[gjs/wip/xulrunner-1.9.3-rebase6: 7/8] dbus: Use separate SetPrototype() call



commit befa94438f269ce48dcf1f0d1264005bf3391084
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 seems to fail; from a reading of the code, what's happening
    is the Object constructor is overriding it.

 modules/dbus.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/modules/dbus.c b/modules/dbus.c
index b0bf2d6..01a6154 100644
--- a/modules/dbus.c
+++ b/modules/dbus.c
@@ -1738,9 +1738,15 @@ 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;
+    /* Separate SetPrototype call since mixing custom prototype with
+     * Object class in ConstructObject seems to fail in 1.9.3.
+     * Really, we should actually be using a custom class for internal
+     * objects like this.
+     */
+    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]