mirror of
https://github.com/servo/servo.git
synced 2025-08-09 23:45:35 +01:00
Provide the source window as part of postMessage events.
This commit is contained in:
parent
212ae3b94a
commit
45619db0ba
12 changed files with 128 additions and 26 deletions
|
@ -1279,8 +1279,13 @@ where
|
|||
warn!("constellation got set final url message for dead pipeline");
|
||||
}
|
||||
},
|
||||
FromScriptMsg::PostMessage(browsing_context_id, origin, data) => {
|
||||
self.handle_post_message_msg(browsing_context_id, origin, data);
|
||||
FromScriptMsg::PostMessage {
|
||||
target: browsing_context_id,
|
||||
source: source_pipeline_id,
|
||||
target_origin: origin,
|
||||
data,
|
||||
} => {
|
||||
self.handle_post_message_msg(browsing_context_id, source_pipeline_id, origin, data);
|
||||
},
|
||||
FromScriptMsg::Focus => {
|
||||
self.handle_focus_msg(source_pipeline_id);
|
||||
|
@ -2844,6 +2849,7 @@ where
|
|||
fn handle_post_message_msg(
|
||||
&mut self,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
source_pipeline: PipelineId,
|
||||
origin: Option<ImmutableOrigin>,
|
||||
data: Vec<u8>,
|
||||
) {
|
||||
|
@ -2856,7 +2862,17 @@ where
|
|||
},
|
||||
Some(browsing_context) => browsing_context.pipeline_id,
|
||||
};
|
||||
let msg = ConstellationControlMsg::PostMessage(pipeline_id, origin, data);
|
||||
let source_browsing_context = match self.pipelines.get(&source_pipeline) {
|
||||
Some(pipeline) => pipeline.top_level_browsing_context_id,
|
||||
None => return warn!("PostMessage from closed pipeline {:?}", source_pipeline),
|
||||
};
|
||||
let msg = ConstellationControlMsg::PostMessage {
|
||||
target: pipeline_id,
|
||||
source: source_pipeline,
|
||||
source_browsing_context: source_browsing_context,
|
||||
target_origin: origin,
|
||||
data,
|
||||
};
|
||||
let result = match self.pipelines.get(&pipeline_id) {
|
||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||
None => return warn!("postMessage to closed pipeline {}.", pipeline_id),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue