Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4424ae9f33dea14bdbf4dad81b2fd729501b1437
      
https://github.com/WebKit/WebKit/commit/4424ae9f33dea14bdbf4dad81b2fd729501b1437
  Author: Anuj Panta <[email protected]>
  Date:   2026-10-07 (Wed, 07 Oct 2026)

  Changed paths:
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/dom-storage-commands-frame-target-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/dom-storage-commands-frame-target.html
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/dom-storage-events-frame-target-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/dom-storage-events-frame-target.html
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/resources/dom-storage-frame.html
    A 
LayoutTests/http/tests/site-isolation/inspector/storage/resources/site-isolation-storage-test-utilities.js
    M Source/JavaScriptCore/inspector/protocol/DOMStorage.json
    M Source/WebCore/inspector/InspectorInstrumentation.cpp
    M Source/WebCore/inspector/InspectorInstrumentation.h
    M Source/WebCore/inspector/agents/frame/FrameDOMStorageAgent.cpp
    M Source/WebCore/inspector/agents/frame/FrameDOMStorageAgent.h
    M Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js
    M Source/WebInspectorUI/UserInterface/Models/DOMStorageObject.js

  Log Message:
  -----------
  Web Inspector: [SI] emit DOMStorage events for cross-origin iframes
https://bugs.webkit.org/show_bug.cgi?id=316801
rdar://179249741

Reviewed by BJ Burg.

Web Inspector's Storage tab showed nothing for a cross-origin iframe's
localStorage and sessionStorage, and never updated when that storage changed.

InspectorDOMStorageAgent locates an area by walking the frame tree by security 
origin, which skips RemoteFrames. FrameDOMStorageAgent already implemented the 
four commands against its own frame, but nothing reached it.

- didDispatchDOMStorageEventImpl finds the local frame whose document origin
matches the event's and dispatches to its FrameDOMStorageAgent, falling back to
the page agent when no frame agent owns the origin. It notifies at most one
agent: same-origin frames share a StorageArea and the frontend keys
DOMStorageObject on the StorageId alone.

- FrameDOMStorageAgent::didDispatchDOMStorageEvent builds its StorageId with the
page agent's helper so both emit an identical key.

- DOMStorageObject holds the target owning its origin and issues all four
commands against it. DOMStorageManager resolves that target from each
FrameTarget's execution context, and rebinds on ExecutionContextAdded since
that context can arrive after the frame's SecurityOriginDidChange.

- clearDOMStorageItems declared targetTypes ["page"], so it was not exposed on
frame targets. It now inherits the domain's types, matching the other three
commands; that also exposes it to itml, which already has the other three.

Two tests, mirroring LayoutTests/inspector/storage/ against an out-of-process
iframe: commands covers get/set/remove/clear for both storage types, verified
through the agent and inside the iframe's own process; events covers all four
events for both types, plus exactly-once delivery and no cross-origin leakage.

Tests: 
http/tests/site-isolation/inspector/storage/dom-storage-commands-frame-target.html
       
http/tests/site-isolation/inspector/storage/dom-storage-events-frame-target.html

* 
LayoutTests/http/tests/site-isolation/inspector/storage/dom-storage-commands-frame-target-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/dom-storage-commands-frame-target.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/dom-storage-events-frame-target-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/dom-storage-events-frame-target.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/resources/dom-storage-frame.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/storage/resources/site-isolation-storage-test-utilities.js:
 Added.
(TestPage.registerInitializer.async InspectorTest):
(TestPage.registerInitializer.InspectorTest.SiteIsolationStorage.logEntries):
(TestPage.registerInitializer.async let):
(TestPage.registerInitializer.InspectorTest.SiteIsolationStorage.readInFrame):
(TestPage.registerInitializer.InspectorTest.SiteIsolationStorage.evaluateInFrame):
(TestPage.registerInitializer.InspectorTest.SiteIsolationStorage.objectForOrigin):
(TestPage.registerInitializer):
* Source/JavaScriptCore/inspector/protocol/DOMStorage.json:
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didDispatchDOMStorageEventImpl):
* Source/WebCore/inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent):
* Source/WebCore/inspector/agents/frame/FrameDOMStorageAgent.cpp:
(WebCore::FrameDOMStorageAgent::didDispatchDOMStorageEvent):
* Source/WebCore/inspector/agents/frame/FrameDOMStorageAgent.h:
* Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js:
(WI.DOMStorageManager.prototype.enable):
(WI.DOMStorageManager.prototype.disable):
(WI.DOMStorageManager.prototype._addDOMStorageIfNeeded):
(WI.DOMStorageManager.prototype._frameTargetForFrame):
(WI.DOMStorageManager.prototype._frameTargetExecutionContextAdded):
(WI.DOMStorageManager.prototype._setTargetForOrigin):
(WI.DOMStorageManager):
* Source/WebInspectorUI/UserInterface/Models/DOMStorageObject.js:
(WI.DOMStorageObject.prototype.get target):
(WI.DOMStorageObject.prototype.set target):
(WI.DOMStorageObject.prototype.getEntries):
(WI.DOMStorageObject.prototype.removeItem):
(WI.DOMStorageObject.prototype.setItem):
(WI.DOMStorageObject.prototype.clear):

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



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

Reply via email to