Title: [109223] trunk/Source/WebCore
Revision
109223
Author
[email protected]
Date
2012-02-29 09:40:55 -0800 (Wed, 29 Feb 2012)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109222 => 109223)


--- trunk/Source/WebCore/ChangeLog	2012-02-29 17:37:04 UTC (rev 109222)
+++ trunk/Source/WebCore/ChangeLog	2012-02-29 17:40:55 UTC (rev 109223)
@@ -1,3 +1,22 @@
+2012-02-27  Vsevolod Vlasov  <[email protected]>
+
+        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):
+
 2012-02-29  Andrey Kosyakov  <[email protected]>
 
         Web Inspector: timeline markers are not shown on the timeline panel

Modified: trunk/Source/WebCore/inspector/front-end/IndexedDBViews.js (109222 => 109223)


--- trunk/Source/WebCore/inspector/front-end/IndexedDBViews.js	2012-02-29 17:37:04 UTC (rev 109222)
+++ trunk/Source/WebCore/inspector/front-end/IndexedDBViews.js	2012-02-29 17:40:55 UTC (rev 109223)
@@ -37,14 +37,14 @@
 {
     WebInspector.View.call(this);
     this.registerRequiredCSS("indexedDBViews.css");
-    
+
     this.element.addStyleClass("fill");
     this.element.addStyleClass("indexed-db-database-view");
-    
+
     this._headersListElement = this.element.createChild("ol", "outline-disclosure");
     this._headersTreeOutline = new TreeOutline(this._headersListElement);
     this._headersTreeOutline.expandTreeElementsWhenArrowing = true;
-    
+
     this._securityOriginTreeElement = new TreeElement("", null, false);
     this._securityOriginTreeElement.selectable = false;
     this._headersTreeOutline.appendChild(this._securityOriginTreeElement);
@@ -105,8 +105,8 @@
 {
     WebInspector.View.call(this);
     this.registerRequiredCSS("indexedDBViews.css");
-    
-    this._model = model; 
+
+    this._model = model;
     this._databaseId = databaseId;
     this._isIndex = !!index;
 
@@ -114,10 +114,13 @@
 
     var editorToolbar = this._createEditorToolbar();
     this.element.appendChild(editorToolbar);
-    
+
     this._dataGridContainer = this.element.createChild("div", "fill");
     this._dataGridContainer.addStyleClass("data-grid-container");
 
+    this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
+    this._refreshButton.addEventListener("click", this._refreshButtonClicked, this);
+
     this._pageSize = 50;
     this._skipCount = 0;
 
@@ -134,18 +137,18 @@
         columns["number"] = {};
         columns["number"].title = WebInspector.UIString("#");
         columns["number"].width = "50px";
-        
+
         var keyPath = this._isIndex ? this._index.keyPath : this._objectStore.keyPath;
         columns["key"] = {};
         var keyColumnTitle = WebInspector.UIString("Key") + (keyPath ? " (" + keyPath + ")" : "");
         columns["key"].title = keyColumnTitle;
-        
+
         if (this._isIndex) {
             columns["primaryKey"] = {};
             var primaryKeyColumnTitle = WebInspector.UIString("Primary key") + (this._objectStore.keyPath ? " (" + this._objectStore.keyPath + ")" : "");
             columns["primaryKey"].title = primaryKeyColumnTitle;
         }
-        
+
         columns["value"] = {};
         columns["value"].title = WebInspector.UIString("Value");
 
@@ -169,7 +172,7 @@
         this._pageBackButton.appendChild(document.createElement("img"));
         this._pageBackButton.addEventListener("click", this._pageBackButtonClicked.bind(this), false);
         editorToolbar.appendChild(this._pageBackButton);
-        
+
         this._pageForwardButton = editorToolbar.createChild("button", "forward-button");
         this._pageForwardButton.addStyleClass("status-bar-item");
         this._pageForwardButton.title = WebInspector.UIString("Show next page.");
@@ -177,7 +180,7 @@
         this._pageForwardButton.appendChild(document.createElement("img"));
         this._pageForwardButton.addEventListener("click", this._pageForwardButtonClicked.bind(this), false);
         editorToolbar.appendChild(this._pageForwardButton);
-        
+
         this._keyInputElement = editorToolbar.createChild("input", "key-input");
         this._keyInputElement.placeholder = WebInspector.UIString("Start from key");
         this._keyInputElement.addEventListener("paste", this._keyInputChanged.bind(this));
@@ -193,18 +196,18 @@
         this._skipCount = Math.max(0, this._skipCount - this._pageSize);
         this._updateData(false);
     },
-    
+
     _pageForwardButtonClicked: function()
     {
         this._skipCount = this._skipCount + this._pageSize;
         this._updateData(false);
     },
-    
+
     _keyInputChanged: function()
     {
-        window.setTimeout(this._updateData.bind(this, false), 0);        
+        window.setTimeout(this._updateData.bind(this, false), 0);
     },
-    
+
     /**
      * @param {WebInspector.IndexedDBModel.ObjectStore} objectStore
      * @param {WebInspector.IndexedDBModel.Index} index
@@ -220,9 +223,9 @@
         this._dataGrid.show(this._dataGridContainer);
 
         this._skipCount = 0;
-        this._updateData(true); 
+        this._updateData(true);
     },
-    
+
     /**
      * @param {string} keyString
      */
@@ -236,7 +239,7 @@
         }
         return result;
     },
-    
+
     /**
      * @return {string}
      */
@@ -255,7 +258,7 @@
         var key = this._parseKey(this._keyInputElement.value);
         var pageSize = this._pageSize;
         var skipCount = this._skipCount;
-        
+
         if (!force && this._lastKey === key && this._lastPageSize === pageSize && this._lastSkipCount === skipCount)
             return;
 
@@ -286,17 +289,27 @@
                 var node = new WebInspector.IDBDataGridNode(valueTitle, data);
                 this._dataGrid.appendChild(node);
             }
-            
+
             this._pageBackButton.disabled = skipCount === 0;
             this._pageForwardButton.disabled = !hasMore;
         }
-        
+
         var idbKeyRange = key ? window.webkitIDBKeyRange.lowerBound(key) : null;
         if (this._isIndex)
             this._model.loadIndexData(this._databaseId, this._objectStore.name, this._index.name, idbKeyRange, skipCount, pageSize, callback.bind(this));
         else
             this._model.loadObjectStoreData(this._databaseId, this._objectStore.name, idbKeyRange, skipCount, pageSize, callback.bind(this));
     },
+
+    _refreshButtonClicked: function(event)
+    {
+        this._updateData(true);
+    },
+
+    get statusBarItems()
+    {
+        return [this._refreshButton.element];
+    }
 }
 
 WebInspector.IDBDataView.prototype.__proto__ = WebInspector.View.prototype;
@@ -310,7 +323,7 @@
 WebInspector.IDBDataGridNode = function(valueTitle, data)
 {
     WebInspector.DataGridNode.call(this, data, false);
-    
+
     this._valueTitle = valueTitle;
     this.selectable = false;
 }
@@ -323,7 +336,7 @@
     {
         if (columnIdentifier !== "value")
             return WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
-        
+
         var section = new WebInspector.ObjectPropertiesSection(this.data["value"], this._valueTitle)
         section.editable = false;
         section.skipProto = true;

Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (109222 => 109223)


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2012-02-29 17:37:04 UTC (rev 109222)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2012-02-29 17:40:55 UTC (rev 109223)
@@ -1513,6 +1513,19 @@
             this._createIndexedDBModel();
     },
 
+    onattach: function()
+    {
+        WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this);
+        this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
+    },
+
+    _handleContextMenuEvent: function(event)
+    {
+        var contextMenu = new WebInspector.ContextMenu();
+        contextMenu.appendItem(WebInspector.UIString("Refresh IndexedDB"), this.refreshIndexedDB.bind(this));
+        contextMenu.show(event);
+    },
+
     _createIndexedDBModel: function()
     {
         this._indexedDBModel = new WebInspector.IndexedDBModel();
@@ -1617,6 +1630,24 @@
         return "indexedDB://" + this._databaseId.securityOrigin + "/" + this._databaseId.name;
     },
 
+    onattach: function()
+    {
+        WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+        this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
+    },
+
+    _handleContextMenuEvent: function(event)
+    {
+        var contextMenu = new WebInspector.ContextMenu();
+        contextMenu.appendItem(WebInspector.UIString("Refresh IndexedDB"), this._refreshIndexedDB.bind(this));
+        contextMenu.show(event);
+    },
+
+    _refreshIndexedDB: function(event)
+    {
+        this._model.refreshDatabaseNames();
+    },
+
     /**
      * @param {WebInspector.IndexedDBModel.Database} database
      */
@@ -1640,7 +1671,7 @@
                 delete this._idbObjectStoreTreeElements[objectStoreName];
             }
         }
-        
+
         if (this.children.length) {
             this.hasChildren = true;
             this.expand();
@@ -1656,7 +1687,7 @@
         if (!this._view)
             this._view = new WebInspector.IDBDatabaseView(this._database);
 
-        this._storagePanel.showIndexedDB(this._view);        
+        this._storagePanel.showIndexedDB(this._view);
     }
 }
 
@@ -1708,7 +1739,7 @@
                 delete this._idbIndexTreeElements[indexName];
             }
         }
-        
+
         if (this.children.length) {
             this.hasChildren = true;
             this.expand();
@@ -1724,7 +1755,7 @@
         if (!this._view)
             this._view = new WebInspector.IDBDataView(this._model, this._databaseId, this._objectStore, null);
 
-        this._storagePanel.showIndexedDB(this._view);        
+        this._storagePanel.showIndexedDB(this._view);
     }
 }
 
@@ -1760,7 +1791,7 @@
     update: function(index)
     {
         this._index = index;
-        
+
         if (this._view)
             this._view.update(this._index);
     },
@@ -1771,7 +1802,7 @@
         if (!this._view)
             this._view = new WebInspector.IDBDataView(this._model, this._databaseId, this._objectStore, this._index);
 
-        this._storagePanel.showIndexedDB(this._view);        
+        this._storagePanel.showIndexedDB(this._view);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to