Skip to content

[@web/dev-server-core] Listening for the unload event throws an error in Chrome #3150

Open

Description

@svanherk

Chrome is deprecating the unload event in a slow percentage-based rollout, so this error will become more prominent with each Chromium release.

Because @web/dev-server-core adds an event listener for unload, this error is thrown:

[Violation] Permissions policy violation: unload is not allowed in this document.

You can reproduce this by enabling the Chrome flag as described here to make it happen every time.

It looks like listening for this event was added recently in #3135, as a way to disable the back/forward cache.

Activity

  1. bashmish commented on Aug 12, 2026

    @bashmish
    Member

    That's unfortunate, I was hoping to solve it in a simple way, but with this it means we need to handle BFCache.
    Resumable WebSocket connection was the issue last time and we'll need to look into how to close it on BFCache event, that's technically possible.
    The problem is then that BFCache can also persist other things, so for each finding we might need another fix and another fix. I wanted to disable BFCache completely, but there seems to be no nice way of doing so.

  2. dlockhart commented on Aug 12, 2026

    @dlockhart
    Contributor

    @bashmish the Chrome developers have been very responsive in this group, so if you describe your scenario to them there they may have some suggestions.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions