Summary: | Inspector: Automatically Refresh DOM Storage Grids on "storage" event | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Joseph Pecoraro <joepeck> | ||||||
Component: | Web Inspector (Deprecated) | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Enhancement | CC: | rik, timothy | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | All | ||||||||
OS: | OS X 10.5 | ||||||||
Attachments: |
|
Description
Joseph Pecoraro
2009-07-17 17:57:44 PDT
Created attachment 32993 [details]
Live Update both DOM Storage Grids
NOTES:
- Assumes only 2 storages exist (like the current code does with the "isLocalStorage" property.
- Tested on localStorage and sessionStorage and it worked great.
- register/unregister functions would be great to use for a toolbar item in case this moves into a setting.
Comment on attachment 32993 [details] Live Update both DOM Storage Grids > - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. > + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. You should add your name and copyright on a new line instead. > + inspectedWindow.addEventListener('storage', this._storageEventListener, true); You should use double quotes for strings. > + var flag = (event.storageArea == InspectorController.inspectedWindow().localStorage); > + if (this._domStorage) { An early return would be better here. > + var domStorageLength = this._domStorage.length; > + for (var i = 0; i < domStorageLength; ++i) { > + var domStorage = this._domStorage[i]; > + if (flag == domStorage.isLocalStorage) { Triple equals. > + var view = domStorage._domStorageView; > + if (this.visibleView && view == this.visibleView) Ditto. Created attachment 33378 [details]
Fixed Based on Review
(In reply to comment #2) > You should add your name and copyright on a new line instead. Done. > You should use double quotes for strings. Done. All. > An early return would be better here. Done. > > + var domStorageLength = this._domStorage.length; > > + for (var i = 0; i < domStorageLength; ++i) { > > + var domStorage = this._domStorage[i]; > > + if (flag == domStorage.isLocalStorage) { > > Triple equals. Done. Renamed flag to "isLocalStorage" like the inspect() patch coming for Keishi. > > + var view = domStorage._domStorageView; > > + if (this.visibleView && view == this.visibleView) > > Ditto. Done. Instead of a setting, another option is to add a timer before doing the update. Both options are valid. |