diff options
author | Josh Matthews <josh@joshmatthews.net> | 2014-10-13 08:20:06 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2015-05-11 13:41:51 -0400 |
commit | 7f0706ed42b33ec1da6bf9741811ca97d566ed45 (patch) | |
tree | 9d74b8a50145afb05bd10d6860227f4af17a5754 /components/script/dom/domimplementation.rs | |
parent | 29a43a00b39e544596e3bcce9bdfca2159313ba5 (diff) | |
download | servo-7f0706ed42b33ec1da6bf9741811ca97d566ed45.tar.gz servo-7f0706ed42b33ec1da6bf9741811ca97d566ed45.zip |
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.
Diffstat (limited to 'components/script/dom/domimplementation.rs')
-rw-r--r-- | components/script/dom/domimplementation.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs index 3400c1d3ea3..d64ad103aa1 100644 --- a/components/script/dom/domimplementation.rs +++ b/components/script/dom/domimplementation.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use document_loader::DocumentLoader; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::DOMImplementationBinding; use dom::bindings::codegen::Bindings::DOMImplementationBinding::DOMImplementationMethods; @@ -63,11 +64,13 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> { fn CreateDocument(self, namespace: Option<DOMString>, qname: DOMString, maybe_doctype: Option<JSRef<DocumentType>>) -> Fallible<Temporary<Document>> { let doc = self.document.root(); - let win = doc.r().window().root(); + let doc = doc.r(); + let win = doc.window().root(); + let loader = DocumentLoader::new(&*doc.loader()); // Step 1. let doc = Document::new(win.r(), None, IsHTMLDocument::NonHTMLDocument, - None, None, DocumentSource::NotFromParser).root(); + None, None, DocumentSource::NotFromParser, loader).root(); // Step 2-3. let maybe_elem = if qname.is_empty() { None @@ -109,11 +112,13 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> { // https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument fn CreateHTMLDocument(self, title: Option<DOMString>) -> Temporary<Document> { let document = self.document.root(); - let win = document.r().window().root(); + let document = document.r(); + let win = document.window().root(); + let loader = DocumentLoader::new(&*document.loader()); // Step 1-2. let doc = Document::new(win.r(), None, IsHTMLDocument::HTMLDocument, None, None, - DocumentSource::NotFromParser).root(); + DocumentSource::NotFromParser, loader).root(); let doc_node: JSRef<Node> = NodeCast::from_ref(doc.r()); { |