diff options
Diffstat (limited to 'WebCore/inspector/front-end/ExtensionServer.js')
-rw-r--r-- | WebCore/inspector/front-end/ExtensionServer.js | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/WebCore/inspector/front-end/ExtensionServer.js b/WebCore/inspector/front-end/ExtensionServer.js index 5e593f7..6ffa33a 100644 --- a/WebCore/inspector/front-end/ExtensionServer.js +++ b/WebCore/inspector/front-end/ExtensionServer.js @@ -42,10 +42,12 @@ WebInspector.ExtensionServer = function() this._registerHandler("getPageTimings", this._onGetPageTimings.bind(this)); this._registerHandler("createPanel", this._onCreatePanel.bind(this)); this._registerHandler("createSidebarPane", this._onCreateSidebar.bind(this)); + this._registerHandler("createWatchExpressionSidebarPane", this._onCreateWatchExpressionSidebarPane.bind(this)); this._registerHandler("log", this._onLog.bind(this)); this._registerHandler("evaluateOnInspectedPage", this._onEvaluateOnInspectedPage.bind(this)); this._registerHandler("setSidebarHeight", this._onSetSidebarHeight.bind(this)); this._registerHandler("setSidebarExpanded", this._onSetSidebarExpansion.bind(this)); + this._registerHandler("setWatchSidebarContent", this._onSetWatchSidebarContent.bind(this)); this._registerHandler("addAuditCategory", this._onAddAuditCategory.bind(this)); this._registerHandler("addAuditResult", this._onAddAuditResult.bind(this)); @@ -90,6 +92,11 @@ WebInspector.ExtensionServer.prototype = { this._postNotification("reset"); }, + notifyExtensionWatchSidebarUpdated: function(id) + { + this._postNotification("watch-sidebar-updated-" + id); + }, + startAuditRun: function(category, auditRun) { this._clientObjects[auditRun.id] = auditRun; @@ -161,7 +168,22 @@ WebInspector.ExtensionServer.prototype = { return this._status.OK(); }, - _onCreateSidebar: function(message, port) + _onCreateSidebar: function(message) + { + var sidebar = this._createSidebar(message, WebInspector.SidebarPane); + if (sidebar.isError) + return sidebar; + this._createClientIframe(sidebar.bodyElement, message.url); + return this._status.OK(); + }, + + _onCreateWatchExpressionSidebarPane: function(message) + { + var sidebar = this._createSidebar(message, WebInspector.ExtensionWatchSidebarPane); + return sidebar.isError ? sidebar : this._status.OK(); + }, + + _createSidebar: function(message, constructor) { var panel = WebInspector.panels[message.panel]; if (!panel) @@ -169,12 +191,12 @@ WebInspector.ExtensionServer.prototype = { if (!panel.sidebarElement || !panel.sidebarPanes) return this._status.E_NOTSUPPORTED(); var id = message.id; - var sidebar = new WebInspector.SidebarPane(message.title); + var sidebar = new constructor(message.title, message.id); this._clientObjects[id] = sidebar; panel.sidebarPanes[id] = sidebar; panel.sidebarElement.appendChild(sidebar.element); - this._createClientIframe(sidebar.bodyElement, message.url); - return this._status.OK(); + + return sidebar; }, _createClientIframe: function(parent, url, requestId, port) @@ -205,6 +227,17 @@ WebInspector.ExtensionServer.prototype = { sidebar.collapse(); }, + _onSetWatchSidebarContent: function(message) + { + var sidebar = this._clientObjects[message.id]; + if (!sidebar) + return this._status.E_NOTFOUND(message.id); + if (message.evaluateOnPage) + sidebar.setExpression(message.expression, message.rootTitle); + else + sidebar.setObject(message.expression, message.rootTitle); + }, + _onLog: function(message) { WebInspector.log(message.message); @@ -243,13 +276,9 @@ WebInspector.ExtensionServer.prototype = { resource = WebInspector.networkResources[id] || WebInspector.resourceForURL(id); if (!resource) return this._status.E_NOTFOUND(typeof id + ": " + id); - if (Preferences.networkPanelEnabled) { - WebInspector.panels.storage.showResource(resource, message.line); - WebInspector.showPanel("storage"); - } else { - WebInspector.panels.resources.showResource(resource, message.line); - WebInspector.showPanel("resources"); - } + + WebInspector.panels.storage.showResource(resource, message.line); + WebInspector.showPanel("storage"); }, _dispatchCallback: function(requestId, port, result) @@ -303,7 +332,7 @@ WebInspector.ExtensionServer.prototype = { if (!resource) response.push(this._status.E_NOTFOUND(id)); else - resource.getContent(onContentAvailable.bind(this, id)); + resource.requestContent(onContentAvailable.bind(this, id)); } if (response.length === ids.length) this._dispatchCallback(message.requestId, port, response); |