[webkit-changes] [WebKit/WebKit] 48c566: Consider delegate methods for _WKWebExtensionActio...

Timothy Hatcher noreply at github.com
Fri Oct 4 15:37:56 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 48c566a109a63be806e989c0a0c54c16b2c09263
      https://github.com/WebKit/WebKit/commit/48c566a109a63be806e989c0a0c54c16b2c09263
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2024-10-04 (Fri, 04 Oct 2024)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionAction.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionAction.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionControllerDelegate.h
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionActionCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtensionAction.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIAction.mm
    M Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.h
    M Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.mm

  Log Message:
  -----------
  Consider delegate methods for _WKWebExtensionAction changes instead of a notification.
https://webkit.org/b/268017
rdar://problem/121536906

Reviewed by Brian Weinstein.

Add a new delegate method that get notified about any tab actions that have updated.
This will notify the app for all tab actions when a default or window action changes,
which we were missing before when it was a simple notification. Also update after a
small delay, so multiple changes in succession are only notifying the delegate once.

Some tests have been updated to use the new delegate method instead to exercise it.

* Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionAction.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionAction.mm:
* Source/WebKit/UIProcess/API/Cocoa/WKWebExtensionControllerDelegate.h:
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionActionCocoa.mm:
(WebKit::WebExtensionAction::propertiesDidChange): Call the delegate on a timeout.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::getOrCreateAction): Pass window to the constructor.
This was a bug, but in practice it wasn't hit.
* Source/WebKit/UIProcess/Extensions/WebExtensionAction.h:
(WebKit::WebExtensionAction::isTabAction const): Added.
(WebKit::WebExtensionAction::isWindowAction const): Added.
(WebKit::WebExtensionAction::isDefaultAction const): Added.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIAction.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconSinglePath)): Use new delegate.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconSinglePathRelative)): Ditto.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconMultipleSizes)): Ditto.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconMultipleSizesRelative)): Ditto.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithImageData)): Ditto.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithMultipleImageDataSizes)): Ditto.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithDataURL)): Ditto.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithMultipleDataURLs)): Ditto.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithVariants)): Ditto.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithImageDataAndVariants)): Ditto.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithMixedValidAndInvalidVariants)): Ditto.
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, SetIconWithAnySizeVariantAndSVGDataURL)): Ditto.
* Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.h:
* Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.mm:
(-[TestWebExtensionsDelegate webExtensionController:didUpdateAction:forExtensionContext:]): Added.

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