[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
pfeldman at chromium.org
pfeldman at chromium.org
Wed Dec 22 15:54:27 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 0b6b73f92f757a89cfcfc6654e0bbc5ddefe33e5
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 16 13:42:51 2010 +0000
2010-11-15 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: rename StoragePanel to ResourcesPanel.
https://bugs.webkit.org/show_bug.cgi?id=49534
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/front-end/DatabaseQueryView.js:
(WebInspector.DatabaseQueryView.prototype._queryFinished):
* inspector/front-end/DatabaseTableView.js:
(WebInspector.DatabaseTableView.prototype._queryFinished):
* inspector/front-end/ExtensionServer.js:
(WebInspector.ExtensionServer.prototype._onRevealAndSelectResource):
* inspector/front-end/Images/storageIcon.png: Removed.
* inspector/front-end/ResourceManager.js:
(WebInspector.ResourceManager.prototype.setOverrideContent):
(WebInspector.ResourceTreeModel.prototype.addOrUpdateFrame):
(WebInspector.ResourceTreeModel.prototype.didCommitLoadForFrame):
(WebInspector.ResourceTreeModel.prototype.frameDetachedFromParent):
(WebInspector.ResourceTreeModel.prototype._clearChildFramesAndResources):
(WebInspector.ResourceTreeModel.prototype.addResourceToFrame):
* inspector/front-end/StoragePanel.js: Removed.
* inspector/front-end/WebKit.qrc:
* inspector/front-end/inspector.css:
(.resources.panel .sidebar):
(.resources.panel .sidebar li):
(.resources.panel .sidebar li.parent):
(.resources.panel .sidebar li.selected):
(.resources.panel .sidebar li.selected .selection):
(.resources.panel .sidebar :focus li.selected .selection):
(body.inactive .resources.panel .sidebar li.selected .selection):
(.resources.panel .sidebar .icon):
(.resources.panel .base-storage-tree-element-title):
(.resources.panel .status):
(.resources.panel li .status .bubble):
* inspector/front-end/inspector.html:
* inspector/front-end/inspector.js:
(WebInspector._createPanels):
(WebInspector.openResource):
(WebInspector.showPanel):
(WebInspector.selectDatabase):
(WebInspector.selectDOMStorage):
(WebInspector.addDatabase):
(WebInspector.addDOMStorage):
(WebInspector.updateDOMStorage):
(WebInspector.updateApplicationCacheStatus):
(WebInspector.didGetFileSystemPath):
(WebInspector.didGetFileSystemError):
(WebInspector.didGetFileSystemDisabled):
(WebInspector.updateNetworkState):
(WebInspector._choosePanelToShowSourceLine):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/inspector/storage-panel-dom-storage.html b/LayoutTests/inspector/storage-panel-dom-storage.html
index 4cd88e1..dafe42f 100644
--- a/LayoutTests/inspector/storage-panel-dom-storage.html
+++ b/LayoutTests/inspector/storage-panel-dom-storage.html
@@ -17,7 +17,7 @@ function populateDOMStorage()
function test()
{
- WebInspector.showPanel("storage");
+ WebInspector.showPanel("resources");
InspectorTest.evaluateInPage("populateDOMStorage()", function(result) {
InspectorTest.addResult("Populated local and session storage");
@@ -26,7 +26,7 @@ function test()
return storage.isLocalStorage ? "Local storage" : "Session storage";
}
InspectorTest.runAfterPendingDispatches(function() {
- var storages = WebInspector.panels.storage._domStorage;
+ var storages = WebInspector.panels.resources._domStorage;
if (storages) {
for (var i = 0; i < storages.length; i++) {
var storage = storages[i];
@@ -37,7 +37,7 @@ function test()
InspectorTest.addResult("FAIL: no DOM storages found.");
InspectorTest.runAfterPendingDispatches(function() {
- var storages = WebInspector.panels.storage._domStorage;
+ var storages = WebInspector.panels.resources._domStorage;
for (var i = 0; i < storages.length; i++) {
var storage = storages[i];
InspectorTest.addResult(name(storage) + " content: ");
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 74cc629..e7b45b8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,57 @@
+2010-11-15 Pavel Feldman <pfeldman at chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: rename StoragePanel to ResourcesPanel.
+ https://bugs.webkit.org/show_bug.cgi?id=49534
+
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * inspector/front-end/DatabaseQueryView.js:
+ (WebInspector.DatabaseQueryView.prototype._queryFinished):
+ * inspector/front-end/DatabaseTableView.js:
+ (WebInspector.DatabaseTableView.prototype._queryFinished):
+ * inspector/front-end/ExtensionServer.js:
+ (WebInspector.ExtensionServer.prototype._onRevealAndSelectResource):
+ * inspector/front-end/Images/storageIcon.png: Removed.
+ * inspector/front-end/ResourceManager.js:
+ (WebInspector.ResourceManager.prototype.setOverrideContent):
+ (WebInspector.ResourceTreeModel.prototype.addOrUpdateFrame):
+ (WebInspector.ResourceTreeModel.prototype.didCommitLoadForFrame):
+ (WebInspector.ResourceTreeModel.prototype.frameDetachedFromParent):
+ (WebInspector.ResourceTreeModel.prototype._clearChildFramesAndResources):
+ (WebInspector.ResourceTreeModel.prototype.addResourceToFrame):
+ * inspector/front-end/StoragePanel.js: Removed.
+ * inspector/front-end/WebKit.qrc:
+ * inspector/front-end/inspector.css:
+ (.resources.panel .sidebar):
+ (.resources.panel .sidebar li):
+ (.resources.panel .sidebar li.parent):
+ (.resources.panel .sidebar li.selected):
+ (.resources.panel .sidebar li.selected .selection):
+ (.resources.panel .sidebar :focus li.selected .selection):
+ (body.inactive .resources.panel .sidebar li.selected .selection):
+ (.resources.panel .sidebar .icon):
+ (.resources.panel .base-storage-tree-element-title):
+ (.resources.panel .status):
+ (.resources.panel li .status .bubble):
+ * inspector/front-end/inspector.html:
+ * inspector/front-end/inspector.js:
+ (WebInspector._createPanels):
+ (WebInspector.openResource):
+ (WebInspector.showPanel):
+ (WebInspector.selectDatabase):
+ (WebInspector.selectDOMStorage):
+ (WebInspector.addDatabase):
+ (WebInspector.addDOMStorage):
+ (WebInspector.updateDOMStorage):
+ (WebInspector.updateApplicationCacheStatus):
+ (WebInspector.didGetFileSystemPath):
+ (WebInspector.didGetFileSystemError):
+ (WebInspector.didGetFileSystemDisabled):
+ (WebInspector.updateNetworkState):
+ (WebInspector._choosePanelToShowSourceLine):
+
2010-11-16 Alexander Pavlov <apavlov at chromium.org>
Unreviewed SnowLeopard build fix.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index a93dc51..216b557 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -4486,6 +4486,7 @@
'inspector/front-end/ResourceCategory.js',
'inspector/front-end/ResourceManager.js',
'inspector/front-end/ResourceView.js',
+ 'inspector/front-end/ResourcesPanel.js',
'inspector/front-end/ScopeChainSidebarPane.js',
'inspector/front-end/Script.js',
'inspector/front-end/ScriptsPanel.js',
@@ -4502,7 +4503,6 @@
'inspector/front-end/SourceTokenizer.js',
'inspector/front-end/SourceView.js',
'inspector/front-end/StatusBarButton.js',
- 'inspector/front-end/StoragePanel.js',
'inspector/front-end/StylesSidebarPane.js',
'inspector/front-end/SummaryBar.js',
'inspector/front-end/TabbedPane.js',
@@ -4638,7 +4638,6 @@
'inspector/front-end/Images/statusbarMenuButtonSelected.png',
'inspector/front-end/Images/statusbarResizerHorizontal.png',
'inspector/front-end/Images/statusbarResizerVertical.png',
- 'inspector/front-end/Images/storageIcon.png',
'inspector/front-end/Images/successGreenDot.png',
'inspector/front-end/Images/thumbActiveHoriz.png',
'inspector/front-end/Images/thumbActiveVert.png',
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 8f5323b..9f90d8e 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -64535,6 +64535,10 @@
>
</File>
<File
+ RelativePath="..\inspector\front-end\ResourcesPanel.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\ScopeChainSidebarPane.js"
>
</File>
@@ -64599,10 +64603,6 @@
>
</File>
<File
- RelativePath="..\inspector\front-end\StoragePanel.js"
- >
- </File>
- <File
RelativePath="..\inspector\front-end\StylesSidebarPane.js"
>
</File>
diff --git a/WebCore/inspector/front-end/DatabaseQueryView.js b/WebCore/inspector/front-end/DatabaseQueryView.js
index a179eaa..111246f 100644
--- a/WebCore/inspector/front-end/DatabaseQueryView.js
+++ b/WebCore/inspector/front-end/DatabaseQueryView.js
@@ -139,7 +139,7 @@ WebInspector.DatabaseQueryView.prototype = {
_queryFinished: function(query, columnNames, values)
{
- var dataGrid = WebInspector.panels.storage.dataGridForResult(columnNames, values);
+ var dataGrid = WebInspector.panels.resources.dataGridForResult(columnNames, values);
var trimmedQuery = query.trim();
if (dataGrid) {
@@ -149,7 +149,7 @@ WebInspector.DatabaseQueryView.prototype = {
}
if (trimmedQuery.match(/^create /i) || trimmedQuery.match(/^drop table /i))
- WebInspector.panels.storage.updateDatabaseTables(this.database);
+ WebInspector.panels.resources.updateDatabaseTables(this.database);
},
_queryError: function(query, error)
diff --git a/WebCore/inspector/front-end/DatabaseTableView.js b/WebCore/inspector/front-end/DatabaseTableView.js
index b234b9a..1a886ff 100644
--- a/WebCore/inspector/front-end/DatabaseTableView.js
+++ b/WebCore/inspector/front-end/DatabaseTableView.js
@@ -58,7 +58,7 @@ WebInspector.DatabaseTableView.prototype = {
{
this.element.removeChildren();
- var dataGrid = WebInspector.panels.storage.dataGridForResult(columnNames, values);
+ var dataGrid = WebInspector.panels.resources.dataGridForResult(columnNames, values);
if (!dataGrid) {
var emptyMsgElement = document.createElement("div");
emptyMsgElement.className = "storage-empty-view";
diff --git a/WebCore/inspector/front-end/ExtensionServer.js b/WebCore/inspector/front-end/ExtensionServer.js
index 6ffa33a..7229785 100644
--- a/WebCore/inspector/front-end/ExtensionServer.js
+++ b/WebCore/inspector/front-end/ExtensionServer.js
@@ -277,8 +277,8 @@ WebInspector.ExtensionServer.prototype = {
if (!resource)
return this._status.E_NOTFOUND(typeof id + ": " + id);
- WebInspector.panels.storage.showResource(resource, message.line);
- WebInspector.showPanel("storage");
+ WebInspector.panels.resources.showResource(resource, message.line);
+ WebInspector.showPanel("resources");
},
_dispatchCallback: function(requestId, port, result)
diff --git a/WebCore/inspector/front-end/Images/storageIcon.png b/WebCore/inspector/front-end/Images/storageIcon.png
deleted file mode 100644
index 79c7bb3..0000000
Binary files a/WebCore/inspector/front-end/Images/storageIcon.png and /dev/null differ
diff --git a/WebCore/inspector/front-end/ResourceManager.js b/WebCore/inspector/front-end/ResourceManager.js
index d1220a2..223e435 100644
--- a/WebCore/inspector/front-end/ResourceManager.js
+++ b/WebCore/inspector/front-end/ResourceManager.js
@@ -250,7 +250,7 @@ WebInspector.ResourceManager.prototype = {
resource.type = WebInspector.Resource.Type[type];
resource.content = sourceString;
- WebInspector.panels.storage.refreshResource(resource);
+ WebInspector.panels.resources.refreshResource(resource);
WebInspector.panels.network.refreshResource(resource);
},
@@ -489,7 +489,7 @@ WebInspector.ResourceTreeModel.prototype = {
addOrUpdateFrame: function(frame)
{
var tmpResource = new WebInspector.Resource(null, frame.url);
- WebInspector.panels.storage.addOrUpdateFrame(frame.parentId, frame.id, frame.name, tmpResource.displayName);
+ WebInspector.panels.resources.addOrUpdateFrame(frame.parentId, frame.id, frame.name, tmpResource.displayName);
var subframes = this._subframes[frame.parentId];
if (!subframes) {
subframes = {};
@@ -508,19 +508,19 @@ WebInspector.ResourceTreeModel.prototype = {
var resourcesForFrame = this._resourcesByFrameId[frame.id];
for (var i = 0; resourcesForFrame && i < resourcesForFrame.length; ++i) {
WebInspector.resourceManager._bindResourceURL(resourcesForFrame[i]);
- WebInspector.panels.storage.addResourceToFrame(frame.id, resourcesForFrame[i]);
+ WebInspector.panels.resources.addResourceToFrame(frame.id, resourcesForFrame[i]);
}
},
frameDetachedFromParent: function(frameId)
{
this._clearChildFramesAndResources(frameId, 0);
- WebInspector.panels.storage.removeFrame(frameId);
+ WebInspector.panels.resources.removeFrame(frameId);
},
_clearChildFramesAndResources: function(frameId, loaderId)
{
- WebInspector.panels.storage.removeResourcesFromFrame(frameId);
+ WebInspector.panels.resources.removeResourcesFromFrame(frameId);
this._clearResources(frameId, loaderId);
var subframes = this._subframes[frameId];
@@ -528,7 +528,7 @@ WebInspector.ResourceTreeModel.prototype = {
return;
for (var childFrameId in subframes) {
- WebInspector.panels.storage.removeFrame(childFrameId);
+ WebInspector.panels.resources.removeFrame(childFrameId);
this._clearChildFramesAndResources(childFrameId, loaderId);
}
delete this._subframes[frameId];
@@ -543,7 +543,7 @@ WebInspector.ResourceTreeModel.prototype = {
}
resourcesForFrame.push(resource);
- WebInspector.panels.storage.addResourceToFrame(frameId, resource);
+ WebInspector.panels.resources.addResourceToFrame(frameId, resource);
},
_clearResources: function(frameId, loaderToPreserveId)
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
new file mode 100644
index 0000000..5285dae
--- /dev/null
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -0,0 +1,1223 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Joseph Pecoraro
+ *
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.ResourcesPanel = function(database)
+{
+ WebInspector.Panel.call(this, "resources");
+
+ WebInspector.settings.installApplicationSetting("resourcesLastSelectedItem", {});
+
+ this.createSidebar();
+ this.sidebarElement.addStyleClass("outline-disclosure filter-all children small");
+ this.sidebarTreeElement.removeStyleClass("sidebar-tree");
+
+ this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Frames"), "Frames", "frame-storage-tree-item");
+ this.sidebarTree.appendChild(this.resourcesListTreeElement);
+ this._treeElementForFrameId = {};
+
+ this.databasesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Databases"), "Databases", "database-storage-tree-item");
+ this.sidebarTree.appendChild(this.databasesListTreeElement);
+
+ this.localStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Local Storage"), "LocalStorage", "domstorage-storage-tree-item local-storage");
+ this.sidebarTree.appendChild(this.localStorageListTreeElement);
+
+ this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Session Storage"), "SessionStorage", "domstorage-storage-tree-item session-storage");
+ this.sidebarTree.appendChild(this.sessionStorageListTreeElement);
+
+ this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Cookies"), "Cookies", "cookie-storage-tree-item");
+ this.sidebarTree.appendChild(this.cookieListTreeElement);
+
+ this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", "application-cache-storage-tree-item");
+ this.sidebarTree.appendChild(this.applicationCacheListTreeElement);
+
+ if (Preferences.fileSystemEnabled) {
+ this.fileSystemListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("File System"), "FileSystem", "file-system-storage-tree-item");
+ this.sidebarTree.appendChild(this.fileSystemListTreeElement);
+ this.fileSystemListTreeElement.expand();
+ }
+
+ this.storageViews = document.createElement("div");
+ this.storageViews.id = "storage-views";
+ this.element.appendChild(this.storageViews);
+
+ this.storageViewStatusBarItemsContainer = document.createElement("div");
+ this.storageViewStatusBarItemsContainer.className = "status-bar-items";
+
+ this._databases = [];
+ this._domStorage = [];
+ this._cookieViews = {};
+ this._origins = {};
+ this._domains = {};
+
+ this.sidebarElement.addEventListener("mousemove", this._onmousemove.bind(this), false);
+ this.sidebarElement.addEventListener("mouseout", this._onmouseout.bind(this), false);
+}
+
+WebInspector.ResourcesPanel.prototype = {
+ get toolbarItemLabel()
+ {
+ return WebInspector.UIString("Resources");
+ },
+
+ get statusBarItems()
+ {
+ return [this.storageViewStatusBarItemsContainer];
+ },
+
+ elementsToRestoreScrollPositionsFor: function()
+ {
+ return [this.sidebarElement];
+ },
+
+ show: function()
+ {
+ WebInspector.Panel.prototype.show.call(this);
+
+ if (this.visibleView instanceof WebInspector.ResourceView) {
+ // SourceViews are shared between the panels.
+ this.visibleView.headersVisible = false;
+ this.visibleView.show(this.storageViews);
+ }
+
+ if (this._initializedDefaultSelection)
+ return;
+
+ this._initializedDefaultSelection = true;
+ var itemURL = WebInspector.settings.resourcesLastSelectedItem;
+ if (itemURL) {
+ for (var treeElement = this.sidebarTree.children[0]; treeElement; treeElement = treeElement.traverseNextTreeElement(false, this.sidebarTree, true)) {
+ if (treeElement.itemURL === itemURL) {
+ treeElement.select();
+ treeElement.reveal();
+ return;
+ }
+ }
+ }
+ this._initDefaultSelection();
+ },
+
+ _initDefaultSelection: function()
+ {
+ if (WebInspector.mainResource && this.resourcesListTreeElement && this.resourcesListTreeElement.expanded)
+ this.showResource(WebInspector.mainResource);
+ },
+
+ reset: function()
+ {
+ this._origins = {};
+ this._domains = {};
+ for (var i = 0; i < this._databases.length; ++i) {
+ var database = this._databases[i];
+ delete database._tableViews;
+ delete database._queryView;
+ }
+ this._databases = [];
+
+ var domStorageLength = this._domStorage.length;
+ for (var i = 0; i < this._domStorage.length; ++i) {
+ var domStorage = this._domStorage[i];
+ delete domStorage._domStorageView;
+ }
+ this._domStorage = [];
+
+ this._cookieViews = {};
+
+ this._fileSystemView = null;
+
+ this._applicationCacheView = null;
+ delete this._cachedApplicationCacheViewStatus;
+
+ this.databasesListTreeElement.removeChildren();
+ this.localStorageListTreeElement.removeChildren();
+ this.sessionStorageListTreeElement.removeChildren();
+ this.cookieListTreeElement.removeChildren();
+ this.applicationCacheListTreeElement.removeChildren();
+ if (Preferences.fileSystemEnabled)
+ this.fileSystemListTreeElement.removeChildren();
+ this.storageViews.removeChildren();
+
+ this.storageViewStatusBarItemsContainer.removeChildren();
+
+ if (this.sidebarTree.selectedTreeElement)
+ this.sidebarTree.selectedTreeElement.deselect();
+ },
+
+ addOrUpdateFrame: function(parentFrameId, frameId, title, subtitle)
+ {
+ var frameTreeElement = this._treeElementForFrameId[frameId];
+ if (frameTreeElement) {
+ frameTreeElement.setTitles(title, subtitle);
+ return;
+ }
+
+ var parentTreeElement = parentFrameId ? this._treeElementForFrameId[parentFrameId] : this.resourcesListTreeElement;
+ if (!parentTreeElement) {
+ console.warning("No frame with id:" + parentFrameId + " to route " + displayName + " to.")
+ return;
+ }
+
+ var frameTreeElement = new WebInspector.FrameTreeElement(this, frameId, title, subtitle);
+ this._treeElementForFrameId[frameId] = frameTreeElement;
+
+ // Insert in the alphabetical order, first frames, then resources.
+ var children = parentTreeElement.children;
+ for (var i = 0; i < children.length; ++i) {
+ var child = children[i];
+ if (!(child instanceof WebInspector.FrameTreeElement)) {
+ parentTreeElement.insertChild(frameTreeElement, i);
+ return;
+ }
+ if (child.displayName.localeCompare(frameTreeElement.displayName) > 0) {
+ parentTreeElement.insertChild(frameTreeElement, i);
+ return;
+ }
+ }
+ parentTreeElement.appendChild(frameTreeElement);
+ },
+
+ removeFrame: function(frameId)
+ {
+ var frameTreeElement = this._treeElementForFrameId[frameId];
+ if (!frameTreeElement)
+ return;
+ delete this._treeElementForFrameId[frameId];
+ if (frameTreeElement.parent)
+ frameTreeElement.parent.removeChild(frameTreeElement);
+ },
+
+ addResourceToFrame: function(frameId, resource)
+ {
+ this.addDocumentURL(resource.documentURL);
+
+ if (resource.statusCode >= 301 && resource.statusCode <= 303)
+ return;
+
+ var frameTreeElement = this._treeElementForFrameId[frameId];
+ if (!frameTreeElement) {
+ // This is a frame's main resource, it will be retained
+ // and re-added by the resource manager;
+ return;
+ }
+
+ var resourceTreeElement = new WebInspector.FrameResourceTreeElement(this, resource);
+
+ // Insert in the alphabetical order, first frames, then resources. Document resource goes first.
+ var children = frameTreeElement.children;
+ for (var i = 0; i < children.length; ++i) {
+ var child = children[i];
+ if (!(child instanceof WebInspector.FrameResourceTreeElement))
+ continue;
+
+ if (resource.type === WebInspector.Resource.Type.Document ||
+ (child._resource.type !== WebInspector.Resource.Type.Document && child._resource.displayName.localeCompare(resource.displayName) > 0)) {
+ frameTreeElement.insertChild(resourceTreeElement, i);
+ return;
+ }
+ }
+ frameTreeElement.appendChild(resourceTreeElement);
+ },
+
+ removeResourcesFromFrame: function(frameId)
+ {
+ var frameTreeElement = this._treeElementForFrameId[frameId];
+ if (frameTreeElement)
+ frameTreeElement.removeChildren();
+ },
+
+ refreshResource: function(resource)
+ {
+ // FIXME: do not add XHR in the first place based on the native instrumentation.
+ if (resource.type === WebInspector.Resource.Type.XHR) {
+ var resourceTreeElement = this._findTreeElementForResource(resource);
+ if (resourceTreeElement)
+ resourceTreeElement.parent.removeChild(resourceTreeElement);
+ }
+ },
+
+ addDatabase: function(database)
+ {
+ this._databases.push(database);
+
+ var databaseTreeElement = new WebInspector.DatabaseTreeElement(this, database);
+ database._databasesTreeElement = databaseTreeElement;
+ this.databasesListTreeElement.appendChild(databaseTreeElement);
+ },
+
+ addDocumentURL: function(url)
+ {
+ var parsedURL = url.asParsedURL();
+ if (!parsedURL)
+ return;
+
+ var domain = parsedURL.host;
+ if (!this._domains[domain]) {
+ this._domains[domain] = true;
+
+ var cookieDomainTreeElement = new WebInspector.CookieTreeElement(this, domain);
+ this.cookieListTreeElement.appendChild(cookieDomainTreeElement);
+
+ var applicationCacheTreeElement = new WebInspector.ApplicationCacheTreeElement(this, domain);
+ this.applicationCacheListTreeElement.appendChild(applicationCacheTreeElement);
+ }
+
+ if (Preferences.fileSystemEnabled) {
+ // FIXME: This should match the SecurityOrigin::toString(), add a test for this.
+ var securityOrigin = parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "");
+ if (!this._origins[securityOrigin]) {
+ this._origins[securityOrigin] = true;
+ var fileSystemTreeElement = new WebInspector.FileSystemTreeElement(this, securityOrigin);
+ this.fileSystemListTreeElement.appendChild(fileSystemTreeElement);
+ }
+ }
+ },
+
+ addDOMStorage: function(domStorage)
+ {
+ this._domStorage.push(domStorage);
+ var domStorageTreeElement = new WebInspector.DOMStorageTreeElement(this, domStorage, (domStorage.isLocalStorage ? "local-storage" : "session-storage"));
+ domStorage._domStorageTreeElement = domStorageTreeElement;
+ if (domStorage.isLocalStorage)
+ this.localStorageListTreeElement.appendChild(domStorageTreeElement);
+ else
+ this.sessionStorageListTreeElement.appendChild(domStorageTreeElement);
+ },
+
+ selectDatabase: function(databaseId)
+ {
+ var database;
+ for (var i = 0, len = this._databases.length; i < len; ++i) {
+ database = this._databases[i];
+ if (database.id === databaseId) {
+ this.showDatabase(database);
+ database._databasesTreeElement.select();
+ return;
+ }
+ }
+ },
+
+ selectDOMStorage: function(storageId)
+ {
+ var domStorage = this._domStorageForId(storageId);
+ if (domStorage) {
+ this.showDOMStorage(domStorage);
+ domStorage._domStorageTreeElement.select();
+ }
+ },
+
+ canShowSourceLine: function(url, line)
+ {
+ return !!WebInspector.resourceManager.resourceForURL(url);
+ },
+
+ showSourceLine: function(url, line)
+ {
+ var resource = WebInspector.resourceManager.resourceForURL(url);
+ if (resource.type === WebInspector.Resource.Type.XHR) {
+ // Show XHRs in the network panel only.
+ if (WebInspector.panels.network && WebInspector.panels.network.canShowSourceLine(url, line)) {
+ WebInspector.currentPanel = WebInspector.panels.network;
+ WebInspector.panels.network.showSourceLine(url, line);
+ }
+ return;
+ }
+ this.showResource(WebInspector.resourceManager.resourceForURL(url), line);
+ },
+
+ showResource: function(resource, line)
+ {
+ var resourceTreeElement = this._findTreeElementForResource(resource);
+ if (resourceTreeElement) {
+ resourceTreeElement.reveal();
+ resourceTreeElement.select();
+ }
+
+ if (line) {
+ var view = WebInspector.ResourceManager.resourceViewForResource(resource);
+ view.selectContentTab();
+ if (view.revealLine)
+ view.revealLine(line);
+ if (view.highlightLine)
+ view.highlightLine(line);
+ }
+ return true;
+ },
+
+ _showResourceView: function(resource)
+ {
+ var view = WebInspector.ResourceManager.resourceViewForResource(resource);
+ view.headersVisible = false;
+ this._innerShowView(view);
+ },
+
+ showDatabase: function(database, tableName)
+ {
+ if (!database)
+ return;
+
+ var view;
+ if (tableName) {
+ if (!("_tableViews" in database))
+ database._tableViews = {};
+ view = database._tableViews[tableName];
+ if (!view) {
+ view = new WebInspector.DatabaseTableView(database, tableName);
+ database._tableViews[tableName] = view;
+ }
+ } else {
+ view = database._queryView;
+ if (!view) {
+ view = new WebInspector.DatabaseQueryView(database);
+ database._queryView = view;
+ }
+ }
+
+ this._innerShowView(view);
+ },
+
+ showDOMStorage: function(domStorage)
+ {
+ if (!domStorage)
+ return;
+
+ var view;
+ view = domStorage._domStorageView;
+ if (!view) {
+ view = new WebInspector.DOMStorageItemsView(domStorage);
+ domStorage._domStorageView = view;
+ }
+
+ this._innerShowView(view);
+ },
+
+ showCookies: function(treeElement, cookieDomain)
+ {
+ var view = this._cookieViews[cookieDomain];
+ if (!view) {
+ view = new WebInspector.CookieItemsView(treeElement, cookieDomain);
+ this._cookieViews[cookieDomain] = view;
+ }
+
+ this._innerShowView(view);
+ },
+
+ showApplicationCache: function(treeElement, appcacheDomain)
+ {
+ var view = this._applicationCacheView;
+ if (!view) {
+ view = new WebInspector.ApplicationCacheItemsView(treeElement, appcacheDomain);
+ this._applicationCacheView = view;
+ }
+
+ this._innerShowView(view);
+
+ if ("_cachedApplicationCacheViewStatus" in this)
+ this._applicationCacheView.updateStatus(this._cachedApplicationCacheViewStatus);
+ },
+
+ showFileSystem: function(treeElement, origin)
+ {
+ this._fileSystemView = new WebInspector.FileSystemView(treeElement, origin);
+ this._innerShowView(this._fileSystemView);
+ },
+
+ showCategoryView: function(categoryName)
+ {
+ if (!this._categoryView)
+ this._categoryView = new WebInspector.StorageCategoryView();
+ this._categoryView.setText(categoryName);
+ this._innerShowView(this._categoryView);
+ },
+
+ _innerShowView: function(view)
+ {
+ if (this.visibleView)
+ this.visibleView.hide();
+
+ view.show(this.storageViews);
+ this.visibleView = view;
+
+ this.storageViewStatusBarItemsContainer.removeChildren();
+ var statusBarItems = view.statusBarItems || [];
+ for (var i = 0; i < statusBarItems.length; ++i)
+ this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
+ },
+
+ closeVisibleView: function()
+ {
+ if (this.visibleView)
+ this.visibleView.hide();
+ delete this.visibleView;
+ },
+
+ updateDatabaseTables: function(database)
+ {
+ if (!database || !database._databasesTreeElement)
+ return;
+
+ database._databasesTreeElement.shouldRefreshChildren = true;
+
+ if (!("_tableViews" in database))
+ return;
+
+ var tableNamesHash = {};
+ var self = this;
+ function tableNamesCallback(tableNames)
+ {
+ var tableNamesLength = tableNames.length;
+ for (var i = 0; i < tableNamesLength; ++i)
+ tableNamesHash[tableNames[i]] = true;
+
+ for (var tableName in database._tableViews) {
+ if (!(tableName in tableNamesHash)) {
+ if (self.visibleView === database._tableViews[tableName])
+ self.closeVisibleView();
+ delete database._tableViews[tableName];
+ }
+ }
+ }
+ database.getTableNames(tableNamesCallback);
+ },
+
+ dataGridForResult: function(columnNames, values)
+ {
+ var numColumns = columnNames.length;
+ if (!numColumns)
+ return null;
+
+ var columns = {};
+
+ for (var i = 0; i < columnNames.length; ++i) {
+ var column = {};
+ column.width = columnNames[i].length;
+ column.title = columnNames[i];
+ column.sortable = true;
+
+ columns[columnNames[i]] = column;
+ }
+
+ var nodes = [];
+ for (var i = 0; i < values.length / numColumns; ++i) {
+ var data = {};
+ for (var j = 0; j < columnNames.length; ++j)
+ data[columnNames[j]] = values[numColumns * i + j];
+
+ var node = new WebInspector.DataGridNode(data, false);
+ node.selectable = false;
+ nodes.push(node);
+ }
+
+ var dataGrid = new WebInspector.DataGrid(columns);
+ var length = nodes.length;
+ for (var i = 0; i < length; ++i)
+ dataGrid.appendChild(nodes[i]);
+
+ dataGrid.addEventListener("sorting changed", this._sortDataGrid.bind(this, dataGrid), this);
+ return dataGrid;
+ },
+
+ _sortDataGrid: function(dataGrid)
+ {
+ var nodes = dataGrid.children.slice();
+ var sortColumnIdentifier = dataGrid.sortColumnIdentifier;
+ var sortDirection = dataGrid.sortOrder === "ascending" ? 1 : -1;
+ var columnIsNumeric = true;
+
+ for (var i = 0; i < nodes.length; i++) {
+ if (isNaN(Number(nodes[i].data[sortColumnIdentifier])))
+ columnIsNumeric = false;
+ }
+
+ function comparator(dataGridNode1, dataGridNode2)
+ {
+ var item1 = dataGridNode1.data[sortColumnIdentifier];
+ var item2 = dataGridNode2.data[sortColumnIdentifier];
+
+ var comparison;
+ if (columnIsNumeric) {
+ // Sort numbers based on comparing their values rather than a lexicographical comparison.
+ var number1 = parseFloat(item1);
+ var number2 = parseFloat(item2);
+ comparison = number1 < number2 ? -1 : (number1 > number2 ? 1 : 0);
+ } else
+ comparison = item1 < item2 ? -1 : (item1 > item2 ? 1 : 0);
+
+ return sortDirection * comparison;
+ }
+
+ nodes.sort(comparator);
+ dataGrid.removeChildren();
+ for (var i = 0; i < nodes.length; i++)
+ dataGrid.appendChild(nodes[i]);
+ },
+
+ updateDOMStorage: function(storageId)
+ {
+ var domStorage = this._domStorageForId(storageId);
+ if (!domStorage)
+ return;
+
+ var view = domStorage._domStorageView;
+ if (this.visibleView && view === this.visibleView)
+ domStorage._domStorageView.update();
+ },
+
+ updateApplicationCacheStatus: function(status)
+ {
+ this._cachedApplicationCacheViewStatus = status;
+ if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
+ this._applicationCacheView.updateStatus(status);
+ },
+
+ updateFileSystemPath: function(root, type, origin)
+ {
+ if (this._fileSystemView && this._fileSystemView === this.visibleView)
+ this._fileSystemView.updateFileSystemPath(root, type, origin);
+ },
+
+ updateFileSystemError: function(type, origin)
+ {
+ if (this._fileSystemView && this._fileSystemView === this.visibleView)
+ this._fileSystemView.updateFileSystemError(type, origin);
+ },
+
+ setFileSystemDisabled: function()
+ {
+ if (this._fileSystemView && this._fileSystemView === this.visibleView)
+ this._fileSystemView.setFileSystemDisabled();
+ },
+
+ updateNetworkState: function(isNowOnline)
+ {
+ if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
+ this._applicationCacheView.updateNetworkState(isNowOnline);
+ },
+
+ updateManifest: function(manifest)
+ {
+ if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
+ this._applicationCacheView.updateManifest(manifest);
+ },
+
+ _domStorageForId: function(storageId)
+ {
+ if (!this._domStorage)
+ return null;
+ var domStorageLength = this._domStorage.length;
+ for (var i = 0; i < domStorageLength; ++i) {
+ var domStorage = this._domStorage[i];
+ if (domStorage.id == storageId)
+ return domStorage;
+ }
+ return null;
+ },
+
+ updateMainViewWidth: function(width)
+ {
+ this.storageViews.style.left = width + "px";
+ this.storageViewStatusBarItemsContainer.style.left = width + "px";
+ this.resize();
+ },
+
+ get searchableViews()
+ {
+ var views = [];
+
+ const visibleView = this.visibleView;
+ if (visibleView instanceof WebInspector.ResourceView && visibleView.performSearch)
+ views.push(visibleView);
+
+ function callback(resourceTreeElement)
+ {
+ var resource = resourceTreeElement._resource;
+ var resourceView = WebInspector.ResourceManager.resourceViewForResource(resource);
+ if (resourceView.performSearch && resourceView !== visibleView)
+ views.push(resourceView);
+ }
+ this._forAllResourceTreeElements(callback);
+ return views;
+ },
+
+ _forAllResourceTreeElements: function(callback)
+ {
+ var stop = false;
+ for (var treeElement = this.resourcesListTreeElement; !stop && treeElement; treeElement = treeElement.traverseNextTreeElement(false, this.resourcesListTreeElement, true)) {
+ if (treeElement instanceof WebInspector.FrameResourceTreeElement)
+ stop = callback(treeElement);
+ }
+ },
+
+ searchMatchFound: function(view, matches)
+ {
+ if (!view.resource)
+ return;
+ var treeElement = this._findTreeElementForResource(view.resource);
+ if (treeElement)
+ treeElement.searchMatchFound(matches);
+ },
+
+ _findTreeElementForResource: function(resource)
+ {
+ function isAncestor(ancestor, object)
+ {
+ // Redirects, XHRs do not belong to the tree, it is fine to silently return false here.
+ return false;
+ }
+
+ function getParent(object)
+ {
+ // Redirects, XHRs do not belong to the tree, it is fine to silently return false here.
+ return null;
+ }
+
+ return this.sidebarTree.findTreeElement(resource, isAncestor, getParent);
+ },
+
+ searchCanceled: function(startingNewSearch)
+ {
+ WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch);
+
+ if (startingNewSearch)
+ return;
+
+ function callback(resourceTreeElement)
+ {
+ resourceTreeElement._errorsWarningsUpdated();
+ }
+ this._forAllResourceTreeElements(callback);
+ },
+
+ performSearch: function(query)
+ {
+ function callback(resourceTreeElement)
+ {
+ resourceTreeElement._resetBubble();
+ }
+ this._forAllResourceTreeElements(callback);
+ WebInspector.Panel.prototype.performSearch.call(this, query);
+ },
+
+ showView: function(view)
+ {
+ if (view)
+ this.showResource(view.resource);
+ },
+
+ _onmousemove: function(event)
+ {
+ var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
+ if (!nodeUnderMouse)
+ return;
+
+ var listNode = nodeUnderMouse.enclosingNodeOrSelfWithNodeName("li");
+ if (!listNode)
+ return;
+
+ var element = listNode.treeElement;
+ if (this._previousHoveredElement === element)
+ return;
+
+ if (this._previousHoveredElement) {
+ this._previousHoveredElement.hovered = false;
+ delete this._previousHoveredElement;
+ }
+
+ if (element instanceof WebInspector.FrameTreeElement) {
+ this._previousHoveredElement = element;
+ element.hovered = true;
+ }
+ },
+
+ _onmouseout: function(event)
+ {
+ if (this._previousHoveredElement) {
+ this._previousHoveredElement.hovered = false;
+ delete this._previousHoveredElement;
+ }
+ }
+}
+
+WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+WebInspector.BaseStorageTreeElement = function(storagePanel, representedObject, title, iconClass, hasChildren)
+{
+ TreeElement.call(this, "", representedObject, hasChildren);
+ this._storagePanel = storagePanel;
+ this._titleText = title;
+ this._iconClass = iconClass;
+}
+
+WebInspector.BaseStorageTreeElement.prototype = {
+ onattach: function()
+ {
+ this.listItemElement.removeChildren();
+ this.listItemElement.addStyleClass(this._iconClass);
+
+ var selectionElement = document.createElement("div");
+ selectionElement.className = "selection";
+ this.listItemElement.appendChild(selectionElement);
+
+ this.imageElement = document.createElement("img");
+ this.imageElement.className = "icon";
+ this.listItemElement.appendChild(this.imageElement);
+
+ this.titleElement = document.createElement("div");
+ this.titleElement.className = "base-storage-tree-element-title";
+ this.titleElement.textContent = this._titleText;
+ this.listItemElement.appendChild(this.titleElement);
+ },
+
+ onselect: function()
+ {
+ var itemURL = this.itemURL;
+ if (itemURL)
+ WebInspector.settings.resourcesLastSelectedItem = itemURL;
+ },
+
+ onreveal: function()
+ {
+ if (this.listItemElement)
+ this.listItemElement.scrollIntoViewIfNeeded(false);
+ },
+
+ get titleText()
+ {
+ return this._titleText;
+ },
+
+ set titleText(titleText)
+ {
+ this._titleText = titleText;
+ this.titleElement.textContent = this._titleText;
+ },
+
+ isEventWithinDisclosureTriangle: function()
+ {
+ // Override it since we use margin-left in place of treeoutline's text-indent.
+ // Hence we need to take padding into consideration. This all is needed for leading
+ // icons in the tree.
+ const paddingLeft = 14;
+ var left = this.listItemElement.totalOffsetLeft + paddingLeft;
+ return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth && this.hasChildren;
+ }
+}
+
+WebInspector.BaseStorageTreeElement.prototype.__proto__ = TreeElement.prototype;
+
+WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, settingsKey, iconClass)
+{
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryName, iconClass, true);
+ this._expandedSettingKey = "resources" + settingsKey + "Expanded";
+ WebInspector.settings.installApplicationSetting(this._expandedSettingKey, settingsKey === "Frames");
+ this._categoryName = categoryName;
+}
+
+WebInspector.StorageCategoryTreeElement.prototype = {
+ get itemURL()
+ {
+ return "category://" + this._categoryName;
+ },
+
+ onselect: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+ this._storagePanel.showCategoryView(this._categoryName);
+ },
+
+ onattach: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+ if (WebInspector.settings[this._expandedSettingKey])
+ this.expand();
+ },
+
+ onexpand: function()
+ {
+ WebInspector.settings[this._expandedSettingKey] = true;
+ },
+
+ oncollapse: function()
+ {
+ WebInspector.settings[this._expandedSettingKey] = false;
+ }
+}
+WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.FrameTreeElement = function(storagePanel, frameId, title, subtitle)
+{
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, "", "frame-storage-tree-item");
+ this._frameId = frameId;
+ this.setTitles(title, subtitle);
+}
+
+WebInspector.FrameTreeElement.prototype = {
+ get itemURL()
+ {
+ return "frame://" + encodeURI(this._displayName);
+ },
+
+ onattach: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+ if (this._titleToSetOnAttach || this._subtitleToSetOnAttach) {
+ this.setTitles(this._titleToSetOnAttach, this._subtitleToSetOnAttach);
+ delete this._titleToSetOnAttach;
+ delete this._subtitleToSetOnAttach;
+ }
+ },
+
+ onselect: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+ this._storagePanel.showCategoryView(this._displayName);
+
+ this.listItemElement.removeStyleClass("hovered");
+ InspectorBackend.hideFrameHighlight();
+ },
+
+ get displayName()
+ {
+ return this._displayName;
+ },
+
+ setTitles: function(title, subtitle)
+ {
+ this._displayName = "";
+ if (this.parent) {
+ if (title) {
+ this.titleElement.textContent = title;
+ this._displayName = title;
+ }
+ if (subtitle) {
+ var subtitleElement = document.createElement("span");
+ subtitleElement.className = "base-storage-tree-element-subtitle";
+ subtitleElement.textContent = "(" + subtitle + ")";
+ this._displayName += " (" + subtitle + ")";
+ this.titleElement.appendChild(subtitleElement);
+ }
+ } else {
+ this._titleToSetOnAttach = title;
+ this._subtitleToSetOnAttach = subtitle;
+ }
+ },
+
+ set hovered(hovered)
+ {
+ if (hovered) {
+ this.listItemElement.addStyleClass("hovered");
+ InspectorBackend.highlightFrame(this._frameId);
+ } else {
+ this.listItemElement.removeStyleClass("hovered");
+ InspectorBackend.hideFrameHighlight();
+ }
+ }
+}
+WebInspector.FrameTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.FrameResourceTreeElement = function(storagePanel, resource)
+{
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name);
+ this._resource = resource;
+ this._resource.addEventListener("errors-warnings-updated", this._errorsWarningsUpdated, this);
+ this.tooltip = resource.url;
+}
+
+WebInspector.FrameResourceTreeElement.prototype = {
+ get itemURL()
+ {
+ return this._resource.url;
+ },
+
+ onselect: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+ this._storagePanel._showResourceView(this._resource);
+ },
+
+ ondblclick: function(event)
+ {
+ InspectorBackend.openInInspectedWindow(this._resource.url);
+ },
+
+ onattach: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+
+ if (this._resource.category === WebInspector.resourceCategories.images) {
+ var previewImage = document.createElement("img");
+ previewImage.className = "image-resource-icon-preview";
+ previewImage.src = this._resource.url;
+
+ var iconElement = document.createElement("div");
+ iconElement.className = "icon";
+ iconElement.appendChild(previewImage);
+ this.listItemElement.replaceChild(iconElement, this.imageElement);
+ }
+
+ this._statusElement = document.createElement("div");
+ this._statusElement.className = "status";
+ this.listItemElement.insertBefore(this._statusElement, this.titleElement);
+
+ this.listItemElement.draggable = true;
+ this.listItemElement.addEventListener("dragstart", this._ondragstart.bind(this), false);
+ },
+
+ _ondragstart: function(event)
+ {
+ event.dataTransfer.setData("text/plain", this._resource.url);
+ event.dataTransfer.setData("text/uri-list", this._resource.url + "\r\n");
+ event.dataTransfer.effectAllowed = "copy";
+ return true;
+ },
+
+ _setBubbleText: function(x)
+ {
+ if (!this._bubbleElement) {
+ this._bubbleElement = document.createElement("div");
+ this._bubbleElement.className = "bubble";
+ this._statusElement.appendChild(this._bubbleElement);
+ }
+
+ this._bubbleElement.textContent = x;
+ },
+
+ _resetBubble: function()
+ {
+ if (this._bubbleElement) {
+ this._bubbleElement.textContent = "";
+ this._bubbleElement.removeStyleClass("search-matches");
+ this._bubbleElement.removeStyleClass("warning");
+ this._bubbleElement.removeStyleClass("error");
+ }
+ },
+
+ searchMatchFound: function(matches)
+ {
+ this._resetBubble();
+
+ this._setBubbleText(matches);
+ this._bubbleElement.addStyleClass("search-matches");
+
+ // Expand, do not scroll into view.
+ var currentAncestor = this.parent;
+ while (currentAncestor && !currentAncestor.root) {
+ if (!currentAncestor.expanded)
+ currentAncestor.expand();
+ currentAncestor = currentAncestor.parent;
+ }
+ },
+
+ _errorsWarningsUpdated: function()
+ {
+ // FIXME: move to the Script/SourceView.
+ if (!this._resource.warnings && !this._resource.errors) {
+ var view = WebInspector.ResourceManager.existingResourceViewForResource(this._resource);
+ if (view && view.clearMessages)
+ view.clearMessages();
+ }
+
+ if (this._storagePanel.currentQuery)
+ return;
+
+ this._resetBubble();
+
+ if (this._resource.warnings || this._resource.errors)
+ this._setBubbleText(this._resource.warnings + this._resource.errors);
+
+ if (this._resource.warnings)
+ this._bubbleElement.addStyleClass("warning");
+
+ if (this._resource.errors)
+ this._bubbleElement.addStyleClass("error");
+ }
+}
+
+WebInspector.FrameResourceTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.DatabaseTreeElement = function(storagePanel, database)
+{
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, database.name, "database-storage-tree-item", true);
+ this._database = database;
+}
+
+WebInspector.DatabaseTreeElement.prototype = {
+ get itemURL()
+ {
+ return "database://" + encodeURI(this._database.name);
+ },
+
+ onselect: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+ this._storagePanel.showDatabase(this._database);
+ },
+
+ oncollapse: function()
+ {
+ // Request a refresh after every collapse so the next
+ // expand will have an updated table list.
+ this.shouldRefreshChildren = true;
+ },
+
+ onpopulate: function()
+ {
+ this.removeChildren();
+
+ function tableNamesCallback(tableNames)
+ {
+ var tableNamesLength = tableNames.length;
+ for (var i = 0; i < tableNamesLength; ++i)
+ this.appendChild(new WebInspector.DatabaseTableTreeElement(this._storagePanel, this._database, tableNames[i]));
+ }
+ this._database.getTableNames(tableNamesCallback.bind(this));
+ }
+
+}
+WebInspector.DatabaseTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.DatabaseTableTreeElement = function(storagePanel, database, tableName)
+{
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, tableName, "database-storage-tree-item");
+ this._database = database;
+ this._tableName = tableName;
+}
+
+WebInspector.DatabaseTableTreeElement.prototype = {
+ get itemURL()
+ {
+ return "database://" + encodeURI(this._database.name) + "/" + encodeURI(this._tableName);
+ },
+
+ onselect: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+ this._storagePanel.showDatabase(this._database, this._tableName);
+ }
+}
+WebInspector.DatabaseTableTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.DOMStorageTreeElement = function(storagePanel, domStorage, className)
+{
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), "domstorage-storage-tree-item " + className);
+ this._domStorage = domStorage;
+}
+
+WebInspector.DOMStorageTreeElement.prototype = {
+ get itemURL()
+ {
+ return "storage://" + this._domStorage.domain + "/" + (this._domStorage.isLocalStorage ? "local" : "session");
+ },
+
+ onselect: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+ this._storagePanel.showDOMStorage(this._domStorage);
+ }
+}
+WebInspector.DOMStorageTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.CookieTreeElement = function(storagePanel, cookieDomain)
+{
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, cookieDomain ? cookieDomain : WebInspector.UIString("Local Files"), "cookie-storage-tree-item");
+ this._cookieDomain = cookieDomain;
+}
+
+WebInspector.CookieTreeElement.prototype = {
+ get itemURL()
+ {
+ return "cookies://" + this._cookieDomain;
+ },
+
+ onselect: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+ this._storagePanel.showCookies(this, this._cookieDomain);
+ }
+}
+WebInspector.CookieTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.ApplicationCacheTreeElement = function(storagePanel, appcacheDomain)
+{
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, appcacheDomain ? appcacheDomain : WebInspector.UIString("Local Files"), "application-cache-storage-tree-item");
+ this._appcacheDomain = appcacheDomain;
+}
+
+WebInspector.ApplicationCacheTreeElement.prototype = {
+ get itemURL()
+ {
+ return "appcache://" + this._appcacheDomain;
+ },
+
+ onselect: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+ this._storagePanel.showApplicationCache(this, this._appcacheDomain);
+ }
+}
+WebInspector.ApplicationCacheTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.FileSystemTreeElement = function(storagePanel, origin)
+{
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, origin, "file-system-storage-tree-item");
+ this._origin = origin;
+}
+
+WebInspector.FileSystemTreeElement.prototype = {
+ get itemURL()
+ {
+ return "file-system://" + encodeURI(this._origin);
+ },
+
+ onselect: function()
+ {
+ WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+ this._storagePanel.showFileSystem(this, this._origin);
+ }
+}
+
+WebInspector.FileSystemTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.StorageCategoryView = function()
+{
+ WebInspector.View.call(this);
+
+ this.element.addStyleClass("storage-view");
+
+ this._emptyMsgElement = document.createElement("div");
+ this._emptyMsgElement.className = "storage-empty-view";
+ this.element.appendChild(this._emptyMsgElement);
+}
+
+WebInspector.StorageCategoryView.prototype = {
+ setText: function(text)
+ {
+ this._emptyMsgElement.textContent = text;
+ }
+}
+
+WebInspector.StorageCategoryView.prototype.__proto__ = WebInspector.View.prototype;
diff --git a/WebCore/inspector/front-end/StoragePanel.js b/WebCore/inspector/front-end/StoragePanel.js
deleted file mode 100644
index 95eb1ce..0000000
--- a/WebCore/inspector/front-end/StoragePanel.js
+++ /dev/null
@@ -1,1220 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * 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.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.StoragePanel = function(database)
-{
- WebInspector.Panel.call(this, "storage");
-
- WebInspector.settings.installApplicationSetting("resourcesLastSelectedItem", {});
-
- this.createSidebar();
- this.sidebarElement.addStyleClass("outline-disclosure filter-all children small");
- this.sidebarTreeElement.removeStyleClass("sidebar-tree");
-
- this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Frames"), "Frames", "frame-storage-tree-item");
- this.sidebarTree.appendChild(this.resourcesListTreeElement);
- this._treeElementForFrameId = {};
-
- this.databasesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Databases"), "Databases", "database-storage-tree-item");
- this.sidebarTree.appendChild(this.databasesListTreeElement);
-
- this.localStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Local Storage"), "LocalStorage", "domstorage-storage-tree-item local-storage");
- this.sidebarTree.appendChild(this.localStorageListTreeElement);
-
- this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Session Storage"), "SessionStorage", "domstorage-storage-tree-item session-storage");
- this.sidebarTree.appendChild(this.sessionStorageListTreeElement);
-
- this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Cookies"), "Cookies", "cookie-storage-tree-item");
- this.sidebarTree.appendChild(this.cookieListTreeElement);
-
- this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", "application-cache-storage-tree-item");
- this.sidebarTree.appendChild(this.applicationCacheListTreeElement);
-
- if (Preferences.fileSystemEnabled) {
- this.fileSystemListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("File System"), "FileSystem", "file-system-storage-tree-item");
- this.sidebarTree.appendChild(this.fileSystemListTreeElement);
- this.fileSystemListTreeElement.expand();
- }
-
- this.storageViews = document.createElement("div");
- this.storageViews.id = "storage-views";
- this.element.appendChild(this.storageViews);
-
- this.storageViewStatusBarItemsContainer = document.createElement("div");
- this.storageViewStatusBarItemsContainer.className = "status-bar-items";
-
- this._databases = [];
- this._domStorage = [];
- this._cookieViews = {};
- this._origins = {};
- this._domains = {};
-
- this.sidebarElement.addEventListener("mousemove", this._onmousemove.bind(this), false);
- this.sidebarElement.addEventListener("mouseout", this._onmouseout.bind(this), false);
-}
-
-WebInspector.StoragePanel.prototype = {
- get toolbarItemLabel()
- {
- return WebInspector.UIString("Resources");
- },
-
- get statusBarItems()
- {
- return [this.storageViewStatusBarItemsContainer];
- },
-
- elementsToRestoreScrollPositionsFor: function()
- {
- return [this.sidebarElement];
- },
-
- show: function()
- {
- WebInspector.Panel.prototype.show.call(this);
-
- if (this.visibleView instanceof WebInspector.ResourceView) {
- // SourceViews are shared between the panels.
- this.visibleView.headersVisible = false;
- this.visibleView.show(this.storageViews);
- }
-
- if (this._initializedDefaultSelection)
- return;
-
- this._initializedDefaultSelection = true;
- var itemURL = WebInspector.settings.resourcesLastSelectedItem;
- if (itemURL) {
- for (var treeElement = this.sidebarTree.children[0]; treeElement; treeElement = treeElement.traverseNextTreeElement(false, this.sidebarTree, true)) {
- if (treeElement.itemURL === itemURL) {
- treeElement.select();
- treeElement.reveal();
- return;
- }
- }
- }
- this._initDefaultSelection();
- },
-
- _initDefaultSelection: function()
- {
- if (WebInspector.mainResource && this.resourcesListTreeElement && this.resourcesListTreeElement.expanded)
- this.showResource(WebInspector.mainResource);
- },
-
- reset: function()
- {
- this._origins = {};
- this._domains = {};
- for (var i = 0; i < this._databases.length; ++i) {
- var database = this._databases[i];
- delete database._tableViews;
- delete database._queryView;
- }
- this._databases = [];
-
- var domStorageLength = this._domStorage.length;
- for (var i = 0; i < this._domStorage.length; ++i) {
- var domStorage = this._domStorage[i];
- delete domStorage._domStorageView;
- }
- this._domStorage = [];
-
- this._cookieViews = {};
-
- this._fileSystemView = null;
-
- this._applicationCacheView = null;
- delete this._cachedApplicationCacheViewStatus;
-
- this.databasesListTreeElement.removeChildren();
- this.localStorageListTreeElement.removeChildren();
- this.sessionStorageListTreeElement.removeChildren();
- this.cookieListTreeElement.removeChildren();
- this.applicationCacheListTreeElement.removeChildren();
- if (Preferences.fileSystemEnabled)
- this.fileSystemListTreeElement.removeChildren();
- this.storageViews.removeChildren();
-
- this.storageViewStatusBarItemsContainer.removeChildren();
-
- if (this.sidebarTree.selectedTreeElement)
- this.sidebarTree.selectedTreeElement.deselect();
- },
-
- addOrUpdateFrame: function(parentFrameId, frameId, title, subtitle)
- {
- var frameTreeElement = this._treeElementForFrameId[frameId];
- if (frameTreeElement) {
- frameTreeElement.setTitles(title, subtitle);
- return;
- }
-
- var parentTreeElement = parentFrameId ? this._treeElementForFrameId[parentFrameId] : this.resourcesListTreeElement;
- if (!parentTreeElement) {
- console.warning("No frame with id:" + parentFrameId + " to route " + displayName + " to.")
- return;
- }
-
- var frameTreeElement = new WebInspector.FrameTreeElement(this, frameId, title, subtitle);
- this._treeElementForFrameId[frameId] = frameTreeElement;
-
- // Insert in the alphabetical order, first frames, then resources.
- var children = parentTreeElement.children;
- for (var i = 0; i < children.length; ++i) {
- var child = children[i];
- if (!(child instanceof WebInspector.FrameTreeElement)) {
- parentTreeElement.insertChild(frameTreeElement, i);
- return;
- }
- if (child.nameForSorting.localeCompare(frameTreeElement.nameForSorting) > 0) {
- parentTreeElement.insertChild(frameTreeElement, i);
- return;
- }
- }
- parentTreeElement.appendChild(frameTreeElement);
- },
-
- removeFrame: function(frameId)
- {
- var frameTreeElement = this._treeElementForFrameId[frameId];
- if (!frameTreeElement)
- return;
- delete this._treeElementForFrameId[frameId];
- if (frameTreeElement.parent)
- frameTreeElement.parent.removeChild(frameTreeElement);
- },
-
- addResourceToFrame: function(frameId, resource)
- {
- this.addDocumentURL(resource.documentURL);
-
- if (resource.statusCode >= 301 && resource.statusCode <= 303)
- return;
-
- var frameTreeElement = this._treeElementForFrameId[frameId];
- if (!frameTreeElement) {
- // This is a frame's main resource, it will be retained
- // and re-added by the resource manager;
- return;
- }
-
- var resourceTreeElement = new WebInspector.FrameResourceTreeElement(this, resource);
-
- // Insert in the alphabetical order, first frames, then resources. Document resource goes first.
- var children = frameTreeElement.children;
- for (var i = 0; i < children.length; ++i) {
- var child = children[i];
- if (!(child instanceof WebInspector.FrameResourceTreeElement))
- continue;
-
- if (resource.type === WebInspector.Resource.Type.Document ||
- (child._resource.type !== WebInspector.Resource.Type.Document && child._resource.displayName.localeCompare(resource.displayName) > 0)) {
- frameTreeElement.insertChild(resourceTreeElement, i);
- return;
- }
- }
- frameTreeElement.appendChild(resourceTreeElement);
- },
-
- removeResourcesFromFrame: function(frameId)
- {
- var frameTreeElement = this._treeElementForFrameId[frameId];
- if (frameTreeElement)
- frameTreeElement.removeChildren();
- },
-
- refreshResource: function(resource)
- {
- // FIXME: do not add XHR in the first place based on the native instrumentation.
- if (resource.type === WebInspector.Resource.Type.XHR) {
- var resourceTreeElement = this._findTreeElementForResource(resource);
- if (resourceTreeElement)
- resourceTreeElement.parent.removeChild(resourceTreeElement);
- }
- },
-
- addDatabase: function(database)
- {
- this._databases.push(database);
-
- var databaseTreeElement = new WebInspector.DatabaseTreeElement(this, database);
- database._databasesTreeElement = databaseTreeElement;
- this.databasesListTreeElement.appendChild(databaseTreeElement);
- },
-
- addDocumentURL: function(url)
- {
- var parsedURL = url.asParsedURL();
- if (!parsedURL)
- return;
-
- var domain = parsedURL.host;
- if (!this._domains[domain]) {
- this._domains[domain] = true;
-
- var cookieDomainTreeElement = new WebInspector.CookieTreeElement(this, domain);
- this.cookieListTreeElement.appendChild(cookieDomainTreeElement);
-
- var applicationCacheTreeElement = new WebInspector.ApplicationCacheTreeElement(this, domain);
- this.applicationCacheListTreeElement.appendChild(applicationCacheTreeElement);
- }
-
- if (Preferences.fileSystemEnabled) {
- // FIXME: This should match the SecurityOrigin::toString(), add a test for this.
- var securityOrigin = parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "");
- if (!this._origins[securityOrigin]) {
- this._origins[securityOrigin] = true;
- var fileSystemTreeElement = new WebInspector.FileSystemTreeElement(this, securityOrigin);
- this.fileSystemListTreeElement.appendChild(fileSystemTreeElement);
- }
- }
- },
-
- addDOMStorage: function(domStorage)
- {
- this._domStorage.push(domStorage);
- var domStorageTreeElement = new WebInspector.DOMStorageTreeElement(this, domStorage, (domStorage.isLocalStorage ? "local-storage" : "session-storage"));
- domStorage._domStorageTreeElement = domStorageTreeElement;
- if (domStorage.isLocalStorage)
- this.localStorageListTreeElement.appendChild(domStorageTreeElement);
- else
- this.sessionStorageListTreeElement.appendChild(domStorageTreeElement);
- },
-
- selectDatabase: function(databaseId)
- {
- var database;
- for (var i = 0, len = this._databases.length; i < len; ++i) {
- database = this._databases[i];
- if (database.id === databaseId) {
- this.showDatabase(database);
- database._databasesTreeElement.select();
- return;
- }
- }
- },
-
- selectDOMStorage: function(storageId)
- {
- var domStorage = this._domStorageForId(storageId);
- if (domStorage) {
- this.showDOMStorage(domStorage);
- domStorage._domStorageTreeElement.select();
- }
- },
-
- canShowSourceLine: function(url, line)
- {
- return !!WebInspector.resourceManager.resourceForURL(url);
- },
-
- showSourceLine: function(url, line)
- {
- var resource = WebInspector.resourceManager.resourceForURL(url);
- if (resource.type === WebInspector.Resource.Type.XHR) {
- // Show XHRs in the network panel only.
- if (WebInspector.panels.network && WebInspector.panels.network.canShowSourceLine(url, line)) {
- WebInspector.currentPanel = WebInspector.panels.network;
- WebInspector.panels.network.showSourceLine(url, line);
- }
- return;
- }
- this.showResource(WebInspector.resourceManager.resourceForURL(url), line);
- },
-
- showResource: function(resource, line)
- {
- var resourceTreeElement = this._findTreeElementForResource(resource);
- if (resourceTreeElement) {
- resourceTreeElement.reveal();
- resourceTreeElement.select();
- }
-
- if (line) {
- var view = WebInspector.ResourceManager.resourceViewForResource(resource);
- view.selectContentTab();
- if (view.revealLine)
- view.revealLine(line);
- if (view.highlightLine)
- view.highlightLine(line);
- }
- return true;
- },
-
- _showResourceView: function(resource)
- {
- var view = WebInspector.ResourceManager.resourceViewForResource(resource);
- view.headersVisible = false;
- this._innerShowView(view);
- },
-
- showDatabase: function(database, tableName)
- {
- if (!database)
- return;
-
- var view;
- if (tableName) {
- if (!("_tableViews" in database))
- database._tableViews = {};
- view = database._tableViews[tableName];
- if (!view) {
- view = new WebInspector.DatabaseTableView(database, tableName);
- database._tableViews[tableName] = view;
- }
- } else {
- view = database._queryView;
- if (!view) {
- view = new WebInspector.DatabaseQueryView(database);
- database._queryView = view;
- }
- }
-
- this._innerShowView(view);
- },
-
- showDOMStorage: function(domStorage)
- {
- if (!domStorage)
- return;
-
- var view;
- view = domStorage._domStorageView;
- if (!view) {
- view = new WebInspector.DOMStorageItemsView(domStorage);
- domStorage._domStorageView = view;
- }
-
- this._innerShowView(view);
- },
-
- showCookies: function(treeElement, cookieDomain)
- {
- var view = this._cookieViews[cookieDomain];
- if (!view) {
- view = new WebInspector.CookieItemsView(treeElement, cookieDomain);
- this._cookieViews[cookieDomain] = view;
- }
-
- this._innerShowView(view);
- },
-
- showApplicationCache: function(treeElement, appcacheDomain)
- {
- var view = this._applicationCacheView;
- if (!view) {
- view = new WebInspector.ApplicationCacheItemsView(treeElement, appcacheDomain);
- this._applicationCacheView = view;
- }
-
- this._innerShowView(view);
-
- if ("_cachedApplicationCacheViewStatus" in this)
- this._applicationCacheView.updateStatus(this._cachedApplicationCacheViewStatus);
- },
-
- showFileSystem: function(treeElement, origin)
- {
- this._fileSystemView = new WebInspector.FileSystemView(treeElement, origin);
- this._innerShowView(this._fileSystemView);
- },
-
- showCategoryView: function(categoryName)
- {
- if (!this._categoryView)
- this._categoryView = new WebInspector.StorageCategoryView();
- this._categoryView.setText(categoryName);
- this._innerShowView(this._categoryView);
- },
-
- _innerShowView: function(view)
- {
- if (this.visibleView)
- this.visibleView.hide();
-
- view.show(this.storageViews);
- this.visibleView = view;
-
- this.storageViewStatusBarItemsContainer.removeChildren();
- var statusBarItems = view.statusBarItems || [];
- for (var i = 0; i < statusBarItems.length; ++i)
- this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
- },
-
- closeVisibleView: function()
- {
- if (this.visibleView)
- this.visibleView.hide();
- delete this.visibleView;
- },
-
- updateDatabaseTables: function(database)
- {
- if (!database || !database._databasesTreeElement)
- return;
-
- database._databasesTreeElement.shouldRefreshChildren = true;
-
- if (!("_tableViews" in database))
- return;
-
- var tableNamesHash = {};
- var self = this;
- function tableNamesCallback(tableNames)
- {
- var tableNamesLength = tableNames.length;
- for (var i = 0; i < tableNamesLength; ++i)
- tableNamesHash[tableNames[i]] = true;
-
- for (var tableName in database._tableViews) {
- if (!(tableName in tableNamesHash)) {
- if (self.visibleView === database._tableViews[tableName])
- self.closeVisibleView();
- delete database._tableViews[tableName];
- }
- }
- }
- database.getTableNames(tableNamesCallback);
- },
-
- dataGridForResult: function(columnNames, values)
- {
- var numColumns = columnNames.length;
- if (!numColumns)
- return null;
-
- var columns = {};
-
- for (var i = 0; i < columnNames.length; ++i) {
- var column = {};
- column.width = columnNames[i].length;
- column.title = columnNames[i];
- column.sortable = true;
-
- columns[columnNames[i]] = column;
- }
-
- var nodes = [];
- for (var i = 0; i < values.length / numColumns; ++i) {
- var data = {};
- for (var j = 0; j < columnNames.length; ++j)
- data[columnNames[j]] = values[numColumns * i + j];
-
- var node = new WebInspector.DataGridNode(data, false);
- node.selectable = false;
- nodes.push(node);
- }
-
- var dataGrid = new WebInspector.DataGrid(columns);
- var length = nodes.length;
- for (var i = 0; i < length; ++i)
- dataGrid.appendChild(nodes[i]);
-
- dataGrid.addEventListener("sorting changed", this._sortDataGrid.bind(this, dataGrid), this);
- return dataGrid;
- },
-
- _sortDataGrid: function(dataGrid)
- {
- var nodes = dataGrid.children.slice();
- var sortColumnIdentifier = dataGrid.sortColumnIdentifier;
- var sortDirection = dataGrid.sortOrder === "ascending" ? 1 : -1;
- var columnIsNumeric = true;
-
- for (var i = 0; i < nodes.length; i++) {
- if (isNaN(Number(nodes[i].data[sortColumnIdentifier])))
- columnIsNumeric = false;
- }
-
- function comparator(dataGridNode1, dataGridNode2)
- {
- var item1 = dataGridNode1.data[sortColumnIdentifier];
- var item2 = dataGridNode2.data[sortColumnIdentifier];
-
- var comparison;
- if (columnIsNumeric) {
- // Sort numbers based on comparing their values rather than a lexicographical comparison.
- var number1 = parseFloat(item1);
- var number2 = parseFloat(item2);
- comparison = number1 < number2 ? -1 : (number1 > number2 ? 1 : 0);
- } else
- comparison = item1 < item2 ? -1 : (item1 > item2 ? 1 : 0);
-
- return sortDirection * comparison;
- }
-
- nodes.sort(comparator);
- dataGrid.removeChildren();
- for (var i = 0; i < nodes.length; i++)
- dataGrid.appendChild(nodes[i]);
- },
-
- updateDOMStorage: function(storageId)
- {
- var domStorage = this._domStorageForId(storageId);
- if (!domStorage)
- return;
-
- var view = domStorage._domStorageView;
- if (this.visibleView && view === this.visibleView)
- domStorage._domStorageView.update();
- },
-
- updateApplicationCacheStatus: function(status)
- {
- this._cachedApplicationCacheViewStatus = status;
- if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
- this._applicationCacheView.updateStatus(status);
- },
-
- updateFileSystemPath: function(root, type, origin)
- {
- if (this._fileSystemView && this._fileSystemView === this.visibleView)
- this._fileSystemView.updateFileSystemPath(root, type, origin);
- },
-
- updateFileSystemError: function(type, origin)
- {
- if (this._fileSystemView && this._fileSystemView === this.visibleView)
- this._fileSystemView.updateFileSystemError(type, origin);
- },
-
- setFileSystemDisabled: function()
- {
- if (this._fileSystemView && this._fileSystemView === this.visibleView)
- this._fileSystemView.setFileSystemDisabled();
- },
-
- updateNetworkState: function(isNowOnline)
- {
- if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
- this._applicationCacheView.updateNetworkState(isNowOnline);
- },
-
- updateManifest: function(manifest)
- {
- if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
- this._applicationCacheView.updateManifest(manifest);
- },
-
- _domStorageForId: function(storageId)
- {
- if (!this._domStorage)
- return null;
- var domStorageLength = this._domStorage.length;
- for (var i = 0; i < domStorageLength; ++i) {
- var domStorage = this._domStorage[i];
- if (domStorage.id == storageId)
- return domStorage;
- }
- return null;
- },
-
- updateMainViewWidth: function(width)
- {
- this.storageViews.style.left = width + "px";
- this.storageViewStatusBarItemsContainer.style.left = width + "px";
- this.resize();
- },
-
- get searchableViews()
- {
- var views = [];
-
- const visibleView = this.visibleView;
- if (visibleView instanceof WebInspector.ResourceView && visibleView.performSearch)
- views.push(visibleView);
-
- function callback(resourceTreeElement)
- {
- var resource = resourceTreeElement._resource;
- var resourceView = WebInspector.ResourceManager.resourceViewForResource(resource);
- if (resourceView.performSearch && resourceView !== visibleView)
- views.push(resourceView);
- }
- this._forAllResourceTreeElements(callback);
- return views;
- },
-
- _forAllResourceTreeElements: function(callback)
- {
- var stop = false;
- for (var treeElement = this.resourcesListTreeElement; !stop && treeElement; treeElement = treeElement.traverseNextTreeElement(false, this.resourcesListTreeElement, true)) {
- if (treeElement instanceof WebInspector.FrameResourceTreeElement)
- stop = callback(treeElement);
- }
- },
-
- searchMatchFound: function(view, matches)
- {
- if (!view.resource)
- return;
- var treeElement = this._findTreeElementForResource(view.resource);
- if (treeElement)
- treeElement.searchMatchFound(matches);
- },
-
- _findTreeElementForResource: function(resource)
- {
- function isAncestor(ancestor, object)
- {
- // Redirects, XHRs do not belong to the tree, it is fine to silently return false here.
- return false;
- }
-
- function getParent(object)
- {
- // Redirects, XHRs do not belong to the tree, it is fine to silently return false here.
- return null;
- }
-
- return this.sidebarTree.findTreeElement(resource, isAncestor, getParent);
- },
-
- searchCanceled: function(startingNewSearch)
- {
- WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch);
-
- if (startingNewSearch)
- return;
-
- function callback(resourceTreeElement)
- {
- resourceTreeElement._errorsWarningsUpdated();
- }
- this._forAllResourceTreeElements(callback);
- },
-
- performSearch: function(query)
- {
- function callback(resourceTreeElement)
- {
- resourceTreeElement._resetBubble();
- }
- this._forAllResourceTreeElements(callback);
- WebInspector.Panel.prototype.performSearch.call(this, query);
- },
-
- showView: function(view)
- {
- if (view)
- this.showResource(view.resource);
- },
-
- _onmousemove: function(event)
- {
- var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
- if (!nodeUnderMouse)
- return;
-
- var listNode = nodeUnderMouse.enclosingNodeOrSelfWithNodeName("li");
- if (!listNode)
- return;
-
- var element = listNode.treeElement;
- if (this._previousHoveredElement === element)
- return;
-
- if (this._previousHoveredElement) {
- this._previousHoveredElement.hovered = false;
- delete this._previousHoveredElement;
- }
-
- if (element instanceof WebInspector.FrameTreeElement) {
- this._previousHoveredElement = element;
- element.hovered = true;
- }
- },
-
- _onmouseout: function(event)
- {
- if (this._previousHoveredElement) {
- this._previousHoveredElement.hovered = false;
- delete this._previousHoveredElement;
- }
- }
-}
-
-WebInspector.StoragePanel.prototype.__proto__ = WebInspector.Panel.prototype;
-
-WebInspector.BaseStorageTreeElement = function(storagePanel, representedObject, title, iconClass, hasChildren)
-{
- TreeElement.call(this, "", representedObject, hasChildren);
- this._storagePanel = storagePanel;
- this._titleText = title;
- this._iconClass = iconClass;
-}
-
-WebInspector.BaseStorageTreeElement.prototype = {
- onattach: function()
- {
- this.listItemElement.removeChildren();
- this.listItemElement.addStyleClass(this._iconClass);
-
- var selectionElement = document.createElement("div");
- selectionElement.className = "selection";
- this.listItemElement.appendChild(selectionElement);
-
- this.imageElement = document.createElement("img");
- this.imageElement.className = "icon";
- this.listItemElement.appendChild(this.imageElement);
-
- this.titleElement = document.createElement("div");
- this.titleElement.className = "base-storage-tree-element-title";
- this.titleElement.textContent = this._titleText;
- this.listItemElement.appendChild(this.titleElement);
- },
-
- onselect: function()
- {
- var itemURL = this.itemURL;
- if (itemURL)
- WebInspector.settings.resourcesLastSelectedItem = itemURL;
- },
-
- onreveal: function()
- {
- if (this.listItemElement)
- this.listItemElement.scrollIntoViewIfNeeded(false);
- },
-
- get titleText()
- {
- return this._titleText;
- },
-
- set titleText(titleText)
- {
- this._titleText = titleText;
- this.titleElement.textContent = this._titleText;
- },
-
- isEventWithinDisclosureTriangle: function()
- {
- // Override it since we use margin-left in place of treeoutline's text-indent.
- // Hence we need to take padding into consideration. This all is needed for leading
- // icons in the tree.
- const paddingLeft = 14;
- var left = this.listItemElement.totalOffsetLeft + paddingLeft;
- return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth && this.hasChildren;
- }
-}
-
-WebInspector.BaseStorageTreeElement.prototype.__proto__ = TreeElement.prototype;
-
-WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, settingsKey, iconClass)
-{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryName, iconClass, true);
- this._expandedSettingKey = "resources" + settingsKey + "Expanded";
- WebInspector.settings.installApplicationSetting(this._expandedSettingKey, settingsKey === "Frames");
- this._categoryName = categoryName;
-}
-
-WebInspector.StorageCategoryTreeElement.prototype = {
- get itemURL()
- {
- return "category://" + this._categoryName;
- },
-
- onselect: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
- this._storagePanel.showCategoryView(this._categoryName);
- },
-
- onattach: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
- if (WebInspector.settings[this._expandedSettingKey])
- this.expand();
- },
-
- onexpand: function()
- {
- WebInspector.settings[this._expandedSettingKey] = true;
- },
-
- oncollapse: function()
- {
- WebInspector.settings[this._expandedSettingKey] = false;
- }
-}
-WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
-
-WebInspector.FrameTreeElement = function(storagePanel, frameId, title, subtitle)
-{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, "", "frame-storage-tree-item");
- this._frameId = frameId;
- this.setTitles(title, subtitle);
-}
-
-WebInspector.FrameTreeElement.prototype = {
- get itemURL()
- {
- return "frame://" + encodeURI(this._displayName);
- },
-
- onattach: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
- if (this._titleToSetOnAttach || this._subtitleToSetOnAttach) {
- this.setTitles(this._titleToSetOnAttach, this._subtitleToSetOnAttach);
- delete this._titleToSetOnAttach;
- delete this._subtitleToSetOnAttach;
- }
- },
-
- onselect: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
- this._storagePanel.showCategoryView(this._displayName);
-
- this.listItemElement.removeStyleClass("hovered");
- InspectorBackend.hideFrameHighlight();
- },
-
- get nameForSorting()
- {
- return this._nameForSorting;
- },
-
- setTitles: function(title, subtitle)
- {
- this._nameForSorting = (title ? title : "") + (subtitle ? subtitle : "");
- if (this.parent) {
- if (title)
- this.titleElement.textContent = title;
- if (subtitle) {
- var subtitleElement = document.createElement("span");
- subtitleElement.className = "base-storage-tree-element-subtitle";
- subtitleElement.textContent = "(" + subtitle + ")";
- this.titleElement.appendChild(subtitleElement);
- }
- } else {
- this._titleToSetOnAttach = title;
- this._subtitleToSetOnAttach = subtitle;
- }
- },
-
- set hovered(hovered)
- {
- if (hovered) {
- this.listItemElement.addStyleClass("hovered");
- InspectorBackend.highlightFrame(this._frameId);
- } else {
- this.listItemElement.removeStyleClass("hovered");
- InspectorBackend.hideFrameHighlight();
- }
- }
-}
-WebInspector.FrameTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
-
-WebInspector.FrameResourceTreeElement = function(storagePanel, resource)
-{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name);
- this._resource = resource;
- this._resource.addEventListener("errors-warnings-updated", this._errorsWarningsUpdated, this);
- this.tooltip = resource.url;
-}
-
-WebInspector.FrameResourceTreeElement.prototype = {
- get itemURL()
- {
- return this._resource.url;
- },
-
- onselect: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
- this._storagePanel._showResourceView(this._resource);
- },
-
- ondblclick: function(event)
- {
- InspectorBackend.openInInspectedWindow(this._resource.url);
- },
-
- onattach: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
-
- if (this._resource.category === WebInspector.resourceCategories.images) {
- var previewImage = document.createElement("img");
- previewImage.className = "image-resource-icon-preview";
- previewImage.src = this._resource.url;
-
- var iconElement = document.createElement("div");
- iconElement.className = "icon";
- iconElement.appendChild(previewImage);
- this.listItemElement.replaceChild(iconElement, this.imageElement);
- }
-
- this._statusElement = document.createElement("div");
- this._statusElement.className = "status";
- this.listItemElement.insertBefore(this._statusElement, this.titleElement);
-
- this.listItemElement.draggable = true;
- this.listItemElement.addEventListener("dragstart", this._ondragstart.bind(this), false);
- },
-
- _ondragstart: function(event)
- {
- event.dataTransfer.setData("text/plain", this._resource.url);
- event.dataTransfer.setData("text/uri-list", this._resource.url + "\r\n");
- event.dataTransfer.effectAllowed = "copy";
- return true;
- },
-
- _setBubbleText: function(x)
- {
- if (!this._bubbleElement) {
- this._bubbleElement = document.createElement("div");
- this._bubbleElement.className = "bubble";
- this._statusElement.appendChild(this._bubbleElement);
- }
-
- this._bubbleElement.textContent = x;
- },
-
- _resetBubble: function()
- {
- if (this._bubbleElement) {
- this._bubbleElement.textContent = "";
- this._bubbleElement.removeStyleClass("search-matches");
- this._bubbleElement.removeStyleClass("warning");
- this._bubbleElement.removeStyleClass("error");
- }
- },
-
- searchMatchFound: function(matches)
- {
- this._resetBubble();
-
- this._setBubbleText(matches);
- this._bubbleElement.addStyleClass("search-matches");
-
- // Expand, do not scroll into view.
- var currentAncestor = this.parent;
- while (currentAncestor && !currentAncestor.root) {
- if (!currentAncestor.expanded)
- currentAncestor.expand();
- currentAncestor = currentAncestor.parent;
- }
- },
-
- _errorsWarningsUpdated: function()
- {
- // FIXME: move to the Script/SourceView.
- if (!this._resource.warnings && !this._resource.errors) {
- var view = WebInspector.ResourceManager.existingResourceViewForResource(this._resource);
- if (view && view.clearMessages)
- view.clearMessages();
- }
-
- if (this._storagePanel.currentQuery)
- return;
-
- this._resetBubble();
-
- if (this._resource.warnings || this._resource.errors)
- this._setBubbleText(this._resource.warnings + this._resource.errors);
-
- if (this._resource.warnings)
- this._bubbleElement.addStyleClass("warning");
-
- if (this._resource.errors)
- this._bubbleElement.addStyleClass("error");
- }
-}
-
-WebInspector.FrameResourceTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
-
-WebInspector.DatabaseTreeElement = function(storagePanel, database)
-{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, database.name, "database-storage-tree-item", true);
- this._database = database;
-}
-
-WebInspector.DatabaseTreeElement.prototype = {
- get itemURL()
- {
- return "database://" + encodeURI(this._database.name);
- },
-
- onselect: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
- this._storagePanel.showDatabase(this._database);
- },
-
- oncollapse: function()
- {
- // Request a refresh after every collapse so the next
- // expand will have an updated table list.
- this.shouldRefreshChildren = true;
- },
-
- onpopulate: function()
- {
- this.removeChildren();
-
- function tableNamesCallback(tableNames)
- {
- var tableNamesLength = tableNames.length;
- for (var i = 0; i < tableNamesLength; ++i)
- this.appendChild(new WebInspector.DatabaseTableTreeElement(this._storagePanel, this._database, tableNames[i]));
- }
- this._database.getTableNames(tableNamesCallback.bind(this));
- }
-
-}
-WebInspector.DatabaseTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
-
-WebInspector.DatabaseTableTreeElement = function(storagePanel, database, tableName)
-{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, tableName, "database-storage-tree-item");
- this._database = database;
- this._tableName = tableName;
-}
-
-WebInspector.DatabaseTableTreeElement.prototype = {
- get itemURL()
- {
- return "database://" + encodeURI(this._database.name) + "/" + encodeURI(this._tableName);
- },
-
- onselect: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
- this._storagePanel.showDatabase(this._database, this._tableName);
- }
-}
-WebInspector.DatabaseTableTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
-
-WebInspector.DOMStorageTreeElement = function(storagePanel, domStorage, className)
-{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), "domstorage-storage-tree-item " + className);
- this._domStorage = domStorage;
-}
-
-WebInspector.DOMStorageTreeElement.prototype = {
- get itemURL()
- {
- return "storage://" + this._domStorage.domain + "/" + (this._domStorage.isLocalStorage ? "local" : "session");
- },
-
- onselect: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
- this._storagePanel.showDOMStorage(this._domStorage);
- }
-}
-WebInspector.DOMStorageTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
-
-WebInspector.CookieTreeElement = function(storagePanel, cookieDomain)
-{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, cookieDomain ? cookieDomain : WebInspector.UIString("Local Files"), "cookie-storage-tree-item");
- this._cookieDomain = cookieDomain;
-}
-
-WebInspector.CookieTreeElement.prototype = {
- get itemURL()
- {
- return "cookies://" + this._cookieDomain;
- },
-
- onselect: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
- this._storagePanel.showCookies(this, this._cookieDomain);
- }
-}
-WebInspector.CookieTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
-
-WebInspector.ApplicationCacheTreeElement = function(storagePanel, appcacheDomain)
-{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, appcacheDomain ? appcacheDomain : WebInspector.UIString("Local Files"), "application-cache-storage-tree-item");
- this._appcacheDomain = appcacheDomain;
-}
-
-WebInspector.ApplicationCacheTreeElement.prototype = {
- get itemURL()
- {
- return "appcache://" + this._appcacheDomain;
- },
-
- onselect: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
- this._storagePanel.showApplicationCache(this, this._appcacheDomain);
- }
-}
-WebInspector.ApplicationCacheTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
-
-WebInspector.FileSystemTreeElement = function(storagePanel, origin)
-{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, origin, "file-system-storage-tree-item");
- this._origin = origin;
-}
-
-WebInspector.FileSystemTreeElement.prototype = {
- get itemURL()
- {
- return "file-system://" + encodeURI(this._origin);
- },
-
- onselect: function()
- {
- WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
- this._storagePanel.showFileSystem(this, this._origin);
- }
-}
-
-WebInspector.FileSystemTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
-
-WebInspector.StorageCategoryView = function()
-{
- WebInspector.View.call(this);
-
- this.element.addStyleClass("storage-view");
-
- this._emptyMsgElement = document.createElement("div");
- this._emptyMsgElement.className = "storage-empty-view";
- this.element.appendChild(this._emptyMsgElement);
-}
-
-WebInspector.StorageCategoryView.prototype = {
- setText: function(text)
- {
- this._emptyMsgElement.textContent = text;
- }
-}
-
-WebInspector.StorageCategoryView.prototype.__proto__ = WebInspector.View.prototype;
diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc
index ebdd4f6..2b87bcc 100644
--- a/WebCore/inspector/front-end/WebKit.qrc
+++ b/WebCore/inspector/front-end/WebKit.qrc
@@ -72,6 +72,7 @@
<file>ResourceCategory.js</file>
<file>ResourceManager.js</file>
<file>ResourceView.js</file>
+ <file>ResourcesPanel.js</file>
<file>ScopeChainSidebarPane.js</file>
<file>Script.js</file>
<file>ScriptsPanel.js</file>
@@ -88,7 +89,6 @@
<file>SourceTokenizer.js</file>
<file>SourceView.js</file>
<file>StatusBarButton.js</file>
- <file>StoragePanel.js</file>
<file>StylesSidebarPane.js</file>
<file>SummaryBar.js</file>
<file>TabbedPane.js</file>
@@ -222,7 +222,6 @@
<file>Images/statusbarMenuButtonSelected.png</file>
<file>Images/statusbarResizerHorizontal.png</file>
<file>Images/statusbarResizerVertical.png</file>
- <file>Images/storageIcon.png</file>
<file>Images/successGreenDot.png</file>
<file>Images/thumbActiveHoriz.png</file>
<file>Images/thumbActiveVert.png</file>
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index ad80cfb..ab331d5 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -219,10 +219,6 @@ body.attached #search-results-matches {
background-image: url(Images/timelineIcon.png);
}
-.toolbar-item.storage .toolbar-icon {
- background-image: url(Images/storageIcon.png);
-}
-
.toolbar-item.profiles .toolbar-icon {
background-image: url(Images/profilesIcon.png);
}
@@ -1916,52 +1912,52 @@ body.inactive .sidebar {
bottom: 0;
}
-.storage.panel .sidebar {
+.resources.panel .sidebar {
padding-left: 0;
z-index: 10;
}
-.storage.panel .sidebar li {
+.resources.panel .sidebar li {
height: 17px;
white-space: nowrap;
text-indent: 0;
margin-left: -2px;
}
-.storage.panel .sidebar li.parent {
+.resources.panel .sidebar li.parent {
text-indent: 0;
margin-left: -12px;
}
-.storage.panel .sidebar li.selected {
+.resources.panel .sidebar li.selected {
color: white;
text-shadow: rgba(0, 0, 0, 0.33) 0 1px 0;
font-weight: bold;
}
-.storage.panel .sidebar li.selected .selection {
+.resources.panel .sidebar li.selected .selection {
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
border-top: 1px solid #979797;
height: 17px;
}
-.storage.panel .sidebar :focus li.selected .selection {
+.resources.panel .sidebar :focus li.selected .selection {
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(21, 83, 170)));
border-top: 1px solid rgb(68, 128, 200);
}
-body.inactive .storage.panel .sidebar li.selected .selection {
+body.inactive .resources.panel .sidebar li.selected .selection {
background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(180, 180, 180)), to(rgb(138, 138, 138)));
border-top: 1px solid rgb(151, 151, 151);
}
-.storage.panel .sidebar .icon {
+.resources.panel .sidebar .icon {
width: 16px;
height: 16px;
float: left;
}
-.storage.panel .base-storage-tree-element-title {
+.resources.panel .base-storage-tree-element-title {
overflow: hidden;
position: relative;
text-overflow: ellipsis;
@@ -1979,7 +1975,7 @@ li.selected .base-storage-tree-element-subtitle {
text-shadow: none;
}
-.storage.panel .status {
+.resources.panel .status {
float: right;
height: 16px;
margin-top: 1px;
@@ -1987,7 +1983,7 @@ li.selected .base-storage-tree-element-subtitle {
line-height: 1em;
}
-.storage.panel li .status .bubble {
+.resources.panel li .status .bubble {
height: 13px;
padding-top: 0;
}
diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html
index c681531..e0c72e9 100644
--- a/WebCore/inspector/front-end/inspector.html
+++ b/WebCore/inspector/front-end/inspector.html
@@ -98,7 +98,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<script type="text/javascript" src="NetworkPanel.js"></script>
<script type="text/javascript" src="InjectedFakeWorker.js"></script>
<script type="text/javascript" src="ScriptsPanel.js"></script>
- <script type="text/javascript" src="StoragePanel.js"></script>
+ <script type="text/javascript" src="ResourcesPanel.js"></script>
<script type="text/javascript" src="ProfilesPanel.js"></script>
<script type="text/javascript" src="ConsolePanel.js"></script>
<script type="text/javascript" src="ExtensionAPI.js"></script>
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 8323cad..69019de 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -223,9 +223,8 @@ var WebInspector = {
var hiddenPanels = (InspectorFrontendHost.hiddenPanels() || "").split(',');
if (hiddenPanels.indexOf("elements") === -1)
this.panels.elements = new WebInspector.ElementsPanel();
-
- if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1)
- this.panels.storage = new WebInspector.StoragePanel();
+ if (hiddenPanels.indexOf("resources") === -1)
+ this.panels.resources = new WebInspector.ResourcesPanel();
if (hiddenPanels.indexOf("network") === -1)
this.panels.network = new WebInspector.NetworkPanel();
if (hiddenPanels.indexOf("scripts") === -1)
@@ -546,10 +545,6 @@ WebInspector.doLoadedDone = function()
for (var panelName in this.panels)
previousToolbarItem = WebInspector.addPanelToolbarIcon(toolbarElement, this.panels[panelName], previousToolbarItem);
- // FIXME: fix this once renamed StoragePanel.js to ResourcesPanel.js
- this.panels.storage._toolbarItem.removeStyleClass("storage");
- this.panels.storage._toolbarItem.addStyleClass("resources");
-
this.Tips = {
ResourceNotCompressed: {id: 0, message: WebInspector.UIString("You could save bandwidth by having your web server compress this transfer with gzip or zlib.")}
};
@@ -810,8 +805,8 @@ WebInspector.openResource = function(resourceURL, inResourcesPanel)
{
var resource = WebInspector.resourceForURL(resourceURL);
if (inResourcesPanel && resource) {
- WebInspector.panels.storage.showResource(resource);
- WebInspector.showPanel("storage");
+ WebInspector.panels.resources.showResource(resource);
+ WebInspector.showPanel("resources");
} else
InspectorBackend.openInInspectedWindow(resource ? resource.url : resourceURL);
}
@@ -1206,10 +1201,6 @@ WebInspector.showChanges = function()
WebInspector.showPanel = function(panel)
{
- // FIXME: fix this once renamed StoragePanel.js to ResourcesPanel.js
- if (panel === "resources")
- panel = "storage";
-
if (!(panel in this.panels))
panel = "elements";
this.currentPanel = this.panels[panel];
@@ -1217,8 +1208,8 @@ WebInspector.showPanel = function(panel)
WebInspector.selectDatabase = function(o)
{
- WebInspector.showPanel("storage");
- WebInspector.panels.storage.selectDatabase(o);
+ WebInspector.showPanel("resources");
+ WebInspector.panels.resources.selectDatabase(o);
}
WebInspector.consoleMessagesCleared = function()
@@ -1228,8 +1219,8 @@ WebInspector.consoleMessagesCleared = function()
WebInspector.selectDOMStorage = function(o)
{
- WebInspector.showPanel("storage");
- WebInspector.panels.storage.selectDOMStorage(o);
+ WebInspector.showPanel("resources");
+ WebInspector.panels.resources.selectDOMStorage(o);
}
WebInspector.domContentEventFired = function(time)
@@ -1250,55 +1241,55 @@ WebInspector.loadEventFired = function(time)
WebInspector.addDatabase = function(payload)
{
- if (!this.panels.storage)
+ if (!this.panels.resources)
return;
var database = new WebInspector.Database(
payload.id,
payload.domain,
payload.name,
payload.version);
- this.panels.storage.addDatabase(database);
+ this.panels.resources.addDatabase(database);
}
WebInspector.addDOMStorage = function(payload)
{
- if (!this.panels.storage)
+ if (!this.panels.resources)
return;
var domStorage = new WebInspector.DOMStorage(
payload.id,
payload.host,
payload.isLocalStorage);
- this.panels.storage.addDOMStorage(domStorage);
+ this.panels.resources.addDOMStorage(domStorage);
}
WebInspector.updateDOMStorage = function(storageId)
{
- this.panels.storage.updateDOMStorage(storageId);
+ this.panels.resources.updateDOMStorage(storageId);
}
WebInspector.updateApplicationCacheStatus = function(status)
{
- this.panels.storage.updateApplicationCacheStatus(status);
+ this.panels.resources.updateApplicationCacheStatus(status);
}
WebInspector.didGetFileSystemPath = function(root, type, origin)
{
- this.panels.storage.updateFileSystemPath(root, type, origin);
+ this.panels.resources.updateFileSystemPath(root, type, origin);
}
WebInspector.didGetFileSystemError = function(type, origin)
{
- this.panels.storage.updateFileSystemError(type, origin);
+ this.panels.resources.updateFileSystemError(type, origin);
}
WebInspector.didGetFileSystemDisabled = function()
{
- this.panels.storage.setFileSystemDisabled();
+ this.panels.resources.setFileSystemDisabled();
}
WebInspector.updateNetworkState = function(isNowOnline)
{
- this.panels.storage.updateNetworkState(isNowOnline);
+ this.panels.resources.updateNetworkState(isNowOnline);
}
WebInspector.searchingForNodeWasEnabled = function()
@@ -1612,14 +1603,11 @@ WebInspector.displayNameForURL = function(url)
WebInspector._choosePanelToShowSourceLine = function(url, line, preferredPanel)
{
preferredPanel = preferredPanel || "resources";
- // FIXME: remove this once StoragePanel renamed to ResourcesPanel
- if (preferredPanel === "resources")
- preferredPanel = "storage";
var panel = this.panels[preferredPanel];
if (panel && panel.canShowSourceLine(url, line))
return panel;
- panel = this.panels.storage;
+ panel = this.panels.resources;
return panel.canShowSourceLine(url, line) ? panel : null;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list