Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 74bc5de8363385d200ce43338756dcb6969bd424
      
https://github.com/WebKit/WebKit/commit/74bc5de8363385d200ce43338756dcb6969bd424
  Author: Anuj Panta <[email protected]>
  Date:   2026-07-13 (Mon, 13 Jul 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/resources/set-cookie-via-script.html
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/resources/set-cookie.py
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-cookies-cross-origin-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-cookies-cross-origin-iframe.html
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-cookies-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-cookies.html
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-partitioned-cookies.https-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-partitioned-cookies.https.html
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-set-and-delete-cookies-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-set-and-delete-cookies.html
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/JavaScriptCore/CMakeLists.txt
    M Source/JavaScriptCore/DerivedSources-input.xcfilelist
    M Source/JavaScriptCore/DerivedSources.make
    A Source/JavaScriptCore/inspector/protocol/Storage.json
    M Source/WebInspectorUI/UserInterface/Protocol/Target.js
    M Source/WebKit/Sources.txt
    M Source/WebKit/UIProcess/Automation/BidiStorageAgent.cpp
    A Source/WebKit/UIProcess/Inspector/Agents/InspectorStorageAgent.cpp
    A Source/WebKit/UIProcess/Inspector/Agents/InspectorStorageAgent.h
    A Source/WebKit/UIProcess/Inspector/InspectorCookieStoreHelpers.cpp
    A Source/WebKit/UIProcess/Inspector/InspectorCookieStoreHelpers.h
    M Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  WIP: [SI] Add a Storage domain for cookie inspection
https://bugs.webkit.org/show_bug.cgi?id=308900
rdar://171780948

Reviewed by Qianlang Chen.

Introduce a new Storage domain (cookies only for this pass) that runs entirely
UIProcess-side and talks to the authoritative store via API::HTTPCookieStore --
the same path BidiStorageAgent already uses. Reading the NetworkProcess-owned
store in one call sees cookies across every WebContent process, including those
set inside cross-origin iframes under Site Isolation, with no per-process fan-
out or routing. The old Page cookie commands are left untouched.

InspectorStorageAgent does no WebContent IPC (all work is UIProcess-local), so
unlike ProxyingPageAgent/ProxyingNetworkAgent it needs no MessageReceiver and
lives in the AgentRegistry. It is created unconditionally in
WebPageInspectorController::createLazyAgents alongside InspectorBrowserAgent,
not gated on siteIsolationEnabled(): the domain is useful with or without SI,
and reading the authoritative store is the correct model in both cases. Its
protocol domain is declared with targetTypes ["web-page"] so, like Browser, it
is owned by the UIProcess (multiplexing) target rather than the WebContent page
target; Target.js gains the matching StorageAgent accessor.

getCookies reads the flat authoritative store (API::HTTPCookieStore::cookies,
backed by WebCookieManager::GetAllCookies). This read surfaces BOTH 
unpartitioned
and partitioned (CHIPS) cookies; each cookie carries its partition in
Cookie.partitionKey, so partitioned cookies are visible and labeled (verified by
storage-get-partitioned-cookies.https.html). The only remaining partition work 
is
a documented per-URL+partition scoped lens (the storageKey PartitionDescriptor
arm), deferred to webkit.org/b/292393 -- not basic visibility.

The Storage domain exposes an explicit PartitionDescriptor parameter (context
now, storageKey stubbed for webkit.org/b/292393) and populates 
Cookie.partitionKey:
it is emitted on getCookies and, on setCookie, written onto the WebCore::Cookie
only when the caller supplies an explicit partitionKey. setCookie's returned
PartitionKey echoes where the cookie actually landed -- the explicit key if 
given,
otherwise empty -- rather than synthesizing the page's origin, so it never 
claims
an unpartitioned cookie lives in a partition. WebCore::Cookie::partitionKey 
already
existed and already rides the IPC to NetworkProcess; BiDi simply never set it. A
follow-up should bring BidiStorageAgent to parity via the shared helper.

deleteCookies requires an explicit filter: a request with no filter is rejected
rather than clearing the entire store (which, given the flat read above, would
include partitioned cookies). This matches BidiStorageAgent and keeps a
destructive clear from being the empty-argument default of a filtered command.

Cookie filtering is factored out of BidiStorageAgent into a shared
CookieStoreHelpers::cookieMatchesFilter so both frontends filter identically;
BidiStorageAgent is refactored onto it with no behavior change.

Opt-in cookie partitioning (CHIPS) is gated on 
HAVE(ALLOW_ONLY_PARTITIONED_COOKIES)
(macOS 26.2+); on older OSes it is compiled out and no partitionKey is 
populated.
storage-get-partitioned-cookies.https.html asserts a populated partitionKey, so
it is [ Skip ] by default in LayoutTests/TestExpectations and re-enabled with
[ Tahoe+ ] [ Pass ] in platform/mac-wk2/TestExpectations -- the same two-file
split as the existing CHIPS suite. The other three storage tests run everywhere.

Tests: http/tests/site-isolation/inspector/storage/storage-get-cookies.html
       
http/tests/site-isolation/inspector/storage/storage-get-cookies-cross-origin-iframe.html
       
http/tests/site-isolation/inspector/storage/storage-get-partitioned-cookies.https.html
       
http/tests/site-isolation/inspector/storage/storage-set-and-delete-cookies.html

* LayoutTests/TestExpectations:
* 
LayoutTests/http/tests/site-isolation/inspector/storage/resources/set-cookie-via-script.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/resources/set-cookie.py:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-cookies-cross-origin-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-cookies-cross-origin-iframe.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-cookies-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-cookies.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-partitioned-cookies.https-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-get-partitioned-cookies.https.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-set-and-delete-cookies-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/storage-set-and-delete-cookies.html:
 Added.
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/DerivedSources-input.xcfilelist:
* Source/JavaScriptCore/DerivedSources.make:
* Source/JavaScriptCore/inspector/protocol/Storage.json: Added.
* Source/WebInspectorUI/UserInterface/Protocol/Target.js:
(WI.Target.prototype.get StorageAgent): Added.
* Source/WebKit/Sources.txt:
* Source/WebKit/UIProcess/Automation/BidiStorageAgent.cpp:
(WebKit::BidiStorageAgent::getCookies):
(WebKit::BidiStorageAgent::deleteCookies):
(WebKit::cookieMatchesFilter): Deleted.
* Source/WebKit/UIProcess/Inspector/Agents/InspectorStorageAgent.cpp: Added.
(WebKit::toProtocol):
(WebKit::fromProtocol):
(WebKit::buildObjectForCookie):
(WebKit::buildArrayForCookies):
(WebKit::InspectorStorageAgent::InspectorStorageAgent):
(WebKit::InspectorStorageAgent::didCreateFrontendAndBackend):
(WebKit::InspectorStorageAgent::willDestroyFrontendAndBackend):
(WebKit::InspectorStorageAgent::enable):
(WebKit::InspectorStorageAgent::disable):
(WebKit::InspectorStorageAgent::cookieStoreForPartition):
(WebKit::InspectorStorageAgent::makePartitionKey):
(WebKit::InspectorStorageAgent::getCookies):
(WebKit::InspectorStorageAgent::setCookie):
(WebKit::deleteCookiesSequentially):
(WebKit::InspectorStorageAgent::deleteCookies):
* Source/WebKit/UIProcess/Inspector/Agents/InspectorStorageAgent.h: Added.
* Source/WebKit/UIProcess/Inspector/InspectorCookieStoreHelpers.cpp: Added.
(WebKit::CookieFilter::fromProtocol):
(WebKit::CookieFilter::matches const):
* Source/WebKit/UIProcess/Inspector/InspectorCookieStoreHelpers.h: Added.
* Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp:
(WebKit::WebPageInspectorController::createLazyAgents):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to