-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add whole load of tests for "Loading Web Pages".
There isn't quite a guarantee these all match the spec, as the spec is places was clearly incompatible with the web when they were written, and as such test what James Graham recommended be done instead, both on the mailing list and in bugs.
- Loading branch information
Showing
241 changed files
with
3,944 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
html/browsers/browsing-the-web/history-traversal/001-1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
001-1 | ||
<script> | ||
addEventListener("pageshow", | ||
function(e) { | ||
parent.events.push(e); | ||
if (parent.events.length == 2) { | ||
parent.do_test(); | ||
} | ||
}, false); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!doctype html> | ||
001-2 | ||
<script> | ||
onload = function() {setTimeout(function() {history.go(-1)}, 500)} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!doctype html> | ||
<title>pageshow event from traversal</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<iframe src="001-1.html"></iframe> | ||
<script> | ||
var t = async_test(); | ||
var events = []; | ||
var iframe = document.getElementsByTagName("iframe")[0]; | ||
|
||
onload = t.step_func(function() { | ||
setTimeout(t.step_func( | ||
function() { | ||
assert_equals(iframe.contentDocument.readyState, "complete") | ||
iframe.src = "001-2.html"; | ||
}), 500); | ||
onload = null; | ||
}) | ||
|
||
do_test = t.step_func(function() { | ||
assert_equals(events.length, 2); | ||
events.forEach(function(e, i) { | ||
phase = i ? "after" : "before"; | ||
assert_equals(e.type, "pageshow", "type " + phase + " navigation"); | ||
assert_equals(e.persisted, i == 0 ? false : true, "persisted " + phase + " navigation"); | ||
t.done(); | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
support 001-1.html | ||
support 001-2.html | ||
001.html | ||
support browsing_context_name-1.html | ||
support browsing_context_name-2.html | ||
support browsing_context_name-3.html | ||
support browsing_context_name-4.html | ||
browsing_context_name_cross_origin_2.html | ||
browsing_context_name_cross_origin_3.html | ||
browsing_context_name_cross_origin.html | ||
browsing_context_name.html | ||
events.html | ||
hashchange_event.html | ||
popstate_event.html | ||
support unset_context_name-1.html | ||
unset_context_name.html |
6 changes: 6 additions & 0 deletions
6
html/browsers/browsing-the-web/history-traversal/browsing_context_name-1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
document 1 | ||
<script> | ||
if (!parent.navigated) { | ||
window.name = "test"; | ||
} | ||
</script> |
4 changes: 4 additions & 0 deletions
4
html/browsers/browsing-the-web/history-traversal/browsing_context_name-2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
document 2 | ||
<script> | ||
window.name = "test1"; | ||
</script> |
6 changes: 6 additions & 0 deletions
6
html/browsers/browsing-the-web/history-traversal/browsing_context_name-3.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
document 3 | ||
<script> | ||
if (!parent.navigated) { | ||
window.name = "test3"; | ||
} | ||
</script> |
6 changes: 6 additions & 0 deletions
6
html/browsers/browsing-the-web/history-traversal/browsing_context_name-4.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
document 4 | ||
<script> | ||
if (!parent.navigated) { | ||
window.name = "test4"; | ||
} | ||
</script> |
42 changes: 42 additions & 0 deletions
42
html/browsers/browsing-the-web/history-traversal/browsing_context_name.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!doctype html> | ||
<title>Retaining window.name on history traversal</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<pre id="step_log"></pre> | ||
<iframe id="test"></iframe> | ||
<script> | ||
|
||
var t = async_test(undefined, {timeout:10000}); | ||
var f = document.getElementById("test"); | ||
var l = document.getElementById("step_log"); | ||
var navigated = false; | ||
|
||
log = function(t) {l.textContent += ("\n" + t)} | ||
|
||
var steps = [ | ||
function() {f.src = "browsing_context_name-1.html"}, | ||
function() { | ||
var navigated = true; | ||
assert_equals(f.contentWindow.name, "test", "Initial load"); | ||
setTimeout(next, 0); | ||
}, | ||
function() {f.src = "browsing_context_name-2.html"; setTimeout(next, 500)}, | ||
function() { | ||
assert_equals(f.contentWindow.name, "test1"); | ||
setTimeout(next, 0); | ||
}, | ||
function() {history.back(); setTimeout(next, 500)}, | ||
function() { | ||
assert_equals(f.contentWindow.name, "test1", "After navigation"); | ||
t.done(); | ||
} | ||
].map(function(x) {return t.step_func(function() {log("Step " + step); x()})}); | ||
|
||
var step = 0; | ||
next = t.step_func(function() {steps[step++]()}); | ||
|
||
f.onload=next; | ||
|
||
onload = setTimeout(next, 0); | ||
</script> |
41 changes: 41 additions & 0 deletions
41
html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!doctype html> | ||
<title>Restoring window.name on cross-origin history traversal</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<pre id="step_log"></pre> | ||
<iframe id="test"></iframe> | ||
<script> | ||
|
||
var t = async_test(undefined, {timeout:10000}); | ||
var f = document.getElementById("test"); | ||
var l = document.getElementById("step_log"); | ||
var navigated = false; | ||
|
||
log = function(t) {l.textContent += ("\n" + t)} | ||
|
||
var steps = [ | ||
function() {f.src = "browsing_context_name-1.html"}, | ||
function() { | ||
var navigated = true; | ||
assert_equals(f.contentWindow.name, "test", "Initial load"); | ||
setTimeout(next, 0); | ||
}, | ||
function() {f.src = f.src.replace("http://", "http://www.").replace("browsing_context_name-1", "browsing_context_name-2");}, | ||
function() { | ||
setTimeout(next, 0); | ||
}, | ||
function() {history.back(); setTimeout(next, 500)}, | ||
function() { | ||
assert_equals(f.contentWindow.name, "test", "After navigation"); | ||
t.done(); | ||
} | ||
].map(function(x) {return t.step_func(function() {log("Step " + step); x()})}); | ||
|
||
var step = 0; | ||
next = t.step_func(function() {steps[step++]()}); | ||
|
||
f.onload=next; | ||
|
||
onload = setTimeout(next, 0); | ||
</script> |
47 changes: 47 additions & 0 deletions
47
html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!doctype html> | ||
<title>Restoring window.name on cross-origin history traversal</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<pre id="step_log"></pre> | ||
<iframe id="test"></iframe> | ||
<script> | ||
|
||
var t = async_test(undefined, {timeout:10000}); | ||
var f = document.getElementById("test"); | ||
var l = document.getElementById("step_log"); | ||
var navigated = false; | ||
|
||
log = function(t) {l.textContent += ("\n" + t)} | ||
|
||
var steps = [ | ||
function() {f.src = "browsing_context_name-1.html"}, | ||
function() { | ||
var navigated = true; | ||
assert_equals(f.contentWindow.name, "test", "Initial load"); | ||
setTimeout(next, 0); | ||
}, | ||
function() {f.src = "browsing_context_name-3.html"}, | ||
function() { | ||
var navigated = true; | ||
assert_equals(f.contentWindow.name, "test3", "Initial load"); | ||
setTimeout(next, 0); | ||
}, | ||
function() {f.src = f.src.replace("http://", "http://www.").replace("browsing_context_name-3", "browsing_context_name-2");}, | ||
function() { | ||
setTimeout(next, 0); | ||
}, | ||
function() {history.go(-2); setTimeout(next, 500)}, | ||
function() { | ||
assert_equals(f.contentWindow.name, "test3", "After navigation"); | ||
t.done(); | ||
} | ||
].map(function(x) {return t.step_func(function() {log("Step " + step); x()})}); | ||
|
||
var step = 0; | ||
next = t.step_func(function() {steps[step++]()}); | ||
|
||
f.onload=next; | ||
|
||
onload = setTimeout(next, 0); | ||
</script> |
47 changes: 47 additions & 0 deletions
47
html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin_3.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!doctype html> | ||
<title>Restoring window.name on cross-origin history traversal</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<pre id="step_log"></pre> | ||
<iframe id="test"></iframe> | ||
<script> | ||
var t = async_test(undefined, {timeout:10000}); | ||
var f = document.getElementById("test"); | ||
var l = document.getElementById("step_log"); | ||
var navigated = false; | ||
|
||
log = function(t) {l.textContent += ("\n" + t)} | ||
|
||
var steps = [ | ||
function() {f.src = "browsing_context_name-1.html"}, | ||
function() { | ||
var navigated = true; | ||
assert_equals(f.contentWindow.name, "test", "Initial load"); | ||
setTimeout(next, 0); | ||
}, | ||
function() {f.src = "browsing_context_name-3.html"}, | ||
function() { | ||
var navigated = true; | ||
assert_equals(f.contentWindow.name, "test3", "Initial load"); | ||
setTimeout(next, 0); | ||
}, | ||
function() {f.src = f.src.replace("http://", "http://www.").replace("browsing_context_name-1", "browsing_context_name-2");}, | ||
function() {f.src = f.src.replace("http://www.", "http://").replace("browsing_context_name-2", "browsing_context_name-4");}, | ||
function() { | ||
assert_equals(f.contentWindow.name, "test3", "After navigation"); | ||
history.go(-3); setTimeout(next, 500) | ||
}, | ||
function() { | ||
assert_equals(f.contentWindow.name, "test3", "After navigation"); | ||
t.done(); | ||
} | ||
].map(function(x) {return t.step_func(function() {log("Step " + step + " " + f.contentWindow.location); x()})}); | ||
|
||
var step = 0; | ||
next = t.step_func(function() {steps[step++]()}); | ||
|
||
f.onload=next; | ||
|
||
onload = setTimeout(next, 0); | ||
</script> |
Oops, something went wrong.