aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorJames Graham <james@hoppipolla.co.uk>2015-09-18 16:42:03 +0100
committerJames Graham <james@hoppipolla.co.uk>2015-09-24 13:43:05 +0100
commitf8cd0d9b3bd3924c0d99462bad25f4ad2dad8a01 (patch)
tree04a0db55306afb225f0c74629cb36393440a75a7 /components/script/script_task.rs
parent2623f58a4b2b302c354257632e3ff67d1dfa72d9 (diff)
downloadservo-f8cd0d9b3bd3924c0d99462bad25f4ad2dad8a01.tar.gz
servo-f8cd0d9b3bd3924c0d99462bad25f4ad2dad8a01.zip
Prevent crash trying to freeze script task with no page.
This fixes a crash resulting from a race between loading an initial document and navigating to a subsequent document. If the navigation happens before the initial document has had a chance to create its root page, we crash trying to unwrap a None. Note that the are likely further similar timing issues with more complex sequences of navigation and history manipulation.
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 96ff1a751eb..1c3b6c2cd37 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -1282,6 +1282,11 @@ impl ScriptTask {
/// Handles freeze message
fn handle_freeze_msg(&self, id: PipelineId) {
+ // Workaround for a race condition when navigating before the initial page has
+ // been constructed c.f. https://github.com/servo/servo/issues/7677
+ if self.page.borrow().is_none() {
+ return
+ };
let page = self.root_page();
let page = page.find(id).expect("ScriptTask: received freeze msg for a
pipeline ID not associated with this script task. This is a bug.");