mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-28 21:26:22 +00: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:
parent
3da20aca65
commit
7402ae3a00
Notes:
github-actions[bot]
2024-11-03 22:27:43 +00:00
Author: https://github.com/yyny
Commit: 7402ae3a00
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2138
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/tcl3
1 changed files with 2 additions and 2 deletions
|
@ -401,7 +401,7 @@ static void update(JS::VM& vm, JS::NonnullGCPtr<Job> job)
|
||||||
// 16. If runResult is failure or an abrupt completion, then:
|
// 16. If runResult is failure or an abrupt completion, then:
|
||||||
// 17. Else, invoke Install algorithm with job, worker, and registration as its arguments.
|
// 17. Else, invoke Install algorithm with job, worker, and registration as its arguments.
|
||||||
if (job->client) {
|
if (job->client) {
|
||||||
auto& realm = *vm.current_realm();
|
auto& realm = job->client->realm();
|
||||||
auto context = HTML::TemporaryExecutionContext(realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes);
|
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());
|
WebIDL::reject_promise(realm, *job->job_promise, *vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Run Service Worker"sv).value());
|
||||||
finish_job(vm, job);
|
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 there's no client, there won't be any promises to resolve
|
||||||
if (job->client) {
|
if (job->client) {
|
||||||
auto& realm = *vm.current_realm();
|
auto& realm = job->client->realm();
|
||||||
auto context = HTML::TemporaryExecutionContext(realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes);
|
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());
|
WebIDL::reject_promise(realm, *job->job_promise, *vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Service Worker unregistration"sv).value());
|
||||||
finish_job(vm, job);
|
finish_job(vm, job);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue