From 50d1ac9f6b78c6f85b2e0f2894390c24b9c20b46 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Wed, 22 Nov 2023 10:02:13 -0700 Subject: [PATCH] fix(runtime): fix for panic in classic workers (#21300) Fixes #21299 --- runtime/web_worker.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index cd54581095..29b6aa3709 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -756,9 +756,16 @@ impl WebWorker { return Poll::Ready(Err(e)); } - panic!( - "coding error: either js is polling or the worker is terminated" - ); + // TODO(mmastrac): we don't want to test this w/classic workers because + // WPT triggers a failure here. This is only exposed via --enable-testing-features-do-not-use. + if self.worker_type == WebWorkerType::Module { + panic!( + "coding error: either js is polling or the worker is terminated" + ); + } else { + eprintln!("classic worker terminated unexpectedly"); + Poll::Ready(Ok(())) + } } Poll::Pending => Poll::Pending, }