mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 09:18:55 +00:00
LibWeb/Fetch: Enable callbacks in the abort signal algorithm callback
If the request has a body, the abort will interact with promises, which requires callbacks to be enabled. Fixes crashing on Atlassian products.
This commit is contained in:
parent
4acd517d8f
commit
e2c935475f
Notes:
github-actions[bot]
2025-08-26 14:30:40 +00:00
Author: https://github.com/Lubrsi
Commit: e2c935475f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5993
Reviewed-by: https://github.com/gmta ✅
3 changed files with 14 additions and 1 deletions
|
@ -143,7 +143,7 @@ GC::Ref<WebIDL::Promise> fetch(JS::VM& vm, RequestInfo const& input, RequestInit
|
|||
controller_holder->controller()->abort(relevant_realm, request_object->signal()->reason());
|
||||
|
||||
// AD-HOC: An execution context is required for Promise functions.
|
||||
HTML::TemporaryExecutionContext execution_context { relevant_realm };
|
||||
HTML::TemporaryExecutionContext execution_context { relevant_realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes };
|
||||
|
||||
// 4. Abort the fetch() call with p, request, responseObject, and requestObject’s signal’s abort reason.
|
||||
abort_fetch(relevant_realm, *promise_capability, request, response_object, request_object->signal()->reason());
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
PASS! (Didn't crash)
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
asyncTest((done) => {
|
||||
const timeoutSignal = AbortSignal.timeout(0);
|
||||
fetch('data:text/plain,fetched from far', { signal: timeoutSignal, body: "message in a bottle", method: "POST" });
|
||||
setTimeout(() => {
|
||||
println("PASS! (Didn't crash)");
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue