Repository navigation
Commit 74bc5de
committed
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@main1 parent 4bcd765 commit 74bc5de
25 files changed
Lines changed: 1031 additions & 51 deletions
File tree
- LayoutTests
- http/tests/site-isolation/inspector/storage
- resources
- platform/mac-wk2
- Source
- JavaScriptCore
- inspector/protocol
- WebInspectorUI/UserInterface/Protocol
- WebKit
- UIProcess
- Automation
- Inspector
- Agents
- WebKit.xcodeproj
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
273 | 276 | | |
274 | 277 | | |
275 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments