mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:47:35 +00:00
LibWeb: Implement AbortSignal.abort()
This returns an AbortSignal that is already set as aborted.
This commit is contained in:
parent
fa95e5ec0e
commit
3b7c252175
5 changed files with 43 additions and 1 deletions
4
Tests/LibWeb/Text/expected/abortsignal-abort.txt
Normal file
4
Tests/LibWeb/Text/expected/abortsignal-abort.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
Aborted: true
|
||||
Reason: "[object DOMException]"
|
||||
Aborted: true
|
||||
Reason: "This is a test"
|
19
Tests/LibWeb/Text/input/abortsignal-abort.html
Normal file
19
Tests/LibWeb/Text/input/abortsignal-abort.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
<script src="include.js"></script>
|
||||
<script>
|
||||
asyncTest(async done => {
|
||||
function testSignal(signal) {
|
||||
return fetch("./basic.html", { signal })
|
||||
.then(() => {
|
||||
println("FAIL");
|
||||
})
|
||||
.catch(error => {
|
||||
println(`Aborted: ${signal.aborted}`);
|
||||
println(`Reason: "${error}"`);
|
||||
});
|
||||
}
|
||||
|
||||
testSignal(AbortSignal.abort())
|
||||
.then(() => testSignal(AbortSignal.abort("This is a test")))
|
||||
.finally(done);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue