Commit 3c41c9b3 authored by Adithya Srinivasan's avatar Adithya Srinivasan Committed by Chromium LUCI CQ

Portals: Fix postMessage calls in portals-focus.sub.html resources

Missed fixing these callsites in https://crrev.com/c/2386012.

Bug: 1126901
Change-Id: If94b71e0767bb222df3840185e7e00e515592fd2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616459Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Adithya Srinivasan <adithyas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841619}
parent b9d9f8b7
......@@ -4,7 +4,7 @@
function handleMessage(e) {
if (e.data == "focus") {
let button = document.querySelector("button");
button.onfocus = () => e.source.postMessage({focused: true}, "*");
button.onfocus = () => e.source.postMessage({focused: true}, {targetOrigin: "*"});
button.focus();
}
}
......@@ -22,7 +22,7 @@
window.onfocus = () => {
if (window.portalHost)
window.portalHost.postMessage("window focused", "*");
window.portalHost.postMessage("window focused");
};
</script>
<button>A</button>
......
......@@ -19,9 +19,9 @@
window.onmessage = e => {
if (window.portalHost)
window.portalHost.postMessage(e.data, "*");
window.portalHost.postMessage(e.data);
else
document.querySelector("portal").postMessage(e.data, "*");
document.querySelector("portal").postMessage(e.data);
}
</script>
<iframe src="http://{{hosts[alt][www]}}:{{ports[http][0]}}/portals/resources/focus-page-with-button.html"></iframe>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment