Fix document load event firing after pipeline is closed.

This commit is contained in:
Glenn Watson 2015-05-21 08:05:58 +10:00
parent fada39164c
commit b84c6fa5db
3 changed files with 32 additions and 9 deletions

View file

@ -1830,13 +1830,17 @@ impl DocumentProgressHandler {
impl Runnable for DocumentProgressHandler {
fn handler(self: Box<DocumentProgressHandler>) {
match self.task {
DocumentProgressTask::DOMContentLoaded => {
self.dispatch_dom_content_loaded();
}
DocumentProgressTask::Load => {
self.set_ready_state_complete();
self.dispatch_load();
let document = self.addr.to_temporary().root();
let window = document.r().window().root();
if window.r().is_alive() {
match self.task {
DocumentProgressTask::DOMContentLoaded => {
self.dispatch_dom_content_loaded();
}
DocumentProgressTask::Load => {
self.set_ready_state_complete();
self.dispatch_load();
}
}
}
}