@@ -33,6 +33,7 @@ use deno_core::ModuleId;
33
33
use deno_core:: ModuleLoader ;
34
34
use deno_core:: ModuleSpecifier ;
35
35
use deno_core:: OpMetricsSummaryTracker ;
36
+ use deno_core:: PollEventLoopOptions ;
36
37
use deno_core:: RuntimeOptions ;
37
38
use deno_core:: SharedArrayBufferStore ;
38
39
use deno_core:: Snapshot ;
@@ -711,6 +712,11 @@ impl WebWorker {
711
712
id : ModuleId ,
712
713
) -> Result < ( ) , AnyError > {
713
714
let mut receiver = self . js_runtime . mod_evaluate ( id) ;
715
+ let poll_options = PollEventLoopOptions {
716
+ wait_for_inspector : false ,
717
+ ..Default :: default ( )
718
+ } ;
719
+
714
720
tokio:: select! {
715
721
biased;
716
722
@@ -722,7 +728,7 @@ impl WebWorker {
722
728
maybe_result. unwrap_or( Ok ( ( ) ) )
723
729
}
724
730
725
- event_loop_result = self . run_event_loop( false ) => {
731
+ event_loop_result = self . run_event_loop( poll_options ) => {
726
732
if self . internal_handle. is_terminated( ) {
727
733
return Ok ( ( ) ) ;
728
734
}
@@ -736,7 +742,7 @@ impl WebWorker {
736
742
fn poll_event_loop (
737
743
& mut self ,
738
744
cx : & mut Context ,
739
- wait_for_inspector : bool ,
745
+ poll_options : PollEventLoopOptions ,
740
746
) -> Poll < Result < ( ) , AnyError > > {
741
747
// If awakened because we are terminating, just return Ok
742
748
if self . internal_handle . terminate_if_needed ( ) {
@@ -745,7 +751,7 @@ impl WebWorker {
745
751
746
752
self . internal_handle . terminate_waker . register ( cx. waker ( ) ) ;
747
753
748
- match self . js_runtime . poll_event_loop ( cx, wait_for_inspector ) {
754
+ match self . js_runtime . poll_event_loop2 ( cx, poll_options ) {
749
755
Poll :: Ready ( r) => {
750
756
// If js ended because we are terminating, just return Ok
751
757
if self . internal_handle . terminate_if_needed ( ) {
@@ -773,9 +779,9 @@ impl WebWorker {
773
779
774
780
pub async fn run_event_loop (
775
781
& mut self ,
776
- wait_for_inspector : bool ,
782
+ poll_options : PollEventLoopOptions ,
777
783
) -> Result < ( ) , AnyError > {
778
- poll_fn ( |cx| self . poll_event_loop ( cx, wait_for_inspector ) ) . await
784
+ poll_fn ( |cx| self . poll_event_loop ( cx, poll_options ) ) . await
779
785
}
780
786
781
787
// Starts polling for messages from worker host from JavaScript.
@@ -851,7 +857,12 @@ pub fn run_web_worker(
851
857
}
852
858
853
859
let result = if result. is_ok ( ) {
854
- worker. run_event_loop ( true ) . await
860
+ worker
861
+ . run_event_loop ( PollEventLoopOptions {
862
+ wait_for_inspector : true ,
863
+ ..Default :: default ( )
864
+ } )
865
+ . await
855
866
} else {
856
867
result
857
868
} ;
0 commit comments