Bug 909340 - Follow up: Fix compartmental tp failures on a CLOSED TREE. (r=bz over IRC)
authorEric Faust <efaustbmo@gmail.com>
Wed, 28 Aug 2013 20:18:13 -0700
changeset 144838 3b5d3af2e2217e4abda77dfb29beb252117bdf68
parent 144837 71af55ce15de30d78487c262b1bc4409bfed2dc3
child 144839 8328d4b74a2e6dd8e635f609be0661ed4759c1e9
push id25176
push userryanvm@gmail.com
push dateThu, 29 Aug 2013 04:20:14 +0000
treeherdermozilla-central@43259182e1a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs909340
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 909340 - Follow up: Fix compartmental tp failures on a CLOSED TREE. (r=bz over IRC)
content/xbl/src/nsXBLProtoImpl.cpp
--- a/content/xbl/src/nsXBLProtoImpl.cpp
+++ b/content/xbl/src/nsXBLProtoImpl.cpp
@@ -153,20 +153,23 @@ 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());
   nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
   JS::Rooted<JS::Value> v(cx);
 
-  // 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.address(),
                                   getter_AddRefs(wrapper));
   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