Bug 1316837 P2 Verify that navigating to a window with an iframe right after sync xhr does not trigger assertions. r=smaug
authorBen Kelly <ben@wanderview.com>
Mon, 14 Nov 2016 12:51:44 -0800
changeset 367475 659a966e70ea3eb9368a13a3ade2c9df473fba2c
parent 367474 b8cf305046e5498dbbb0a51cef2bd2021aec0be1
child 367476 71543633d754b08008cfd83b1399842786c4a4bf
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1316837
milestone52.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 1316837 P2 Verify that navigating to a window with an iframe right after sync xhr does not trigger assertions. r=smaug
dom/xhr/tests/file_sync_xhr_document_write_with_iframe.html
dom/xhr/tests/mochitest.ini
dom/xhr/tests/test_sync_xhr_document_write_with_iframe.html
new file mode 100644
--- /dev/null
+++ b/dom/xhr/tests/file_sync_xhr_document_write_with_iframe.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<body>
+<script>
+function syncXHR() {
+  let xhr = new XMLHttpRequest();
+  xhr.open("GET", window.location, false);
+  xhr.send(null);
+}
+
+addEventListener('load', evt => {
+  syncXHR();
+  document.open();
+  document.write(
+    '<body>' +
+    '<iframe src="about:blank"></iframe>' +
+    '<script>window.opener.postMessage("DONE", "*");</' + 'script>' +
+    '</body>');
+  document.close();
+}, { once: true });
+</script>
+</body>
--- a/dom/xhr/tests/mochitest.ini
+++ b/dom/xhr/tests/mochitest.ini
@@ -58,16 +58,17 @@ support-files =
   subdir/relativeLoad_sub_worker2.js
   subdir/relativeLoad_sub_import.js
   common_temporaryFileBlob.js
   worker_temporaryFileBlob.js
   worker_bug1300552.js
   sync_xhr_unload.sjs
   iframe_sync_xhr_unload.html
   empty.html
+  file_sync_xhr_document_write_with_iframe.html
 
 [test_bug1300552.html]
 [test_html_in_xhr.html]
 [test_relativeLoad.html]
 skip-if = buildapp == 'b2g' # b2g(Failed to load script: relativeLoad_import.js) b2g-debug(Failed to load script: relativeLoad_import.js) b2g-desktop(Failed to load script: relativeLoad_import.js)
 [test_sync_xhr_timer.xhtml]
 skip-if = toolkit == 'android'
 [test_sync_xhr_unload.html]
@@ -106,8 +107,9 @@ skip-if = toolkit == 'android'
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(12 total, 2 failing - .mozSystem == true - got false, expected true + ) b2g-desktop(12 total, 2 failing - .mozSystem == true - got false, expected true + )
 [test_XHR_timeout.html]
 skip-if = buildapp == 'b2g' || (android_version == '18' && debug) # b2g(flaky on B2G, bug 960743) b2g-debug(flaky on B2G, bug 960743) b2g-desktop(flaky on B2G, bug 960743)
 support-files = test_XHR_timeout.js
 [test_xhr_withCredentials.html]
 [test_XHRDocURI.html]
 [test_XHRResponseURL.html]
 [test_XHRSendData.html]
+[test_sync_xhr_document_write_with_iframe.html]
new file mode 100644
--- /dev/null
+++ b/dom/xhr/tests/test_sync_xhr_document_write_with_iframe.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for Bug </title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+<script>
+function runTest() {
+  let w = window.open('file_sync_xhr_document_write_with_iframe.html');
+  addEventListener('message', evt => {
+    is(evt.data, 'DONE');
+    w.close();
+    SimpleTest.finish();
+  }, { once: true });
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(runTest);
+</script>
+</pre>
+</body>
+</html>