-
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.
Test during load; figured out a way to stop HTML escaping
- Loading branch information
Showing
14 changed files
with
283 additions
and
22 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...browsing-the-web/navigating-across-documents/replace-before-load/a-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,35 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/helpers.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"; | ||
document.body.append(a); | ||
a.click(); | ||
}; | ||
`; | ||
|
||
const startURL = "resources/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, "history.length must not change after waiting for the replacement"); | ||
|
||
await checkSentinelIframe(t, sentinelIframe); | ||
assert_equals(history.length, startingHistoryLength, "history.length must not change after checking the sentinel iframe"); | ||
}, "Replace during the load event, triggered by aElement.click()"); | ||
</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
41 changes: 41 additions & 0 deletions
41
...sing-the-web/navigating-across-documents/replace-before-load/form-submit-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,41 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/helpers.js"></script> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
promise_test(async t => { | ||
const sentinelIframe = await setupSentinelIframe(t); | ||
const startingHistoryLength = history.length; | ||
|
||
const code = ` | ||
window.onload = () => { | ||
const form = document.createElement("form"); | ||
form.action = "/common/blank.html"; | ||
const input = document.createElement("input"); | ||
input.type = "hidden"; | ||
input.name = "thereplacement"; | ||
form.append(input); | ||
document.body.append(form); | ||
form.submit(); | ||
}; | ||
`; | ||
|
||
const startURL = "resources/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, "history.length must not change after waiting for the replacement"); | ||
|
||
await checkSentinelIframe(t, sentinelIframe); | ||
assert_equals(history.length, startingHistoryLength, "history.length must not change after checking the sentinel iframe"); | ||
}, "Replace during the load event, triggered by formElement.submit()"); | ||
</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
31 changes: 31 additions & 0 deletions
31
...he-web/navigating-across-documents/replace-before-load/history-pushstate-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,31 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/helpers.js"></script> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
promise_test(async t => { | ||
const sentinelIframe = await setupSentinelIframe(t); | ||
const startingHistoryLength = history.length; | ||
|
||
const code = ` | ||
window.onload = () => { | ||
history.pushState(null, null, "/common/blank.html?thereplacement"); | ||
}; | ||
`; | ||
|
||
const startURL = "resources/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, "history.length must not change after waiting for the replacement"); | ||
|
||
await checkSentinelIframe(t, sentinelIframe); | ||
assert_equals(history.length, startingHistoryLength, "history.length must not change after checking the sentinel iframe"); | ||
}, "Replace during the load event, triggered by history.pushState()"); | ||
</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
31 changes: 31 additions & 0 deletions
31
...-the-web/navigating-across-documents/replace-before-load/location-assign-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,31 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/helpers.js"></script> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
promise_test(async t => { | ||
const sentinelIframe = await setupSentinelIframe(t); | ||
const startingHistoryLength = history.length; | ||
|
||
const code = ` | ||
window.onload = () => { | ||
location.assign("/common/blank.html?thereplacement"); | ||
}; | ||
`; | ||
|
||
const startURL = "resources/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, "history.length must not change after waiting for the replacement"); | ||
|
||
await checkSentinelIframe(t, sentinelIframe); | ||
assert_equals(history.length, startingHistoryLength, "history.length must not change after checking the sentinel iframe"); | ||
}, "Replace during the load event, triggered by location.assign()"); | ||
</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
76 changes: 76 additions & 0 deletions
76
...-the-web/navigating-across-documents/replace-before-load/location-setter-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,76 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Replace during the load event, triggered by location setters</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/helpers.js"></script> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
|
||
promise_test(async t => { | ||
const sentinelIframe = await setupSentinelIframe(t); | ||
const startingHistoryLength = history.length; | ||
|
||
const code = ` | ||
window.onload = () => { | ||
location.href = "/common/blank.html?thereplacement"; | ||
}; | ||
`; | ||
|
||
const startURL = "resources/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, "history.length must not change after waiting for the replacement"); | ||
|
||
await checkSentinelIframe(t, sentinelIframe); | ||
assert_equals(history.length, startingHistoryLength, "history.length must not change after checking the sentinel iframe"); | ||
}, "href"); | ||
|
||
promise_test(async t => { | ||
const sentinelIframe = await setupSentinelIframe(t); | ||
const startingHistoryLength = history.length; | ||
|
||
const code = ` | ||
window.onload = () => { | ||
location.search = "thereplacement"; | ||
}; | ||
`; | ||
|
||
const startURL = "resources/code-injector.html?pipe=sub(none)&code=" + encodeURIComponent(code); | ||
const afterReplacementURL = "resources/code-injector.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, "history.length must not change after waiting for the replacement"); | ||
|
||
await checkSentinelIframe(t, sentinelIframe); | ||
}, "search"); | ||
|
||
promise_test(async t => { | ||
const sentinelIframe = await setupSentinelIframe(t); | ||
const startingHistoryLength = history.length; | ||
|
||
const code = ` | ||
window.onload = () => { | ||
location.hash = "thereplacement"; | ||
}; | ||
`; | ||
|
||
const startURL = "resources/code-injector.html?pipe=sub(none)&code=" + encodeURIComponent(code); | ||
const afterReplacementURL = startURL + "#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, "history.length must not change after waiting for the replacement"); | ||
|
||
await checkSentinelIframe(t, sentinelIframe); | ||
assert_equals(history.length, startingHistoryLength, "history.length must not change after checking the sentinel iframe"); | ||
}, "hash"); | ||
</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
File renamed without changes.
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
32 changes: 32 additions & 0 deletions
32
...sing-the-web/navigating-across-documents/replace-before-load/window-open-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,32 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="resources/helpers.js"></script> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
promise_test(async t => { | ||
const sentinelIframe = await setupSentinelIframe(t); | ||
const startingHistoryLength = history.length; | ||
|
||
const code = ` | ||
window.onload = () => { | ||
window.open("/common/blank.html?thereplacement", "_self"); | ||
}; | ||
`; | ||
|
||
const startURL = "resources/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, "history.length must not change after waiting for the replacement"); | ||
|
||
await checkSentinelIframe(t, sentinelIframe); | ||
assert_equals(history.length, startingHistoryLength, "history.length must not change after checking the sentinel iframe"); | ||
}, "Replace during the load event, triggered by window.open()"); | ||
</script> |
Oops, something went wrong.