mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibWeb: Ensure a Web::Page is associated with local Worker LoadRequests
This is a hack on top of a hack because Workers don't *really* need to
have a Web::Page at all, but the ResourceLoader infra that should be
going away soon ™️ is not quite ready to axe that requirement for
cookies.
This commit is contained in:
parent
5586340cf3
commit
d7d84ee931
2 changed files with 6 additions and 1 deletions
|
@ -36,6 +36,7 @@
|
|||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HTML/WorkerGlobalScope.h>
|
||||
#include <LibWeb/HighResolutionTime/TimeOrigin.h>
|
||||
#include <LibWeb/Loader/LoadRequest.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
|
@ -1728,6 +1729,8 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> nonstandard_resource_load
|
|||
auto& global_object = realm.global_object();
|
||||
if (is<HTML::Window>(global_object))
|
||||
page = static_cast<HTML::Window&>(global_object).page();
|
||||
else if (is<HTML::WorkerGlobalScope>(global_object))
|
||||
page = static_cast<HTML::WorkerGlobalScope&>(global_object).page();
|
||||
|
||||
// NOTE: Using LoadRequest::create_for_url_on_page here will unconditionally add cookies as long as there's a page available.
|
||||
// However, it is up to http_network_or_cache_fetch to determine if cookies should be added to the request.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue