mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement a DocumentLoader type that tracks pending loads and notifies the script task when the queue is empty. Dispatch the document load event based on the DocumentLoader's notification.
This commit is contained in:
parent
29a43a00b3
commit
7f0706ed42
11 changed files with 243 additions and 38 deletions
|
@ -7,9 +7,11 @@
|
|||
//! This module contains smart pointers to global scopes, to simplify writing
|
||||
//! code that works in workers as well as window scopes.
|
||||
|
||||
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||
use dom::bindings::conversions::native_from_reflector_jsmanaged;
|
||||
use dom::bindings::js::{JS, JSRef, Rootable, Root, Unrooted};
|
||||
use dom::bindings::utils::{Reflectable, Reflector};
|
||||
use dom::document::DocumentHelpers;
|
||||
use dom::workerglobalscope::{WorkerGlobalScope, WorkerGlobalScopeHelpers};
|
||||
use dom::window::{self, WindowHelpers};
|
||||
use devtools_traits::DevtoolsControlChan;
|
||||
|
@ -101,7 +103,12 @@ impl<'a> GlobalRef<'a> {
|
|||
/// Get the `ResourceTask` for this global scope.
|
||||
pub fn resource_task(&self) -> ResourceTask {
|
||||
match *self {
|
||||
GlobalRef::Window(ref window) => window.resource_task().clone(),
|
||||
GlobalRef::Window(ref window) => {
|
||||
let doc = window.Document().root();
|
||||
let doc = doc.r();
|
||||
let loader = doc.loader();
|
||||
loader.resource_task.clone()
|
||||
}
|
||||
GlobalRef::Worker(ref worker) => worker.resource_task().clone(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue