Title: [183867] trunk/Source
Revision
183867
Author
commit-qu...@webkit.org
Date
2015-05-06 05:55:20 -0700 (Wed, 06 May 2015)

Log Message

Web Inspector: DOMStorage exception and issue with sessionStorage
https://bugs.webkit.org/show_bug.cgi?id=144646

Patch by Joseph Pecoraro <pecor...@apple.com> on 2015-05-06
Reviewed by Timothy Hatcher.

Source/WebCore:

* inspector/InspectorDOMStorageAgent.cpp:
(WebCore::InspectorDOMStorageAgent::findStorageArea):
Return session storage if the identifier says not local storage.

Source/WebInspectorUI:

* UserInterface/Views/DOMStorageContentView.js:
(WebInspector.DOMStorageContentView):
(WebInspector.DOMStorageContentView.prototype._populate):
(WebInspector.DOMStorageContentView.prototype.reset): Deleted.
Always have the datagrid be available with a default sort.

(WebInspector.DOMStorageContentView.prototype._sortDataGrid.comparator):
(WebInspector.DOMStorageContentView.prototype._sortDataGrid):
Simplify and correct the order.

(WebInspector.DOMStorageContentView.prototype.cleanup):
Cleanup some uses of delete.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid.prototype.sortNodesImmediately):
Provide a way to sort immediately without a visible delay.

(WebInspector.DataGrid.prototype._sortNodesCallback):
Cleanup some dead code to simplify sorting.

(WebInspector.DataGridNode.prototype._attach):
When sorting, the children list does not match the child node list,
so ensure that placeholder nodes are added to the end.

(WebInspector.PlaceholderDataGridNode.prototype.makeNormal):
Cleanup some uses of delete.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (183866 => 183867)


--- trunk/Source/WebCore/ChangeLog	2015-05-06 11:59:41 UTC (rev 183866)
+++ trunk/Source/WebCore/ChangeLog	2015-05-06 12:55:20 UTC (rev 183867)
@@ -1,3 +1,14 @@
+2015-05-06  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: DOMStorage exception and issue with sessionStorage
+        https://bugs.webkit.org/show_bug.cgi?id=144646
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/InspectorDOMStorageAgent.cpp:
+        (WebCore::InspectorDOMStorageAgent::findStorageArea):
+        Return session storage if the identifier says not local storage.
+
 2015-05-06  Xabier Rodriguez Calvar  <calva...@igalia.com> and Youenn Fablet  <youenn.fab...@crf.canon.fr>
 
         Move ReadableStreamJSSource.h/.cpp to ReadableJSStream.h/.cpp

Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp (183866 => 183867)


--- trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp	2015-05-06 11:59:41 UTC (rev 183866)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp	2015-05-06 12:55:20 UTC (rev 183867)
@@ -42,6 +42,7 @@
 #include "PageGroup.h"
 #include "SecurityOrigin.h"
 #include "Storage.h"
+#include "StorageNamespace.h"
 #include "StorageNamespaceProvider.h"
 #include "VoidCallback.h"
 #include <inspector/InspectorFrontendDispatchers.h>
@@ -198,6 +199,8 @@
         return nullptr;
     }
 
+    if (!isLocalStorage)
+        return m_pageAgent->page()->sessionStorage()->storageArea(targetFrame->document()->securityOrigin());
     return m_pageAgent->page()->storageNamespaceProvider().localStorageArea(*targetFrame->document());
 }
 

Modified: trunk/Source/WebInspectorUI/ChangeLog (183866 => 183867)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-05-06 11:59:41 UTC (rev 183866)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-05-06 12:55:20 UTC (rev 183867)
@@ -1,5 +1,39 @@
 2015-05-06  Joseph Pecoraro  <pecor...@apple.com>
 
+        Web Inspector: DOMStorage exception and issue with sessionStorage
+        https://bugs.webkit.org/show_bug.cgi?id=144646
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/DOMStorageContentView.js:
+        (WebInspector.DOMStorageContentView):
+        (WebInspector.DOMStorageContentView.prototype._populate):
+        (WebInspector.DOMStorageContentView.prototype.reset): Deleted.
+        Always have the datagrid be available with a default sort.
+
+        (WebInspector.DOMStorageContentView.prototype._sortDataGrid.comparator):
+        (WebInspector.DOMStorageContentView.prototype._sortDataGrid):
+        Simplify and correct the order.
+
+        (WebInspector.DOMStorageContentView.prototype.cleanup):
+        Cleanup some uses of delete.
+
+        * UserInterface/Views/DataGrid.js:
+        (WebInspector.DataGrid.prototype.sortNodesImmediately):
+        Provide a way to sort immediately without a visible delay.
+
+        (WebInspector.DataGrid.prototype._sortNodesCallback):
+        Cleanup some dead code to simplify sorting.
+
+        (WebInspector.DataGridNode.prototype._attach):
+        When sorting, the children list does not match the child node list,
+        so ensure that placeholder nodes are added to the end.
+
+        (WebInspector.PlaceholderDataGridNode.prototype.makeNormal):
+        Cleanup some uses of delete.
+
+2015-05-06  Joseph Pecoraro  <pecor...@apple.com>
+
         Web Inspector: SourceCodeTextEditor shows "undefined" instead of resource content when pausing during resource load
         https://bugs.webkit.org/show_bug.cgi?id=144662
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js (183866 => 183867)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js	2015-05-06 11:59:41 UTC (rev 183866)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.js	2015-05-06 12:55:20 UTC (rev 183867)
@@ -35,7 +35,18 @@
     representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemRemoved, this.itemRemoved, this);
     representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemUpdated, this.itemUpdated, this);
 
-    this.reset();
+    var columns = {};
+    columns.key = {title: WebInspector.UIString("Key"), sortable: true};
+    columns.value = {title: WebInspector.UIString("Value"), sortable: true};
+
+    this._dataGrid = new WebInspector.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
+    this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
+    this._dataGrid.sortColumnIdentifier = "key";
+    this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
+
+    this.element.appendChild(this._dataGrid.element);
+
+    this._populate();
 };
 
 WebInspector.DOMStorageContentView.StyleClassName = "dom-storage";
@@ -50,40 +61,6 @@
 
     // Public
 
-    reset: function()
-    {
-        this.representedObject.getEntries(function(error, entries) {
-            if (error)
-                return;
-
-            if (!this._dataGrid) {
-                var columns = {};
-                columns.key = {title: WebInspector.UIString("Key"), sortable: true};
-                columns.value = {title: WebInspector.UIString("Value"), sortable: true};
-
-                this._dataGrid = new WebInspector.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
-                this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sortDataGrid, this);
-
-                this.element.appendChild(this._dataGrid.element);
-            }
-
-            console.assert(this._dataGrid);
-
-            var nodes = [];
-            for (var entry of entries) {
-                if (!entry[0] || !entry[1])
-                    continue;
-                var data = "" entry[0], value: entry[1]};
-                var node = new WebInspector.DataGridNode(data, false);
-                this._dataGrid.appendChild(node);
-            }
-
-            this._sortDataGrid();
-            this._dataGrid.addPlaceholderNode();
-            this._dataGrid.updateLayout();
-        }.bind(this));
-    },
-
     saveToCookie: function(cookie)
     {
         cookie.type = WebInspector.ContentViewCookieType.DOMStorage;
@@ -158,19 +135,37 @@
 
     // Private
 
-    _sortDataGrid: function()
+    _populate: function()
     {
-        if (!this._dataGrid.sortOrder)
-            return;
+        this.representedObject.getEntries(function(error, entries) {
+            if (error)
+                return;
 
+            var nodes = [];
+            for (var entry of entries) {
+                if (!entry[0] || !entry[1])
+                    continue;
+                var data = "" entry[0], value: entry[1]};
+                var node = new WebInspector.DataGridNode(data, false);
+                this._dataGrid.appendChild(node);
+            }
+
+            this._sortDataGrid();
+            this._dataGrid.addPlaceholderNode();
+            this._dataGrid.updateLayout();
+        }.bind(this));
+    },
+
+    _sortDataGrid: function()
+    {
         var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier || "key";
 
         function comparator(a, b)
         {
-            return b.data[sortColumnIdentifier].localeCompare(a.data[sortColumnIdentifier]);
+            return a.data[sortColumnIdentifier].localeCompare(b.data[sortColumnIdentifier]);
         }
 
-        this._dataGrid.sortNodes(comparator, this._dataGrid.sortOrder);
+        this._dataGrid.sortNodesImmediately(comparator);
     },
 
     _deleteCallback: function(node)
@@ -210,9 +205,9 @@
             editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingKeyStyleClassName);
             editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingValueStyleClassName);
             editingNode.element.classList.remove(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);
-            delete editingNode.__hasUncommittedEdits;
-            delete editingNode.__originalKey;
-            delete editingNode.__originalValue;
+            editingNode.__hasUncommittedEdits = undefined;
+            editingNode.__originalKey = undefined;
+            editingNode.__originalValue = undefined;
         }
 
         function restoreOriginalValues()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js (183866 => 183867)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js	2015-05-06 11:59:41 UTC (rev 183866)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js	2015-05-06 12:55:20 UTC (rev 183867)
@@ -832,22 +832,28 @@
         this._sortNodesRequestId = window.requestAnimationFrame(this._sortNodesCallback.bind(this, comparator));
     },
 
+    sortNodesImmediately: function(comparator)
+    {
+        this._sortNodesCallback(comparator);
+    },
+
     _sortNodesCallback: function(comparator)
     {
         function comparatorWrapper(aRow, bRow)
         {
-            var reverseFactor = this.sortOrder !== WebInspector.DataGrid.SortOrder.Ascending ? -1 : 1;
             var aNode = aRow._dataGridNode;
             var bNode = bRow._dataGridNode;
-            if (aNode._data.summaryRow || aNode.isPlaceholderNode)
+
+            if (aNode.isPlaceholderNode)
                 return 1;
-            if (bNode._data.summaryRow || bNode.isPlaceholderNode)
+            if (bNode.isPlaceholderNode)
                 return -1;
 
+            var reverseFactor = this.sortOrder !== WebInspector.DataGrid.SortOrder.Ascending ? -1 : 1;
             return reverseFactor * comparator(aNode, bNode);
         }
 
-        delete this._sortNodesRequestId;
+        this._sortNodesRequestId = undefined;
 
         if (this._editing) {
             this._sortAfterEditingCallback = this.sortNodes.bind(this, comparator);
@@ -1823,11 +1829,13 @@
 
         var nextElement = null;
 
-        var previousGridNode = this.traversePreviousNode(true, true);
-        if (previousGridNode && previousGridNode.element.parentNode)
-            nextElement = previousGridNode.element.nextSibling;
-        else if (!previousGridNode)
-            nextElement = this.dataGrid.dataTableBodyElement.firstChild;
+        if (!this.isPlaceholderNode) {
+            var previousGridNode = this.traversePreviousNode(true, true);
+            if (previousGridNode && previousGridNode.element.parentNode)
+                nextElement = previousGridNode.element.nextSibling;
+            else if (!previousGridNode)
+                nextElement = this.dataGrid.dataTableBodyElement.firstChild;
+        }
 
         // If there is no next grid node, then append before the last child since the last child is the filler row.
         console.assert(this.dataGrid.dataTableBodyElement.lastChild.classList.contains("filler"));
@@ -1896,7 +1904,6 @@
 
     makeNormal: function()
     {
-        delete this.isPlaceholderNode;
-        delete this.makeNormal;
+        this.isPlaceholderNode = false;
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to