Stop DedicatedWorker from handling remaining messages after closed (#37471)

Stop DedicatedWorker from handling remaining messages after closed

Testing: WPT workers/WorkerGlobalScope-close.html

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
This commit is contained in:
Xiaocheng Hu 2025-06-15 16:09:08 +08:00 committed by GitHub
parent 9352a9db7c
commit f09042340c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -618,6 +618,9 @@ impl DedicatedWorkerGlobalScope {
} }
fn handle_mixed_message(&self, msg: MixedMessage, can_gc: CanGc) -> bool { fn handle_mixed_message(&self, msg: MixedMessage, can_gc: CanGc) -> bool {
if self.upcast::<WorkerGlobalScope>().is_closing() {
return false;
}
// FIXME(#26324): `self.worker` is None in devtools messages. // FIXME(#26324): `self.worker` is None in devtools messages.
match msg { match msg {
MixedMessage::Devtools(msg) => match msg { MixedMessage::Devtools(msg) => match msg {

View file

@ -1,3 +0,0 @@
[WorkerGlobalScope-close.html]
[Test sending a message after closing.]
expected: FAIL