Last active
November 18, 2015 10:11
-
-
Save paulrouget/852cd69e2830d381f3d3 to your computer and use it in GitHub Desktop.
patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs | |
index 1b8b99d..2812a89 100644 | |
--- a/components/script/dom/document.rs | |
+++ b/components/script/dom/document.rs | |
@@ -107,6 +107,7 @@ use style::stylesheets::Stylesheet; | |
use time; | |
use url::Url; | |
use util::str::{DOMString, split_html_space_chars, str_join}; | |
+use hyper::status::StatusCode; | |
#[derive(JSTraceable, PartialEq, HeapSizeOf)] | |
pub enum IsHTMLDocument { | |
@@ -1111,7 +1112,7 @@ impl Document { | |
loader.load_async(load, listener) | |
} | |
- pub fn finish_load(&self, load: LoadType) { | |
+ pub fn finish_load(&self, load: LoadType, status: Result<(), String>) { | |
// The parser might need the loader, so restrict the lifetime of the borrow. | |
{ | |
let mut loader = self.loader.borrow_mut(); | |
@@ -1123,6 +1124,23 @@ impl Document { | |
self.process_asap_scripts(); | |
} | |
+ if let LoadType::PageSource(_) = load { | |
+ match status { | |
+ Err(err) => { | |
+ debug!("Failed to load page URL {}, error: {}", self.url.serialize(), err); | |
+ // TODO(Savago): we should send a notification to callers #5463. | |
+ }, | |
+ Ok(status) => { | |
+ match status { | |
+ StatusCode::NotModified => { | |
+ }, | |
+ _ => { | |
+ }, | |
+ } | |
+ } | |
+ } | |
+ } | |
+ | |
if self.maybe_execute_parser_blocking_script() == ParserBlockedByScript::Blocked { | |
return; | |
} | |
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs | |
index a7365c3..2b09ba4 100644 | |
--- a/components/script/dom/htmllinkelement.rs | |
+++ b/components/script/dom/htmllinkelement.rs | |
@@ -274,7 +274,7 @@ impl AsyncResponseListener for StylesheetContext { | |
self.data.append(&mut payload); | |
} | |
- fn response_complete(&mut self, _status: Result<(), String>) { | |
+ fn response_complete(&mut self, status: Result<(), String>) { | |
let data = mem::replace(&mut self.data, vec!()); | |
let metadata = self.metadata.take().unwrap(); | |
// TODO: Get the actual value. http://dev.w3.org/csswg/css-syntax/#environment-encoding | |
@@ -301,7 +301,7 @@ impl AsyncResponseListener for StylesheetContext { | |
if elem.parser_inserted.get() { | |
document.decrement_script_blocking_stylesheet_count(); | |
} | |
- document.finish_load(LoadType::Stylesheet(self.url.clone())); | |
+ document.finish_load(LoadType::Stylesheet(self.url.clone()), status); | |
} | |
} | |
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs | |
index 1a37926..83099ab 100644 | |
--- a/components/script/dom/htmlscriptelement.rs | |
+++ b/components/script/dom/htmlscriptelement.rs | |
@@ -147,7 +147,7 @@ impl AsyncResponseListener for ScriptContext { | |
} | |
fn response_complete(&mut self, status: Result<(), String>) { | |
- let load = status.map(|_| { | |
+ let load = Ok({ | |
let data = mem::replace(&mut self.data, vec!()); | |
let metadata = self.metadata.take().unwrap(); | |
(metadata, data) | |
@@ -158,7 +158,7 @@ impl AsyncResponseListener for ScriptContext { | |
elem.ready_to_be_parser_executed.set(true); | |
let document = document_from_node(elem.r()); | |
- document.finish_load(LoadType::Script(self.url.clone())); | |
+ document.finish_load(LoadType::Script(self.url.clone()), status); | |
} | |
} | |
diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs | |
index 50132dc..a285f8c 100644 | |
--- a/components/script/dom/servohtmlparser.rs | |
+++ b/components/script/dom/servohtmlparser.rs | |
@@ -171,12 +171,8 @@ impl AsyncResponseListener for ParserContext { | |
Some(parser) => parser.root(), | |
None => return, | |
}; | |
- parser.document.finish_load(LoadType::PageSource(self.url.clone())); | |
- if let Err(err) = status { | |
- debug!("Failed to load page URL {}, error: {}", self.url.serialize(), err); | |
- // TODO(Savago): we should send a notification to callers #5463. | |
- } | |
+ parser.document.finish_load(LoadType::PageSource(self.url.clone()), status); | |
parser.last_chunk_received.set(true); | |
if !parser.is_suspended() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment