diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2016-10-07 15:52:09 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2016-10-07 15:52:09 +0200 |
commit | f1d8b387aa13d49923798fb391b1abc9b5b3fb6e (patch) | |
tree | 34a08eb6ff0b04b013a4c226a93dcc62dd84f543 /browser/devtools/framework | |
parent | 9575777eddc6c10f5121873a9211efb294d40bb2 (diff) | |
download | palemoon-gre-f1d8b387aa13d49923798fb391b1abc9b5b3fb6e.tar.gz |
DevTools - some fixes
Diffstat (limited to 'browser/devtools/framework')
-rw-r--r-- | browser/devtools/framework/gDevTools.jsm | 30 | ||||
-rw-r--r-- | browser/devtools/framework/toolbox-options.js | 2 | ||||
-rw-r--r-- | browser/devtools/framework/toolbox.js | 120 |
3 files changed, 121 insertions, 31 deletions
diff --git a/browser/devtools/framework/gDevTools.jsm b/browser/devtools/framework/gDevTools.jsm index 0f637378e..d369a0e5d 100644 --- a/browser/devtools/framework/gDevTools.jsm +++ b/browser/devtools/framework/gDevTools.jsm @@ -589,19 +589,12 @@ let gDevToolsBrowser = { let appMgrEnabled = Services.prefs.getBoolPref("devtools.appmanager.enabled"); toggleCmd("Tools:DevAppMgr", !webIDEEnabled && appMgrEnabled); - // Enable Browser Toolbox? - let chromeEnabled = Services.prefs.getBoolPref("devtools.chrome.enabled"); - let devtoolsRemoteEnabled = Services.prefs.getBoolPref("devtools.debugger.remote-enabled"); - let remoteEnabled = chromeEnabled && devtoolsRemoteEnabled && - Services.prefs.getBoolPref("devtools.debugger.chrome-enabled"); - toggleCmd("Tools:BrowserToolbox", remoteEnabled); - toggleCmd("Tools:BrowserContentToolbox", remoteEnabled && win.gMultiProcessBrowser); - // Enable Error Console? let consoleEnabled = Services.prefs.getBoolPref("devtools.errorconsole.enabled"); toggleCmd("Tools:ErrorConsole", consoleEnabled); // Enable DevTools connection screen, if the preference allows this. + let devtoolsRemoteEnabled = Services.prefs.getBoolPref("devtools.debugger.remote-enabled"); toggleCmd("Tools:DevToolsConnect", devtoolsRemoteEnabled); }, @@ -737,15 +730,6 @@ let gDevToolsBrowser = { return deferred.promise; }, - openContentProcessToolbox: function () { - this._getContentProcessTarget() - .then(target => { - // Display a new toolbox, in a new window, with debugger by default - return gDevTools.showToolbox(target, "jsdebugger", - devtools.Toolbox.HostType.WINDOW); - }); - }, - /** * Install WebIDE widget */ @@ -1181,16 +1165,6 @@ let gDevToolsBrowser = { }, /** - * Connects to the SPS profiler when the developer tools are open. This is - * necessary because of the WebConsole's `profile` and `profileEnd` methods. - */ - _connectToProfiler: function DT_connectToProfiler(event, toolbox) { - let SharedProfilerUtils = devtools.require("devtools/profiler/shared"); - let connection = SharedProfilerUtils.getProfilerConnection(toolbox); - connection.open(); - }, - - /** * Remove the menuitem for a tool to all open browser windows. * * @param {string} toolId @@ -1267,7 +1241,6 @@ let gDevToolsBrowser = { * All browser windows have been closed, tidy up remaining objects. */ destroy: function() { - gDevTools.off("toolbox-ready", gDevToolsBrowser._connectToProfiler); Services.prefs.removeObserver("devtools.", gDevToolsBrowser); Services.obs.removeObserver(gDevToolsBrowser.destroy, "quit-application"); }, @@ -1288,7 +1261,6 @@ gDevTools.on("tool-unregistered", function(ev, toolId) { }); gDevTools.on("toolbox-ready", gDevToolsBrowser._updateMenuCheckbox); -gDevTools.on("toolbox-ready", gDevToolsBrowser._connectToProfiler); gDevTools.on("toolbox-destroyed", gDevToolsBrowser._updateMenuCheckbox); Services.obs.addObserver(gDevToolsBrowser.destroy, "quit-application", false); diff --git a/browser/devtools/framework/toolbox-options.js b/browser/devtools/framework/toolbox-options.js index 88de29513..22a4a22f1 100644 --- a/browser/devtools/framework/toolbox-options.js +++ b/browser/devtools/framework/toolbox-options.js @@ -423,7 +423,7 @@ OptionsPanel.prototype = { */ _isDevEditionThemeOn: function() { let win = Services.wm.getMostRecentWindow("navigator:browser"); - return !!(win && win.DevEdition.styleSheet); + return !!(win && win.DevEdition && win.DevEdition.styleSheet); }, /** diff --git a/browser/devtools/framework/toolbox.js b/browser/devtools/framework/toolbox.js index 374240a44..bbb5db646 100644 --- a/browser/devtools/framework/toolbox.js +++ b/browser/devtools/framework/toolbox.js @@ -48,6 +48,7 @@ loader.lazyGetter(this, "toolboxStrings", () => { loader.lazyGetter(this, "Selection", () => require("devtools/framework/selection").Selection); loader.lazyGetter(this, "InspectorFront", () => require("devtools/server/actors/inspector").InspectorFront); loader.lazyRequireGetter(this, "DevToolsUtils", "devtools/toolkit/DevToolsUtils"); +loader.lazyRequireGetter(this, "getPerformanceActorsConnection", "devtools/performance/front", true); // White-list buttons that can be toggled to prevent adding prefs for // addons that have manually inserted toolbarbuttons into DOM. @@ -293,6 +294,85 @@ Toolbox.prototype = { /** * Open the toolbox */ +// TODO +// https://hg.mozilla.org/mozilla-central/diff/963ca422f7c5/browser/devtools/framework/toolbox.js +/* + open: function () { + return Task.spawn(function*() { + let iframe = yield this._host.create(); + let domReady = promise.defer(); + + // Load the toolbox-level actor fronts and utilities now + yield this._target.makeRemote(); + iframe.setAttribute("src", this._URL); + iframe.setAttribute("aria-label", toolboxStrings("toolbox.label")); + let domHelper = new DOMHelpers(iframe.contentWindow); + domHelper.onceDOMReady(() => domReady.resolve()); + + yield domReady.promise; + + this.isReady = true; + let framesPromise = this._listFrames(); + + this.closeButton = this.doc.getElementById("toolbox-close"); + this.closeButton.addEventListener("command", this.destroy, true); + + gDevTools.on("pref-changed", this._prefChanged); + + let framesMenu = this.doc.getElementById("command-button-frames"); + framesMenu.addEventListener("command", this.selectFrame, true); + + this._buildDockButtons(); + this._buildOptions(); + this._buildTabs(); + this._applyCacheSettings(); + this._applyServiceWorkersTestingSettings(); + this._addKeysToWindow(); + this._addReloadKeys(); + this._addHostListeners(); + if (this._hostOptions && this._hostOptions.zoom === false) { + this._disableZoomKeys(); + } else { + this._addZoomKeys(); + this._loadInitialZoom(); + } + + this.webconsolePanel = this.doc.querySelector("#toolbox-panel-webconsole"); + this.webconsolePanel.height = Services.prefs.getIntPref(SPLITCONSOLE_HEIGHT_PREF); + this.webconsolePanel.addEventListener("resize", this._saveSplitConsoleHeight); + + let buttonsPromise = this._buildButtons(); + + this._pingTelemetry(); + + let panel = yield this.selectTool(this._defaultToolId); + + // Wait until the original tool is selected so that the split + // console input will receive focus. + let splitConsolePromise = promise.resolve(); + if (Services.prefs.getBoolPref(SPLITCONSOLE_ENABLED_PREF)) { + splitConsolePromise = this.openSplitConsole(); + } + + yield promise.all([ + splitConsolePromise, + buttonsPromise, + framesPromise + ]); + + let profilerReady = this._connectProfiler(); + + // Only wait for the profiler initialization during tests. Otherwise, + // lazily load this. This is to intercept console.profile calls; the performance + // tools will explicitly wait for the connection opening when opened. + if (gDevTools.testing) { + yield profilerReady; + } + + this.emit("ready"); + }.bind(this)).then(null, console.error.bind(console)); + }, +*/ open: function() { let deferred = promise.defer(); @@ -1606,6 +1686,7 @@ Toolbox.prototype = { this._target.off("frame-update", this._updateFrames); this.off("select", this._refreshHostTitle); this.off("host-changed", this._refreshHostTitle); + this.off("ready", this._showDevEditionPromo); gDevTools.off("tool-registered", this._toolRegistered); gDevTools.off("tool-unregistered", this._toolUnregistered); @@ -1648,6 +1729,9 @@ Toolbox.prototype = { } })); + // Destroy the profiler connection + outstanding.push(this._disconnectProfiler()); + // We need to grab a reference to win before this._host is destroyed. let win = this.frame.ownerGlobal; @@ -1728,5 +1812,39 @@ Toolbox.prototype = { } let window = this.frame.contentWindow; showDoorhanger({ window, type: "deveditionpromo" }); - } + }, + + getPerformanceActorsConnection: function() { + if (!this._performanceConnection) { + this._performanceConnection = getPerformanceActorsConnection(this.target); + } + return this._performanceConnection; + }, + + /** + * Connects to the SPS profiler when the developer tools are open. This is + * necessary because of the WebConsole's `profile` and `profileEnd` methods. + */ + _connectProfiler: Task.async(function*() { + // If target does not have profiler actor (addons), do not + // even register the shared performance connection. + if (!this.target.hasActor("profiler")) { + return; + } + + yield this.getPerformanceActorsConnection().open(); + // Emit an event when connected, but don't wait on startup for this. + this.emit("profiler-connected"); + }), + + /** + * Disconnects the underlying Performance Actor Connection. + */ + _disconnectProfiler: Task.async(function*() { + if (!this._performanceConnection) { + return; + } + yield this._performanceConnection.destroy(); + this._performanceConnection = null; + }), }; |