Separate disposing of layout data from the GCing of the DOM object reflectors. Change the order of operations when shutting down the script task to ensure that Window globals aren't used after they've been GCed.

This commit is contained in:
Josh Matthews 2015-02-26 00:19:27 -05:00
parent c816975750
commit 4972b623e1
3 changed files with 20 additions and 11 deletions

View file

@ -461,6 +461,9 @@ impl<'a, T: Reflectable> ScriptHelpers for JSRef<'a, T> {
impl<'a> WindowHelpers for JSRef<'a, Window> {
fn clear_js_context(self) {
let document = self.Document().root();
NodeCast::from_ref(document.r()).teardown();
*self.js_context.borrow_mut() = None;
*self.browser_context.borrow_mut() = None;
}