diff options
author | bors-servo <release+servo@mozilla.com> | 2014-05-06 12:58:18 -0400 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-05-06 12:58:18 -0400 |
commit | 03e0f911ec5ba005881cd4b1cc121b66648e51d6 (patch) | |
tree | 120e21c8490dbbb88352c084e239dadd7a40cefa /src/components/script/script_task.rs | |
parent | 1879bf95ee40c74bf78164f10817d726a7c4c6b9 (diff) | |
parent | d0387a399b4b398f918ee955dff0954ca949eb60 (diff) | |
download | servo-03e0f911ec5ba005881cd4b1cc121b66648e51d6.tar.gz servo-03e0f911ec5ba005881cd4b1cc121b66648e51d6.zip |
auto merge of #2344 : jdm/servo/iframefail, r=Ms2ger
Diffstat (limited to 'src/components/script/script_task.rs')
-rw-r--r-- | src/components/script/script_task.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index 249d13d6a99..32a51f33c92 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -36,7 +36,7 @@ use geom::point::Point2D; use geom::size::Size2D; use js::global::DEBUG_FNS; use js::jsapi::{JS_CallFunctionValue, JS_DefineFunctions}; -use js::jsapi::{JS_SetWrapObjectCallbacks, JS_SetGCZeal, JS_DEFAULT_ZEAL_FREQ}; +use js::jsapi::{JS_SetWrapObjectCallbacks, JS_SetGCZeal, JS_DEFAULT_ZEAL_FREQ, JS_GC}; use js::jsapi::{JSContext, JSRuntime}; use js::jsval::NullValue; use js::rust::{Cx, RtUtils}; @@ -872,14 +872,14 @@ impl ScriptTask { if page_tree.page().id == id { debug!("shutting down layout for root page {:?}", id); *self.js_context.borrow_mut() = None; - shut_down_layout(&mut *page_tree); + shut_down_layout(&mut *page_tree, (*self.js_runtime).ptr); return true } // otherwise find just the matching page and exit all sub-pages match page_tree.remove(id) { Some(ref mut page_tree) => { - shut_down_layout(&mut *page_tree); + shut_down_layout(&mut *page_tree, (*self.js_runtime).ptr); false } // TODO(tkuehn): pipeline closing is currently duplicated across @@ -1247,7 +1247,7 @@ impl ScriptTask { } /// Shuts down layout for the given page tree. -fn shut_down_layout(page_tree: &mut PageTree) { +fn shut_down_layout(page_tree: &mut PageTree, rt: *JSRuntime) { for page in page_tree.iter() { page.join_layout(); @@ -1269,6 +1269,12 @@ fn shut_down_layout(page_tree: &mut PageTree) { *page.mut_js_info() = None; } + // Force a GC to make sure that our DOM reflectors are released before we tell + // layout to exit. + unsafe { + JS_GC(rt); + } + // 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; |