[webkit-changes] [WebKit/WebKit] 253859: activeTab should not be granted if the match patte...

Timothy Hatcher noreply at github.com
Wed Mar 27 13:08:23 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 253859aff9169b69d73252ed37636c46ca299752
      https://github.com/WebKit/WebKit/commit/253859aff9169b69d73252ed37636c46ca299752
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2024-03-27 (Wed, 27 Mar 2024)

  Changed paths:
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm

  Log Message:
  -----------
  activeTab should not be granted if the match pattern is already Denied.
https://webkit.org/b/271771
rdar://problem/125499141

Reviewed by Brian Weinstein.

Prevent activeTab permissions from being granted if the current URL has
already been denied by the user. That is a strong signal the user does not
want this extension on the page.

Also fix a bug where activeTab permissions were not being removed with
granted or denied permisions, since the code was behind an early return.

Also use the new WebExtensionMatchPattern constructor that takes a URL
instead of manually constructing it in two places.

Added two tests for these cases.

* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::removeGrantedPermissionMatchPatterns):
(WebKit::WebExtensionContext::setPermissionState):
(WebKit::WebExtensionContext::userGesturePerformed):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm:
(TEST(WKWebExtensionAPITabs, ActiveTabWithDeniedPermissions)): Added.
(TEST(WKWebExtensionAPITabs, ActiveTabRemovedWithDeniedPermissions)): Added.

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list