[webkit-changes] [WebKit/WebKit] adf972: Figure out how to tell if a Web Extension has been...

Timothy Hatcher noreply at github.com
Wed Apr 3 13:06:51 PDT 2024


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

  Changed paths:
    M Source/WTF/wtf/spi/cocoa/SecuritySPI.h
    M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIScriptingCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtension.h
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h

  Log Message:
  -----------
  Figure out how to tell if a Web Extension has been updated in WebKit.
https://webkit.org/b/249266
rdar://problem/103573769

Reviewed by Brian Weinstein.

Use the code signing hash from the app extension bundle to tell if an extension
has updated. This will change after building in Xcode or via App Store updates.
There is no quick way to do this for non-bundle code paths, so we still consider
an extension updated if the version in the manifest changes.

Unfortunately, there is no way to test this with TestWebKitAPI currently since it requires
an extension to be loaded from a bundle, code signed, updated, and reloaded. I was able
to manually test this against extensions loaded in Safari.

* Source/WTF/wtf/spi/cocoa/SecuritySPI.h: Added functions and types for iOS and macOS.
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIScriptingCocoa.mm:
(WebKit::WebExtensionContext::clearRegisteredContentScripts): Added.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCocoa.mm:
(WebKit::WebExtension::bundleStaticCode const): Made const, use bridge_cast().
(WebKit::WebExtension::bundleHash const): Added.
(WebKit::WebExtension::validateResourceData): Store staticCode in variable. Use bridge_cast().
(WebKit::WebExtension::imageForPath): Use bridge_cast().
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::load): Call determineInstallReasonDuringLoad().
(WebKit::WebExtensionContext::loadBackgroundWebViewDuringLoad):
(WebKit::WebExtensionContext::determineInstallReasonDuringLoad): Renamed. Drop writeStateToStorage()
since it is already done by the caller in load(). Save and compare the bundleHash() to determine updates.
Always set LastSeenVersion. Call clearRegisteredContentScripts() when extension updates.
(WebKit::WebExtensionContext::queueStartupAndInstallEventsForExtensionIfNecessary): Deleted.
* Source/WebKit/UIProcess/Extensions/WebExtension.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:

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