mirror of
https://github.com/servo/servo.git
synced 2025-06-13 19:04:30 +00:00
fix intermittent Option::unwrap in timers fixes intermittent #8616 This intermittent indicates real problem in code. Lets consider such code: ```javascript // timer 1 setTimeout(function() { //timer 2 setTimeout(function() {}, 0); }, 0); ``` When we receive event to fire timer 1 it will be selected and extracted from active timers list in fire_timer function. During timer 1 handler execution we will schedule timer 2 and request timer event for it. But it will be executed during same fire_timer call because of 0 timeout. And as a result we will have empty timers list and expecting event for timer 2 that will crash in assert. I'm not sure that all I've written is clear, but we have something like this: ``` install timer 1 -> [1] in timers list push and expect timer event 1 -> expected_event=1 received timer event 1 fire_timer() select timer 1 to execute -> [] in timers list execute timer 1 handler install timer 2 -> [2] in timers list push and expect timer event 2 -> expected_event=2 select timer 2 to execute (because of 0 timeout) -> [] in tiemrs list execute timer 2 handler expected_event=2 is dangling received timer event 2 fire_timer() -> BOOM ``` <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8768) <!-- Reviewable:end --> |
||
---|---|---|
.. | ||
docs | ||
dom | ||
parse | ||
build.rs | ||
Cargo.toml | ||
clipboard_provider.rs | ||
cors.rs | ||
devtools.rs | ||
document_loader.rs | ||
layout_interface.rs | ||
lib.rs | ||
makefile.cargo | ||
mem.rs | ||
network_listener.rs | ||
page.rs | ||
reporter.rs | ||
script_task.rs | ||
textinput.rs | ||
timers.rs | ||
unpremultiplytable.rs | ||
webdriver_handlers.rs |