RESOLVED FIXED 224045
Pass the main frame URL to requestGeolocationAuthorizationForURL delegate SPI
https://bugs.webkit.org/show_bug.cgi?id=224045
Summary Pass the main frame URL to requestGeolocationAuthorizationForURL delegate SPI
youenn fablet
Reported 2021-04-01 06:09:41 PDT
Pass the main frame URL to requestGeolocationAuthorizationForURL delegate SPI
Attachments
Patch (12.46 KB, patch)
2021-04-01 06:14 PDT, youenn fablet
no flags
Patch (1.58 KB, patch)
2021-04-19 13:10 PDT, Alex Christensen
no flags
Patch (7.80 KB, patch)
2021-04-20 09:47 PDT, Alex Christensen
no flags
youenn fablet
Comment 1 2021-04-01 06:14:26 PDT
Radar WebKit Bug Importer
Comment 2 2021-04-01 08:09:20 PDT
Alex Christensen
Comment 3 2021-04-01 12:14:28 PDT
Comment on attachment 424889 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=424889&action=review > Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:-165 > -- (BOOL)_webView:(WKWebView *)webView shouldRequestGeolocationAuthorizationForURL:(NSURL *)url isMainFrame:(BOOL)isMainFrame mainFrameURL:(NSURL *)mainFrameURL; Are we sure nobody uses this?
youenn fablet
Comment 4 2021-04-02 01:03:51 PDT
(In reply to Alex Christensen from comment #3) > Comment on attachment 424889 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=424889&action=review > > > Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:-165 > > -- (BOOL)_webView:(WKWebView *)webView shouldRequestGeolocationAuthorizationForURL:(NSURL *)url isMainFrame:(BOOL)isMainFrame mainFrameURL:(NSURL *)mainFrameURL; > > Are we sure nobody uses this? I have not found any use through search tools.
EWS
Comment 5 2021-04-02 01:07:33 PDT
Committed r275407: <https://commits.webkit.org/r275407> All reviewed patches have been landed. Closing bug and clearing flags on attachment 424889 [details].
Chris Dumez
Comment 6 2021-04-19 13:06:08 PDT
Comment on attachment 424889 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=424889&action=review I think this may have caused rdar://76791065 > Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm:182 > + Function<void(bool)> decisionHandler = [completionHandler = WTFMove(request.completionHandler), protectedSelf = retainPtr(self)](bool result) { request.completionHandler gets moved here. > Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm:200 > + auto policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithCompletionHandler:WTFMove(request.completionHandler)]); This looks like a use-after-move of request.completionHandler ?
Alex Christensen
Comment 7 2021-04-19 13:07:35 PDT
Comment on attachment 424889 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=424889&action=review >> Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm:200 >> + auto policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithCompletionHandler:WTFMove(request.completionHandler)]); > > This looks like a use-after-move of request.completionHandler ? Indeed, request.completionHandler should be replaced with decisionHandler
Chris Dumez
Comment 8 2021-04-19 13:08:46 PDT
(In reply to Alex Christensen from comment #7) > Comment on attachment 424889 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=424889&action=review > > >> Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm:200 > >> + auto policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithCompletionHandler:WTFMove(request.completionHandler)]); > > > > This looks like a use-after-move of request.completionHandler ? > > Indeed, request.completionHandler should be replaced with decisionHandler Could one of you please follow-up? I am busy with GPUProcess stuff :/
Alex Christensen
Comment 9 2021-04-19 13:10:56 PDT
Reopening to attach new patch.
Alex Christensen
Comment 10 2021-04-19 13:10:58 PDT
Chris Dumez
Comment 11 2021-04-19 13:12:01 PDT
Comment on attachment 426468 [details] Patch Is it possible to API test? Clearly our current tests did not catch this.
Alex Christensen
Comment 12 2021-04-19 13:14:02 PDT
I think it could be done with some creative use of ClassMethodSwizzler
Darin Adler
Comment 13 2021-04-19 15:43:18 PDT
Comment on attachment 426468 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=426468&action=review > Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm:200 > - auto policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithCompletionHandler:WTFMove(request.completionHandler)]); > + auto policyListener = adoptNS([[WKWebAllowDenyPolicyListener alloc] initWithCompletionHandler:WTFMove(decisionHandler)]); This does more than just fix a use-after-move. It also adds a call to the geolocationAuthorizationGranted method, which I hope is also a progression. Is there a way we can construct a test that is sensitive to both of these?
Alex Christensen
Comment 14 2021-04-20 09:47:47 PDT
EWS
Comment 15 2021-04-20 10:19:09 PDT
Committed r276311 (236793@main): <https://commits.webkit.org/236793@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 426559 [details].
Note You need to log in before you can comment on or make changes to this bug.