Bug 169891 - Prevent new navigations from onbeforeunload handler
Summary: Prevent new navigations from onbeforeunload handler
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Events (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
: 169833 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-03-20 14:01 PDT by Daniel Bates
Modified: 2017-05-22 10:49 PDT (History)
9 users (show)

See Also:


Attachments
Patch and layout test (5.77 KB, patch)
2017-03-20 14:02 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch and layout test (5.81 KB, patch)
2017-03-20 14:11 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2017-03-20 14:01:15 PDT
We should not allow navigation initiated from an onberforeunload handler.
Comment 1 Radar WebKit Bug Importer 2017-03-20 14:01:57 PDT
<rdar://problem/31155736>
Comment 2 Daniel Bates 2017-03-20 14:02:58 PDT
Created attachment 304947 [details]
Patch and layout test
Comment 3 Simon Fraser (smfr) 2017-03-20 14:04:33 PDT
Comment on attachment 304947 [details]
Patch and layout test

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

> Source/WebCore/ChangeLog:3
> +        onbeforeunload handler may start new navigation

Would be nice to phrase this more actively: "onbeforeunload handler may start new navigation but should not be able to", or, better, "Prevent new navigations from onbeforeunload handler"
Comment 4 Daniel Bates 2017-03-20 14:04:36 PDT
Comment on attachment 304947 [details]
Patch and layout test

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

> LayoutTests/fast/events/before-unload-forbidden-navigation.html:15
> +var didFireOnBeforeLoad = false;

Will rename to didFireOnbeforeunloadEvent before landing. I am open to suggestions.
Comment 5 Daniel Bates 2017-03-20 14:11:22 PDT
Created attachment 304948 [details]
Patch and layout test

Updated ChangeLog to reflect updated bug title. Also renamed the variable didFireOnBeforeLoad to didFireBeforeUnloadEvent in the included test.
Comment 6 Daniel Bates 2017-03-20 16:07:58 PDT
Comment on attachment 304948 [details]
Patch and layout test

Clearing flags on attachment: 304948

Committed r214194: <http://trac.webkit.org/changeset/214194>
Comment 7 Daniel Bates 2017-03-20 16:08:03 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Brent Fulgham 2017-05-22 10:49:35 PDT
*** Bug 169833 has been marked as a duplicate of this bug. ***