Bug 857356 - Convert field-y XBL tests to run with dom.use_xbl_scopes_for_remote_xul=false. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Thu, 09 May 2013 09:16:02 -0700
changeset 131399 a8fe89875091e3cd235cb378628cfe3020f6e05e
parent 131398 d8d4867f71c1725b193f9d6d20e5eea084d6459e
child 131400 80b26df1c79a3e382290f5c434d88c522de6e4fb
push id24658
push useremorley@mozilla.com
push dateFri, 10 May 2013 08:13:26 +0000
treeherdermozilla-central@08be63954b6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs857356
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 857356 - Convert field-y XBL tests to run with dom.use_xbl_scopes_for_remote_xul=false. r=bz There are a couple of tests here that do funny things with fields. Our basic position here is that fields have no place for in-content XBL bindings, but there's still value in testing this stuff given our heavy usage of XBL in chrome code. They really should be converted to chrome tests, but I was having trouble doing that, so I decided to convert them to run without XBL scopes, like we do for remote XUL. As a nice side effect, this gives us a tiny bit more test coverage for the remote XUL configuration.
content/xbl/test/Makefile.in
content/xbl/test/file_bug372769.xhtml
content/xbl/test/file_bug397934.xhtml
content/xbl/test/test_bug372769.html
content/xbl/test/test_bug372769.xhtml
content/xbl/test/test_bug397934.html
content/xbl/test/test_bug397934.xhtml
--- a/content/xbl/test/Makefile.in
+++ b/content/xbl/test/Makefile.in
@@ -11,19 +11,21 @@ relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_FILES =	\
 		test_bug310107.html \
 		bug310107-resource.xhtml \
 		test_bug366770.html \
 		test_bug371724.xhtml \
-		test_bug372769.xhtml \
+		test_bug372769.html \
+		file_bug372769.xhtml \
 		test_bug378866.xhtml \
-		test_bug397934.xhtml \
+		test_bug397934.html \
+		file_bug397934.xhtml \
 		test_bug389322.xhtml \
 		test_bug400705.xhtml \
 		test_bug401907.xhtml \
 		test_bug403162.xhtml \
 		test_bug379959.html \
 		file_bug379959_data.html \
 		file_bug379959_cross.html \
 		file_bug379959_xbl.xml \
rename from content/xbl/test/test_bug372769.xhtml
rename to content/xbl/test/file_bug372769.xhtml
--- a/content/xbl/test/test_bug372769.xhtml
+++ b/content/xbl/test/file_bug372769.xhtml
@@ -1,16 +1,14 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=372769
 -->
 <head>
   <title>Test for Bug 372769</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <bindings xmlns="http://www.mozilla.org/xbl">
     <binding id="test1">
       <implementation>
         <field name="one">1</field>
         <field name="two">9</field>
         <field name="three">3</field>
         <field name="four">10</field>
         <field name="five">11</field>
@@ -79,18 +77,23 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 /** Test for Bug 372769 **/
-SimpleTest.waitForExplicitFinish();
-addLoadEvent(function() {
+
+SimpleTest = parent.SimpleTest;
+ok = parent.ok;
+is = parent.is;
+$ = function(x) { return document.getElementById(x); }
+
+window.onload = function() {
   var d = $("display1");
   is(d.one, 1, "Should be able to read field");
 
   d.two = 2;
   is(d.two, 2, "Should be able to write field");
 
   is("three" in d, true, 'Should have a property named "three"');
   is(d.three, 3, "Should be 3");
@@ -163,17 +166,16 @@ addLoadEvent(function() {
   for (var prop2 in d) {
     if (prop2 == "twenty-one") {
       found = true;
       break;
     }
   }
   is(found, true, "Enumeration is broken");
   is(d["twenty-one"], 21, "Should be 21");
-  
-});
-addLoadEvent(SimpleTest.finish);
+  SimpleTest.finish();
+}
 ]]>
 </script>
 </pre>
 </body>
 </html>
 
rename from content/xbl/test/test_bug397934.xhtml
rename to content/xbl/test/file_bug397934.xhtml
--- a/content/xbl/test/test_bug397934.xhtml
+++ b/content/xbl/test/file_bug397934.xhtml
@@ -1,16 +1,14 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=397934
 -->
 <head>
   <title>Test for Bug 397934</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <bindings xmlns="http://www.mozilla.org/xbl">
     <binding id="ancestor">
       <implementation>
         <field name="testAncestor">"ancestor"</field>
       </implementation>
     </binding>
     <binding id="test1" extends="#ancestor">
       <implementation>
@@ -54,18 +52,21 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 /** Test for Bug 397934 **/
-SimpleTest.waitForExplicitFinish();
-addLoadEvent(function() {
+SimpleTest = parent.SimpleTest;
+ok = parent.ok;
+is = parent.is;
+$ = function(x) { return document.getElementById(x); }
+window.onload = function() {
   var d;
   d = $("display1");
   is(d.storage, window,
      "test1" +
        ": |window| in the constructor should have resolved to our window");
   is(d.ownerDocument, "ownerDocument",
      "test1" + ": Control to test field overriding DOM prop");
   is(d.parentNode, document.body, "test1" + ": unexpected parent");
@@ -100,17 +101,17 @@ addLoadEvent(function() {
   is(typeof(d.emptyTest1), "undefined",
      "test2" + ": First field wins even if undefined, double-check");
   is(d.emptyTest2, "empty2",
      "test2" + ": First field wins");
   is(d.testAncestor, undefined,
      "test2" + ": Undefined field should override ancestor binding");
   is(typeof(d.testAncestor), "undefined",
      "test2" + ": Undefined field should really override ancestor binding");
-});
-addLoadEvent(SimpleTest.finish);
+  SimpleTest.finish();
+}
 
 ]]>
 </script>
 </pre>
 </body>
 </html>
 
new file mode 100644
--- /dev/null
+++ b/content/xbl/test/test_bug372769.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=372769
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 372769</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">
+
+  SimpleTest.waitForExplicitFinish();
+
+  // Embed the real test. It will take care of everything else.
+  function setup() {
+    SpecialPowers.pushPrefEnv({'set': [['dom.use_xbl_scopes_for_remote_xul', false]]}, go);
+  }
+  function go() {
+    $('ifr').setAttribute('src', 'file_bug372769.xhtml');
+  }
+
+  </script>
+</head>
+<body onload="setup();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=372769">Mozilla Bug 372769</a>
+<p id="display"></p>
+<div id="content">
+<iframe id="ifr"></iframe>
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/content/xbl/test/test_bug397934.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=397934
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 397934</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">
+
+  SimpleTest.waitForExplicitFinish();
+
+  // Embed the real test. It will take care of everything else.
+  function setup() {
+    SpecialPowers.pushPrefEnv({'set': [['dom.use_xbl_scopes_for_remote_xul', false]]}, go);
+  }
+  function go() {
+    $('ifr').setAttribute('src', 'file_bug397934.xhtml');
+  }
+
+  </script>
+</head>
+<body onload="setup();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=397934">Mozilla Bug 397934</a>
+<p id="display"></p>
+<div id="content">
+<iframe id="ifr"></iframe>
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>