diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-01-18 14:04:19 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-01-19 16:17:14 +0100 |
commit | 0f244d6948a0545009a8a1a5acbcb36e1e125b03 (patch) | |
tree | a23643129340ffb81783a2086bfd2c2b8a55e6f4 /components/script/script_thread.rs | |
parent | d5442b87fce26b1e5cea1bba4fe37d05c5eaa049 (diff) | |
download | servo-0f244d6948a0545009a8a1a5acbcb36e1e125b03.tar.gz servo-0f244d6948a0545009a8a1a5acbcb36e1e125b03.zip |
Mark the page source as loaded only after parsing is done
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 58a59e2fd91..ce02d763699 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -41,7 +41,7 @@ use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::utils::WRAP_CALLBACKS; use dom::browsingcontext::BrowsingContext; -use dom::document::{Document, DocumentProgressHandler, DocumentSource, FocusType, IsHTMLDocument, TouchEventResult}; +use dom::document::{Document, DocumentSource, FocusType, IsHTMLDocument, TouchEventResult}; use dom::element::Element; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::globalscope::GlobalScope; @@ -239,8 +239,6 @@ enum MixedMessage { pub enum MainThreadScriptMsg { /// Common variants associated with the script messages Common(CommonScriptMsg), - /// Notify a document that all pending loads are complete. - DocumentLoadsComplete(PipelineId), /// Notifies the script that a window associated with a particular pipeline /// should be closed (only dispatched to ScriptThread). ExitWindow(PipelineId), @@ -1027,8 +1025,6 @@ impl ScriptThread { self.handle_navigate(parent_pipeline_id, None, load_data, replace), MainThreadScriptMsg::ExitWindow(id) => self.handle_exit_window_msg(id), - MainThreadScriptMsg::DocumentLoadsComplete(id) => - self.handle_loads_complete(id), MainThreadScriptMsg::Common(CommonScriptMsg::RunnableMsg(_, runnable)) => { // The category of the runnable is ignored by the pattern, however // it is still respected by profiling (see categorize_msg). @@ -1248,29 +1244,6 @@ impl ScriptThread { } } - fn handle_loads_complete(&self, pipeline: PipelineId) { - let doc = match { self.documents.borrow().find_document(pipeline) } { - Some(doc) => doc, - None => return warn!("Message sent to closed pipeline {}.", pipeline), - }; - if doc.loader().is_blocked() { - debug!("Script thread got loads complete while loader is blocked."); - return; - } - - doc.mut_loader().inhibit_events(); - - // https://html.spec.whatwg.org/multipage/#the-end step 7 - // Schedule a task to fire a "load" event (if no blocking loads have arrived in the mean time) - // NOTE: we can end up executing this code more than once, in case more blocking loads arrive. - let handler = box DocumentProgressHandler::new(Trusted::new(&doc)); - self.dom_manipulation_task_source.queue(handler, doc.window().upcast()).unwrap(); - - if let Some(fragment) = doc.url().fragment() { - doc.check_and_scroll_fragment(fragment); - }; - } - fn collect_reports(&self, reports_chan: ReportsChan) { let mut path_seg = String::from("url("); let mut dom_tree_size = 0; @@ -1771,7 +1744,7 @@ impl ScriptThread { }); let loader = DocumentLoader::new_with_threads(self.resource_threads.clone(), - Some(incomplete.url.clone())); + Some(final_url.clone())); let is_html_document = match metadata.content_type { Some(Serde(ContentType(Mime(TopLevel::Application, SubLevel::Ext(ref sub_level), _)))) |