Bug 223247 - Align device orientation delegate to getUserMedia/geolocation delegates
Summary: Align device orientation delegate to getUserMedia/geolocation delegates
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-16 03:33 PDT by youenn fablet
Modified: 2021-03-17 06:31 PDT (History)
11 users (show)

See Also:


Attachments
Patch (33.30 KB, patch)
2021-03-16 03:38 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (52.30 KB, patch)
2021-03-16 08:59 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (53.35 KB, patch)
2021-03-17 01:10 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2021-03-16 03:33:19 PDT
Align device orientation delegate to getUserMedia/geolocation delegates
Comment 1 youenn fablet 2021-03-16 03:38:08 PDT
Created attachment 423314 [details]
Patch
Comment 2 youenn fablet 2021-03-16 08:59:21 PDT
Created attachment 423337 [details]
Patch
Comment 3 Eric Carlson 2021-03-16 09:05:11 PDT
Comment on attachment 423337 [details]
Patch

r=me once the bots are satisfied
Comment 4 Chris Dumez 2021-03-16 09:22:55 PDT
Comment on attachment 423337 [details]
Patch

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

> Source/WebKit/ChangeLog:8
> +        Refactor code to move device orientation prompt implementation with other prompts in MediaPermissionUtilities.

Well, then *Media*PermissionUtilities does not seem like a great name for it.

> Source/WebKit/ChangeLog:11
> +        Update the decision handler to taker grant, deny or prompt parameter.

typo: taker

> Source/WebKit/UIProcess/API/C/WKPageUIClient.h:136
> +typedef bool (*WKPageShouldAllowDeviceOrientationAndMotionAccessCallback)(WKPageRef page, WKSecurityOriginRef securityOrigin, WKFrameInfoRef frame, const void *clientInfo);

Is it really OK to modify the existing callback type like that? Wouldn't it break clients using the old prototype? I thought we were adding new delegates whenever the prototype changes.

> Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:226
> +- (void)_webView:(WKWebView *)webView requestDeviceOrientationAndMotionPermissionForOrigin:(WKSecurityOrigin*)origin initiatedByFrame:(WKFrameInfo *)frame decisionHandler:(void (^)(_WKPermissionDecision decision))decisionHandler WK_API_AVAILABLE(ios(WK_IOS_TBA));

Same, seems risky to just rename the existing SPI. I feel we should deprecate the old one and add a new one.
Comment 5 youenn fablet 2021-03-17 01:07:56 PDT
> > Source/WebKit/ChangeLog:11
> > +        Update the decision handler to taker grant, deny or prompt parameter.
> 
> typo: taker

OK

> > Source/WebKit/UIProcess/API/C/WKPageUIClient.h:136
> > +typedef bool (*WKPageShouldAllowDeviceOrientationAndMotionAccessCallback)(WKPageRef page, WKSecurityOriginRef securityOrigin, WKFrameInfoRef frame, const void *clientInfo);
> 
> Is it really OK to modify the existing callback type like that? Wouldn't it
> break clients using the old prototype? I thought we were adding new
> delegates whenever the prototype changes.

I think there is no other user right now except WebKit Tools.

> > Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:226
> > +- (void)_webView:(WKWebView *)webView requestDeviceOrientationAndMotionPermissionForOrigin:(WKSecurityOrigin*)origin initiatedByFrame:(WKFrameInfo *)frame decisionHandler:(void (^)(_WKPermissionDecision decision))decisionHandler WK_API_AVAILABLE(ios(WK_IOS_TBA));
> 
> Same, seems risky to just rename the existing SPI. I feel we should
> deprecate the old one and add a new one.

Ditto.
Comment 6 youenn fablet 2021-03-17 01:10:50 PDT
Created attachment 423449 [details]
Patch for landing
Comment 7 EWS 2021-03-17 06:30:30 PDT
Committed r274558: <https://commits.webkit.org/r274558>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 423449 [details].
Comment 8 Radar WebKit Bug Importer 2021-03-17 06:31:14 PDT
<rdar://problem/75523911>