Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f606e5e964d5dcd860e4a6625db8092664bbc05c
      
https://github.com/WebKit/WebKit/commit/f606e5e964d5dcd860e4a6625db8092664bbc05c
  Author: Timothy Hatcher <[email protected]>
  Date:   2024-03-08 (Fri, 08 Mar 2024)

  Changed paths:
    M 
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIPermissionsCocoa.mm
    M 
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIPermissions.mm

  Log Message:
  -----------
  WebExtensionContext::permissionsRequest needs to properly capture 
completionHandler.
https://webkit.org/b/269678
rdar://problem/123197187

Reviewed by Brian Weinstein.

Rework permissions.request() to only call the delegate if needed, never with an 
empty set.
Also the completionHandler only worked if it was called immediately, but we 
need to support
it being called later. To support all this, a CallbackAggregator was needed and 
it now waits
for both delegates to be called (in either order) since they both retain the 
aggregator.

This also changes the handling to better match the permissions.request() API, 
by only
allowing granting all or none, not some. Added a test for this.

Also updated the tests to not use nil, since the block parameters are not 
nullable.

* 
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIPermissionsCocoa.mm:
(WebKit::WebExtensionContext::permissionsRequest):
* 
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm:
(WebKit::WebExtensionContext::runtimeSendNativeMessage):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIPermissions.mm:
(TEST(WKWebExtensionAPIPermissions, Basics)): Renamed.
(TEST(WKWebExtensionAPIPermissions, AcceptPermissionsRequest)): Updated.
(TEST(WKWebExtensionAPIPermissions, DenyPermissionsRequest)): Updated.
(TEST(WKWebExtensionAPIPermissions, 
AcceptPermissionsDenyMatchPatternsRequest)): Updated.
(TEST(WKWebExtensionAPIPermissions, RequestPermissionsOnly)): Updated.
(TEST(WKWebExtensionAPIPermissions, RequestMatchPatternsOnly)): Updated.
(TEST(WKWebExtensionAPIPermissions, GrantOnlySomePermissions)): Added.
(TEST(WKWebExtensionAPIPermissions, GrantOnlySomeMatchPatterns)): Added.

Canonical link: https://commits.webkit.org/275859@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to