diff options
author | Gregory Terzian <gterzian@users.noreply.github.com> | 2020-06-24 15:07:48 +0800 |
---|---|---|
committer | Gregory Terzian <gterzian@users.noreply.github.com> | 2020-06-30 13:22:38 +0800 |
commit | 44ebca72da45575df4e5970e25920c46c14aa0cb (patch) | |
tree | 88a9ed7d5529b9b83425d7b7cdd9b86f18ec12c2 /components/script/timers.rs | |
parent | 0b61cfc3ae803ac0f9deef937f890f83b24c9a35 (diff) | |
download | servo-44ebca72da45575df4e5970e25920c46c14aa0cb.tar.gz servo-44ebca72da45575df4e5970e25920c46c14aa0cb.zip |
ensure clean shutdown of all threads running JS
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); } |