WebWorker: Ensure global object has URL set before fetching

As explained by the comment in the code. I believe this to be a
spec issue, which I will report.
This commit is contained in:
Shannon Booth 2025-05-24 21:27:34 +12:00 committed by Tim Flynn
commit 9aabe88795
Notes: github-actions[bot] 2025-05-24 13:52:44 +00:00

View file

@ -245,6 +245,11 @@ void WorkerHost::run(GC::Ref<Web::Page> page, Web::HTML::TransferDataHolder mess
};
auto on_complete = Web::HTML::create_on_fetch_script_complete(inside_settings->vm().heap(), move(on_complete_function));
// AD-HOC: Fetching a script performs actions such as for blobs checking that they are on the same partition
// based on origin. However, this is performed before the consume body algorithm is run, where
// this URL for that worker is set. As a workaround, set the URL upfront.
worker_global_scope->set_url(m_url);
// 14. Obtain script by switching on the value of options's type member:
// classic: Fetch a classic worker script given url, outside settings, destination, inside settings,
// and with onComplete and performFetch as defined below.