LibWeb: Use the realm from the ServiceWorker client
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

`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);