Open Bug 2008615 Opened 9 days ago Updated 13 hours ago

postMessage during visibiltychange with document.visibilityState == 'hidden' is dropped

Categories

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

defect

Tracking

()

ASSIGNED

People

(Reporter: jrmuizel, Assigned: asuth)

References

(Blocks 1 open bug)

Details

(Keywords: webcompat:platform-bug)

User Story

user-impact-score:360

See the test case from bug 2004106: https://bugzilla.mozilla.org/attachment.cgi?id=9535715

STR:

  • Load the testcase from a server other than bugzilla. (Bugzilla has cache headers that prevent BFCache from working)
  • Click the button to make noticing whether BFCache is being used more obvious
  • Click the wikipedia link
  • Go back
  • Observe the output

Expected:

Page startup
Received message: Hello from port1!
Button clicked
Document is now hidden
Sending message via the port
Document is now visible
Received message: port message is hidden

Actual:

Page startup
Received message: Hello from port1!
Button clicked
Button clicked
Document is now hidden
Sending message via the port
Document is now visible
Blocks: 2004106

We should probably make sure we don't drop the messages and just queue them instead.

Chrome seems to have a limit of 1 million messages. (I don't know where this is implemented). See https://bugzilla.mozilla.org/show_bug.cgi?id=2004106#c21

Olli, where's the right place to implement this?

User Story: (updated)

:smaug, :zcorpan, I have some questions about this non-normative text in regards to the port message queue I reference below; I was wondering if you could (briefly) lend your understanding; I don't think the non-normative text is supported by spec. At least as I'm reading this, it sounds like we'd somehow buffer the messages, but maybe the phrasing is just bad and it means to convey that the not-fully-active listeners will just miss (and never see) any messages received while they're not-fully-active?

If the document is fully active, but the event listeners were all created in the context of documents that are not fully active, then the messages will not be received unless and until the documents become fully active again.

Here's my understanding of the situation:

Assignee: nobody → bugmail
Severity: -- → S3
Status: NEW → ASSIGNED
Flags: needinfo?(zcorpan)
Flags: needinfo?(smaug)
Priority: -- → P2

The non-normative text was changed by domenic in https://github.com/whatwg/html/pull/5728 without anyone commenting about the change in the non-normative note. Tests for this change were https://github.com/web-platform-tests/wpt/pull/24566

I think the non-normative note is just trying to match what would fall out from implementing the normative requirements. I don't know if the note is actually correct.

If we don't bfcache the old doc when it has a transferred entangled port, it's not observable if messages are dropped or queued.

Flags: needinfo?(zcorpan)
Flags: needinfo?(smaug)
You need to log in before you can comment on or make changes to this bug.