RESOLVED FIXED 27400
Inspector: Automatically Refresh DOM Storage Grids on "storage" event
https://bugs.webkit.org/show_bug.cgi?id=27400
Summary Inspector: Automatically Refresh DOM Storage Grids on "storage" event
Joseph Pecoraro
Reported 2009-07-17 17:57:44 PDT
It is too much work to click that small Refresh button to view changes in the dataGrid. The inspected window fires a storage event that can be hooked into to automatically update the data grid. NOTE: I could totally see this as being a "setting". If lots of storage events are firing and the table keeps updating it might not be good for a developer to work with. It may be a good idea to add a permanent setting, and toolbar item, that will allow the user to activate "live updates" or not!
Attachments
Live Update both DOM Storage Grids (3.66 KB, patch)
2009-07-17 18:02 PDT, Joseph Pecoraro
timothy: review-
Fixed Based on Review (3.71 KB, patch)
2009-07-23 14:36 PDT, Joseph Pecoraro
timothy: review+
Joseph Pecoraro
Comment 1 2009-07-17 18:02: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.
Timothy Hatcher
Comment 2 2009-07-23 11:52:34 PDT
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.
Joseph Pecoraro
Comment 3 2009-07-23 14:36:04 PDT
Created attachment 33378 [details] Fixed Based on Review
Joseph Pecoraro
Comment 4 2009-07-23 14:38:38 PDT
(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.
Timothy Hatcher
Comment 5 2009-07-28 21:55:27 PDT
Anthony Ricaud
Comment 6 2009-07-29 03:45:16 PDT
Instead of a setting, another option is to add a timer before doing the update. Both options are valid.
Note You need to log in before you can comment on or make changes to this bug.