beforeunload dialog doesn't show when attached to top-level window but user gestures have occurred in an embedded iframe
Reported by
bed...@technicalpursuit.com,
Jun 30 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4 Steps to reproduce the problem: 1. Load a main page that has embedded iframe that is 100%/100% stretched across the body of the main page. This should install a beforeunload handler on the main window 2. Do some user gestures in the 100%/100% stretched iframe 3. Click the back button. What is the expected behavior? The beforeunload dialog will show What went wrong? The beforeunload dialog does not show and this message shows in the DevTools console: Blocked attempt to show a 'beforeunload' confirmation panel for a frame that never had a user gesture since its load. https://www.chromestatus.com/feature/5082396709879808 Did this work before? N/A Does this work in other browsers? Yes Chrome version: Version 61.0.3145.0 (Official Build) canary (64-bit) Channel: n/a OS Version: OS X 10.12.5 Flash Version: The implementation bug for this feature (https://bugs.chromium.org/p/chromium/issues/detail?id=707007&desc=4), states: "The beforeunload dialog will only be shown if the frame attempting to display it has received a user gesture or user interaction (or if any embedded frame has received such a gesture)." But clearly, even though an embedded frame is receiving user gestures, the beforeunload dialog box isn't showing.
,
Jun 30 2017
,
Jun 30 2017
The iframe itself doesn't have the beforeunload handlers. The main window is the one with the unload handler. But the iframe is stretched 100%/100% across the main window's body, so the main window never receives user gestures. I've attached a test case.
,
Jun 30 2017
Oops, I meant to say above "the main window is the one with the beforeunload handler". Sorry.
,
Jun 30 2017
In 61.0.3141.7, I load the file you provide in comment 2, and if I click within the iframe, or I type, I get a beforeunload dialog when I try to leave the page. Can you specify what user gesture you're doing?
,
Jun 30 2017
,
Jun 30 2017
Ha! I'm able to get it to do that here as well with a click or a keystroke. My user gesture, and the one I was testing this whole time, was: mouseover. Now, given the original intent of the feature, I understand that you all wouldn't want to include mouseover/mouseout as a valid user gesture and I concur. So here's two things I'd like you all to consider: 1. Can the red "error" text that shows "Blocked attempt to show a 'beforeunload' confirmation panel for a frame..." in the DevTools console be made a yellow "warning"? Basically, our users sometimes launch DevTools (sigh...) and they get freaked out when they see red errors. If we haven't lost any data because of no user interaction yet, then I think a warning-level message is reasonable. 2. Can the launch of DevTools be considered an "interaction" with the page, such that closing it after DevTools has launched would show the dialog? Sometimes, when we're interacting with the underlying data of a page (part of a client-side stateful SPA) in the DevTools console, we'll accidentally click reload out of habit and, when the dialog doesn't pop, we lose work. Thanks for your time on this!
,
Jul 1 2017
Correct; mouseover doesn't qualify as being a user gesture. 1. Users shouldn't be in devtools, and if this is just a warning, they'll freak out over something else. :\ 2. I'm not a devtools person, so I don't know. We have some exemptions about how just having the devtools open changes stuff, but I think they try to keep it as accurate as to how it works otherwise as they can.
,
Jul 1 2017
Fair enough. Thanks for your time looking into this. I really appreciate it! |
|||
►
Sign in to add a comment |
|||
Comment 1 by a...@chromium.org
, Jun 30 2017