Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 64611e1e3f2b64fd0428f0ce6e6f41aab0d24cf9
      
https://github.com/WebKit/WebKit/commit/64611e1e3f2b64fd0428f0ce6e6f41aab0d24cf9
  Author: Basuke Suzuki <[email protected]>
  Date:   2026-10-09 (Fri, 09 Oct 2026)

  Changed paths:
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/indexeddb-frame-target-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/indexeddb-frame-target.html
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/resources/indexeddb-frame.html
    M Source/JavaScriptCore/inspector/protocol/IndexedDB.json
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/inspector/FrameInspectorController.cpp
    M Source/WebCore/inspector/PageInspectorController.cpp
    M Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp
    M Source/WebCore/inspector/agents/InspectorIndexedDBAgent.h
    A Source/WebCore/inspector/agents/frame/FrameIndexedDBAgent.cpp
    A Source/WebCore/inspector/agents/frame/FrameIndexedDBAgent.h
    A Source/WebCore/inspector/agents/page/PageIndexedDBAgent.cpp
    A Source/WebCore/inspector/agents/page/PageIndexedDBAgent.h
    M Source/WebInspectorUI/UserInterface/Controllers/IndexedDBManager.js
    M 
Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseHostTreeElement.js

  Log Message:
  -----------
  [Site Isolation] Web Inspector: support cross-origin iframes in the IndexedDB 
domain
https://bugs.webkit.org/show_bug.cgi?id=326726
rdar://143583558

Reviewed by Qianlang Chen and Sihui Liu.

With Site Isolation enabled, the Storage tab listed no IndexedDB databases for 
a cross-origin
iframe. The IndexedDB domain was exposed only on the page target. Its agent 
finds a frame by
walking the frame tree by security origin, which skips RemoteFrames. The 
frontend also sent
every IndexedDB command to the main target.

InspectorIndexedDBAgent is now an abstract base, following 
InspectorWorkerAgent. It keeps the
database loaders and asks a subclass for the frame that owns a security origin.
PageIndexedDBAgent keeps the frame-tree walk. FrameIndexedDBAgent is exposed on 
frame targets
and returns its own frame only when the requested origin matches its 
document's, so a frame
target never serves another frame's storage. frameForSecurityOrigin returns an 
ErrorStringOr,
so each subclass reports why it has no frame: no frame in the page has the 
origin, or the frame
target's document has a different one. The protocol keeps its securityOrigin 
parameters, so
the commands look the same to older frontends and backends.

IndexedDBManager now looks up the target that owns an origin each time it sends 
a command. It
does not store a target per database, so a frame that moves to a new process is 
never left
bound to a destroyed target. Remote objects in requestData results are now 
bound to that
target; before, they were always created for the main target. When 
requestIndexedDatabaseData
gets no entries, it now passes an empty array instead of null, because
IndexedDatabaseObjectStoreContentView iterates the entries; null threw and left 
the view unable
to fetch again. clearObjectStore returns the command's promise.

When frame targets carry the domain, an origin goes to the target behind the 
main-world
execution context of a frame with that origin. WI.Frame favors a context 
reported by the
frame's own frame target, so this is the frame target once it has reported, and 
the main
target otherwise. The origin is requested only once such a context exists, and 
again whenever
a frame's main-world context changes: a frame target can report its context 
before the
frontend learns about the frame, and asking the main target instead would fail 
for an
out-of-process frame. Without frame targets, every origin still goes to the 
main target.

WebKitLegacy also creates frame targets, but their execution contexts carry 
frame IDs in a
different format from its Page domain, so they never attach to a frame. 
Following the frame's
context keeps WebKitLegacy on the main target, which reaches every frame there; 
matching frame
targets directly would find none, and no iframe database would be listed.

The Storage tab can now show more than one IndexedDB host under Site Isolation, 
which exposed
an existing bug: every host folder after the first had a blank title. 
StorageTreeElement's
constructor sets the title from `name`, but IndexedDatabaseHostTreeElement 
assigns `_host`
only after super() returns. The first host is retitled when the sidebar 
flattens and then
unflattens it; later hosts never are. IndexedDatabaseHostTreeElement now sets 
its title again
once `_host` is set.

Test: http/tests/site-isolation/inspector/storage/indexeddb-frame-target.html

* 
LayoutTests/http/tests/site-isolation/inspector/storage/indexeddb-frame-target-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/indexeddb-frame-target.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/resources/indexeddb-frame.html:
 Added.
* Source/JavaScriptCore/inspector/protocol/IndexedDB.json:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/inspector/FrameInspectorController.cpp:
(WebCore::FrameInspectorController::createLazyAgents):
* Source/WebCore/inspector/PageInspectorController.cpp:
(WebCore::PageInspectorController::createLazyAgents):
* Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp:
(WebCore::InspectorIndexedDBAgent::InspectorIndexedDBAgent):
(WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
(WebCore::InspectorIndexedDBAgent::requestDatabase):
(WebCore::InspectorIndexedDBAgent::requestData):
(WebCore::InspectorIndexedDBAgent::clearObjectStore):
* Source/WebCore/inspector/agents/InspectorIndexedDBAgent.h:
(WebCore::InspectorIndexedDBAgent::inspectedPage const): Deleted.
* Source/WebCore/inspector/agents/frame/FrameIndexedDBAgent.cpp: Added.
(WebCore::FrameIndexedDBAgent::FrameIndexedDBAgent):
(WebCore::FrameIndexedDBAgent::frameForSecurityOrigin):
* Source/WebCore/inspector/agents/frame/FrameIndexedDBAgent.h: Added.
* Source/WebCore/inspector/agents/page/PageIndexedDBAgent.cpp: Added.
(WebCore::PageIndexedDBAgent::PageIndexedDBAgent):
(WebCore::PageIndexedDBAgent::frameForSecurityOrigin):
* Source/WebCore/inspector/agents/page/PageIndexedDBAgent.h: Added.
* Source/WebInspectorUI/UserInterface/Controllers/IndexedDBManager.js:
(WI.IndexedDBManager.prototype.enable):
(WI.IndexedDBManager.prototype.disable):
(WI.IndexedDBManager.prototype.requestIndexedDatabaseData):
(WI.IndexedDBManager.prototype.clearObjectStore):
(WI.IndexedDBManager.prototype._addIndexedDBDatabasesIfNeeded):
(WI.IndexedDBManager.prototype._targetForSecurityOrigin):
(WI.IndexedDBManager.prototype._framePageExecutionContextChanged):
(WI.IndexedDBManager):
* Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseHostTreeElement.js:
(WI.IndexedDatabaseHostTreeElement):

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



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

Reply via email to