Bug 169936 - WebKit should disallow beforeunload alerts from web pages users have never interacted with
Summary: WebKit should disallow beforeunload alerts from web pages users have never in...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://html.spec.whatwg.org/multipag...
Keywords: InRadar
Depends on:
Blocks: 169995
  Show dependency treegraph
 
Reported: 2017-03-21 16:38 PDT by Chris Dumez
Modified: 2017-03-22 22:20 PDT (History)
12 users (show)

See Also:


Attachments
WIP patch (1.77 KB, patch)
2017-03-21 16:40 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP patch (7.17 KB, patch)
2017-03-21 18:19 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (19.02 KB, patch)
2017-03-21 19:02 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews124 for ios-simulator-wk2 (13.19 MB, application/zip)
2017-03-21 22:36 PDT, Build Bot
no flags Details
Patch (20.06 KB, patch)
2017-03-22 09:13 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews121 for ios-simulator-wk2 (896.01 KB, application/zip)
2017-03-22 10:44 PDT, Build Bot
no flags Details
Patch (22.65 KB, patch)
2017-03-22 12:50 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (22.70 KB, patch)
2017-03-22 12:56 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (22.69 KB, patch)
2017-03-22 13:19 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-03-21 16:38:54 PDT
WebKit should disallow beforeunload alerts from web pages users have never interacted with.
Comment 1 Chris Dumez 2017-03-21 16:39:16 PDT
<rdar://problem/23798897>
Comment 2 Chris Dumez 2017-03-21 16:40:08 PDT
Created attachment 305048 [details]
WIP patch
Comment 3 Chris Dumez 2017-03-21 16:43:07 PDT
https://html.spec.whatwg.org/multipage/browsers.html#prompt-to-unload-a-document (Step 8):
"""
The user agent is encouraged to avoid asking the user for confirmation if it judges that doing so would be annoying, deceptive, or pointless. A simple heuristic might be that if the user has not interacted with the document, the user agent would not ask for confirmation before unloading it.
"""
Comment 4 Chris Dumez 2017-03-21 18:19:04 PDT
Created attachment 305057 [details]
WIP patch
Comment 5 Chris Dumez 2017-03-21 19:02:38 PDT
Created attachment 305063 [details]
Patch
Comment 6 Build Bot 2017-03-21 22:36:51 PDT
Comment on attachment 305063 [details]
Patch

Attachment 305063 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3379827

New failing tests:
fast/events/beforeunload-alert-user-interaction2.html
fast/loader/show-only-one-beforeunload-dialog.html
http/tests/misc/iframe-beforeunload-dialog-matching-ancestor-securityorigin.html
fast/events/beforeunload-alert-user-interaction.html
fast/loader/form-submission-after-beforeunload-cancel.html
http/tests/misc/iframe-beforeunload-dialog-not-matching-ancestor-securityorigin.html
Comment 7 Build Bot 2017-03-21 22:36:53 PDT
Created attachment 305078 [details]
Archive of layout-test-results from ews124 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews124  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 8 Chris Dumez 2017-03-22 09:13:37 PDT
Created attachment 305101 [details]
Patch
Comment 9 Build Bot 2017-03-22 10:44:35 PDT
Comment on attachment 305101 [details]
Patch

Attachment 305101 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3388119

New failing tests:
http/tests/misc/iframe-beforeunload-dialog-matching-ancestor-securityorigin.html
http/tests/misc/iframe-beforeunload-dialog-not-matching-ancestor-securityorigin.html
fast/loader/form-submission-after-beforeunload-cancel.html
fast/loader/show-only-one-beforeunload-dialog.html
Comment 10 Build Bot 2017-03-22 10:44:38 PDT
Created attachment 305108 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 11 Chris Dumez 2017-03-22 12:50:17 PDT
Created attachment 305116 [details]
Patch
Comment 12 Chris Dumez 2017-03-22 12:56:28 PDT
Created attachment 305118 [details]
Patch
Comment 13 Brent Fulgham 2017-03-22 13:16:35 PDT
Comment on attachment 305118 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=305118&action=review

Looks good. I had a question about whitespace in the test file, but nothing critical.

> LayoutTests/http/tests/misc/iframe-beforeunload-dialog-not-matching-ancestor-securityorigin.html:16
> +        // Simulate a user interaction with the page so that the beforeunload alert shows.

The indent on this comment looks strange. Is that what you intended? Or did we get a tab in the file?
Comment 14 Chris Dumez 2017-03-22 13:19:21 PDT
Created attachment 305121 [details]
Patch
Comment 15 Chris Dumez 2017-03-22 14:14:28 PDT
Comment on attachment 305121 [details]
Patch

Clearing flags on attachment: 305121

Committed r214277: <http://trac.webkit.org/changeset/214277>
Comment 16 Chris Dumez 2017-03-22 14:14:32 PDT
All reviewed patches have been landed.  Closing bug.