diff options
author | Alan Jeffrey <ajeffrey@mozilla.com> | 2017-05-15 16:09:49 -0500 |
---|---|---|
committer | Alan Jeffrey <ajeffrey@mozilla.com> | 2017-05-22 09:27:07 -0500 |
commit | 42577365b7924d0af64033d852447ff61579da3a (patch) | |
tree | 107d4646c361a97a1e72e7ccf13fa9370ebea06b /components/script_traits | |
parent | b428a94326322c88da4c32e56ee753ceeffca7d1 (diff) | |
download | servo-42577365b7924d0af64033d852447ff61579da3a.tar.gz servo-42577365b7924d0af64033d852447ff61579da3a.zip |
Added a TopLevelBrowsingContextId type.
Diffstat (limited to 'components/script_traits')
-rw-r--r-- | components/script_traits/lib.rs | 21 | ||||
-rw-r--r-- | components/script_traits/script_msg.rs | 4 |
2 files changed, 15 insertions, 10 deletions
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 889a06e5cb3..98e66ab8044 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::{BrowsingContextId, FrameType, Key, KeyModifiers, KeyState}; +use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, FrameType, Key, KeyModifiers, KeyState}; use msg::constellation_msg::{PipelineId, PipelineNamespaceId, TraversalDirection}; use net_traits::{ReferrerPolicy, ResourceThreads}; use net_traits::image::base::Image; @@ -181,6 +181,8 @@ pub struct NewLayoutInfo { pub new_pipeline_id: PipelineId, /// Id of the browsing context associated with this pipeline. pub browsing_context_id: BrowsingContextId, + /// Id of the top-level browsing context associated with this pipeline. + pub top_level_browsing_context_id: TopLevelBrowsingContextId, /// Network request data which will be initiated by the script thread. pub load_data: LoadData, /// Information about the initial window size. @@ -260,9 +262,9 @@ pub enum ConstellationControlMsg { 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, + /// Requests the script thread forward a mozbrowser event to a mozbrowser iframe it owns, /// or to the window if no browsing context id is provided. - MozBrowserEvent(PipelineId, Option<BrowsingContextId>, MozBrowserEvent), + MozBrowserEvent(PipelineId, Option<TopLevelBrowsingContextId>, 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, BrowsingContextId, PipelineId, UpdatePipelineIdReason), @@ -488,10 +490,10 @@ pub struct InitialScriptState { /// The subpage ID of this pipeline to create in its pipeline parent. /// If `None`, this is the root. pub parent_info: Option<(PipelineId, FrameType)>, - /// The ID of the frame this script is part of. + /// The ID of the browsing context this script is part of. pub browsing_context_id: BrowsingContextId, - /// The ID of the top-level frame this script is part of. - pub top_level_browsing_context_id: BrowsingContextId, + /// The ID of the top-level browsing context this script is part of. + pub top_level_browsing_context_id: TopLevelBrowsingContextId, /// 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. @@ -548,8 +550,11 @@ pub enum IFrameSandboxState { pub struct IFrameLoadInfo { /// Pipeline ID of the parent of this iframe pub parent_pipeline_id: PipelineId, - /// The ID for this iframe. + /// The ID for this iframe's nested browsing context. pub browsing_context_id: BrowsingContextId, + /// The ID for the top-level ancestor browsing context of this iframe's nested browsing context. + /// Note: this is the same as the browsing_context_id for mozbrowser iframes. + pub top_level_browsing_context_id: TopLevelBrowsingContextId, /// The new pipeline ID that the iframe has generated. pub new_pipeline_id: PipelineId, /// Whether this iframe should be considered private @@ -761,7 +766,7 @@ pub enum ConstellationMsg { /// Reload the current page. Reload, /// A log entry, with the top-level browsing context id and thread name - LogEntry(Option<BrowsingContextId>, Option<String>, LogEntry), + LogEntry(Option<TopLevelBrowsingContextId>, 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 d34f2feeb5f..1ebe6c17b5f 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::{BrowsingContextId, FrameType, PipelineId, TraversalDirection}; +use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, FrameType, PipelineId, TraversalDirection}; use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use net_traits::CoreResourceMsg; use net_traits::storage_thread::StorageType; @@ -148,7 +148,7 @@ pub enum ScriptMsg { /// Script has handled a touch event, and either prevented or allowed default actions. TouchEventProcessed(EventResult), /// A log entry, with the top-level browsing context id and thread name - LogEntry(Option<BrowsingContextId>, Option<String>, LogEntry), + LogEntry(Option<TopLevelBrowsingContextId>, Option<String>, LogEntry), /// Notifies the constellation that this pipeline has exited. PipelineExited(PipelineId), /// Send messages from postMessage calls from serviceworker |