Issue #1118 - Part 6: Fix various tests that are no longer correct.

The behavior change of document.open() requires these tests to be
changed to account for the new spec behavior.
This commit is contained in:
wolfbeast 2019-12-22 23:48:40 +01:00 committed by Roy Tam
commit b753aec164
17 changed files with 71 additions and 205 deletions

View file

@ -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>

View file

@ -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);
opener.is(history.length, length,
"document.open/close should not change history");
opener.nextTest();
window.close();
}
function start() {
if (++opener.testCount == 1) {
setTimeout(run, 0);
}
}
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();">

View file

@ -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]

View file

@ -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);
}