Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0350073e737b173a5a7a80ad55a83d52e940b98d
https://github.com/WebKit/WebKit/commit/0350073e737b173a5a7a80ad55a83d52e940b98d
Author: Timothy Hatcher <[email protected]>
Date: 2026-07-07 (Tue, 07 Jul 2026)
Changed paths:
M Source/WebKit/Shared/Extensions/WebExtensionContextParameters.h
M
Source/WebKit/Shared/Extensions/WebExtensionContextParameters.serialization.in
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionControllerCocoa.mm
M
Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionControllerConfigurationCocoa.mm
M Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp
M Source/WebKit/UIProcess/Extensions/WebExtensionControllerConfiguration.cpp
M
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPICookiesCocoa.mm
M
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIExtensionCocoa.mm
M Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionContextProxyCocoa.mm
M Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h
M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
M Tools/TestWebKitAPI/Helpers/cocoa/WebExtensionUtilities.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPICookies.mm
M
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionControllerConfiguration.mm
Log Message:
-----------
WKWebExtensionController.Configuration.nonPersistent() should use a
non-persistent datastore by default.
https://webkit.org/b/318748
rdar://181546335
Reviewed by Brian Weinstein and Kiara Rose.
Despite its name, a non-persistent extension controller configuration resolved
its website data
store to the persistent default. Fix this by ensuring the non-persistent
configuration initializes
with an ephemeral data store that is used consistently across all internal code
paths.
Extension pages (background, popup, etc.) run in the controller's own
non-persistent session.
Ensure event dispatch, data store lookup, content injection, and incognito
detection correctly
recognize pages in that session as belonging to the extension — not to an
external
private-browsing session.
To propagate the controller's session identity to the WebProcess, add a
defaultSessionID field
to WebExtensionContextParameters and thread it through to
WebExtensionContextProxy so the cookies
and extension APIs can distinguish the controller's own ephemeral session from
unrelated ones.
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp:
(WebKit::WebExtensionContext::processes): Allow processes in the controller's
own non-persistent
session to receive extension events without requiring hasAccessToPrivateData.
(WebKit::WebExtensionContext::parameters): Populate defaultSessionID from the
controller's
default data store session ID.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::websiteDataStore): Allow the controller's own
non-persistent data
store to be returned without requiring hasAccessToPrivateData.
*
Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionControllerConfigurationCocoa.mm:
(WebKit::WebExtensionControllerConfiguration::webViewConfiguration): Propagate
the data store
into the lazily created web view configuration.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionControllerCocoa.mm:
(WebKit::WebExtensionController::addPage): Treat pages in the controller's own
non-persistent
data store as non-private so injected content and declarative rules are
registered for them.
* Source/WebKit/UIProcess/Extensions/WebExtensionControllerConfiguration.cpp:
(WebKit::WebExtensionControllerConfiguration::WebExtensionControllerConfiguration):
Initialize
the data store to a non-persistent store when the configuration is
non-persistent.
* Source/WebKit/Shared/Extensions/WebExtensionContextParameters.h:
*
Source/WebKit/Shared/Extensions/WebExtensionContextParameters.serialization.in:
Add defaultSessionID to carry the controller's session ID over IPC.
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h:
* Source/WebKit/WebProcess/Extensions/Cocoa/WebExtensionContextProxyCocoa.mm:
(WebKit::WebExtensionContextProxy::getOrCreate): Store defaultSessionID from
the IPC parameters.
*
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIExtensionCocoa.mm:
(WebKit::WebExtensionAPIExtension::isInIncognitoContext): Extension pages are
never incognito;
use isURLForThisExtension to identify them. Also return false for pages in the
controller's own
non-persistent session so content scripts running in that session are not
treated as incognito.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPICookiesCocoa.mm:
(toWebAPI): Accept ownSessionID and mark a store as incognito only if it is
ephemeral and not
the controller's own session, so getAllCookieStores does not misreport the
controller's store.
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::platformInitializeAccessibility): Replace assertion with
waitForDatabaseUpdate
so that rapid web process restart after network process termination does not
crash; the database
arrives within milliseconds and the call becomes a no-op once it has been
received.
* Tools/TestWebKitAPI/Helpers/cocoa/WebExtensionUtilities.mm:
(-[TestWebExtensionTab initWithWindow:extensionController:]): Use the
controller's own default
website data store for non-private tab web views instead of the shared
persistent store.
(-[TestWebExtensionTab changeWebViewIfNeededForURL:forExtensionContext:]): Do
not override the
websiteDataStore on configurations sourced from the extension context; they
already carry the
correct store and a relatedWebView pointing to the background page. Use the
controller's own
default website data store for non-private HTTP tab web views. Rename isHTTPURL
to isHTTPFamilyURL.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPICookies.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPICookies, GetAll)): Use the controller's
own data store.
(TestWebKitAPI::TEST(WKWebExtensionAPICookies, GetAllIncognito)): Replace
hardcoded ephemeral
store ID rejection checks with a length assertion now that the controller's own
ephemeral session
is not exposed as a separate incognito store.
(TestWebKitAPI::TEST(WKWebExtensionAPICookies, GetAllWithFilters)): Use the
controller's store.
(TestWebKitAPI::TEST(WKWebExtensionAPICookies, RemoveCookie)): Use the
controller's store.
(TestWebKitAPI::TEST(WKWebExtensionAPICookies, RemoveCookieNotFound)): Use the
controller's store.
(TestWebKitAPI::TEST(WKWebExtensionAPICookies, SetCookie)): Use the
controller's store.
(TestWebKitAPI::TEST(WKWebExtensionAPICookies, GetCookie)): Use the
controller's store.
(TestWebKitAPI::TEST(WKWebExtensionAPICookies,
GetAllAfterNetworkProcessTermination)): Use
defaultConfiguration so cookies are persisted to disk and survive a network
process restart.
*
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionControllerConfiguration.mm:
(TestWebKitAPI::TEST(WKWebExtensionControllerConfiguration, Initialization)):
(TestWebKitAPI::TEST(WKWebExtensionControllerConfiguration, SecureCoding)):
(TestWebKitAPI::TEST(WKWebExtensionControllerConfiguration, Copying)): Update
tests to expect
a non-persistent data store for non-persistent configurations, and verify both
the default
data store and web view configuration use the same ephemeral store.
Canonical link: https://commits.webkit.org/316701@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications