Fix several hangs / panics during pipeline cleanup of in progress loads.

This fixes a hang found while testing the jQuery test suite.
This commit is contained in:
Glenn Watson 2015-05-19 16:14:25 +10:00
parent 90aacf00f8
commit 35a570ab66
7 changed files with 46 additions and 10 deletions

View file

@ -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;
}