Back out e46601eb7279:533dc9ea3301 (bug 912322) for Android reftest bustage
authorPhil Ringnalda <philringnalda@gmail.com>
Wed, 04 Sep 2013 21:49:16 -0700
changeset 145999 b2730cc16df13d50feb7722dd4e088366929d0ce
parent 145998 470293fe677c7d4442199cffa8cb5d3bcd6d5f34
child 146000 f6d0b53da118af96a5a59879d33d440c671841e7
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs912322
milestone26.0a1
backs oute46601eb7279c2896af0f178f30dddebe86fae02
Back out e46601eb7279:533dc9ea3301 (bug 912322) for Android reftest bustage
content/base/crashtests/308120-1.xul
content/base/crashtests/330925-1.xhtml
content/base/crashtests/401993-1.html
content/base/test/test_base.xhtml
content/base/test/test_bug330925.xhtml
content/base/test/test_bug372086.html
content/base/test/test_bug444030.xhtml
content/html/content/crashtests/465466-1.xhtml
content/xbl/crashtests/472260-1.xhtml
content/xbl/test/file_bug379959_cross.html
content/xbl/test/file_bug379959_data.html
content/xbl/test/file_bug591198_inner.html
content/xbl/test/test_bug378866.xhtml
content/xbl/test/test_bug468210.xhtml
content/xslt/tests/mochitest/test_bug319374.xhtml
content/xul/content/crashtests/326864-1.xul
content/xul/content/crashtests/384740-1.xul
dom/base/crashtests/404869-1.xul
dom/indexedDB/test/head.js
dom/webidl/Document.webidl
js/xpconnect/crashtests/471366-1.html
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
js/xpconnect/tests/mochitest/Makefile.in
js/xpconnect/tests/mochitest/test_bug912322.html
layout/base/crashtests/379105-1.xhtml
layout/inspector/tests/test_bug522601.xhtml
layout/reftests/bugs/495385-2f.xhtml
layout/reftests/bugs/reftest.list
layout/style/test/test_selectors_on_anonymous_content.html
layout/xul/base/src/crashtests/328135-1.xul
layout/xul/base/src/crashtests/329477-1.xhtml
toolkit/content/tests/widgets/test_popupanchor.xul
--- a/content/base/crashtests/308120-1.xul
+++ b/content/base/crashtests/308120-1.xul
@@ -1,3 +1,3 @@
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="var button=document.getElementsByTagName('button')[0]; try { button.appendChild(SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(button))[0]); } catch(e) { }">
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="var button=document.getElementsByTagName('button')[0]; try { button.appendChild(document.getAnonymousNodes(button)[0]); } catch(e) { }">
   <button/>
 </window>
--- a/content/base/crashtests/330925-1.xhtml
+++ b/content/base/crashtests/330925-1.xhtml
@@ -5,17 +5,17 @@
 <script>
 
 function init()
 {
   var foopy = document.getElementById("foopy");
   var emb = document.getElementById("emb");
 
   try {  
-    foopy.appendChild(SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(emb))[0]);
+    foopy.appendChild(document.getAnonymousNodes(emb)[0]);
     emb.parentNode.removeChild(emb);
     foopy.parentNode.removeChild(foopy);
   } catch (e) {
   }
   
   document.documentElement.removeAttribute("class");
 }
 
--- a/content/base/crashtests/401993-1.html
+++ b/content/base/crashtests/401993-1.html
@@ -6,17 +6,17 @@ function s()
 {
   var x = document.getElementById("x");
   x.style.MozBinding = "url(401993-1.xml#foo)";
   
   setTimeout(boom, 0);
   
   function boom()
   {
-    var nodes = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(x));
+    var nodes = document.getAnonymousNodes(x);
     if (!nodes) {
       setTimeout(boom, 10);
       return;
     }
 
     var newSpan = document.createElement("span");
     newSpan.contentEditable = "true";
     nodes[0].appendChild(newSpan);
--- a/content/base/test/test_base.xhtml
+++ b/content/base/test/test_base.xhtml
@@ -35,17 +35,17 @@ addLoadEvent(function() {
   }
   is(expected.length, 0, "found all expected nodes");
 
   var svgExpected =
     ["http://mochi.test:8888/tests/content/base/test/file_base_xbl.xml",
      "http://mochi.test:8888/tests/content/base/test/file_base_xbl.xml",
      "http://mochi.test:8888/tests/content/base/test/file_base_xbl.xml#shesellsseashellsbytheseashore",
      ];
-  node = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(document.getElementById("bound")))[0];
+  node = document.getAnonymousNodes(document.getElementById("bound"))[0];
   while(node) {
     is(node.baseURI, svgExpected.shift(), "node base");
     node = node.firstChild;
   }
   is(svgExpected.length, 0, "found all expected nodes");
 
   SimpleTest.finish();
 });
--- a/content/base/test/test_bug330925.xhtml
+++ b/content/base/test/test_bug330925.xhtml
@@ -41,31 +41,30 @@ xbl textnode2
 
 // We have to wait until onload because XBL doesn't bind immediately.
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(init);
 
 function init()
 {
   var t = document.getElementById("t");
-  var d = SpecialPowers.wrap(document);
 
-  is(SpecialPowers.unwrap(d.getBindingParent(d.getAnonymousNodes(t)[0])),
+  is(document.getBindingParent(document.getAnonymousNodes(t)[0]), 
      t,
      "Wrong binding parent for anonymous node");
      
-  is(SpecialPowers.unwrap(d.getBindingParent(d.getAnonymousNodes(t)[1].childNodes[0])),
+  is(document.getBindingParent(document.getAnonymousNodes(t)[1].childNodes[0]), 
      t,
      "Wrong binding parent for child of anonymous node");
      
-  is(d.getBindingParent(t), 
+  is(document.getBindingParent(t), 
      null,
      "Non-anonymous node should not have a binding parent");
      
-  is(d.getBindingParent(document.documentElement), 
+  is(document.getBindingParent(document.documentElement), 
      null,
      "Document element should not have a binding parent");
      
   SimpleTest.finish();
 }
 
 ]]>
 </script>
--- a/content/base/test/test_bug372086.html
+++ b/content/base/test/test_bug372086.html
@@ -37,34 +37,34 @@ function runTest() {
   range.setStart(c, 1);
   range.setEnd(c, 3);
   is(range.startContainer, c, "Unexpected start container");
   is(range.startOffset, 1, "Unexpected start offset");
   is(range.endContainer, c, "Unexpected end container");
   is(range.endOffset, 3, "Unexpected end offset");
   is(range.toString(), "bc", "Unexpected range serialization");
 
-  var anon = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes($("d")))[0];
+  var anon = document.getAnonymousNodes($("d"))[0];
   // Should collapse the range, because can't determine order
   range.setEnd(anon, 2);
   is(range.startContainer, anon, "Unexpected collapsed start container");
   is(range.startOffset, 2, "Unexpected collapsed start offset");
   is(range.endContainer, anon, "Unexpected collapsed end container");
   is(range.endOffset, 2, "Unexpected collapsed end offset");
   is(range.toString(), "", "Unexpected collapsed range serialization");
 
   range.setEnd(a, 2);
   range.setStart(a, 0);
   is(range.startContainer, a, "Unexpected start container after");
   is(range.startOffset, 0, "Unexpected start offset after");
   is(range.endContainer, a, "Unexpected end container after");
   is(range.endOffset, 2, "Unexpected end offset after");
   is(range.toString(), "de", "Unexpected range serialization after");
 
-  anon = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes($("d")))[2];
+  anon = document.getAnonymousNodes($("d"))[2];
   // Collapses because one endpoint is anonymous from point of view of
   // the other.  
   range.setStart(anon, 1);
   is(range.startContainer, anon, "Unexpected newly collapsed start container");
   is(range.startOffset, 1, "Unexpected newly collapsed start offset");
   is(range.endContainer, anon, "Unexpected newly collapsed end container");
   is(range.endOffset, 1, "Unexpected newly collapsed end offset");
   is(range.toString(), "", "Unexpected collapsed range serialization");
--- a/content/base/test/test_bug444030.xhtml
+++ b/content/base/test/test_bug444030.xhtml
@@ -21,17 +21,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 /** Test for Bug 444030 **/
 
 function doTest() {
-  var anonTextNode = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(document.getElementById("boundElement")))[0];
+  var anonTextNode = document.getAnonymousNodes(document.getElementById("boundElement"))[0];
   var hadException = false;
   try {
     var wholeText = anonTextNode.wholeText;
   } catch(e) {
     hadException = true;
   }
   ok(hadException,
      "Should have got an exception when using .wholeText with a text node child of the binding parent");
--- a/content/html/content/crashtests/465466-1.xhtml
+++ b/content/html/content/crashtests/465466-1.xhtml
@@ -6,17 +6,17 @@
 </binding></bindings>
 
 
 <script type="text/javascript">
 
 function boom()
 {
   var f = document.getElementById("f");
-  var anon = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(f))[0];
+  var anon = document.getAnonymousNodes(f)[0];
   document.body.removeChild(f);
   anon.appendChild(document.createElement("label"));
 }
 
 </script>
 </head>
 
 <body onload="boom();"><form id="f" style="-moz-binding: url(#u);"><label></label></form></body>
--- a/content/xbl/crashtests/472260-1.xhtml
+++ b/content/xbl/crashtests/472260-1.xhtml
@@ -7,17 +7,17 @@
 </bindings>
 
 <script type="text/javascript">
 // <![CDATA[
 
 function boom()
 {
   var bo = document.getElementById("bo");
-  var anon = SpecialPowers.wrap(document).getAnonymousNodes(bo)[0];
+  var anon = document.getAnonymousNodes(bo)[0];
 
   bo.style.MozBinding = "url(#bar)";
 
   var fr = document.createElementNS("http://www.w3.org/1999/xhtml", "iframe");
   fr.setAttribute("src", "javascript:void 0;"); 
   anon.appendChild(fr);
   
   document.documentElement.removeAttribute("class");
--- a/content/xbl/test/file_bug379959_cross.html
+++ b/content/xbl/test/file_bug379959_cross.html
@@ -11,15 +11,15 @@
   -moz-binding: url(http://example.com/tests/content/xbl/test/file_bug379959_xbl.xml#xbltest);
 }
 </style>
 <body>
 <div id="div1"></div>
 <div id="div2"></div>
 <script>
 onload = function() {
-  nodes = SpecialPowers.wrap(document).getAnonymousNodes(document.getElementById('div1'));
+  nodes = document.getAnonymousNodes(document.getElementById('div1'));
   parent.postMessage(nodes ? nodes.length : 0, "http://mochi.test:8888");
-  nodes = SpecialPowers.wrap(document).getAnonymousNodes(document.getElementById('div2'));
+  nodes = document.getAnonymousNodes(document.getElementById('div2'));
   parent.postMessage(nodes ? nodes.length : 0, "http://mochi.test:8888");
 }
 </script>
 </html>
--- a/content/xbl/test/file_bug379959_data.html
+++ b/content/xbl/test/file_bug379959_data.html
@@ -6,13 +6,13 @@
   color: green;
   -moz-binding: url(data:text/xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cbindings%20id%3D%22xbltestBindings%22%20xmlns%3D%22http%3A//www.mozilla.org/xbl%22%3E%0A%20%20%3Cbinding%20id%3D%22xbltest%22%3E%3Ccontent%3EPASS%3C/content%3E%3C/binding%3E%0A%3C/bindings%3E%0A);
 }
 </style>
 <body>
 <div id="d"></div>
 <script>
 onload = function() {
-  nodes = SpecialPowers.wrap(document).getAnonymousNodes(document.getElementById('d'));
+  nodes = document.getAnonymousNodes(document.getElementById('d'));
   parent.postMessage(nodes ? nodes.length : 0, "http://mochi.test:8888");
 }
 </script>
 </html>
--- a/content/xbl/test/file_bug591198_inner.html
+++ b/content/xbl/test/file_bug591198_inner.html
@@ -17,17 +17,17 @@ function sendResults() {
 
   ps = document.getElementsByTagName('span');
   for (var i = 0; i < ps.length; i++) {
     res.widths.push(ps[i].offsetWidth);
   }
   
   try {
     res.anonChildCount =
-      SpecialPowers.wrap(document).getAnonymousNodes(document.getElementById('b')).length;
+      document.getAnonymousNodes(document.getElementById('b')).length;
   }
   catch (ex) {}
 
   parent.postMessage(JSON.stringify(res), "*");
 }
     </script>
   </head>
   <body onload="sendResults();">
--- a/content/xbl/test/test_bug378866.xhtml
+++ b/content/xbl/test/test_bug378866.xhtml
@@ -28,17 +28,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 /** Test for Bug 378866 **/
 
 function runTest() {
-  var anon = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(document.getElementById('grandparent')));
+  var anon = document.getAnonymousNodes(document.getElementById('grandparent'));
   var child = document.getElementById('child');
   var insertionPoint = anon[0].childNodes[0];
   insertionPoint.parentNode.removeChild(insertionPoint);
   child.appendChild(insertionPoint);
 
   var e = document.createEvent("Event");
   e.initEvent("foo", true, true);
   child.dispatchEvent(e);
--- a/content/xbl/test/test_bug468210.xhtml
+++ b/content/xbl/test/test_bug468210.xhtml
@@ -27,17 +27,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <![CDATA[
 
 /** Test for Bug 468210 **/
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(function() {
   var div = $("d");
   var n = document.anchors.length;
   is(n, 1, "Unexpected number of anchors");
-  var anon = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(div))[0];
+  var anon = document.getAnonymousNodes(div)[0];
   is(anon instanceof HTMLSpanElement, true, "Unexpected node");
   is(anon.parentNode, div, "Unexpected parent");
   document.body.appendChild(div);
   is(anon.parentNode, null, "Parent should have become null");
   // An attr set to test notifications
   anon.setAttribute("h", "i");
 });
 addLoadEvent(SimpleTest.finish);
--- a/content/xslt/tests/mochitest/test_bug319374.xhtml
+++ b/content/xslt/tests/mochitest/test_bug319374.xhtml
@@ -26,48 +26,45 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 /** Test for Bug 319374 **/
 
   function testChangesInAnonymousTree() {
     // Test 1: Make sure that modifying anonymous content doesn't 
     //         cause non-anonymous XPath result to throw exceptions..
     var counter = 0;
     var error = null;
-    function getAnonymousNodes(e) {
-      return SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(e));
-    }
     try {
       var xp = new XPathEvaluator();
       var result = xp.evaluate("*",
                                document.getElementById('content'),
                                null,
                                SpecialPowers.Ci.nsIDOMXPathResult.
                                  UNORDERED_NODE_ITERATOR_TYPE,
                                null);
       var res = null;
       while (res = result.iterateNext()) {
         ++counter; 
-        var anon = getAnonymousNodes(res);
+        var anon = document.getAnonymousNodes(res);
         anon[0].removeChild(anon[0].firstChild); // Removing a child node
         anon[0].removeAttribute("attr1"); // Removing an attribute
         anon[1].firstChild.data = "anon text changed" // Modifying text data
       }
     } catch (e) {
       error = e;
     }
     ok(!error, error);
     ok(counter == 3, "XPathEvaluator should have found 3 elements.")
 
     // Test 2: If the context node is in anonymous content, changing some
     //         other anonymous tree shouldn't cause XPath result to throw.
     var anonAttr1 =
-      getAnonymousNodes(document.getElementById('content').
+      document.getAnonymousNodes(document.getElementById('content').
         firstChild)[0].getAttributeNode('attr');
     var anonAttr2 =
-      getAnonymousNodes(document.getElementById('content').
+      document.getAnonymousNodes(document.getElementById('content').
         lastChild)[0].getAttributeNode('attr');
     var resultAttr = null;
     try {
       var xp2 = xp.evaluate(".",
                             anonAttr1,
                             null,
                             SpecialPowers.Ci.nsIDOMXPathResult.
                               UNORDERED_NODE_ITERATOR_TYPE,
--- a/content/xul/content/crashtests/326864-1.xul
+++ b/content/xul/content/crashtests/326864-1.xul
@@ -1,27 +1,23 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
 
 <script>
 
-function getAnonymousNodes(e) {
-  return SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(e));
-}
-
 function init()
 {
   var tt = document.getElementById("textbox");
-  var hb = getAnonymousNodes(tt)[0]; // hbox
-  var men = getAnonymousNodes(hb)[1]; // menupopup
+  var hb = document.getAnonymousNodes(tt)[0]; // hbox
+  var men = document.getAnonymousNodes(hb)[1]; // menupopup
   var menitem = men.childNodes[0]; // menuitem
-  var hb2 = getAnonymousNodes(menitem)[1]; // hbox
+  var hb2 = document.getAnonymousNodes(menitem)[1]; // hbox
   var label2 = hb2.childNodes[0]; // label
 
   men.menu = null;
   label2.click();
 }
 
 window.addEventListener("load", init, false);
 
--- a/content/xul/content/crashtests/384740-1.xul
+++ b/content/xul/content/crashtests/384740-1.xul
@@ -7,17 +7,17 @@
 <script>
 
 function boom()
 {
   var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
   var scrollbar = document.createElementNS(XUL_NS, 'scrollbar');
   document.documentElement.appendChild(scrollbar);
-  var sbb = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(scrollbar))[0];
+  var sbb = document.getAnonymousNodes(scrollbar)[0];
   var action = document.createElementNS(XUL_NS, 'action');
   action.setAttribute('datasources', "");
   sbb.appendChild(action);
 }
 
 </script>
 
 </window>
--- a/dom/base/crashtests/404869-1.xul
+++ b/dom/base/crashtests/404869-1.xul
@@ -5,17 +5,17 @@
   <binding id="empty"><content></content></binding>
 </bindings>
 
 <script type="text/javascript">
 
 function boom()
 {
   var menupopup = document.getElementById("menupopup");
-  var x = SpecialPowers.wrap(document).getAnonymousNodes(menupopup)[0];
+  var x = document.getAnonymousNodes(menupopup)[0];
   menupopup.style.MozBinding = "url('#empty')";
   for (var ppp in x) {
   }
 }
 
 </script>
 
 <menupopup id="menupopup"/>
--- a/dom/indexedDB/test/head.js
+++ b/dom/indexedDB/test/head.js
@@ -55,17 +55,17 @@ function triggerSecondaryCommand(popup, 
 {
   info("triggering secondary command, " + index);
   let notifications = popup.childNodes;
   ok(notifications.length > 0, "at least one notification displayed");
   let notification = notifications[0];
 
   // Cancel the arrow panel slide-in transition (bug 767133) such that
   // it won't interfere with us interacting with the dropdown.
-  SpecialPowers.wrap(document).getAnonymousNodes(popup)[0].style.transition = "none";
+  document.getAnonymousNodes(popup)[0].style.transition = "none";
 
   notification.button.focus();
 
   popup.addEventListener("popupshown", function () {
     popup.removeEventListener("popupshown", arguments.callee, false);
 
     // Press down until the desired command is selected
     for (let i = 0; i <= index; i++)
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -272,24 +272,21 @@ partial interface Document {
   //(Not implemented)Element?  find(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
   //(Not implemented)NodeList  findAll(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
 };
 
 //  Mozilla extensions of various sorts
 partial interface Document {
   // nsIDOMDocumentXBL.  Wish we could make these [ChromeOnly], but
   // that would likely break bindings running with the page principal.
-  [Func="IsChromeOrXBL"]
   NodeList? getAnonymousNodes(Element elt);
-  [Func="IsChromeOrXBL"]
   Element? getAnonymousElementByAttribute(Element elt, DOMString attrName,
                                           DOMString attrValue);
-  [Func="IsChromeOrXBL"]
   Element? getBindingParent(Node node);
-  [Throws, Func="IsChromeOrXBL"]
+  [Throws]
   void loadBindingDocument(DOMString documentURL);
 
   // nsIDOMDocumentTouch
   // XXXbz I can't find the sane spec for this stuff, so just cribbing
   // from our xpidl for now.
   [Creator, Func="nsGenericHTMLElement::TouchEventsEnabled"]
   Touch createTouch(optional Window? view = null,
                     optional EventTarget? target = null,
--- a/js/xpconnect/crashtests/471366-1.html
+++ b/js/xpconnect/crashtests/471366-1.html
@@ -1,12 +1,12 @@
 <!DOCTYPE html>
 <html>
 <head>
 <script type="text/javascript">
 
-SpecialPowers.wrap(document).getAnonymousNodes({__proto__: XPCNativeWrapper.prototype});
+document.getAnonymousNodes({__proto__: XPCNativeWrapper.prototype});
 
 </script>
 </head>
 <body>
 </body>
 </html>
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -261,25 +261,16 @@ XPCWrappedNativeScope::EnsureXBLScope(JS
 
     // Tag it.
     EnsureCompartmentPrivate(js::UncheckedUnwrap(mXBLScope))->scope->mIsXBLScope = true;
 
     // Good to go!
     return mXBLScope;
 }
 
-bool
-XPCWrappedNativeScope::AllowXBLScope()
-{
-    // We only disallow XBL scopes in remote XUL situations.
-    MOZ_ASSERT_IF(!mAllowXBLScope,
-                  nsContentUtils::AllowXULXBLForPrincipal(GetPrincipal()));
-    return mAllowXBLScope;
-}
-
 namespace xpc {
 JSObject *GetXBLScope(JSContext *cx, JSObject *contentScopeArg)
 {
     JS::RootedObject contentScope(cx, contentScopeArg);
     JSAutoCompartment ac(cx, contentScope);
     JSObject *scope = EnsureCompartmentPrivate(contentScope)->scope->EnsureXBLScope(cx);
     NS_ENSURE_TRUE(scope, nullptr); // See bug 858642.
     scope = js::UncheckedUnwrap(scope);
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -1705,21 +1705,15 @@ JS_EXPORT_API(void) DumpCompleteHeap()
 
 namespace mozilla {
 namespace dom {
 
 bool
 IsChromeOrXBL(JSContext* cx, JSObject* /* unused */)
 {
     MOZ_ASSERT(NS_IsMainThread());
-    JSCompartment* c = js::GetContextCompartment(cx);
-
-    // For remote XUL, we run XBL in the XUL scope. Given that we care about
-    // compat and not security for remote XUL, we just always claim to be XBL.
-    //
-    // Note that, for performance, we don't check AllowXULXBLForPrincipal here,
-    // and instead rely on the fact that AllowXBLScope() only returns false in
-    // remote XUL situations.
-    return AccessCheck::isChrome(c) || IsXBLScope(c) || !AllowXBLScope(c);
+    JSCompartment* compartment = js::GetContextCompartment(cx);
+    return AccessCheck::isChrome(compartment) ||
+           IsXBLScope(compartment);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -1408,17 +1408,17 @@ public:
     // object is wrapped into the compartment of the global.
     JSObject *EnsureXBLScope(JSContext *cx);
 
     XPCWrappedNativeScope(JSContext *cx, JS::HandleObject aGlobal);
 
     nsAutoPtr<JSObject2JSObjectMap> mWaiverWrapperMap;
 
     bool IsXBLScope() { return mIsXBLScope; }
-    bool AllowXBLScope();
+    bool AllowXBLScope() { return mAllowXBLScope; }
 
 protected:
     virtual ~XPCWrappedNativeScope();
 
     static void KillDyingScopes();
 
     XPCWrappedNativeScope(); // not implemented
 
@@ -1444,27 +1444,30 @@ private:
     JS::ObjectPtr                    mXBLScope;
 
     XPCContext*                      mContext;
 
     nsAutoPtr<DOMExpandoSet> mDOMExpandoSet;
 
     bool mIsXBLScope;
 
-    // For remote XUL domains, we run all XBL in the content scope for compat
-    // reasons (though we sometimes pref this off for automation). We separately
+    // There are certain cases where we explicitly disallow XBL scopes: they
+    // can be prefed off, or we might be running in a remote XUL domain where
+    // we want to run all XBL in content to maintain compat. We separately
     // track the result of this decision (mAllowXBLScope), from the decision
     // of whether to actually _use_ an XBL scope (mUseXBLScope), which depends
     // on the type of global and whether the compartment is system principal
     // or not.
     //
-    // This distinction is useful primarily because, if true, we know that we
-    // have no way of distinguishing XBL script from content script for the
-    // given scope. In these (unsupported) situations, we just always claim to
-    // be XBL.
+    // This distinction is useful primarily because it tells us whether we
+    // can infer the XBL-ness of a caller by checking that the caller is
+    // running in an XBL scope, or whether we need to check the XBL bit on the
+    // script. The XBL bit is nasty, so we want to consult it only if we
+    // absolutely have to, which should generally happen only in unsupported
+    // pref configurations.
     bool mAllowXBLScope;
     bool mUseXBLScope;
 };
 
 /***************************************************************************/
 // XPCNativeMember represents a single idl declared method, attribute or
 // constant.
 
--- a/js/xpconnect/tests/mochitest/Makefile.in
+++ b/js/xpconnect/tests/mochitest/Makefile.in
@@ -82,14 +82,13 @@ MOCHITEST_FILES =	chrome_wrappers_helper
 		file_bug802557.html \
 		test_bug803730.html \
 		test_bug809547.html \
 		test_bug829872.html \
 		test_bug862380.html \
 		test_bug865260.html \
 		test_bug870423.html \
 		test_bug871887.html \
-		test_bug912322.html \
 		file_crosscompartment_weakmap.html \
 		test_crosscompartment_weakmap.html \
 		test_asmjs.html \
 		file_asmjs.js \
 		$(NULL)
deleted file mode 100644
--- a/js/xpconnect/tests/mochitest/test_bug912322.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=912322
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 912322</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript">
-
-  /** Test that XBL functions aren't exposed to the web. **/
-  funs = ['getAnonymousNodes', 'getAnonymousElementByAttribute',
-          'getBindingParent', 'loadBindingDocument'];
-  for (var f of funs) {
-    ok(!(f in document), f + " should not be available to content");
-    ok(f in SpecialPowers.wrap(document), f + " should be available to chrome via Xray");
-  }
-
-
-
-
-  </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=912322">Mozilla Bug 912322</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-</pre>
-</body>
-</html>
--- a/layout/base/crashtests/379105-1.xhtml
+++ b/layout/base/crashtests/379105-1.xhtml
@@ -20,17 +20,17 @@ function boom1()
 {
   xbltarget = document.getElementById("xbltarget");
   xbltarget.style.MozBinding = "url('#x')";
   setTimeout(boom2, 0);
 }
 
 function boom2()
 {
-  var nodes = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(xbltarget));
+  var nodes = document.getAnonymousNodes(xbltarget);
   if (!nodes) {
     setTimeout(boom2, 10);
     return;
   }
   var anox = nodes[0];
   var frame = document.createElementNS("http://www.w3.org/1999/xhtml", "frame")
   frame.src = "data:text/html,<html><body>Hi!</body></html>";
   anox.appendChild(frame);
--- a/layout/inspector/tests/test_bug522601.xhtml
+++ b/layout/inspector/tests/test_bug522601.xhtml
@@ -101,17 +101,17 @@ addLoadEvent(function() {
   testFunc(walkerNonAnon, "previousNode", $("s"), "step back to span");
   testFunc(walkerNonAnon, "previousNode", $("s").previousSibling,
            "step back to some text");
   testFunc(walkerNonAnon, "previousNode", $("display"),
            "step back to root");
   testFunc(walkerNonAnon, "previousNode", null,
            "step back past root");
 
-  var anonDiv = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes($("display")))[0];
+  var anonDiv = document.getAnonymousNodes($("display"))[0];
 
   var walkerAnon =
     SpecialPowers.Cc["@mozilla.org/inspector/deep-tree-walker;1"]
               .createInstance(SpecialPowers.Ci.inIDeepTreeWalker);
   walkerAnon.showAnonymousContent = true;
   walkerAnon.init($("display"), NodeFilter.SHOW_ALL);
 
   is(SpecialPowers.unwrap(walkerAnon.currentNode), $("display"), "Unexpected anon root");
--- a/layout/reftests/bugs/495385-2f.xhtml
+++ b/layout/reftests/bugs/495385-2f.xhtml
@@ -8,41 +8,31 @@
   <binding id="after">
     <content><children/>Kitty</content>
   </binding>
   <binding id="empty1">
     <content><div xmlns="http://www.w3.org/1999/xhtml">Hello</div><children/></content>
   </binding>
   <binding id="empty2">
     <content><children/><div xmlns="http://www.w3.org/1999/xhtml">Kitty</div></content>
-    <implementation>
-      <constructor>
-        // We used to do this in an onload handler, but getAnonymousNodes is no
-        // longer accessible to content, and we can't use SpecialPowers in
-        // reftests. So we enable XBL scopes and take advantage of the fact that XBL
-        // scopes can access these functions. We apply this binding
-        // programatically to make absolutely sure this constructor runs after all the
-        // other bindings have been set up.
-        document.body.offsetHeight;
-        document.getAnonymousNodes(document.getElementById("d3"))[0].style.display = 'inline';
-        document.getAnonymousNodes(document.getElementById("d4"))[2].style.display = 'inline';
-      </constructor>
-    </implementation>
   </binding>
 </bindings>
 <style>
 body > div { border:1px solid black; margin:1em;
              font-family:sans-serif; letter-spacing:2px; }
 #d1 { -moz-binding:url(#before); }
 #d2 { -moz-binding:url(#after); }
 #d3 { -moz-binding:url(#empty1); }
+#d4 { -moz-binding:url(#empty2); }
 </style>
 <script>
 function loaded() {
-  document.getElementById('d4').style.MozBinding = "url(#empty2)";
+  document.body.offsetHeight;
+  document.getAnonymousNodes(document.getElementById("d3"))[0].style.display = 'inline';
+  document.getAnonymousNodes(document.getElementById("d4"))[2].style.display = 'inline';
 }
 </script>
 </head>
 <body onload="loaded()">
   <div id="d1"> <span>Kitty</span></div>
   <div id="d2"><span>Hello</span> </div>
   <div id="d3"> <span>Kitty</span></div>
   <div id="d4"><span>Hello</span> </div>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1365,17 +1365,17 @@ fails-if(Android) == 488685-1.html 48868
 == 495385-1d.html 495385-1-ref.html
 == 495385-1e.html 495385-1-ref.html
 == 495385-1f.html 495385-1-ref.html
 == 495385-2a.html 495385-2-ref.html
 == 495385-2b.html 495385-2-ref.html
 == 495385-2c.html 495385-2-ref.html
 == 495385-2d.html 495385-2-ref.html
 == 495385-2e.html 495385-2-ref.html
-pref(dom.use_xbl_scopes_for_remote_xul,true) == 495385-2f.xhtml 495385-2-ref.html
+== 495385-2f.xhtml 495385-2-ref.html
 == 495385-2g.html 495385-2-ref.html
 == 495385-2h.html 495385-2-ref.html
 == 495385-2i.html 495385-2-ref.html
 == 495385-3.html 495385-3-ref.html
 == 495385-4.html 495385-4-ref.html
 == 495385-5.html 495385-5-ref.html
 asserts(1) == 496032-1.html 496032-1-ref.html # bug 399262
 == 496840-1.html 496840-1-ref.html
--- a/layout/style/test/test_selectors_on_anonymous_content.html
+++ b/layout/style/test/test_selectors_on_anonymous_content.html
@@ -37,17 +37,17 @@ function run() {
     var gCounter = 0;
 
     function test_selector(selector, matches_docdiv, matches_anondiv)
     {
         var zi = ++gCounter;
         style_text.data = selector + "{ z-index: " + zi + " }";
 
         var doc_div = document.getElementById("display");
-        var anon_div = SpecialPowers.unwrap(SpecialPowers.wrap(document).getAnonymousNodes(doc_div))[0];
+        var anon_div = document.getAnonymousNodes(doc_div)[0];
         var should_match = [];
         var should_not_match = [];
         (matches_docdiv ? should_match : should_not_match).push(doc_div);
         (matches_anondiv ? should_match : should_not_match).push(anon_div);
 
         for (var i = 0; i < should_match.length; ++i) {
             var e = should_match[i];
             is(getComputedStyle(e, "").zIndex, zi,
--- a/layout/xul/base/src/crashtests/328135-1.xul
+++ b/layout/xul/base/src/crashtests/328135-1.xul
@@ -4,17 +4,17 @@
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
 
 
 <script>
 
 function init() { 
   var pop = document.getElementsByTagName("popup")[0];
-  SpecialPowers.wrap(document).getAnonymousNodes(pop)[0];
+  document.getAnonymousNodes(pop)[0];
   eval.eee = document.documentElement;
 };
 
 
 window.addEventListener("load", init, false);
 
 </script>
 
--- a/layout/xul/base/src/crashtests/329477-1.xhtml
+++ b/layout/xul/base/src/crashtests/329477-1.xhtml
@@ -4,18 +4,18 @@
 <script>
 
 <![CDATA[
 
 
 function init() 
 { 
   var textbox = document.getElementsByTagName("textbox")[0];
-  var hbox = SpecialPowers.wrap(document).getAnonymousNodes(textbox)[0];
-  var menupopup = SpecialPowers.wrap(document).getAnonymousNodes(hbox)[1];
+  var hbox = document.getAnonymousNodes(textbox)[0];
+  var menupopup = document.getAnonymousNodes(hbox)[1];
 
   menupopup.click();
 }
 
 window.addEventListener("load", init, false);
 
 ]]>
 </script>
--- a/toolkit/content/tests/widgets/test_popupanchor.xul
+++ b/toolkit/content/tests/widgets/test_popupanchor.xul
@@ -378,17 +378,17 @@ function runTests() {
   runNextTest();
 }
 
 SimpleTest.waitForExplicitFinish();
 
 addEventListener("load", function() {
   // anchor is set by the test runner above
   panel = document.getElementById("testPanel");
-  arrow = SpecialPowers.wrap(document).getAnonymousElementByAttribute(panel, "anonid", "arrow");
+  arrow = document.getAnonymousElementByAttribute(panel, "anonid", "arrow");
   // Cancel the arrow panel slide-in transition (bug 767133) so the size and
   // position are "stable" enough to test without jumping through hoops...
   arrow.style.transition = "none";
   runTests();
 });
 
 ]]>
 </script>