Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make external script sources load asynchronously, yet still block furthe... #5727

Merged
merged 3 commits into from May 21, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Update test expectations. Mark script loads as complete when the resp…

…onse is complete.
  • Loading branch information
jdm committed May 21, 2015
commit ef8a1271561b9ee7ea4be8ac2e0548d3c8669fb2
@@ -100,6 +100,7 @@ impl DocumentLoader {
}

pub fn is_blocked(&self) -> bool {
//TODO: Ensure that we report blocked if parsing is still ongoing.
!self.blocking_loads.is_empty()
}

@@ -167,6 +167,8 @@ struct ScriptContext {
metadata: RefCell<Option<Metadata>>,
/// Whether the owning document's parser should resume once the response completes.
resume_on_completion: bool,
/// The initial URL requested.
url: Url,
}

impl AsyncResponseListener for ScriptContext {
@@ -175,7 +177,8 @@ impl AsyncResponseListener for ScriptContext {
}

fn data_available(&self, payload: Vec<u8>) {
self.data.borrow_mut().extend(payload.into_iter());
let mut payload = payload;
self.data.borrow_mut().append(&mut payload);
}

fn response_complete(&self, status: Result<(), String>) {
@@ -188,8 +191,10 @@ impl AsyncResponseListener for ScriptContext {

elem.r().execute(ScriptOrigin::External(load));

let document = document_from_node(elem.r()).root();
document.r().finish_load(LoadType::Script(self.url.clone()));

if self.resume_on_completion {
let document = document_from_node(elem.r()).root();
document.r().get_current_parser().unwrap().root().r().resume();
}
}
@@ -316,6 +321,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
data: RefCell::new(vec!()),
metadata: RefCell::new(None),
resume_on_completion: self.parser_inserted.get(),
url: url.clone(),
}));

let listener = box NetworkListener {

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,8 +1,5 @@
[122.html]
type: testharness
[scheduler: altering the type attribute and adding/removing external script ]
expected: FAIL

[Reinserted script async IDL attribute]
expected: FAIL

This file was deleted.

This file was deleted.

@@ -0,0 +1,5 @@
[134.html]
type: testharness
[scheduler: external HTML script added by SVG script]
expected: FAIL

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.