-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: fix
AbortSignal.timeout
parameter validation
PR-URL: #42856 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
- Loading branch information
1 parent
f10f2c1
commit d7470ad
Showing
8 changed files
with
207 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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,19 @@ | ||
<!DOCTYPE HTML> | ||
<meta charset=utf-8> | ||
<title>AbortSignal.timeout frame detach</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="iframe"></iframe> | ||
<script> | ||
async_test(t => { | ||
const signal = iframe.contentWindow.AbortSignal.timeout(5); | ||
signal.onabort = t.unreached_func("abort must not fire"); | ||
|
||
iframe.remove(); | ||
|
||
t.step_timeout(() => { | ||
assert_false(signal.aborted); | ||
t.done(); | ||
}, 10); | ||
}, "Signal returned by AbortSignal.timeout() is not aborted after frame detach"); | ||
</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,22 @@ | ||
<!DOCTYPE html> | ||
<html class="test-wait"> | ||
<meta charset="utf-8"> | ||
<iframe id="iframe"></iframe> | ||
<script> | ||
const srcdoc = ` | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<script> | ||
const xhr = new XMLHttpRequest() | ||
setTimeout(() => { | ||
xhr.open('GET', '/', false) | ||
xhr.send() | ||
AbortSignal.timeout(41.62684667994843) | ||
}, 1) | ||
setTimeout(() => { | ||
location.href = "about:blank" | ||
parent.document.documentElement.classList.remove("test-wait") | ||
}, 0) | ||
</` + "script>"; | ||
iframe.srcdoc = srcdoc; | ||
</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
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>AbortSignal.reason constructor</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="iframe"></iframe> | ||
<script> | ||
test(() => { | ||
const aborted = iframe.contentWindow.AbortSignal.abort(); | ||
assert_equals(aborted.reason.constructor, iframe.contentWindow.DOMException, "DOMException is using the correct global"); | ||
}, "AbortSignal.reason.constructor should be from iframe"); | ||
</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