mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 08:25:07 +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:
parent
f7ff1fd985
commit
9acc542059
19 changed files with 62 additions and 49 deletions
|
@ -634,14 +634,14 @@ Bindings::RequestDuplex Request::duplex() const
|
|||
// https://fetch.spec.whatwg.org/#dom-request-clone
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::clone() const
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& realm = this->realm();
|
||||
|
||||
// 1. If this is unusable, then throw a TypeError.
|
||||
if (is_unusable())
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Request is unusable"sv };
|
||||
|
||||
// 2. Let clonedRequest be the result of cloning this’s request.
|
||||
auto cloned_request = TRY(m_request->clone(vm));
|
||||
auto cloned_request = TRY(m_request->clone(realm));
|
||||
|
||||
// 3. Let clonedRequestObject be the result of creating a Request object, given clonedRequest, this’s headers’s guard, and this’s relevant Realm.
|
||||
auto cloned_request_object = TRY(Request::create(HTML::relevant_realm(*this), cloned_request, m_headers->guard()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue