-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add wpt test of form submission inside an onload handler.
MozReview-Commit-ID: HearVphzHsG Upstreamed from https://bugzilla.mozilla.org/show_bug.cgi?id=1397512 [ci skip]
- Loading branch information
1 parent
3d2d43c
commit b3145ac
Showing
5 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...sers/history/the-session-history-of-browsing-contexts/navigation-in-onload.tentative.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,37 @@ | ||
|
||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Navigation in onload handler</title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script> | ||
var testFiles = [ | ||
"navigation-in-onload_form-submission-1.tentative.html", | ||
"navigation-in-onload_form-submission-iframe.tentative.html", | ||
"navigation-in-onload_form-submission-dynamic-iframe.tentative.html" | ||
] | ||
|
||
var t = async_test(); | ||
|
||
function scheduleNextTest() { | ||
setTimeout(runNextTest, 0); | ||
} | ||
|
||
function runNextTest() { | ||
var file = testFiles.shift(); | ||
if (!file) { | ||
t.done(); | ||
return; | ||
} | ||
|
||
window.open(file); | ||
} | ||
|
||
function verify(actual, expected, desc) { | ||
setTimeout(t.step_func(function() { | ||
assert_equals(actual, expected, desc); | ||
}), 0); | ||
} | ||
|
||
</script> | ||
<body onload="scheduleNextTest();"></body> |
15 changes: 15 additions & 0 deletions
15
...ession-history-of-browsing-contexts/navigation-in-onload_form-submission-1.tentative.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,15 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Navigation in onload handler through form submission</title> | ||
<script> | ||
function redirect() { | ||
document.querySelector("#redirectionForm").submit(); | ||
} | ||
</script> | ||
</head> | ||
<body onload="redirect();"> | ||
<form id="redirectionForm" action="navigation-in-onload_form-submission-2.tentative.html" method="get"></form> | ||
</body> | ||
</html> |
22 changes: 22 additions & 0 deletions
22
...ession-history-of-browsing-contexts/navigation-in-onload_form-submission-2.tentative.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,22 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Navigation in onload handler through form submission</title> | ||
<script> | ||
|
||
// Verify is called after onload event to ensure history has been stable. | ||
function verify() { | ||
// Navigation in onload handler through form submission should not | ||
// increse history length. | ||
var testRunner = window.top.opener; | ||
testRunner.verify(history.length, 1, | ||
"history.length of subtest '" + top.document.title + "'."); | ||
testRunner.scheduleNextTest(); | ||
setTimeout(window.close.bind(top), 0); | ||
} | ||
</script> | ||
</head> | ||
<body onload="setTimeout(verify, 0);"> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
...y-of-browsing-contexts/navigation-in-onload_form-submission-dynamic-iframe.tentative.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,16 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Navigation in onload handler through form submission in a dynamically created iframe</title> | ||
<script> | ||
function test() { | ||
let testFrame = document.createElement("iframe"); | ||
testFrame.src = "navigation-in-onload_form-submission-1.tentative.html"; | ||
document.body.appendChild(testFrame); | ||
} | ||
</script> | ||
</head> | ||
<body onload="test();"> | ||
</body> | ||
</html> |
10 changes: 10 additions & 0 deletions
10
...n-history-of-browsing-contexts/navigation-in-onload_form-submission-iframe.tentative.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,10 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Navigation in onload handler through form submission in an iframe</title> | ||
</head> | ||
<body> | ||
<iframe id="testFrame" src="navigation-in-onload_form-submission-1.tentative.html"></iframe> | ||
</body> | ||
</html> |