Changeset 109223 in webkit


Ignore:
Timestamp:
Feb 29, 2012 9:40:55 AM (12 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: [InspectorIndexedDB] Add refresh to IndexedDB support.
https://bugs.webkit.org/show_bug.cgi?id=79695

Reviewed by Pavel Feldman.

  • inspector/front-end/IndexedDBViews.js:

(WebInspector.IDBDataView):
(WebInspector.IDBDataView.prototype._refreshButtonClicked):
(WebInspector.IDBDataView.prototype.get statusBarItems):

  • inspector/front-end/ResourcesPanel.js:

(WebInspector.IndexedDBTreeElement):
(WebInspector.IndexedDBTreeElement.prototype.onattach):
(WebInspector.IndexedDBTreeElement.prototype._handleContextMenuEvent):
(WebInspector.IDBDatabaseTreeElement.prototype.onattach):
(WebInspector.IDBDatabaseTreeElement.prototype._handleContextMenuEvent):
(WebInspector.IDBDatabaseTreeElement.prototype._refreshIndexedDB):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109221 r109223  
     12012-02-27  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: [InspectorIndexedDB] Add refresh to IndexedDB support.
     4        https://bugs.webkit.org/show_bug.cgi?id=79695
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/front-end/IndexedDBViews.js:
     9        (WebInspector.IDBDataView):
     10        (WebInspector.IDBDataView.prototype._refreshButtonClicked):
     11        (WebInspector.IDBDataView.prototype.get statusBarItems):
     12        * inspector/front-end/ResourcesPanel.js:
     13        (WebInspector.IndexedDBTreeElement):
     14        (WebInspector.IndexedDBTreeElement.prototype.onattach):
     15        (WebInspector.IndexedDBTreeElement.prototype._handleContextMenuEvent):
     16        (WebInspector.IDBDatabaseTreeElement.prototype.onattach):
     17        (WebInspector.IDBDatabaseTreeElement.prototype._handleContextMenuEvent):
     18        (WebInspector.IDBDatabaseTreeElement.prototype._refreshIndexedDB):
     19
    1202012-02-29  Andrey Kosyakov  <caseq@chromium.org>
    221
  • trunk/Source/WebCore/inspector/front-end/IndexedDBViews.js

    r108495 r109223  
    3838    WebInspector.View.call(this);
    3939    this.registerRequiredCSS("indexedDBViews.css");
    40    
     40
    4141    this.element.addStyleClass("fill");
    4242    this.element.addStyleClass("indexed-db-database-view");
    43    
     43
    4444    this._headersListElement = this.element.createChild("ol", "outline-disclosure");
    4545    this._headersTreeOutline = new TreeOutline(this._headersListElement);
    4646    this._headersTreeOutline.expandTreeElementsWhenArrowing = true;
    47    
     47
    4848    this._securityOriginTreeElement = new TreeElement("", null, false);
    4949    this._securityOriginTreeElement.selectable = false;
     
    106106    WebInspector.View.call(this);
    107107    this.registerRequiredCSS("indexedDBViews.css");
    108    
    109     this._model = model; 
     108
     109    this._model = model;
    110110    this._databaseId = databaseId;
    111111    this._isIndex = !!index;
     
    115115    var editorToolbar = this._createEditorToolbar();
    116116    this.element.appendChild(editorToolbar);
    117    
     117
    118118    this._dataGridContainer = this.element.createChild("div", "fill");
    119119    this._dataGridContainer.addStyleClass("data-grid-container");
     120
     121    this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
     122    this._refreshButton.addEventListener("click", this._refreshButtonClicked, this);
    120123
    121124    this._pageSize = 50;
     
    135138        columns["number"].title = WebInspector.UIString("#");
    136139        columns["number"].width = "50px";
    137        
     140
    138141        var keyPath = this._isIndex ? this._index.keyPath : this._objectStore.keyPath;
    139142        columns["key"] = {};
    140143        var keyColumnTitle = WebInspector.UIString("Key") + (keyPath ? " (" + keyPath + ")" : "");
    141144        columns["key"].title = keyColumnTitle;
    142        
     145
    143146        if (this._isIndex) {
    144147            columns["primaryKey"] = {};
     
    146149            columns["primaryKey"].title = primaryKeyColumnTitle;
    147150        }
    148        
     151
    149152        columns["value"] = {};
    150153        columns["value"].title = WebInspector.UIString("Value");
     
    170173        this._pageBackButton.addEventListener("click", this._pageBackButtonClicked.bind(this), false);
    171174        editorToolbar.appendChild(this._pageBackButton);
    172        
     175
    173176        this._pageForwardButton = editorToolbar.createChild("button", "forward-button");
    174177        this._pageForwardButton.addStyleClass("status-bar-item");
     
    178181        this._pageForwardButton.addEventListener("click", this._pageForwardButtonClicked.bind(this), false);
    179182        editorToolbar.appendChild(this._pageForwardButton);
    180        
     183
    181184        this._keyInputElement = editorToolbar.createChild("input", "key-input");
    182185        this._keyInputElement.placeholder = WebInspector.UIString("Start from key");
     
    194197        this._updateData(false);
    195198    },
    196    
     199
    197200    _pageForwardButtonClicked: function()
    198201    {
     
    200203        this._updateData(false);
    201204    },
    202    
     205
    203206    _keyInputChanged: function()
    204207    {
    205         window.setTimeout(this._updateData.bind(this, false), 0);       
    206     },
    207    
     208        window.setTimeout(this._updateData.bind(this, false), 0);
     209    },
     210
    208211    /**
    209212     * @param {WebInspector.IndexedDBModel.ObjectStore} objectStore
     
    221224
    222225        this._skipCount = 0;
    223         this._updateData(true); 
    224     },
    225    
     226        this._updateData(true);
     227    },
     228
    226229    /**
    227230     * @param {string} keyString
     
    237240        return result;
    238241    },
    239    
     242
    240243    /**
    241244     * @return {string}
     
    256259        var pageSize = this._pageSize;
    257260        var skipCount = this._skipCount;
    258        
     261
    259262        if (!force && this._lastKey === key && this._lastPageSize === pageSize && this._lastSkipCount === skipCount)
    260263            return;
     
    287290                this._dataGrid.appendChild(node);
    288291            }
    289            
     292
    290293            this._pageBackButton.disabled = skipCount === 0;
    291294            this._pageForwardButton.disabled = !hasMore;
    292295        }
    293        
     296
    294297        var idbKeyRange = key ? window.webkitIDBKeyRange.lowerBound(key) : null;
    295298        if (this._isIndex)
     
    298301            this._model.loadObjectStoreData(this._databaseId, this._objectStore.name, idbKeyRange, skipCount, pageSize, callback.bind(this));
    299302    },
     303
     304    _refreshButtonClicked: function(event)
     305    {
     306        this._updateData(true);
     307    },
     308
     309    get statusBarItems()
     310    {
     311        return [this._refreshButton.element];
     312    }
    300313}
    301314
     
    311324{
    312325    WebInspector.DataGridNode.call(this, data, false);
    313    
     326
    314327    this._valueTitle = valueTitle;
    315328    this.selectable = false;
     
    324337        if (columnIdentifier !== "value")
    325338            return WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
    326        
     339
    327340        var section = new WebInspector.ObjectPropertiesSection(this.data["value"], this._valueTitle)
    328341        section.editable = false;
  • trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js

    r108495 r109223  
    15141514    },
    15151515
     1516    onattach: function()
     1517    {
     1518        WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this);
     1519        this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
     1520    },
     1521
     1522    _handleContextMenuEvent: function(event)
     1523    {
     1524        var contextMenu = new WebInspector.ContextMenu();
     1525        contextMenu.appendItem(WebInspector.UIString("Refresh IndexedDB"), this.refreshIndexedDB.bind(this));
     1526        contextMenu.show(event);
     1527    },
     1528
    15161529    _createIndexedDBModel: function()
    15171530    {
     
    16181631    },
    16191632
     1633    onattach: function()
     1634    {
     1635        WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
     1636        this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
     1637    },
     1638
     1639    _handleContextMenuEvent: function(event)
     1640    {
     1641        var contextMenu = new WebInspector.ContextMenu();
     1642        contextMenu.appendItem(WebInspector.UIString("Refresh IndexedDB"), this._refreshIndexedDB.bind(this));
     1643        contextMenu.show(event);
     1644    },
     1645
     1646    _refreshIndexedDB: function(event)
     1647    {
     1648        this._model.refreshDatabaseNames();
     1649    },
     1650
    16201651    /**
    16211652     * @param {WebInspector.IndexedDBModel.Database} database
     
    16411672            }
    16421673        }
    1643        
     1674
    16441675        if (this.children.length) {
    16451676            this.hasChildren = true;
     
    16571688            this._view = new WebInspector.IDBDatabaseView(this._database);
    16581689
    1659         this._storagePanel.showIndexedDB(this._view);       
     1690        this._storagePanel.showIndexedDB(this._view);
    16601691    }
    16611692}
     
    17091740            }
    17101741        }
    1711        
     1742
    17121743        if (this.children.length) {
    17131744            this.hasChildren = true;
     
    17251756            this._view = new WebInspector.IDBDataView(this._model, this._databaseId, this._objectStore, null);
    17261757
    1727         this._storagePanel.showIndexedDB(this._view);       
     1758        this._storagePanel.showIndexedDB(this._view);
    17281759    }
    17291760}
     
    17611792    {
    17621793        this._index = index;
    1763        
     1794
    17641795        if (this._view)
    17651796            this._view.update(this._index);
     
    17721803            this._view = new WebInspector.IDBDataView(this._model, this._databaseId, this._objectStore, this._index);
    17731804
    1774         this._storagePanel.showIndexedDB(this._view);       
     1805        this._storagePanel.showIndexedDB(this._view);
    17751806    }
    17761807}
Note: See TracChangeset for help on using the changeset viewer.