Bug 27400 - Inspector: Automatically Refresh DOM Storage Grids on "storage" event
Summary: Inspector: Automatically Refresh DOM Storage Grids on "storage" event
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All OS X 10.5
: P2 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-17 17:57 PDT by Joseph Pecoraro
Modified: 2009-07-29 03:45 PDT (History)
2 users (show)

See Also:


Attachments
Live Update both DOM Storage Grids (3.66 KB, patch)
2009-07-17 18:02 PDT, Joseph Pecoraro
timothy: review-
Details | Formatted Diff | Diff
Fixed Based on Review (3.71 KB, patch)
2009-07-23 14:36 PDT, Joseph Pecoraro
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 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!
Comment 1 Joseph Pecoraro 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.
Comment 2 Timothy Hatcher 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.
Comment 3 Joseph Pecoraro 2009-07-23 14:36:04 PDT
Created attachment 33378 [details]
Fixed Based on Review
Comment 4 Joseph Pecoraro 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.
Comment 5 Timothy Hatcher 2009-07-28 21:55:27 PDT
http://trac.webkit.org/changeset/46518
Comment 6 Anthony Ricaud 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.