Excise SubpageId and use only PipelineIds

SubpageId was originally introduced in 2013 to help iframes keep track of
their associated (children) pipelines. However, since each pipeline
already has a PipelineId, and those are unique, those are sufficient
to keep track of children.
This commit is contained in:
Aneesh Agrawal 2016-06-09 08:17:30 -04:00
parent b9b25b6f82
commit 56fbfd46a4
12 changed files with 145 additions and 217 deletions

View file

@ -28,7 +28,7 @@ use log::{Log, LogLevel, LogLevelFilter, LogMetadata, LogRecord};
use msg::constellation_msg::{FrameId, FrameType, PipelineId}; use msg::constellation_msg::{FrameId, FrameType, PipelineId};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection}; use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection};
use msg::constellation_msg::{SubpageId, WindowSizeType}; use msg::constellation_msg::WindowSizeType;
use net_traits::{self, IpcSend, ResourceThreads}; use net_traits::{self, IpcSend, ResourceThreads};
use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::bluetooth_thread::BluetoothMethodMsg;
use net_traits::image_cache_thread::ImageCacheThread; use net_traits::image_cache_thread::ImageCacheThread;
@ -135,9 +135,6 @@ pub struct Constellation<Message, LTF, STF> {
/// A list of all the frames /// A list of all the frames
frames: HashMap<FrameId, Frame>, frames: HashMap<FrameId, Frame>,
/// Maps from a (parent pipeline, subpage) to the actual child pipeline ID.
subpage_map: HashMap<(PipelineId, SubpageId), PipelineId>,
/// A channel through which messages can be sent to the font cache. /// A channel through which messages can be sent to the font cache.
font_cache_thread: FontCacheThread, font_cache_thread: FontCacheThread,
@ -492,7 +489,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
swmanager_sender: sw_mgr_clone, swmanager_sender: sw_mgr_clone,
pipelines: HashMap::new(), pipelines: HashMap::new(),
frames: HashMap::new(), frames: HashMap::new(),
subpage_map: HashMap::new(),
pending_frames: vec!(), pending_frames: vec!(),
next_pipeline_namespace_id: PipelineNamespaceId(0), next_pipeline_namespace_id: PipelineNamespaceId(0),
root_frame_id: None, root_frame_id: None,
@ -551,7 +547,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
/// Helper function for creating a pipeline /// Helper function for creating a pipeline
fn new_pipeline(&mut self, fn new_pipeline(&mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
parent_info: Option<(PipelineId, SubpageId, FrameType)>, parent_info: Option<(PipelineId, FrameType)>,
initial_window_size: Option<TypedSize2D<f32, PagePx>>, initial_window_size: Option<TypedSize2D<f32, PagePx>>,
script_channel: Option<IpcSender<ConstellationControlMsg>>, script_channel: Option<IpcSender<ConstellationControlMsg>>,
load_data: LoadData, load_data: LoadData,
@ -564,7 +560,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.public_resource_threads.clone() self.public_resource_threads.clone()
}; };
let parent_visibility = if let Some((parent_pipeline_id, _, _)) = parent_info { let parent_visibility = if let Some((parent_pipeline_id, _)) = parent_info {
self.pipelines.get(&parent_pipeline_id).map(|pipeline| pipeline.visible) self.pipelines.get(&parent_pipeline_id).map(|pipeline| pipeline.visible)
} else { } else {
None None
@ -826,8 +822,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
FromScriptMsg::ScriptLoadedURLInIFrame(load_info) => { FromScriptMsg::ScriptLoadedURLInIFrame(load_info) => {
debug!("constellation got iframe URL load message {:?} {:?} {:?}", debug!("constellation got iframe URL load message {:?} {:?} {:?}",
load_info.parent_pipeline_id, load_info.parent_pipeline_id,
load_info.old_subpage_id, load_info.old_pipeline_id,
load_info.new_subpage_id); load_info.new_pipeline_id);
self.handle_script_loaded_url_in_iframe_msg(load_info); self.handle_script_loaded_url_in_iframe_msg(load_info);
} }
FromScriptMsg::ChangeRunningAnimationsState(pipeline_id, animation_state) => { FromScriptMsg::ChangeRunningAnimationsState(pipeline_id, animation_state) => {
@ -870,10 +866,10 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
warn!("constellation got set final url message for dead pipeline"); warn!("constellation got set final url message for dead pipeline");
} }
} }
FromScriptMsg::MozBrowserEvent(pipeline_id, subpage_id, event) => { FromScriptMsg::MozBrowserEvent(parent_pipeline_id, pipeline_id, event) => {
debug!("constellation got mozbrowser event message"); debug!("constellation got mozbrowser event message");
self.handle_mozbrowser_event_msg(pipeline_id, self.handle_mozbrowser_event_msg(parent_pipeline_id,
subpage_id, pipeline_id,
event); event);
} }
FromScriptMsg::Focus(pipeline_id) => { FromScriptMsg::Focus(pipeline_id) => {
@ -1230,12 +1226,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// parent_pipeline_id's frame tree's children. This message is never the result of a // parent_pipeline_id's frame tree's children. This message is never the result of a
// page navigation. // page navigation.
fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfo) { fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfo) {
let old_pipeline_id = load_info.old_subpage_id
.and_then(|old_subpage_id| self.subpage_map.get(&(load_info.parent_pipeline_id, old_subpage_id)))
.cloned();
let (load_data, script_chan, window_size, is_private) = { let (load_data, script_chan, window_size, is_private) = {
let old_pipeline = old_pipeline_id let old_pipeline = load_info.old_pipeline_id
.and_then(|old_pipeline_id| self.pipelines.get(&old_pipeline_id)); .and_then(|old_pipeline_id| self.pipelines.get(&old_pipeline_id));
let source_pipeline = match self.pipelines.get(&load_info.parent_pipeline_id) { let source_pipeline = match self.pipelines.get(&load_info.parent_pipeline_id) {
@ -1290,16 +1282,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// Create the new pipeline, attached to the parent and push to pending frames // Create the new pipeline, attached to the parent and push to pending frames
self.new_pipeline(load_info.new_pipeline_id, self.new_pipeline(load_info.new_pipeline_id,
Some((load_info.parent_pipeline_id, load_info.new_subpage_id, load_info.frame_type)), Some((load_info.parent_pipeline_id, load_info.frame_type)),
window_size, window_size,
script_chan, script_chan,
load_data, load_data,
is_private); is_private);
self.subpage_map.insert((load_info.parent_pipeline_id, load_info.new_subpage_id), self.push_pending_frame(load_info.new_pipeline_id, load_info.old_pipeline_id);
load_info.new_pipeline_id);
self.push_pending_frame(load_info.new_pipeline_id, old_pipeline_id);
} }
fn handle_set_cursor_msg(&mut self, cursor: Cursor) { fn handle_set_cursor_msg(&mut self, cursor: Cursor) {
@ -1347,14 +1336,14 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
.map(|root_frame| root_frame.current.pipeline_id); .map(|root_frame| root_frame.current.pipeline_id);
let ancestor_info = self.get_mozbrowser_ancestor_info(pipeline_id); let ancestor_info = self.get_mozbrowser_ancestor_info(pipeline_id);
if let Some((ancestor_id, subpage_id)) = ancestor_info { if let Some((ancestor_id, mozbrowser_iframe_id)) = ancestor_info {
if root_pipeline_id == Some(ancestor_id) { if root_pipeline_id == Some(ancestor_id) {
match root_pipeline_id.and_then(|pipeline_id| self.pipelines.get(&pipeline_id)) { match root_pipeline_id.and_then(|pipeline_id| self.pipelines.get(&pipeline_id)) {
Some(root_pipeline) => { Some(root_pipeline) => {
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsershowmodalprompt // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsershowmodalprompt
let event = MozBrowserEvent::ShowModalPrompt("alert".to_owned(), "Alert".to_owned(), let event = MozBrowserEvent::ShowModalPrompt("alert".to_owned(), "Alert".to_owned(),
String::from(message), "".to_owned()); String::from(message), "".to_owned());
root_pipeline.trigger_mozbrowser_event(Some(subpage_id), event); root_pipeline.trigger_mozbrowser_event(Some(mozbrowser_iframe_id), event);
} }
None => return warn!("Alert sent to Pipeline {:?} after closure.", root_pipeline_id), None => return warn!("Alert sent to Pipeline {:?} after closure.", root_pipeline_id),
} }
@ -1387,11 +1376,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// requested change so it can update its internal state. // requested change so it can update its internal state.
let parent_info = self.pipelines.get(&source_id).and_then(|source| source.parent_info); let parent_info = self.pipelines.get(&source_id).and_then(|source| source.parent_info);
match parent_info { match parent_info {
Some((parent_pipeline_id, subpage_id, _)) => { Some((parent_pipeline_id, _)) => {
self.handle_load_start_msg(source_id); self.handle_load_start_msg(source_id);
// Message the constellation to find the script thread for this iframe // Message the constellation to find the script thread for this iframe
// and issue an iframe load through there. // and issue an iframe load through there.
let msg = ConstellationControlMsg::Navigate(parent_pipeline_id, subpage_id, load_data); let msg = ConstellationControlMsg::Navigate(parent_pipeline_id, source_id, load_data);
let result = match self.pipelines.get(&parent_pipeline_id) { let result = match self.pipelines.get(&parent_pipeline_id) {
Some(parent_pipeline) => parent_pipeline.script_chan.send(msg), Some(parent_pipeline) => parent_pipeline.script_chan.send(msg),
None => { None => {
@ -1586,7 +1575,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
fn handle_mozbrowser_event_msg(&mut self, fn handle_mozbrowser_event_msg(&mut self,
parent_pipeline_id: PipelineId, parent_pipeline_id: PipelineId,
subpage_id: Option<SubpageId>, pipeline_id: Option<PipelineId>,
event: MozBrowserEvent) { event: MozBrowserEvent) {
assert!(PREFS.is_mozbrowser_enabled()); assert!(PREFS.is_mozbrowser_enabled());
@ -1595,7 +1584,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// If the pipeline lookup fails, it is because we have torn down the pipeline, // If the pipeline lookup fails, it is because we have torn down the pipeline,
// so it is reasonable to silently ignore the event. // so it is reasonable to silently ignore the event.
match self.pipelines.get(&parent_pipeline_id) { match self.pipelines.get(&parent_pipeline_id) {
Some(pipeline) => pipeline.trigger_mozbrowser_event(subpage_id, event), Some(pipeline) => pipeline.trigger_mozbrowser_event(pipeline_id, event),
None => warn!("Pipeline {:?} handling mozbrowser event after closure.", parent_pipeline_id), None => warn!("Pipeline {:?} handling mozbrowser event after closure.", parent_pipeline_id),
} }
} }
@ -1630,14 +1619,14 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
Some(pipeline) => pipeline.parent_info, Some(pipeline) => pipeline.parent_info,
None => return warn!("Pipeline {:?} focus parent after closure.", pipeline_id), None => return warn!("Pipeline {:?} focus parent after closure.", pipeline_id),
}; };
let (parent_pipeline_id, subpage_id, _) = match parent_info { let (parent_pipeline_id, _) = match parent_info {
Some(info) => info, Some(info) => info,
None => return debug!("Pipeline {:?} focus has no parent.", pipeline_id), None => return debug!("Pipeline {:?} focus has no parent.", pipeline_id),
}; };
// Send a message to the parent of the provided pipeline (if it exists) // Send a message to the parent of the provided pipeline (if it exists)
// telling it to mark the iframe element as focused. // telling it to mark the iframe element as focused.
let msg = ConstellationControlMsg::FocusIFrame(parent_pipeline_id, subpage_id); let msg = ConstellationControlMsg::FocusIFrame(parent_pipeline_id, pipeline_id);
let result = match self.pipelines.get(&parent_pipeline_id) { let result = match self.pipelines.get(&parent_pipeline_id) {
Some(pipeline) => pipeline.script_chan.send(msg), Some(pipeline) => pipeline.script_chan.send(msg),
None => return warn!("Pipeline {:?} focus after closure.", parent_pipeline_id), None => return warn!("Pipeline {:?} focus after closure.", parent_pipeline_id),
@ -1685,7 +1674,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
fn handle_visibility_change_complete(&mut self, pipeline_id: PipelineId, visibility: bool) { fn handle_visibility_change_complete(&mut self, pipeline_id: PipelineId, visibility: bool) {
let parent_pipeline_info = self.pipelines.get(&pipeline_id).and_then(|source| source.parent_info); let parent_pipeline_info = self.pipelines.get(&pipeline_id).and_then(|source| source.parent_info);
if let Some((parent_pipeline_id, _, _)) = parent_pipeline_info { if let Some((parent_pipeline_id, _)) = parent_pipeline_info {
let visibility_msg = ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id, let visibility_msg = ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id,
pipeline_id, pipeline_id,
visibility); visibility);
@ -1855,19 +1844,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.revoke_paint_permission(prev_pipeline_id); self.revoke_paint_permission(prev_pipeline_id);
self.send_frame_tree_and_grant_paint_permission(); self.send_frame_tree_and_grant_paint_permission();
// Update the owning iframe to point to the new subpage id. // Update the owning iframe to point to the new pipeline id.
// This makes things like contentDocument work correctly. // This makes things like contentDocument work correctly.
if let Some((parent_pipeline_id, subpage_id, _)) = pipeline_info { if let Some((parent_pipeline_id, _)) = pipeline_info {
let new_subpage_id = match self.pipelines.get(&next_pipeline_id) { let msg = ConstellationControlMsg::UpdatePipelineId(parent_pipeline_id,
None => return warn!("Pipeline {:?} traversed to after closure.", next_pipeline_id), prev_pipeline_id,
Some(pipeline) => match pipeline.parent_info {
None => return warn!("Pipeline {:?} has no parent info.", next_pipeline_id),
Some((_, new_subpage_id, _)) => new_subpage_id,
},
};
let msg = ConstellationControlMsg::UpdateSubpageId(parent_pipeline_id,
subpage_id,
new_subpage_id,
next_pipeline_id); next_pipeline_id);
let result = match self.pipelines.get(&parent_pipeline_id) { let result = match self.pipelines.get(&parent_pipeline_id) {
None => return warn!("Pipeline {:?} child traversed after closure.", parent_pipeline_id), None => return warn!("Pipeline {:?} child traversed after closure.", parent_pipeline_id),
@ -1886,8 +1867,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
fn get_top_level_frame_for_pipeline(&self, pipeline_id: Option<PipelineId>) -> Option<FrameId> { fn get_top_level_frame_for_pipeline(&self, pipeline_id: Option<PipelineId>) -> Option<FrameId> {
if PREFS.is_mozbrowser_enabled() { if PREFS.is_mozbrowser_enabled() {
pipeline_id.and_then(|id| self.get_mozbrowser_ancestor_info(id)) pipeline_id.and_then(|id| self.get_mozbrowser_ancestor_info(id))
.and_then(|info| self.subpage_map.get(&info)) .and_then(|pipeline_info| self.pipelines.get(&pipeline_info.1))
.and_then(|pipeline_id| self.pipelines.get(&pipeline_id))
.and_then(|pipeline| pipeline.frame) .and_then(|pipeline| pipeline.frame)
.or(self.root_frame_id) .or(self.root_frame_id)
} else { } else {
@ -1940,7 +1920,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// If a child frame, add it to the parent pipeline. Otherwise // If a child frame, add it to the parent pipeline. Otherwise
// it must surely be the root frame being created! // it must surely be the root frame being created!
match self.pipelines.get(&frame_change.new_pipeline_id).and_then(|pipeline| pipeline.parent_info) { match self.pipelines.get(&frame_change.new_pipeline_id).and_then(|pipeline| pipeline.parent_info) {
Some((parent_id, _, _)) => { Some((parent_id, _)) => {
if let Some(parent) = self.pipelines.get_mut(&parent_id) { if let Some(parent) = self.pipelines.get_mut(&parent_id) {
parent.add_child(frame_id); parent.add_child(frame_id);
} }
@ -1976,7 +1956,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let _ = parent_pipeline.script_chan let _ = parent_pipeline.script_chan
.send(ConstellationControlMsg::FramedContentChanged( .send(ConstellationControlMsg::FramedContentChanged(
parent_info.0, parent_info.0,
parent_info.1)); pipeline_id));
} }
} }
} }
@ -2250,7 +2230,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
warn!("Closing frame {:?} twice.", frame_id); warn!("Closing frame {:?} twice.", frame_id);
} }
if let Some((parent_pipeline_id, _, _)) = parent_info { if let Some((parent_pipeline_id, _)) = parent_info {
let parent_pipeline = match self.pipelines.get_mut(&parent_pipeline_id) { let parent_pipeline = match self.pipelines.get_mut(&parent_pipeline_id) {
None => return warn!("Pipeline {:?} child closed after parent.", parent_pipeline_id), None => return warn!("Pipeline {:?} child closed after parent.", parent_pipeline_id),
Some(parent_pipeline) => parent_pipeline, Some(parent_pipeline) => parent_pipeline,
@ -2285,10 +2265,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
None => return warn!("Closing pipeline {:?} twice.", pipeline_id), None => return warn!("Closing pipeline {:?} twice.", pipeline_id),
}; };
// If a child pipeline, remove from subpage map
if let Some((parent_id, subpage_id, _)) = pipeline.parent_info {
self.subpage_map.remove(&(parent_id, subpage_id));
}
// Remove assocation between this pipeline and its holding frame // Remove assocation between this pipeline and its holding frame
pipeline.frame = None; pipeline.frame = None;
@ -2388,12 +2364,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
/// For a given pipeline, determine the mozbrowser iframe that transitively contains /// For a given pipeline, determine the mozbrowser iframe that transitively contains
/// it. There could be arbitrary levels of nested iframes in between them. /// it. There could be arbitrary levels of nested iframes in between them.
fn get_mozbrowser_ancestor_info(&self, mut pipeline_id: PipelineId) -> Option<(PipelineId, SubpageId)> { fn get_mozbrowser_ancestor_info(&self, original_pipeline_id: PipelineId) -> Option<(PipelineId, PipelineId)> {
let mut pipeline_id = original_pipeline_id;
loop { loop {
match self.pipelines.get(&pipeline_id) { match self.pipelines.get(&pipeline_id) {
Some(pipeline) => match pipeline.parent_info { Some(pipeline) => match pipeline.parent_info {
Some((parent_id, subpage_id, FrameType::MozBrowserIFrame)) => return Some((parent_id, subpage_id)), Some((parent_id, FrameType::MozBrowserIFrame)) => return Some((parent_id, pipeline_id)),
Some((parent_id, _, _)) => pipeline_id = parent_id, Some((parent_id, _)) => pipeline_id = parent_id,
None => return None, None => return None,
}, },
None => { None => {
@ -2415,15 +2392,14 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}; };
// If this is a mozbrowser iframe, then send the event with new url // If this is a mozbrowser iframe, then send the event with new url
if let Some((parent_pipeline_id, subpage_id)) = self.get_mozbrowser_ancestor_info(pipeline_id) { if let Some((ancestor_id, mozbrowser_iframe_id)) = self.get_mozbrowser_ancestor_info(pipeline_id) {
if let Some(parent_pipeline) = self.pipelines.get(&parent_pipeline_id) { if let Some(ancestor) = self.pipelines.get(&ancestor_id) {
let pipeline_id = self.subpage_map.get(&(parent_pipeline_id, subpage_id)); if let Some(pipeline) = self.pipelines.get(&mozbrowser_iframe_id) {
if let Some(pipeline) = pipeline_id.and_then(|pipeline_id| self.pipelines.get(pipeline_id)) {
if let Some(frame_id) = pipeline.frame { if let Some(frame_id) = pipeline.frame {
let can_go_forward = !self.joint_session_future(frame_id).is_empty(); let can_go_forward = !self.joint_session_future(frame_id).is_empty();
let can_go_back = !self.joint_session_past(frame_id).is_empty(); let can_go_back = !self.joint_session_past(frame_id).is_empty();
let event = MozBrowserEvent::LocationChange(url, can_go_back, can_go_forward); let event = MozBrowserEvent::LocationChange(url, can_go_back, can_go_forward);
parent_pipeline.trigger_mozbrowser_event(Some(subpage_id), event); ancestor.trigger_mozbrowser_event(Some(mozbrowser_iframe_id), event);
} }
} }
} }
@ -2455,9 +2431,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let event = MozBrowserEvent::Error(MozBrowserErrorType::Fatal, reason, report); let event = MozBrowserEvent::Error(MozBrowserErrorType::Fatal, reason, report);
if let Some(pipeline_id) = pipeline_id { if let Some(pipeline_id) = pipeline_id {
if let Some((ancestor_id, subpage_id)) = self.get_mozbrowser_ancestor_info(pipeline_id) { if let Some((ancestor_id, mozbrowser_iframe_id)) = self.get_mozbrowser_ancestor_info(pipeline_id) {
if let Some(ancestor) = self.pipelines.get(&ancestor_id) { if let Some(ancestor) = self.pipelines.get(&ancestor_id) {
return ancestor.trigger_mozbrowser_event(Some(subpage_id), event); return ancestor.trigger_mozbrowser_event(Some(mozbrowser_iframe_id), event);
} }
} }
} }

View file

@ -17,8 +17,7 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use layout_traits::LayoutThreadFactory; use layout_traits::LayoutThreadFactory;
use msg::constellation_msg::{FrameId, FrameType, LoadData, PipelineId}; use msg::constellation_msg::{FrameId, FrameType, LoadData, PipelineId, PipelineNamespaceId};
use msg::constellation_msg::{PipelineNamespaceId, SubpageId};
use net_traits::{IpcSend, ResourceThreads}; use net_traits::{IpcSend, ResourceThreads};
use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::bluetooth_thread::BluetoothMethodMsg;
use net_traits::image_cache_thread::ImageCacheThread; use net_traits::image_cache_thread::ImageCacheThread;
@ -51,7 +50,7 @@ pub enum ChildProcess {
/// A uniquely-identifiable pipeline of script thread, layout thread, and paint thread. /// A uniquely-identifiable pipeline of script thread, layout thread, and paint thread.
pub struct Pipeline { pub struct Pipeline {
pub id: PipelineId, pub id: PipelineId,
pub parent_info: Option<(PipelineId, SubpageId, FrameType)>, pub parent_info: Option<(PipelineId, FrameType)>,
pub script_chan: IpcSender<ConstellationControlMsg>, pub script_chan: IpcSender<ConstellationControlMsg>,
/// A channel to layout, for performing reflows and shutdown. /// A channel to layout, for performing reflows and shutdown.
pub layout_chan: IpcSender<LayoutControlMsg>, pub layout_chan: IpcSender<LayoutControlMsg>,
@ -84,9 +83,9 @@ pub struct Pipeline {
pub struct InitialPipelineState { pub struct InitialPipelineState {
/// The ID of the pipeline to create. /// The ID of the pipeline to create.
pub id: PipelineId, pub id: PipelineId,
/// The subpage ID of this pipeline to create in its pipeline parent. /// The ID of the parent pipeline and frame type, if any.
/// If `None`, this is the root. /// If `None`, this is the root.
pub parent_info: Option<(PipelineId, SubpageId, FrameType)>, pub parent_info: Option<(PipelineId, FrameType)>,
/// A channel to the associated constellation. /// A channel to the associated constellation.
pub constellation_chan: IpcSender<ScriptMsg>, pub constellation_chan: IpcSender<ScriptMsg>,
/// A channel for the layout thread to send messages to the constellation. /// A channel for the layout thread to send messages to the constellation.
@ -150,12 +149,11 @@ impl Pipeline {
let (script_chan, content_ports) = match state.script_chan { let (script_chan, content_ports) = match state.script_chan {
Some(script_chan) => { Some(script_chan) => {
let (parent_pipeline_id, subpage_id, frame_type) = let (parent_pipeline_id, frame_type) =
state.parent_info.expect("script_pipeline != None but subpage_id == None"); state.parent_info.expect("script_pipeline != None but parent_info == None");
let new_layout_info = NewLayoutInfo { let new_layout_info = NewLayoutInfo {
parent_pipeline_id: parent_pipeline_id, parent_pipeline_id: parent_pipeline_id,
new_pipeline_id: state.id, new_pipeline_id: state.id,
subpage_id: subpage_id,
frame_type: frame_type, frame_type: frame_type,
load_data: state.load_data.clone(), load_data: state.load_data.clone(),
paint_chan: layout_to_paint_chan.clone().to_opaque(), paint_chan: layout_to_paint_chan.clone().to_opaque(),
@ -273,7 +271,7 @@ impl Pipeline {
} }
fn new(id: PipelineId, fn new(id: PipelineId,
parent_info: Option<(PipelineId, SubpageId, FrameType)>, parent_info: Option<(PipelineId, FrameType)>,
script_chan: IpcSender<ConstellationControlMsg>, script_chan: IpcSender<ConstellationControlMsg>,
layout_chan: IpcSender<LayoutControlMsg>, layout_chan: IpcSender<LayoutControlMsg>,
compositor_proxy: Box<CompositorProxy + 'static + Send>, compositor_proxy: Box<CompositorProxy + 'static + Send>,
@ -377,12 +375,12 @@ impl Pipeline {
} }
pub fn trigger_mozbrowser_event(&self, pub fn trigger_mozbrowser_event(&self,
subpage_id: Option<SubpageId>, child_id: Option<PipelineId>,
event: MozBrowserEvent) { event: MozBrowserEvent) {
assert!(PREFS.is_mozbrowser_enabled()); assert!(PREFS.is_mozbrowser_enabled());
let event = ConstellationControlMsg::MozBrowserEvent(self.id, let event = ConstellationControlMsg::MozBrowserEvent(self.id,
subpage_id, child_id,
event); event);
if let Err(e) = self.script_chan.send(event) { if let Err(e) = self.script_chan.send(event) {
warn!("Sending mozbrowser event to script failed ({}).", e); warn!("Sending mozbrowser event to script failed ({}).", e);
@ -409,7 +407,7 @@ impl Pipeline {
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub struct UnprivilegedPipelineContent { pub struct UnprivilegedPipelineContent {
id: PipelineId, id: PipelineId,
parent_info: Option<(PipelineId, SubpageId, FrameType)>, parent_info: Option<(PipelineId, FrameType)>,
constellation_chan: IpcSender<ScriptMsg>, constellation_chan: IpcSender<ScriptMsg>,
layout_to_constellation_chan: IpcSender<LayoutMsg>, layout_to_constellation_chan: IpcSender<LayoutMsg>,
scheduler_chan: IpcSender<TimerEventRequest>, scheduler_chan: IpcSender<TimerEventRequest>,

View file

@ -331,9 +331,6 @@ impl fmt::Display for PipelineId {
} }
} }
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize, HeapSizeOf)]
pub struct SubpageId(pub u32);
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize, HeapSizeOf)] #[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize, HeapSizeOf)]
pub enum FrameType { pub enum FrameType {
IFrame, IFrame,

View file

@ -57,7 +57,7 @@ use js::jsapi::{GCTraceKindToAscii, Heap, JSObject, JSTracer, TraceKind};
use js::jsval::JSVal; use js::jsval::JSVal;
use js::rust::Runtime; use js::rust::Runtime;
use libc; use libc;
use msg::constellation_msg::{FrameType, PipelineId, ReferrerPolicy, SubpageId, WindowSizeType}; use msg::constellation_msg::{FrameType, PipelineId, ReferrerPolicy, WindowSizeType};
use net_traits::{Metadata, NetworkError, ResourceThreads}; use net_traits::{Metadata, NetworkError, ResourceThreads};
use net_traits::filemanager_thread::RelativePos; use net_traits::filemanager_thread::RelativePos;
use net_traits::image::base::{Image, ImageMetadata}; use net_traits::image::base::{Image, ImageMetadata};
@ -308,7 +308,7 @@ no_jsmanaged_fields!(PropertyDeclarationBlock);
no_jsmanaged_fields!(HashSet<T>); no_jsmanaged_fields!(HashSet<T>);
// These three are interdependent, if you plan to put jsmanaged data // These three are interdependent, if you plan to put jsmanaged data
// in one of these make sure it is propagated properly to containing structs // in one of these make sure it is propagated properly to containing structs
no_jsmanaged_fields!(FrameType, SubpageId, WindowSizeData, WindowSizeType, PipelineId); no_jsmanaged_fields!(FrameType, WindowSizeData, WindowSizeType, PipelineId);
no_jsmanaged_fields!(TimerEventId, TimerSource); no_jsmanaged_fields!(TimerEventId, TimerSource);
no_jsmanaged_fields!(WorkerId); no_jsmanaged_fields!(WorkerId);
no_jsmanaged_fields!(QuirksMode); no_jsmanaged_fields!(QuirksMode);

View file

@ -26,7 +26,7 @@ use js::jsapi::{JS_GetOwnPropertyDescriptorById, JS_HasPropertyById};
use js::jsapi::{MutableHandle, MutableHandleObject, MutableHandleValue}; use js::jsapi::{MutableHandle, MutableHandleObject, MutableHandleValue};
use js::jsapi::{ObjectOpResult, PropertyDescriptor}; use js::jsapi::{ObjectOpResult, PropertyDescriptor};
use js::jsval::{UndefinedValue, PrivateValue}; use js::jsval::{UndefinedValue, PrivateValue};
use msg::constellation_msg::{PipelineId, SubpageId}; use msg::constellation_msg::PipelineId;
use std::cell::Cell; use std::cell::Cell;
use url::Url; use url::Url;
@ -160,10 +160,10 @@ impl BrowsingContext {
self.children.borrow_mut().push(JS::from_ref(&context)); self.children.borrow_mut().push(JS::from_ref(&context));
} }
pub fn find_child_by_subpage(&self, subpage_id: SubpageId) -> Option<Root<Window>> { pub fn find_child_by_id(&self, pipeline_id: PipelineId) -> Option<Root<Window>> {
self.children.borrow().iter().find(|context| { self.children.borrow().iter().find(|context| {
let window = context.active_window(); let window = context.active_window();
window.subpage() == Some(subpage_id) window.pipeline_id() == pipeline_id
}).map(|context| context.active_window()) }).map(|context| context.active_window())
} }

View file

@ -94,7 +94,7 @@ use js::jsapi::{JSContext, JSObject, JSRuntime};
use js::jsapi::JS_GetRuntime; use js::jsapi::JS_GetRuntime;
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use msg::constellation_msg::{Key, KeyModifiers, KeyState};
use msg::constellation_msg::{PipelineId, ReferrerPolicy, SubpageId}; use msg::constellation_msg::{PipelineId, ReferrerPolicy};
use net_traits::{AsyncResponseTarget, IpcSend, PendingAsyncLoad}; use net_traits::{AsyncResponseTarget, IpcSend, PendingAsyncLoad};
use net_traits::CookieSource::NonHTTP; use net_traits::CookieSource::NonHTTP;
use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl}; use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl};
@ -1342,9 +1342,9 @@ impl Document {
pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) { pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) {
if PREFS.is_mozbrowser_enabled() { if PREFS.is_mozbrowser_enabled() {
if let Some((parent_pipeline_id, subpage_id, _)) = self.window.parent_info() { if let Some((parent_pipeline_id, _)) = self.window.parent_info() {
let event = ConstellationMsg::MozBrowserEvent(parent_pipeline_id, let event = ConstellationMsg::MozBrowserEvent(parent_pipeline_id,
Some(subpage_id), Some(self.window.pipeline_id()),
event); event);
self.window.constellation_chan().send(event).unwrap(); self.window.constellation_chan().send(event).unwrap();
} }
@ -1581,15 +1581,7 @@ impl Document {
} }
/// Find an iframe element in the document. /// Find an iframe element in the document.
pub fn find_iframe(&self, subpage_id: SubpageId) -> Option<Root<HTMLIFrameElement>> { pub fn find_iframe(&self, pipeline: PipelineId) -> Option<Root<HTMLIFrameElement>> {
self.upcast::<Node>()
.traverse_preorder()
.filter_map(Root::downcast::<HTMLIFrameElement>)
.find(|node| node.subpage_id() == Some(subpage_id))
}
/// Find an iframe element in the document.
pub fn find_iframe_by_pipeline(&self, pipeline: PipelineId) -> Option<Root<HTMLIFrameElement>> {
self.upcast::<Node>() self.upcast::<Node>()
.traverse_preorder() .traverse_preorder()
.filter_map(Root::downcast::<HTMLIFrameElement>) .filter_map(Root::downcast::<HTMLIFrameElement>)

View file

@ -38,7 +38,7 @@ use dom::window::{ReflowReason, Window};
use ipc_channel::ipc; use ipc_channel::ipc;
use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue}; use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue};
use js::jsval::{NullValue, UndefinedValue}; use js::jsval::{NullValue, UndefinedValue};
use msg::constellation_msg::{FrameType, LoadData, PipelineId, SubpageId, TraversalDirection}; use msg::constellation_msg::{FrameType, LoadData, PipelineId, TraversalDirection};
use net_traits::response::HttpsState; use net_traits::response::HttpsState;
use script_layout_interface::message::ReflowQueryType; use script_layout_interface::message::ReflowQueryType;
use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg}; use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg};
@ -68,7 +68,6 @@ bitflags! {
pub struct HTMLIFrameElement { pub struct HTMLIFrameElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
pipeline_id: Cell<Option<PipelineId>>, pipeline_id: Cell<Option<PipelineId>>,
subpage_id: Cell<Option<SubpageId>>,
sandbox: MutNullableHeap<JS<DOMTokenList>>, sandbox: MutNullableHeap<JS<DOMTokenList>>,
sandbox_allowance: Cell<Option<SandboxAllowance>>, sandbox_allowance: Cell<Option<SandboxAllowance>>,
load_blocker: DOMRefCell<Option<LoadBlocker>>, load_blocker: DOMRefCell<Option<LoadBlocker>>,
@ -94,14 +93,11 @@ impl HTMLIFrameElement {
}).unwrap_or_else(|| Url::parse("about:blank").unwrap()) }).unwrap_or_else(|| Url::parse("about:blank").unwrap())
} }
pub fn generate_new_subpage_id(&self) -> (SubpageId, Option<SubpageId>) { pub fn generate_new_pipeline_id(&self) -> (Option<PipelineId>, PipelineId) {
self.pipeline_id.set(Some(PipelineId::new())); let old_pipeline_id = self.pipeline_id.get();
let new_pipeline_id = PipelineId::new();
let old_subpage_id = self.subpage_id.get(); self.pipeline_id.set(Some(new_pipeline_id));
let win = window_from_node(self); (old_pipeline_id, new_pipeline_id)
let subpage_id = win.get_next_subpage_id();
self.subpage_id.set(Some(subpage_id));
(subpage_id, old_subpage_id)
} }
pub fn navigate_or_reload_child_browsing_context(&self, load_data: Option<LoadData>) { pub fn navigate_or_reload_child_browsing_context(&self, load_data: Option<LoadData>) {
@ -126,16 +122,14 @@ impl HTMLIFrameElement {
} }
let window = window_from_node(self); let window = window_from_node(self);
let (new_subpage_id, old_subpage_id) = self.generate_new_subpage_id(); let (old_pipeline_id, new_pipeline_id) = self.generate_new_pipeline_id();
let new_pipeline_id = self.pipeline_id.get().unwrap();
let private_iframe = self.privatebrowsing(); let private_iframe = self.privatebrowsing();
let frame_type = if self.Mozbrowser() { FrameType::MozBrowserIFrame } else { FrameType::IFrame }; let frame_type = if self.Mozbrowser() { FrameType::MozBrowserIFrame } else { FrameType::IFrame };
let load_info = IFrameLoadInfo { let load_info = IFrameLoadInfo {
load_data: load_data, load_data: load_data,
parent_pipeline_id: window.pipeline_id(), parent_pipeline_id: window.pipeline_id(),
new_subpage_id: new_subpage_id, old_pipeline_id: old_pipeline_id,
old_subpage_id: old_subpage_id,
new_pipeline_id: new_pipeline_id, new_pipeline_id: new_pipeline_id,
sandbox: sandboxed, sandbox: sandboxed,
is_private: private_iframe, is_private: private_iframe,
@ -170,8 +164,7 @@ impl HTMLIFrameElement {
} }
} }
pub fn update_subpage_id(&self, new_subpage_id: SubpageId, new_pipeline_id: PipelineId) { pub fn update_pipeline_id(&self, new_pipeline_id: PipelineId) {
self.subpage_id.set(Some(new_subpage_id));
self.pipeline_id.set(Some(new_pipeline_id)); self.pipeline_id.set(Some(new_pipeline_id));
let mut blocker = self.load_blocker.borrow_mut(); let mut blocker = self.load_blocker.borrow_mut();
@ -186,7 +179,6 @@ impl HTMLIFrameElement {
HTMLIFrameElement { HTMLIFrameElement {
htmlelement: HTMLElement::new_inherited(localName, prefix, document), htmlelement: HTMLElement::new_inherited(localName, prefix, document),
pipeline_id: Cell::new(None), pipeline_id: Cell::new(None),
subpage_id: Cell::new(None),
sandbox: Default::default(), sandbox: Default::default(),
sandbox_allowance: Cell::new(None), sandbox_allowance: Cell::new(None),
load_blocker: DOMRefCell::new(None), load_blocker: DOMRefCell::new(None),
@ -208,11 +200,6 @@ impl HTMLIFrameElement {
self.pipeline_id.get() self.pipeline_id.get()
} }
#[inline]
pub fn subpage_id(&self) -> Option<SubpageId> {
self.subpage_id.get()
}
pub fn change_visibility_status(&self, visibility: bool) { pub fn change_visibility_status(&self, visibility: bool) {
if self.visibility.get() != visibility { if self.visibility.get() != visibility {
self.visibility.set(visibility); self.visibility.set(visibility);
@ -270,11 +257,11 @@ impl HTMLIFrameElement {
} }
pub fn get_content_window(&self) -> Option<Root<Window>> { pub fn get_content_window(&self) -> Option<Root<Window>> {
self.subpage_id.get().and_then(|subpage_id| { self.pipeline_id.get().and_then(|pipeline_id| {
let window = window_from_node(self); let window = window_from_node(self);
let window = window.r(); let window = window.r();
let browsing_context = window.browsing_context(); let browsing_context = window.browsing_context();
browsing_context.find_child_by_subpage(subpage_id) browsing_context.find_child_by_id(pipeline_id)
}) })
} }
@ -659,12 +646,11 @@ impl VirtualMethods for HTMLIFrameElement {
receiver.recv().unwrap() receiver.recv().unwrap()
} }
// Resetting the subpage id to None is required here so that // Resetting the pipeline_id to None is required here so that
// if this iframe is subsequently re-added to the document // if this iframe is subsequently re-added to the document
// the load doesn't think that it's a navigation, but instead // the load doesn't think that it's a navigation, but instead
// a new iframe. Without this, the constellation gets very // a new iframe. Without this, the constellation gets very
// confused. // confused.
self.subpage_id.set(None);
self.pipeline_id.set(None); self.pipeline_id.set(None);
} }
} }

View file

@ -30,7 +30,7 @@ use hyper::header::ContentType;
use hyper::mime::{Mime, SubLevel, TopLevel}; use hyper::mime::{Mime, SubLevel, TopLevel};
use hyper_serde::Serde; use hyper_serde::Serde;
use js::jsapi::JSTracer; use js::jsapi::JSTracer;
use msg::constellation_msg::{PipelineId, SubpageId}; use msg::constellation_msg::PipelineId;
use net_traits::{AsyncResponseListener, Metadata, NetworkError}; use net_traits::{AsyncResponseListener, Metadata, NetworkError};
use network_listener::PreInvoke; use network_listener::PreInvoke;
use parse::{Parser, ParserRef, TrustedParser}; use parse::{Parser, ParserRef, TrustedParser};
@ -67,19 +67,16 @@ pub struct ParserContext {
is_synthesized_document: bool, is_synthesized_document: bool,
/// The pipeline associated with this document. /// The pipeline associated with this document.
id: PipelineId, id: PipelineId,
/// The subpage associated with this document.
subpage: Option<SubpageId>,
/// The URL for this document. /// The URL for this document.
url: Url, url: Url,
} }
impl ParserContext { impl ParserContext {
pub fn new(id: PipelineId, subpage: Option<SubpageId>, url: Url) -> ParserContext { pub fn new(id: PipelineId, url: Url) -> ParserContext {
ParserContext { ParserContext {
parser: None, parser: None,
is_synthesized_document: false, is_synthesized_document: false,
id: id, id: id,
subpage: subpage,
url: url, url: url,
} }
} }
@ -102,7 +99,6 @@ impl AsyncResponseListener for ParserContext {
let content_type = let content_type =
metadata.clone().and_then(|meta| meta.content_type).map(Serde::into_inner); metadata.clone().and_then(|meta| meta.content_type).map(Serde::into_inner);
let parser = match ScriptThread::page_headers_available(&self.id, let parser = match ScriptThread::page_headers_available(&self.id,
self.subpage.as_ref(),
metadata) { metadata) {
Some(parser) => parser, Some(parser) => parser,
None => return, None => return,

View file

@ -51,7 +51,7 @@ use js::jsval::UndefinedValue;
use js::rust::CompileOptionsWrapper; use js::rust::CompileOptionsWrapper;
use js::rust::Runtime; use js::rust::Runtime;
use libc; use libc;
use msg::constellation_msg::{FrameType, LoadData, PipelineId, SubpageId, WindowSizeType}; use msg::constellation_msg::{FrameType, LoadData, PipelineId, WindowSizeType};
use net_traits::ResourceThreads; use net_traits::ResourceThreads;
use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::bluetooth_thread::BluetoothMethodMsg;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread}; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
@ -200,16 +200,14 @@ pub struct Window {
/// page changes. /// page changes.
devtools_wants_updates: Cell<bool>, devtools_wants_updates: Cell<bool>,
next_subpage_id: Cell<SubpageId>,
/// Pending resize event, if any. /// Pending resize event, if any.
resize_event: Cell<Option<(WindowSizeData, WindowSizeType)>>, resize_event: Cell<Option<(WindowSizeData, WindowSizeType)>>,
/// Pipeline id associated with this page. /// Pipeline id associated with this page.
id: PipelineId, id: PipelineId,
/// Subpage id associated with this page, if any. /// Parent id associated with this page, if any.
parent_info: Option<(PipelineId, SubpageId, FrameType)>, parent_info: Option<(PipelineId, FrameType)>,
/// Global static data related to the DOM. /// Global static data related to the DOM.
dom_static: GlobalStaticData, dom_static: GlobalStaticData,
@ -335,11 +333,7 @@ impl Window {
self.id self.id
} }
pub fn subpage(&self) -> Option<SubpageId> { pub fn parent_info(&self) -> Option<(PipelineId, FrameType)> {
self.parent_info.map(|p| p.1)
}
pub fn parent_info(&self) -> Option<(PipelineId, SubpageId, FrameType)> {
self.parent_info self.parent_info
} }
@ -1492,13 +1486,6 @@ impl Window {
WindowProxyHandler(self.dom_static.windowproxy_handler.0) WindowProxyHandler(self.dom_static.windowproxy_handler.0)
} }
pub fn get_next_subpage_id(&self) -> SubpageId {
let subpage_id = self.next_subpage_id.get();
let SubpageId(id_num) = subpage_id;
self.next_subpage_id.set(SubpageId(id_num + 1));
subpage_id
}
pub fn get_pending_reflow_count(&self) -> u32 { pub fn get_pending_reflow_count(&self) -> u32 {
self.pending_reflow_count.get() self.pending_reflow_count.get()
} }
@ -1612,7 +1599,7 @@ impl Window {
// https://html.spec.whatwg.org/multipage/#top-level-browsing-context // https://html.spec.whatwg.org/multipage/#top-level-browsing-context
pub fn is_top_level(&self) -> bool { pub fn is_top_level(&self) -> bool {
match self.parent_info { match self.parent_info {
Some((_, _, FrameType::IFrame)) => false, Some((_, FrameType::IFrame)) => false,
_ => true, _ => true,
} }
} }
@ -1676,7 +1663,7 @@ impl Window {
timer_event_chan: IpcSender<TimerEvent>, timer_event_chan: IpcSender<TimerEvent>,
layout_chan: Sender<Msg>, layout_chan: Sender<Msg>,
id: PipelineId, id: PipelineId,
parent_info: Option<(PipelineId, SubpageId, FrameType)>, parent_info: Option<(PipelineId, FrameType)>,
window_size: Option<WindowSizeData>) window_size: Option<WindowSizeData>)
-> Root<Window> { -> Root<Window> {
let layout_rpc: Box<LayoutRPC> = { let layout_rpc: Box<LayoutRPC> = {
@ -1726,7 +1713,6 @@ impl Window {
page_clip_rect: Cell::new(max_rect()), page_clip_rect: Cell::new(max_rect()),
fragment_name: DOMRefCell::new(None), fragment_name: DOMRefCell::new(None),
resize_event: Cell::new(None), resize_event: Cell::new(None),
next_subpage_id: Cell::new(SubpageId(0)),
layout_chan: layout_chan, layout_chan: layout_chan,
layout_rpc: layout_rpc, layout_rpc: layout_rpc,
window_size: Cell::new(window_size), window_size: Cell::new(window_size),

View file

@ -65,7 +65,7 @@ use js::jsval::UndefinedValue;
use js::rust::Runtime; use js::rust::Runtime;
use mem::heap_size_of_self_and_children; use mem::heap_size_of_self_and_children;
use msg::constellation_msg::{FrameType, LoadData, PipelineId, PipelineNamespace}; use msg::constellation_msg::{FrameType, LoadData, PipelineId, PipelineNamespace};
use msg::constellation_msg::{ReferrerPolicy, SubpageId, WindowSizeType}; use msg::constellation_msg::{ReferrerPolicy, WindowSizeType};
use net_traits::{AsyncResponseTarget, CoreResourceMsg, LoadConsumer, LoadContext, Metadata, ResourceThreads}; use net_traits::{AsyncResponseTarget, CoreResourceMsg, LoadConsumer, LoadContext, Metadata, ResourceThreads};
use net_traits::{IpcSend, LoadData as NetLoadData}; use net_traits::{IpcSend, LoadData as NetLoadData};
use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::bluetooth_thread::BluetoothMethodMsg;
@ -131,8 +131,8 @@ pub unsafe fn trace_thread(tr: *mut JSTracer) {
struct InProgressLoad { struct InProgressLoad {
/// The pipeline which requested this load. /// The pipeline which requested this load.
pipeline_id: PipelineId, pipeline_id: PipelineId,
/// The parent pipeline and child subpage associated with this load, if any. /// The parent pipeline and frame type associated with this load, if any.
parent_info: Option<(PipelineId, SubpageId, FrameType)>, parent_info: Option<(PipelineId, FrameType)>,
/// The current window size associated with this pipeline. /// The current window size associated with this pipeline.
window_size: Option<WindowSizeData>, window_size: Option<WindowSizeData>,
/// Channel to the layout thread associated with this pipeline. /// Channel to the layout thread associated with this pipeline.
@ -150,7 +150,7 @@ struct InProgressLoad {
impl InProgressLoad { impl InProgressLoad {
/// Create a new InProgressLoad object. /// Create a new InProgressLoad object.
fn new(id: PipelineId, fn new(id: PipelineId,
parent_info: Option<(PipelineId, SubpageId, FrameType)>, parent_info: Option<(PipelineId, FrameType)>,
layout_chan: Sender<message::Msg>, layout_chan: Sender<message::Msg>,
window_size: Option<WindowSizeData>, window_size: Option<WindowSizeData>,
url: Url) -> InProgressLoad { url: Url) -> InProgressLoad {
@ -484,11 +484,11 @@ impl ScriptThreadFactory for ScriptThread {
} }
impl ScriptThread { impl ScriptThread {
pub fn page_headers_available(id: &PipelineId, subpage: Option<&SubpageId>, metadata: Option<Metadata>) pub fn page_headers_available(id: &PipelineId, metadata: Option<Metadata>)
-> Option<ParserRoot> { -> Option<ParserRoot> {
SCRIPT_THREAD_ROOT.with(|root| { SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.get().unwrap() }; let script_thread = unsafe { &*root.get().unwrap() };
script_thread.handle_page_headers_available(id, subpage, metadata) script_thread.handle_page_headers_available(id, metadata)
}) })
} }
@ -877,8 +877,8 @@ impl ScriptThread {
fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) { fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) {
match msg { match msg {
ConstellationControlMsg::Navigate(parent_pipeline_id, subpage_id, load_data) => ConstellationControlMsg::Navigate(parent_pipeline_id, pipeline_id, load_data) =>
self.handle_navigate(parent_pipeline_id, Some(subpage_id), load_data), self.handle_navigate(parent_pipeline_id, Some(pipeline_id), load_data),
ConstellationControlMsg::SendEvent(id, event) => ConstellationControlMsg::SendEvent(id, event) =>
self.handle_event(id, event), self.handle_event(id, event),
ConstellationControlMsg::ResizeInactive(id, new_size) => ConstellationControlMsg::ResizeInactive(id, new_size) =>
@ -894,21 +894,19 @@ impl ScriptThread {
ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id, pipeline_id, visible) => ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id, pipeline_id, visible) =>
self.handle_visibility_change_complete_msg(parent_pipeline_id, pipeline_id, visible), self.handle_visibility_change_complete_msg(parent_pipeline_id, pipeline_id, visible),
ConstellationControlMsg::MozBrowserEvent(parent_pipeline_id, ConstellationControlMsg::MozBrowserEvent(parent_pipeline_id,
subpage_id, pipeline_id,
event) => event) =>
self.handle_mozbrowser_event_msg(parent_pipeline_id, self.handle_mozbrowser_event_msg(parent_pipeline_id,
subpage_id, pipeline_id,
event), event),
ConstellationControlMsg::UpdateSubpageId(parent_pipeline_id, ConstellationControlMsg::UpdatePipelineId(parent_pipeline_id,
old_subpage_id, old_pipeline_id,
new_subpage_id,
new_pipeline_id) => new_pipeline_id) =>
self.handle_update_subpage_id(parent_pipeline_id, self.handle_update_pipeline_id(parent_pipeline_id,
old_subpage_id, old_pipeline_id,
new_subpage_id,
new_pipeline_id), new_pipeline_id),
ConstellationControlMsg::FocusIFrame(parent_pipeline_id, subpage_id) => ConstellationControlMsg::FocusIFrame(parent_pipeline_id, pipeline_id) =>
self.handle_focus_iframe_msg(parent_pipeline_id, subpage_id), self.handle_focus_iframe_msg(parent_pipeline_id, pipeline_id),
ConstellationControlMsg::WebDriverScriptCommand(pipeline_id, msg) => ConstellationControlMsg::WebDriverScriptCommand(pipeline_id, msg) =>
self.handle_webdriver_msg(pipeline_id, msg), self.handle_webdriver_msg(pipeline_id, msg),
ConstellationControlMsg::TickAllAnimations(pipeline_id) => ConstellationControlMsg::TickAllAnimations(pipeline_id) =>
@ -1130,7 +1128,6 @@ impl ScriptThread {
let NewLayoutInfo { let NewLayoutInfo {
parent_pipeline_id, parent_pipeline_id,
new_pipeline_id, new_pipeline_id,
subpage_id,
frame_type, frame_type,
load_data, load_data,
paint_chan, paint_chan,
@ -1169,7 +1166,7 @@ impl ScriptThread {
.unwrap(); .unwrap();
// Kick off the fetch for the new resource. // Kick off the fetch for the new resource.
let new_load = InProgressLoad::new(new_pipeline_id, Some((parent_pipeline_id, subpage_id, frame_type)), let new_load = InProgressLoad::new(new_pipeline_id, Some((parent_pipeline_id, frame_type)),
layout_chan, parent_window.window_size(), layout_chan, parent_window.window_size(),
load_data.url.clone()); load_data.url.clone());
self.start_page_load(new_load, load_data); self.start_page_load(new_load, load_data);
@ -1257,7 +1254,7 @@ impl ScriptThread {
fn handle_visibility_change_complete_msg(&self, parent_pipeline_id: PipelineId, id: PipelineId, visible: bool) { fn handle_visibility_change_complete_msg(&self, parent_pipeline_id: PipelineId, id: PipelineId, visible: bool) {
if let Some(root_context) = self.browsing_context.get() { if let Some(root_context) = self.browsing_context.get() {
if let Some(ref inner_context) = root_context.find(parent_pipeline_id) { if let Some(ref inner_context) = root_context.find(parent_pipeline_id) {
if let Some(iframe) = inner_context.active_document().find_iframe_by_pipeline(id) { if let Some(iframe) = inner_context.active_document().find_iframe(id) {
iframe.change_visibility_status(visible); iframe.change_visibility_status(visible);
} }
} }
@ -1323,12 +1320,12 @@ impl ScriptThread {
fn handle_focus_iframe_msg(&self, fn handle_focus_iframe_msg(&self,
parent_pipeline_id: PipelineId, parent_pipeline_id: PipelineId,
subpage_id: SubpageId) { pipeline_id: PipelineId) {
let borrowed_context = self.root_browsing_context(); let borrowed_context = self.root_browsing_context();
let context = borrowed_context.find(parent_pipeline_id).unwrap(); let context = borrowed_context.find(parent_pipeline_id).unwrap();
let doc = context.active_document(); let doc = context.active_document();
let frame_element = doc.find_iframe(subpage_id); let frame_element = doc.find_iframe(pipeline_id);
if let Some(ref frame_element) = frame_element { if let Some(ref frame_element) = frame_element {
doc.begin_focus_transaction(); doc.begin_focus_transaction();
@ -1339,11 +1336,11 @@ impl ScriptThread {
fn handle_framed_content_changed(&self, fn handle_framed_content_changed(&self,
parent_pipeline_id: PipelineId, parent_pipeline_id: PipelineId,
subpage_id: SubpageId) { pipeline_id: PipelineId) {
let root_context = self.root_browsing_context(); let root_context = self.root_browsing_context();
let context = root_context.find(parent_pipeline_id).unwrap(); let context = root_context.find(parent_pipeline_id).unwrap();
let doc = context.active_document(); let doc = context.active_document();
let frame_element = doc.find_iframe(subpage_id); let frame_element = doc.find_iframe(pipeline_id);
if let Some(ref frame_element) = frame_element { if let Some(ref frame_element) = frame_element {
frame_element.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage); frame_element.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
let window = context.active_window(); let window = context.active_window();
@ -1357,33 +1354,32 @@ impl ScriptThread {
/// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart /// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart
fn handle_mozbrowser_event_msg(&self, fn handle_mozbrowser_event_msg(&self,
parent_pipeline_id: PipelineId, parent_pipeline_id: PipelineId,
subpage_id: Option<SubpageId>, pipeline_id: Option<PipelineId>,
event: MozBrowserEvent) { event: MozBrowserEvent) {
match self.root_browsing_context().find(parent_pipeline_id) { match self.root_browsing_context().find(parent_pipeline_id) {
None => warn!("Mozbrowser event after pipeline {:?} closed.", parent_pipeline_id), None => warn!("Mozbrowser event after pipeline {:?} closed.", parent_pipeline_id),
Some(context) => match subpage_id { Some(context) => match pipeline_id {
None => context.active_window().dispatch_mozbrowser_event(event), None => context.active_window().dispatch_mozbrowser_event(event),
Some(subpage_id) => match context.active_document().find_iframe(subpage_id) { Some(pipeline_id) => match context.active_document().find_iframe(pipeline_id) {
None => warn!("Mozbrowser event after iframe {:?}/{:?} closed.", parent_pipeline_id, subpage_id), None => warn!("Mozbrowser event after iframe {:?}/{:?} closed.", parent_pipeline_id, pipeline_id),
Some(frame_element) => frame_element.dispatch_mozbrowser_event(event), Some(frame_element) => frame_element.dispatch_mozbrowser_event(event),
}, },
}, },
} }
} }
fn handle_update_subpage_id(&self, fn handle_update_pipeline_id(&self,
parent_pipeline_id: PipelineId, parent_pipeline_id: PipelineId,
old_subpage_id: SubpageId, old_pipeline_id: PipelineId,
new_subpage_id: SubpageId,
new_pipeline_id: PipelineId) { new_pipeline_id: PipelineId) {
let borrowed_context = self.root_browsing_context(); let borrowed_context = self.root_browsing_context();
let frame_element = borrowed_context.find(parent_pipeline_id).and_then(|context| { let frame_element = borrowed_context.find(parent_pipeline_id).and_then(|context| {
let doc = context.active_document(); let doc = context.active_document();
doc.find_iframe(old_subpage_id) doc.find_iframe(old_pipeline_id)
}); });
frame_element.unwrap().update_subpage_id(new_subpage_id, new_pipeline_id); frame_element.unwrap().update_pipeline_id(new_pipeline_id);
} }
/// Window was resized, but this script was not active, so don't reflow yet /// Window was resized, but this script was not active, so don't reflow yet
@ -1412,11 +1408,9 @@ impl ScriptThread {
/// We have received notification that the response associated with a load has completed. /// We have received notification that the response associated with a load has completed.
/// Kick off the document and frame tree creation process using the result. /// Kick off the document and frame tree creation process using the result.
fn handle_page_headers_available(&self, id: &PipelineId, subpage: Option<&SubpageId>, fn handle_page_headers_available(&self, id: &PipelineId,
metadata: Option<Metadata>) -> Option<ParserRoot> { metadata: Option<Metadata>) -> Option<ParserRoot> {
let idx = self.incomplete_loads.borrow().iter().position(|load| { let idx = self.incomplete_loads.borrow().iter().position(|load| { load.pipeline_id == *id });
load.pipeline_id == *id && load.parent_info.as_ref().map(|info| &info.1) == subpage
});
// The matching in progress load structure may not exist if // The matching in progress load structure may not exist if
// the pipeline exited before the page load completed. // the pipeline exited before the page load completed.
match idx { match idx {
@ -1539,7 +1533,7 @@ impl ScriptThread {
Some(browsing_context) => browsing_context.active_document(), Some(browsing_context) => browsing_context.active_document(),
None => return warn!("Message sent to closed pipeline {}.", parent_pipeline_id), None => return warn!("Message sent to closed pipeline {}.", parent_pipeline_id),
}; };
if let Some(iframe) = document.find_iframe_by_pipeline(id) { if let Some(iframe) = document.find_iframe(id) {
iframe.iframe_load_event_steps(id); iframe.iframe_load_event_steps(id);
} }
} }
@ -1561,7 +1555,7 @@ impl ScriptThread {
} }
debug!("ScriptThread: loading {} on pipeline {:?}", incomplete.url, incomplete.pipeline_id); debug!("ScriptThread: loading {} on pipeline {:?}", incomplete.url, incomplete.pipeline_id);
let frame_element = incomplete.parent_info.and_then(|(parent_id, subpage_id, _)| { let frame_element = incomplete.parent_info.and_then(|(parent_id, _)| {
// The root context may not exist yet, if the parent of this frame // The root context may not exist yet, if the parent of this frame
// exists in a different script thread. // exists in a different script thread.
let root_context = self.browsing_context.get(); let root_context = self.browsing_context.get();
@ -1576,7 +1570,7 @@ impl ScriptThread {
root_context.and_then(|root_context| { root_context.and_then(|root_context| {
root_context.find(parent_id).and_then(|context| { root_context.find(parent_id).and_then(|context| {
let doc = context.active_document(); let doc = context.active_document();
doc.find_iframe(subpage_id) doc.find_iframe(incomplete.pipeline_id)
}) })
}) })
}); });
@ -1664,7 +1658,7 @@ impl ScriptThread {
// We have a new root frame tree. // We have a new root frame tree.
self.browsing_context.set(Some(&new_context)); self.browsing_context.set(Some(&new_context));
(new_context, ContextToRemove::Root) (new_context, ContextToRemove::Root)
} else if let Some((parent, _, _)) = incomplete.parent_info { } else if let Some((parent, _)) = incomplete.parent_info {
// Create a new context tree entry. This will be a child context. // Create a new context tree entry. This will be a child context.
let new_context = BrowsingContext::new(&window, frame_element, incomplete.pipeline_id); let new_context = BrowsingContext::new(&window, frame_element, incomplete.pipeline_id);
@ -2006,7 +2000,7 @@ impl ScriptThread {
/// https://html.spec.whatwg.org/multipage/#navigating-across-documents /// https://html.spec.whatwg.org/multipage/#navigating-across-documents
/// The entry point for content to notify that a new load has been requested /// The entry point for content to notify that a new load has been requested
/// for the given pipeline (specifically the "navigate" algorithm). /// for the given pipeline (specifically the "navigate" algorithm).
fn handle_navigate(&self, parent_pipeline_id: PipelineId, subpage_id: Option<SubpageId>, load_data: LoadData) { fn handle_navigate(&self, parent_pipeline_id: PipelineId, pipeline_id: Option<PipelineId>, load_data: LoadData) {
// Step 7. // Step 7.
{ {
let nurl = &load_data.url; let nurl = &load_data.url;
@ -2024,12 +2018,12 @@ impl ScriptThread {
} }
} }
match subpage_id { match pipeline_id {
Some(subpage_id) => { Some(pipeline_id) => {
let root_context = self.root_browsing_context(); let root_context = self.root_browsing_context();
let iframe = root_context.find(parent_pipeline_id).and_then(|context| { let iframe = root_context.find(parent_pipeline_id).and_then(|context| {
let doc = context.active_document(); let doc = context.active_document();
doc.find_iframe(subpage_id) doc.find_iframe(pipeline_id)
}); });
if let Some(iframe) = iframe.r() { if let Some(iframe) = iframe.r() {
iframe.navigate_or_reload_child_browsing_context(Some(load_data)); iframe.navigate_or_reload_child_browsing_context(Some(load_data));
@ -2076,9 +2070,8 @@ impl ScriptThread {
/// argument until a notification is received that the fetch is complete. /// argument until a notification is received that the fetch is complete.
fn start_page_load(&self, incomplete: InProgressLoad, mut load_data: LoadData) { fn start_page_load(&self, incomplete: InProgressLoad, mut load_data: LoadData) {
let id = incomplete.pipeline_id.clone(); let id = incomplete.pipeline_id.clone();
let subpage = incomplete.parent_info.clone().map(|p| p.1);
let context = Arc::new(Mutex::new(ParserContext::new(id, subpage, load_data.url.clone()))); let context = Arc::new(Mutex::new(ParserContext::new(id, load_data.url.clone())));
let (action_sender, action_receiver) = ipc::channel().unwrap(); let (action_sender, action_receiver) = ipc::channel().unwrap();
let listener = NetworkListener { let listener = NetworkListener {
context: context, context: context,

View file

@ -54,7 +54,7 @@ use layers::geometry::DevicePixel;
use libc::c_void; use libc::c_void;
use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{PipelineId, PipelineNamespaceId, ReferrerPolicy}; use msg::constellation_msg::{PipelineId, PipelineNamespaceId, ReferrerPolicy};
use msg::constellation_msg::{SubpageId, TraversalDirection, WindowSizeType}; use msg::constellation_msg::{TraversalDirection, WindowSizeType};
use net_traits::{LoadOrigin, ResourceThreads}; use net_traits::{LoadOrigin, ResourceThreads};
use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::bluetooth_thread::BluetoothMethodMsg;
use net_traits::image_cache_thread::ImageCacheThread; use net_traits::image_cache_thread::ImageCacheThread;
@ -133,8 +133,6 @@ pub struct NewLayoutInfo {
pub parent_pipeline_id: PipelineId, pub parent_pipeline_id: PipelineId,
/// Id of the newly-created pipeline. /// Id of the newly-created pipeline.
pub new_pipeline_id: PipelineId, pub new_pipeline_id: PipelineId,
/// Id of the new frame associated with this pipeline.
pub subpage_id: SubpageId,
/// Type of the new frame associated with this pipeline. /// Type of the new frame associated with this pipeline.
pub frame_type: FrameType, pub frame_type: FrameType,
/// Network request data which will be initiated by the script thread. /// Network request data which will be initiated by the script thread.
@ -178,16 +176,22 @@ pub enum ConstellationControlMsg {
/// Notifies script thread whether frame is visible /// Notifies script thread whether frame is visible
ChangeFrameVisibilityStatus(PipelineId, bool), ChangeFrameVisibilityStatus(PipelineId, bool),
/// Notifies script thread that frame visibility change is complete /// Notifies script thread that frame visibility change is complete
/// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
NotifyVisibilityChange(PipelineId, PipelineId, bool), NotifyVisibilityChange(PipelineId, PipelineId, bool),
/// Notifies script thread that a url should be loaded in this iframe. /// Notifies script thread that a url should be loaded in this iframe.
Navigate(PipelineId, SubpageId, LoadData), /// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
Navigate(PipelineId, PipelineId, LoadData),
/// Requests the script thread forward a mozbrowser event to an iframe it owns, /// Requests the script thread forward a mozbrowser event to an iframe it owns,
/// or to the window if no subpage id is provided. /// or to the window if no child pipeline id is provided.
MozBrowserEvent(PipelineId, Option<SubpageId>, MozBrowserEvent), /// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
/// Updates the current subpage and pipeline IDs of a given iframe MozBrowserEvent(PipelineId, Option<PipelineId>, MozBrowserEvent),
UpdateSubpageId(PipelineId, SubpageId, SubpageId, PipelineId), /// Updates the current pipeline ID of a given iframe.
/// First PipelineId is for the parent, second is the old PipelineId for the frame,
/// third is the new PipelineId for the frame.
UpdatePipelineId(PipelineId, PipelineId, PipelineId),
/// Set an iframe to be focused. Used when an element in an iframe gains focus. /// Set an iframe to be focused. Used when an element in an iframe gains focus.
FocusIFrame(PipelineId, SubpageId), /// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
FocusIFrame(PipelineId, PipelineId),
/// Passes a webdriver command to the script thread for execution /// Passes a webdriver command to the script thread for execution
WebDriverScriptCommand(PipelineId, WebDriverScriptCommand), WebDriverScriptCommand(PipelineId, WebDriverScriptCommand),
/// Notifies script thread that all animations are done /// Notifies script thread that all animations are done
@ -203,7 +207,8 @@ pub enum ConstellationControlMsg {
parent: PipelineId, parent: PipelineId,
}, },
/// Notifies a parent frame that one of its child frames is now active. /// Notifies a parent frame that one of its child frames is now active.
FramedContentChanged(PipelineId, SubpageId), /// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
FramedContentChanged(PipelineId, PipelineId),
/// Report an error from a CSS parser for the given pipeline /// Report an error from a CSS parser for the given pipeline
ReportCSSError(PipelineId, String, usize, usize, String), ReportCSSError(PipelineId, String, usize, usize, String),
/// Reload the given page. /// Reload the given page.
@ -228,7 +233,7 @@ impl fmt::Debug for ConstellationControlMsg {
NotifyVisibilityChange(..) => "NotifyVisibilityChange", NotifyVisibilityChange(..) => "NotifyVisibilityChange",
Navigate(..) => "Navigate", Navigate(..) => "Navigate",
MozBrowserEvent(..) => "MozBrowserEvent", MozBrowserEvent(..) => "MozBrowserEvent",
UpdateSubpageId(..) => "UpdateSubpageId", UpdatePipelineId(..) => "UpdatePipelineId",
FocusIFrame(..) => "FocusIFrame", FocusIFrame(..) => "FocusIFrame",
WebDriverScriptCommand(..) => "WebDriverScriptCommand", WebDriverScriptCommand(..) => "WebDriverScriptCommand",
TickAllAnimations(..) => "TickAllAnimations", TickAllAnimations(..) => "TickAllAnimations",
@ -389,7 +394,7 @@ pub struct InitialScriptState {
pub id: PipelineId, pub id: PipelineId,
/// The subpage ID of this pipeline to create in its pipeline parent. /// The subpage ID of this pipeline to create in its pipeline parent.
/// If `None`, this is the root. /// If `None`, this is the root.
pub parent_info: Option<(PipelineId, SubpageId, FrameType)>, pub parent_info: Option<(PipelineId, FrameType)>,
/// A channel with which messages can be sent to us (the script thread). /// A channel with which messages can be sent to us (the script thread).
pub control_chan: IpcSender<ConstellationControlMsg>, pub control_chan: IpcSender<ConstellationControlMsg>,
/// A port on which messages sent by the constellation to script can be received. /// A port on which messages sent by the constellation to script can be received.
@ -445,10 +450,8 @@ pub struct IFrameLoadInfo {
pub load_data: Option<LoadData>, pub load_data: Option<LoadData>,
/// Pipeline ID of the parent of this iframe /// Pipeline ID of the parent of this iframe
pub parent_pipeline_id: PipelineId, pub parent_pipeline_id: PipelineId,
/// The new subpage ID for this load /// The old pipeline ID for this iframe, if a page was previously loaded.
pub new_subpage_id: SubpageId, pub old_pipeline_id: Option<PipelineId>,
/// The old subpage ID for this iframe, if a page was previously loaded.
pub old_subpage_id: Option<SubpageId>,
/// The new pipeline ID that the iframe has generated. /// The new pipeline ID that the iframe has generated.
pub new_pipeline_id: PipelineId, pub new_pipeline_id: PipelineId,
/// Sandbox type of this iframe /// Sandbox type of this iframe

View file

@ -17,7 +17,7 @@ use euclid::size::Size2D;
use gfx_traits::LayerId; use gfx_traits::LayerId;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{PipelineId, SubpageId, TraversalDirection}; use msg::constellation_msg::{PipelineId, TraversalDirection};
use net_traits::CoreResourceMsg; use net_traits::CoreResourceMsg;
use offscreen_gl_context::{GLContextAttributes, GLLimits}; use offscreen_gl_context::{GLContextAttributes, GLLimits};
use style_traits::cursor::Cursor; use style_traits::cursor::Cursor;
@ -87,7 +87,8 @@ pub enum ScriptMsg {
LoadUrl(PipelineId, LoadData), LoadUrl(PipelineId, LoadData),
/// Dispatch a mozbrowser event to a given iframe, /// Dispatch a mozbrowser event to a given iframe,
/// or to the window if no subpage id is provided. /// or to the window if no subpage id is provided.
MozBrowserEvent(PipelineId, Option<SubpageId>, MozBrowserEvent), /// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
MozBrowserEvent(PipelineId, Option<PipelineId>, MozBrowserEvent),
/// HTMLIFrameElement Forward or Back traversal. /// HTMLIFrameElement Forward or Back traversal.
TraverseHistory(Option<PipelineId>, TraversalDirection), TraverseHistory(Option<PipelineId>, TraversalDirection),
/// Gets the length of the joint session history from the constellation. /// Gets the length of the joint session history from the constellation.