mirror of
https://github.com/servo/servo
synced 2026-05-01 03:47:53 +02: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:
@@ -4,6 +4,7 @@
|
||||
|
||||
use std::ascii::AsciiExt;
|
||||
|
||||
use document_loader::LoadType;
|
||||
use dom::attr::Attr;
|
||||
use dom::attr::AttrHelpers;
|
||||
use dom::bindings::cell::DOMRefCell;
|
||||
@@ -34,7 +35,7 @@ use script_task::{ScriptMsg, Runnable};
|
||||
use encoding::all::UTF_8;
|
||||
use encoding::label::encoding_from_whatwg_label;
|
||||
use encoding::types::{Encoding, EncodingRef, DecoderTrap};
|
||||
use net_traits::{load_whole_resource, Metadata};
|
||||
use net_traits::Metadata;
|
||||
use util::str::{DOMString, HTML_SPACE_CHARACTERS, StaticStringVec};
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
@@ -261,7 +262,9 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
|
||||
// state of the element's `crossorigin` content attribute, the origin being
|
||||
// the origin of the script element's node document, and the default origin
|
||||
// behaviour set to taint.
|
||||
ScriptOrigin::External(load_whole_resource(&window.resource_task(), url))
|
||||
let doc = document_from_node(self).root();
|
||||
let contents = doc.r().load_sync(LoadType::Script(url));
|
||||
ScriptOrigin::External(contents)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user