mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Make IFrameLoadInfo take an Option<LoadData> instead of Option<Url>
This commit is contained in:
parent
e1091128cd
commit
3110647852
4 changed files with 20 additions and 13 deletions
|
@ -982,7 +982,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
};
|
||||
|
||||
// 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<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
|
||||
};
|
||||
|
||||
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);
|
||||
|
|
|
@ -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<Url>) {
|
||||
pub fn navigate_or_reload_child_browsing_context(&self, load_data: Option<LoadData>) {
|
||||
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)]
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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<Url>,
|
||||
/// Load data containing the url to load
|
||||
pub load_data: Option<LoadData>,
|
||||
/// Pipeline ID of the parent of this iframe
|
||||
pub containing_pipeline_id: PipelineId,
|
||||
/// The new subpage ID for this load
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue