mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Fix null realm assertion when activating a service worker (#36256)
Ensure there is an active realm when dispatching the `activation` DOM event to the ServiceWorker global. Testing: Existing WPT coverage. Fixes: #36114 Fixes: #36235 Fixes: #36231 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
be38c5478f
commit
fcef1dff9d
50 changed files with 579 additions and 116 deletions
|
@ -376,11 +376,11 @@ impl ServiceWorkerGlobalScope {
|
|||
|
||||
{
|
||||
// TODO: use AutoWorkerReset as in dedicated worker?
|
||||
let _ac = enter_realm(scope);
|
||||
let realm = enter_realm(scope);
|
||||
scope.execute_script(DOMString::from(source), CanGc::note());
|
||||
global.dispatch_activate(CanGc::note(), InRealm::entered(&realm));
|
||||
}
|
||||
|
||||
global.dispatch_activate(CanGc::note());
|
||||
let reporter_name = format!("service-worker-reporter-{}", random::<u64>());
|
||||
scope
|
||||
.upcast::<GlobalScope>()
|
||||
|
@ -476,7 +476,7 @@ impl ServiceWorkerGlobalScope {
|
|||
ScriptEventLoopSender::ServiceWorker(self.own_sender.clone())
|
||||
}
|
||||
|
||||
fn dispatch_activate(&self, can_gc: CanGc) {
|
||||
fn dispatch_activate(&self, can_gc: CanGc, _realm: InRealm) {
|
||||
let event = ExtendableEvent::new(self, atom!("activate"), false, false, can_gc);
|
||||
let event = (*event).upcast::<Event>();
|
||||
self.upcast::<EventTarget>().dispatch_event(event, can_gc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue