-
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.
- Loading branch information
Showing
5 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...ing-the-web/navigating-across-documents/replace-before-load/a-user-click-during-load.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,36 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/helpers.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
promise_test(async t => { | ||
const sentinelIframe = await setupSentinelIframe(t); | ||
const startingHistoryLength = history.length; | ||
|
||
const code = ` | ||
window.onload = () => { | ||
const a = document.createElement("a"); | ||
a.href = "/common/blank.html?thereplacement"; | ||
a.id = "the-anchor"; | ||
a.textContent = "needs to have content to be clickable"; | ||
document.body.append(a); | ||
parent.test_driver.click(a); | ||
}; | ||
`; | ||
|
||
const startURL = "resources/slow-code-injector.html?pipe=sub(none)&code=" + encodeURIComponent(code); | ||
const afterReplacementURL = "/common/blank.html?thereplacement"; | ||
const iframe = insertIframe(t, startURL); | ||
|
||
assert_equals(history.length, startingHistoryLength, "Inserting the under-test iframe must not change history.length"); | ||
|
||
await waitForLoadAllowingIntermediateLoads(t, iframe, afterReplacementURL); | ||
assert_equals(history.length, startingHistoryLength + 1, "history.length must change after waiting for the load"); | ||
}, "User click on <a> during the load event must NOT replace"); | ||
</script> |
34 changes: 34 additions & 0 deletions
34
...owsers/browsing-the-web/navigating-across-documents/replace-before-load/a-user-click.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,34 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/helpers.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
promise_test(async t => { | ||
const sentinelIframe = await setupSentinelIframe(t); | ||
const startingHistoryLength = history.length; | ||
|
||
const code = ` | ||
const a = document.createElement("a"); | ||
a.href = "/common/blank.html?thereplacement"; | ||
a.id = "the-anchor"; | ||
a.textContent = "needs to have content to be clickable"; | ||
document.currentScript.before(a); | ||
parent.test_driver.click(a); | ||
`; | ||
|
||
const startURL = "resources/slow-code-injector.html?pipe=sub(none)&code=" + encodeURIComponent(code); | ||
const afterReplacementURL = "/common/blank.html?thereplacement"; | ||
const iframe = insertIframe(t, startURL); | ||
|
||
assert_equals(history.length, startingHistoryLength, "Inserting the under-test iframe must not change history.length"); | ||
|
||
await waitForLoad(t, iframe, afterReplacementURL); | ||
assert_equals(history.length, startingHistoryLength + 1, "history.length must change after waiting for the load"); | ||
}, "User click on <a> before the load event must NOT replace"); | ||
</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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
<meta charset="utf-8"> | ||
<title>Subframe</title> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
{{GET[code]}} | ||
|
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
12 changes: 12 additions & 0 deletions
12
...the-web/navigating-across-documents/replace-before-load/resources/slow-code-injector.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,12 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Subframe</title> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
{{GET[code]}} | ||
</script> | ||
|
||
<!-- This is necessary in cases involving user interaction because those happen async through the webdriver infrastructure --> | ||
<img src="/common/slow.py"> |