1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 04:34:59 +00:00

LibWeb: Propagate Realm instead of VM more through Fetch

This makes Fetch rely less on using main_thread_vm().current_realm(),
which relies on the dummy execution context if no JavaScript is
currently running.
This commit is contained in:
Luke Wilde 2023-02-28 17:45:49 +00:00 committed by Linus Groh
parent f7ff1fd985
commit 9acc542059
19 changed files with 62 additions and 49 deletions

View file

@ -759,7 +759,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_fetch(JS::Realm& rea
// 4. If requests service-workers mode is "all", then:
if (request->service_workers_mode() == Infrastructure::Request::ServiceWorkersMode::All) {
// 1. Let requestForServiceWorker be a clone of request.
auto request_for_service_worker = TRY(request->clone(vm));
auto request_for_service_worker = TRY(request->clone(realm));
// 2. If requestForServiceWorkers body is non-null, then:
if (!request_for_service_worker->body().has<Empty>()) {
@ -1147,7 +1147,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
// NOTE: Implementations are encouraged to avoid teeing requests bodys stream when requests bodys
// source is null as only a single body is needed in that case. E.g., when requests bodys source
// is null, redirects and authentication will end up failing the fetch.
http_request = TRY(request->clone(vm));
http_request = TRY(request->clone(realm));
// 2. Set httpFetchParams to a copy of fetchParams.
// 3. Set httpFetchParamss request to httpRequest.