1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibWeb: Use the realm from the ServiceWorker client

`vm.realm()` might not exist, and was probably not even the right realm
to use in the first place.
This commit is contained in:
Jonne Ransijn 2024-11-03 16:31:39 +01:00 committed by Andrew Kaster
parent 3da20aca65
commit 7402ae3a00
Notes: github-actions[bot] 2024-11-03 22:27:43 +00:00

View file

@ -401,7 +401,7 @@ static void update(JS::VM& vm, JS::NonnullGCPtr<Job> job)
// 16. If runResult is failure or an abrupt completion, then:
// 17. Else, invoke Install algorithm with job, worker, and registration as its arguments.
if (job->client) {
auto& realm = *vm.current_realm();
auto& realm = job->client->realm();
auto context = HTML::TemporaryExecutionContext(realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes);
WebIDL::reject_promise(realm, *job->job_promise, *vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Run Service Worker"sv).value());
finish_job(vm, job);
@ -428,7 +428,7 @@ static void unregister(JS::VM& vm, JS::NonnullGCPtr<Job> job)
{
// If there's no client, there won't be any promises to resolve
if (job->client) {
auto& realm = *vm.current_realm();
auto& realm = job->client->realm();
auto context = HTML::TemporaryExecutionContext(realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes);
WebIDL::reject_promise(realm, *job->job_promise, *vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Service Worker unregistration"sv).value());
finish_job(vm, job);