Developer Tools "capture screenshot" unexpectedly triggers a window "beforeunload" event
Reported by
kan...@cakoose.com,
Apr 11 2018
|
|||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Steps to reproduce the problem:
1. Open a tab with the following HTML:
<html>
<script>
window.onbeforeunload = ev => console.log('beforeunload');
</script>
</html>
2. Press Cmd-Option-J to open the JavaScript console.
3. Press Cmd-Shift-P to show the command menu. Type in "Capture Screenshot" and select that option.
4. The screenshot will be taken (expected).
5. 'beforeunload' is printed to the console (unexpected).
What is the expected behavior?
What went wrong?
I didn't expect "Capture Screenshot" to trigger "beforeunload". Is that by design?
We use 'beforeunload' to trigger certain app shutdown behaviors. Is that a mistake?
Did this work before? N/A
Chrome version: 65.0.3325.181 Channel: stable
OS Version: OS X 10.13.3
Flash Version:
,
Sep 19
,
Sep 19
Nate, do you have an idea why clicking on a link which results in a download triggers beforeunload handler? We have <a download="filename"> link, so it should be crystal clear there is no navigation involved. |
|||
►
Sign in to add a comment |
|||
Comment 1 by pfeldman@chromium.org
, Apr 11 2018Owner: pfeldman@chromium.org
Status: Assigned (was: Unconfirmed)