Open Bug 1883187 Opened 7 months ago Updated 7 months ago

`message` event handler triggered after `MessagePort.close()`

Categories

(Core :: DOM: postMessage, defect, P3)

Firefox 123
defect

Tracking

()

ASSIGNED

People

(Reporter: daxpedda, Assigned: asuth)

Details

Description

I'm actually unsure if this is a bug or not, but the behavior between Chrome and Firefox differs here. Chrome does not trigger the message event handler after the MessagePort is closed, but Firefox does. In my attempt to understand the spec I couldn't find a clear answer.

Steps to reproduce

const channel = new MessageChannel
channel.port1.onmessage = () => console.log('message received')
channel.port2.postMessage(undefined)
channel.port1.close()
console.log('after `close`')

Actual results

after `close`
message received

Expected results

after `close`
Component: General → DOM: postMessage
Product: Firefox → Core
Version: unspecified → Firefox 123
Assignee: nobody → bugmail
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.