Bug 834699 - Fix tests that munge dom.xbl_scopes. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Thu, 02 May 2013 16:02:04 -0700
changeset 130686 e4074e65f6e2
parent 130685 d56decca3e60
child 130687 c6f5c1bbcf76
push id24629
push useremorley@mozilla.com
push dateFri, 03 May 2013 12:33:32 +0000
treeherdermozilla-central@5c240ee646fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs834699
milestone23.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 834699 - Fix tests that munge dom.xbl_scopes. r=bz
content/base/test/test_xbl_userdata.xhtml
content/xbl/test/test_bug821850.html
--- a/content/base/test/test_xbl_userdata.xhtml
+++ b/content/base/test/test_xbl_userdata.xhtml
@@ -27,45 +27,28 @@
 <script class="testbody">
 <![CDATA[
 "use strict";
 
 var url = 'data:text/html;charset=utf-8,' +
           encodeURIComponent('<div id=t style="-moz-binding:url(' + location + '#xbl)"></div>');
 
 SimpleTest.waitForExplicitFinish();
-addLoadEvent(function() {
-  SpecialPowers.pushPrefEnv({set: [['dom.xbl_scopes', true]]}, test1);
-});
+addLoadEvent(test1);
 
 function test1() {
   var iframe = document.createElement('iframe');
   iframe.src = url;
   iframe.onload = function() {
     var t = iframe.contentWindow.t;
     is(!!(t.getUserData || t.setUserData), false,
        "getUserData and setUserData should not be visible from the regular content");
     is(t.textContent, "true",
        "getUserData and setUserData should be visible from XBL");
     document.body.removeChild(iframe);
-    SpecialPowers.pushPrefEnv({set: [['dom.xbl_scopes', false]]}, test2);
-  };
-  document.body.appendChild(iframe);
-}
-
-function test2() {
-  var iframe = document.createElement('iframe');
-  iframe.src = url;
-  iframe.onload = function() {
-    var t = iframe.contentWindow.t;
-    is(!!(t.getUserData && t.setUserData), true,
-       "getUserData and setUserData is visible if XBL scopes are disabled");
-    is(t.textContent, "true",
-       "getUserData and setUserData should be visible from XBL");
-    document.body.removeChild(iframe);
     SimpleTest.finish();
   };
   document.body.appendChild(iframe);
 }
 
 ]]>
 </script>
 </pre>
--- a/content/xbl/test/test_bug821850.html
+++ b/content/xbl/test/test_bug821850.html
@@ -8,24 +8,23 @@ https://bugzilla.mozilla.org/show_bug.cg
   <title>Test for Bug 821850</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 for XBL scope behavior. **/
   SimpleTest.waitForExplicitFinish();
 
-  // The XBL scope pref is read when a global is constructed, so we need to set
-  // it before loading the test.
+  // Embed the real test. It will take care of everything else.
+  //
+  // NB: This two-layer setup used to exist because XBL scopes were behind a
+  // pref, and we wanted to make sure that we properly set the pref before
+  // loading the real test. This stuff is no longer behind a pref, but we just
+  // leave the structure as-is for expediency.
   function setup() {
-    SpecialPowers.pushPrefEnv({set: [['dom.xbl_scopes', true]] }, continueSetup);
-  }
-
-  // Embed the real test. It will take care of everything else.
-  function continueSetup() {
     $('ifr').setAttribute('src', 'file_bug821850.xhtml');
   }
 
   </script>
 </head>
 <body onload="setup();">
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=821850">Mozilla Bug 821850</a>
 <p id="display"></p>