Bug 963701 - Unscope the JSAutoCompartment in InitTargetObjects. r=bz
authorAndrew McCreight <continuation@gmail.com>
Fri, 24 Jan 2014 15:01:48 -0800
changeset 175397 3664a7e8db93e67844b33715183066327e695d7b
parent 175396 8780eb7816322cb7727553296f2f2dab1c256244
child 175398 bb900e8085fdd2e3fc21f7002ad3e3c490577cfb
push idunknown
push userunknown
push dateunknown
reviewersbz
bugs963701
milestone29.0a1
Bug 963701 - Unscope the JSAutoCompartment in InitTargetObjects. r=bz
dom/xbl/nsXBLProtoImpl.cpp
--- a/dom/xbl/nsXBLProtoImpl.cpp
+++ b/dom/xbl/nsXBLProtoImpl.cpp
@@ -167,23 +167,21 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLP
   }
 
   // Because our prototype implementation has a class, we need to build up a corresponding
   // class for the concrete implementation in the bound document.
   AutoJSContext cx;
   JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
   JS::Rooted<JS::Value> v(cx);
 
-  {
-    JSAutoCompartment ac(cx, global);
-    // Make sure the interface object is created before the prototype object
-    // so that XULElement is hidden from content. See bug 909340.
-    bool defineOnGlobal = dom::XULElementBinding::ConstructorEnabled(cx, global);
-    dom::XULElementBinding::GetConstructorObject(cx, global, defineOnGlobal);
-  }
+  JSAutoCompartment ac(cx, global);
+  // Make sure the interface object is created before the prototype object
+  // so that XULElement is hidden from content. See bug 909340.
+  bool defineOnGlobal = dom::XULElementBinding::ConstructorEnabled(cx, global);
+  dom::XULElementBinding::GetConstructorObject(cx, global, defineOnGlobal);
 
   rv = nsContentUtils::WrapNative(cx, global, aBoundElement, &v);
   NS_ENSURE_SUCCESS(rv, rv);
 
   JS::Rooted<JSObject*> value(cx, &v.toObject());
 
   // All of the above code was just obtaining the bound element's script object and its immediate
   // concrete base class.  We need to alter the object so that our concrete class is interposed