summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docshell/test/navigation/file_bug1379762-2.html43
-rw-r--r--docshell/test/navigation/file_document_write_1.html23
-rw-r--r--docshell/test/navigation/mochitest.ini4
-rw-r--r--docshell/test/navigation/test_sessionhistory.html10
-rw-r--r--dom/base/test/test_x-frame-options.html26
-rw-r--r--dom/html/test/mochitest.ini1
-rw-r--r--dom/html/test/test_bug172261.html67
-rw-r--r--dom/html/test/test_bug255820.html38
-rw-r--r--dom/tests/mochitest/bugs/test_bug346659.html2
-rw-r--r--js/xpconnect/crashtests/crashtests.list2
-rw-r--r--layout/style/test/test_bug1232829.html1
-rw-r--r--parser/htmlparser/tests/mochitest/test_bug715739.html34
-rw-r--r--security/manager/ssl/tests/mochitest/mixedcontent/test_bug329869.html2
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1-1.html5
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html5
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html7
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html6
17 files changed, 71 insertions, 205 deletions
diff --git a/docshell/test/navigation/file_bug1379762-2.html b/docshell/test/navigation/file_bug1379762-2.html
deleted file mode 100644
index 86033cb2e..000000000
--- a/docshell/test/navigation/file_bug1379762-2.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Bug 1379762</title>
- </head>
- <script type="text/just-data">
- onunload = null; // enable bfcache
- ++opener.testCount;
- onpageshow = function(e) {
- opener.ok(!e.persisted, "Pageshow should not be coming from bfcache " + opener.testCount);
- }
- if (opener.testCount == 1) {
- onload = function () {
- setTimeout(function() {
- document.write(testScript);
- }, 0);
- }
- } else if (opener.testCount == 2) {
- // Do this async, just in case.
- setTimeout(function() {
- history.back();
- }, 0);
- } else if (opener.testCount == 3) {
- // Do this async, just in case.
- setTimeout(function() {
- history.forward();
- }, 0);
- } else if (opener.testCount == 4) {
- onload = function() {
- opener.nextTest();
- window.close();
- }
- }
- </script>
- <script>
- var data = document.querySelector("script[type='text/just-data']").textContent;
- // Store the string that does all out work in a global variable, so we can
- // get at it later.
- var testScript = "<script>" + data + "</" + "script>";
- document.write(testScript);
- </script>
-</html>
diff --git a/docshell/test/navigation/file_document_write_1.html b/docshell/test/navigation/file_document_write_1.html
index e0281f7cd..169046a9b 100644
--- a/docshell/test/navigation/file_document_write_1.html
+++ b/docshell/test/navigation/file_document_write_1.html
@@ -1,27 +1,16 @@
<html>
<head>
<script>
- function run() {
+ function start() {
+ var length = history.length;
document.open();
document.write("<h5 id='dynamic'>document.written content</h5>");
document.close();
- window.history.go(-1);
- }
-
- function start() {
- if (++opener.testCount == 1) {
- setTimeout(run, 0);
- }
+ opener.is(history.length, length,
+ "document.open/close should not change history");
+ opener.nextTest();
+ window.close();
}
-
- window.addEventListener("pageshow",
- function() {
- ++opener.file_document_write_1_loadCount;
- if (opener.file_document_write_1_loadCount == 2) {
- opener.setTimeout("isTestDynamic()", 0);
- }
- opener.ok(opener.file_document_write_1_loadCount <= 2);
- });
</script>
</head>
<body onload="start();">
diff --git a/docshell/test/navigation/mochitest.ini b/docshell/test/navigation/mochitest.ini
index 8cff81ad1..e2ee307e4 100644
--- a/docshell/test/navigation/mochitest.ini
+++ b/docshell/test/navigation/mochitest.ini
@@ -58,8 +58,8 @@ skip-if = (toolkit == 'android') || (!debug && (os == 'mac' || os == 'win')) # B
[test_reserved.html]
skip-if = (toolkit == 'android') || (debug && e10s) #too slow on Android 4.3 aws only; bug 1030403; bug 1263213 for debug e10s
[test_sessionhistory.html]
-skip-if = toolkit == 'android' #RANDOM
-support-files = file_bug1379762-1.html file_bug1379762-2.html
+skip-if = toolkit == 'android' #RANDOM on Android
+support-files = file_bug1379762-1.html
[test_sibling-matching-parent.html]
[test_sibling-off-domain.html]
[test_triggeringprincipal_frame_nav.html]
diff --git a/docshell/test/navigation/test_sessionhistory.html b/docshell/test/navigation/test_sessionhistory.html
index 10b0cbcaf..e5978acfa 100644
--- a/docshell/test/navigation/test_sessionhistory.html
+++ b/docshell/test/navigation/test_sessionhistory.html
@@ -33,7 +33,6 @@ var testFiles =
"file_scrollRestoration.html",
"file_bug1300461.html",
"file_bug1379762-1.html",
- "file_bug1379762-2.html",
];
var testCount = 0; // Used by the test files.
@@ -51,15 +50,6 @@ function nextTest_() {
}
}
-// Needed by file_document_write_1.html
-window.file_document_write_1_loadCount = 0;
-function isTestDynamic() {
- var dyn = testWindow.document.getElementById("dynamic");
- is(dyn, null, "Should have gone back to the static page!");
- nextTest();
- testWindow.close();
-}
-
function nextTest() {
setTimeout(nextTest_, 0);
}
diff --git a/dom/base/test/test_x-frame-options.html b/dom/base/test/test_x-frame-options.html
index a0c7acdc3..8e8cffcc3 100644
--- a/dom/base/test/test_x-frame-options.html
+++ b/dom/base/test/test_x-frame-options.html
@@ -113,19 +113,25 @@ var testFramesLoaded = function() {
// test that a document can be framed under a javascript: URL opened by the
// same site as the frame
+// We can't set a load event listener before calling document.open/document.write, because those will remove such listeners. So we need to define a function that the new window will be able to call.
+function frameInJSURILoaded(win) {
+ var test = win.document.getElementById("sameorigin3")
+ .contentDocument.getElementById("test");
+ ok(test != null, "frame under javascript: URL should have loaded.");
+ win.close();
+
+ // run last test
+ if (!isUnique) {
+ testFrameInDataURI();
+ } else {
+ testFrameNotLoadedInDataURI();
+ }
+}
+
var testFrameInJSURI = function() {
var html = '<iframe id="sameorigin3" src="http://mochi.test:8888/tests/dom/base/test/file_x-frame-options_page.sjs?testid=sameorigin3&xfo=sameorigin"></iframe>';
var win = window.open();
- win.onload = function() {
- var test = win.document.getElementById("sameorigin3")
- .contentDocument.getElementById("test");
- ok(test != null, "frame under javascript: URL should have loaded.");
- win.close();
-
- // run last test
- testFrameInDataURI();
- }
- win.location.href = "javascript:document.write('"+html+"');document.close();";
+ win.location.href = "javascript:document.open(); onload = opener.frameInJSURILoaded.bind(null, window); document.write('"+html+"');document.close();";
}
// test that a document can be framed under a data: URL opened by the
diff --git a/dom/html/test/mochitest.ini b/dom/html/test/mochitest.ini
index b9da7def8..024de1cd9 100644
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -529,7 +529,6 @@ skip-if = toolkit == 'android' # plugins not supported
[test_bug196523.html]
[test_bug199692.html]
skip-if = toolkit == 'android' #bug 811644
-[test_bug172261.html]
[test_bug255820.html]
[test_bug259332.html]
[test_bug311681.html]
diff --git a/dom/html/test/test_bug172261.html b/dom/html/test/test_bug172261.html
deleted file mode 100644
index 2b5d752cd..000000000
--- a/dom/html/test/test_bug172261.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=172261
--->
-<head>
- <title>Test for Bug 172261</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=172261">Mozilla Bug 172261</a>
-<p id="display">
- <iframe id="test"></iframe>
-</p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
- /** Test for Bug 172261 **/
- SimpleTest.waitForExplicitFinish();
- SimpleTest.requestFlakyTimeout("untriaged");
-
- var callable = false;
- function toggleCallable() { callable = true; }
-
- var doTestInIframe = false;
-
- // Shouldn't do history stuff from inside onload
- addLoadEvent(function() { setTimeout(startTest, 10) });
-
- function startTest() {
- // First, create a dummy document. Use onunload handlers to make sure
- // bfcache doesn't screw us up.
- var doc = $("test").contentDocument;
-
- doc.write("<html><body onunload=''>First</body></html>");
- doc.close();
-
- // Now write our test document
- doc.write("<html><script>window.onerror = parent.onerror; if (parent.doTestInIframe) { parent.is(document.domain, parent.document.domain, 'Domains should match'); parent.toggleCallable(); } <" + "/script><body>Second</body></html>");
- doc.close();
-
- $("test").onload = goForward;
- history.back();
- }
-
- function goForward() {
- $("test").onload = doTest;
- doTestInIframe = true;
- history.forward();
- }
-
- function doTest() {
- is($("test").contentDocument.domain, document.domain,
- "Domains should match 2");
- is($("test").contentDocument.location.href, location.href,
- "Locations should match");
- is(callable, true, "Subframe should be able to call us");
- SimpleTest.finish();
- }
-</script>
-</pre>
-</body>
-</html>
-
diff --git a/dom/html/test/test_bug255820.html b/dom/html/test/test_bug255820.html
index 20727fee4..18073497b 100644
--- a/dom/html/test/test_bug255820.html
+++ b/dom/html/test/test_bug255820.html
@@ -28,7 +28,7 @@ SimpleTest.waitForExplicitFinish();
is(document.characterSet, "UTF-8",
"Unexpected character set for our document");
-var testsLeft = 4;
+var testsLeft = 3;
function testFinished() {
--testsLeft;
@@ -42,29 +42,11 @@ function charsetTestFinished(id, doc, charsetTarget) {
testFinished();
}
-function f2Continue() {
-// Commented out pending discussion at the WHATWG
-// $("f2").
-// setAttribute("onload",
-// "charsetTestFinished('f2 reloaded', this.contentDocument, 'us-ascii');");
- $("f2").
- setAttribute("onload",
- "testFinished();");
- $("f2").contentWindow.location.reload();
-}
-
function f3Continue() {
var doc = $("f3").contentDocument;
is(doc.defaultView.getComputedStyle(doc.body, "").color, "rgb(0, 180, 0)",
- "Wrong color before reload");
- $("f3").
- setAttribute("onload",
- 'var doc = this.contentDocument; ' +
- 'is(doc.defaultView.getComputedStyle(doc.body, "").color, ' +
- ' "rgb(0, 180, 0)",' +
- ' "Wrong color after reload");' +
- "charsetTestFinished('f1', this.contentDocument, 'UTF-8')");
- $("f3").contentWindow.location.reload();
+ "Wrong color");
+ charsetTestFinished('f3', doc, "UTF-8");
}
function runTest() {
@@ -74,12 +56,7 @@ function runTest() {
doc.open();
doc.write('<html></html>');
doc.close();
- is(doc.characterSet, "UTF-8",
- "Unexpected character set for first frame after write");
- $("f1").
- setAttribute("onload",
- "charsetTestFinished('f1', this.contentDocument, 'UTF-8')");
- $("f1").contentWindow.location.reload();
+ charsetTestFinished("f1", doc, "UTF-8");
doc = $("f2").contentDocument;
is(doc.characterSet, "UTF-8",
@@ -96,12 +73,11 @@ function runTest() {
"Unexpected character set for second frame after write");
$("f2").
setAttribute("onload",
- "charsetTestFinished('f2', this.contentDocument, 'UTF-8');" +
- "f2Continue()");
+ "charsetTestFinished('f2', this.contentDocument, 'UTF-8');");
doc = $("f3").contentDocument;
is(doc.characterSet, "UTF-8",
- "Unexpected initial character set for first frame");
+ "Unexpected initial character set for third frame");
doc.open();
var str = '<html><head>';
str += '<style>body { color: rgb(255, 0, 0) }</style>';
@@ -111,7 +87,7 @@ function runTest() {
doc.write(str);
doc.close();
is(doc.characterSet, "UTF-8",
- "Unexpected character set for first frame after write");
+ "Unexpected character set for third frame after write");
$("f3").setAttribute("onload", "f3Continue()");
}
diff --git a/dom/tests/mochitest/bugs/test_bug346659.html b/dom/tests/mochitest/bugs/test_bug346659.html
index 78c1fc659..8596de7b1 100644
--- a/dom/tests/mochitest/bugs/test_bug346659.html
+++ b/dom/tests/mochitest/bugs/test_bug346659.html
@@ -108,7 +108,7 @@ function messageReceiver(evt) {
is(testResult, "undefined", "Props on new window's child should go away when loading");
break;
case 6:
- is(testResult, "undefined", "Props on new window's child should go away when writing");
+ is(testResult, "6", "Props on new window's child should go away when writing");
break;
case 7:
is(testResult, "7", "Props on different-domain window opened from different-domain new window can stay");
diff --git a/js/xpconnect/crashtests/crashtests.list b/js/xpconnect/crashtests/crashtests.list
index 7325e2601..51f4b8643 100644
--- a/js/xpconnect/crashtests/crashtests.list
+++ b/js/xpconnect/crashtests/crashtests.list
@@ -43,7 +43,7 @@ load 732870.html
load 751995.html
load 761831.html
asserts(0-1) load 752038.html # We may hit bug 645229 here.
-asserts(1) load 753162.html # We hit bug 675518 or bug 680086 here.
+load 753162.html
load 754311.html
asserts(0-1) load 786142.html # We may hit bug 645229 here.
load 797583.html
diff --git a/layout/style/test/test_bug1232829.html b/layout/style/test/test_bug1232829.html
index 8981d56e0..65bea2014 100644
--- a/layout/style/test/test_bug1232829.html
+++ b/layout/style/test/test_bug1232829.html
@@ -19,7 +19,6 @@ function boom() {
setTimeout(function() {
var frameDoc = document.querySelector("iframe").contentDocument;
frameDoc.write("3");
- frameDoc.defaultView.history.back();
requestAnimationFrame(function() {
popup.close();
ok(true, "Didn't crash");
diff --git a/parser/htmlparser/tests/mochitest/test_bug715739.html b/parser/htmlparser/tests/mochitest/test_bug715739.html
index 597160a19..e59fdf332 100644
--- a/parser/htmlparser/tests/mochitest/test_bug715739.html
+++ b/parser/htmlparser/tests/mochitest/test_bug715739.html
@@ -33,24 +33,30 @@ function textChildren(node) {
return s;
}
+var f, d;
+
function tick() {
runNumber++;
- var f = document.getElementsByTagName("iframe")[0];
- var d = f.contentDocument;
+ f = document.getElementsByTagName("iframe")[0];
+ d = f.contentDocument;
if (runNumber == 1) {
- d.open();
- f.addEventListener("load", tick);
- d.write("X");
- d.write("\u003cscript>document.write('Y');\u003c/script>");
- d.write("Z");
- d.close();
+ frames[1].setTimeout(`
+ var d = parent.d;
+ var f = parent.f;
+ d.open();
+ f.addEventListener("load", parent.tick);
+ d.write("X");
+ d.write("\u003cscript>document.write('Y');\u003c/script>");
+ d.write("Z");
+ d.close();
+ `);
return;
}
if (runNumber == 2) {
var text = textChildren(d.body);
- is(text, "XYZ", "Wrong text before reload.");
+ is(text, "ABC", "Wrong text before reload.");
f.contentWindow.location.reload();
return;
}
@@ -63,10 +69,20 @@ function tick() {
}
}
+// We want to trigger a document.open/write with a different window as the
+// entry global. Let's give that window a blob URL so we don't have to set up
+// extra helper files.
+var blob = new Blob(["ABC"], { type: "text/html" });
+var blobURL = URL.createObjectURL(blob);
+
</script>
</pre>
<div id="content" style="display: none">
<iframe></iframe>
+ <iframe></iframe>
</div>
+<script>
+ document.querySelectorAll("iframe")[1].src = blobURL;
+</script>
</body>
</html>
diff --git a/security/manager/ssl/tests/mochitest/mixedcontent/test_bug329869.html b/security/manager/ssl/tests/mochitest/mixedcontent/test_bug329869.html
index 3b8fae25e..596b65628 100644
--- a/security/manager/ssl/tests/mochitest/mixedcontent/test_bug329869.html
+++ b/security/manager/ssl/tests/mochitest/mixedcontent/test_bug329869.html
@@ -25,7 +25,7 @@
function afterNavigationTest()
{
- isSecurityState("broken", "security still broken after navigation");
+ isSecurityState("secure", "when we navigate back, we're loading our secure page again and not loading an insecure script, so our security state is secure");
finish();
}
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1-1.html
index af0118a01..945c8d81f 100644
--- a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1-1.html
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1-1.html
@@ -5,11 +5,8 @@
opener.pages.push(2);
onload = function() {
setTimeout(function() {
- document.write("<!doctype html>3<script>opener.pages.push(3); if(!opener.started) {opener.started = true; history.go(-1);} opener.start_test_wait();<\/script>");
+ document.write("<!doctype html>3<script>opener.pages.push(3); if(!opener.started) {opener.started = true; history.go(-1);}<\/script>");
document.close();
- if (opener.started) {
- opener.start_test_wait();
- }
}, 100);
}
</script>
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html
index c2c31e76f..404d61d0c 100644
--- a/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html
@@ -11,12 +11,11 @@
function() {
check_result = t.step_func(
function() {
- if (pages.length < 4) {
+ if (pages.length < 3) {
setTimeout(check_result, 500);
return
}
- //The pass condition here is based on the idea that the spec is wrong and browsers are right
- assert_array_equals(pages, [2, 3, 2, 3], "Pages opened during history navigation");
+ assert_array_equals(pages, [2, 3, 1], "Pages opened during history navigation");
t.done();
}
)
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html
index 1c5a1db8f..e1a2e811c 100644
--- a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html
@@ -3,11 +3,16 @@
<script>
function f() {
opener.postMessage("original", "*");
+ if (opener.data.length >= 2) {
+ // If we proceed here, then our document.write will be racing with the
+ // setTimeout in our opener. Just stop.
+ return;
+ }
setTimeout(function () {
document.open();
document.write("<!doctype html>2<script>opener.postMessage('written', '*');<\/script>");
document.close();
- }), 100;
+ });
}
window.onload = f
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html
index 0fc2a2c3d..905ef8874 100644
--- a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html
+++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html
@@ -11,11 +11,11 @@ var data = [];
window.onmessage = t.step_func(function(e) {
data.push(e.data);
- if (data.length < 3) {
+ if (data.length == 2) {
win.location.reload();
- } else {
+ } else if (data.length >= 3) {
setTimeout(t.step_func(function() {
- assert_array_equals(data, ["original", "written", "written"]);
+ assert_array_equals(data, ["original", "written", "original"]);
t.done();
}), 500);
}