New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 692203 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

onbeforeunload return value processing is not per-spec

Project Member Reported by domenic@chromium.org, Feb 14 2017

Issue description

Chrome Version: Version 58.0.3012.0 (Official Build) canary (64-bit)
OS: Windows 10

What steps will reproduce the problem?

Run the tests at https://w3c-test.org/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling.html. There are two issues:

1. The beforeunload dialog shows even for iframes, which is a bit surprising to me. That is not this bug, so just click "Leave" multiple times.

2. The failing tests.

The spec for this is at https://html.spec.whatwg.org/multipage/webappapis.html#the-event-handler-processing-algorithm. In particular, the return value processing is supposed to convert whatever value is given to a Web IDL DOMString?, and then react whenever it is non-null. That means inputs like "", true, 0 are supposed to cancel the event, whereas it appears in Chrome they do not.

 

Comment 1 by dcheng@chromium.org, Mar 27 2017

Cc: dcheng@chromium.org
Do the tests pass in other browsers?
They pass in Safari Tech Preview and in Firefox
Description: Show this description
Components: -Blink>Loader Blink>HTML
Labels: Hotlist-GoodFirstBug
Owner: dominicc@chromium.org
Status: Assigned (was: Untriaged)
http://stackoverflow.com/questions/10680544/beforeunload-chrome-issue might be relevant.

It looks like Document::DispatchBeforeUnloadEvent just consults DefaultPrevented and ReturnValue.IsNull but the IDL has DOMString and not DOMString?
Cc: dominicc@chromium.org
Owner: ----
Status: Available (was: Assigned)
Bulk disowning per sshruthi's email about bug triage best practices.

Comment 7 by rakina@chromium.org, Oct 11 2017

Cc: kochi@chromium.org
Owner: rakina@chromium.org
Status: Assigned (was: Available)
Project Member

Comment 8 by bugdroid1@chromium.org, Oct 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/530a82542c23ba43cd3bce7c325b78820bc636d5

commit 530a82542c23ba43cd3bce7c325b78820bc636d5
Author: Rakina Zata Amni <rakina@chromium.org>
Date: Fri Oct 20 10:34:41 2017

Don't cancel Events with type beforeunload

If we return the boolean false in a beforeunload eventlistener, the
unload event will get canceled. This is not per-spec, which is in
https://html.spec.whatwg.org/multipage/webappapis.html#the-event-handler-processing-algorithm 

This is because the return value of the event listener is not converted
to DOMString, because OnBeforeUnloadEventHandler is not currently
implemented. See:
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/frame/WindowEventHandlers.idl?q=beforeunloadeventhandler&dr=C&l=39

This is a temporary fix until OnBeforeUnloadEventHandler is
implemented, making sure that Events with the type beforeunload
won't get canceled (in accordance to the spec). 

Bug:  692203 
Change-Id: Ic31e8b90fb2edad173e99ac6a7d9059162a53278
Reviewed-on: https://chromium-review.googlesource.com/727863
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Reviewed-by: Takayoshi Kochi <kochi@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510398}
[delete] https://crrev.com/2cd618735fb87636b100642cacbe8705b9ab3199/third_party/WebKit/LayoutTests/external/wpt/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling-expected.txt
[modify] https://crrev.com/530a82542c23ba43cd3bce7c325b78820bc636d5/third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp

Comment 9 by rakina@chromium.org, Oct 20 2017

Status: Fixed (was: Assigned)

Sign in to add a comment