Diff
Modified: trunk/Source/WebCore/ChangeLog (126424 => 126425)
--- trunk/Source/WebCore/ChangeLog 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/ChangeLog 2012-08-23 14:59:13 UTC (rev 126425)
@@ -1,3 +1,38 @@
+2012-08-23 Pavel Feldman <pfeld...@chromium.org>
+
+ Web Inspector: register context menu providers for lazily loaded panels.
+ https://bugs.webkit.org/show_bug.cgi?id=94812
+
+ Reviewed by Alexander Pavlov.
+
+ - Panel descriptors now register providers that lazily load panels on demand.
+ - Removed custom profiles context provider infrastructure in favor of generic one.
+
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * inspector/compile-front-end.py:
+ * inspector/front-end/NetworkPanel.js:
+ (WebInspector.NetworkPanel):
+ * inspector/front-end/NetworkPanelDescriptor.js: Added.
+ (WebInspector.NetworkPanelDescriptor):
+ (WebInspector.NetworkPanelDescriptor.prototype.appendApplicableItems):
+ * inspector/front-end/ObjectPropertiesSection.js:
+ (WebInspector.ObjectPropertiesSection.prototype._contextMenuEventFired):
+ * inspector/front-end/ProfilesPanel.js:
+ (WebInspector.ProfilesPanel):
+ (WebInspector.ProfilesPanel.prototype._reportHeapSnapshotProgress):
+ (WebInspector.ProfilesPanel.prototype.appendApplicableItems.didReceiveHeapObjectId):
+ (WebInspector.ProfilesPanel.prototype.appendApplicableItems):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel):
+ * inspector/front-end/ScriptsPanelDescriptor.js: Added.
+ (WebInspector.ScriptsPanelDescriptor):
+ (WebInspector.ScriptsPanelDescriptor.prototype.appendApplicableItems):
+ * inspector/front-end/WebKit.qrc:
+ * inspector/front-end/inspector.html:
+ * inspector/front-end/inspector.js:
+ (WebInspector._panelDescriptors):
+
2012-08-23 Carlos Garcia Campos <cgar...@igalia.com>
Unreviewed. Fix make distcheck.
Modified: trunk/Source/WebCore/WebCore.gypi (126424 => 126425)
--- trunk/Source/WebCore/WebCore.gypi 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/WebCore.gypi 2012-08-23 14:59:13 UTC (rev 126425)
@@ -6340,6 +6340,7 @@
'inspector/front-end/NativeBreakpointsSidebarPane.js',
'inspector/front-end/NetworkManager.js',
'inspector/front-end/NetworkLog.js',
+ 'inspector/front-end/NetworkPanelDescriptor.js',
'inspector/front-end/NetworkRequest.js',
'inspector/front-end/Object.js',
'inspector/front-end/ObjectPopoverHelper.js',
@@ -6363,6 +6364,7 @@
'inspector/front-end/ScriptFormatter.js',
'inspector/front-end/ScriptFormatterWorker.js',
'inspector/front-end/ScriptSnippetModel.js',
+ 'inspector/front-end/ScriptsPanelDescriptor.js',
'inspector/front-end/SearchController.js',
'inspector/front-end/ShortcutsScreen.js',
'inspector/front-end/SettingsScreen.js',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (126424 => 126425)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-08-23 14:59:13 UTC (rev 126425)
@@ -76166,6 +76166,10 @@
>
</File>
<File
+ RelativePath="..\inspector\front-end\NetworkPanelDescriptor.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\NetworkRequest.js"
>
</File>
@@ -76362,6 +76366,10 @@
>
</File>
<File
+ RelativePath="..\inspector\front-end\ScriptsPanelDescriptor.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\ScriptsSearchScope.js"
>
</File>
Modified: trunk/Source/WebCore/inspector/compile-front-end.py (126424 => 126425)
--- trunk/Source/WebCore/inspector/compile-front-end.py 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/inspector/compile-front-end.py 2012-08-23 14:59:13 UTC (rev 126425)
@@ -197,6 +197,7 @@
"ResourceView.js",
"ResourceWebSocketFrameView.js",
"NetworkPanel.js",
+ "NetworkPanelDescriptor.js",
]
},
{
@@ -229,6 +230,7 @@
"ScopeChainSidebarPane.js",
"ScriptsNavigator.js",
"ScriptsPanel.js",
+ "ScriptsPanelDescriptor.js",
"ScriptsSearchScope.js",
"SnippetJavaScriptSourceFrame.js",
"StyleSheetOutlineDialog.js",
Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (126424 => 126425)
--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2012-08-23 14:59:13 UTC (rev 126425)
@@ -1308,7 +1308,6 @@
return this.visibleView;
}
WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
- WebInspector.ContextMenu.registerProvider(this);
}
WebInspector.NetworkPanel.prototype = {
Added: trunk/Source/WebCore/inspector/front-end/NetworkPanelDescriptor.js (0 => 126425)
--- trunk/Source/WebCore/inspector/front-end/NetworkPanelDescriptor.js (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanelDescriptor.js 2012-08-23 14:59:13 UTC (rev 126425)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/**
+ * @constructor
+ * @extends {WebInspector.PanelDescriptor}
+ * @implements {WebInspector.ContextMenu.Provider}
+ */
+WebInspector.NetworkPanelDescriptor = function()
+{
+ WebInspector.PanelDescriptor.call(this, "network", WebInspector.UIString("Network"), "NetworkPanel", "NetworkPanel.js");
+ WebInspector.ContextMenu.registerProvider(this);
+}
+
+WebInspector.NetworkPanelDescriptor.prototype = {
+ /**
+ * @param {WebInspector.ContextMenu} contextMenu
+ * @param {Object} target
+ */
+ appendApplicableItems: function(contextMenu, target)
+ {
+ if (!(target instanceof WebInspector.NetworkRequest))
+ return;
+ this.panel().appendApplicableItems(contextMenu, target);
+ }
+}
+
+WebInspector.NetworkPanelDescriptor.prototype.__proto__ = WebInspector.PanelDescriptor.prototype;
Property changes on: trunk/Source/WebCore/inspector/front-end/NetworkPanelDescriptor.js
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js (126424 => 126425)
--- trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js 2012-08-23 14:59:13 UTC (rev 126425)
@@ -27,7 +27,7 @@
/**
* @constructor
* @extends {WebInspector.PropertiesSection}
- * @param {WebInspector.RemoteObject=} object
+ * @param {WebInspector.RemoteObject} object
* @param {string|Element=} title
* @param {string=} subtitle
* @param {string=} emptyPlaceholder
@@ -50,38 +50,6 @@
WebInspector.ObjectPropertiesSection._arrayLoadThreshold = 100;
-
-/**
- * @interface
- */
-WebInspector.ObjectPropertiesSection.ContextMenuProvider = function()
-{
-}
-
-WebInspector.ObjectPropertiesSection.ContextMenuProvider.prototype = {
- /**
- * @param {WebInspector.ObjectPropertiesSection} section
- * @param {WebInspector.ContextMenu} contextMenu
- */
- populateContextMenu: function(section, contextMenu)
- {
- }
-}
-
-
-/**
- * @type {Array.<WebInspector.ObjectPropertiesSection.ContextMenuProvider>}
- */
-WebInspector.ObjectPropertiesSection._contextMenuProviers = [];
-
-/**
- * @param {WebInspector.ObjectPropertiesSection.ContextMenuProvider} provider
- */
-WebInspector.ObjectPropertiesSection.addContextMenuProvider = function(provider)
-{
- WebInspector.ObjectPropertiesSection._contextMenuProviers.push(provider);
-}
-
WebInspector.ObjectPropertiesSection.prototype = {
enableContextMenu: function()
{
@@ -91,9 +59,7 @@
_contextMenuEventFired: function(event)
{
var contextMenu = new WebInspector.ContextMenu();
- var providers = WebInspector.ObjectPropertiesSection._contextMenuProviers;
- for (var i = 0; i < providers.length; i++)
- providers[i].populateContextMenu(this, contextMenu);
+ contextMenu.appendApplicableItems(this.object);
if (!contextMenu.isEmpty())
contextMenu.show(event);
},
Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (126424 => 126425)
--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2012-08-23 14:59:13 UTC (rev 126425)
@@ -183,6 +183,7 @@
/**
* @constructor
* @extends {WebInspector.Panel}
+ * @implements {WebInspector.ContextMenu.Provider}
*/
WebInspector.ProfilesPanel = function()
{
@@ -253,7 +254,7 @@
this._createFileSelectorElement();
this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
- WebInspector.ObjectPropertiesSection.addContextMenuProvider(new WebInspector.RevealInHeapSnapshotContextMenuProvider());
+ WebInspector.ContextMenu.registerProvider(this);
}
WebInspector.ProfilesPanel.prototype = {
@@ -1074,36 +1075,23 @@
if (done >= total)
this._removeTemporaryProfile(WebInspector.HeapSnapshotProfileType.TypeId);
}
- }
-}
+ },
-WebInspector.ProfilesPanel.prototype.__proto__ = WebInspector.Panel.prototype;
-
-
-/**
- * @implements {WebInspector.ObjectPropertiesSection.ContextMenuProvider}
- * @constructor
- */
-WebInspector.RevealInHeapSnapshotContextMenuProvider = function()
-{
-}
-
-WebInspector.RevealInHeapSnapshotContextMenuProvider.prototype = {
- /**
- * @override
- * @param {WebInspector.ObjectPropertiesSection} section
+ /**
* @param {WebInspector.ContextMenu} contextMenu
+ * @param {Object} target
*/
- populateContextMenu: function(section, contextMenu)
+ appendApplicableItems: function(contextMenu, target)
{
- if (WebInspector.inspectorView.currentPanel() !== WebInspector.ProfilesPanel._instance)
+ if (WebInspector.inspectorView.currentPanel() !== this)
return;
- var objectId = section.object.objectId;
+ var object = /** @type {WebInspector.RemoteObject} */ target;
+ var objectId = object.objectId;
if (!objectId)
return;
- var heapProfiles = WebInspector.ProfilesPanel._instance.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId);
+ var heapProfiles = this.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId);
if (!heapProfiles.length)
return;
@@ -1114,10 +1102,10 @@
function didReceiveHeapObjectId(viewName, error, result)
{
- if (WebInspector.inspectorView.currentPanel() !== WebInspector.ProfilesPanel._instance)
+ if (WebInspector.inspectorView.currentPanel() !== this)
return;
if (!error)
- WebInspector.ProfilesPanel._instance.showObject(result, viewName);
+ this.showObject(result, viewName);
}
contextMenu.appendItem(WebInspector.UIString("Reveal in Dominators View"), revealInView.bind(this, "Dominators"));
@@ -1125,6 +1113,7 @@
}
}
+WebInspector.ProfilesPanel.prototype.__proto__ = WebInspector.Panel.prototype;
/**
* @constructor
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (126424 => 126425)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-08-23 14:59:13 UTC (rev 126425)
@@ -199,7 +199,6 @@
this._workspace.addEventListener(WebInspector.Workspace.Events.WorkspaceReset, this._reset.bind(this), this);
WebInspector.advancedSearchController.registerSearchScope(new WebInspector.ScriptsSearchScope(this._workspace));
- WebInspector.ContextMenu.registerProvider(this);
}
WebInspector.ScriptsPanel.prototype = {
Added: trunk/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js (0 => 126425)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js 2012-08-23 14:59:13 UTC (rev 126425)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @constructor
+ * @extends {WebInspector.PanelDescriptor}
+ * @implements {WebInspector.ContextMenu.Provider}
+ */
+WebInspector.ScriptsPanelDescriptor = function()
+{
+ WebInspector.PanelDescriptor.call(this, "scripts", WebInspector.UIString("Sources"), "ScriptsPanel", "ScriptsPanel.js");
+ WebInspector.ContextMenu.registerProvider(this);
+}
+
+WebInspector.ScriptsPanelDescriptor.prototype = {
+ /**
+ * @param {WebInspector.ContextMenu} contextMenu
+ * @param {Object} target
+ */
+ appendApplicableItems: function(contextMenu, target)
+ {
+ if (!(target instanceof WebInspector.UISourceCode))
+ return;
+ this.panel().appendApplicableItems(contextMenu, target);
+ }
+}
+
+WebInspector.ScriptsPanelDescriptor.prototype.__proto__ = WebInspector.PanelDescriptor.prototype;
Property changes on: trunk/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js (126424 => 126425)
--- trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js 2012-08-23 14:59:13 UTC (rev 126425)
@@ -123,7 +123,7 @@
{
this._watchObjectGroupId = "watch-group";
- WebInspector.ObjectPropertiesSection.call(this);
+ WebInspector.ObjectPropertiesSection.call(this, WebInspector.RemoteObject.fromPrimitiveValue(""));
this.emptyElement = document.createElement("div");
this.emptyElement.className = "info";
Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (126424 => 126425)
--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2012-08-23 14:59:13 UTC (rev 126425)
@@ -110,6 +110,7 @@
<file>NetworkLog.js</file>
<file>NetworkManager.js</file>
<file>NetworkPanel.js</file>
+ <file>NetworkPanelDescriptor.js</file>
<file>NetworkRequest.js</file>
<file>Object.js</file>
<file>ObjectPopoverHelper.js</file>
@@ -151,6 +152,7 @@
<file>ScriptFormatterWorker.js</file>
<file>ScriptSnippetModel.js</file>
<file>ScriptsPanel.js</file>
+ <file>ScriptsPanelDescriptor.js</file>
<file>ScriptsNavigator.js</file>
<file>ScriptsSearchScope.js</file>
<file>SearchController.js</file>
Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (126424 => 126425)
--- trunk/Source/WebCore/inspector/front-end/inspector.html 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html 2012-08-23 14:59:13 UTC (rev 126425)
@@ -158,6 +158,8 @@
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""
+ <script type="text/_javascript_" src=""
+ <script type="text/_javascript_" src=""
</head>
<body class="detached" id="-webkit-web-inspector">
<div id="toolbar">
Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (126424 => 126425)
--- trunk/Source/WebCore/inspector/front-end/inspector.js 2012-08-23 14:55:28 UTC (rev 126424)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js 2012-08-23 14:59:13 UTC (rev 126425)
@@ -39,8 +39,8 @@
var elements = new WebInspector.PanelDescriptor("elements", WebInspector.UIString("Elements"), "ElementsPanel", "ElementsPanel.js");
var resources = new WebInspector.PanelDescriptor("resources", WebInspector.UIString("Resources"), "ResourcesPanel", "ResourcesPanel.js");
- var network = new WebInspector.PanelDescriptor("network", WebInspector.UIString("Network"), "NetworkPanel", "NetworkPanel.js");
- var scripts = new WebInspector.PanelDescriptor("scripts", WebInspector.UIString("Sources"), "ScriptsPanel", "ScriptsPanel.js");
+ var network = new WebInspector.NetworkPanelDescriptor();
+ var scripts = new WebInspector.ScriptsPanelDescriptor();
var timeline = new WebInspector.PanelDescriptor("timeline", WebInspector.UIString("Timeline"), "TimelinePanel", "TimelinePanel.js");
var profiles = new WebInspector.PanelDescriptor("profiles", WebInspector.UIString("Profiles"), "ProfilesPanel", "ProfilesPanel.js");
var audits = new WebInspector.PanelDescriptor("audits", WebInspector.UIString("Audits"), "AuditsPanel", "AuditsPanel.js");