Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bd758aa007dd580c7b3a547ce485d52afc5343fb
      
https://github.com/WebKit/WebKit/commit/bd758aa007dd580c7b3a547ce485d52afc5343fb
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-20 (Mon, 20 Jul 2026)

  Changed paths:
    M Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js

  Log Message:
  -----------
  Web Inspector: DOMStorageManager looks up storage objects with an O(n) 
Object.shallowEqual scan on every storage event
https://bugs.webkit.org/show_bug.cgi?id=319415
rdar://182241938

Reviewed by Devin Rousso.

DOMStorageManager stored its DOMStorageObjects in an array and resolved
the object for an incoming storage event by walking the whole array and
calling Object.shallowEqual on each entry's identifier. This ran for every
DOMStorage observer event (itemAdded/itemUpdated/itemRemoved/itemsCleared),
as well as on every add-if-needed and inspect.

Back the collection with two Maps, one for localStorage and one for
sessionStorage, each keyed directly by securityOrigin. This turns the
lookup into an O(1) Map.get and drops the per-element Object.shallowEqual
comparison. The public domStorageObjects getter continues to return an
array, so existing consumers are unchanged.

Covered by the existing inspector/storage/domStorage-events.html test,
which drives set/remove/clear on both sessionStorage and localStorage and
asserts the events reach the correct DOMStorageObject.

* Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js:
(WI.DOMStorageManager.prototype.get domStorageObjects):
(WI.DOMStorageManager.prototype._reset):
(WI.DOMStorageManager.prototype._domStorageForIdentifier):
(WI.DOMStorageManager.prototype._addDOMStorageIfNeeded):

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



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

Reply via email to