Provide the source window as part of postMessage events.

This commit is contained in:
Josh Matthews 2018-12-20 16:16:51 -05:00
parent 212ae3b94a
commit 45619db0ba
12 changed files with 128 additions and 26 deletions

View file

@ -284,7 +284,18 @@ pub enum ConstellationControlMsg {
/// 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>),
PostMessage {
/// The target of the message.
target: PipelineId,
/// The source of the message.
source: PipelineId,
/// The top level browsing context associated with the source pipeline.
source_browsing_context: TopLevelBrowsingContextId,
/// The expected origin of the target.
target_origin: Option<ImmutableOrigin>,
/// The data to be posted.
data: Vec<u8>,
},
/// Updates the current pipeline ID of a given iframe.
/// First PipelineId is for the parent, second is the new PipelineId for the frame.
UpdatePipelineId(
@ -358,7 +369,7 @@ impl fmt::Debug for ConstellationControlMsg {
ChangeFrameVisibilityStatus(..) => "ChangeFrameVisibilityStatus",
NotifyVisibilityChange(..) => "NotifyVisibilityChange",
Navigate(..) => "Navigate",
PostMessage(..) => "PostMessage",
PostMessage { .. } => "PostMessage",
UpdatePipelineId(..) => "UpdatePipelineId",
UpdateHistoryState(..) => "UpdateHistoryState",
RemoveHistoryStates(..) => "RemoveHistoryStates",

View file

@ -134,7 +134,16 @@ pub enum ScriptMsg {
/// Abort loading after sending a LoadUrl message.
AbortLoadUrl,
/// Post a message to the currently active window of a given browsing context.
PostMessage(BrowsingContextId, Option<ImmutableOrigin>, Vec<u8>),
PostMessage {
/// The target of the posted message.
target: BrowsingContextId,
/// The source of the posted message.
source: PipelineId,
/// The expected origin of the target.
target_origin: Option<ImmutableOrigin>,
/// The data to be posted.
data: Vec<u8>,
},
/// Inform the constellation that a fragment was navigated to and whether or not it was a replacement navigation.
NavigatedToFragment(ServoUrl, bool),
/// HTMLIFrameElement Forward or Back traversal.
@ -209,7 +218,7 @@ impl fmt::Debug for ScriptMsg {
LoadComplete => "LoadComplete",
LoadUrl(..) => "LoadUrl",
AbortLoadUrl => "AbortLoadUrl",
PostMessage(..) => "PostMessage",
PostMessage { .. } => "PostMessage",
NavigatedToFragment(..) => "NavigatedToFragment",
TraverseHistory(..) => "TraverseHistory",
PushHistoryState(..) => "PushHistoryState",