Skip to content

Commit

Permalink
Use the incumbent global as the source of x-origin postMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Jeffrey committed Apr 10, 2018
1 parent 07dd37a commit cef3f0e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/script/dom/dissimilaroriginwindow.rs
Expand Up @@ -192,9 +192,13 @@ impl DissimilarOriginWindowMethods for DissimilarOriginWindow {

impl DissimilarOriginWindow {
pub fn post_message(&self, origin: Option<ImmutableOrigin>, data: StructuredCloneData) {
let incumbent = match GlobalScope::incumbent() {
None => return warn!("postMessage called with no incumbent global"),
Some(incumbent) => incumbent,
};
let msg = ScriptMsg::PostMessage(self.window_proxy.browsing_context_id(),
origin,
data.move_to_arraybuffer());
let _ = self.upcast::<GlobalScope>().script_to_constellation_chan().send(msg);
let _ = incumbent.script_to_constellation_chan().send(msg);
}
}

0 comments on commit cef3f0e

Please sign in to comment.