Title: [183580] trunk/Source/WebInspectorUI
Revision
183580
Author
[email protected]
Date
2015-04-29 15:00:06 -0700 (Wed, 29 Apr 2015)

Log Message

Web Inspector: Split Storage from Resources tab
https://bugs.webkit.org/show_bug.cgi?id=144404

Reviewed by Joseph Pecoraro.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Main.js:
(WebInspector.loaded):
(WebInspector.isTabTypeAllowed):
(WebInspector._tabContentViewForType):
(WebInspector._updateNewTabButtonState):
(WebInspector.showStorageTab):
(WebInspector._storageWasInspected):
* UserInterface/Controllers/ApplicationCacheManager.js:
(WebInspector.ApplicationCacheManager.prototype.initialize):
(WebInspector.ApplicationCacheManager.prototype.get applicationCacheObjects):
* UserInterface/Controllers/StorageManager.js:
(WebInspector.StorageManager.prototype.get domStorageObjects):
(WebInspector.StorageManager.prototype.get databases):
(WebInspector.StorageManager.prototype.get indexedDatabases):
(WebInspector.StorageManager.prototype.get cookieStorageObjects):
* UserInterface/Images/Storage.svg: Added.
* UserInterface/Main.html:
* UserInterface/Views/DatabaseTableContentView.js:
(WebInspector.DatabaseTableContentView.prototype._queryFinished): Clear _dataGrid,
since it might have been allocated but still be empty. This avoids an exception in
updateLayout next time layout is updated.
* UserInterface/Views/NewTabContentView.js:
(WebInspector.NewTabContentView):
* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel):
(WebInspector.ResourceSidebarPanel.prototype._treeElementSelected):
(WebInspector.ResourceSidebarPanel.prototype._domStorageObjectWasAdded): Deleted.
(WebInspector.ResourceSidebarPanel.prototype._domStorageObjectWasInspected): Deleted.
(WebInspector.ResourceSidebarPanel.prototype._databaseWasAdded): Deleted.
(WebInspector.ResourceSidebarPanel.prototype._databaseWasInspected): Deleted.
(WebInspector.ResourceSidebarPanel.prototype._indexedDatabaseWasAdded): Deleted.
(WebInspector.ResourceSidebarPanel.prototype._cookieStorageObjectWasAdded): Deleted.
(WebInspector.ResourceSidebarPanel.prototype._frameManifestAdded): Deleted.
(WebInspector.ResourceSidebarPanel.prototype._frameManifestRemoved): Deleted.
(WebInspector.ResourceSidebarPanel.prototype._addStorageChild): Deleted.
(WebInspector.ResourceSidebarPanel.prototype._storageCleared): Deleted.
* UserInterface/Views/ResourcesTabContentView.js:
(WebInspector.ResourcesTabContentView):
(WebInspector.ResourcesTabContentView.prototype.canShowRepresentedObject):
* UserInterface/Views/StorageSidebarPanel.js: Added.
(WebInspector.StorageSidebarPanel):
(WebInspector.StorageSidebarPanel.prototype.showDefaultContentView):
(WebInspector.StorageSidebarPanel.prototype.closed):
(WebInspector.StorageSidebarPanel.prototype._treeElementSelected):
(WebInspector.StorageSidebarPanel.prototype._domStorageObjectWasAdded):
(WebInspector.StorageSidebarPanel.prototype._addDOMStorageObject):
(WebInspector.StorageSidebarPanel.prototype._domStorageObjectWasInspected):
(WebInspector.StorageSidebarPanel.prototype._databaseWasAdded):
(WebInspector.StorageSidebarPanel.prototype._addDatabase):
(WebInspector.StorageSidebarPanel.prototype._databaseWasInspected):
(WebInspector.StorageSidebarPanel.prototype._indexedDatabaseWasAdded):
(WebInspector.StorageSidebarPanel.prototype._addIndexedDatabase):
(WebInspector.StorageSidebarPanel.prototype._cookieStorageObjectWasAdded):
(WebInspector.StorageSidebarPanel.prototype._addCookieStorageObject):
(WebInspector.StorageSidebarPanel.prototype._frameManifestAdded):
(WebInspector.StorageSidebarPanel.prototype._addFrameManifest):
(WebInspector.StorageSidebarPanel.prototype._frameManifestRemoved):
(WebInspector.StorageSidebarPanel.prototype._compareTreeElements):
(WebInspector.StorageSidebarPanel.prototype._addStorageChild):
(WebInspector.StorageSidebarPanel.prototype._storageCleared):
* UserInterface/Views/StorageTabContentView.js: Copied from Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js.
(WebInspector.StorageTabContentView):
(WebInspector.StorageTabContentView.prototype.get type):
(WebInspector.StorageTabContentView.prototype.canShowRepresentedObject):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (183579 => 183580)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-04-29 21:59:48 UTC (rev 183579)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-04-29 22:00:06 UTC (rev 183580)
@@ -1,5 +1,78 @@
 2015-04-29  Timothy Hatcher  <[email protected]>
 
+        Web Inspector: Split Storage from Resources tab
+        https://bugs.webkit.org/show_bug.cgi?id=144404
+
+        Reviewed by Joseph Pecoraro.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Base/Main.js:
+        (WebInspector.loaded):
+        (WebInspector.isTabTypeAllowed):
+        (WebInspector._tabContentViewForType):
+        (WebInspector._updateNewTabButtonState):
+        (WebInspector.showStorageTab):
+        (WebInspector._storageWasInspected):
+        * UserInterface/Controllers/ApplicationCacheManager.js:
+        (WebInspector.ApplicationCacheManager.prototype.initialize):
+        (WebInspector.ApplicationCacheManager.prototype.get applicationCacheObjects):
+        * UserInterface/Controllers/StorageManager.js:
+        (WebInspector.StorageManager.prototype.get domStorageObjects):
+        (WebInspector.StorageManager.prototype.get databases):
+        (WebInspector.StorageManager.prototype.get indexedDatabases):
+        (WebInspector.StorageManager.prototype.get cookieStorageObjects):
+        * UserInterface/Images/Storage.svg: Added.
+        * UserInterface/Main.html:
+        * UserInterface/Views/DatabaseTableContentView.js:
+        (WebInspector.DatabaseTableContentView.prototype._queryFinished): Clear _dataGrid,
+        since it might have been allocated but still be empty. This avoids an exception in
+        updateLayout next time layout is updated.
+        * UserInterface/Views/NewTabContentView.js:
+        (WebInspector.NewTabContentView):
+        * UserInterface/Views/ResourceSidebarPanel.js:
+        (WebInspector.ResourceSidebarPanel):
+        (WebInspector.ResourceSidebarPanel.prototype._treeElementSelected):
+        (WebInspector.ResourceSidebarPanel.prototype._domStorageObjectWasAdded): Deleted.
+        (WebInspector.ResourceSidebarPanel.prototype._domStorageObjectWasInspected): Deleted.
+        (WebInspector.ResourceSidebarPanel.prototype._databaseWasAdded): Deleted.
+        (WebInspector.ResourceSidebarPanel.prototype._databaseWasInspected): Deleted.
+        (WebInspector.ResourceSidebarPanel.prototype._indexedDatabaseWasAdded): Deleted.
+        (WebInspector.ResourceSidebarPanel.prototype._cookieStorageObjectWasAdded): Deleted.
+        (WebInspector.ResourceSidebarPanel.prototype._frameManifestAdded): Deleted.
+        (WebInspector.ResourceSidebarPanel.prototype._frameManifestRemoved): Deleted.
+        (WebInspector.ResourceSidebarPanel.prototype._addStorageChild): Deleted.
+        (WebInspector.ResourceSidebarPanel.prototype._storageCleared): Deleted.
+        * UserInterface/Views/ResourcesTabContentView.js:
+        (WebInspector.ResourcesTabContentView):
+        (WebInspector.ResourcesTabContentView.prototype.canShowRepresentedObject):
+        * UserInterface/Views/StorageSidebarPanel.js: Added.
+        (WebInspector.StorageSidebarPanel):
+        (WebInspector.StorageSidebarPanel.prototype.showDefaultContentView):
+        (WebInspector.StorageSidebarPanel.prototype.closed):
+        (WebInspector.StorageSidebarPanel.prototype._treeElementSelected):
+        (WebInspector.StorageSidebarPanel.prototype._domStorageObjectWasAdded):
+        (WebInspector.StorageSidebarPanel.prototype._addDOMStorageObject):
+        (WebInspector.StorageSidebarPanel.prototype._domStorageObjectWasInspected):
+        (WebInspector.StorageSidebarPanel.prototype._databaseWasAdded):
+        (WebInspector.StorageSidebarPanel.prototype._addDatabase):
+        (WebInspector.StorageSidebarPanel.prototype._databaseWasInspected):
+        (WebInspector.StorageSidebarPanel.prototype._indexedDatabaseWasAdded):
+        (WebInspector.StorageSidebarPanel.prototype._addIndexedDatabase):
+        (WebInspector.StorageSidebarPanel.prototype._cookieStorageObjectWasAdded):
+        (WebInspector.StorageSidebarPanel.prototype._addCookieStorageObject):
+        (WebInspector.StorageSidebarPanel.prototype._frameManifestAdded):
+        (WebInspector.StorageSidebarPanel.prototype._addFrameManifest):
+        (WebInspector.StorageSidebarPanel.prototype._frameManifestRemoved):
+        (WebInspector.StorageSidebarPanel.prototype._compareTreeElements):
+        (WebInspector.StorageSidebarPanel.prototype._addStorageChild):
+        (WebInspector.StorageSidebarPanel.prototype._storageCleared):
+        * UserInterface/Views/StorageTabContentView.js: Copied from Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js.
+        (WebInspector.StorageTabContentView):
+        (WebInspector.StorageTabContentView.prototype.get type):
+        (WebInspector.StorageTabContentView.prototype.canShowRepresentedObject):
+
+2015-04-29  Timothy Hatcher  <[email protected]>
+
         Web Inspector: Remove Legacy images and styles
         https://bugs.webkit.org/show_bug.cgi?id=144390
 

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (183579 => 183580)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2015-04-29 21:59:48 UTC (rev 183579)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2015-04-29 22:00:06 UTC (rev 183580)
@@ -224,6 +224,7 @@
 localizedStrings["Filter Console Log"] = "Filter Console Log";
 localizedStrings["Filter Resource List"] = "Filter Resource List";
 localizedStrings["Filter Search Results"] = "Filter Search Results";
+localizedStrings["Filter Storage List"] = "Filter Storage List";
 localizedStrings["Flows"] = "Flows";
 localizedStrings["Focused"] = "Focused";
 localizedStrings["Font"] = "Font";

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (183579 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-04-29 21:59:48 UTC (rev 183579)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-04-29 22:00:06 UTC (rev 183580)
@@ -140,7 +140,7 @@
     this._showingSplitConsoleSetting = new WebInspector.Setting("showing-split-console", false);
     this._splitConsoleHeightSetting = new WebInspector.Setting("split-console-height", 150);
 
-    this._openTabsSetting = new WebInspector.Setting("open-tabs", ["elements", "resources", "timeline", "debugger", "console"]);
+    this._openTabsSetting = new WebInspector.Setting("open-tabs", ["elements", "resources", "timeline", "debugger", "storage", "console"]);
     this._selectedTabIndexSetting = new WebInspector.Setting("selected-tab-index", 0);
 
     this.showShadowDOMSetting = new WebInspector.Setting("show-shadow-dom", false);
@@ -376,6 +376,8 @@
     switch (tabType) {
     case WebInspector.ElementsTabContentView.Type:
         return !!window.DOMAgent;
+    case WebInspector.StorageTabContentView.Type:
+        return !!window.DOMStorageAgent || !!window.DatabaseAgent || !!window.IndexedDBAgent;
     case WebInspector.TimelineTabContentView.Type:
         return !!window.TimelineAgent;
     }
@@ -386,20 +388,22 @@
 WebInspector._tabContentViewForType = function(tabType)
 {
     switch (tabType) {
+    case WebInspector.ConsoleTabContentView.Type:
+        return new WebInspector.ConsoleTabContentView;
+    case WebInspector.DebuggerTabContentView.Type:
+        return new WebInspector.DebuggerTabContentView;
     case WebInspector.ElementsTabContentView.Type:
         return new WebInspector.ElementsTabContentView;
+    case WebInspector.NewTabContentView.Type:
+        return new WebInspector.NewTabContentView;
     case WebInspector.ResourcesTabContentView.Type:
         return new WebInspector.ResourcesTabContentView;
+    case WebInspector.SearchTabContentView.Type:
+        return new WebInspector.SearchTabContentView;
+    case WebInspector.StorageTabContentView.Type:
+        return new WebInspector.StorageTabContentView;
     case WebInspector.TimelineTabContentView.Type:
         return new WebInspector.TimelineTabContentView;
-    case WebInspector.DebuggerTabContentView.Type:
-        return new WebInspector.DebuggerTabContentView;
-    case WebInspector.ConsoleTabContentView.Type:
-        return new WebInspector.ConsoleTabContentView;
-    case WebInspector.SearchTabContentView.Type:
-        return new WebInspector.SearchTabContentView;
-    case WebInspector.NewTabTabContentView.Type:
-        return new WebInspector.NewTabTabContentView;
     default:
         console.error("Unknown tab type", tabType);
     }
@@ -426,7 +430,8 @@
 
 WebInspector._updateNewTabButtonState = function(event)
 {
-    var newTabAllowed = this.isNewTabWithTypeAllowed(WebInspector.ConsoleTabContentView.Type) || this.isNewTabWithTypeAllowed(WebInspector.ElementsTabContentView.Type);
+    var newTabAllowed = this.isNewTabWithTypeAllowed(WebInspector.ConsoleTabContentView.Type) || this.isNewTabWithTypeAllowed(WebInspector.ElementsTabContentView.Type)
+         || this.isNewTabWithTypeAllowed(WebInspector.StorageTabContentView.Type);
     this.tabBar.newTabItem.disabled = !newTabAllowed;
 };
 
@@ -753,6 +758,14 @@
     this.tabBrowser.showTabForContentView(tabContentView);
 };
 
+WebInspector.showStorageTab = function()
+{
+    var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.StorageTabContentView);
+    if (!tabContentView)
+        tabContentView = new WebInspector.StorageTabContentView;
+    this.tabBrowser.showTabForContentView(tabContentView);
+};
+
 WebInspector.showTimelineTab = function()
 {
     var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.TimelineTabContentView);
@@ -1440,8 +1453,7 @@
 
 WebInspector._storageWasInspected = function(event)
 {
-    // FIXME: This should show a Storage tab when we have one.
-    this.showResourcesTab();
+    this.showStorageTab();
 };
 
 WebInspector._domNodeWasInspected = function(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js (183579 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js	2015-04-29 21:59:48 UTC (rev 183579)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js	2015-04-29 22:00:06 UTC (rev 183580)
@@ -44,12 +44,20 @@
 
     initialize()
     {
-        this._applicationCacheObjects = [];
+        this._applicationCacheObjects = {};
 
         if (window.ApplicationCacheAgent)
             ApplicationCacheAgent.getFramesWithManifests(this._framesWithManifestsLoaded.bind(this));
     }
 
+    get applicationCacheObjects()
+    {
+        var applicationCacheObjects = [];
+        for (var id in this._applicationCacheObjects)
+            applicationCacheObjects.push(this._applicationCacheObjects[id]);
+        return applicationCacheObjects;
+    }
+
     networkStateUpdated(isNowOnline)
     {
         this._online = isNowOnline;

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js (183579 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js	2015-04-29 21:59:48 UTC (rev 183579)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js	2015-04-29 22:00:06 UTC (rev 183580)
@@ -60,6 +60,29 @@
         this._cookieStorageObjects = {};
     }
 
+    get domStorageObjects()
+    {
+        return this._domStorageObjects;
+    }
+
+    get databases()
+    {
+        return this._databaseObjects;
+    }
+
+    get indexedDatabases()
+    {
+        return this._indexedDatabases;
+    }
+
+    get cookieStorageObjects()
+    {
+        var cookieStorageObjects = [];
+        for (var host in this._cookieStorageObjects)
+            cookieStorageObjects.push(this._cookieStorageObjects[host]);
+        return cookieStorageObjects;
+    }
+
     domStorageWasAdded(id, host, isLocalStorage)
     {
         var domStorage = new WebInspector.DOMStorageObject(id, host, isLocalStorage);

Added: trunk/Source/WebInspectorUI/UserInterface/Images/Storage.svg (0 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Images/Storage.svg	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/Storage.svg	2015-04-29 22:00:06 UTC (rev 183580)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2015 Apple Inc. All rights reserved. -->
+<svg viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
+    <path d="M 13.4475645 6.5701038 C 14.1131101 6.95915994 14.5 7.44243562 14.5 8 C 14.5 9.52952015 11.5885604 10.5 8 10.5 C 4.41143956 10.5 1.5 9.52952015 1.5 8 C 1.5 7.44243562 1.88688992 6.95915994 2.55243554 6.5701038 C 2.95984566 6.75017534 3.43583057 6.90963763 3.96620982 7.04342621 C 3.94919939 7.04895616 3.93228678 7.05452352 3.91547313 7.06012807 C 2.98303097 7.37094212 2.5 7.7516133 2.5 8 C 2.5 8.2483867 2.98303097 8.62905788 3.91547313 8.93987193 C 4.97873363 9.2942921 6.43777802 9.5 8 9.5 C 9.56222198 9.5 11.0212664 9.2942921 12.0845269 8.93987193 C 13.016969 8.62905788 13.5 8.2483867 13.5 8 C 13.5 7.7516133 13.016969 7.37094212 12.0845269 7.06012807 C 12.0677132 7.05452352 12.0508006 7.04895616 12.0337902 7.04342621 C 12.5641694 6.90963763 13.0401543 6.75017534 13.4475645 6.5701038 Z" class="filled" fill="black"/>
+    <path d="M 13.4475645 10.5701038 C 14.1131101 10.9591599 14.5 11.4424356 14.5 12 C 14.5 13.5295201 11.5885604 14.5 8 14.5 C 4.41143956 14.5 1.5 13.5295201 1.5 12 C 1.5 11.4424356 1.88688992 10.9591599 2.55243554 10.5701038 C 2.95984566 10.7501753 3.43583057 10.9096376 3.96620982 11.0434262 C 3.94919939 11.0489562 3.93228678 11.0545235 3.91547313 11.0601281 C 2.98303097 11.3709421 2.5 11.7516133 2.5 12 C 2.5 12.2483867 2.98303097 12.6290579 3.91547313 12.9398719 C 4.97873363 13.2942921 6.43777802 13.5 8 13.5 C 9.56222198 13.5 11.0212664 13.2942921 12.0845269 12.9398719 C 13.016969 12.6290579 13.5 12.2483867 13.5 12 C 13.5 11.7516133 13.016969 11.3709421 12.0845269 11.0601281 C 12.0677132 11.0545235 12.0508006 11.0489562 12.0337902 11.0434262 C 12.5641694 10.9096376 13.0401543 10.7501753 13.4475645 10.5701038 Z" class="filled" fill="black"/>
+    <path d="M 14.5 4 C 14.5 2.47047985 11.5885604 1.5 8 1.5 C 4.41143956 1.5 1.5 2.47047985 1.5 4 C 1.5 5.52952015 4.41143956 6.5 8 6.5 C 11.5885604 6.5 14.5 5.52952015 14.5 4 Z M 3.91547313 4.93987193 C 2.98303097 4.62905788 2.5 4.2483867 2.5 4 C 2.5 3.7516133 2.98303097 3.37094212 3.91547313 3.06012807 C 4.97873363 2.7057079 6.43777802 2.5 8 2.5 C 9.56222198 2.5 11.0212664 2.7057079 12.0845269 3.06012807 C 13.016969 3.37094212 13.5 3.7516133 13.5 4 C 13.5 4.2483867 13.016969 4.62905788 12.0845269 4.93987193 C 11.0212664 5.2942921 9.56222198 5.5 8 5.5 C 6.43777802 5.5 4.97873363 5.2942921 3.91547313 4.93987193 Z" class="filled" fill="black"/>
+</svg>

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (183579 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Main.html	2015-04-29 21:59:48 UTC (rev 183579)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html	2015-04-29 22:00:06 UTC (rev 183580)
@@ -353,6 +353,7 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
     <script src=""
 
     <script src=""
@@ -504,6 +505,7 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
     <script src=""
     <script src=""
     <script src=""

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js (183579 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js	2015-04-29 21:59:48 UTC (rev 183579)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js	2015-04-29 22:00:06 UTC (rev 183580)
@@ -90,6 +90,8 @@
 
         this._dataGrid = new WebInspector.DataGrid.createSortableDataGrid(columnNames, values);
         if (!this._dataGrid || !this._dataGrid.element) {
+            this._dataGrid = undefined;
+
             // If the DataGrid is empty, then we were returned a table with no columns. This can happen when a table has
             // no data, the SELECT query only returns column names when there is data.
             this.element.removeChildren();

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js (183579 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js	2015-04-29 21:59:48 UTC (rev 183579)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js	2015-04-29 22:00:06 UTC (rev 183580)
@@ -31,6 +31,7 @@
 
     var allowedNewTabs = [
         {image: "Images/Elements.svg", title: WebInspector.UIString("Elements"), type: WebInspector.ElementsTabContentView.Type},
+        {image: "Images/Storage.svg", title: WebInspector.UIString("Storage"), type: WebInspector.StorageTabContentView.Type},
         {image: "Images/Console.svg", title: WebInspector.UIString("Console"), type: WebInspector.ConsoleTabContentView.Type}
     ];
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js (183579 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js	2015-04-29 21:59:48 UTC (rev 183579)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js	2015-04-29 22:00:06 UTC (rev 183580)
@@ -35,31 +35,6 @@
 
         this._waitingForInitialMainFrame = true;
 
-        this._localStorageRootTreeElement = null;
-        this._sessionStorageRootTreeElement = null;
-
-        this._databaseRootTreeElement = null;
-        this._databaseHostTreeElementMap = {};
-
-        this._indexedDatabaseRootTreeElement = null;
-        this._indexedDatabaseHostTreeElementMap = {};
-
-        this._cookieStorageRootTreeElement = null;
-
-        this._applicationCacheRootTreeElement = null;
-        this._applicationCacheURLTreeElementMap = {};
-
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.CookieStorageObjectWasAdded, this._cookieStorageObjectWasAdded, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DOMStorageObjectWasAdded, this._domStorageObjectWasAdded, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DOMStorageObjectWasInspected, this._domStorageObjectWasInspected, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DatabaseWasAdded, this._databaseWasAdded, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DatabaseWasInspected, this._databaseWasInspected, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.IndexedDatabaseWasAdded, this._indexedDatabaseWasAdded, this);
-        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.Cleared, this._storageCleared, this);
-
-        WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestAdded, this._frameManifestAdded, this);
-        WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestRemoved, this._frameManifestRemoved, this);
-
         WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
 
         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, this._scriptWasAdded, this);
@@ -300,15 +275,10 @@
 
     _treeElementSelected(treeElement, selectedByUser)
     {
-        if (treeElement instanceof WebInspector.FolderTreeElement || treeElement instanceof WebInspector.DatabaseHostTreeElement ||
-            treeElement instanceof WebInspector.IndexedDatabaseHostTreeElement || treeElement instanceof WebInspector.IndexedDatabaseTreeElement)
+        if (treeElement instanceof WebInspector.FolderTreeElement)
             return;
 
-        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement ||
-            treeElement instanceof WebInspector.StorageTreeElement || treeElement instanceof WebInspector.DatabaseTableTreeElement ||
-            treeElement instanceof WebInspector.DatabaseTreeElement || treeElement instanceof WebInspector.ApplicationCacheFrameTreeElement ||
-            treeElement instanceof WebInspector.ContentFlowTreeElement || treeElement instanceof WebInspector.IndexedDatabaseObjectStoreTreeElement ||
-            treeElement instanceof WebInspector.IndexedDatabaseObjectStoreIndexTreeElement) {
+        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
             WebInspector.showRepresentedObject(treeElement.representedObject);
             return;
         }
@@ -316,90 +286,6 @@
         console.error("Unknown tree element", treeElement);
     }
 
-    _domStorageObjectWasAdded(event)
-    {
-        var domStorage = event.data.domStorage;
-        var storageElement = new WebInspector.DOMStorageTreeElement(domStorage);
-
-        if (domStorage.isLocalStorage())
-            this._localStorageRootTreeElement = this._addStorageChild(storageElement, this._localStorageRootTreeElement, WebInspector.UIString("Local Storage"));
-        else
-            this._sessionStorageRootTreeElement = this._addStorageChild(storageElement, this._sessionStorageRootTreeElement, WebInspector.UIString("Session Storage"));
-    }
-
-    _domStorageObjectWasInspected(event)
-    {
-        var domStorage = event.data.domStorage;
-        var treeElement = this.treeElementForRepresentedObject(domStorage);
-        treeElement.revealAndSelect(true);
-    }
-
-    _databaseWasAdded(event)
-    {
-        var database = event.data.database;
-
-        console.assert(database instanceof WebInspector.DatabaseObject);
-
-        if (!this._databaseHostTreeElementMap[database.host]) {
-            this._databaseHostTreeElementMap[database.host] = new WebInspector.DatabaseHostTreeElement(database.host);
-            this._databaseRootTreeElement = this._addStorageChild(this._databaseHostTreeElementMap[database.host], this._databaseRootTreeElement, WebInspector.UIString("Databases"));
-        }
-
-        var databaseElement = new WebInspector.DatabaseTreeElement(database);
-        this._databaseHostTreeElementMap[database.host].appendChild(databaseElement);
-    }
-
-    _databaseWasInspected(event)
-    {
-        var database = event.data.database;
-        var treeElement = this.treeElementForRepresentedObject(database);
-        treeElement.revealAndSelect(true);
-    }
-
-    _indexedDatabaseWasAdded(event)
-    {
-        var indexedDatabase = event.data.indexedDatabase;
-
-        console.assert(indexedDatabase instanceof WebInspector.IndexedDatabase);
-
-        if (!this._indexedDatabaseHostTreeElementMap[indexedDatabase.host]) {
-            this._indexedDatabaseHostTreeElementMap[indexedDatabase.host] = new WebInspector.IndexedDatabaseHostTreeElement(indexedDatabase.host);
-            this._indexedDatabaseRootTreeElement = this._addStorageChild(this._indexedDatabaseHostTreeElementMap[indexedDatabase.host], this._indexedDatabaseRootTreeElement, WebInspector.UIString("Indexed Databases"));
-        }
-
-        var indexedDatabaseElement = new WebInspector.IndexedDatabaseTreeElement(indexedDatabase);
-        this._indexedDatabaseHostTreeElementMap[indexedDatabase.host].appendChild(indexedDatabaseElement);
-    }
-
-    _cookieStorageObjectWasAdded(event)
-    {
-        console.assert(event.data.cookieStorage instanceof WebInspector.CookieStorageObject);
-
-        var cookieElement = new WebInspector.CookieStorageTreeElement(event.data.cookieStorage);
-        this._cookieStorageRootTreeElement = this._addStorageChild(cookieElement, this._cookieStorageRootTreeElement, WebInspector.UIString("Cookies"));
-    }
-
-    _frameManifestAdded(event)
-    {
-        var frameManifest = event.data.frameManifest;
-        console.assert(frameManifest instanceof WebInspector.ApplicationCacheFrame);
-
-        var manifest = frameManifest.manifest;
-        var manifestURL = manifest.manifestURL;
-        if (!this._applicationCacheURLTreeElementMap[manifestURL]) {
-            this._applicationCacheURLTreeElementMap[manifestURL] = new WebInspector.ApplicationCacheManifestTreeElement(manifest);
-            this._applicationCacheRootTreeElement = this._addStorageChild(this._applicationCacheURLTreeElementMap[manifestURL], this._applicationCacheRootTreeElement, WebInspector.UIString("Application Cache"));
-        }
-
-        var frameCacheElement = new WebInspector.ApplicationCacheFrameTreeElement(frameManifest);
-        this._applicationCacheURLTreeElementMap[manifestURL].appendChild(frameCacheElement);
-    }
-
-    _frameManifestRemoved(event)
-    {
-         // FIXME: Implement this.
-    }
-
     _compareTreeElements(a, b)
     {
         // Always sort the main frame element first.
@@ -414,76 +300,6 @@
         return (a.mainTitle || "").localeCompare(b.mainTitle || "");
     }
 
-    _addStorageChild(childElement, parentElement, folderName)
-    {
-        if (!parentElement) {
-            childElement.flattened = true;
-
-            this.contentTreeOutline.insertChild(childElement, insertionIndexForObjectInListSortedByFunction(childElement, this.contentTreeOutline.children, this._compareTreeElements));
-
-            return childElement;
-        }
-
-        if (parentElement instanceof WebInspector.StorageTreeElement) {
-            console.assert(parentElement.flattened);
-
-            var previousOnlyChild = parentElement;
-            previousOnlyChild.flattened = false;
-            this.contentTreeOutline.removeChild(previousOnlyChild);
-
-            var folderElement = new WebInspector.FolderTreeElement(folderName);
-            this.contentTreeOutline.insertChild(folderElement, insertionIndexForObjectInListSortedByFunction(folderElement, this.contentTreeOutline.children, this._compareTreeElements));
-
-            folderElement.appendChild(previousOnlyChild);
-            folderElement.insertChild(childElement, insertionIndexForObjectInListSortedByFunction(childElement, folderElement.children, this._compareTreeElements));
-
-            return folderElement;
-        }
-
-        console.assert(parentElement instanceof WebInspector.FolderTreeElement);
-        parentElement.insertChild(childElement, insertionIndexForObjectInListSortedByFunction(childElement, parentElement.children, this._compareTreeElements));
-
-        return parentElement;
-    }
-
-    _storageCleared(event)
-    {
-        // Close all DOM and cookie storage content views since the main frame has navigated and all storages are cleared.
-        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.CookieStorageContentView);
-        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DOMStorageContentView);
-        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseTableContentView);
-        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseContentView);
-        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.ApplicationCacheFrameContentView);
-
-        if (this._localStorageRootTreeElement && this._localStorageRootTreeElement.parent)
-            this._localStorageRootTreeElement.parent.removeChild(this._localStorageRootTreeElement);
-
-        if (this._sessionStorageRootTreeElement && this._sessionStorageRootTreeElement.parent)
-            this._sessionStorageRootTreeElement.parent.removeChild(this._sessionStorageRootTreeElement);
-
-        if (this._databaseRootTreeElement && this._databaseRootTreeElement.parent)
-            this._databaseRootTreeElement.parent.removeChild(this._databaseRootTreeElement);
-
-        if (this._indexedDatabaseRootTreeElement && this._indexedDatabaseRootTreeElement.parent)
-            this._indexedDatabaseRootTreeElement.parent.removeChild(this._indexedDatabaseRootTreeElement);
-
-        if (this._cookieStorageRootTreeElement && this._cookieStorageRootTreeElement.parent)
-            this._cookieStorageRootTreeElement.parent.removeChild(this._cookieStorageRootTreeElement);
-
-        if (this._applicationCacheRootTreeElement && this._applicationCacheRootTreeElement.parent)
-            this._applicationCacheRootTreeElement.parent.removeChild(this._applicationCacheRootTreeElement);
-
-        this._localStorageRootTreeElement = null;
-        this._sessionStorageRootTreeElement = null;
-        this._databaseRootTreeElement = null;
-        this._databaseHostTreeElementMap = {};
-        this._indexedDatabaseRootTreeElement = null;
-        this._indexedDatabaseHostTreeElementMap = {};
-        this._cookieStorageRootTreeElement = null;
-        this._applicationCacheRootTreeElement = null;
-        this._applicationCacheURLTreeElementMap = {};
-    }
-
     _extraDomainsActivated()
     {
         if (WebInspector.debuggableType === WebInspector.DebuggableType._javascript_)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js (183579 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js	2015-04-29 21:59:48 UTC (rev 183579)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js	2015-04-29 22:00:06 UTC (rev 183580)
@@ -26,7 +26,7 @@
 WebInspector.ResourcesTabContentView = function(identifier)
 {
     var tabBarItem = new WebInspector.TabBarItem("Images/Resources.svg", WebInspector.UIString("Resources"));
-    var detailsSidebarPanels = [WebInspector.resourceDetailsSidebarPanel, WebInspector.applicationCacheDetailsSidebarPanel, WebInspector.probeDetailsSidebarPanel];
+    var detailsSidebarPanels = [WebInspector.resourceDetailsSidebarPanel, WebInspector.probeDetailsSidebarPanel];
 
     // FIXME: Until ContentFlows are moved to the Elements tab, these details sidebar panels need to be included.
     detailsSidebarPanels = detailsSidebarPanels.concat([WebInspector.domNodeDetailsSidebarPanel, WebInspector.cssStyleDetailsSidebarPanel]);
@@ -52,12 +52,7 @@
 
     canShowRepresentedObject: function(representedObject)
     {
-        return representedObject instanceof WebInspector.Frame || representedObject instanceof WebInspector.Resource ||
-            representedObject instanceof WebInspector.Script || representedObject instanceof WebInspector.ContentFlow ||
-            representedObject instanceof WebInspector.DOMStorageObject || representedObject instanceof WebInspector.CookieStorageObject ||
-            representedObject instanceof WebInspector.DatabaseTableObject || representedObject instanceof WebInspector.DatabaseObject ||
-            representedObject instanceof WebInspector.ApplicationCacheFrame || representedObject instanceof WebInspector.IndexedDatabaseObjectStore ||
-            representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex;
+        return representedObject instanceof WebInspector.Frame || representedObject instanceof WebInspector.Resource || representedObject instanceof WebInspector.Script;
     }
 };
 

Added: trunk/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js (0 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js	2015-04-29 22:00:06 UTC (rev 183580)
@@ -0,0 +1,292 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.StorageSidebarPanel = class StorageSidebarPanel extends WebInspector.NavigationSidebarPanel
+{
+    constructor(contentBrowser)
+    {
+        super("storage", WebInspector.UIString("Storage"));
+
+        this.contentBrowser = contentBrowser;
+
+        this.filterBar.placeholder = WebInspector.UIString("Filter Storage List");
+
+        this._localStorageRootTreeElement = null;
+        this._sessionStorageRootTreeElement = null;
+
+        this._databaseRootTreeElement = null;
+        this._databaseHostTreeElementMap = {};
+
+        this._indexedDatabaseRootTreeElement = null;
+        this._indexedDatabaseHostTreeElementMap = {};
+
+        this._cookieStorageRootTreeElement = null;
+
+        this._applicationCacheRootTreeElement = null;
+        this._applicationCacheURLTreeElementMap = {};
+
+        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.CookieStorageObjectWasAdded, this._cookieStorageObjectWasAdded, this);
+        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DOMStorageObjectWasAdded, this._domStorageObjectWasAdded, this);
+        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DOMStorageObjectWasInspected, this._domStorageObjectWasInspected, this);
+        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DatabaseWasAdded, this._databaseWasAdded, this);
+        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DatabaseWasInspected, this._databaseWasInspected, this);
+        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.IndexedDatabaseWasAdded, this._indexedDatabaseWasAdded, this);
+        WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.Cleared, this._storageCleared, this);
+
+        WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestAdded, this._frameManifestAdded, this);
+        WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestRemoved, this._frameManifestRemoved, this);
+
+        this.contentTreeOutline._onselect_ = this._treeElementSelected.bind(this);
+
+        for (var domStorageObject of WebInspector.storageManager.domStorageObjects)
+            this._addDOMStorageObject(domStorageObject);
+
+        for (var cookieStorageObject of WebInspector.storageManager.cookieStorageObjects)
+            this._addCookieStorageObject(cookieStorageObject);
+
+        for (var database of WebInspector.storageManager.databases)
+            this._addDatabase(database);
+
+        for (var indexedDatabase of WebInspector.storageManager.indexedDatabases)
+            this._addIndexedDatabase(indexedDatabase);
+
+        for (var applicationCacheObject of WebInspector.applicationCacheManager.applicationCacheObjects)
+            this._addFrameManifest(applicationCacheObject);
+    }
+
+    // Public
+
+    showDefaultContentView()
+    {
+        // Don't show anything by default. It doesn't make a whole lot of sense here.
+    }
+
+    closed()
+    {
+        WebInspector.storageManager.removeEventListener(null, null, this);
+        WebInspector.applicationCacheManager.removeEventListener(null, null, this);
+    }
+
+    // Private
+
+    _treeElementSelected(treeElement, selectedByUser)
+    {
+        if (treeElement instanceof WebInspector.FolderTreeElement || treeElement instanceof WebInspector.DatabaseHostTreeElement ||
+            treeElement instanceof WebInspector.IndexedDatabaseHostTreeElement || treeElement instanceof WebInspector.IndexedDatabaseTreeElement)
+            return;
+
+        if (treeElement instanceof WebInspector.StorageTreeElement || treeElement instanceof WebInspector.DatabaseTableTreeElement ||
+            treeElement instanceof WebInspector.DatabaseTreeElement || treeElement instanceof WebInspector.ApplicationCacheFrameTreeElement ||
+            treeElement instanceof WebInspector.IndexedDatabaseObjectStoreTreeElement || treeElement instanceof WebInspector.IndexedDatabaseObjectStoreIndexTreeElement) {
+            WebInspector.showRepresentedObject(treeElement.representedObject);
+            return;
+        }
+
+        console.error("Unknown tree element", treeElement);
+    }
+
+    _domStorageObjectWasAdded(event)
+    {
+        var domStorage = event.data.domStorage;
+        this._addDOMStorageObject(event.data.domStorage);
+    }
+
+    _addDOMStorageObject(domStorage)
+    {
+        var storageElement = new WebInspector.DOMStorageTreeElement(domStorage);
+
+        if (domStorage.isLocalStorage())
+            this._localStorageRootTreeElement = this._addStorageChild(storageElement, this._localStorageRootTreeElement, WebInspector.UIString("Local Storage"));
+        else
+            this._sessionStorageRootTreeElement = this._addStorageChild(storageElement, this._sessionStorageRootTreeElement, WebInspector.UIString("Session Storage"));
+    }
+
+    _domStorageObjectWasInspected(event)
+    {
+        var domStorage = event.data.domStorage;
+        var treeElement = this.treeElementForRepresentedObject(domStorage);
+        treeElement.revealAndSelect(true);
+    }
+
+    _databaseWasAdded(event)
+    {
+        var database = event.data.database;
+        this._addDatabase(event.data.database);
+    }
+
+    _addDatabase(database)
+    {
+        console.assert(database instanceof WebInspector.DatabaseObject);
+
+        if (!this._databaseHostTreeElementMap[database.host]) {
+            this._databaseHostTreeElementMap[database.host] = new WebInspector.DatabaseHostTreeElement(database.host);
+            this._databaseRootTreeElement = this._addStorageChild(this._databaseHostTreeElementMap[database.host], this._databaseRootTreeElement, WebInspector.UIString("Databases"));
+        }
+
+        var databaseElement = new WebInspector.DatabaseTreeElement(database);
+        this._databaseHostTreeElementMap[database.host].appendChild(databaseElement);
+    }
+
+    _databaseWasInspected(event)
+    {
+        var database = event.data.database;
+        var treeElement = this.treeElementForRepresentedObject(database);
+        treeElement.revealAndSelect(true);
+    }
+
+    _indexedDatabaseWasAdded(event)
+    {
+        this._addIndexedDatabaseWasAdded(event.data.indexedDatabase);
+    }
+
+    _addIndexedDatabase(indexedDatabase)
+    {
+        console.assert(indexedDatabase instanceof WebInspector.IndexedDatabase);
+
+        if (!this._indexedDatabaseHostTreeElementMap[indexedDatabase.host]) {
+            this._indexedDatabaseHostTreeElementMap[indexedDatabase.host] = new WebInspector.IndexedDatabaseHostTreeElement(indexedDatabase.host);
+            this._indexedDatabaseRootTreeElement = this._addStorageChild(this._indexedDatabaseHostTreeElementMap[indexedDatabase.host], this._indexedDatabaseRootTreeElement, WebInspector.UIString("Indexed Databases"));
+        }
+
+        var indexedDatabaseElement = new WebInspector.IndexedDatabaseTreeElement(indexedDatabase);
+        this._indexedDatabaseHostTreeElementMap[indexedDatabase.host].appendChild(indexedDatabaseElement);
+    }
+
+    _cookieStorageObjectWasAdded(event)
+    {
+        this._addCookieStorageObject(event.data.cookieStorage);
+    }
+
+    _addCookieStorageObject(cookieStorage)
+    {
+        console.assert(cookieStorage instanceof WebInspector.CookieStorageObject);
+
+        var cookieElement = new WebInspector.CookieStorageTreeElement(cookieStorage);
+        this._cookieStorageRootTreeElement = this._addStorageChild(cookieElement, this._cookieStorageRootTreeElement, WebInspector.UIString("Cookies"));
+    }
+
+    _frameManifestAdded(event)
+    {
+        this._addFrameManifest(event.data.frameManifest);
+    }
+
+    _addFrameManifest(frameManifest)
+    {
+        console.assert(frameManifest instanceof WebInspector.ApplicationCacheFrame);
+
+        var manifest = frameManifest.manifest;
+        var manifestURL = manifest.manifestURL;
+        if (!this._applicationCacheURLTreeElementMap[manifestURL]) {
+            this._applicationCacheURLTreeElementMap[manifestURL] = new WebInspector.ApplicationCacheManifestTreeElement(manifest);
+            this._applicationCacheRootTreeElement = this._addStorageChild(this._applicationCacheURLTreeElementMap[manifestURL], this._applicationCacheRootTreeElement, WebInspector.UIString("Application Cache"));
+        }
+
+        var frameCacheElement = new WebInspector.ApplicationCacheFrameTreeElement(frameManifest);
+        this._applicationCacheURLTreeElementMap[manifestURL].appendChild(frameCacheElement);
+    }
+
+    _frameManifestRemoved(event)
+    {
+         // FIXME: Implement this.
+    }
+
+    _compareTreeElements(a, b)
+    {
+        console.assert(a.mainTitle);
+        console.assert(b.mainTitle);
+
+        return (a.mainTitle || "").localeCompare(b.mainTitle || "");
+    }
+
+    _addStorageChild(childElement, parentElement, folderName)
+    {
+        if (!parentElement) {
+            childElement.flattened = true;
+
+            this.contentTreeOutline.insertChild(childElement, insertionIndexForObjectInListSortedByFunction(childElement, this.contentTreeOutline.children, this._compareTreeElements));
+
+            return childElement;
+        }
+
+        if (parentElement instanceof WebInspector.StorageTreeElement) {
+            console.assert(parentElement.flattened);
+
+            var previousOnlyChild = parentElement;
+            previousOnlyChild.flattened = false;
+            this.contentTreeOutline.removeChild(previousOnlyChild);
+
+            var folderElement = new WebInspector.FolderTreeElement(folderName);
+            this.contentTreeOutline.insertChild(folderElement, insertionIndexForObjectInListSortedByFunction(folderElement, this.contentTreeOutline.children, this._compareTreeElements));
+
+            folderElement.appendChild(previousOnlyChild);
+            folderElement.insertChild(childElement, insertionIndexForObjectInListSortedByFunction(childElement, folderElement.children, this._compareTreeElements));
+
+            return folderElement;
+        }
+
+        console.assert(parentElement instanceof WebInspector.FolderTreeElement);
+        parentElement.insertChild(childElement, insertionIndexForObjectInListSortedByFunction(childElement, parentElement.children, this._compareTreeElements));
+
+        return parentElement;
+    }
+
+    _storageCleared(event)
+    {
+        // Close all DOM and cookie storage content views since the main frame has navigated and all storages are cleared.
+        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.CookieStorageContentView);
+        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DOMStorageContentView);
+        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseTableContentView);
+        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.DatabaseContentView);
+        this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.ApplicationCacheFrameContentView);
+
+        if (this._localStorageRootTreeElement && this._localStorageRootTreeElement.parent)
+            this._localStorageRootTreeElement.parent.removeChild(this._localStorageRootTreeElement);
+
+        if (this._sessionStorageRootTreeElement && this._sessionStorageRootTreeElement.parent)
+            this._sessionStorageRootTreeElement.parent.removeChild(this._sessionStorageRootTreeElement);
+
+        if (this._databaseRootTreeElement && this._databaseRootTreeElement.parent)
+            this._databaseRootTreeElement.parent.removeChild(this._databaseRootTreeElement);
+
+        if (this._indexedDatabaseRootTreeElement && this._indexedDatabaseRootTreeElement.parent)
+            this._indexedDatabaseRootTreeElement.parent.removeChild(this._indexedDatabaseRootTreeElement);
+
+        if (this._cookieStorageRootTreeElement && this._cookieStorageRootTreeElement.parent)
+            this._cookieStorageRootTreeElement.parent.removeChild(this._cookieStorageRootTreeElement);
+
+        if (this._applicationCacheRootTreeElement && this._applicationCacheRootTreeElement.parent)
+            this._applicationCacheRootTreeElement.parent.removeChild(this._applicationCacheRootTreeElement);
+
+        this._localStorageRootTreeElement = null;
+        this._sessionStorageRootTreeElement = null;
+        this._databaseRootTreeElement = null;
+        this._databaseHostTreeElementMap = {};
+        this._indexedDatabaseRootTreeElement = null;
+        this._indexedDatabaseHostTreeElementMap = {};
+        this._cookieStorageRootTreeElement = null;
+        this._applicationCacheRootTreeElement = null;
+        this._applicationCacheURLTreeElementMap = {};
+    }
+};

Copied: trunk/Source/WebInspectorUI/UserInterface/Views/StorageTabContentView.js (from rev 183579, trunk/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js) (0 => 183580)


--- trunk/Source/WebInspectorUI/UserInterface/Views/StorageTabContentView.js	                        (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/StorageTabContentView.js	2015-04-29 22:00:06 UTC (rev 183580)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.StorageTabContentView = function(identifier)
+{
+    var tabBarItem = new WebInspector.TabBarItem("Images/Storage.svg", WebInspector.UIString("Storage"));
+    var detailsSidebarPanels = [WebInspector.applicationCacheDetailsSidebarPanel];
+
+    WebInspector.ContentBrowserTabContentView.call(this, identifier || "storage", "storage", tabBarItem, WebInspector.StorageSidebarPanel, detailsSidebarPanels);
+};
+
+WebInspector.StorageTabContentView.prototype = {
+    constructor: WebInspector.StorageTabContentView,
+    __proto__: WebInspector.ContentBrowserTabContentView.prototype,
+
+    // Public
+
+    get type()
+    {
+        return WebInspector.StorageTabContentView.Type;
+    },
+
+    canShowRepresentedObject: function(representedObject)
+    {
+        return representedObject instanceof WebInspector.DOMStorageObject || representedObject instanceof WebInspector.CookieStorageObject ||
+            representedObject instanceof WebInspector.DatabaseTableObject || representedObject instanceof WebInspector.DatabaseObject ||
+            representedObject instanceof WebInspector.ApplicationCacheFrame || representedObject instanceof WebInspector.IndexedDatabaseObjectStore ||
+            representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex;
+    }
+};
+
+WebInspector.StorageTabContentView.Type = "storage";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to