diff --git a/src/components/main/constellation.rs b/src/components/main/constellation.rs index 20768b2d3a8..e5f2a99ddc0 100644 --- a/src/components/main/constellation.rs +++ b/src/components/main/constellation.rs @@ -320,8 +320,7 @@ impl Constellation { if url.path.ends_with(".js") { pipeline.script_chan.send(ExecuteMsg(pipeline.id, url)); } else { - pipeline.load(url); - pipeline.navigation_type = Some(constellation_msg::Load); + pipeline.load(url, Some(constellation_msg::Load)); self.pending_frames.push(FrameChange{ before: None, @@ -374,6 +373,7 @@ impl Constellation { source's Url is None. There should never be a LoadUrlIframeMsg from a pipeline that was never given a url to load."); + // FIXME(tkuehn): Need to follow the standardized spec for checking same-origin let pipeline = @mut if (source_url.host == url.host && source_url.port == url.port) { // Reuse the script task if same-origin url's @@ -400,8 +400,7 @@ impl Constellation { if url.path.ends_with(".js") { pipeline.execute(url); } else { - pipeline.load(url); - pipeline.navigation_type = None; + pipeline.load(url, None); } frame_tree.children.push(@mut FrameTree { pipeline: pipeline, @@ -445,8 +444,7 @@ impl Constellation { if url.path.ends_with(".js") { pipeline.script_chan.send(ExecuteMsg(pipeline.id, url)); } else { - pipeline.load(url); - pipeline.navigation_type = Some(constellation_msg::Load); + pipeline.load(url, Some(constellation_msg::Load)); let parent = if self.current_frame().get_ref().pipeline.id == source_id { // source_id is the root of the current frame tree; replace whole tree @@ -494,8 +492,7 @@ impl Constellation { for destination_frame.iter().advance |frame| { let pipeline = &frame.pipeline; - pipeline.navigation_type = Some(constellation_msg::Navigate); - pipeline.reload(); + pipeline.reload(Some(constellation_msg::Navigate)); } self.compositor_chan.send(SetIds(destination_frame.to_sendable(), self.chan.clone())); diff --git a/src/components/main/pipeline.rs b/src/components/main/pipeline.rs index 645fb051b7d..ec17e01ef21 100644 --- a/src/components/main/pipeline.rs +++ b/src/components/main/pipeline.rs @@ -137,8 +137,9 @@ impl Pipeline { } } - pub fn load(&mut self, url: Url) { + pub fn load(&mut self, url: Url, navigation_type: Option) { self.url = Some(url.clone()); + self.navigation_type = navigation_type; self.script_chan.send(LoadMsg(self.id, url)); } @@ -155,9 +156,10 @@ impl Pipeline { self.render_chan.send(PaintPermissionRevoked); } - pub fn reload(&self) { - for self.url.iter().advance |url| { - self.script_chan.send(LoadMsg(self.id, url.clone())); + pub fn reload(&mut self, navigation_type: Option) { + if self.url.is_some() { + let url = self.url.get_ref().clone(); + self.load(url, navigation_type); } } diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index e1ad1c28d34..d3b94d2fe3f 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -241,6 +241,7 @@ pub fn parse_html(cx: *JSContext, url: Url, resource_task: ResourceTask, image_cache_task: ImageCacheTask) -> HtmlParserResult { + debug!("Hubbub: parsing %?", url); // Spawn a CSS parser to receive links to CSS style sheets. let resource_task2 = resource_task.clone(); diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index bd52d3f8e20..9e2b6a7984b 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -560,6 +560,8 @@ impl ScriptTask { /// The entry point to document loading. Defines bindings, sets up the window and document /// objects, parses HTML and CSS, and kicks off initial layout. fn load(&mut self, pipeline_id: PipelineId, url: Url) { + debug!("ScriptTask: loading %?", url); + let page = self.page_tree.find(pipeline_id).expect("ScriptTask: received a load message for a layout channel that is not associated with this script task. This is a bug.").page; @@ -569,8 +571,8 @@ impl ScriptTask { if *last_loaded_url == url { if needs_reflow { page.reflow_all(ReflowForDisplay, self.chan.clone(), self.compositor); - page.url = Some((last_loaded_url.clone(), false)); } + page.url = Some((last_loaded_url.clone(), false)); return; } } @@ -758,10 +760,11 @@ impl ScriptTask { // if the node's element is "a," load url from href attr let href = element.get_attr("href"); for href.iter().advance |href| { - debug!("clicked on link to %s", *href); + debug!("ScriptTask: clicked on link to %s", *href); let current_url = do page.url.map |&(ref url, _)| { url.clone() }; + debug!("ScriptTask: current url is %?", current_url); let url = make_url(href.to_owned(), current_url); self.constellation_chan.send(LoadUrlMsg(page.id, url, from_value(page.window_size.get()))); }