Bug 885140 - Fix intermittent timeout in content/html/content/test/test_iframe_sandbox_navigation.html. r=imelven
authorBob Owen <bobowencode@gmail.com>
Fri, 21 Jun 2013 18:33:39 +0100
changeset 140176 7ff04bb944aa4239f0f5d61204b16cd0da585e90
parent 140175 e26410b337b59d41e88c952bceef0ac437d455b9
child 140177 8b32dad46ea1c5434719f3c31e7cdd115002aebf
push id1945
push userryanvm@gmail.com
push dateSat, 27 Jul 2013 02:27:26 +0000
treeherderfx-team@4874fa438b1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersimelven
bugs885140
milestone25.0a1
Bug 885140 - Fix intermittent timeout in content/html/content/test/test_iframe_sandbox_navigation.html. r=imelven
content/html/content/test/file_iframe_sandbox_d_if8.html
content/html/content/test/test_iframe_sandbox_navigation.html
--- a/content/html/content/test/file_iframe_sandbox_d_if8.html
+++ b/content/html/content/test/file_iframe_sandbox_d_if8.html
@@ -1,24 +1,18 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 341604</title>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
+
 <script type="application/javascript">
-function doTest() {
-  if (location.search == "?onreload") {
-    try {
-      window.parent.modify_if_8();
-    } catch (error) {
-      window.parent.postMessage({ok: true, desc: "allow-same-origin is no longer in effect after reload - parent access blocked."}, "*");
-    }
-  } else {
+  function doTest() {
     window.parent.modify_if_8();
   }
-}
 </script>
+
 <body onload="doTest()">
   I am sandboxed with 'allow-scripts' and 'allow-same-origin' the first time I am loaded, and with 'allow-scripts' the second time
 </body>
 </html>
--- a/content/html/content/test/test_iframe_sandbox_navigation.html
+++ b/content/html/content/test/test_iframe_sandbox_navigation.html
@@ -38,17 +38,17 @@ function receiveMessage(event) {
 
 // Open windows for tests to attempt to navigate later.
 var windowsToClose = new Array();
 windowsToClose.push(window.open("about:blank", "window_to_navigate"));
 windowsToClose.push(window.open("about:blank", "window_to_navigate2"));
 
 var attemptedTests = 0;
 var passedTests = 0;
-var totalTestsToPass = 8;
+var totalTestsToPass = 7;
 var totalTestsToAttempt = 13;
 
 function ok_wrapper(result, desc, addToAttempted = true) {
   ok(result, desc);
 
   if (result) {
     passedTests++;
   }
@@ -115,17 +115,17 @@ function doTest() {
   // page to file_iframe_sandbox_navigation_fail.html).
 
   // passes if good, fails if bad
   // 5) When a link is clicked in a sandboxed iframe, the document navigated to is sandboxed
   // the same as the original document and is not same origin with parent document
   // (done by file_iframe_sandbox_d_if6.html which simulates a link click and navigates
   // to file_iframe_sandbox_d_if7.html which attempts to call back into its parent).
 
-  // passes if good, fails if bad
+  // fails if bad
   // 6) An iframe (if_8) has sandbox="allow-same-origin allow-scripts", the sandboxed document
   // (file_iframe_sandbox_d_if_8.html) that it contains accesses its parent (this file) and removes
   // 'allow-same-origin' and then triggers a reload.
   // The document should not be able to access its parent (this file).
 
   // fails if bad
   // 7) An iframe (if_9) has sandbox="allow-same-origin allow-scripts", the sandboxed document
   // (file_iframe_sandbox_d_if_9.html) that it contains accesses its parent (this file) and removes
@@ -175,35 +175,36 @@ function doTest() {
 }
 
 addLoadEvent(doTest);
 
 window.modified_if_8 = false;
 
 function reload_if_8() {
   var if_8 = document.getElementById('if_8');
-  if_8.src = 'file_iframe_sandbox_d_if8.html?onreload';
+  if_8.src = 'file_iframe_sandbox_d_if8.html';
 }
 
 function modify_if_8() {
   // If this is the second time this has been called
   // that's a failed test (allow-same-origin was removed
   // the first time).
   if (window.modified_if_8) {
-    ok_wrapper(false, "an sandboxed iframe from which 'allow-same-origin' was removed should not be able to access its parent");
+    ok_wrapper(false, "a sandboxed iframe from which 'allow-same-origin' was removed should not be able to access its parent");
 
     // need to return here since we end up in an infinite loop otherwise
     return;
   }
 
   var if_8 = document.getElementById('if_8');
   window.modified_if_8 = true;
 
   if_8.sandbox = 'allow-scripts';
   sendMouseEvent({type:'click'}, 'a_button');
+  testAttempted();
 }
 
 window.modified_if_9 = false;
 
 function reload_if_9() {
   var if_9 = document.getElementById('if_9');
   if_9.src = 'file_iframe_sandbox_d_if9.html';
 }