[gjs/wip/xulrunner-1.9.3-rebase7: 6/13] dbus: Use separate SetPrototype() call



commit b0bea2857be7caaa8079d96aadb3df03423e9e12
Author: Colin Walters <walters verbum org>
Date:   Tue Sep 21 10:55:22 2010 -0400

    dbus: Use separate SetPrototype() call
    
    In XULRunner 1.9.3, passing a custom prototype to JS_ConstructObject
    for Object fails, so work around with a separate call to SetPrototype().
    See https://bugzilla.mozilla.org/show_bug.cgi?id=599651.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=622896

 modules/dbus.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/modules/dbus.c b/modules/dbus.c
index b0bf2d6..561105d 100644
--- a/modules/dbus.c
+++ b/modules/dbus.c
@@ -1738,9 +1738,16 @@ define_bus_object(JSContext  *context,
     bus_val = JSVAL_VOID;
     JS_AddValueRoot(context, &bus_val);
 
-    bus_obj = JS_ConstructObject(context, NULL, proto_obj, NULL);
+    bus_obj = JS_ConstructObject(context, NULL, NULL, NULL);
     if (bus_obj == NULL)
         goto out;
+    /* We need to use a separate call to SetPrototype to work
+     * around a SpiderMonkey bug where with clasp=NULL, the
+     * parent and proto arguments to JS_ConstructObject are
+     * lost.
+     * https://bugzilla.mozilla.org/show_bug.cgi?id=599651
+     */
+    JS_SetPrototype(context, bus_obj, proto_obj);
 
     bus_val = OBJECT_TO_JSVAL(bus_obj);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]