aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-05-16 23:10:45 -0500
committerGitHub <noreply@github.com>2017-05-16 23:10:45 -0500
commit837531992864f920342020462830b933d5ed0280 (patch)
treea79281756cb68f6e37c75901de88129c511c3473
parentfada0eb6607fa746cd88426ebb7bb4052f709cda (diff)
parent607e011b050f22e10a69fc7d57d7e2dc473d979e (diff)
downloadservo-837531992864f920342020462830b933d5ed0280.tar.gz
servo-837531992864f920342020462830b933d5ed0280.zip
Auto merge of #16876 - asajeffrey:constellation-rename-frames, r=cbrewster
Renamed constellation::Frame to constellation::BrowsingContext <!-- Please describe your changes on the following line: --> Now that script has `WindowProxy` rather than `BrowsingContext` objects, we can rename `Frame` in the constellation to `BrowsingContext`. In particular, this means that `FrameId`s are now `BrowsingContextid`s, which better captures their purpose (and they are used in a lot of places, not just the constellation). --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because renaming <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16876) <!-- Reviewable:end -->
-rw-r--r--components/constellation/browsingcontext.rs (renamed from components/constellation/frame.rs)140
-rw-r--r--components/constellation/constellation.rs905
-rw-r--r--components/constellation/lib.rs2
-rw-r--r--components/constellation/pipeline.rs60
-rw-r--r--components/layout/display_list_builder.rs6
-rw-r--r--components/layout/fragment.rs8
-rw-r--r--components/layout_thread/lib.rs12
-rw-r--r--components/layout_traits/lib.rs4
-rw-r--r--components/msg/constellation_msg.rs42
-rw-r--r--components/script/dom/bindings/trace.rs4
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs8
-rw-r--r--components/script/dom/dissimilaroriginwindow.rs4
-rw-r--r--components/script/dom/document.rs6
-rw-r--r--components/script/dom/htmliframeelement.rs32
-rw-r--r--components/script/dom/node.rs8
-rw-r--r--components/script/dom/windowproxy.rs24
-rw-r--r--components/script/layout_wrapper.rs6
-rw-r--r--components/script/script_thread.rs124
-rw-r--r--components/script/webdriver_handlers.rs8
-rw-r--r--components/script_layout_interface/wrapper_traits.rs6
-rw-r--r--components/script_traits/lib.rs48
-rw-r--r--components/script_traits/script_msg.rs16
-rw-r--r--components/script_traits/webdriver_msg.rs2
-rw-r--r--components/webdriver_server/lib.rs24
24 files changed, 778 insertions, 721 deletions
diff --git a/components/constellation/frame.rs b/components/constellation/browsingcontext.rs
index ac85c14d214..5f6f29aecf6 100644
--- a/components/constellation/frame.rs
+++ b/components/constellation/browsingcontext.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use euclid::size::TypedSize2D;
-use msg::constellation_msg::{FrameId, PipelineId};
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
use pipeline::Pipeline;
use script_traits::LoadData;
use std::collections::HashMap;
@@ -12,17 +12,16 @@ use std::mem::replace;
use std::time::Instant;
use style_traits::CSSPixel;
-/// A frame in the frame tree.
-/// Each frame is the constellation's view of a browsing context.
+/// The constellation's view of a browsing context.
/// Each browsing context has a session history, caused by
-/// navigation and traversing the history. Each frame has its
+/// navigation and traversing the history. Each browsing contest has its
/// current entry, plus past and future entries. The past is sorted
/// chronologically, the future is sorted reverse chronologically:
/// in particular prev.pop() is the latest past entry, and
/// next.pop() is the earliest future entry.
-pub struct Frame {
- /// The frame id.
- pub id: FrameId,
+pub struct BrowsingContext {
+ /// The browsing context id.
+ pub id: BrowsingContextId,
/// The size of the frame.
pub size: Option<TypedSize2D<f32, CSSPixel>>,
@@ -37,17 +36,17 @@ pub struct Frame {
pub load_data: LoadData,
/// The past session history, ordered chronologically.
- pub prev: Vec<FrameState>,
+ pub prev: Vec<SessionHistoryEntry>,
/// The future session history, ordered reverse chronologically.
- pub next: Vec<FrameState>,
+ pub next: Vec<SessionHistoryEntry>,
}
-impl Frame {
- /// Create a new frame.
- /// Note this just creates the frame, it doesn't add it to the frame tree.
- pub fn new(id: FrameId, pipeline_id: PipelineId, load_data: LoadData) -> Frame {
- Frame {
+impl BrowsingContext {
+ /// Create a new browsing context.
+ /// Note this just creates the browsing context, it doesn't add it to the constellation's set of browsing contexts.
+ pub fn new(id: BrowsingContextId, pipeline_id: PipelineId, load_data: LoadData) -> BrowsingContext {
+ BrowsingContext {
id: id,
size: None,
pipeline_id: pipeline_id,
@@ -58,17 +57,17 @@ impl Frame {
}
}
- /// Get the current frame state.
- pub fn current(&self) -> FrameState {
- FrameState {
+ /// Get the current session history entry.
+ pub fn current(&self) -> SessionHistoryEntry {
+ SessionHistoryEntry {
instant: self.instant,
- frame_id: self.id,
+ browsing_context_id: self.id,
pipeline_id: Some(self.pipeline_id),
load_data: self.load_data.clone(),
}
}
- /// Set the current frame entry, and push the current frame entry into the past.
+ /// Set the current session history entry, and push the current frame entry into the past.
pub fn load(&mut self, pipeline_id: PipelineId, load_data: LoadData) {
let current = self.current();
self.prev.push(current);
@@ -78,25 +77,27 @@ impl Frame {
}
/// Set the future to be empty.
- pub fn remove_forward_entries(&mut self) -> Vec<FrameState> {
+ pub fn remove_forward_entries(&mut self) -> Vec<SessionHistoryEntry> {
replace(&mut self.next, vec!())
}
- /// Update the current entry of the Frame from an entry that has been traversed to.
- pub fn update_current(&mut self, pipeline_id: PipelineId, entry: FrameState) {
+ /// Update the current entry of the BrowsingContext from an entry that has been traversed to.
+ pub fn update_current(&mut self, pipeline_id: PipelineId, entry: SessionHistoryEntry) {
self.pipeline_id = pipeline_id;
self.instant = entry.instant;
self.load_data = entry.load_data;
}
}
-/// An entry in a frame's session history.
+/// An entry in a browsing context's session history.
/// Each entry stores the pipeline id for a document in the session history.
///
/// When we operate on the joint session history, entries are sorted chronologically,
/// so we timestamp the entries by when the entry was added to the session history.
+///
+/// https://html.spec.whatwg.org/multipage/#session-history-entry
#[derive(Clone)]
-pub struct FrameState {
+pub struct SessionHistoryEntry {
/// The timestamp for when the session history entry was created
pub instant: Instant,
@@ -108,14 +109,14 @@ pub struct FrameState {
pub load_data: LoadData,
/// The frame that this session history entry is part of
- pub frame_id: FrameId,
+ pub browsing_context_id: BrowsingContextId,
}
-/// Represents a pending change in the frame tree, that will be applied
+/// Represents a pending change in a session history, that will be applied
/// once the new pipeline has loaded and completed initial layout / paint.
-pub struct FrameChange {
- /// The frame to change.
- pub frame_id: FrameId,
+pub struct SessionHistoryChange {
+ /// The browsing context to change.
+ pub browsing_context_id: BrowsingContextId,
/// The pipeline for the document being loaded.
pub new_pipeline_id: PipelineId,
@@ -129,16 +130,15 @@ pub struct FrameChange {
pub replace_instant: Option<Instant>,
}
-/// An iterator over a frame tree, returning the fully active frames in
-/// depth-first order. Note that this iterator only returns the fully
-/// active frames, that is ones where every ancestor frame is
-/// in the currently active pipeline of its parent frame.
-pub struct FrameTreeIterator<'a> {
- /// The frames still to iterate over.
- pub stack: Vec<FrameId>,
+/// An iterator over browsing contexts, returning the descendant
+/// contexts whose active documents are fully active, in depth-first
+/// order.
+pub struct FullyActiveBrowsingContextsIterator<'a> {
+ /// The browsing contexts still to iterate over.
+ pub stack: Vec<BrowsingContextId>,
- /// The set of all frames.
- pub frames: &'a HashMap<FrameId, Frame>,
+ /// The set of all browsing contexts.
+ pub browsing_contexts: &'a HashMap<BrowsingContextId, BrowsingContext>,
/// The set of all pipelines. We use this to find the active
/// children of a frame, which are the iframes in the currently
@@ -146,73 +146,73 @@ pub struct FrameTreeIterator<'a> {
pub pipelines: &'a HashMap<PipelineId, Pipeline>,
}
-impl<'a> Iterator for FrameTreeIterator<'a> {
- type Item = &'a Frame;
- fn next(&mut self) -> Option<&'a Frame> {
+impl<'a> Iterator for FullyActiveBrowsingContextsIterator<'a> {
+ type Item = &'a BrowsingContext;
+ fn next(&mut self) -> Option<&'a BrowsingContext> {
loop {
- let frame_id = match self.stack.pop() {
- Some(frame_id) => frame_id,
+ let browsing_context_id = match self.stack.pop() {
+ Some(browsing_context_id) => browsing_context_id,
None => return None,
};
- let frame = match self.frames.get(&frame_id) {
- Some(frame) => frame,
+ let browsing_context = match self.browsing_contexts.get(&browsing_context_id) {
+ Some(browsing_context) => browsing_context,
None => {
- warn!("Frame {:?} iterated after closure.", frame_id);
+ warn!("BrowsingContext {:?} iterated after closure.", browsing_context_id);
continue;
},
};
- let pipeline = match self.pipelines.get(&frame.pipeline_id) {
+ let pipeline = match self.pipelines.get(&browsing_context.pipeline_id) {
Some(pipeline) => pipeline,
None => {
- warn!("Pipeline {:?} iterated after closure.", frame.pipeline_id);
+ warn!("Pipeline {:?} iterated after closure.", browsing_context.pipeline_id);
continue;
},
};
self.stack.extend(pipeline.children.iter());
- return Some(frame)
+ return Some(browsing_context)
}
}
}
-/// An iterator over a frame tree, returning all frames in depth-first
-/// order. Note that this iterator returns all frames, not just the
-/// fully active ones.
-pub struct FullFrameTreeIterator<'a> {
- /// The frames still to iterate over.
- pub stack: Vec<FrameId>,
+/// An iterator over browsing contexts, returning all descendant
+/// contexts in depth-first order. Note that this iterator returns all
+/// contexts, not just the fully active ones.
+pub struct AllBrowsingContextsIterator<'a> {
+ /// The browsing contexts still to iterate over.
+ pub stack: Vec<BrowsingContextId>,
- /// The set of all frames.
- pub frames: &'a HashMap<FrameId, Frame>,
+ /// The set of all browsing contexts.
+ pub browsing_contexts: &'a HashMap<BrowsingContextId, BrowsingContext>,
/// The set of all pipelines. We use this to find the
- /// children of a frame, which are the iframes in all documents
+ /// children of a browsing context, which are the iframes in all documents
/// in the session history.
pub pipelines: &'a HashMap<PipelineId, Pipeline>,
}
-impl<'a> Iterator for FullFrameTreeIterator<'a> {
- type Item = &'a Frame;
- fn next(&mut self) -> Option<&'a Frame> {
+impl<'a> Iterator for AllBrowsingContextsIterator<'a> {
+ type Item = &'a BrowsingContext;
+ fn next(&mut self) -> Option<&'a BrowsingContext> {
let pipelines = self.pipelines;
loop {
- let frame_id = match self.stack.pop() {
- Some(frame_id) => frame_id,
+ let browsing_context_id = match self.stack.pop() {
+ Some(browsing_context_id) => browsing_context_id,
None => return None,
};
- let frame = match self.frames.get(&frame_id) {
- Some(frame) => frame,
+ let browsing_context = match self.browsing_contexts.get(&browsing_context_id) {
+ Some(browsing_context) => browsing_context,
None => {
- warn!("Frame {:?} iterated after closure.", frame_id);
+ warn!("BrowsingContext {:?} iterated after closure.", browsing_context_id);
continue;
},
};
- let child_frame_ids = frame.prev.iter().chain(frame.next.iter())
+ let child_browsing_context_ids = browsing_context.prev.iter().chain(browsing_context.next.iter())
.filter_map(|entry| entry.pipeline_id)
- .chain(once(frame.pipeline_id))
+ .chain(once(browsing_context.pipeline_id))
.filter_map(|pipeline_id| pipelines.get(&pipeline_id))
.flat_map(|pipeline| pipeline.children.iter());
- self.stack.extend(child_frame_ids);
- return Some(frame)
+ self.stack.extend(child_browsing_context_ids);
+ return Some(browsing_context)
}
}
}
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index 01a59070730..c16ff8c2049 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -16,32 +16,34 @@
//! layout threads. Pipelines may share script threads, but not
//! layout threads.
//!
-//! * The set of all `Frame` objects. Each frame gives the constellation's
-//! view of a browsing context. Each browsing context stores an independent
-//! session history, created by navigation of that frame. The session
+//! * The set of all `BrowsingContext` objects. Each browsing context
+//! gives the constellation's view of a `WindowProxy`.
+//! Each browsing context stores an independent
+//! session history, created by navigation. The session
//! history can be traversed, for example by the back and forwards UI,
//! so each session history maintains a list of past and future pipelines,
//! as well as the current active pipeline.
//!
-//! There are two kinds of frames: top-level frames (for example tabs
-//! in a browser UI), and nested frames (typically caused by `iframe`
-//! elements). Frames have a hierarchy (typically caused by `iframe`s
-//! containing `iframe`s), giving rise to a frame tree with a root frame.
-//! The logical relationship between these types is:
+//! There are two kinds of browsing context: top-level ones (for
+//! example tabs in a browser UI), and nested ones (typically caused
+//! by `iframe` elements). Browsing contexts have a hierarchy
+//! (typically caused by `iframe`s containing `iframe`s), giving rise
+//! to a tree with a root top-level browsing context. The logical
+//! relationship between these types is:
//!
//! ```
-//! +---------+ +------------+ +-------------+
-//! | Frame | --parent?--> | Pipeline | --event_loop--> | EventLoop |
-//! | | --current--> | | | |
-//! | | --prev*----> | | <---pipeline*-- | |
-//! | | --next*----> | | +-------------+
-//! | | | |
-//! | | <----frame-- | |
-//! +---------+ +------------+
+//! +------------+ +------------+ +---------+
+//! | Browsing | ------parent?------> | Pipeline | --event_loop--> | Event |
+//! | Context | ------current------> | | | Loop |
+//! | | ------prev*--------> | | <---pipeline*-- | |
+//! | | ------next*--------> | | +---------+
+//! | | | |
+//! | | <-browsing_context-- | |
+//! +------------+ +------------+
//! ```
//
//! Complicating matters, there are also mozbrowser iframes, which are top-level
-//! frames with a parent.
+//! iframes with a parent.
//!
//! The constellation also maintains channels to threads, including:
//!
@@ -53,7 +55,7 @@
//! * The devtools, debugger and webdriver servers.
//!
//! The constellation passes messages between the threads, and updates its state
-//! to track the evolving state of the frame tree.
+//! to track the evolving state of the browsing context tree.
//!
//! The constellation acts as a logger, tracking any `warn!` messages from threads,
//! and converting any `error!` or `panic!` into a crash report, which is filed
@@ -64,6 +66,8 @@
use backtrace::Backtrace;
use bluetooth_traits::BluetoothRequest;
+use browsingcontext::{BrowsingContext, SessionHistoryChange, SessionHistoryEntry};
+use browsingcontext::{FullyActiveBrowsingContextsIterator, AllBrowsingContextsIterator};
use canvas::canvas_paint_thread::CanvasPaintThread;
use canvas::webgl_paint_thread::WebGLPaintThread;
use canvas_traits::CanvasMsg;
@@ -75,7 +79,6 @@ use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
use euclid::scale_factor::ScaleFactor;
use euclid::size::{Size2D, TypedSize2D};
use event_loop::EventLoop;
-use frame::{Frame, FrameChange, FrameState, FrameTreeIterator, FullFrameTreeIterator};
use gfx::font_cache_thread::FontCacheThread;
use gfx_traits::Epoch;
use ipc_channel::{Error as IpcError};
@@ -84,7 +87,7 @@ use ipc_channel::router::ROUTER;
use itertools::Itertools;
use layout_traits::LayoutThreadFactory;
use log::{Log, LogLevel, LogLevelFilter, LogMetadata, LogRecord};
-use msg::constellation_msg::{FrameId, FrameType, PipelineId};
+use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId};
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection};
use net_traits::{self, IpcSend, ResourceThreads};
@@ -222,32 +225,33 @@ pub struct Constellation<Message, LTF, STF> {
/// The set of all event loops in the browser. We generate a new
/// event loop for each registered domain name (aka eTLD+1) in
- /// each top-level frame. We store the event loops in a map
- /// indexed by top-level frame id (as a `FrameId`) and registered
+ /// each top-level browsing context. We store the event loops in a map
+ /// indexed by top-level browsing context id
+ /// (as a `BrowsingContextId`) and registered
/// domain name (as a `Host`) to event loops. This double
/// indirection ensures that separate tabs do not share event
/// loops, even if the same domain is loaded in each.
/// It is important that scripts with the same eTLD+1
/// share an event loop, since they can use `document.domain`
/// to become same-origin, at which point they can share DOM objects.
- event_loops: HashMap<FrameId, HashMap<Host, Weak<EventLoop>>>,
+ event_loops: HashMap<BrowsingContextId, HashMap<Host, Weak<EventLoop>>>,
/// The set of all the pipelines in the browser.
/// (See the `pipeline` module for more details.)
pipelines: HashMap<PipelineId, Pipeline>,
- /// The set of all the frames in the browser.
- frames: HashMap<FrameId, Frame>,
+ /// The set of all the browsing contexts in the browser.
+ browsing_contexts: HashMap<BrowsingContextId, BrowsingContext>,
/// When a navigation is performed, we do not immediately update
- /// the frame tree, instead we ask the event loop to begin loading
- /// the new document, and do not update the frame tree until the
+ /// the session history, instead we ask the event loop to begin loading
+ /// the new document, and do not update the browsing context until the
/// document is active. Between starting the load and it activating,
- /// we store a `FrameChange` object for the navigation in progress.
- pending_frames: Vec<FrameChange>,
+ /// we store a `SessionHistoryChange` object for the navigation in progress.
+ pending_changes: Vec<SessionHistoryChange>,
- /// The root frame.
- root_frame_id: FrameId,
+ /// The root browsing context.
+ root_browsing_context_id: BrowsingContextId,
/// The currently focused pipeline for key events.
focus_pipeline_id: Option<PipelineId>,
@@ -339,8 +343,8 @@ impl WebDriverData {
/// This enum gives the possible states of preparing such an image.
#[derive(Debug, PartialEq)]
enum ReadyToSave {
- NoRootFrame,
- PendingFrames,
+ NoRootBrowsingContext,
+ PendingChanges,
WebFontNotLoaded,
DocumentLoading,
EpochMismatch,
@@ -391,9 +395,9 @@ impl Log for FromScriptLogger {
fn log(&self, record: &LogRecord) {
if let Some(entry) = log_entry(record) {
debug!("Sending log entry {:?}.", entry);
- let top_level_frame_id = FrameId::installed();
+ let top_level_id = BrowsingContextId::installed();
let thread_name = thread::current().name().map(ToOwned::to_owned);
- let msg = FromScriptMsg::LogEntry(top_level_frame_id, thread_name, entry);
+ let msg = FromScriptMsg::LogEntry(top_level_id, thread_name, entry);
let chan = self.constellation_chan.lock().unwrap_or_else(|err| err.into_inner());
let _ = chan.send(msg);
}
@@ -429,9 +433,9 @@ impl Log for FromCompositorLogger {
fn log(&self, record: &LogRecord) {
if let Some(entry) = log_entry(record) {
debug!("Sending log entry {:?}.", entry);
- let top_level_frame_id = FrameId::installed();
+ let top_level_id = BrowsingContextId::installed();
let thread_name = thread::current().name().map(ToOwned::to_owned);
- let msg = FromCompositorMsg::LogEntry(top_level_frame_id, thread_name, entry);
+ let msg = FromCompositorMsg::LogEntry(top_level_id, thread_name, entry);
let chan = self.constellation_chan.lock().unwrap_or_else(|err| err.into_inner());
let _ = chan.send(msg);
}
@@ -516,11 +520,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
swmanager_sender: sw_mgr_clone,
event_loops: HashMap::new(),
pipelines: HashMap::new(),
- frames: HashMap::new(),
- pending_frames: vec!(),
+ browsing_contexts: HashMap::new(),
+ pending_changes: vec!(),
// We initialize the namespace at 1, since we reserved namespace 0 for the constellation
next_pipeline_namespace_id: PipelineNamespaceId(1),
- root_frame_id: FrameId::new(),
+ root_browsing_context_id: BrowsingContextId::new(),
focus_pipeline_id: None,
time_profiler_chan: state.time_profiler_chan,
mem_profiler_chan: state.mem_profiler_chan,
@@ -575,7 +579,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
/// Helper function for creating a pipeline
fn new_pipeline(&mut self,
pipeline_id: PipelineId,
- frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
parent_info: Option<(PipelineId, FrameType)>,
initial_window_size: Option<TypedSize2D<f32, CSSPixel>>,
// TODO: we have to provide ownership of the LoadData
@@ -589,13 +593,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// TODO: can we get a case where the child pipeline is created
// before the parent is part of the frame tree?
- let top_level_frame_id = match parent_info {
- Some((_, FrameType::MozBrowserIFrame)) => frame_id,
- Some((parent_id, _)) => self.get_top_level_frame_for_pipeline(parent_id),
- None => self.root_frame_id,
+ let top_level_id = match parent_info {
+ Some((_, FrameType::MozBrowserIFrame)) => browsing_context_id,
+ Some((parent_id, _)) => self.get_top_level_browsing_context_for_pipeline(parent_id),
+ None => self.root_browsing_context_id,
};
- debug!("Creating new pipeline {} in top-level frame {}.", pipeline_id, top_level_frame_id);
+ debug!("Creating new pipeline {} in top-level browsing context {}.", pipeline_id, top_level_id);
let (event_loop, host) = match sandbox {
IFrameSandboxState::IFrameSandboxed => (None, None),
@@ -606,7 +610,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
match reg_host(&load_data.url) {
None => (None, None),
Some(host) => {
- let event_loop = self.event_loops.get(&top_level_frame_id)
+ let event_loop = self.event_loops.get(&top_level_id)
.and_then(|map| map.get(&host))
.and_then(|weak| weak.upgrade());
match event_loop {
@@ -637,23 +641,23 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
.and_then(|(parent_pipeline_id, _)| self.pipelines.get(&parent_pipeline_id))
.map(|pipeline| pipeline.visible);
- let prev_visibility = self.frames.get(&frame_id)
- .and_then(|frame| self.pipelines.get(&frame.pipeline_id))
+ let prev_visibility = self.browsing_contexts.get(&browsing_context_id)
+ .and_then(|browsing_context| self.pipelines.get(&browsing_context.pipeline_id))
.map(|pipeline| pipeline.visible)
.or(parent_visibility);
// TODO: think about the case where the child pipeline is created
// before the parent is part of the frame tree.
- let top_level_frame_id = match parent_info {
- Some((_, FrameType::MozBrowserIFrame)) => frame_id,
- Some((parent_id, _)) => self.get_top_level_frame_for_pipeline(parent_id),
- None => self.root_frame_id,
+ let top_level_browsing_context_id = match parent_info {
+ Some((_, FrameType::MozBrowserIFrame)) => browsing_context_id,
+ Some((parent_id, _)) => self.get_top_level_browsing_context_for_pipeline(parent_id),
+ None => self.root_browsing_context_id,
};
let result = Pipeline::spawn::<Message, LTF, STF>(InitialPipelineState {
id: pipeline_id,
- frame_id: frame_id,
- top_level_frame_id: top_level_frame_id,
+ browsing_context_id: browsing_context_id,
+ top_level_browsing_context_id: top_level_browsing_context_id,
parent_info: parent_info,
constellation_chan: self.script_sender.clone(),
layout_to_constellation_chan: self.layout_sender.clone(),
@@ -683,8 +687,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
};
if let Some(host) = host {
- debug!("Adding new host entry {} for top-level frame {}.", host, top_level_frame_id);
- self.event_loops.entry(top_level_frame_id)
+ debug!("Adding new host entry {} for top-level browsing context {}.", host, top_level_browsing_context_id);
+ self.event_loops.entry(top_level_browsing_context_id)
.or_insert_with(HashMap::new)
.insert(host, Rc::downgrade(&pipeline.event_loop));
}
@@ -693,75 +697,84 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.pipelines.insert(pipeline_id, pipeline);
}
- /// Get an iterator for the current frame tree. Specify self.root_frame_id to
- /// iterate the entire tree, or a specific frame id to iterate only that sub-tree.
- /// Iterates over the fully active frames in the tree.
- fn current_frame_tree_iter(&self, frame_id_root: FrameId) -> FrameTreeIterator {
- FrameTreeIterator {
- stack: vec!(frame_id_root),
+ /// Get an iterator for browsing contexts. Specify self.root_browsing context_id to
+ /// iterate the entire tree, or a specific browsing context id to iterate only that sub-tree.
+ /// Iterates over the fully active browsing contexts in the tree.
+ fn fully_active_browsing_contexts_iter(&self, browsing_context_id: BrowsingContextId)
+ -> FullyActiveBrowsingContextsIterator
+ {
+ FullyActiveBrowsingContextsIterator {
+ stack: vec!(browsing_context_id),
pipelines: &self.pipelines,
- frames: &self.frames,
+ browsing_contexts: &self.browsing_contexts,
}
}
- /// Get an iterator for the current frame tree. Specify self.root_frame_id to
- /// iterate the entire tree, or a specific frame id to iterate only that sub-tree.
- /// Iterates over all frames in the tree.
- fn full_frame_tree_iter(&self, frame_id_root: FrameId) -> FullFrameTreeIterator {
- FullFrameTreeIterator {
- stack: vec!(frame_id_root),
+ /// Get an iterator for browsing contexts. Specify self.root_browsing_context_id to
+ /// iterate the entire tree, or a specific browsing context id to iterate only that sub-tree.
+ /// Iterates over all browsing contexts in the tree.
+ fn all_browsing_contexts_iter(&self, browsing_context_id: BrowsingContextId)
+ -> AllBrowsingContextsIterator
+ {
+ AllBrowsingContextsIterator {
+ stack: vec!(browsing_context_id),
pipelines: &self.pipelines,
- frames: &self.frames,
+ browsing_contexts: &self.browsing_contexts,
}
}
/// The joint session future is the merge of the session future of every
- /// frame in the frame tree, sorted chronologically.
- fn joint_session_future<'a>(&'a self, frame_id_root: FrameId) -> impl Iterator<Item = &'a FrameState> + 'a {
- self.full_frame_tree_iter(frame_id_root)
- .map(|frame| frame.next.iter().rev())
+ /// browsing_context, sorted chronologically.
+ fn joint_session_future<'a>(&'a self, browsing_context_id: BrowsingContextId)
+ -> impl Iterator<Item = &'a SessionHistoryEntry> + 'a
+ {
+ self.all_browsing_contexts_iter(browsing_context_id)
+ .map(|browsing_context| browsing_context.next.iter().rev())
.kmerge_by(|a, b| a.instant.cmp(&b.instant) == Ordering::Less)
}
/// Is the joint session future empty?
- fn joint_session_future_is_empty(&self, frame_id_root: FrameId) -> bool {
- self.full_frame_tree_iter(frame_id_root)
- .all(|frame| frame.next.is_empty())
+ fn joint_session_future_is_empty(&self, browsing_context_id: BrowsingContextId) -> bool {
+ self.all_browsing_contexts_iter(browsing_context_id)
+ .all(|browsing_context| browsing_context.next.is_empty())
}
/// The joint session past is the merge of the session past of every
- /// frame in the frame tree, sorted reverse chronologically.
- fn joint_session_past<'a>(&'a self, frame_id_root: FrameId) -> impl Iterator<Item = &'a FrameState> + 'a {
- self.full_frame_tree_iter(frame_id_root)
- .map(|frame| frame.prev.iter().rev().scan(frame.instant, |prev_instant, entry| {
- let instant = *prev_instant;
- *prev_instant = entry.instant;
- Some((instant, entry))
- }))
+ /// browsing_context, sorted reverse chronologically.
+ fn joint_session_past<'a>(&'a self, browsing_context_id: BrowsingContextId)
+ -> impl Iterator<Item = &'a SessionHistoryEntry> + 'a
+ {
+ self.all_browsing_contexts_iter(browsing_context_id)
+ .map(|browsing_context| browsing_context.prev.iter().rev()
+ .scan(browsing_context.instant, |prev_instant, entry| {
+ let instant = *prev_instant;
+ *prev_instant = entry.instant;
+ Some((instant, entry))
+ }))
.kmerge_by(|a, b| a.0.cmp(&b.0) == Ordering::Greater)
.map(|(_, entry)| entry)
}
/// Is the joint session past empty?
- fn joint_session_past_is_empty(&self, frame_id_root: FrameId) -> bool {
- self.full_frame_tree_iter(frame_id_root)
- .all(|frame| frame.prev.is_empty())
+ fn joint_session_past_is_empty(&self, browsing_context_id: BrowsingContextId) -> bool {
+ self.all_browsing_contexts_iter(browsing_context_id)
+ .all(|browsing_context| browsing_context.prev.is_empty())
}
- /// Create a new frame and update the internal bookkeeping.
- fn new_frame(&mut self,
- frame_id: FrameId,
+ /// Create a new browsing context and update the internal bookkeeping.
+ fn new_browsing_context(&mut self,
+ browsing_context_id: BrowsingContextId,
pipeline_id: PipelineId,
load_data: LoadData) {
- let frame = Frame::new(frame_id, pipeline_id, load_data);
- self.frames.insert(frame_id, frame);
+ let browsing_context = BrowsingContext::new(browsing_context_id, pipeline_id, load_data);
+ self.browsing_contexts.insert(browsing_context_id, browsing_context);
- // If a child frame, add it to the parent pipeline.
+ // If a child browsing_context, add it to the parent pipeline.
let parent_info = self.pipelines.get(&pipeline_id)
.and_then(|pipeline| pipeline.parent_info);
if let Some((parent_id, _)) = parent_info {
if let Some(parent) = self.pipelines.get_mut(&parent_id) {
- parent.add_child(frame_id);
+ parent.add_child(browsing_context_id);
}
}
}
@@ -810,8 +823,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// Treat deserialization error the same as receiving a panic message
debug!("Deserialization failed ({:?}).", err);
let reason = format!("Deserialization failed ({})", err);
- let root_frame_id = self.root_frame_id;
- return self.handle_panic(root_frame_id, reason, None);
+ let root_browsing_context_id = self.root_browsing_context_id;
+ return self.handle_panic(root_browsing_context_id, reason, None);
}
};
@@ -846,13 +859,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
debug!("constellation exiting");
self.handle_exit();
}
- FromCompositorMsg::GetFrame(pipeline_id, resp_chan) => {
- debug!("constellation got get root pipeline message");
- self.handle_get_frame(pipeline_id, resp_chan);
+ FromCompositorMsg::GetBrowsingContext(pipeline_id, resp_chan) => {
+ debug!("constellation got get browsing context message");
+ self.handle_get_browsing_context(pipeline_id, resp_chan);
}
- FromCompositorMsg::GetPipeline(frame_id, resp_chan) => {
+ FromCompositorMsg::GetPipeline(browsing_context_id, resp_chan) => {
debug!("constellation got get root pipeline message");
- self.handle_get_pipeline(frame_id, resp_chan);
+ self.handle_get_pipeline(browsing_context_id, resp_chan);
}
FromCompositorMsg::GetPipelineTitle(pipeline_id) => {
debug!("constellation got get-pipeline-title message");
@@ -863,7 +876,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.handle_key_msg(ch, key, state, modifiers);
}
// Load a new page from a typed url
- // If there is already a pending page (self.pending_frames), it will not be overridden;
+ // If there is already a pending page (self.pending_changes), it will not be overridden;
// However, if the id is not encompassed by another change, it will be.
FromCompositorMsg::LoadUrl(source_id, load_data) => {
debug!("constellation got URL load message from compositor");
@@ -906,8 +919,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
debug!("constellation got reload message");
self.handle_reload_msg();
}
- FromCompositorMsg::LogEntry(top_level_frame_id, thread_name, entry) => {
- self.handle_log_entry(top_level_frame_id, thread_name, entry);
+ FromCompositorMsg::LogEntry(top_level_browsing_context_id, thread_name, entry) => {
+ self.handle_log_entry(top_level_browsing_context_id, thread_name, entry);
}
FromCompositorMsg::SetWebVRThread(webvr_thread) => {
assert!(self.webvr_thread.is_none());
@@ -942,7 +955,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.handle_change_running_animations_state(pipeline_id, animation_state)
}
// Load a new page from a mouse click
- // If there is already a pending page (self.pending_frames), it will not be overridden;
+ // If there is already a pending page (self.pending_changes), it will not be overridden;
// However, if the id is not encompassed by another change, it will be.
FromScriptMsg::LoadUrl(source_id, load_data, replace) => {
debug!("constellation got URL load message from script");
@@ -978,9 +991,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
warn!("constellation got set final url message for dead pipeline");
}
}
- FromScriptMsg::PostMessage(frame_id, origin, data) => {
+ FromScriptMsg::PostMessage(browsing_context_id, origin, data) => {
debug!("constellation got postMessage message");
- self.handle_post_message_msg(frame_id, origin, data);
+ self.handle_post_message_msg(browsing_context_id, origin, data);
}
FromScriptMsg::MozBrowserEvent(parent_pipeline_id, pipeline_id, event) => {
debug!("constellation got mozbrowser event message");
@@ -1017,9 +1030,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
debug!("constellation got set visibility change complete message");
self.handle_visibility_change_complete(pipeline_id, visible);
}
- FromScriptMsg::RemoveIFrame(frame_id, sender) => {
+ FromScriptMsg::RemoveIFrame(browsing_context_id, sender) => {
debug!("constellation got remove iframe message");
- let removed_pipeline_ids = self.handle_remove_iframe_msg(frame_id);
+ let removed_pipeline_ids = self.handle_remove_iframe_msg(browsing_context_id);
if let Err(e) = sender.send(removed_pipeline_ids) {
warn!("Error replying to remove iframe ({})", e);
}
@@ -1074,8 +1087,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
FromScriptMsg::Exit => {
self.compositor_proxy.send(ToCompositorMsg::Exit);
}
- FromScriptMsg::LogEntry(top_level_frame_id, thread_name, entry) => {
- self.handle_log_entry(top_level_frame_id, thread_name, entry);
+ FromScriptMsg::LogEntry(top_level_browsing_context_id, thread_name, entry) => {
+ self.handle_log_entry(top_level_browsing_context_id, thread_name, entry);
}
FromScriptMsg::SetTitle(pipeline_id, title) => {
@@ -1089,10 +1102,10 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
FromScriptMsg::TouchEventProcessed(result) => {
self.compositor_proxy.send(ToCompositorMsg::TouchEventProcessed(result))
}
- FromScriptMsg::GetFrameId(pipeline_id, sender) => {
- let result = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.frame_id);
+ FromScriptMsg::GetBrowsingContextId(pipeline_id, sender) => {
+ let result = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.browsing_context_id);
if let Err(e) = sender.send(result) {
- warn!("Sending reply to get frame id failed ({:?}).", e);
+ warn!("Sending reply to get browsing context failed ({:?}).", e);
}
}
FromScriptMsg::GetParentInfo(pipeline_id, sender) => {
@@ -1128,9 +1141,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
// Layout sends new sizes for all subframes. This needs to be reflected by all
// frame trees in the navigation context containing the subframe.
- FromLayoutMsg::FrameSizes(iframe_sizes) => {
- debug!("constellation got frame size message");
- self.handle_frame_size_msg(iframe_sizes);
+ FromLayoutMsg::IFrameSizes(iframe_sizes) => {
+ debug!("constellation got iframe size message");
+ self.handle_iframe_size_msg(iframe_sizes);
}
FromLayoutMsg::SetCursor(cursor) => {
self.handle_set_cursor_msg(cursor)
@@ -1172,24 +1185,24 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.mem_profiler_chan.send(mem::ProfilerMsg::Exit);
- // TODO: exit before the root frame is initialized?
- debug!("Removing root frame.");
- let root_frame_id = self.root_frame_id;
- self.close_frame(root_frame_id, ExitPipelineMode::Normal);
+ // TODO: exit before the root browsing context is initialized?
+ debug!("Removing root browsing context.");
+ let root_browsing_context_id = self.root_browsing_context_id;
+ self.close_browsing_context(root_browsing_context_id, ExitPipelineMode::Normal);
- // Close any pending frames and pipelines
- while let Some(pending) = self.pending_frames.pop() {
- debug!("Removing pending frame {}.", pending.frame_id);
- self.close_frame(pending.frame_id, ExitPipelineMode::Normal);
+ // Close any pending changes and pipelines
+ while let Some(pending) = self.pending_changes.pop() {
+ debug!("Removing pending browsing context {}.", pending.browsing_context_id);
+ self.close_browsing_context(pending.browsing_context_id, ExitPipelineMode::Normal);
debug!("Removing pending pipeline {}.", pending.new_pipeline_id);
self.close_pipeline(pending.new_pipeline_id, DiscardBrowsingContext::Yes, ExitPipelineMode::Normal);
}
- // In case there are frames which weren't attached to the frame tree, we close them.
- let frame_ids: Vec<FrameId> = self.frames.keys().cloned().collect();
- for frame_id in frame_ids {
- debug!("Removing detached frame {}.", frame_id);
- self.close_frame(frame_id, ExitPipelineMode::Normal);
+ // In case there are browsing contexts which weren't attached, we close them.
+ let browsing_context_ids: Vec<BrowsingContextId> = self.browsing_contexts.keys().cloned().collect();
+ for browsing_context_id in browsing_context_ids {
+ debug!("Removing detached browsing context {}.", browsing_context_id);
+ self.close_browsing_context(browsing_context_id, ExitPipelineMode::Normal);
}
// In case there are pipelines which weren't attached to the pipeline tree, we close them.
@@ -1276,12 +1289,15 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
fn handle_send_error(&mut self, pipeline_id: PipelineId, err: IpcError) {
// Treat send error the same as receiving a panic message
debug!("Pipeline {:?} send error ({}).", pipeline_id, err);
- let top_level_frame_id = self.get_top_level_frame_for_pipeline(pipeline_id);
+ let top_level_browsing_context_id = self.get_top_level_browsing_context_for_pipeline(pipeline_id);
let reason = format!("Send failed ({})", err);
- self.handle_panic(top_level_frame_id, reason, None);
+ self.handle_panic(top_level_browsing_context_id, reason, None);
}
- fn handle_panic(&mut self, top_level_frame_id: FrameId, reason: String, backtrace: Option<String>) {
+ fn handle_panic(&mut self, top_level_browsing_context_id: BrowsingContextId,
+ reason: String,
+ backtrace: Option<String>)
+ {
if opts::get().hard_fail {
// It's quite difficult to make Servo exit cleanly if some threads have failed.
// Hard fail exists for test runners so we crash and that's good enough.
@@ -1289,15 +1305,15 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
process::exit(1);
}
- debug!("Panic handler for top-level frame {}: {}.", top_level_frame_id, reason);
+ debug!("Panic handler for top-level browsing context {}: {}.", top_level_browsing_context_id, reason);
// Notify the browser chrome that the pipeline has failed
- self.trigger_mozbrowsererror(top_level_frame_id, reason, backtrace);
+ self.trigger_mozbrowsererror(top_level_browsing_context_id, reason, backtrace);
let (window_size, pipeline_id) = {
- let frame = self.frames.get(&top_level_frame_id);
- let window_size = frame.and_then(|frame| frame.size);
- let pipeline_id = frame.map(|frame| frame.pipeline_id);
+ let browsing_context = self.browsing_contexts.get(&top_level_browsing_context_id);
+ let window_size = browsing_context.and_then(|browsing_context| browsing_context.size);
+ let pipeline_id = browsing_context.map(|browsing_context| browsing_context.pipeline_id);
(window_size, pipeline_id)
};
@@ -1308,7 +1324,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
(pipeline_url, parent_info)
};
- self.close_frame_children(top_level_frame_id, DiscardBrowsingContext::No, ExitPipelineMode::Force);
+ self.close_browsing_context_children(top_level_browsing_context_id,
+ DiscardBrowsingContext::No,
+ ExitPipelineMode::Force);
let failure_url = ServoUrl::parse("about:failure").expect("infallible");
@@ -1323,22 +1341,26 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let new_pipeline_id = PipelineId::new();
let load_data = LoadData::new(failure_url, None, None, None);
let sandbox = IFrameSandboxState::IFrameSandboxed;
- self.new_pipeline(new_pipeline_id, top_level_frame_id, parent_info,
+ self.new_pipeline(new_pipeline_id, top_level_browsing_context_id, parent_info,
window_size, load_data.clone(), sandbox, false);
- self.pending_frames.push(FrameChange {
- frame_id: top_level_frame_id,
+ self.pending_changes.push(SessionHistoryChange {
+ browsing_context_id: top_level_browsing_context_id,
new_pipeline_id: new_pipeline_id,
load_data: load_data,
replace_instant: None,
});
}
- fn handle_log_entry(&mut self, top_level_frame_id: Option<FrameId>, thread_name: Option<String>, entry: LogEntry) {
+ fn handle_log_entry(&mut self,
+ top_level_browsing_context_id: Option<BrowsingContextId>,
+ thread_name: Option<String>,
+ entry: LogEntry)
+ {
debug!("Received log entry {:?}.", entry);
+ let top_level_browsing_context_id = top_level_browsing_context_id.unwrap_or(self.root_browsing_context_id);
match entry {
LogEntry::Panic(reason, backtrace) => {
- let top_level_frame_id = top_level_frame_id.unwrap_or(self.root_frame_id);
- self.handle_panic(top_level_frame_id, reason, Some(backtrace));
+ self.handle_panic(top_level_browsing_context_id, reason, Some(backtrace));
},
LogEntry::Error(reason) | LogEntry::Warn(reason) => {
// VecDeque::truncate is unstable
@@ -1365,47 +1387,53 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
fn handle_init_load(&mut self, url: ServoUrl) {
let window_size = self.window_size.initial_viewport;
let root_pipeline_id = PipelineId::new();
- let root_frame_id = self.root_frame_id;
+ let root_browsing_context_id = self.root_browsing_context_id;
let load_data = LoadData::new(url.clone(), None, None, None);
let sandbox = IFrameSandboxState::IFrameUnsandboxed;
- self.new_pipeline(root_pipeline_id, root_frame_id, None, Some(window_size), load_data.clone(), sandbox, false);
+ self.new_pipeline(root_pipeline_id,
+ root_browsing_context_id,
+ None,
+ Some(window_size),
+ load_data.clone(),
+ sandbox,
+ false);
self.handle_load_start_msg(root_pipeline_id);
- self.pending_frames.push(FrameChange {
- frame_id: self.root_frame_id,
+ self.pending_changes.push(SessionHistoryChange {
+ browsing_context_id: self.root_browsing_context_id,
new_pipeline_id: root_pipeline_id,
load_data: load_data,
replace_instant: None,
});
}
- fn handle_frame_size_msg(&mut self,
- iframe_sizes: Vec<(FrameId, TypedSize2D<f32, CSSPixel>)>) {
- for (frame_id, size) in iframe_sizes {
+ fn handle_iframe_size_msg(&mut self,
+ iframe_sizes: Vec<(BrowsingContextId, TypedSize2D<f32, CSSPixel>)>) {
+ for (browsing_context_id, size) in iframe_sizes {
let window_size = WindowSizeData {
initial_viewport: size,
device_pixel_ratio: self.window_size.device_pixel_ratio,
};
- self.resize_frame(window_size, WindowSizeType::Initial, frame_id);
+ self.resize_frame(window_size, WindowSizeType::Initial, browsing_context_id);
}
}
fn handle_subframe_loaded(&mut self, pipeline_id: PipelineId) {
- let (frame_id, parent_id) = match self.pipelines.get(&pipeline_id) {
+ let (browsing_context_id, parent_id) = match self.pipelines.get(&pipeline_id) {
Some(pipeline) => match pipeline.parent_info {
- Some((parent_id, _)) => (pipeline.frame_id, parent_id),
+ Some((parent_id, _)) => (pipeline.browsing_context_id, parent_id),
None => return warn!("Pipeline {} has no parent.", pipeline_id),
},
None => return warn!("Pipeline {} loaded after closure.", pipeline_id),
};
- let msg = ConstellationControlMsg::DispatchFrameLoadEvent {
- target: frame_id,
+ let msg = ConstellationControlMsg::DispatchIFrameLoadEvent {
+ target: browsing_context_id,
parent: parent_id,
child: pipeline_id,
};
let result = match self.pipelines.get(&parent_id) {
Some(parent) => parent.event_loop.send(msg),
- None => return warn!("Parent {} frame loaded after closure.", parent_id),
+ None => return warn!("Parent {} browsing context loaded after closure.", parent_id),
};
if let Err(e) = result {
self.handle_send_error(parent_id, e);
@@ -1413,8 +1441,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
// The script thread associated with pipeline_id has loaded a URL in an iframe via script. This
- // will result in a new pipeline being spawned and a frame tree being added to
- // parent_pipeline_id's frame tree's children. This message is never the result of a
+ // will result in a new pipeline being spawned and a child being added to
+ // the parent pipeline. This message is never the result of a
// page navigation.
fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfoWithData) {
let (load_data, window_size, is_private) = {
@@ -1439,27 +1467,29 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let is_private = load_info.info.is_private || source_pipeline.is_private;
- let window_size = self.frames.get(&load_info.info.frame_id).and_then(|frame| frame.size);
+ let window_size = self.browsing_contexts.get(&load_info.info.browsing_context_id)
+ .and_then(|browsing_context| browsing_context.size);
(load_data, window_size, is_private)
};
let replace_instant = if load_info.info.replace {
- self.frames.get(&load_info.info.frame_id).map(|frame| frame.instant)
+ self.browsing_contexts.get(&load_info.info.browsing_context_id)
+ .map(|browsing_context| browsing_context.instant)
} else {
None
};
- // Create the new pipeline, attached to the parent and push to pending frames
- self.pending_frames.push(FrameChange {
- frame_id: load_info.info.frame_id,
+ // Create the new pipeline, attached to the parent and push to pending changes
+ self.pending_changes.push(SessionHistoryChange {
+ browsing_context_id: load_info.info.browsing_context_id,
new_pipeline_id: load_info.info.new_pipeline_id,
load_data: load_data.clone(),
replace_instant: replace_instant,
});
self.new_pipeline(load_info.info.new_pipeline_id,
- load_info.info.frame_id,
+ load_info.info.browsing_context_id,
Some((load_info.info.parent_pipeline_id, load_info.info.frame_type)),
window_size,
load_data,
@@ -1475,7 +1505,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
new_pipeline_id,
frame_type,
replace,
- frame_id,
+ browsing_context_id,
is_private,
} = load_info;
@@ -1490,7 +1520,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let script_sender = parent_pipeline.event_loop.clone();
Pipeline::new(new_pipeline_id,
- frame_id,
+ browsing_context_id,
Some((parent_pipeline_id, frame_type)),
script_sender,
layout_sender,
@@ -1504,7 +1534,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let load_data = LoadData::new(url, Some(parent_pipeline_id), None, None);
let replace_instant = if replace {
- self.frames.get(&frame_id).map(|frame| frame.instant)
+ self.browsing_contexts.get(&browsing_context_id).map(|browsing_context| browsing_context.instant)
} else {
None
};
@@ -1512,8 +1542,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
assert!(!self.pipelines.contains_key(&new_pipeline_id));
self.pipelines.insert(new_pipeline_id, pipeline);
- self.pending_frames.push(FrameChange {
- frame_id: frame_id,
+ self.pending_changes.push(SessionHistoryChange {
+ browsing_context_id: browsing_context_id,
new_pipeline_id: new_pipeline_id,
load_data: load_data,
replace_instant: replace_instant,
@@ -1566,13 +1596,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let title = String::from("Alert");
let return_value = String::from("");
let event = MozBrowserEvent::ShowModalPrompt(prompt_type, title, message, return_value);
- let top_level_frame_id = self.get_top_level_frame_for_pipeline(pipeline_id);
+ let top_level_browsing_context_id = self.get_top_level_browsing_context_for_pipeline(pipeline_id);
- match self.frames.get(&self.root_frame_id) {
- None => warn!("Alert sent after root frame closure."),
- Some(root_frame) => match self.pipelines.get(&root_frame.pipeline_id) {
+ match self.browsing_contexts.get(&self.root_browsing_context_id) {
+ None => warn!("Alert sent after root browsing context closure."),
+ Some(root_browsing_context) => match self.pipelines.get(&root_browsing_context.pipeline_id) {
None => warn!("Alert sent after root pipeline closure."),
- Some(root_pipeline) => root_pipeline.trigger_mozbrowser_event(Some(top_level_frame_id), event),
+ Some(pipeline) => pipeline.trigger_mozbrowser_event(Some(top_level_browsing_context_id), event),
}
}
}
@@ -1602,8 +1632,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// requested change so it can update its internal state.
//
// If replace is true, the current entry is replaced instead of a new entry being added.
- let (frame_id, parent_info) = match self.pipelines.get(&source_id) {
- Some(pipeline) => (pipeline.frame_id, pipeline.parent_info),
+ let (browsing_context_id, parent_info) = match self.pipelines.get(&source_id) {
+ Some(pipeline) => (pipeline.browsing_context_id, pipeline.parent_info),
None => {
warn!("Pipeline {:?} loaded after closure.", source_id);
return None;
@@ -1614,7 +1644,10 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.handle_load_start_msg(source_id);
// Message the constellation to find the script thread for this iframe
// and issue an iframe load through there.
- let msg = ConstellationControlMsg::Navigate(parent_pipeline_id, frame_id, load_data, replace);
+ let msg = ConstellationControlMsg::Navigate(parent_pipeline_id,
+ browsing_context_id,
+ load_data,
+ replace);
let result = match self.pipelines.get(&parent_pipeline_id) {
Some(parent_pipeline) => parent_pipeline.event_loop.send(msg),
None => {
@@ -1628,17 +1661,17 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
Some(source_id)
}
None => {
- let root_frame_id = self.root_frame_id;
+ let root_browsing_context_id = self.root_browsing_context_id;
// Make sure no pending page would be overridden.
- for frame_change in &self.pending_frames {
- if frame_change.frame_id == root_frame_id {
+ for change in &self.pending_changes {
+ if change.browsing_context_id == root_browsing_context_id {
// id that sent load msg is being changed already; abort
return None;
}
}
- if !self.pipeline_is_in_current_frame(source_id) {
+ if self.get_activity(source_id) == DocumentActivity::Inactive {
// Disregard this load if the navigating pipeline is not actually
// active. This could be caused by a delayed navigation (eg. from
// a timer) or a race between multiple navigations (such as an
@@ -1647,26 +1680,32 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
self.handle_load_start_msg(source_id);
- // Being here means either there are no pending frames, or none of the pending
+ // Being here means either there are no pending changes, or none of the pending
// changes would be overridden by changing the subframe associated with source_id.
// Create the new pipeline
- let window_size = self.frames.get(&root_frame_id).and_then(|frame| frame.size);
+ let window_size = self.browsing_contexts.get(&root_browsing_context_id)
+ .and_then(|browsing_context| browsing_context.size);
let new_pipeline_id = PipelineId::new();
let sandbox = IFrameSandboxState::IFrameUnsandboxed;
let replace_instant = if replace {
- self.frames.get(&frame_id).map(|frame| frame.instant)
+ self.browsing_contexts.get(&browsing_context_id).map(|browsing_context| browsing_context.instant)
} else {
None
};
- self.pending_frames.push(FrameChange {
- frame_id: root_frame_id,
+ self.pending_changes.push(SessionHistoryChange {
+ browsing_context_id: root_browsing_context_id,
new_pipeline_id: new_pipeline_id,
load_data: load_data.clone(),
replace_instant: replace_instant,
});
- self.new_pipeline(new_pipeline_id, root_frame_id, None, window_size, load_data, sandbox, false);
-
+ self.new_pipeline(new_pipeline_id,
+ root_browsing_context_id,
+ None,
+ window_size,
+ load_data,
+ sandbox,
+ false);
Some(new_pipeline_id)
}
}
@@ -1695,27 +1734,27 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
fn handle_traverse_history_msg(&mut self,
pipeline_id: Option<PipelineId>,
direction: TraversalDirection) {
- let top_level_frame_id = pipeline_id
- .map(|pipeline_id| self.get_top_level_frame_for_pipeline(pipeline_id))
- .unwrap_or(self.root_frame_id);
+ let top_level_browsing_context_id = pipeline_id
+ .map(|pipeline_id| self.get_top_level_browsing_context_for_pipeline(pipeline_id))
+ .unwrap_or(self.root_browsing_context_id);
let mut size = 0;
let mut table = HashMap::new();
match direction {
TraversalDirection::Forward(delta) => {
- for entry in self.joint_session_future(top_level_frame_id).take(delta) {
+ for entry in self.joint_session_future(top_level_browsing_context_id).take(delta) {
size = size + 1;
- table.insert(entry.frame_id, entry.clone());
+ table.insert(entry.browsing_context_id, entry.clone());
}
if size < delta {
return debug!("Traversing forward too much.");
}
},
TraversalDirection::Back(delta) => {
- for entry in self.joint_session_past(top_level_frame_id).take(delta) {
+ for entry in self.joint_session_past(top_level_browsing_context_id).take(delta) {
size = size + 1;
- table.insert(entry.frame_id, entry.clone());
+ table.insert(entry.browsing_context_id, entry.clone());
}
if size < delta {
return debug!("Traversing back too much.");
@@ -1729,23 +1768,23 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
fn handle_joint_session_history_length(&self, pipeline_id: PipelineId, sender: IpcSender<u32>) {
- let frame_id = self.get_top_level_frame_for_pipeline(pipeline_id);
+ let browsing_context_id = self.get_top_level_browsing_context_for_pipeline(pipeline_id);
// Initialize length at 1 to count for the current active entry
let mut length = 1;
- for frame in self.full_frame_tree_iter(frame_id) {
- length += frame.next.len();
- length += frame.prev.len();
+ for browsing_context in self.all_browsing_contexts_iter(browsing_context_id) {
+ length += browsing_context.next.len();
+ length += browsing_context.prev.len();
}
let _ = sender.send(length as u32);
}
fn handle_key_msg(&mut self, ch: Option<char>, key: Key, state: KeyState, mods: KeyModifiers) {
// Send to the explicitly focused pipeline (if it exists), or the root
- // frame's current pipeline. If neither exist, fall back to sending to
+ // browsing context's current pipeline. If neither exist, fall back to sending to
// the compositor below.
- let root_pipeline_id = self.frames.get(&self.root_frame_id)
- .map(|root_frame| root_frame.pipeline_id);
+ let root_pipeline_id = self.browsing_contexts.get(&self.root_browsing_context_id)
+ .map(|root_browsing_context| root_browsing_context.pipeline_id);
let pipeline_id = self.focus_pipeline_id.or(root_pipeline_id);
match pipeline_id {
@@ -1769,8 +1808,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
fn handle_reload_msg(&mut self) {
// Send Reload constellation msg to root script channel.
- let root_pipeline_id = self.frames.get(&self.root_frame_id)
- .map(|root_frame| root_frame.pipeline_id);
+ let root_pipeline_id = self.browsing_contexts.get(&self.root_browsing_context_id)
+ .map(|root_browsing_context| root_browsing_context.pipeline_id);
if let Some(pipeline_id) = root_pipeline_id {
let msg = ConstellationControlMsg::Reload(pipeline_id);
@@ -1794,10 +1833,14 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
- fn handle_post_message_msg(&mut self, frame_id: FrameId, origin: Option<ImmutableOrigin>, data: Vec<u8>) {
- let pipeline_id = match self.frames.get(&frame_id) {
- None => return warn!("postMessage to closed frame {}.", frame_id),
- Some(frame) => frame.pipeline_id,
+ fn handle_post_message_msg(&mut self,
+ browsing_context_id: BrowsingContextId,
+ origin: Option<ImmutableOrigin>,
+ data: Vec<u8>)
+ {
+ let pipeline_id = match self.browsing_contexts.get(&browsing_context_id) {
+ None => return warn!("postMessage to closed browsing_context {}.", browsing_context_id),
+ Some(browsing_context) => browsing_context.pipeline_id,
};
let msg = ConstellationControlMsg::PostMessage(pipeline_id, origin, data);
let result = match self.pipelines.get(&pipeline_id) {
@@ -1819,20 +1862,21 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// and pass the event to that script thread.
// If the pipeline lookup fails, it is because we have torn down the pipeline,
// so it is reasonable to silently ignore the event.
- let frame_id = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.frame_id);
+ let browsing_context_id = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.browsing_context_id);
match self.pipelines.get(&parent_pipeline_id) {
- Some(pipeline) => pipeline.trigger_mozbrowser_event(frame_id, event),
+ Some(pipeline) => pipeline.trigger_mozbrowser_event(browsing_context_id, event),
None => warn!("Pipeline {:?} handling mozbrowser event after closure.", parent_pipeline_id),
}
}
- fn handle_get_pipeline(&mut self, frame_id: Option<FrameId>,
+ fn handle_get_pipeline(&mut self,
+ browsing_context_id: Option<BrowsingContextId>,
resp_chan: IpcSender<Option<PipelineId>>) {
- let frame_id = frame_id.unwrap_or(self.root_frame_id);
- let current_pipeline_id = self.frames.get(&frame_id)
- .map(|frame| frame.pipeline_id);
- let pipeline_id_loaded = self.pending_frames.iter().rev()
- .find(|x| x.frame_id == frame_id)
+ let browsing_context_id = browsing_context_id.unwrap_or(self.root_browsing_context_id);
+ let current_pipeline_id = self.browsing_contexts.get(&browsing_context_id)
+ .map(|browsing_context| browsing_context.pipeline_id);
+ let pipeline_id_loaded = self.pending_changes.iter().rev()
+ .find(|x| x.browsing_context_id == browsing_context_id)
.map(|x| x.new_pipeline_id)
.or(current_pipeline_id);
if let Err(e) = resp_chan.send(pipeline_id_loaded) {
@@ -1840,18 +1884,18 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
- fn handle_get_frame(&mut self,
- pipeline_id: PipelineId,
- resp_chan: IpcSender<Option<FrameId>>) {
- let frame_id = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.frame_id);
- if let Err(e) = resp_chan.send(frame_id) {
- warn!("Failed get_frame response ({}).", e);
+ fn handle_get_browsing_context(&mut self,
+ pipeline_id: PipelineId,
+ resp_chan: IpcSender<Option<BrowsingContextId>>) {
+ let browsing_context_id = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.browsing_context_id);
+ if let Err(e) = resp_chan.send(browsing_context_id) {
+ warn!("Failed get_browsing_context response ({}).", e);
}
}
fn focus_parent_pipeline(&mut self, pipeline_id: PipelineId) {
- let (frame_id, parent_info) = match self.pipelines.get(&pipeline_id) {
- Some(pipeline) => (pipeline.frame_id, pipeline.parent_info),
+ let (browsing_context_id, parent_info) = match self.pipelines.get(&pipeline_id) {
+ Some(pipeline) => (pipeline.browsing_context_id, pipeline.parent_info),
None => return warn!("Pipeline {:?} focus parent after closure.", pipeline_id),
};
let (parent_pipeline_id, _) = match parent_info {
@@ -1861,7 +1905,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// Send a message to the parent of the provided pipeline (if it exists)
// telling it to mark the iframe element as focused.
- let msg = ConstellationControlMsg::FocusIFrame(parent_pipeline_id, frame_id);
+ let msg = ConstellationControlMsg::FocusIFrame(parent_pipeline_id, browsing_context_id);
let result = match self.pipelines.get(&parent_pipeline_id) {
Some(pipeline) => pipeline.event_loop.send(msg),
None => return warn!("Pipeline {:?} focus after closure.", parent_pipeline_id),
@@ -1879,26 +1923,26 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.focus_parent_pipeline(pipeline_id);
}
- fn handle_remove_iframe_msg(&mut self, frame_id: FrameId) -> Vec<PipelineId> {
- let result = self.full_frame_tree_iter(frame_id)
- .flat_map(|frame| frame.next.iter().chain(frame.prev.iter())
+ fn handle_remove_iframe_msg(&mut self, browsing_context_id: BrowsingContextId) -> Vec<PipelineId> {
+ let result = self.all_browsing_contexts_iter(browsing_context_id)
+ .flat_map(|browsing_context| browsing_context.next.iter().chain(browsing_context.prev.iter())
.filter_map(|entry| entry.pipeline_id)
- .chain(once(frame.pipeline_id)))
+ .chain(once(browsing_context.pipeline_id)))
.collect();
- self.close_frame(frame_id, ExitPipelineMode::Normal);
+ self.close_browsing_context(browsing_context_id, ExitPipelineMode::Normal);
result
}
fn handle_set_visible_msg(&mut self, pipeline_id: PipelineId, visible: bool) {
- let frame_id = match self.pipelines.get(&pipeline_id) {
- Some(pipeline) => pipeline.frame_id,
- None => return warn!("No frame associated with pipeline {:?}", pipeline_id),
+ let browsing_context_id = match self.pipelines.get(&pipeline_id) {
+ Some(pipeline) => pipeline.browsing_context_id,
+ None => return warn!("No browsing context associated with pipeline {:?}", pipeline_id),
};
- let child_pipeline_ids: Vec<PipelineId> = self.full_frame_tree_iter(frame_id)
- .flat_map(|frame| frame.prev.iter().chain(frame.next.iter())
+ let child_pipeline_ids: Vec<PipelineId> = self.all_browsing_contexts_iter(browsing_context_id)
+ .flat_map(|browsing_context| browsing_context.prev.iter().chain(browsing_context.next.iter())
.filter_map(|entry| entry.pipeline_id)
- .chain(once(frame.pipeline_id)))
+ .chain(once(browsing_context.pipeline_id)))
.collect();
for id in child_pipeline_ids {
@@ -1909,13 +1953,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
fn handle_visibility_change_complete(&mut self, pipeline_id: PipelineId, visibility: bool) {
- let (frame_id, parent_pipeline_info) = match self.pipelines.get(&pipeline_id) {
+ let (browsing_context_id, parent_pipeline_info) = match self.pipelines.get(&pipeline_id) {
None => return warn!("Visibity change for closed pipeline {:?}.", pipeline_id),
- Some(pipeline) => (pipeline.frame_id, pipeline.parent_info),
+ Some(pipeline) => (pipeline.browsing_context_id, pipeline.parent_info),
};
if let Some((parent_pipeline_id, _)) = parent_pipeline_info {
let visibility_msg = ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id,
- frame_id,
+ browsing_context_id,
visibility);
let result = match self.pipelines.get(&parent_pipeline_id) {
None => return warn!("Parent pipeline {:?} closed", parent_pipeline_id),
@@ -1998,8 +2042,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
},
WebDriverCommandMsg::TakeScreenshot(pipeline_id, reply) => {
- let current_pipeline_id = self.frames.get(&self.root_frame_id)
- .map(|root_frame| root_frame.pipeline_id);
+ let current_pipeline_id = self.browsing_contexts.get(&self.root_browsing_context_id)
+ .map(|root_browsing_context| root_browsing_context.pipeline_id);
if Some(pipeline_id) == current_pipeline_id {
self.compositor_proxy.send(ToCompositorMsg::CreatePng(reply));
} else {
@@ -2012,9 +2056,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
// https://html.spec.whatwg.org/multipage/#traverse-the-history
- fn traverse_to_entry(&mut self, entry: FrameState) {
+ fn traverse_to_entry(&mut self, entry: SessionHistoryEntry) {
// Step 1.
- let frame_id = entry.frame_id;
+ let browsing_context_id = entry.browsing_context_id;
let pipeline_id = match entry.pipeline_id {
Some(pipeline_id) => pipeline_id,
None => {
@@ -2022,22 +2066,22 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// entry has been discarded, so we navigate to the entry
// URL instead. When the document has activated, it will
// traverse to the entry, but with the new pipeline id.
- debug!("Reloading document {} for frame {}.", entry.load_data.url, entry.frame_id);
+ debug!("Reloading document {} in browsing context {}.", entry.load_data.url, entry.browsing_context_id);
// TODO: save the sandbox state so it can be restored here.
let sandbox = IFrameSandboxState::IFrameUnsandboxed;
let new_pipeline_id = PipelineId::new();
let load_data = entry.load_data;
- let (parent_info, window_size, is_private) = match self.frames.get(&frame_id) {
- Some(frame) => match self.pipelines.get(&frame.pipeline_id) {
- Some(pipeline) => (pipeline.parent_info, frame.size, pipeline.is_private),
- None => (None, frame.size, false),
+ let (parent_info, window_size, is_private) = match self.browsing_contexts.get(&browsing_context_id) {
+ Some(browsing_context) => match self.pipelines.get(&browsing_context.pipeline_id) {
+ Some(pipeline) => (pipeline.parent_info, browsing_context.size, pipeline.is_private),
+ None => (None, browsing_context.size, false),
},
- None => return warn!("no frame to traverse"),
+ None => return warn!("no browsing context to traverse"),
};
- self.new_pipeline(new_pipeline_id, frame_id, parent_info,
+ self.new_pipeline(new_pipeline_id, browsing_context_id, parent_info,
window_size, load_data.clone(), sandbox, is_private);
- self.pending_frames.push(FrameChange {
- frame_id: frame_id,
+ self.pending_changes.push(SessionHistoryChange {
+ browsing_context_id: browsing_context_id,
new_pipeline_id: new_pipeline_id,
load_data: load_data,
replace_instant: Some(entry.instant),
@@ -2049,24 +2093,24 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// Check if the currently focused pipeline is the pipeline being replaced
// (or a child of it). This has to be done here, before the current
// frame tree is modified below.
- let update_focus_pipeline = self.focused_pipeline_in_tree(entry.frame_id);
+ let update_focus_pipeline = self.focused_pipeline_is_descendant_of(entry.browsing_context_id);
- let (old_pipeline_id, replaced_pipeline_id) = match self.frames.get_mut(&frame_id) {
- Some(frame) => {
- let old_pipeline_id = frame.pipeline_id;
- let mut curr_entry = frame.current();
+ let (old_pipeline_id, replaced_pipeline_id) = match self.browsing_contexts.get_mut(&browsing_context_id) {
+ Some(browsing_context) => {
+ let old_pipeline_id = browsing_context.pipeline_id;
+ let mut curr_entry = browsing_context.current();
- if entry.instant > frame.instant {
+ if entry.instant > browsing_context.instant {
// We are traversing to the future.
- while let Some(next) = frame.next.pop() {
- frame.prev.push(curr_entry);
+ while let Some(next) = browsing_context.next.pop() {
+ browsing_context.prev.push(curr_entry);
curr_entry = next;
if entry.instant <= curr_entry.instant { break; }
}
- } else if entry.instant < frame.instant {
+ } else if entry.instant < browsing_context.instant {
// We are traversing to the past.
- while let Some(prev) = frame.prev.pop() {
- frame.next.push(curr_entry);
+ while let Some(prev) = browsing_context.prev.pop() {
+ browsing_context.next.push(curr_entry);
curr_entry = prev;
if entry.instant >= curr_entry.instant { break; }
}
@@ -2076,11 +2120,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let replaced_pipeline_id = curr_entry.pipeline_id;
- frame.update_current(pipeline_id, entry);
+ browsing_context.update_current(pipeline_id, entry);
(old_pipeline_id, replaced_pipeline_id)
},
- None => return warn!("no frame to traverse"),
+ None => return warn!("no browsing context to traverse"),
};
let parent_info = self.pipelines.get(&old_pipeline_id)
@@ -2112,7 +2156,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// This makes things like contentDocument work correctly.
if let Some((parent_pipeline_id, _)) = parent_info {
let msg = ConstellationControlMsg::UpdatePipelineId(parent_pipeline_id,
- frame_id, pipeline_id, UpdatePipelineIdReason::Traversal);
+ browsing_context_id, pipeline_id, UpdatePipelineIdReason::Traversal);
let result = match self.pipelines.get(&parent_pipeline_id) {
None => return warn!("Pipeline {:?} child traversed after closure.", parent_pipeline_id),
Some(pipeline) => pipeline.event_loop.send(msg),
@@ -2133,17 +2177,17 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// the current entry and the future entries.
// LoadData of inner frames are ignored and replaced with the LoadData of the parent.
- let top_level_frame_id = self.get_top_level_frame_for_pipeline(pipeline_id);
+ let top_level_browsing_context_id = self.get_top_level_browsing_context_for_pipeline(pipeline_id);
- // Ignore LoadData of non-top-level frames.
- let keep_load_data_if_top_frame = |state: &FrameState| {
- match state.pipeline_id {
- None => Some(state.load_data.clone()),
+ // Ignore LoadData of non-top-level browsing contexts.
+ let keep_load_data_if_top_browsing_context = |entry: &SessionHistoryEntry| {
+ match entry.pipeline_id {
+ None => Some(entry.load_data.clone()),
Some(pipeline_id) => {
match self.pipelines.get(&pipeline_id) {
- None => Some(state.load_data.clone()),
+ None => Some(entry.load_data.clone()),
Some(pipeline) => match pipeline.parent_info {
- None => Some(state.load_data.clone()),
+ None => Some(entry.load_data.clone()),
Some(_) => None,
}
}
@@ -2151,8 +2195,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
};
- // If LoadData was ignored, use the LoadData of the previous FrameState, which
- // is the LoadData of the parent frame.
+ // If LoadData was ignored, use the LoadData of the previous SessionHistoryEntry, which
+ // is the LoadData of the parent browsing context.
let resolve_load_data = |previous_load_data: &mut LoadData, load_data| {
let load_data = match load_data {
None => previous_load_data.clone(),
@@ -2162,13 +2206,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
Some(load_data)
};
- let current_load_data = match self.frames.get(&top_level_frame_id) {
- Some(frame) => frame.load_data.clone(),
- None => return warn!("notify_history_changed error after top-level frame closed."),
+ let current_load_data = match self.browsing_contexts.get(&top_level_browsing_context_id) {
+ Some(browsing_context) => browsing_context.load_data.clone(),
+ None => return warn!("notify_history_changed error after top-level browsing context closed."),
};
- let mut entries: Vec<LoadData> = self.joint_session_past(top_level_frame_id)
- .map(&keep_load_data_if_top_frame)
+ let mut entries: Vec<LoadData> = self.joint_session_past(top_level_browsing_context_id)
+ .map(&keep_load_data_if_top_browsing_context)
.scan(current_load_data.clone(), &resolve_load_data)
.collect();
@@ -2178,31 +2222,31 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
entries.push(current_load_data.clone());
- entries.extend(self.joint_session_future(top_level_frame_id)
- .map(&keep_load_data_if_top_frame)
+ entries.extend(self.joint_session_future(top_level_browsing_context_id)
+ .map(&keep_load_data_if_top_browsing_context)
.scan(current_load_data.clone(), &resolve_load_data));
self.compositor_proxy.send(ToCompositorMsg::HistoryChanged(entries, current_index));
}
- fn get_top_level_frame_for_pipeline(&self, mut pipeline_id: PipelineId) -> FrameId {
+ fn get_top_level_browsing_context_for_pipeline(&self, mut pipeline_id: PipelineId) -> BrowsingContextId {
if PREFS.is_mozbrowser_enabled() {
loop {
match self.pipelines.get(&pipeline_id) {
Some(pipeline) => match pipeline.parent_info {
- Some((_, FrameType::MozBrowserIFrame)) => return pipeline.frame_id,
+ Some((_, FrameType::MozBrowserIFrame)) => return pipeline.browsing_context_id,
Some((parent_id, _)) => pipeline_id = parent_id,
- None => return self.root_frame_id,
+ None => return self.root_browsing_context_id,
},
None => {
warn!("Finding top-level ancestor for pipeline {} after closure.", pipeline_id);
- return self.root_frame_id;
+ return self.root_browsing_context_id;
},
}
}
} else {
- // If mozbrowser is not enabled, the root frame is the only top-level frame
- self.root_frame_id
+ // If mozbrowser is not enabled, the root browsing context is the only top-level browsing context
+ self.root_browsing_context_id
}
}
@@ -2217,37 +2261,37 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
- fn add_or_replace_pipeline_in_frame_tree(&mut self, frame_change: FrameChange) {
- debug!("Setting frame {} to be pipeline {}.", frame_change.frame_id, frame_change.new_pipeline_id);
+ fn change_session_history(&mut self, change: SessionHistoryChange) {
+ debug!("Setting browsing context {} to be pipeline {}.", change.browsing_context_id, change.new_pipeline_id);
// If the currently focused pipeline is the one being changed (or a child
// of the pipeline being changed) then update the focus pipeline to be
// the replacement.
- if self.focused_pipeline_in_tree(frame_change.frame_id) {
- self.focus_pipeline_id = Some(frame_change.new_pipeline_id);
+ if self.focused_pipeline_is_descendant_of(change.browsing_context_id) {
+ self.focus_pipeline_id = Some(change.new_pipeline_id);
}
- let (evicted_id, new_frame, navigated, location_changed) = if let Some(instant) = frame_change.replace_instant {
- debug!("Replacing pipeline in existing frame with timestamp {:?}.", instant);
- let entry = FrameState {
- frame_id: frame_change.frame_id,
- pipeline_id: Some(frame_change.new_pipeline_id),
- load_data: frame_change.load_data.clone(),
+ let (evicted_id, new_context, navigated, location_changed) = if let Some(instant) = change.replace_instant {
+ debug!("Replacing pipeline in existing browsing context with timestamp {:?}.", instant);
+ let entry = SessionHistoryEntry {
+ browsing_context_id: change.browsing_context_id,
+ pipeline_id: Some(change.new_pipeline_id),
+ load_data: change.load_data.clone(),
instant: instant,
};
self.traverse_to_entry(entry);
(None, false, None, false)
- } else if let Some(frame) = self.frames.get_mut(&frame_change.frame_id) {
- debug!("Adding pipeline to existing frame.");
- let old_pipeline_id = frame.pipeline_id;
- frame.load(frame_change.new_pipeline_id, frame_change.load_data.clone());
- let evicted_id = frame.prev.len()
+ } else if let Some(browsing_context) = self.browsing_contexts.get_mut(&change.browsing_context_id) {
+ debug!("Adding pipeline to existing browsing context.");
+ let old_pipeline_id = browsing_context.pipeline_id;
+ browsing_context.load(change.new_pipeline_id, change.load_data.clone());
+ let evicted_id = browsing_context.prev.len()
.checked_sub(PREFS.get("session-history.max-length").as_u64().unwrap_or(20) as usize)
- .and_then(|index| frame.prev.get_mut(index))
+ .and_then(|index| browsing_context.prev.get_mut(index))
.and_then(|entry| entry.pipeline_id.take());
(evicted_id, false, Some(old_pipeline_id), true)
} else {
- debug!("Adding pipeline to new frame.");
+ debug!("Adding pipeline to new browsing context.");
(None, true, None, true)
};
@@ -2255,26 +2299,26 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.close_pipeline(evicted_id, DiscardBrowsingContext::No, ExitPipelineMode::Normal);
}
- if new_frame {
- self.new_frame(frame_change.frame_id,
- frame_change.new_pipeline_id,
- frame_change.load_data);
- self.update_activity(frame_change.new_pipeline_id);
- self.notify_history_changed(frame_change.new_pipeline_id);
+ if new_context {
+ self.new_browsing_context(change.browsing_context_id,
+ change.new_pipeline_id,
+ change.load_data);
+ self.update_activity(change.new_pipeline_id);
+ self.notify_history_changed(change.new_pipeline_id);
};
if let Some(old_pipeline_id) = navigated {
// Deactivate the old pipeline, and activate the new one.
self.update_activity(old_pipeline_id);
- self.update_activity(frame_change.new_pipeline_id);
+ self.update_activity(change.new_pipeline_id);
// Clear the joint session future
- let top_level_frame_id = self.get_top_level_frame_for_pipeline(frame_change.new_pipeline_id);
- self.clear_joint_session_future(top_level_frame_id);
- self.notify_history_changed(frame_change.new_pipeline_id);
+ let top_level_id = self.get_top_level_browsing_context_for_pipeline(change.new_pipeline_id);
+ self.clear_joint_session_future(top_level_id);
+ self.notify_history_changed(change.new_pipeline_id);
}
if location_changed {
- self.trigger_mozbrowserlocationchange(frame_change.new_pipeline_id);
+ self.trigger_mozbrowserlocationchange(change.new_pipeline_id);
}
// Build frame tree
@@ -2289,22 +2333,22 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
if let Some((parent_pipeline_id, _)) = pipeline.parent_info {
if let Some(parent_pipeline) = self.pipelines.get(&parent_pipeline_id) {
let msg = ConstellationControlMsg::UpdatePipelineId(parent_pipeline_id,
- pipeline.frame_id, pipeline_id, UpdatePipelineIdReason::Navigation);
+ pipeline.browsing_context_id, pipeline_id, UpdatePipelineIdReason::Navigation);
let _ = parent_pipeline.event_loop.send(msg);
}
}
}
- // Find the pending frame change whose new pipeline id is pipeline_id.
- let pending_index = self.pending_frames.iter().rposition(|frame_change| {
- frame_change.new_pipeline_id == pipeline_id
+ // Find the pending change whose new pipeline id is pipeline_id.
+ let pending_index = self.pending_changes.iter().rposition(|change| {
+ change.new_pipeline_id == pipeline_id
});
- // If it is found, remove it from the pending frames, and make it
+ // If it is found, remove it from the pending changes, and make it
// the active document of its frame.
if let Some(pending_index) = pending_index {
- let frame_change = self.pending_frames.swap_remove(pending_index);
- self.add_or_replace_pipeline_in_frame_tree(frame_change);
+ let change = self.pending_changes.swap_remove(pending_index);
+ self.change_session_history(change);
}
}
@@ -2312,8 +2356,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
fn handle_window_size_msg(&mut self, new_size: WindowSizeData, size_type: WindowSizeType) {
debug!("handle_window_size_msg: {:?}", new_size.initial_viewport.to_untyped());
- let frame_id = self.root_frame_id;
- self.resize_frame(new_size, size_type, frame_id);
+ let browsing_context_id = self.root_browsing_context_id;
+ self.resize_frame(new_size, size_type, browsing_context_id);
if let Some(resize_channel) = self.webdriver.resize_channel.take() {
let _ = resize_channel.send(new_size);
@@ -2340,28 +2384,28 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// avoiding this panic would require a mechanism for dealing
// with low-resource scenarios.
//
- // If there is no root frame yet, the initial page has
+ // If there is no root browsing context yet, the initial page has
// not loaded, so there is nothing to save yet.
- if !self.frames.contains_key(&self.root_frame_id) {
- return ReadyToSave::NoRootFrame;
+ if !self.browsing_contexts.contains_key(&self.root_browsing_context_id) {
+ return ReadyToSave::NoRootBrowsingContext;
}
// If there are pending loads, wait for those to complete.
- if !self.pending_frames.is_empty() {
- return ReadyToSave::PendingFrames;
+ if !self.pending_changes.is_empty() {
+ return ReadyToSave::PendingChanges;
}
let (state_sender, state_receiver) = ipc::channel().expect("Failed to create IPC channel!");
let (epoch_sender, epoch_receiver) = ipc::channel().expect("Failed to create IPC channel!");
- // Step through the current frame tree, checking that the script
+ // Step through the fully active browsing contexts, checking that the script
// thread is idle, and that the current epoch of the layout thread
// matches what the compositor has painted. If all these conditions
// are met, then the output image should not change and a reftest
// screenshot can safely be written.
- for frame in self.current_frame_tree_iter(self.root_frame_id) {
- let pipeline_id = frame.pipeline_id;
- debug!("Checking readiness of frame {}, pipeline {}.", frame.id, pipeline_id);
+ for browsing_context in self.fully_active_browsing_contexts_iter(self.root_browsing_context_id) {
+ let pipeline_id = browsing_context.pipeline_id;
+ debug!("Checking readiness of browsing context {}, pipeline {}.", browsing_context.id, pipeline_id);
let pipeline = match self.pipelines.get(&pipeline_id) {
None => {
@@ -2388,7 +2432,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
// See if this pipeline has reached idle script state yet.
- match self.document_states.get(&frame.pipeline_id) {
+ match self.document_states.get(&browsing_context.pipeline_id) {
Some(&DocumentState::Idle) => {}
Some(&DocumentState::Pending) | None => {
return ReadyToSave::DocumentLoading;
@@ -2399,7 +2443,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// size for the pipeline, then its painting should be up to date. If the constellation
// *hasn't* received a size, it could be that the layer was hidden by script before the
// compositor discovered it, so we just don't check the layer.
- if let Some(size) = frame.size {
+ if let Some(size) = browsing_context.size {
// If the rectangle for this pipeline is zero sized, it will
// never be painted. In this case, don't query the layout
// thread as it won't contribute to the final output image.
@@ -2408,7 +2452,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
// Get the epoch that the compositor has drawn for this pipeline.
- let compositor_epoch = pipeline_states.get(&frame.pipeline_id);
+ let compositor_epoch = pipeline_states.get(&browsing_context.pipeline_id);
match compositor_epoch {
Some(compositor_epoch) => {
// Synchronously query the layout thread to see if the current
@@ -2444,8 +2488,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let mut ancestor_id = pipeline_id;
loop {
if let Some(ancestor) = self.pipelines.get(&ancestor_id) {
- if let Some(frame) = self.frames.get(&ancestor.frame_id) {
- if frame.pipeline_id == ancestor_id {
+ if let Some(browsing_context) = self.browsing_contexts.get(&ancestor.browsing_context_id) {
+ if browsing_context.pipeline_id == ancestor_id {
if let Some((parent_id, FrameType::IFrame)) = ancestor.parent_info {
ancestor_id = parent_id;
continue;
@@ -2474,7 +2518,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
activity
};
for child_id in &pipeline.children {
- if let Some(child) = self.frames.get(child_id) {
+ if let Some(child) = self.browsing_contexts.get(child_id) {
self.set_activity(child.pipeline_id, child_activity);
}
}
@@ -2488,15 +2532,19 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
/// Handle updating the size of a frame. This notifies every pipeline in the frame of the new
/// size.
- fn resize_frame(&mut self, new_size: WindowSizeData, size_type: WindowSizeType, frame_id: FrameId) {
- if let Some(frame) = self.frames.get_mut(&frame_id) {
- frame.size = Some(new_size.initial_viewport);
+ fn resize_frame(&mut self,
+ new_size: WindowSizeData,
+ size_type: WindowSizeType,
+ browsing_context_id: BrowsingContextId)
+ {
+ if let Some(browsing_context) = self.browsing_contexts.get_mut(&browsing_context_id) {
+ browsing_context.size = Some(new_size.initial_viewport);
}
- if let Some(frame) = self.frames.get(&frame_id) {
+ if let Some(browsing_context) = self.browsing_contexts.get(&browsing_context_id) {
// Send Resize (or ResizeInactive) messages to each
// pipeline in the frame tree.
- let pipeline_id = frame.pipeline_id;
+ let pipeline_id = browsing_context.pipeline_id;
let pipeline = match self.pipelines.get(&pipeline_id) {
None => return warn!("Pipeline {:?} resized after closing.", pipeline_id),
Some(pipeline) => pipeline,
@@ -2506,7 +2554,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
new_size,
size_type
));
- let pipelines = frame.prev.iter().chain(frame.next.iter())
+ let pipelines = browsing_context.prev.iter().chain(browsing_context.next.iter())
.filter_map(|entry| entry.pipeline_id)
.filter_map(|pipeline_id| self.pipelines.get(&pipeline_id));
for pipeline in pipelines {
@@ -2518,13 +2566,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
// Send resize message to any pending pipelines that aren't loaded yet.
- for pending_frame in &self.pending_frames {
- let pipeline_id = pending_frame.new_pipeline_id;
+ for change in &self.pending_changes {
+ let pipeline_id = change.new_pipeline_id;
let pipeline = match self.pipelines.get(&pipeline_id) {
None => { warn!("Pending pipeline {:?} is closed", pipeline_id); continue; }
Some(pipeline) => pipeline,
};
- if pipeline.frame_id == frame_id {
+ if pipeline.browsing_context_id == browsing_context_id {
let _ = pipeline.event_loop.send(ConstellationControlMsg::Resize(
pipeline.id,
new_size,
@@ -2534,13 +2582,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
- fn clear_joint_session_future(&mut self, frame_id: FrameId) {
- let frame_ids: Vec<FrameId> = self.full_frame_tree_iter(frame_id)
- .map(|frame| frame.id)
+ fn clear_joint_session_future(&mut self, browsing_context_id: BrowsingContextId) {
+ let browsing_context_ids: Vec<BrowsingContextId> = self.all_browsing_contexts_iter(browsing_context_id)
+ .map(|browsing_context| browsing_context.id)
.collect();
- for frame_id in frame_ids {
- let evicted = match self.frames.get_mut(&frame_id) {
- Some(frame) => frame.remove_forward_entries(),
+ for browsing_context_id in browsing_context_ids {
+ let evicted = match self.browsing_contexts.get_mut(&browsing_context_id) {
+ Some(browsing_context) => browsing_context.remove_forward_entries(),
None => continue,
};
for entry in evicted {
@@ -2551,18 +2599,18 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
- // Close a frame (and all children)
- fn close_frame(&mut self, frame_id: FrameId, exit_mode: ExitPipelineMode) {
- debug!("Closing frame {}.", frame_id);
- let parent_info = self.frames.get(&frame_id)
- .and_then(|frame| self.pipelines.get(&frame.pipeline_id))
+ // Close a browsing context (and all children)
+ fn close_browsing_context(&mut self, browsing_context_id: BrowsingContextId, exit_mode: ExitPipelineMode) {
+ debug!("Closing browsing context {}.", browsing_context_id);
+ let parent_info = self.browsing_contexts.get(&browsing_context_id)
+ .and_then(|browsing_context| self.pipelines.get(&browsing_context.pipeline_id))
.and_then(|pipeline| pipeline.parent_info);
- self.close_frame_children(frame_id, DiscardBrowsingContext::Yes, exit_mode);
+ self.close_browsing_context_children(browsing_context_id, DiscardBrowsingContext::Yes, exit_mode);
- self.event_loops.remove(&frame_id);
- if self.frames.remove(&frame_id).is_none() {
- warn!("Closing frame {:?} twice.", frame_id);
+ self.event_loops.remove(&browsing_context_id);
+ if self.browsing_contexts.remove(&browsing_context_id).is_none() {
+ warn!("Closing browsing context {:?} twice.", browsing_context_id);
}
if let Some((parent_pipeline_id, _)) = parent_info {
@@ -2570,56 +2618,60 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
None => return warn!("Pipeline {:?} child closed after parent.", parent_pipeline_id),
Some(parent_pipeline) => parent_pipeline,
};
- parent_pipeline.remove_child(frame_id);
+ parent_pipeline.remove_child(browsing_context_id);
}
- debug!("Closed frame {:?}.", frame_id);
+ debug!("Closed browsing context {:?}.", browsing_context_id);
}
- // Close the children of a frame
- fn close_frame_children(&mut self, frame_id: FrameId, dbc: DiscardBrowsingContext, exit_mode: ExitPipelineMode) {
- debug!("Closing frame children {}.", frame_id);
+ // Close the children of a browsing context
+ fn close_browsing_context_children(&mut self,
+ browsing_context_id: BrowsingContextId,
+ dbc: DiscardBrowsingContext,
+ exit_mode: ExitPipelineMode)
+ {
+ debug!("Closing browsing context children {}.", browsing_context_id);
// Store information about the pipelines to be closed. Then close the
- // pipelines, before removing ourself from the frames hash map. This
+ // pipelines, before removing ourself from the browsing_contexts hash map. This
// ordering is vital - so that if close_pipeline() ends up closing
- // any child frames, they can be removed from the parent frame correctly.
- let mut pipelines_to_close: Vec<PipelineId> = self.pending_frames.iter()
- .filter(|frame_change| frame_change.frame_id == frame_id)
- .map(|frame_change| frame_change.new_pipeline_id)
+ // any child browsing contexts, they can be removed from the parent browsing context correctly.
+ let mut pipelines_to_close: Vec<PipelineId> = self.pending_changes.iter()
+ .filter(|change| change.browsing_context_id == browsing_context_id)
+ .map(|change| change.new_pipeline_id)
.collect();
- if let Some(frame) = self.frames.get(&frame_id) {
- pipelines_to_close.extend(frame.next.iter().filter_map(|state| state.pipeline_id));
- pipelines_to_close.push(frame.pipeline_id);
- pipelines_to_close.extend(frame.prev.iter().filter_map(|state| state.pipeline_id));
+ if let Some(browsing_context) = self.browsing_contexts.get(&browsing_context_id) {
+ pipelines_to_close.extend(browsing_context.next.iter().filter_map(|state| state.pipeline_id));
+ pipelines_to_close.push(browsing_context.pipeline_id);
+ pipelines_to_close.extend(browsing_context.prev.iter().filter_map(|state| state.pipeline_id));
}
for pipeline_id in pipelines_to_close {
self.close_pipeline(pipeline_id, dbc, exit_mode);
}
- debug!("Closed frame children {}.", frame_id);
+ debug!("Closed browsing context children {}.", browsing_context_id);
}
- // Close all pipelines at and beneath a given frame
+ // Close all pipelines at and beneath a given browsing context
fn close_pipeline(&mut self, pipeline_id: PipelineId, dbc: DiscardBrowsingContext, exit_mode: ExitPipelineMode) {
debug!("Closing pipeline {:?}.", pipeline_id);
- // Store information about the frames to be closed. Then close the
- // frames, before removing ourself from the pipelines hash map. This
- // ordering is vital - so that if close_frame() ends up closing
+ // Store information about the browsing contexts to be closed. Then close the
+ // browsing contexts, before removing ourself from the pipelines hash map. This
+ // ordering is vital - so that if close_browsing_context() ends up closing
// any child pipelines, they can be removed from the parent pipeline correctly.
- let frames_to_close = {
- let mut frames_to_close = vec!();
+ let browsing_contexts_to_close = {
+ let mut browsing_contexts_to_close = vec!();
if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
- frames_to_close.extend_from_slice(&pipeline.children);
+ browsing_contexts_to_close.extend_from_slice(&pipeline.children);
}
- frames_to_close
+ browsing_contexts_to_close
};
- // Remove any child frames
- for child_frame in &frames_to_close {
- self.close_frame(*child_frame, exit_mode);
+ // Remove any child browsing contexts
+ for child_browsing_context in &browsing_contexts_to_close {
+ self.close_browsing_context(*child_browsing_context, exit_mode);
}
// Note, we don't remove the pipeline now, we wait for the message to come back from
@@ -2629,12 +2681,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
None => return warn!("Closing pipeline {:?} twice.", pipeline_id),
};
- // Remove this pipeline from pending frames if it hasn't loaded yet.
- let pending_index = self.pending_frames.iter().position(|frame_change| {
- frame_change.new_pipeline_id == pipeline_id
+ // Remove this pipeline from pending changes if it hasn't loaded yet.
+ let pending_index = self.pending_changes.iter().position(|change| {
+ change.new_pipeline_id == pipeline_id
});
if let Some(pending_index) = pending_index {
- self.pending_frames.remove(pending_index);
+ self.pending_changes.remove(pending_index);
}
// Inform script, compositor that this pipeline has exited.
@@ -2671,19 +2723,19 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
- // Convert a frame to a sendable form to pass to the compositor
- fn frame_to_sendable(&self, frame_id: FrameId) -> Option<SendableFrameTree> {
- self.frames.get(&frame_id).and_then(|frame: &Frame| {
- self.pipelines.get(&frame.pipeline_id).map(|pipeline: &Pipeline| {
+ // Convert a browsing context to a sendable form to pass to the compositor
+ fn browsing_context_to_sendable(&self, browsing_context_id: BrowsingContextId) -> Option<SendableFrameTree> {
+ self.browsing_contexts.get(&browsing_context_id).and_then(|browsing_context| {
+ self.pipelines.get(&browsing_context.pipeline_id).map(|pipeline| {
let mut frame_tree = SendableFrameTree {
pipeline: pipeline.to_sendable(),
- size: frame.size,
+ size: browsing_context.size,
children: vec!(),
};
- for child_frame_id in &pipeline.children {
- if let Some(frame) = self.frame_to_sendable(*child_frame_id) {
- frame_tree.children.push(frame);
+ for child_browsing_context_id in &pipeline.children {
+ if let Some(child) = self.browsing_context_to_sendable(*child_browsing_context_id) {
+ frame_tree.children.push(child);
}
}
@@ -2697,8 +2749,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// Note that this function can panic, due to ipc-channel creation failure.
// avoiding this panic would require a mechanism for dealing
// with low-resource scenarios.
- debug!("Sending frame tree for frame {}.", self.root_frame_id);
- if let Some(frame_tree) = self.frame_to_sendable(self.root_frame_id) {
+ debug!("Sending frame tree for browsing context {}.", self.root_browsing_context_id);
+ if let Some(frame_tree) = self.browsing_context_to_sendable(self.root_browsing_context_id) {
let (chan, port) = ipc::channel().expect("Failed to create IPC channel!");
self.compositor_proxy.send(ToCompositorMsg::SetFrameTree(frame_tree,
chan));
@@ -2716,11 +2768,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
Some(pipeline) => if let Some((parent_id, FrameType::MozBrowserIFrame)) = pipeline.parent_info {
match self.pipelines.get(&parent_id) {
Some(parent) => {
- let can_go_forward = !self.joint_session_future_is_empty(pipeline.frame_id);
- let can_go_back = !self.joint_session_past_is_empty(pipeline.frame_id);
+ let can_go_forward = !self.joint_session_future_is_empty(pipeline.browsing_context_id);
+ let can_go_back = !self.joint_session_past_is_empty(pipeline.browsing_context_id);
let url = pipeline.url.to_string();
let event = MozBrowserEvent::LocationChange(url, can_go_back, can_go_forward);
- parent.trigger_mozbrowser_event(Some(pipeline.frame_id), event);
+ parent.trigger_mozbrowser_event(Some(pipeline.browsing_context_id), event);
},
None => warn!("triggered mozbrowser location change on closed parent {}", parent_id),
}
@@ -2731,7 +2783,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsererror
// Note that this does not require the pipeline to be an immediate child of the root
- fn trigger_mozbrowsererror(&mut self, top_level_frame_id: FrameId, reason: String, backtrace: Option<String>) {
+ fn trigger_mozbrowsererror(&mut self,
+ top_level_browsing_context_id: BrowsingContextId,
+ reason: String,
+ backtrace: Option<String>)
+ {
if !PREFS.is_mozbrowser_enabled() { return; }
let mut report = String::new();
@@ -2753,36 +2809,25 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let event = MozBrowserEvent::Error(MozBrowserErrorType::Fatal, reason, report);
- match self.frames.get(&top_level_frame_id) {
- None => warn!("Mozbrowser error after top-level frame closed."),
- Some(frame) => match self.pipelines.get(&frame.pipeline_id) {
+ match self.browsing_contexts.get(&top_level_browsing_context_id) {
+ None => warn!("Mozbrowser error after top-level browsing context closed."),
+ Some(browsing_context) => match self.pipelines.get(&browsing_context.pipeline_id) {
None => warn!("Mozbrowser error after top-level pipeline closed."),
Some(pipeline) => match pipeline.parent_info {
None => pipeline.trigger_mozbrowser_event(None, event),
Some((parent_id, _)) => match self.pipelines.get(&parent_id) {
None => warn!("Mozbrowser error after root pipeline closed."),
- Some(parent) => parent.trigger_mozbrowser_event(Some(top_level_frame_id), event),
+ Some(parent) => parent.trigger_mozbrowser_event(Some(top_level_browsing_context_id), event),
},
},
},
};
}
- fn focused_pipeline_in_tree(&self, frame_id: FrameId) -> bool {
+ fn focused_pipeline_is_descendant_of(&self, browsing_context_id: BrowsingContextId) -> bool {
self.focus_pipeline_id.map_or(false, |pipeline_id| {
- self.pipeline_exists_in_tree(pipeline_id, frame_id)
+ self.fully_active_browsing_contexts_iter(browsing_context_id)
+ .any(|browsing_context| browsing_context.pipeline_id == pipeline_id)
})
}
-
- fn pipeline_is_in_current_frame(&self, pipeline_id: PipelineId) -> bool {
- self.pipeline_exists_in_tree(pipeline_id, self.root_frame_id)
- }
-
- fn pipeline_exists_in_tree(&self,
- pipeline_id: PipelineId,
- root_frame_id: FrameId) -> bool {
- self.current_frame_tree_iter(root_frame_id)
- .any(|current_frame| current_frame.pipeline_id == pipeline_id)
- }
-
}
diff --git a/components/constellation/lib.rs b/components/constellation/lib.rs
index 536775de0ef..6958a5b7c39 100644
--- a/components/constellation/lib.rs
+++ b/components/constellation/lib.rs
@@ -41,9 +41,9 @@ extern crate style_traits;
extern crate webrender_traits;
extern crate webvr_traits;
+mod browsingcontext;
mod constellation;
mod event_loop;
-mod frame;
mod pipeline;
#[cfg(not(target_os = "windows"))]
mod sandboxing;
diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs
index 60401f4313c..01c386779bb 100644
--- a/components/constellation/pipeline.rs
+++ b/components/constellation/pipeline.rs
@@ -15,7 +15,7 @@ use ipc_channel::Error;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use layout_traits::LayoutThreadFactory;
-use msg::constellation_msg::{FrameId, FrameType, PipelineId, PipelineNamespaceId};
+use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId, PipelineNamespaceId};
use net::image_cache::ImageCacheImpl;
use net_traits::{IpcSend, ResourceThreads};
use net_traits::image_cache::ImageCache;
@@ -49,14 +49,14 @@ pub struct Pipeline {
/// The ID of the pipeline.
pub id: PipelineId,
- /// The ID of the frame that contains this Pipeline.
- pub frame_id: FrameId,
+ /// The ID of the browsing context that contains this Pipeline.
+ pub browsing_context_id: BrowsingContextId,
/// The parent pipeline of this one. `None` if this is a root pipeline.
/// Note that because of mozbrowser iframes, even top-level pipelines
/// may have a parent (in which case the frame type will be
/// `MozbrowserIFrame`).
- /// TODO: move this field to `Frame`.
+ /// TODO: move this field to `BrowsingContext`.
pub parent_info: Option<(PipelineId, FrameType)>,
/// The event loop handling this pipeline.
@@ -80,11 +80,11 @@ pub struct Pipeline {
/// animations cause composites to be continually scheduled.
pub running_animations: bool,
- /// The child frames of this pipeline (these are iframes in the document).
- pub children: Vec<FrameId>,
+ /// The child browsing contexts of this pipeline (these are iframes in the document).
+ pub children: Vec<BrowsingContextId>,
/// Whether this pipeline is in private browsing mode.
- /// TODO: move this field to `Frame`.
+ /// TODO: move this field to `BrowsingContext`.
pub is_private: bool,
/// Whether this pipeline should be treated as visible for the purposes of scheduling and
@@ -100,11 +100,11 @@ pub struct InitialPipelineState {
/// The ID of the pipeline to create.
pub id: PipelineId,
- /// The ID of the frame that contains this Pipeline.
- pub frame_id: FrameId,
+ /// The ID of the browsing context that contains this Pipeline.
+ pub browsing_context_id: BrowsingContextId,
- /// The ID of the top-level frame that contains this Pipeline.
- pub top_level_frame_id: FrameId,
+ /// The ID of the top-level browsing context that contains this Pipeline.
+ pub top_level_browsing_context_id: BrowsingContextId,
/// The ID of the parent pipeline and frame type, if any.
/// If `None`, this is the root.
@@ -200,7 +200,7 @@ impl Pipeline {
let new_layout_info = NewLayoutInfo {
parent_info: state.parent_info,
new_pipeline_id: state.id,
- frame_id: state.frame_id,
+ browsing_context_id: state.browsing_context_id,
load_data: state.load_data,
window_size: window_size,
pipeline_port: pipeline_port,
@@ -237,8 +237,8 @@ impl Pipeline {
let unprivileged_pipeline_content = UnprivilegedPipelineContent {
id: state.id,
- frame_id: state.frame_id,
- top_level_frame_id: state.top_level_frame_id,
+ browsing_context_id: state.browsing_context_id,
+ top_level_browsing_context_id: state.top_level_browsing_context_id,
parent_info: state.parent_info,
constellation_chan: state.constellation_chan,
scheduler_chan: state.scheduler_chan,
@@ -280,7 +280,7 @@ impl Pipeline {
};
Ok(Pipeline::new(state.id,
- state.frame_id,
+ state.browsing_context_id,
state.parent_info,
script_chan,
pipeline_chan,
@@ -293,7 +293,7 @@ impl Pipeline {
/// Creates a new `Pipeline`, after the script and layout threads have been
/// spawned.
pub fn new(id: PipelineId,
- frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
parent_info: Option<(PipelineId, FrameType)>,
event_loop: Rc<EventLoop>,
layout_chan: IpcSender<LayoutControlMsg>,
@@ -304,7 +304,7 @@ impl Pipeline {
-> Pipeline {
let pipeline = Pipeline {
id: id,
- frame_id: frame_id,
+ browsing_context_id: browsing_context_id,
parent_info: parent_info,
event_loop: event_loop,
layout_chan: layout_chan,
@@ -376,15 +376,15 @@ impl Pipeline {
}
}
- /// Add a new child frame.
- pub fn add_child(&mut self, frame_id: FrameId) {
- self.children.push(frame_id);
+ /// Add a new child browsing context.
+ pub fn add_child(&mut self, browsing_context_id: BrowsingContextId) {
+ self.children.push(browsing_context_id);
}
- /// Remove a child frame.
- pub fn remove_child(&mut self, frame_id: FrameId) {
- match self.children.iter().position(|id| *id == frame_id) {
- None => return warn!("Pipeline remove child already removed ({:?}).", frame_id),
+ /// Remove a child browsing context.
+ pub fn remove_child(&mut self, browsing_context_id: BrowsingContextId) {
+ match self.children.iter().position(|id| *id == browsing_context_id) {
+ None => return warn!("Pipeline remove child already removed ({:?}).", browsing_context_id),
Some(index) => self.children.remove(index),
};
}
@@ -393,7 +393,7 @@ impl Pipeline {
/// This will cause an event to be fired on an iframe in the document,
/// or on the `Window` if no frame is given.
pub fn trigger_mozbrowser_event(&self,
- child_id: Option<FrameId>,
+ child_id: Option<BrowsingContextId>,
event: MozBrowserEvent) {
assert!(PREFS.is_mozbrowser_enabled());
@@ -433,8 +433,8 @@ impl Pipeline {
#[derive(Deserialize, Serialize)]
pub struct UnprivilegedPipelineContent {
id: PipelineId,
- frame_id: FrameId,
- top_level_frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
+ top_level_browsing_context_id: BrowsingContextId,
parent_info: Option<(PipelineId, FrameType)>,
constellation_chan: IpcSender<ScriptMsg>,
layout_to_constellation_chan: IpcSender<LayoutMsg>,
@@ -470,8 +470,8 @@ impl UnprivilegedPipelineContent {
let image_cache = Arc::new(ImageCacheImpl::new(self.webrender_api_sender.create_api()));
let layout_pair = STF::create(InitialScriptState {
id: self.id,
- frame_id: self.frame_id,
- top_level_frame_id: self.top_level_frame_id,
+ browsing_context_id: self.browsing_context_id,
+ top_level_browsing_context_id: self.top_level_browsing_context_id,
parent_info: self.parent_info,
control_chan: self.script_chan.clone(),
control_port: self.script_port,
@@ -491,7 +491,7 @@ impl UnprivilegedPipelineContent {
}, self.load_data.clone());
LTF::create(self.id,
- Some(self.top_level_frame_id),
+ Some(self.top_level_browsing_context_id),
self.load_data.url,
self.parent_info.is_some(),
layout_pair,
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index 67a520a3796..110246379bb 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -34,7 +34,7 @@ use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT};
use ipc_channel::ipc;
use list_item::ListItemFlow;
use model::{self, MaybeAuto, specified};
-use msg::constellation_msg::FrameId;
+use msg::constellation_msg::BrowsingContextId;
use net_traits::image::base::PixelFormat;
use net_traits::image_cache::UsePlaceholder;
use range::Range;
@@ -175,7 +175,7 @@ pub struct DisplayListBuildState<'a> {
/// Vector containing iframe sizes, used to inform the constellation about
/// new iframe sizes
- pub iframe_sizes: Vec<(FrameId, TypedSize2D<f32, CSSPixel>)>,
+ pub iframe_sizes: Vec<(BrowsingContextId, TypedSize2D<f32, CSSPixel>)>,
/// A stack of clips used to cull display list entries that are outside the
/// rendered region.
@@ -1823,7 +1823,7 @@ impl FragmentDisplayListBuilding for Fragment {
let size = Size2D::new(item.bounds().size.width.to_f32_px(),
item.bounds().size.height.to_f32_px());
- state.iframe_sizes.push((fragment_info.frame_id, TypedSize2D::from_untyped(&size)));
+ state.iframe_sizes.push((fragment_info.browsing_context_id, TypedSize2D::from_untyped(&size)));
state.add_display_item(item);
}
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index c4dfefcc696..7bbe57953fc 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -26,7 +26,7 @@ use ipc_channel::ipc::IpcSender;
use layout_debug;
use model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint};
use model::{style_length, ToGfxMatrix};
-use msg::constellation_msg::{FrameId, PipelineId};
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image::base::{Image, ImageMetadata};
use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder};
use range::*;
@@ -472,7 +472,7 @@ impl ImageFragmentInfo {
#[derive(Clone)]
pub struct IframeFragmentInfo {
/// The frame ID of this iframe.
- pub frame_id: FrameId,
+ pub browsing_context_id: BrowsingContextId,
/// The pipelineID of this iframe.
pub pipeline_id: PipelineId,
}
@@ -480,10 +480,10 @@ pub struct IframeFragmentInfo {
impl IframeFragmentInfo {
/// Creates the information specific to an iframe fragment.
pub fn new<N: ThreadSafeLayoutNode>(node: &N) -> IframeFragmentInfo {
- let frame_id = node.iframe_frame_id();
+ let browsing_context_id = node.iframe_browsing_context_id();
let pipeline_id = node.iframe_pipeline_id();
IframeFragmentInfo {
- frame_id: frame_id,
+ browsing_context_id: browsing_context_id,
pipeline_id: pipeline_id,
}
}
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index eed95ecb9ea..8185aa6e409 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -74,7 +74,7 @@ use layout::webrender_helpers::WebRenderDisplayListConverter;
use layout::wrapper::LayoutNodeLayoutData;
use layout::wrapper::drop_style_and_layout_data;
use layout_traits::LayoutThreadFactory;
-use msg::constellation_msg::{FrameId, PipelineId};
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image_cache::{ImageCache, UsePlaceholder};
use parking_lot::RwLock;
use profile_traits::mem::{self, Report, ReportKind, ReportsChan};
@@ -244,7 +244,7 @@ impl LayoutThreadFactory for LayoutThread {
/// Spawns a new layout thread.
fn create(id: PipelineId,
- top_level_frame_id: Option<FrameId>,
+ top_level_browsing_context_id: Option<BrowsingContextId>,
url: ServoUrl,
is_iframe: bool,
chan: (Sender<Msg>, Receiver<Msg>),
@@ -261,8 +261,8 @@ impl LayoutThreadFactory for LayoutThread {
thread::Builder::new().name(format!("LayoutThread {:?}", id)).spawn(move || {
thread_state::initialize(thread_state::LAYOUT);
- if let Some(top_level_frame_id) = top_level_frame_id {
- FrameId::install(top_level_frame_id);
+ if let Some(top_level_browsing_context_id) = top_level_browsing_context_id {
+ BrowsingContextId::install(top_level_browsing_context_id);
}
{ // Ensures layout thread is destroyed before we send shutdown message
@@ -732,7 +732,7 @@ impl LayoutThread {
fn create_layout_thread(&self, info: NewLayoutThreadInfo) {
LayoutThread::create(info.id,
- FrameId::installed(),
+ BrowsingContextId::installed(),
info.url.clone(),
info.is_parent,
info.layout_pair,
@@ -930,7 +930,7 @@ impl LayoutThread {
// build_state.iframe_sizes is only used here, so its okay to replace
// it with an empty vector
let iframe_sizes = std::mem::replace(&mut build_state.iframe_sizes, vec![]);
- let msg = ConstellationMsg::FrameSizes(iframe_sizes);
+ let msg = ConstellationMsg::IFrameSizes(iframe_sizes);
if let Err(e) = self.constellation_chan.send(msg) {
warn!("Layout resize to constellation failed ({}).", e);
}
diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs
index 9d97a89a53c..53aa2529cb0 100644
--- a/components/layout_traits/lib.rs
+++ b/components/layout_traits/lib.rs
@@ -20,7 +20,7 @@ extern crate webrender_traits;
use gfx::font_cache_thread::FontCacheThread;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
-use msg::constellation_msg::{FrameId, PipelineId};
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image_cache::ImageCache;
use profile_traits::{mem, time};
use script_traits::{ConstellationControlMsg, LayoutControlMsg};
@@ -34,7 +34,7 @@ use std::sync::mpsc::{Receiver, Sender};
pub trait LayoutThreadFactory {
type Message;
fn create(id: PipelineId,
- top_level_frame_id: Option<FrameId>,
+ top_level_browsing_context_id: Option<BrowsingContextId>,
url: ServoUrl,
is_iframe: bool,
chan: (Sender<Self::Message>, Receiver<Self::Message>),
diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs
index 02d4157f20c..edec5fb5231 100644
--- a/components/msg/constellation_msg.rs
+++ b/components/msg/constellation_msg.rs
@@ -207,10 +207,10 @@ impl PipelineNamespace {
}
}
- fn next_frame_id(&mut self) -> FrameId {
- FrameId {
+ fn next_browsing_context_id(&mut self) -> BrowsingContextId {
+ BrowsingContextId {
namespace_id: self.id,
- index: FrameIndex(self.next_index()),
+ index: BrowsingContextIndex(self.next_index()),
}
}
}
@@ -258,42 +258,41 @@ impl fmt::Display for PipelineId {
}
}
-thread_local!(pub static TOP_LEVEL_FRAME_ID: Cell<Option<FrameId>> = Cell::new(None));
+thread_local!(pub static TOP_LEVEL_BROWSING_CONTEXT_ID: Cell<Option<BrowsingContextId>> = Cell::new(None));
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Copy, Hash, Debug, Deserialize, Serialize, HeapSizeOf)]
-pub struct FrameIndex(pub u32);
+pub struct BrowsingContextIndex(pub u32);
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Copy, Hash, Debug, Deserialize, Serialize, HeapSizeOf)]
-pub struct FrameId {
+pub struct BrowsingContextId {
pub namespace_id: PipelineNamespaceId,
- pub index: FrameIndex
+ pub index: BrowsingContextIndex
}
-impl FrameId {
- pub fn new() -> FrameId {
+impl BrowsingContextId {
+ pub fn new() -> BrowsingContextId {
PIPELINE_NAMESPACE.with(|tls| {
let mut namespace = tls.get().expect("No namespace set for this thread!");
- let new_frame_id = namespace.next_frame_id();
+ let new_browsing_context_id = namespace.next_browsing_context_id();
tls.set(Some(namespace));
- new_frame_id
+ new_browsing_context_id
})
}
-
- /// Each script and layout thread should have the top-level frame id installed,
+ /// Each script and layout thread should have the top-level browsing context id installed,
/// since it is used by crash reporting.
- pub fn install(id: FrameId) {
- TOP_LEVEL_FRAME_ID.with(|tls| tls.set(Some(id)))
+ pub fn install(id: BrowsingContextId) {
+ TOP_LEVEL_BROWSING_CONTEXT_ID.with(|tls| tls.set(Some(id)))
}
- pub fn installed() -> Option<FrameId> {
- TOP_LEVEL_FRAME_ID.with(|tls| tls.get())
+ pub fn installed() -> Option<BrowsingContextId> {
+ TOP_LEVEL_BROWSING_CONTEXT_ID.with(|tls| tls.get())
}
}
-impl fmt::Display for FrameId {
+impl fmt::Display for BrowsingContextId {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let PipelineNamespaceId(namespace_id) = self.namespace_id;
- let FrameIndex(index) = self.index;
+ let BrowsingContextIndex(index) = self.index;
write!(fmt, "({},{})", namespace_id, index)
}
}
@@ -302,8 +301,9 @@ impl fmt::Display for FrameId {
pub const TEST_NAMESPACE: PipelineNamespaceId = PipelineNamespaceId(1234);
pub const TEST_PIPELINE_INDEX: PipelineIndex = PipelineIndex(5678);
pub const TEST_PIPELINE_ID: PipelineId = PipelineId { namespace_id: TEST_NAMESPACE, index: TEST_PIPELINE_INDEX };
-pub const TEST_FRAME_INDEX: FrameIndex = FrameIndex(8765);
-pub const TEST_FRAME_ID: FrameId = FrameId { namespace_id: TEST_NAMESPACE, index: TEST_FRAME_INDEX };
+pub const TEST_BROWSING_CONTEXT_INDEX: BrowsingContextIndex = BrowsingContextIndex(8765);
+pub const TEST_BROWSING_CONTEXT_ID: BrowsingContextId =
+ BrowsingContextId { namespace_id: TEST_NAMESPACE, index: TEST_BROWSING_CONTEXT_INDEX };
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize, HeapSizeOf)]
pub enum FrameType {
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index a0f26d12c23..2b3bfceceb2 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -58,7 +58,7 @@ use js::glue::{CallObjectTracer, CallValueTracer};
use js::jsapi::{GCTraceKindToAscii, Heap, JSObject, JSTracer, TraceKind};
use js::jsval::JSVal;
use js::rust::Runtime;
-use msg::constellation_msg::{FrameId, FrameType, PipelineId};
+use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId};
use net_traits::{Metadata, NetworkError, ReferrerPolicy, ResourceThreads};
use net_traits::filemanager_thread::RelativePos;
use net_traits::image::base::{Image, ImageMetadata};
@@ -336,7 +336,7 @@ unsafe_no_jsmanaged_fields!(TrustedPromise);
unsafe_no_jsmanaged_fields!(PropertyDeclarationBlock);
// These three are interdependent, if you plan to put jsmanaged data
// in one of these make sure it is propagated properly to containing structs
-unsafe_no_jsmanaged_fields!(DocumentActivity, FrameId, FrameType, WindowSizeData, WindowSizeType, PipelineId);
+unsafe_no_jsmanaged_fields!(DocumentActivity, BrowsingContextId, FrameType, WindowSizeData, WindowSizeType, PipelineId);
unsafe_no_jsmanaged_fields!(TimerEventId, TimerSource);
unsafe_no_jsmanaged_fields!(TimelineMarkerType);
unsafe_no_jsmanaged_fields!(WorkerId);
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index 14dd070f44d..6b73df12dfc 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -27,7 +27,7 @@ use js::jsapi::{HandleValue, JS_SetInterruptCallback};
use js::jsapi::{JSAutoCompartment, JSContext};
use js::jsval::UndefinedValue;
use js::rust::Runtime;
-use msg::constellation_msg::FrameId;
+use msg::constellation_msg::BrowsingContextId;
use net_traits::{IpcSend, load_whole_resource};
use net_traits::request::{CredentialsMode, Destination, RequestInit, Type as RequestType};
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, StackRootTLS, get_reports, new_rt_and_cx};
@@ -159,13 +159,13 @@ impl DedicatedWorkerGlobalScope {
closing: Arc<AtomicBool>) {
let serialized_worker_url = worker_url.to_string();
let name = format!("WebWorker for {}", serialized_worker_url);
- let top_level_frame_id = FrameId::installed();
+ let top_level_browsing_context_id = BrowsingContextId::installed();
thread::Builder::new().name(name).spawn(move || {
thread_state::initialize(thread_state::SCRIPT | thread_state::IN_WORKER);
- if let Some(top_level_frame_id) = top_level_frame_id {
- FrameId::install(top_level_frame_id);
+ if let Some(top_level_browsing_context_id) = top_level_browsing_context_id {
+ BrowsingContextId::install(top_level_browsing_context_id);
}
let roots = RootCollection::new();
diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs
index 7d5bef36344..a4e230e90a2 100644
--- a/components/script/dom/dissimilaroriginwindow.rs
+++ b/components/script/dom/dissimilaroriginwindow.rs
@@ -184,7 +184,9 @@ impl DissimilarOriginWindowMethods for DissimilarOriginWindow {
impl DissimilarOriginWindow {
pub fn post_message(&self, origin: Option<ImmutableOrigin>, data: StructuredCloneData) {
- let msg = ConstellationMsg::PostMessage(self.window_proxy.frame_id(), origin, data.move_to_arraybuffer());
+ let msg = ConstellationMsg::PostMessage(self.window_proxy.browsing_context_id(),
+ origin,
+ data.move_to_arraybuffer());
let _ = self.upcast::<GlobalScope>().constellation_chan().send(msg);
}
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index e44de8be727..81ea073ab41 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -100,7 +100,7 @@ use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::{JSContext, JSObject, JSRuntime};
use js::jsapi::JS_GetRuntime;
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
-use msg::constellation_msg::{FrameId, Key, KeyModifiers, KeyState};
+use msg::constellation_msg::{BrowsingContextId, Key, KeyModifiers, KeyState};
use net_traits::{FetchResponseMsg, IpcSend, ReferrerPolicy};
use net_traits::CookieSource::NonHTTP;
use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl};
@@ -1897,9 +1897,9 @@ impl Document {
}
/// Find an iframe element in the document.
- pub fn find_iframe(&self, frame_id: FrameId) -> Option<Root<HTMLIFrameElement>> {
+ pub fn find_iframe(&self, browsing_context_id: BrowsingContextId) -> Option<Root<HTMLIFrameElement>> {
self.iter_iframes()
- .find(|node| node.frame_id() == frame_id)
+ .find(|node| node.browsing_context_id() == browsing_context_id)
}
pub fn get_dom_loading(&self) -> u64 {
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 1e6615ce36a..8334b4cb421 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -40,7 +40,7 @@ use html5ever::{LocalName, Prefix};
use ipc_channel::ipc;
use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue};
use js::jsval::{NullValue, UndefinedValue};
-use msg::constellation_msg::{FrameType, FrameId, PipelineId, TraversalDirection};
+use msg::constellation_msg::{FrameType, BrowsingContextId, PipelineId, TraversalDirection};
use net_traits::response::HttpsState;
use script_layout_interface::message::ReflowQueryType;
use script_thread::{ScriptThread, Runnable};
@@ -84,7 +84,7 @@ enum ProcessingMode {
#[dom_struct]
pub struct HTMLIFrameElement {
htmlelement: HTMLElement,
- frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
pipeline_id: Cell<Option<PipelineId>>,
pending_pipeline_id: Cell<Option<PipelineId>>,
sandbox: MutNullableJS<DOMTokenList>,
@@ -115,7 +115,7 @@ impl HTMLIFrameElement {
pub fn generate_new_pipeline_id(&self) -> (Option<PipelineId>, PipelineId) {
let old_pipeline_id = self.pipeline_id.get();
let new_pipeline_id = PipelineId::new();
- debug!("Frame {} created pipeline {}.", self.frame_id, new_pipeline_id);
+ debug!("Frame {} created pipeline {}.", self.browsing_context_id, new_pipeline_id);
(old_pipeline_id, new_pipeline_id)
}
@@ -152,7 +152,7 @@ impl HTMLIFrameElement {
let global_scope = window.upcast::<GlobalScope>();
let load_info = IFrameLoadInfo {
parent_pipeline_id: global_scope.pipeline_id(),
- frame_id: self.frame_id,
+ browsing_context_id: self.browsing_context_id,
new_pipeline_id: new_pipeline_id,
is_private: private_iframe,
frame_type: frame_type,
@@ -171,7 +171,7 @@ impl HTMLIFrameElement {
let new_layout_info = NewLayoutInfo {
parent_info: Some((global_scope.pipeline_id(), frame_type)),
new_pipeline_id: new_pipeline_id,
- frame_id: self.frame_id,
+ browsing_context_id: self.browsing_context_id,
load_data: load_data.unwrap(),
pipeline_port: pipeline_receiver,
content_process_shutdown_chan: None,
@@ -277,7 +277,7 @@ impl HTMLIFrameElement {
document: &Document) -> HTMLIFrameElement {
HTMLIFrameElement {
htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
- frame_id: FrameId::new(),
+ browsing_context_id: BrowsingContextId::new(),
pipeline_id: Cell::new(None),
pending_pipeline_id: Cell::new(None),
sandbox: Default::default(),
@@ -302,8 +302,8 @@ impl HTMLIFrameElement {
}
#[inline]
- pub fn frame_id(&self) -> FrameId {
- self.frame_id
+ pub fn browsing_context_id(&self) -> BrowsingContextId {
+ self.browsing_context_id
}
pub fn change_visibility_status(&self, visibility: bool) {
@@ -364,7 +364,7 @@ impl HTMLIFrameElement {
pub trait HTMLIFrameElementLayoutMethods {
fn pipeline_id(&self) -> Option<PipelineId>;
- fn frame_id(&self) -> FrameId;
+ fn browsing_context_id(&self) -> BrowsingContextId;
fn get_width(&self) -> LengthOrPercentageOrAuto;
fn get_height(&self) -> LengthOrPercentageOrAuto;
}
@@ -380,9 +380,9 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
#[inline]
#[allow(unsafe_code)]
- fn frame_id(&self) -> FrameId {
+ fn browsing_context_id(&self) -> BrowsingContextId {
unsafe {
- (*self.unsafe_get()).frame_id
+ (*self.unsafe_get()).browsing_context_id
}
}
@@ -541,7 +541,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentwindow
fn GetContentWindow(&self) -> Option<Root<WindowProxy>> {
- self.pipeline_id.get().and_then(|_| ScriptThread::find_window_proxy(self.frame_id))
+ self.pipeline_id.get().and_then(|_| ScriptThread::find_window_proxy(self.browsing_context_id))
}
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentdocument
@@ -711,7 +711,7 @@ impl VirtualMethods for HTMLIFrameElement {
// is in a document tree and has a browsing context, which is what causes
// the child browsing context to be created.
if self.upcast::<Node>().is_in_doc_with_browsing_context() {
- debug!("iframe {} src set while in browsing context.", self.frame_id);
+ debug!("iframe {} src set while in browsing context.", self.browsing_context_id);
self.process_the_iframe_attributes(ProcessingMode::NotFirstTime);
}
},
@@ -740,7 +740,7 @@ impl VirtualMethods for HTMLIFrameElement {
// to the newly-created browsing context, and then process the
// iframe attributes for the "first time"."
if self.upcast::<Node>().is_in_doc_with_browsing_context() {
- debug!("iframe {} bound to browsing context.", self.frame_id);
+ debug!("iframe {} bound to browsing context.", self.browsing_context_id);
debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc");
self.create_nested_browsing_context();
self.process_the_iframe_attributes(ProcessingMode::FirstTime);
@@ -754,13 +754,13 @@ impl VirtualMethods for HTMLIFrameElement {
LoadBlocker::terminate(&mut blocker);
// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded
- debug!("Unbinding frame {}.", self.frame_id);
+ debug!("Unbinding frame {}.", self.browsing_context_id);
let window = window_from_node(self);
let (sender, receiver) = ipc::channel().unwrap();
// Ask the constellation to remove the iframe, and tell us the
// pipeline ids of the closed pipelines.
- let msg = ConstellationMsg::RemoveIFrame(self.frame_id, sender);
+ let msg = ConstellationMsg::RemoveIFrame(self.browsing_context_id, sender);
window.upcast::<GlobalScope>().constellation_chan().send(msg).unwrap();
let exited_pipeline_ids = receiver.recv().unwrap();
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 6d16cac6731..bec7a34d63f 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -61,7 +61,7 @@ use heapsize::{HeapSizeOf, heap_size_of};
use html5ever::{Prefix, Namespace, QualName};
use js::jsapi::{JSContext, JSObject, JSRuntime};
use libc::{self, c_void, uintptr_t};
-use msg::constellation_msg::{FrameId, PipelineId};
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
use ref_slice::ref_slice;
use script_layout_interface::{HTMLCanvasData, OpaqueStyleAndLayoutData, SVGSVGData};
use script_layout_interface::{LayoutElementType, LayoutNodeType, TrustedNodeAddress};
@@ -968,7 +968,7 @@ pub trait LayoutNodeHelpers {
fn image_url(&self) -> Option<ServoUrl>;
fn canvas_data(&self) -> Option<HTMLCanvasData>;
fn svg_data(&self) -> Option<SVGSVGData>;
- fn iframe_frame_id(&self) -> FrameId;
+ fn iframe_browsing_context_id(&self) -> BrowsingContextId;
fn iframe_pipeline_id(&self) -> PipelineId;
fn opaque(&self) -> OpaqueNode;
}
@@ -1119,10 +1119,10 @@ impl LayoutNodeHelpers for LayoutJS<Node> {
.map(|svg| svg.data())
}
- fn iframe_frame_id(&self) -> FrameId {
+ fn iframe_browsing_context_id(&self) -> BrowsingContextId {
let iframe_element = self.downcast::<HTMLIFrameElement>()
.expect("not an iframe element!");
- iframe_element.frame_id()
+ iframe_element.browsing_context_id()
}
fn iframe_pipeline_id(&self) -> PipelineId {
diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs
index 3290afa1f2c..e022e69a810 100644
--- a/components/script/dom/windowproxy.rs
+++ b/components/script/dom/windowproxy.rs
@@ -28,7 +28,7 @@ use js::jsapi::{MutableHandle, MutableHandleObject, MutableHandleValue};
use js::jsapi::{ObjectOpResult, PropertyDescriptor};
use js::jsval::{UndefinedValue, PrivateValue};
use js::rust::get_object_class;
-use msg::constellation_msg::FrameId;
+use msg::constellation_msg::BrowsingContextId;
use msg::constellation_msg::PipelineId;
use std::cell::Cell;
use std::ptr;
@@ -45,10 +45,10 @@ pub struct WindowProxy {
/// changes Window.
reflector: Reflector,
- /// The frame id of the browsing context.
- /// In the case that this is a nested browsing context, this is the frame id
+ /// The id of the browsing context.
+ /// In the case that this is a nested browsing context, this is the id
/// of the container.
- frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
/// The pipeline id of the currently active document.
/// May be None, when the currently active document is in another script thread.
@@ -68,7 +68,7 @@ pub struct WindowProxy {
}
impl WindowProxy {
- pub fn new_inherited(frame_id: FrameId,
+ pub fn new_inherited(browsing_context_id: BrowsingContextId,
currently_active: Option<PipelineId>,
frame_element: Option<&Element>,
parent: Option<&WindowProxy>)
@@ -76,7 +76,7 @@ impl WindowProxy {
{
WindowProxy {
reflector: Reflector::new(),
- frame_id: frame_id,
+ browsing_context_id: browsing_context_id,
currently_active: Cell::new(currently_active),
discarded: Cell::new(false),
frame_element: frame_element.map(JS::from_ref),
@@ -86,7 +86,7 @@ impl WindowProxy {
#[allow(unsafe_code)]
pub fn new(window: &Window,
- frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
frame_element: Option<&Element>,
parent: Option<&WindowProxy>)
-> Root<WindowProxy>
@@ -107,7 +107,7 @@ impl WindowProxy {
// Create a new browsing context.
let current = Some(window.global().pipeline_id());
- let mut window_proxy = box WindowProxy::new_inherited(frame_id, current, frame_element, parent);
+ let mut window_proxy = box WindowProxy::new_inherited(browsing_context_id, current, frame_element, parent);
// The window proxy owns the browsing context.
// When we finalize the window proxy, it drops the browsing context it owns.
@@ -125,7 +125,7 @@ impl WindowProxy {
#[allow(unsafe_code)]
pub fn new_dissimilar_origin(global_to_clone_from: &GlobalScope,
- frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
parent: Option<&WindowProxy>)
-> Root<WindowProxy>
{
@@ -136,7 +136,7 @@ impl WindowProxy {
let cx = global_to_clone_from.get_cx();
// Create a new browsing context.
- let mut window_proxy = box WindowProxy::new_inherited(frame_id, None, None, parent);
+ let mut window_proxy = box WindowProxy::new_inherited(browsing_context_id, None, None, parent);
// Create a new dissimilar-origin window.
let window = DissimilarOriginWindow::new(global_to_clone_from, &*window_proxy);
@@ -171,8 +171,8 @@ impl WindowProxy {
self.discarded.get()
}
- pub fn frame_id(&self) -> FrameId {
- self.frame_id
+ pub fn browsing_context_id(&self) -> BrowsingContextId {
+ self.browsing_context_id
}
pub fn frame_element(&self) -> Option<&Element> {
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index 5cea48786e3..7802d446114 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -44,7 +44,7 @@ use dom::node::{LayoutNodeHelpers, Node};
use dom::text::Text;
use gfx_traits::ByteIndex;
use html5ever::{LocalName, Namespace};
-use msg::constellation_msg::{FrameId, PipelineId};
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
use range::Range;
use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, TrustedNodeAddress};
use script_layout_interface::{OpaqueStyleAndLayoutData, PartialPersistentLayoutData};
@@ -908,9 +908,9 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
this.svg_data()
}
- fn iframe_frame_id(&self) -> FrameId {
+ fn iframe_browsing_context_id(&self) -> BrowsingContextId {
let this = unsafe { self.get_jsmanaged() };
- this.iframe_frame_id()
+ this.iframe_browsing_context_id()
}
fn iframe_pipeline_id(&self) -> PipelineId {
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index b817fc77d1d..9ab6fd301bc 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -71,7 +71,7 @@ use js::jsval::UndefinedValue;
use js::rust::Runtime;
use mem::heap_size_of_self_and_children;
use microtask::{MicrotaskQueue, Microtask};
-use msg::constellation_msg::{FrameId, FrameType, PipelineId, PipelineNamespace};
+use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId, PipelineNamespace};
use net_traits::{CoreResourceMsg, FetchMetadata, FetchResponseListener};
use net_traits::{IpcSend, Metadata, ReferrerPolicy, ResourceThreads};
use net_traits::image_cache::{ImageCache, PendingImageResponse};
@@ -142,7 +142,7 @@ struct InProgressLoad {
/// The pipeline which requested this load.
pipeline_id: PipelineId,
/// The frame being loaded into.
- frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
/// The parent pipeline and frame type associated with this load, if any.
parent_info: Option<(PipelineId, FrameType)>,
/// The current window size associated with this pipeline.
@@ -162,7 +162,7 @@ struct InProgressLoad {
impl InProgressLoad {
/// Create a new InProgressLoad object.
fn new(id: PipelineId,
- frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
parent_info: Option<(PipelineId, FrameType)>,
layout_chan: Sender<message::Msg>,
window_size: Option<WindowSizeData>,
@@ -170,7 +170,7 @@ impl InProgressLoad {
origin: MutableOrigin) -> InProgressLoad {
InProgressLoad {
pipeline_id: id,
- frame_id: frame_id,
+ browsing_context_id: browsing_context_id,
parent_info: parent_info,
layout_chan: layout_chan,
window_size: window_size,
@@ -368,8 +368,10 @@ impl Documents {
self.find_window(pipeline_id).map(|window| Root::from_ref(window.upcast()))
}
- pub fn find_iframe(&self, pipeline_id: PipelineId, frame_id: FrameId) -> Option<Root<HTMLIFrameElement>> {
- self.find_document(pipeline_id).and_then(|doc| doc.find_iframe(frame_id))
+ pub fn find_iframe(&self, pipeline_id: PipelineId, browsing_context_id: BrowsingContextId)
+ -> Option<Root<HTMLIFrameElement>>
+ {
+ self.find_document(pipeline_id).and_then(|doc| doc.find_iframe(browsing_context_id))
}
pub fn iter<'a>(&'a self) -> DocumentsIter<'a> {
@@ -400,7 +402,7 @@ pub struct ScriptThread {
documents: DOMRefCell<Documents>,
/// The window proxies known by this thread
/// TODO: this map grows, but never shrinks. Issue #15258.
- window_proxies: DOMRefCell<HashMap<FrameId, JS<WindowProxy>>>,
+ window_proxies: DOMRefCell<HashMap<BrowsingContextId, JS<WindowProxy>>>,
/// A list of data pertaining to loads that have not yet received a network response
incomplete_loads: DOMRefCell<Vec<InProgressLoad>>,
/// A map to store service worker registrations for a given origin
@@ -538,11 +540,11 @@ impl ScriptThreadFactory for ScriptThread {
thread::Builder::new().name(format!("ScriptThread {:?}", state.id)).spawn(move || {
thread_state::initialize(thread_state::SCRIPT);
PipelineNamespace::install(state.pipeline_namespace_id);
- FrameId::install(state.top_level_frame_id);
+ BrowsingContextId::install(state.top_level_browsing_context_id);
let roots = RootCollection::new();
let _stack_roots_tls = StackRootTLS::new(&roots);
let id = state.id;
- let frame_id = state.frame_id;
+ let browsing_context_id = state.browsing_context_id;
let parent_info = state.parent_info;
let mem_profiler_chan = state.mem_profiler_chan.clone();
let window_size = state.window_size;
@@ -557,7 +559,7 @@ impl ScriptThreadFactory for ScriptThread {
let mut failsafe = ScriptMemoryFailsafe::new(&script_thread);
let origin = MutableOrigin::new(load_data.url.origin());
- let new_load = InProgressLoad::new(id, frame_id, parent_info,
+ let new_load = InProgressLoad::new(id, browsing_context_id, parent_info,
layout_chan, window_size, load_data.url.clone(), origin);
script_thread.start_page_load(new_load, load_data);
@@ -669,7 +671,7 @@ impl ScriptThread {
}))
}
- pub fn find_window_proxy(id: FrameId) -> Option<Root<WindowProxy>> {
+ pub fn find_window_proxy(id: BrowsingContextId) -> Option<Root<WindowProxy>> {
SCRIPT_THREAD_ROOT.with(|root| root.get().and_then(|script_thread| {
let script_thread = unsafe { &*script_thread };
script_thread.window_proxies.borrow().get(&id)
@@ -1049,8 +1051,8 @@ impl ScriptThread {
fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) {
match msg {
- ConstellationControlMsg::Navigate(parent_pipeline_id, frame_id, load_data, replace) =>
- self.handle_navigate(parent_pipeline_id, Some(frame_id), load_data, replace),
+ ConstellationControlMsg::Navigate(parent_pipeline_id, browsing_context_id, load_data, replace) =>
+ self.handle_navigate(parent_pipeline_id, Some(browsing_context_id), load_data, replace),
ConstellationControlMsg::SendEvent(id, event) =>
self.handle_event(id, event),
ConstellationControlMsg::ResizeInactive(id, new_size) =>
@@ -1061,22 +1063,22 @@ impl ScriptThread {
self.handle_set_document_activity_msg(pipeline_id, activity),
ConstellationControlMsg::ChangeFrameVisibilityStatus(pipeline_id, visible) =>
self.handle_visibility_change_msg(pipeline_id, visible),
- ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id, frame_id, visible) =>
- self.handle_visibility_change_complete_msg(parent_pipeline_id, frame_id, visible),
+ ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id, browsing_context_id, visible) =>
+ self.handle_visibility_change_complete_msg(parent_pipeline_id, browsing_context_id, visible),
ConstellationControlMsg::PostMessage(pipeline_id, origin, data) =>
self.handle_post_message_msg(pipeline_id, origin, data),
ConstellationControlMsg::MozBrowserEvent(parent_pipeline_id,
- frame_id,
+ browsing_context_id,
event) =>
self.handle_mozbrowser_event_msg(parent_pipeline_id,
- frame_id,
+ browsing_context_id,
event),
ConstellationControlMsg::UpdatePipelineId(parent_pipeline_id,
- frame_id,
+ browsing_context_id,
new_pipeline_id,
reason) =>
self.handle_update_pipeline_id(parent_pipeline_id,
- frame_id,
+ browsing_context_id,
new_pipeline_id,
reason),
ConstellationControlMsg::FocusIFrame(parent_pipeline_id, frame_id) =>
@@ -1089,9 +1091,9 @@ impl ScriptThread {
self.handle_transition_event(unsafe_node, name, duration),
ConstellationControlMsg::WebFontLoaded(pipeline_id) =>
self.handle_web_font_loaded(pipeline_id),
- ConstellationControlMsg::DispatchFrameLoadEvent {
- target: frame_id, parent: parent_id, child: child_id } =>
- self.handle_frame_load_event(parent_id, frame_id, child_id),
+ ConstellationControlMsg::DispatchIFrameLoadEvent {
+ target: browsing_context_id, parent: parent_id, child: child_id } =>
+ self.handle_iframe_load_event(parent_id, browsing_context_id, child_id),
ConstellationControlMsg::DispatchStorageEvent(pipeline_id, storage, url, key, old_value, new_value) =>
self.handle_storage_event(pipeline_id, storage, url, key, old_value, new_value),
ConstellationControlMsg::ReportCSSError(pipeline_id, filename, line, column, msg) =>
@@ -1224,8 +1226,8 @@ impl ScriptThread {
webdriver_handlers::handle_get_rect(&*documents, pipeline_id, node_id, reply),
WebDriverScriptCommand::GetElementText(node_id, reply) =>
webdriver_handlers::handle_get_text(&*documents, pipeline_id, node_id, reply),
- WebDriverScriptCommand::GetFrameId(frame_id, reply) =>
- webdriver_handlers::handle_get_frame_id(&*documents, pipeline_id, frame_id, reply),
+ WebDriverScriptCommand::GetPipelineId(browsing_context_id, reply) =>
+ webdriver_handlers::handle_get_pipeline_id(&*documents, pipeline_id, browsing_context_id, reply),
WebDriverScriptCommand::GetUrl(reply) =>
webdriver_handlers::handle_get_url(&*documents, pipeline_id, reply),
WebDriverScriptCommand::IsEnabled(element_id, reply) =>
@@ -1292,7 +1294,7 @@ impl ScriptThread {
let NewLayoutInfo {
parent_info,
new_pipeline_id,
- frame_id,
+ browsing_context_id,
load_data,
window_size,
pipeline_port,
@@ -1328,7 +1330,7 @@ impl ScriptThread {
};
// Kick off the fetch for the new resource.
- let new_load = InProgressLoad::new(new_pipeline_id, frame_id, parent_info,
+ let new_load = InProgressLoad::new(new_pipeline_id, browsing_context_id, parent_info,
layout_chan, window_size,
load_data.url.clone(), origin);
if load_data.url.as_str() == "about:blank" {
@@ -1369,8 +1371,12 @@ impl ScriptThread {
}
/// Updates iframe element after a change in visibility
- fn handle_visibility_change_complete_msg(&self, parent_pipeline_id: PipelineId, id: FrameId, visible: bool) {
- let iframe = self.documents.borrow().find_iframe(parent_pipeline_id, id);
+ fn handle_visibility_change_complete_msg(&self,
+ parent_pipeline_id: PipelineId,
+ browsing_context_id: BrowsingContextId,
+ visible: bool)
+ {
+ let iframe = self.documents.borrow().find_iframe(parent_pipeline_id, browsing_context_id);
if let Some(iframe) = iframe {
iframe.change_visibility_status(visible);
}
@@ -1418,9 +1424,9 @@ impl ScriptThread {
fn handle_focus_iframe_msg(&self,
parent_pipeline_id: PipelineId,
- frame_id: FrameId) {
+ browsing_context_id: BrowsingContextId) {
let doc = self.documents.borrow().find_document(parent_pipeline_id).unwrap();
- let frame_element = doc.find_iframe(frame_id);
+ let frame_element = doc.find_iframe(browsing_context_id);
if let Some(ref frame_element) = frame_element {
doc.begin_focus_transaction();
@@ -1440,17 +1446,17 @@ impl ScriptThread {
/// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart
fn handle_mozbrowser_event_msg(&self,
parent_pipeline_id: PipelineId,
- frame_id: Option<FrameId>,
+ browsing_context_id: Option<BrowsingContextId>,
event: MozBrowserEvent) {
let doc = match { self.documents.borrow().find_document(parent_pipeline_id) } {
- None => return warn!("Mozbrowser event after pipeline {:?} closed.", parent_pipeline_id),
+ None => return warn!("Mozbrowser event after pipeline {} closed.", parent_pipeline_id),
Some(doc) => doc,
};
- match frame_id {
+ match browsing_context_id {
None => doc.window().dispatch_mozbrowser_event(event),
- Some(frame_id) => match doc.find_iframe(frame_id) {
- None => warn!("Mozbrowser event after iframe {:?}/{:?} closed.", parent_pipeline_id, frame_id),
+ Some(browsing_context_id) => match doc.find_iframe(browsing_context_id) {
+ None => warn!("Mozbrowser event after iframe {}/{} closed.", parent_pipeline_id, browsing_context_id),
Some(frame_element) => frame_element.dispatch_mozbrowser_event(event),
},
}
@@ -1458,10 +1464,10 @@ impl ScriptThread {
fn handle_update_pipeline_id(&self,
parent_pipeline_id: PipelineId,
- frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
new_pipeline_id: PipelineId,
reason: UpdatePipelineIdReason) {
- let frame_element = self.documents.borrow().find_iframe(parent_pipeline_id, frame_id);
+ let frame_element = self.documents.borrow().find_iframe(parent_pipeline_id, browsing_context_id);
if let Some(frame_element) = frame_element {
frame_element.update_pipeline_id(new_pipeline_id, reason);
}
@@ -1690,18 +1696,22 @@ impl ScriptThread {
storage.queue_storage_event(url, key, old_value, new_value);
}
- /// Notify the containing document of a child frame that has completed loading.
- fn handle_frame_load_event(&self, parent_id: PipelineId, frame_id: FrameId, child_id: PipelineId) {
- let iframe = self.documents.borrow().find_iframe(parent_id, frame_id);
+ /// Notify the containing document of a child iframe that has completed loading.
+ fn handle_iframe_load_event(&self,
+ parent_id: PipelineId,
+ browsing_context_id: BrowsingContextId,
+ child_id: PipelineId)
+ {
+ let iframe = self.documents.borrow().find_iframe(parent_id, browsing_context_id);
match iframe {
Some(iframe) => iframe.iframe_load_event_steps(child_id),
None => warn!("Message sent to closed pipeline {}.", parent_id),
}
}
- fn ask_constellation_for_frame_id(&self, pipeline_id: PipelineId) -> Option<FrameId> {
+ fn ask_constellation_for_browsing_context_id(&self, pipeline_id: PipelineId) -> Option<BrowsingContextId> {
let (result_sender, result_receiver) = ipc::channel().unwrap();
- let msg = ConstellationMsg::GetFrameId(pipeline_id, result_sender);
+ let msg = ConstellationMsg::GetBrowsingContextId(pipeline_id, result_sender);
self.constellation_chan.send(msg).expect("Failed to send to constellation.");
result_receiver.recv().expect("Failed to get frame id from constellation.")
}
@@ -1724,19 +1734,19 @@ impl ScriptThread {
pipeline_id: PipelineId)
-> Option<Root<WindowProxy>>
{
- let frame_id = match self.ask_constellation_for_frame_id(pipeline_id) {
- Some(frame_id) => frame_id,
+ let browsing_context_id = match self.ask_constellation_for_browsing_context_id(pipeline_id) {
+ Some(browsing_context_id) => browsing_context_id,
None => return None,
};
- if let Some(window_proxy) = self.window_proxies.borrow().get(&frame_id) {
+ if let Some(window_proxy) = self.window_proxies.borrow().get(&browsing_context_id) {
return Some(Root::from_ref(window_proxy));
}
let parent = match self.ask_constellation_for_parent_info(pipeline_id) {
Some((parent_id, FrameType::IFrame)) => self.remote_window_proxy(global_to_clone, parent_id),
_ => None,
};
- let window_proxy = WindowProxy::new_dissimilar_origin(global_to_clone, frame_id, parent.r());
- self.window_proxies.borrow_mut().insert(frame_id, JS::from_ref(&*window_proxy));
+ let window_proxy = WindowProxy::new_dissimilar_origin(global_to_clone, browsing_context_id, parent.r());
+ self.window_proxies.borrow_mut().insert(browsing_context_id, JS::from_ref(&*window_proxy));
Some(window_proxy)
}
@@ -1748,16 +1758,16 @@ impl ScriptThread {
// to the `window_proxies` map, and return it.
fn local_window_proxy(&self,
window: &Window,
- frame_id: FrameId,
+ browsing_context_id: BrowsingContextId,
parent_info: Option<(PipelineId, FrameType)>)
-> Root<WindowProxy>
{
- if let Some(window_proxy) = self.window_proxies.borrow().get(&frame_id) {
+ if let Some(window_proxy) = self.window_proxies.borrow().get(&browsing_context_id) {
window_proxy.set_currently_active(&*window);
return Root::from_ref(window_proxy);
}
let iframe = match parent_info {
- Some((parent_id, FrameType::IFrame)) => self.documents.borrow().find_iframe(parent_id, frame_id),
+ Some((parent_id, FrameType::IFrame)) => self.documents.borrow().find_iframe(parent_id, browsing_context_id),
_ => None,
};
let parent = match (parent_info, iframe.as_ref()) {
@@ -1765,8 +1775,8 @@ impl ScriptThread {
(Some((parent_id, FrameType::IFrame)), _) => self.remote_window_proxy(window.upcast(), parent_id),
_ => None,
};
- let window_proxy = WindowProxy::new(&window, frame_id, iframe.r().map(Castable::upcast), parent.r());
- self.window_proxies.borrow_mut().insert(frame_id, JS::from_ref(&*window_proxy));
+ let window_proxy = WindowProxy::new(&window, browsing_context_id, iframe.r().map(Castable::upcast), parent.r());
+ self.window_proxies.borrow_mut().insert(browsing_context_id, JS::from_ref(&*window_proxy));
window_proxy
}
@@ -1823,7 +1833,7 @@ impl ScriptThread {
self.webvr_thread.clone());
// Initialize the browsing context for the window.
- let window_proxy = self.local_window_proxy(&window, incomplete.frame_id, incomplete.parent_info);
+ let window_proxy = self.local_window_proxy(&window, incomplete.browsing_context_id, incomplete.parent_info);
window.init_window_proxy(&window_proxy);
let last_modified = metadata.headers.as_ref().and_then(|headers| {
@@ -2093,12 +2103,12 @@ impl ScriptThread {
/// The entry point for content to notify that a new load has been requested
/// for the given pipeline (specifically the "navigate" algorithm).
fn handle_navigate(&self, parent_pipeline_id: PipelineId,
- frame_id: Option<FrameId>,
+ browsing_context_id: Option<BrowsingContextId>,
load_data: LoadData,
replace: bool) {
- match frame_id {
- Some(frame_id) => {
- let iframe = self.documents.borrow().find_iframe(parent_pipeline_id, frame_id);
+ match browsing_context_id {
+ Some(browsing_context_id) => {
+ let iframe = self.documents.borrow().find_iframe(parent_pipeline_id, browsing_context_id);
if let Some(iframe) = iframe {
iframe.navigate_or_reload_child_browsing_context(Some(load_data), NavigationType::Regular, replace);
}
diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs
index 7e7fe95122b..7bc31263c25 100644
--- a/components/script/webdriver_handlers.rs
+++ b/components/script/webdriver_handlers.rs
@@ -109,10 +109,10 @@ pub fn handle_execute_async_script(documents: &Documents,
window.upcast::<GlobalScope>().evaluate_js_on_global_with_result(&eval, rval.handle_mut());
}
-pub fn handle_get_frame_id(documents: &Documents,
- pipeline: PipelineId,
- webdriver_frame_id: WebDriverFrameId,
- reply: IpcSender<Result<Option<PipelineId>, ()>>) {
+pub fn handle_get_pipeline_id(documents: &Documents,
+ pipeline: PipelineId,
+ webdriver_frame_id: WebDriverFrameId,
+ reply: IpcSender<Result<Option<PipelineId>, ()>>) {
let result = match webdriver_frame_id {
WebDriverFrameId::Short(_) => {
// This isn't supported yet
diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs
index 9219f1e4b09..4f2870aace0 100644
--- a/components/script_layout_interface/wrapper_traits.rs
+++ b/components/script_layout_interface/wrapper_traits.rs
@@ -11,7 +11,7 @@ use SVGSVGData;
use atomic_refcell::AtomicRefCell;
use gfx_traits::{ByteIndex, FragmentType, combine_id_with_fragment_type};
use html5ever::{Namespace, LocalName};
-use msg::constellation_msg::{FrameId, PipelineId};
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
use range::Range;
use servo_url::ServoUrl;
use std::fmt::Debug;
@@ -272,9 +272,9 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
fn svg_data(&self) -> Option<SVGSVGData>;
- /// If this node is an iframe element, returns its frame ID. If this node is
+ /// If this node is an iframe element, returns its browsing context ID. If this node is
/// not an iframe element, fails.
- fn iframe_frame_id(&self) -> FrameId;
+ fn iframe_browsing_context_id(&self) -> BrowsingContextId;
/// If this node is an iframe element, returns its pipeline ID. If this node is
/// not an iframe element, fails.
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index bfc1e63fcc8..889a06e5cb3 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -53,7 +53,7 @@ use hyper::header::Headers;
use hyper::method::Method;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::c_void;
-use msg::constellation_msg::{FrameId, FrameType, Key, KeyModifiers, KeyState};
+use msg::constellation_msg::{BrowsingContextId, FrameType, Key, KeyModifiers, KeyState};
use msg::constellation_msg::{PipelineId, PipelineNamespaceId, TraversalDirection};
use net_traits::{ReferrerPolicy, ResourceThreads};
use net_traits::image::base::Image;
@@ -179,8 +179,8 @@ pub struct NewLayoutInfo {
pub parent_info: Option<(PipelineId, FrameType)>,
/// Id of the newly-created pipeline.
pub new_pipeline_id: PipelineId,
- /// Id of the frame associated with this pipeline.
- pub frame_id: FrameId,
+ /// Id of the browsing context associated with this pipeline.
+ pub browsing_context_id: BrowsingContextId,
/// Network request data which will be initiated by the script thread.
pub load_data: LoadData,
/// Information about the initial window size.
@@ -253,22 +253,22 @@ pub enum ConstellationControlMsg {
/// Notifies script thread whether frame is visible
ChangeFrameVisibilityStatus(PipelineId, bool),
/// Notifies script thread that frame visibility change is complete
- /// PipelineId is for the parent, FrameId is for the actual frame.
- NotifyVisibilityChange(PipelineId, FrameId, bool),
+ /// PipelineId is for the parent, BrowsingContextId is for the nested browsing context
+ NotifyVisibilityChange(PipelineId, BrowsingContextId, bool),
/// Notifies script thread that a url should be loaded in this iframe.
- /// PipelineId is for the parent, FrameId is for the actual frame.
- Navigate(PipelineId, FrameId, LoadData, bool),
+ /// PipelineId is for the parent, BrowsingContextId is for the nested browsing context
+ Navigate(PipelineId, BrowsingContextId, LoadData, bool),
/// Post a message to a given window.
PostMessage(PipelineId, Option<ImmutableOrigin>, Vec<u8>),
/// Requests the script thread forward a mozbrowser event to an iframe it owns,
- /// or to the window if no child frame id is provided.
- MozBrowserEvent(PipelineId, Option<FrameId>, MozBrowserEvent),
+ /// or to the window if no browsing context id is provided.
+ MozBrowserEvent(PipelineId, Option<BrowsingContextId>, MozBrowserEvent),
/// Updates the current pipeline ID of a given iframe.
/// First PipelineId is for the parent, second is the new PipelineId for the frame.
- UpdatePipelineId(PipelineId, FrameId, PipelineId, UpdatePipelineIdReason),
+ UpdatePipelineId(PipelineId, BrowsingContextId, PipelineId, UpdatePipelineIdReason),
/// Set an iframe to be focused. Used when an element in an iframe gains focus.
- /// PipelineId is for the parent, FrameId is for the actual frame.
- FocusIFrame(PipelineId, FrameId),
+ /// PipelineId is for the parent, BrowsingContextId is for the nested browsing context
+ FocusIFrame(PipelineId, BrowsingContextId),
/// Passes a webdriver command to the script thread for execution
WebDriverScriptCommand(PipelineId, WebDriverScriptCommand),
/// Notifies script thread that all animations are done
@@ -278,10 +278,10 @@ pub enum ConstellationControlMsg {
/// Notifies the script thread that a new Web font has been loaded, and thus the page should be
/// reflowed.
WebFontLoaded(PipelineId),
- /// Cause a `load` event to be dispatched at the appropriate frame element.
- DispatchFrameLoadEvent {
+ /// Cause a `load` event to be dispatched at the appropriate iframe element.
+ DispatchIFrameLoadEvent {
/// The frame that has been marked as loaded.
- target: FrameId,
+ target: BrowsingContextId,
/// The pipeline that contains a frame loading the target pipeline.
parent: PipelineId,
/// The pipeline that has completed loading.
@@ -323,7 +323,7 @@ impl fmt::Debug for ConstellationControlMsg {
TickAllAnimations(..) => "TickAllAnimations",
TransitionEnd(..) => "TransitionEnd",
WebFontLoaded(..) => "WebFontLoaded",
- DispatchFrameLoadEvent { .. } => "DispatchFrameLoadEvent",
+ DispatchIFrameLoadEvent { .. } => "DispatchIFrameLoadEvent",
DispatchStorageEvent(..) => "DispatchStorageEvent",
ReportCSSError(..) => "ReportCSSError",
Reload(..) => "Reload",
@@ -489,9 +489,9 @@ pub struct InitialScriptState {
/// If `None`, this is the root.
pub parent_info: Option<(PipelineId, FrameType)>,
/// The ID of the frame this script is part of.
- pub frame_id: FrameId,
+ pub browsing_context_id: BrowsingContextId,
/// The ID of the top-level frame this script is part of.
- pub top_level_frame_id: FrameId,
+ pub top_level_browsing_context_id: BrowsingContextId,
/// A channel with which messages can be sent to us (the script thread).
pub control_chan: IpcSender<ConstellationControlMsg>,
/// A port on which messages sent by the constellation to script can be received.
@@ -549,7 +549,7 @@ pub struct IFrameLoadInfo {
/// Pipeline ID of the parent of this iframe
pub parent_pipeline_id: PipelineId,
/// The ID for this iframe.
- pub frame_id: FrameId,
+ pub browsing_context_id: BrowsingContextId,
/// The new pipeline ID that the iframe has generated.
pub new_pipeline_id: PipelineId,
/// Whether this iframe should be considered private
@@ -732,13 +732,13 @@ pub enum WebDriverCommandMsg {
pub enum ConstellationMsg {
/// Exit the constellation.
Exit,
- /// Request that the constellation send the FrameId corresponding to the document
+ /// Request that the constellation send the BrowsingContextId corresponding to the document
/// with the provided pipeline id
- GetFrame(PipelineId, IpcSender<Option<FrameId>>),
+ GetBrowsingContext(PipelineId, IpcSender<Option<BrowsingContextId>>),
/// Request that the constellation send the current pipeline id for the provided frame
/// id, or for the root frame if this is None, over a provided channel.
/// Also returns a boolean saying whether the document has finished loading or not.
- GetPipeline(Option<FrameId>, IpcSender<Option<PipelineId>>),
+ GetPipeline(Option<BrowsingContextId>, IpcSender<Option<PipelineId>>),
/// Requests that the constellation inform the compositor of the title of the pipeline
/// immediately.
GetPipelineTitle(PipelineId),
@@ -760,8 +760,8 @@ pub enum ConstellationMsg {
WebDriverCommand(WebDriverCommandMsg),
/// Reload the current page.
Reload,
- /// A log entry, with the top-level frame id and thread name
- LogEntry(Option<FrameId>, Option<String>, LogEntry),
+ /// A log entry, with the top-level browsing context id and thread name
+ LogEntry(Option<BrowsingContextId>, Option<String>, LogEntry),
/// Set the WebVR thread channel.
SetWebVRThread(IpcSender<WebVRMsg>),
/// Dispatch WebVR events to the subscribed script threads.
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs
index 0402e3ddad6..d34f2feeb5f 100644
--- a/components/script_traits/script_msg.rs
+++ b/components/script_traits/script_msg.rs
@@ -17,7 +17,7 @@ use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
use euclid::point::Point2D;
use euclid::size::{Size2D, TypedSize2D};
use ipc_channel::ipc::IpcSender;
-use msg::constellation_msg::{FrameId, FrameType, PipelineId, TraversalDirection};
+use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId, TraversalDirection};
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
use net_traits::CoreResourceMsg;
use net_traits::storage_thread::StorageType;
@@ -34,8 +34,8 @@ use webrender_traits::ClipId;
pub enum LayoutMsg {
/// Indicates whether this pipeline is currently running animations.
ChangeRunningAnimationsState(PipelineId, AnimationState),
- /// Inform the constellation of the size of the frame's viewport.
- FrameSizes(Vec<(FrameId, TypedSize2D<f32, CSSPixel>)>),
+ /// Inform the constellation of the size of the iframe's viewport.
+ IFrameSizes(Vec<(BrowsingContextId, TypedSize2D<f32, CSSPixel>)>),
/// Requests that the constellation inform the compositor of the a cursor change.
SetCursor(Cursor),
/// Notifies the constellation that the viewport has been constrained in some manner
@@ -87,7 +87,7 @@ pub enum ScriptMsg {
/// Requests that the constellation retrieve the current contents of the clipboard
GetClipboardContents(IpcSender<String>),
/// Get the frame id for a given pipeline.
- GetFrameId(PipelineId, IpcSender<Option<FrameId>>),
+ GetBrowsingContextId(PipelineId, IpcSender<Option<BrowsingContextId>>),
/// Get the parent info for a given pipeline.
GetParentInfo(PipelineId, IpcSender<Option<(PipelineId, FrameType)>>),
/// <head> tag finished parsing
@@ -99,7 +99,7 @@ pub enum ScriptMsg {
/// instead of adding a new entry.
LoadUrl(PipelineId, LoadData, bool),
/// Post a message to the currently active window of a given browsing context.
- PostMessage(FrameId, Option<ImmutableOrigin>, Vec<u8>),
+ PostMessage(BrowsingContextId, Option<ImmutableOrigin>, Vec<u8>),
/// Dispatch a mozbrowser event to the parent of this pipeline.
/// The first PipelineId is for the parent, the second is for the originating pipeline.
MozBrowserEvent(PipelineId, PipelineId, MozBrowserEvent),
@@ -113,7 +113,7 @@ pub enum ScriptMsg {
NodeStatus(Option<String>),
/// Notification that this iframe should be removed.
/// Returns a list of pipelines which were closed.
- RemoveIFrame(FrameId, IpcSender<Vec<PipelineId>>),
+ RemoveIFrame(BrowsingContextId, IpcSender<Vec<PipelineId>>),
/// Change pipeline visibility
SetVisible(PipelineId, bool),
/// Notifies constellation that an iframe's visibility has been changed.
@@ -147,8 +147,8 @@ pub enum ScriptMsg {
ResizeTo(Size2D<u32>),
/// Script has handled a touch event, and either prevented or allowed default actions.
TouchEventProcessed(EventResult),
- /// A log entry, with the top-level frame id and thread name
- LogEntry(Option<FrameId>, Option<String>, LogEntry),
+ /// A log entry, with the top-level browsing context id and thread name
+ LogEntry(Option<BrowsingContextId>, Option<String>, LogEntry),
/// Notifies the constellation that this pipeline has exited.
PipelineExited(PipelineId),
/// Send messages from postMessage calls from serviceworker
diff --git a/components/script_traits/webdriver_msg.rs b/components/script_traits/webdriver_msg.rs
index c09f1f19dae..b92e32ff65c 100644
--- a/components/script_traits/webdriver_msg.rs
+++ b/components/script_traits/webdriver_msg.rs
@@ -31,7 +31,7 @@ pub enum WebDriverScriptCommand {
GetElementRect(String, IpcSender<Result<Rect<f64>, ()>>),
GetElementTagName(String, IpcSender<Result<String, ()>>),
GetElementText(String, IpcSender<Result<String, ()>>),
- GetFrameId(WebDriverFrameId, IpcSender<Result<Option<PipelineId>, ()>>),
+ GetPipelineId(WebDriverFrameId, IpcSender<Result<Option<PipelineId>, ()>>),
GetUrl(IpcSender<ServoUrl>),
IsEnabled(String, IpcSender<Result<bool, ()>>),
IsSelected(String, IpcSender<Result<bool, ()>>),
diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs
index 250ad21813b..404f965bbb9 100644
--- a/components/webdriver_server/lib.rs
+++ b/components/webdriver_server/lib.rs
@@ -32,7 +32,7 @@ use hyper::method::Method::{self, Post};
use image::{DynamicImage, ImageFormat, RgbImage};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use keys::keycodes_to_keys;
-use msg::constellation_msg::{FrameId, PipelineId, TraversalDirection};
+use msg::constellation_msg::{BrowsingContextId, PipelineId, TraversalDirection};
use net_traits::image::base::PixelFormat;
use regex::Captures;
use rustc_serialize::json::{Json, ToJson};
@@ -102,7 +102,7 @@ pub fn start_server(port: u16, constellation_chan: Sender<ConstellationMsg>) {
/// Represents the current WebDriver session and holds relevant session state.
struct WebDriverSession {
id: Uuid,
- frame_id: Option<FrameId>,
+ browsing_context_id: Option<BrowsingContextId>,
/// Time to wait for injected scripts to run before interrupting them. A [`None`] value
/// specifies that the script should run indefinitely.
@@ -120,7 +120,7 @@ impl WebDriverSession {
pub fn new() -> WebDriverSession {
WebDriverSession {
id: Uuid::new_v4(),
- frame_id: None,
+ browsing_context_id: None,
script_timeout: Some(30_000),
load_timeout: Some(300_000),
@@ -264,7 +264,7 @@ impl Handler {
}
}
- fn pipeline_id(&self, frame_id: Option<FrameId>) -> WebDriverResult<PipelineId> {
+ fn pipeline_id(&self, frame_id: Option<BrowsingContextId>) -> WebDriverResult<PipelineId> {
let interval = 20;
let iterations = 30_000 / interval;
let (sender, receiver) = ipc::channel().unwrap();
@@ -288,7 +288,7 @@ impl Handler {
}
fn frame_pipeline(&self) -> WebDriverResult<PipelineId> {
- self.pipeline_id(self.session.as_ref().and_then(|session| session.frame_id))
+ self.pipeline_id(self.session.as_ref().and_then(|session| session.browsing_context_id))
}
fn session(&self) -> WebDriverResult<&WebDriverSession> {
@@ -299,10 +299,10 @@ impl Handler {
}
}
- fn set_frame_id(&mut self, frame_id: Option<FrameId>) -> WebDriverResult<()> {
+ fn set_browsing_context_id(&mut self, browsing_context_id: Option<BrowsingContextId>) -> WebDriverResult<()> {
match self.session {
Some(ref mut x) => {
- x.frame_id = frame_id;
+ x.browsing_context_id = browsing_context_id;
Ok(())
},
None => Err(WebDriverError::new(ErrorStatus::SessionNotCreated,
@@ -525,7 +525,7 @@ impl Handler {
use webdriver::common::FrameId;
let frame_id = match parameters.id {
FrameId::Null => {
- self.set_frame_id(None).unwrap();
+ self.set_browsing_context_id(None).unwrap();
return Ok(WebDriverResponse::Void)
},
FrameId::Short(ref x) => WebDriverFrameId::Short(*x),
@@ -547,16 +547,16 @@ impl Handler {
}
let pipeline_id = try!(self.frame_pipeline());
let (sender, receiver) = ipc::channel().unwrap();
- let cmd = WebDriverScriptCommand::GetFrameId(frame_id, sender);
+ let cmd = WebDriverScriptCommand::GetPipelineId(frame_id, sender);
{
self.constellation_chan.send(ConstellationMsg::WebDriverCommand(
WebDriverCommandMsg::ScriptCommand(pipeline_id, cmd))).unwrap();
}
- let frame = match receiver.recv().unwrap() {
+ let context_id = match receiver.recv().unwrap() {
Ok(Some(pipeline_id)) => {
let (sender, receiver) = ipc::channel().unwrap();
- self.constellation_chan.send(ConstellationMsg::GetFrame(pipeline_id, sender)).unwrap();
+ self.constellation_chan.send(ConstellationMsg::GetBrowsingContext(pipeline_id, sender)).unwrap();
receiver.recv().unwrap()
},
Ok(None) => None,
@@ -566,7 +566,7 @@ impl Handler {
}
};
- self.set_frame_id(frame).unwrap();
+ self.set_browsing_context_id(context_id).unwrap();
Ok(WebDriverResponse::Void)
}