Skip to content

Conversation

@llannasatoll
Copy link

@llannasatoll llannasatoll commented Jan 15, 2026

The existing sharedworker string in notRestoredReason is a general back/forward cache block for pages with SharedWorker. To relax this, we are adding two specific strings:

  • sharedworker-message: Evicts a page from back/forward cache if it receives a message from its SharedWorker while cached.
  • sharedworker-with-no-active-client: Blocks or evicts a page if its connected SharedWorker no longer has active client. This ensures workers do not continue running without any active documents.

(See WHATWG Working Mode: Changes for more details.)


/nav-history-apis.html ( diff )

@llannasatoll
Copy link
Author

@smaug---- @annevk @rakina could you help to review this change?

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapping is incorrect. See the guidelines and previous PR of this sort.

@llannasatoll
Copy link
Author

Wrapping is incorrect. See the guidelines and previous PR of this sort.

Fixed the wrapping, sorry.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll leave this to Mozilla to okay as per the prior PRs.

export><code>sharedworker-with-no-active-client</code></dfn>"</dt>
<dd>This <code>Document</code> was in the <span>owner set</span> of a
<code>SharedWorkerGlobalScope</code> that is not <span data-x="active needed worker">actively
needed</span>.</dd>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't understand this. How is this a blocking reason?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When all clients enter BFCache, the SharedWorker is no longer actively needed. The User Agent might choose to terminate the worker to prevent resource waste and potential privacy risks associated with keeping it alive indefinitely.

Since this termination breaks the connections held by the BFCached clients, we must evict them to prevent restoring pages in a broken state. (Ideally, the SharedWorker would be frozen in this case to allow clients to remain in BFCache.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants