RESOLVED FIXED 204912
Prevent synchronous XHR in beforeunload / unload event handlers
https://bugs.webkit.org/show_bug.cgi?id=204912
Summary Prevent synchronous XHR in beforeunload / unload event handlers
Chris Dumez
Reported 2019-12-05 14:02:01 PST
Prevent synchronous XHR in beforeunload / unload event handlers. They are terrible for performance and the Beacon API (or Fetch keepalive) are more efficient & supported alternatives.
Attachments
Patch (12.86 KB, patch)
2019-12-05 14:39 PST, Chris Dumez
no flags
Patch (13.71 KB, patch)
2019-12-05 15:41 PST, Chris Dumez
no flags
Patch (15.56 KB, patch)
2019-12-06 08:37 PST, Chris Dumez
no flags
Patch (15.77 KB, patch)
2019-12-06 10:25 PST, Chris Dumez
no flags
Radar WebKit Bug Importer
Comment 1 2019-12-05 14:02:42 PST
Chris Dumez
Comment 2 2019-12-05 14:39:06 PST
Chris Dumez
Comment 3 2019-12-05 15:41:59 PST
Ryosuke Niwa
Comment 4 2019-12-05 17:01:20 PST
Comment on attachment 384970 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=384970&action=review > Source/WebCore/loader/DocumentThreadableLoader.cpp:134 > + if (!m_async && (!document.page() || !document.page()->areSynchronousLoadsAllowed())) { Seems like we want to put this behind some kind of a setting / feature flag?
Ryosuke Niwa
Comment 5 2019-12-05 17:01:33 PST
Do other browsers forbid this as well?
Sam Weinig
Comment 6 2019-12-06 06:42:04 PST
It seems like if we want to make this kind of change, we should first understand the compatibility story and if it's ok, make a change to HTML5 to standardize this. Otherwise, it's not clear why this is an ok change to make.
Chris Dumez
Comment 7 2019-12-06 08:12:59 PST
(In reply to Ryosuke Niwa from comment #5) > Do other browsers forbid this as well? No, other browsers do not do this at this time.
Chris Dumez
Comment 8 2019-12-06 08:15:05 PST
(In reply to Ryosuke Niwa from comment #5) > Do other browsers forbid this as well? Please see https://www.chromestatus.com/feature/4664843055398912
Chris Dumez
Comment 9 2019-12-06 08:16:09 PST
(In reply to Chris Dumez from comment #7) > (In reply to Ryosuke Niwa from comment #5) > > Do other browsers forbid this as well? > > No, other browsers do not do this at this time. Sorry, I meant the opposite. Not sure what happened there: Chrome has been testing this for a while: https://www.chromestatus.com/feature/4664843055398912
Chris Dumez
Comment 10 2019-12-06 08:25:28 PST
(In reply to Ryosuke Niwa from comment #4) > Comment on attachment 384970 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=384970&action=review > > > Source/WebCore/loader/DocumentThreadableLoader.cpp:134 > > + if (!m_async && (!document.page() || !document.page()->areSynchronousLoadsAllowed())) { > > Seems like we want to put this behind some kind of a setting / feature flag? Good idea, will do.
Chris Dumez
Comment 11 2019-12-06 08:37:24 PST
Chris Dumez
Comment 12 2019-12-06 10:25:38 PST
WebKit Commit Bot
Comment 13 2019-12-06 13:05:19 PST
Comment on attachment 385025 [details] Patch Clearing flags on attachment: 385025 Committed r253213: <https://trac.webkit.org/changeset/253213>
WebKit Commit Bot
Comment 14 2019-12-06 13:05:21 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.