diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 6e09fc4b15d..b855885b88a 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -982,7 +982,7 @@ impl Constellation }; // If no url is specified, reload. - let new_url = load_info.url.clone() + let new_url = load_info.load_data.clone().map(|data| data.url) .or_else(|| old_pipeline.map(|old_pipeline| old_pipeline.url.clone())) .unwrap_or_else(|| Url::parse("about:blank").expect("infallible")); @@ -1016,13 +1016,20 @@ impl Constellation }; + let load_data = if let Some(mut data) = load_info.load_data { + data.url = new_url; + data + } else { + // TODO - loaddata here should have referrer info (not None, None) + LoadData::new(new_url, None, None) + }; + // Create the new pipeline, attached to the parent and push to pending frames - // TODO - loaddata here should have referrer info (not None, None) self.new_pipeline(load_info.new_pipeline_id, Some((load_info.containing_pipeline_id, load_info.new_subpage_id)), window_size, script_chan, - LoadData::new(new_url, None, None)); + load_data); self.subpage_map.insert((load_info.containing_pipeline_id, load_info.new_subpage_id), load_info.new_pipeline_id); diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 89e7d6f89e8..bf3ff02487c 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -33,7 +33,7 @@ use ipc_channel::ipc; use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue, JSContext, MutableHandleValue}; use js::jsval::{UndefinedValue, NullValue}; use layout_interface::ReflowQueryType; -use msg::constellation_msg::{ConstellationChan}; +use msg::constellation_msg::{ConstellationChan, LoadData}; use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId}; use net_traits::response::HttpsState; use page::IterablePage; @@ -98,7 +98,7 @@ impl HTMLIFrameElement { (subpage_id, old_subpage_id) } - pub fn navigate_or_reload_child_browsing_context(&self, url: Option) { + pub fn navigate_or_reload_child_browsing_context(&self, load_data: Option) { let sandboxed = if self.is_sandboxed() { IFrameSandboxed } else { @@ -115,8 +115,8 @@ impl HTMLIFrameElement { //TODO(#9592): Deal with the case where an iframe is being reloaded so url is None. // The iframe should always have access to the nested context's active // document URL through the browsing context. - if let Some(ref url) = url { - *load_blocker = Some(LoadBlocker::new(&*document, LoadType::Subframe(url.clone()))); + if let Some(ref load_data) = load_data { + *load_blocker = Some(LoadBlocker::new(&*document, LoadType::Subframe(load_data.url.clone()))); } let window = window_from_node(self); @@ -127,7 +127,7 @@ impl HTMLIFrameElement { let ConstellationChan(ref chan) = *window.constellation_chan(); let load_info = IFrameLoadInfo { - url: url, + load_data: load_data, containing_pipeline_id: window.pipeline(), new_subpage_id: new_subpage_id, old_subpage_id: old_subpage_id, @@ -149,7 +149,8 @@ impl HTMLIFrameElement { None => Url::parse("about:blank").unwrap(), }; - self.navigate_or_reload_child_browsing_context(Some(url)); + // TODO - loaddata here should have referrer info (not None, None) + self.navigate_or_reload_child_browsing_context(Some(LoadData::new(url, None, None))); } #[allow(unsafe_code)] diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 107902b88ee..4768273c16e 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -1812,7 +1812,7 @@ impl ScriptThread { doc.find_iframe(subpage_id) }); if let Some(iframe) = iframe.r() { - iframe.navigate_or_reload_child_browsing_context(Some(load_data.url)); + iframe.navigate_or_reload_child_browsing_context(Some(load_data)); } } None => { diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 568c1aac0b6..2d4469ef80d 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -51,7 +51,6 @@ use net_traits::response::HttpsState; use net_traits::storage_thread::StorageThread; use profile_traits::mem; use std::any::Any; -use url::Url; use util::ipc::OptionalOpaqueIpcSender; pub use script_msg::{LayoutMsg, ScriptMsg}; @@ -405,8 +404,8 @@ pub enum IFrameSandboxState { /// Specifies the information required to load a URL in an iframe. #[derive(Deserialize, Serialize)] pub struct IFrameLoadInfo { - /// Url to load - pub url: Option, + /// Load data containing the url to load + pub load_data: Option, /// Pipeline ID of the parent of this iframe pub containing_pipeline_id: PipelineId, /// The new subpage ID for this load