postMessage queues a runnable task, see https://html.spec.whatwg.org/multipage/webappapis.html#concept-task-runnable but the implied document is no longer fully active when we actually dequeue the runnable to run, but for PostMessageEvent we don't check if our implied document (or in this case targetWindow) is fully active. This part of the spec is unclear and under-specified (see https://github.com/whatwg/html/issues/4980) so it's not easy to say exactly what should happen here. This closes the gap in behavior between chromium/safari and firefox. Differential Revision: https://phabricator.services.mozilla.com/D310341
20 lines
399 B
HTML
20 lines
399 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
</head>
|
|
<body>
|
|
Child Window (B)
|
|
<script>
|
|
'use strict';
|
|
|
|
// This message is sent from parent's unload handler and because we
|
|
// should be not-fully active by the time the queued task runs
|
|
// we should never receive this.
|
|
window.addEventListener('message', (msg) => {
|
|
window.parent.parent.postMessageTaskRan = true;
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|