Skip to content

Clarify EventSource behavior for documents entering and restoring from BFCache #12363

@zp1996

Description

@zp1996

What is the issue with the HTML Standard?

EventSource interaction with BFCache seems underspecified today.

As far as I can tell, the HTML Standard does not clearly define what should happen when an EventSource associated Document becomes non-fully-active due to entering the back/forward cache, and then later becomes fully active again when restored.

This appears to leave room for interop differences:

  • Safari allows the page to enter BFCache, closes the EventSource, and reconnects when the page is restored.
  • Chrome is moving toward matching Safari's behavior.
  • Firefox appears to keep such pages out of BFCache.

So I think it would be helpful to clarify the expected behavior for EventSource, for example along these lines:

  • when a document becomes non-fully-active due to BFCache, its EventSource should stop delivering events;
  • the user agent may close / fail the active connection at that point;
  • events that would have arrived while the document is in BFCache should not be queued for later delivery;
  • when the document is restored and becomes fully active again, the EventSource may resume through its normal reconnection behavior.

Relatedly, there is already BFCache-oriented guidance for spec in the TAG document “Supporting BFCached Documents”, but it seems like the normative clarification should live in the HTML Standard's EventSource processing model.

Would such a clarification be acceptable here? If so, I’d be happy to put together a PR.

cc: @ricea @rakina @annevk @zcorpan

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions