diff options
Diffstat (limited to 'components/script/timers.rs')
-rw-r--r-- | components/script/timers.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/components/script/timers.rs b/components/script/timers.rs index 5d8893c3055..5e236f07494 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -218,6 +218,13 @@ impl OneshotTimers { } for timer in timers_to_run { + // Since timers can be coalesced together inside a task, + // this loop can keep running, including after an interrupt of the JS, + // and prevent a clean-shutdown of a JS-running thread. + // This check prevents such a situation. + if !global.can_continue_running() { + return; + } let callback = timer.callback; callback.invoke(global, &self.js_timers); } |