aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-09-21 18:49:33 -0500
committerGitHub <noreply@github.com>2016-09-21 18:49:33 -0500
commitf357afc94ac437c4323bcc4d46c2767ccef73b73 (patch)
tree2a5b7952f3b1c3ac3a5cd7facba026440815a8ba /components/script/dom/document.rs
parentecb44e748b090655bea9d519448c02d290b9e957 (diff)
parent6fbd2aa5b7628bd47971806ddf438cd350a60bee (diff)
downloadservo-f357afc94ac437c4323bcc4d46c2767ccef73b73.tar.gz
servo-f357afc94ac437c4323bcc4d46c2767ccef73b73.zip
Auto merge of #12472 - KiChjang:use-fetch-in-script, r=jdm
Use fetch infrastructure to load external scripts Fixes #9186. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12472) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 15cb50aa466..2cca84a625a 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -95,9 +95,10 @@ use js::jsapi::JS_GetRuntime;
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
use msg::constellation_msg::{PipelineId, ReferrerPolicy};
-use net_traits::{AsyncResponseTarget, IpcSend, PendingAsyncLoad};
+use net_traits::{AsyncResponseTarget, FetchResponseMsg, IpcSend, PendingAsyncLoad};
use net_traits::CookieSource::NonHTTP;
use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl};
+use net_traits::request::RequestInit;
use net_traits::response::HttpsState;
use num_traits::ToPrimitive;
use origin::Origin;
@@ -1433,6 +1434,14 @@ impl Document {
loader.load_async(load, listener, self, referrer_policy);
}
+ pub fn fetch_async(&self, load: LoadType,
+ request: RequestInit,
+ fetch_target: IpcSender<FetchResponseMsg>,
+ referrer_policy: Option<ReferrerPolicy>) {
+ let mut loader = self.loader.borrow_mut();
+ loader.fetch_async(load, request, fetch_target, self, referrer_policy);
+ }
+
pub fn finish_load(&self, load: LoadType) {
debug!("Document got finish_load: {:?}", load);
// The parser might need the loader, so restrict the lifetime of the borrow.
@@ -1520,7 +1529,7 @@ impl Document {
}
/// https://html.spec.whatwg.org/multipage/#the-end step 5 and the latter parts of
- /// https://html.spec.whatwg.org/multipage/#prepare-a-script 15.d and 15.e.
+ /// https://html.spec.whatwg.org/multipage/#prepare-a-script 20.d and 20.e.
pub fn process_asap_scripts(&self) {
// Execute the first in-order asap-executed script if it's ready, repeat as required.
// Re-borrowing the list for each step because it can also be borrowed under execute.