[webkit-changes] [WebKit/WebKit] 4fd2be: Requesting the optional '<all_urls>' match pattern...

Commit Queue noreply at github.com
Thu Feb 27 08:03:03 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4fd2be23e4b871b1b1360f059de4649e294d704a
      https://github.com/WebKit/WebKit/commit/4fd2be23e4b871b1b1360f059de4649e294d704a
  Author: Elijah Sawyers <esawyers at apple.com>
  Date:   2025-02-27 (Thu, 27 Feb 2025)

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

  Log Message:
  -----------
  Requesting the optional '<all_urls>' match pattern doesn't do anything
https://bugs.webkit.org/show_bug.cgi?id=288641
rdar://140010739

Reviewed by Brian Weinstein and Timothy Hatcher.

This patch fixes a bug where requesting access to all URLs wouldn't do
anything. The reason that this was happening was because when we'd
check whether or not we need to request permission, we were
incorrectly saying that it was implicitly granted.

The solution here is to fix the broken condition in the permissionState
method:

if (pattern.matchesURL(baseURL()))
    return PermissionState::GrantedImplicitly;

When we're requesting access to *all* URLs, obviously it would match
the base URL of the extension. Therefore, we should only perform this
check if the pattern doesn't match all URLs.

* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::permissionState):
Fix the broken condition that was incorrectly reporting the permission
as implicitly granted.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIPermissions.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPIPermissions, RequestMatchPatternsOnly)):
(TestWebKitAPI::TEST(WKWebExtensionAPIPermissions, RequestAllURLsMatchPattern)):
Write a new test to validate the fix.

Canonical link: https://commits.webkit.org/291225@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