Bug 1051157 - Fix TEST-UNEXPECTED-FAIL for test_bug789713.html. r=bholley, a=test-only
authorMartijn Wargers <mwargers@mozilla.com>
Mon, 11 Aug 2014 15:04:37 -0700
changeset 217558 b66729c044f0f666500b1d9f22d633bfddb52cbd
parent 217557 5e1e03a7e25c1504b1f5bbe1e595d6ac29ccce0e
child 217559 5d4f07c87783a9901bdff89c9abc2c15652d2d74
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley, test-only
bugs1051157, 789713
milestone33.0a2
Bug 1051157 - Fix TEST-UNEXPECTED-FAIL for test_bug789713.html. r=bholley, a=test-only
js/xpconnect/tests/mochitest/file_bug789713.html
js/xpconnect/tests/mochitest/mochitest.ini
js/xpconnect/tests/mochitest/test_bug789713.html
new file mode 100644
--- /dev/null
+++ b/js/xpconnect/tests/mochitest/file_bug789713.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=789713
+-->
+<head>
+  <meta charset="utf-8">
+</head>
+<body>
+
+<script type="application/javascript">
+
+/** Test for Bug 789713 **/
+
+function go() {
+  var ifr = document.getElementById('ifr');
+  var pass = true;
+  var doc = ifr.contentDocument;
+
+  // Tree walkers use nsDOMGenericSH, which has a spineless PreCreate.
+  var walker = doc.createTreeWalker(doc.body);
+  pass = pass && (walker.root === doc.body);
+
+  // Grab a reference to Object.prototype to make sure we test the machinery
+  // with respect to standard prototype remapping.
+  var objProto = ifr.contentWindow.Object.prototype;
+
+  // First, do the document.domain operation. This shouldn't crash.
+  document.domain = "example.org";
+
+  // Now, make sure that we still can't access cross-origin properties despite
+  // the fact that the WN is shared under the hood.
+  try {
+    walker.root;
+    pass = false;
+  } catch (e) { pass = pass && /Permission denied/.exec(e.message); }
+  window.parent.postMessage(pass, '*');
+}
+
+</script>
+<iframe id="ifr" src="file_empty.html" onload="go()"></iframe>
+</pre>
+</body>
+</html>
--- a/js/xpconnect/tests/mochitest/mochitest.ini
+++ b/js/xpconnect/tests/mochitest/mochitest.ini
@@ -12,16 +12,17 @@ support-files =
   file_bug505915.html
   file_bug650273.html
   file_bug658560.html
   file_bug706301.html
   file_bug720619.html
   file_bug738244.html
   file_bug760131.html
   file_bug781476.html
+  file_bug789713.html
   file_bug795275.html
   file_bug795275.xml
   file_bug799348.html
   file_bug802557.html
   file_bug860494.html
   file_crosscompartment_weakmap.html
   file_documentdomain.html
   file_doublewrappedcompartments.html
--- a/js/xpconnect/tests/mochitest/test_bug789713.html
+++ b/js/xpconnect/tests/mochitest/test_bug789713.html
@@ -15,48 +15,25 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
 <iframe id="ifr"></iframe>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 789713 **/
 
-function go() {
-  var pass = true;
-  var doc = document.getElementById('ifr').contentDocument;
-
-  // Tree walkers use nsDOMGenericSH, which has a spineless PreCreate.
-  var walker = doc.createTreeWalker(doc.body);
-  pass = pass && (walker.root === doc.body);
-
-  // Grab a reference to Object.prototype to make sure we test the machinery
-  // with respect to standard prototype remapping.
-  var objProto = ifr.contentWindow.Object.prototype;
-
-  // First, do the document.domain operation. This shouldn't crash.
-  document.domain = "example.org";
-
-  // Now, make sure that we still can't access cross-origin properties despite
-  // the fact that the WN is shared under the hood.
-  try {
-    walker.root;
-    pass = false;
-  } catch (e) { pass = pass && /Permission denied/.exec(e.message); }
-  window.parent.postMessage(pass, '*');
-}
-
 // We can't set document.domain on mochi.test, because it's forbidden to set
 // document.domain to a TLD.
 var ifr = document.getElementById('ifr');
-if (window.location.hostname == "mochi.test") {
-  SimpleTest.waitForExplicitFinish();
-  ifr.src = window.location.toString().replace("mochi.test:8888", "test1.example.org").split('?')[0];
-  window.onmessage = function(message) { ok(message.data, "Test succeeded and didn't crash"); SimpleTest.finish(); };
-} else {
-  ifr.src = "file_empty.html";
-  ifr.onload = go;
+
+SimpleTest.waitForExplicitFinish();
+ifr.src = window.location.toString().replace("mochi.test:8888", "test1.example.org")
+                                    .replace("test_bug789713", "file_bug789713")
+                                    .split('?')[0];
+window.onmessage = function(message) {
+  ok(message.data, "Test succeeded and didn't crash");
+  SimpleTest.finish();
 }
 
 </script>
 </pre>
 </body>
 </html>