RESOLVED FIXED236566
Do preliminary work to pass domain names to CoreLocation
https://bugs.webkit.org/show_bug.cgi?id=236566
Summary Do preliminary work to pass domain names to CoreLocation
Chris Dumez
Reported 2022-02-13 11:05:52 PST
Do preliminary work to pass domain names to CoreLocation.
Attachments
Patch (99.96 KB, patch)
2022-02-13 11:24 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (100.00 KB, patch)
2022-02-13 11:43 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (100.01 KB, patch)
2022-02-13 12:33 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (100.41 KB, patch)
2022-02-13 13:21 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (100.40 KB, patch)
2022-02-13 14:21 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (100.45 KB, patch)
2022-02-13 17:46 PST, Chris Dumez
no flags
Patch (101.23 KB, patch)
2022-02-13 20:07 PST, Chris Dumez
no flags
Patch (98.34 KB, patch)
2022-02-14 10:03 PST, Chris Dumez
no flags
Patch (107.22 KB, patch)
2022-02-14 18:43 PST, Chris Dumez
no flags
Patch (107.25 KB, patch)
2022-02-14 19:37 PST, Chris Dumez
no flags
Patch (108.03 KB, patch)
2022-02-15 08:15 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (107.87 KB, patch)
2022-02-15 08:46 PST, Chris Dumez
no flags
Patch (107.87 KB, patch)
2022-02-15 09:53 PST, Chris Dumez
no flags
Patch (107.94 KB, patch)
2022-02-15 10:54 PST, Chris Dumez
no flags
Patch (107.20 KB, patch)
2022-02-15 11:20 PST, Chris Dumez
no flags
Patch (107.57 KB, patch)
2022-02-15 13:11 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (107.80 KB, patch)
2022-02-15 13:18 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (109.01 KB, patch)
2022-02-15 15:42 PST, Chris Dumez
no flags
Patch (108.58 KB, patch)
2022-02-15 15:51 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (108.59 KB, patch)
2022-02-15 16:04 PST, Chris Dumez
no flags
Patch (293.78 KB, patch)
2022-02-15 20:49 PST, Myles C. Maxfield
no flags
Patch (293.78 KB, patch)
2022-02-15 20:54 PST, Myles C. Maxfield
no flags
Chris Dumez
Comment 1 2022-02-13 11:06:06 PST
Chris Dumez
Comment 2 2022-02-13 11:24:14 PST
Chris Dumez
Comment 3 2022-02-13 11:43:29 PST
Chris Dumez
Comment 4 2022-02-13 12:33:16 PST
Chris Dumez
Comment 5 2022-02-13 13:21:46 PST
Chris Dumez
Comment 6 2022-02-13 14:21:51 PST
Chris Dumez
Comment 7 2022-02-13 17:46:30 PST
Chris Dumez
Comment 8 2022-02-13 20:07:57 PST
Chris Dumez
Comment 9 2022-02-14 10:03:41 PST
Chris Dumez
Comment 10 2022-02-14 18:43:59 PST
Chris Dumez
Comment 11 2022-02-14 19:37:32 PST
Darin Adler
Comment 12 2022-02-15 07:52:14 PST
Comment on attachment 451984 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=451984&action=review > Source/WebCore/Modules/geolocation/cocoa/GeolocationPositionDataCocoa.mm:33 > +GeolocationPositionData::GeolocationPositionData(CLLocation* location) CLLocation * should have a space given our Objective-C class coding style. > Source/WebCore/SourcesCocoa.txt:311 > +platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm @no-unify I’d love to avoid adding new no-unify. Why were these required? Do you know any workaround? > Source/WebCore/platform/cocoa/CoreLocationGeolocationProvider.h:46 > + virtual void geolocationAuthorizationGranted(const String& /*websiteIdentifier*/) { } Can any of these arguments be StringView instead of const String&? > Source/WebCore/platform/cocoa/CoreLocationGeolocationProvider.mm:50 > +static bool isAuthorizationGranted(CLAuthorizationStatus authorizationStatus) I’d name the argument just status. > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:245 > + for (auto& perDomainData : m_perDomainData.values()) { Same name for the loop variable as this function’s argument. Could sidestep this by using a shorter name for one or both. Just “data” will do give the scope of a short function or loop. > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:265 > + if (!m_clientProvider) This code should go into the #else, or we could move the #if so it’s only around the provider creation and start call. > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:280 > + UNUSED_PARAM(perDomainData); Same refactoring as above would be good. Put #if around the stop call. > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:293 > + UNUSED_PARAM(perDomainData); And here. Add the early return? > Source/WebKit/UIProcess/WebGeolocationManagerProxy.h:104 > + struct PerDomainData { Should just name the struct here and define it inside the .cop file. > Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp:47 > + return RegistrableDomain { document->url() }; Can probably use the braces without repeating the class name. > Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp:69 > + auto& pageSets = m_pageSets.ensure(registrableDomain, [] { This ensure should just be an add. It’s probably sufficiently efficient to make an empty PageSets; just two null pointers. Generally speaking new empty hash tables are just a null pointer, amd even though they sound expensive to allocate they’re not.
Chris Dumez
Comment 13 2022-02-15 08:05:37 PST
(In reply to Darin Adler from comment #12) > Comment on attachment 451984 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=451984&action=review > > > Source/WebCore/Modules/geolocation/cocoa/GeolocationPositionDataCocoa.mm:33 > > +GeolocationPositionData::GeolocationPositionData(CLLocation* location) > > CLLocation * should have a space given our Objective-C class coding style. OK. > > > Source/WebCore/SourcesCocoa.txt:311 > > +platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm @no-unify > > I’d love to avoid adding new no-unify. Why were these required? Do you know > any workaround? I consulted with Jer on this and this was his suggestion. This is happening because of unified build and soft-linking macros. I'll double check to see if I still need both or if I can remove one. > > Source/WebCore/platform/cocoa/CoreLocationGeolocationProvider.h:46 > > + virtual void geolocationAuthorizationGranted(const String& /*websiteIdentifier*/) { } > > Can any of these arguments be StringView instead of const String&? What's the benefit here though. I am holding a String as a data member and passing it as parameter. I think it makes sense to use the same type. > > > Source/WebCore/platform/cocoa/CoreLocationGeolocationProvider.mm:50 > > +static bool isAuthorizationGranted(CLAuthorizationStatus authorizationStatus) > > I’d name the argument just status. OK. > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:245 > > + for (auto& perDomainData : m_perDomainData.values()) { > > Same name for the loop variable as this function’s argument. Could sidestep > this by using a shorter name for one or both. Just “data” will do give the > scope of a short function or loop. OK. > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:265 > > + if (!m_clientProvider) > > This code should go into the #else, or we could move the #if so it’s only > around the provider creation and start call. I think there is probably a misunderstanding here. The code cannot be in the #else because it is still useful on IOS_FAMILY in those 2 cases: 1. The client sets its own provider via the API to pass a dummy provider (for testing, used by WKTR and API tests for e.g.) 2. The client sets its own provider via the API and passes a provider which rejects all authorization as a way to disable the geolocation API (used on watchOS). Eventually, we should be able to get rid of both cases but it will require some additional work for provide alternatives for these clients. > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:280 > > + UNUSED_PARAM(perDomainData); > > Same refactoring as above would be good. Put #if around the stop call. > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:293 > > + UNUSED_PARAM(perDomainData); > > And here. Add the early return? > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.h:104 > > + struct PerDomainData { > > Should just name the struct here and define it inside the .cop file. Oh, last time I tried that it didn't work because I was also using the struct from WebGeolocationManagerCocoa.cpp. However, in this latest iteration, it doesn't seem to be the case anymore so I should be able to do this indeed. > > > Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp:47 > > + return RegistrableDomain { document->url() }; > > Can probably use the braces without repeating the class name. OK, will try. > > > Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp:69 > > + auto& pageSets = m_pageSets.ensure(registrableDomain, [] { > > This ensure should just be an add. It’s probably sufficiently efficient to > make an empty PageSets; just two null pointers. Generally speaking new empty > hash tables are just a null pointer, amd even though they sound expensive to > allocate they’re not. Ok.
Chris Dumez
Comment 14 2022-02-15 08:15:14 PST
Chris Dumez
Comment 15 2022-02-15 08:30:24 PST
(In reply to Chris Dumez from comment #13) > (In reply to Darin Adler from comment #12) > > Comment on attachment 451984 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=451984&action=review > > > > > Source/WebCore/Modules/geolocation/cocoa/GeolocationPositionDataCocoa.mm:33 > > > +GeolocationPositionData::GeolocationPositionData(CLLocation* location) > > > > CLLocation * should have a space given our Objective-C class coding style. > > OK. > > > > > > Source/WebCore/SourcesCocoa.txt:311 > > > +platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm @no-unify > > > > I’d love to avoid adding new no-unify. Why were these required? Do you know > > any workaround? > > I consulted with Jer on this and this was his suggestion. This is happening > because of unified build and soft-linking macros. > I'll double check to see if I still need both or if I can remove one. > > > > Source/WebCore/platform/cocoa/CoreLocationGeolocationProvider.h:46 > > > + virtual void geolocationAuthorizationGranted(const String& /*websiteIdentifier*/) { } > > > > Can any of these arguments be StringView instead of const String&? > > What's the benefit here though. I am holding a String as a data member and > passing it as parameter. I think it makes sense to use the same type. > > > > > > Source/WebCore/platform/cocoa/CoreLocationGeolocationProvider.mm:50 > > > +static bool isAuthorizationGranted(CLAuthorizationStatus authorizationStatus) > > > > I’d name the argument just status. > > OK. > > > > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:245 > > > + for (auto& perDomainData : m_perDomainData.values()) { > > > > Same name for the loop variable as this function’s argument. Could sidestep > > this by using a shorter name for one or both. Just “data” will do give the > > scope of a short function or loop. > > OK. > > > > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:265 > > > + if (!m_clientProvider) > > > > This code should go into the #else, or we could move the #if so it’s only > > around the provider creation and start call. > > I think there is probably a misunderstanding here. The code cannot be in the > #else because it is still useful on IOS_FAMILY in those 2 cases: > 1. The client sets its own provider via the API to pass a dummy provider > (for testing, used by WKTR and API tests for e.g.) > 2. The client sets its own provider via the API and passes a provider which > rejects all authorization as a way to disable the geolocation API (used on > watchOS). > > Eventually, we should be able to get rid of both cases but it will require > some additional work for provide alternatives for these clients. > > > > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:280 > > > + UNUSED_PARAM(perDomainData); > > > > Same refactoring as above would be good. Put #if around the stop call. > > > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:293 > > > + UNUSED_PARAM(perDomainData); > > > > And here. Add the early return? > > > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.h:104 > > > + struct PerDomainData { > > > > Should just name the struct here and define it inside the .cop file. > > Oh, last time I tried that it didn't work because I was also using the > struct from WebGeolocationManagerCocoa.cpp. However, in this latest > iteration, it doesn't seem to be the case anymore so I should be able to do > this indeed. No actually, WebGeolocationManagerCocoa.cpp still uses PerDomainData so I still cannot do what you suggested it seems. > > > > > Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp:47 > > > + return RegistrableDomain { document->url() }; > > > > Can probably use the braces without repeating the class name. > > OK, will try. > > > > > > Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp:69 > > > + auto& pageSets = m_pageSets.ensure(registrableDomain, [] { > > > > This ensure should just be an add. It’s probably sufficiently efficient to > > make an empty PageSets; just two null pointers. Generally speaking new empty > > hash tables are just a null pointer, amd even though they sound expensive to > > allocate they’re not. > > Ok.
Chris Dumez
Comment 16 2022-02-15 08:34:20 PST
(In reply to Darin Adler from comment #12) > Comment on attachment 451984 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=451984&action=review > > > Source/WebCore/Modules/geolocation/cocoa/GeolocationPositionDataCocoa.mm:33 > > +GeolocationPositionData::GeolocationPositionData(CLLocation* location) > > CLLocation * should have a space given our Objective-C class coding style. > > > Source/WebCore/SourcesCocoa.txt:311 > > +platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm @no-unify > > I’d love to avoid adding new no-unify. Why were these required? Do you know > any workaround? > > > Source/WebCore/platform/cocoa/CoreLocationGeolocationProvider.h:46 > > + virtual void geolocationAuthorizationGranted(const String& /*websiteIdentifier*/) { } > > Can any of these arguments be StringView instead of const String&? > > > Source/WebCore/platform/cocoa/CoreLocationGeolocationProvider.mm:50 > > +static bool isAuthorizationGranted(CLAuthorizationStatus authorizationStatus) > > I’d name the argument just status. > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:245 > > + for (auto& perDomainData : m_perDomainData.values()) { > > Same name for the loop variable as this function’s argument. Could sidestep > this by using a shorter name for one or both. Just “data” will do give the > scope of a short function or loop. > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:265 > > + if (!m_clientProvider) > > This code should go into the #else, or we could move the #if so it’s only > around the provider creation and start call. > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:280 > > + UNUSED_PARAM(perDomainData); > > Same refactoring as above would be good. Put #if around the stop call. > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp:293 > > + UNUSED_PARAM(perDomainData); > > And here. Add the early return? > > > Source/WebKit/UIProcess/WebGeolocationManagerProxy.h:104 > > + struct PerDomainData { > > Should just name the struct here and define it inside the .cop file. > > > Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp:47 > > + return RegistrableDomain { document->url() }; > > Can probably use the braces without repeating the class name. Hmm, this didn't work: /Volumes/Data/WebKit/OpenSource/Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp:47:12: error: chosen constructor is explicit in copy-initialization return { document->url() };
Chris Dumez
Comment 17 2022-02-15 08:46:34 PST
EWS
Comment 18 2022-02-15 09:47:18 PST
ChangeLog entry in Source/WTF/ChangeLog contains OOPS!.
Chris Dumez
Comment 19 2022-02-15 09:53:28 PST
EWS
Comment 20 2022-02-15 10:47:41 PST
Patch 452044 does not build
Chris Dumez
Comment 21 2022-02-15 10:54:22 PST
Chris Dumez
Comment 22 2022-02-15 11:20:05 PST
EWS
Comment 23 2022-02-15 12:22:52 PST
Patch 452062 does not build
Chris Dumez
Comment 24 2022-02-15 13:11:58 PST
Chris Dumez
Comment 25 2022-02-15 13:18:36 PST
Chris Dumez
Comment 26 2022-02-15 15:42:15 PST
Chris Dumez
Comment 27 2022-02-15 15:51:50 PST
EWS
Comment 28 2022-02-15 16:02:02 PST
Patch 452081 does not build
Chris Dumez
Comment 29 2022-02-15 16:04:14 PST
EWS
Comment 30 2022-02-15 20:06:37 PST
Committed r289872 (247312@main): <https://commits.webkit.org/247312@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452106 [details].
Myles C. Maxfield
Comment 31 2022-02-15 20:49:48 PST
Reopening to attach new patch.
Myles C. Maxfield
Comment 32 2022-02-15 20:49:50 PST
Myles C. Maxfield
Comment 33 2022-02-15 20:54:55 PST
Myles C. Maxfield
Comment 34 2022-02-15 20:56:24 PST
Whoops, sorry, webkit-patch upload messed up
Note You need to log in before you can comment on or make changes to this bug.