Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dbb4014be65b5a5020523c545b563179cdfd7891
      
https://github.com/WebKit/WebKit/commit/dbb4014be65b5a5020523c545b563179cdfd7891
  Author: Elijah Sawyers <esawy...@apple.com>
  Date:   2025-04-17 (Thu, 17 Apr 2025)

  Changed paths:
    M 
Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionURLSchemeHandlerCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtension.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionController.mm

  Log Message:
  -----------
  Failing to load a web accessible resource from a subframe at about:blank
https://bugs.webkit.org/show_bug.cgi?id=291696
rdar://149494286

Reviewed by Timothy Hatcher.

This patch fixes a couple of bugs:

1) A subframe couldn't load a web accessible resource if its URL is about:blank.

2) A prefix slash in web accessible resource's resource path patterns would
   cause them to not be matched.

The first issue was caused by us inadvertently returning false from
isWebAccessibleResource in the extension URL scheme handler if a subframe was at
about:blank and trying to load a web accessible resource. The fix for this is to
use the parent frame's URL, rather than firstPartyForCookies, for the frame
document's URL if the frame isn't the main frame. This resolves a FIXME in the
code: rdar://59193765.

The second issue was caused by us dropping the prefix slash of the resource URL,
but not dropping it from the path pattern. Simply remove it from both.

I wrote new tests to validate these fixes.

* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionURLSchemeHandlerCocoa.mm:
(WebKit::WebExtensionURLSchemeHandler::platformStartTask):
* Source/WebKit/UIProcess/Extensions/WebExtension.cpp:
(WebKit::WebExtension::isWebAccessibleResource):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionController.mm:
(TestWebKitAPI::TEST(WKWebExtensionController, 
WebAccessibleResourcesWithLeadingSlash)):
(TestWebKitAPI::TEST(WKWebExtensionController, 
WebAccessibleResourceInSubframeFromAboutBlank)):

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



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

Reply via email to