diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-05-19 21:44:45 -0500 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-05-19 21:44:45 -0500 |
commit | c51e9f04559f04f1e820b792261e1653c6869ee5 (patch) | |
tree | 2b403bad1b01e64a4462ea46544eb8396c6549cd /components/script/dom | |
parent | e2b0922d42e18362ec9ae79feaffed601142e586 (diff) | |
parent | 41c243e853a1a19bac512fd26b6c9bae3402c4df (diff) | |
download | servo-c51e9f04559f04f1e820b792261e1653c6869ee5.tar.gz servo-c51e9f04559f04f1e820b792261e1653c6869ee5.zip |
Auto merge of #6131 - glennw:jquery-exit-fix, r=jdm
This fixes a hang found while testing the jQuery test suite.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6131)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/window.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 2621a9498a3..f791464366d 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -584,6 +584,17 @@ impl<'a> WindowHelpers for JSRef<'a, Window> { let document = self.Document().root(); NodeCast::from_ref(document.r()).teardown(); + // The above code may not catch all DOM objects + // (e.g. DOM objects removed from the tree that haven't + // been collected yet). Forcing a GC here means that + // those DOM objects will be able to call dispose() + // to free their layout data before the layout task + // exits. Without this, those remaining objects try to + // send a message to free their layout data to the + // layout task when the script task is dropped, + // which causes a panic! + self.Gc(); + *self.js_runtime.borrow_mut() = None; *self.browser_context.borrow_mut() = None; } |