RESOLVED FIXED 196893
[Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
https://bugs.webkit.org/show_bug.cgi?id=196893
Summary [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProt...
Andy Estes
Reported 2019-04-12 20:20:21 PDT
[Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
Attachments
Patch (7.67 KB, patch)
2019-04-12 20:27 PDT, Andy Estes
no flags
Patch (7.60 KB, patch)
2019-04-12 21:05 PDT, Andy Estes
no flags
Patch (7.92 KB, patch)
2019-04-13 14:10 PDT, Andy Estes
no flags
Andy Estes
Comment 1 2019-04-12 20:26:00 PDT
Andy Estes
Comment 2 2019-04-12 20:27:06 PDT Comment hidden (obsolete)
Andy Estes
Comment 3 2019-04-12 21:05:24 PDT
Anders Carlsson
Comment 4 2019-04-13 07:57:58 PDT
Comment on attachment 367377 [details] Patch Assuming there are no thread safety issues and that LegacyCustomProtocolManagerProxy is always called from the same (main?) thread, r=me.
Darin Adler
Comment 5 2019-04-13 07:58:50 PDT
Comment on attachment 367377 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=367377&action=review Kinda wish we still canceled the load when the weak pointer became null. > Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:-77 > - ASSERT(_customProtocolManagerProxy); I think this assertion might still be good. The WeakPtr can protect us from mistakes, but we should always be canceling before destroying the proxy, for efficiency reasons if no other reasons. > Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:-78 > - _customProtocolManagerProxy = nullptr; Still might be good to null this out. Not sure. > Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:119 > - if (redirectResponse) { > + if (_customProtocolManagerProxy && redirectResponse) { > _customProtocolManagerProxy->wasRedirectedToRequest(_customProtocolID, request, redirectResponse); > return nil; > } Seems to me that if _customProtocolManagerProxy is null we should return nil, not request.
Andy Estes
Comment 6 2019-04-13 13:51:51 PDT
(In reply to Anders Carlsson from comment #4) > Comment on attachment 367377 [details] > Patch > > Assuming there are no thread safety issues and that > LegacyCustomProtocolManagerProxy is always called from the same (main?) > thread, r=me. LegacyCustomProtocolManagerProxy is always called from the main thread. Thanks for reviewing!
Andy Estes
Comment 7 2019-04-13 13:53:24 PDT
(In reply to Darin Adler from comment #5) > Comment on attachment 367377 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=367377&action=review > > Kinda wish we still canceled the load when the weak pointer became null. We should still cancel, because LegacyCustomProtocolManagerClient::invalidate() will still be called when the LegacyCustomProtocolManagerProxy is destroyed. > > > Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:-77 > > - ASSERT(_customProtocolManagerProxy); > > I think this assertion might still be good. The WeakPtr can protect us from > mistakes, but we should always be canceling before destroying the proxy, for > efficiency reasons if no other reasons. > > > Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:-78 > > - _customProtocolManagerProxy = nullptr; > > Still might be good to null this out. Not sure. I restored the assertion and the nulling. > > > Source/WebKit/UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:119 > > - if (redirectResponse) { > > + if (_customProtocolManagerProxy && redirectResponse) { > > _customProtocolManagerProxy->wasRedirectedToRequest(_customProtocolID, request, redirectResponse); > > return nil; > > } > > Seems to me that if _customProtocolManagerProxy is null we should return > nil, not request. Yes, that makes more sense. Thanks for your comments!
Andy Estes
Comment 8 2019-04-13 14:10:52 PDT
Andy Estes
Comment 9 2019-04-14 08:40:41 PDT
The api-mac failure is due to a flaky API test. I filed <https://bugs.webkit.org/show_bug.cgi?id=196905>.
WebKit Commit Bot
Comment 10 2019-04-14 09:08:29 PDT
Comment on attachment 367391 [details] Patch Clearing flags on attachment: 367391 Committed r244246: <https://trac.webkit.org/changeset/244246>
WebKit Commit Bot
Comment 11 2019-04-14 09:08:30 PDT
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.