Bug 991742 part 5. Remove use of the "aScope" argument in binding Wrap() methods. r=bholley
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 08 Apr 2014 18:27:16 -0400
changeset 178030 b94df89242487b3dedd881aa22bbc677911d0aa2
parent 178029 c86f1317b99ccd78c6edb9c0ee0d0a96e8592643
child 178031 c438f7b1d1b5f43b2beedb24359d69f50f918291
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersbholley
bugs991742
milestone31.0a1
Bug 991742 part 5. Remove use of the "aScope" argument in binding Wrap() methods. r=bholley
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -2771,17 +2771,18 @@ class CGWrapNonWrapperCacheMethod(CGAbst
                 Argument(descriptor.nativeType + '*', 'aObject')]
         if descriptor.nativeOwnership == 'owned':
             args.append(Argument('bool*', 'aTookOwnership'))
         CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'JSObject*', args)
         self.properties = properties
 
     def definition_body(self):
         return """%s
-  JS::Rooted<JSObject*> global(aCx, JS_GetGlobalForObject(aCx, aScope));
+  MOZ_ASSERT(js::IsObjectInContextCompartment(aScope, aCx));
+  JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
   JS::Handle<JSObject*> proto = GetProtoObject(aCx, global);
   if (!proto) {
     return nullptr;
   }
 
 %s
 %s
 %s