Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

onbeforeunload not handled when closing tab #11809

Closed
petemill opened this issue Nov 6, 2017 · 3 comments
Closed

onbeforeunload not handled when closing tab #11809

petemill opened this issue Nov 6, 2017 · 3 comments

Comments

@petemill
Copy link
Member

petemill commented Nov 6, 2017

Description

When window.onbeforeunload is set, and it returns a string, the tab should not be closed unless the user confirms a prompt. This does not happen on Brave. #4079 states it is fixed, but it does not work as intended in either 0.19.x or 0.21.x, for tab close events. It does, however, work when refreshing or navigating away in the same tab.

Steps to Reproduce

  1. Visit http://petemill-code-samples.s3-website-us-west-1.amazonaws.com/onbeforeunload/
  2. Focus the tab content by clicking inside the content area
  3. Close the tab

Actual result:
Tab closes

Expected result:
A prompt should be shown confirming if the user really wants to close the tab.

Reproduces how often: 100%

Reproducible on current live release:
Yes

Additional Information

Chrome, Safari and Firefox all present dialogs with 'Leave' and 'Stay' buttons.

@petemill petemill added this to the Triage Backlog milestone Nov 6, 2017
@bsclifton bsclifton added the priority/P3 Major loss of function. label Nov 7, 2017
@bsclifton
Copy link
Member

codepen needs update

@petemill
Copy link
Member Author

petemill commented Nov 7, 2017

@petemill
Copy link
Member Author

petemill commented Nov 7, 2017

FYI it seems like the way that other browsers protect against malicious sites defining an 'alert' trail by traversing multiple sites which all define onbeforeunload handlers, is to require that some user focus be actioned inside a frame before allowing the handler to be registered.

@NejcZdovc NejcZdovc modified the milestones: Triage Backlog, Prioritized Backlog Nov 21, 2017
@bsclifton bsclifton added the stale label Sep 9, 2018
@bsclifton bsclifton removed this from the Backlog (Prioritized) milestone Sep 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants