author | Alexandre Poirot <poirot.alex@gmail.com> |
Wed, 12 Nov 2014 04:57:00 +0100 | |
changeset 240436 | 8a40ada1dc8b8b7e916b0e955af0dd96713270e3 |
parent 240435 | 469adc9556c0711a518c7a6e0d9e36554e629870 |
child 240437 | dabf47d7f72053f7b9ad005522ccae8f6d186468 |
push id | 4311 |
push user | raliiev@mozilla.com |
push date | Mon, 12 Jan 2015 19:37:41 +0000 |
treeherder | mozilla-beta@150c9fed433b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jryans |
bugs | 1094203 |
milestone | 36.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/devtools/debugger/debugger-controller.js +++ b/browser/devtools/debugger/debugger-controller.js @@ -193,24 +193,24 @@ let DebuggerController = { * A promise that is resolved when the debugger finishes connecting. */ connect: Task.async(function*() { if (this._connected) { return; } let target = this._target; - let { client, form: { chromeDebugger, traceActor, addonActor } } = target; + let { client, form: { chromeDebugger, traceActor, actor } } = target; target.on("close", this._onTabDetached); target.on("navigate", this._onTabNavigated); target.on("will-navigate", this._onTabNavigated); this.client = client; - if (addonActor) { - yield this._startAddonDebugging(addonActor); + if (target.isAddon) { + yield this._startAddonDebugging(actor); } else if (target.chrome) { yield this._startChromeDebugging(chromeDebugger); } else { yield this._startDebuggingTab(); if (Prefs.tracerEnabled && traceActor) { yield this._startTracingTab(traceActor); }
--- a/browser/devtools/debugger/test/head.js +++ b/browser/devtools/debugger/test/head.js @@ -562,21 +562,17 @@ AddonDebugger.prototype = { let connected = promise.defer(); this.client.connect(connected.resolve); yield connected.promise; let addonActor = yield getAddonActorForUrl(this.client, aUrl); let targetOptions = { - form: { - addonActor: addonActor.actor, - consoleActor: addonActor.consoleActor, - title: addonActor.name - }, + form: addonActor, client: this.client, chrome: true }; let toolboxOptions = { customIframe: this.frame };
--- a/browser/devtools/framework/connect/connect.js +++ b/browser/devtools/framework/connect/connect.js @@ -149,17 +149,17 @@ let onConnectionReady = Task.async(funct }); /** * Build one button for an add-on actor. */ function buildAddonLink(addon, parent) { let a = document.createElement("a"); a.onclick = function() { - openToolbox({ addonActor: addon.actor, title: addon.name }, true, "jsdebugger"); + openToolbox(addon, true, "jsdebugger"); } a.textContent = addon.name; a.title = addon.id; a.href = "#"; parent.appendChild(a); }
--- a/browser/devtools/framework/target.js +++ b/browser/devtools/framework/target.js @@ -275,16 +275,23 @@ TabTarget.prototype = { * * @param {String} traitName * @return {Mixed} */ getTrait: function (traitName) { if (!this.client) { throw new Error("TabTarget#getTrait() can only be called on remote tabs."); } + + // If the targeted actor exposes traits and has a defined value for this traits, + // override the root actor traits + if (this.form.traits && traitName in this.form.traits) { + return this.form.traits[traitName]; + } + return this.client.traits[traitName]; }, get version() { return getVersion(); }, get tab() { return this._tab; }, @@ -318,32 +325,37 @@ TabTarget.prototype = { // during shutdown. if (this._tab && this._tab.linkedBrowser) { return this._tab.linkedBrowser.contentWindow; } return null; }, get name() { - return this._tab && this._tab.linkedBrowser.contentDocument ? - this._tab.linkedBrowser.contentDocument.title : - this._form.title; + if (this._tab && this._tab.linkedBrowser.contentDocument) { + return this._tab.linkedBrowser.contentDocument.title + } else if (this.isAddon) { + return this._form.name; + } else { + return this._form.title; + } }, get url() { return this._tab ? this._tab.linkedBrowser.currentURI.spec : this._form.url; }, get isRemote() { return !this.isLocalTab; }, get isAddon() { - return !!(this._form && this._form.addonActor); + return !!(this._form && this._form.actor && + this._form.actor.match(/conn\d+\.addon\d+/)); }, get isLocalTab() { return !!this._tab; }, get isMultiProcess() { return !this.window;
--- a/browser/devtools/framework/toolbox-process-window.js +++ b/browser/devtools/framework/toolbox-process-window.js @@ -32,21 +32,17 @@ function connect() { ); gClient = new DebuggerClient(transport); gClient.connect(() => { let addonID = getParameterByName("addonID"); if (addonID) { gClient.listAddons(({addons}) => { let addonActor = addons.filter(addon => addon.id === addonID).pop(); - openToolbox({ - addonActor: addonActor.actor, - consoleActor: addonActor.consoleActor, - title: addonActor.name - }); + openToolbox(addonActor); }); } else { gClient.listTabs(openToolbox); } }); } // Certain options should be toggled since we can assume chrome debugging here
--- a/browser/devtools/framework/toolbox.js +++ b/browser/devtools/framework/toolbox.js @@ -48,21 +48,22 @@ loader.lazyGetter(this, "toolboxStrings" loader.lazyGetter(this, "Selection", () => require("devtools/framework/selection").Selection); loader.lazyGetter(this, "InspectorFront", () => require("devtools/server/actors/inspector").InspectorFront); // White-list buttons that can be toggled to prevent adding prefs for // addons that have manually inserted toolbarbuttons into DOM. // (By default, supported target is only local tab) const ToolboxButtons = [ { id: "command-button-pick", - isTargetSupported: target => !target.isAddon }, + isTargetSupported: target => + target.getTrait("highlightable") + }, { id: "command-button-frames", - isTargetSupported: target => ( - !target.isAddon && target.activeTab && target.activeTab.traits.frames - ) + isTargetSupported: target => + ( target.activeTab && target.activeTab.traits.frames ) }, { id: "command-button-splitconsole", isTargetSupported: target => !target.isAddon }, { id: "command-button-responsive" }, { id: "command-button-paintflashing" }, { id: "command-button-tilt" }, { id: "command-button-scratchpad" }, { id: "command-button-eyedropper" }, @@ -1244,22 +1245,25 @@ Toolbox.prototype = { let toolDef = gDevTools.getToolDefinition(this.currentToolId); if (toolDef) { toolName = toolDef.label; } else { // no tool is selected toolName = toolboxStrings("toolbox.defaultTitle"); } let title = toolboxStrings("toolbox.titleTemplate", - toolName, this.target.url || this.target.name); + toolName, + this.target.isAddon ? + this.target.name : + this.target.url || this.target.name); this._host.setTitle(title); }, _listFrames: function (event) { - if (!this._target.form || !this._target.form.actor) { + if (!this._target.activeTab || !this._target.activeTab.traits.frames) { // We are not targetting a regular TabActor // it can be either an addon or browser toolbox actor return promise.resolve(); } let packet = { to: this._target.form.actor, type: "listFrames" };
--- a/browser/devtools/main.js +++ b/browser/devtools/main.js @@ -112,17 +112,17 @@ Tools.inspector = { ], preventClosingOnKey: true, onkey: function(panel) { panel.toolbox.highlighterUtils.togglePicker(); }, isTargetSupported: function(target) { - return !target.isAddon && target.hasActor("inspector"); + return target.hasActor("inspector"); }, build: function(iframeWindow, toolbox) { return new InspectorPanel(iframeWindow, toolbox); } }; Tools.webConsole = { @@ -194,18 +194,17 @@ Tools.styleEditor = { url: "chrome://browser/content/devtools/styleeditor.xul", label: l10n("ToolboxStyleEditor.label", styleEditorStrings), panelLabel: l10n("ToolboxStyleEditor.panelLabel", styleEditorStrings), tooltip: l10n("ToolboxStyleEditor.tooltip2", styleEditorStrings), inMenu: true, commands: "devtools/styleeditor/styleeditor-commands", isTargetSupported: function(target) { - return !target.isAddon && - (target.hasActor("styleEditor") || target.hasActor("styleSheets")); + return target.hasActor("styleEditor") || target.hasActor("styleSheets"); }, build: function(iframeWindow, toolbox) { return new StyleEditorPanel(iframeWindow, toolbox); } }; Tools.shaderEditor = { @@ -215,17 +214,17 @@ Tools.shaderEditor = { icon: "chrome://browser/skin/devtools/tool-styleeditor.svg", invertIconForLightTheme: true, url: "chrome://browser/content/devtools/shadereditor.xul", label: l10n("ToolboxShaderEditor.label", shaderEditorStrings), panelLabel: l10n("ToolboxShaderEditor.panelLabel", shaderEditorStrings), tooltip: l10n("ToolboxShaderEditor.tooltip", shaderEditorStrings), isTargetSupported: function(target) { - return !target.isAddon; + return target.hasActor("webgl"); }, build: function(iframeWindow, toolbox) { return new ShaderEditorPanel(iframeWindow, toolbox); } }; Tools.canvasDebugger = { @@ -237,17 +236,17 @@ Tools.canvasDebugger = { url: "chrome://browser/content/devtools/canvasdebugger.xul", label: l10n("ToolboxCanvasDebugger.label", canvasDebuggerStrings), panelLabel: l10n("ToolboxCanvasDebugger.panelLabel", canvasDebuggerStrings), tooltip: l10n("ToolboxCanvasDebugger.tooltip", canvasDebuggerStrings), // Hide the Canvas Debugger in the Add-on Debugger and Browser Toolbox // (bug 1047520). isTargetSupported: function(target) { - return !target.isAddon && !target.chrome; + return target.hasActor("canvas") && !target.chrome; }, build: function (iframeWindow, toolbox) { return new CanvasDebuggerPanel(iframeWindow, toolbox); } }; Tools.jsprofiler = { @@ -263,17 +262,17 @@ Tools.jsprofiler = { label: l10n("profiler.label2", profilerStrings), panelLabel: l10n("profiler.panelLabel2", profilerStrings), tooltip: l10n("profiler.tooltip2", profilerStrings), inMenu: true, isTargetSupported: function (target) { // Hide the profiler when debugging devices pre bug 1046394, // that don't expose profiler actor in content processes. - return !target.isAddon && target.hasActor("profiler"); + return target.hasActor("profiler"); }, build: function (frame, target) { return new ProfilerPanel(frame, target); } }; Tools.performance = { @@ -287,17 +286,17 @@ Tools.performance = { panelLabel: "Performance++", //l10n("profiler.panelLabel2", profilerStrings), tooltip: l10n("profiler.tooltip2", profilerStrings), accesskey: l10n("profiler.accesskey", profilerStrings), key: l10n("profiler.commandkey2", profilerStrings), modifiers: "shift", inMenu: true, isTargetSupported: function (target) { - return !target.isAddon && target.hasActor("profiler"); + return target.hasActor("profiler"); }, build: function (frame, target) { return new PerformancePanel(frame, target); } }; Tools.timeline = { @@ -307,17 +306,17 @@ Tools.timeline = { icon: "chrome://browser/skin/devtools/tool-network.svg", invertIconForLightTheme: true, url: "chrome://browser/content/devtools/timeline/timeline.xul", label: l10n("timeline.label", timelineStrings), panelLabel: l10n("timeline.panelLabel", timelineStrings), tooltip: l10n("timeline.tooltip", timelineStrings), isTargetSupported: function(target) { - return !target.isAddon && target.hasActor("timeline"); + return target.hasActor("timeline"); }, build: function (iframeWindow, toolbox) { let panel = new TimelinePanel(iframeWindow, toolbox); return panel.open(); } }; @@ -332,17 +331,17 @@ Tools.netMonitor = { invertIconForLightTheme: true, url: "chrome://browser/content/devtools/netmonitor.xul", label: l10n("netmonitor.label", netMonitorStrings), panelLabel: l10n("netmonitor.panelLabel", netMonitorStrings), tooltip: l10n("netmonitor.tooltip", netMonitorStrings), inMenu: true, isTargetSupported: function(target) { - return !target.isAddon && target.getTrait("networkMonitor"); + return target.getTrait("networkMonitor"); }, build: function(iframeWindow, toolbox) { return new NetMonitorPanel(iframeWindow, toolbox); } }; Tools.storage = { @@ -358,17 +357,18 @@ Tools.storage = { label: l10n("storage.label", storageStrings), menuLabel: l10n("storage.menuLabel", storageStrings), panelLabel: l10n("storage.panelLabel", storageStrings), tooltip: l10n("storage.tooltip2", storageStrings), inMenu: true, isTargetSupported: function(target) { return target.isLocalTab || - (target.client.traits.storageInspector && !target.isAddon); + ( target.hasActor("storage") && + target.getTrait("storageInspector") ); }, build: function(iframeWindow, toolbox) { return new StoragePanel(iframeWindow, toolbox); } }; Tools.webAudioEditor = { @@ -378,17 +378,17 @@ Tools.webAudioEditor = { icon: "chrome://browser/skin/devtools/tool-webaudio.svg", invertIconForLightTheme: true, url: "chrome://browser/content/devtools/webaudioeditor.xul", label: l10n("ToolboxWebAudioEditor1.label", webAudioEditorStrings), panelLabel: l10n("ToolboxWebAudioEditor1.panelLabel", webAudioEditorStrings), tooltip: l10n("ToolboxWebAudioEditor1.tooltip", webAudioEditorStrings), isTargetSupported: function(target) { - return !target.isAddon && !target.chrome && target.hasActor("webaudio"); + return !target.chrome && target.hasActor("webaudio"); }, build: function(iframeWindow, toolbox) { return new WebAudioEditorPanel(iframeWindow, toolbox); } }; Tools.scratchpad = {
--- a/toolkit/devtools/server/actors/webbrowser.js +++ b/toolkit/devtools/server/actors/webbrowser.js @@ -1796,16 +1796,21 @@ BrowserAddonActor.prototype = { return { actor: this.actorID, id: this.id, name: this._addon.name, url: this.url, debuggable: this._addon.isDebuggable, consoleActor: this._consoleActor.actorID, + + traits: { + highlightable: false, + networkMonitor: false, + }, }; }, disconnect: function BAA_disconnect() { this.conn.removeActorPool(this._contextPool); this._contextPool = null; this._consoleActor = null; this._addon = null;