aboutsummaryrefslogtreecommitdiffstats
path: root/www/firefox/files/patch-ff-479560
blob: 2609935bbdc95c167f82121eaa59780506b24f87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
diff -up mozilla/js/src/xpconnect/src/xpcprivate.h.479560 mozilla/js/src/xpconnect/src/xpcprivate.h
--- js/src/xpconnect/src/xpcprivate.h.479560    2008-03-22 09:04:17.000000000 +0100
+++ js/src/xpconnect/src/xpcprivate.h   2009-05-13 14:56:10.000000000 +0200
@@ -2167,7 +2167,7 @@ private:
     nsXPCWrappedJSClass(XPCCallContext& ccx, REFNSIID aIID,
                         nsIInterfaceInfo* aInfo);
 
-    JSObject*  NewOutObject(JSContext* cx);
+    JSObject*  NewOutObject(JSContext* cx, JSObject* scope);
 
     JSBool IsReflectable(uint16 i) const
         {return (JSBool)(mDescriptors[i/32] & (1 << (i%32)));}
diff -up mozilla/js/src/xpconnect/src/xpcwrappedjsclass.cpp.479560 mozilla/js/src/xpconnect/src/xpcwrappedjsclass.cpp
--- js/src/xpconnect/src/xpcwrappedjsclass.cpp.479560   2007-06-30 01:21:28.000000000 +0200
+++ js/src/xpconnect/src/xpcwrappedjsclass.cpp  2009-05-13 14:51:35.000000000 +0200
@@ -1338,7 +1338,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWra
         if(param.IsOut())
         {
             // create an 'out' object
-            JSObject* out_obj = NewOutObject(cx);
+            JSObject* out_obj = NewOutObject(cx, obj);
             if(!out_obj)
             {
                 retval = NS_ERROR_OUT_OF_MEMORY;
@@ -1706,9 +1706,9 @@ nsXPCWrappedJSClass::GetInterfaceName()
 }
 
 JSObject*
-nsXPCWrappedJSClass::NewOutObject(JSContext* cx)
+nsXPCWrappedJSClass::NewOutObject(JSContext* cx, JSObject* scope)
 {
-    return JS_NewObject(cx, nsnull, nsnull, nsnull);
+    return JS_NewObject(cx, nsnull, nsnull, JS_GetGlobalForObject(cx, scope));
 }
 
 
diff -up mozilla/js/src/jsapi.c.old mozilla/js/src/jsapi.c
--- js/src/jsapi.c.old  2009-05-13 15:13:20.000000000 +0200
+++ js/src/jsapi.c  2009-05-13 15:13:32.000000000 +0200
@@ -122,6 +122,16 @@ JS_GetPositiveInfinityValue(JSContext *c
     return DOUBLE_TO_JSVAL(cx->runtime->jsPositiveInfinity);
 }
 
+JS_PUBLIC_API(JSObject *)
+JS_GetGlobalForObject(JSContext *cx, JSObject *obj)
+{
+    JSObject *parent;
+
+    while ((parent = OBJ_GET_PARENT(cx, obj)) != NULL)
+        obj = parent;
+    return obj;
+}
+
 JS_PUBLIC_API(jsval)
 JS_GetEmptyStringValue(JSContext *cx)
 {
diff -up mozilla/js/src/jsapi.h.old mozilla/js/src/jsapi.h
--- js/src/jsapi.h.old  2009-05-13 15:13:20.000000000 +0200
+++ js/src/jsapi.h  2009-05-13 15:13:32.000000000 +0200
@@ -668,6 +668,9 @@ JS_DumpNamedRoots(JSRuntime *rt,
                   void *data);
 #endif
 
+extern JS_PUBLIC_API(JSObject *)
+JS_GetGlobalForObject(JSContext *cx, JSObject *obj);
+
 /*
  * Call JS_MapGCRoots to map the GC's roots table using map(rp, name, data).
  * The root is pointed at by rp; if the root is unnamed, name is null; data is