New issue
Advanced search Search tips

Issue 866818 link

Starred by 3 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Bug



Sign in to add a comment

preventDefault did not work fine in beforeunload

Reported by xia.jaso...@gmail.com, Jul 24

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Steps to reproduce the problem:
1. Run `window.onbeforeunload = e => e.preventDefault()` in the console
2. Refresh current page

What is the expected behavior?
Prompt to block up the refreshing shows up

What went wrong?
No prompt show up

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 67.0.3396.99  Channel: stable
OS Version: OS X 10.13.4
Flash Version:
 
Chrome's implementation of the specification is inconsistent:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#unloading-documents:event-beforeunload

    8. If document's active sandboxing flag set does not have its sandboxed modals flag set, 
       and the returnValue attribute of the event object is not the empty string, 
       or if the event was canceled, then the user agent may ask the user to confirm [...].

Chrome implements "returnValue [...] is not the empty string" clause, but not "event was canceled" clause.
Observed since at least Chrome 30.
Labels: Needs-Triage-M67
Components: -Blink>DOM Blink>Internals
Cc: vamshi.kommuri@chromium.org
Labels: Triaged-ET Target-70 M-70 FoundIn-70 OS-Linux OS-Windows
Status: Untriaged (was: Unconfirmed)
Thanks for filing the issue!

Able to reproduce the issue on reported chrome version 67.0.3396.99 and on the latest canary 70.0.3501.0 using Mac 10.13.1, Windows 10 and Ubuntu 14.04

As the issue is seen from M60(60.0.3112.0) considering it as Non-Regression and marking it as Untriaged.
Components: -Blink>Internals Blink>Loader
Status: Available (was: Untriaged)
Components: -Blink>Loader Blink>PageLifecycle
Labels: OS-Android OS-Chrome
Owner: phistuck@chromium.org
Status: Started (was: Available)
I just bumped into this in my application a few days ago.

I submitted a change list to support that, currently in review -
https://crrev.com/c/1154225

Sign in to add a comment