diff options
author | Glenn Watson <gw@intuitionlibrary.com> | 2015-02-06 14:59:42 +1000 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2015-02-06 15:28:02 +1000 |
commit | 5ef9eaa1e1653a2eda62388fc47e932e6fdda254 (patch) | |
tree | 1cef137d55e48b60c8b3e393cc945554a5b95857 | |
parent | 237cdee9e462bc7b070d9fe1a7722ad961ff25c2 (diff) | |
download | servo-5ef9eaa1e1653a2eda62388fc47e932e6fdda254.tar.gz servo-5ef9eaa1e1653a2eda62388fc47e932e6fdda254.zip |
Fix page being removed too early. Fixes #3986 (intermittent failure).
-rw-r--r-- | components/script/script_task.rs | 10 | ||||
-rw-r--r-- | tests/content/test_iframe_contentDocument.html (renamed from tests/content/test_iframe_contentDocument.html.disabled) | 0 |
2 files changed, 6 insertions, 4 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 11245f59dfa..f46f2aa70ed 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -752,9 +752,10 @@ impl ScriptTask { } // otherwise find just the matching page and exit all sub-pages - match page.remove(id) { + match page.find(id) { Some(ref mut page) => { shut_down_layout(&*page, (*self.js_runtime).ptr, exit_type); + page.remove(id); false } // TODO(tkuehn): pipeline closing is currently duplicated across @@ -1309,8 +1310,9 @@ fn shut_down_layout(page_tree: &Rc<Page>, rt: *mut JSRuntime, exit_type: Pipelin // processed this message. let (response_chan, response_port) = channel(); let LayoutChan(ref chan) = page.layout_chan; - chan.send(layout_interface::Msg::PrepareToExit(response_chan)).unwrap(); - response_port.recv().unwrap(); + if chan.send(layout_interface::Msg::PrepareToExit(response_chan)).is_ok() { + response_port.recv().unwrap(); + } } // Remove our references to the DOM objects in this page tree. @@ -1332,7 +1334,7 @@ fn shut_down_layout(page_tree: &Rc<Page>, rt: *mut JSRuntime, exit_type: Pipelin // Destroy the layout task. If there were node leaks, layout will now crash safely. for page in page_tree.iter() { let LayoutChan(ref chan) = page.layout_chan; - chan.send(layout_interface::Msg::ExitNow(exit_type)).unwrap(); + chan.send(layout_interface::Msg::ExitNow(exit_type)).ok(); } } diff --git a/tests/content/test_iframe_contentDocument.html.disabled b/tests/content/test_iframe_contentDocument.html index 93e5c9c8c62..93e5c9c8c62 100644 --- a/tests/content/test_iframe_contentDocument.html.disabled +++ b/tests/content/test_iframe_contentDocument.html |