Closed Bug 1760585 Opened 3 years ago Closed 2 years ago

onmidimessage called after a port has been closed

Categories

(Core :: DOM: Device Interfaces, defect, P2)

defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: padenot, Unassigned)

References

(Blocks 1 open bug)

Details

We have a report of onmidimessage still being called after close has been called, maybe something is off, we should invetigate.

Severity: -- → S3
Priority: -- → P2
Blocks: 1748641

Do we have an STR for this? I've double-checked the code and I've verified that:

  1. We check if a port is open before delivering a message
  2. Closing a port is async and we resolve the closing promise only after the port has been closed on the content side

So in theory it's impossible for us to deliver messages after a port is closed. It is possible that onmidimessage() gets called between a call to MIDIPort.close() and the resolution of the returned promise but that's to be expected since the API is asynchronous.

Flags: needinfo?(padenot)

I made a local test where a page sends messages in a loop to a through port and another page listens to them. As soon as I call MIDIPort.close() on the input port in the receiving page I can see that onmidimessage() stops being called. So I'm confident that at least in a simple scenario this works as expected.

Ok, we can probably close this, I'll follow up with the reporter (via email).

Flags: needinfo?(padenot)
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.