_getCurrentTime: function() { const docShell = this.parent.isRootActor ? this.parent.docShell : this.parent.originalDocShell; if (docShell) { return docShell.now(); } // When used from the ContentProcessTargetActor, parent has no docShell, // so fallback to Cu.now return Cu.now(); },
/** * Log telemetry related to toolbox opening. * Two distinct probes are logged. One for cold startup, when we open the very first * toolbox. This one includes devtools framework loading. And a second one for all * subsequent toolbox opening, which should all be faster. * These two probes are indexed by Tool ID. * * @param {String} toolId * The id of the opened tool. * @param {Number} startTime * Indicates the time at which the user event related to the toolbox * opening started. This is a `Cu.now()` timing. */ logToolboxOpenTime(toolId, startTime) { const delay = Cu.now() - startTime; const telemetryKey = this._firstShowToolbox ? "DEVTOOLS_COLD_TOOLBOX_OPEN_DELAY_MS" : "DEVTOOLS_WARM_TOOLBOX_OPEN_DELAY_MS"; this._telemetry.getKeyedHistogramById(telemetryKey).add(toolId, delay); this._telemetry.addEventProperty( "devtools.main", "open", "tools", null, "first_panel", this.makeToolIdHumanReadable(toolId)); }, makeToolIdHumanReadable(toolId) { if (/^[0-9a-fA-F]{40}_temporary-addon/.test(toolId)) { return "temporary-addon"; }
const { Cu } = require("chrome"); loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true); loader.lazyRequireGetter(this, "CommandUtils", "devtools/client/shared/developer-toolbar", true); loader.lazyRequireGetter(this, "TargetFactory", "devtools/client/framework/target", true); loader.lazyRequireGetter(this, "ResponsiveUIManager", "devtools/client/responsive.html/manager", true); loader.lazyImporter(this, "BrowserToolboxProcess", "resource://devtools/client/framework/ToolboxProcess.jsm"); loader.lazyImporter(this, "ScratchpadManager", "resource://devtools/client/scratchpad/scratchpad-manager.jsm"); exports.menuitems = [ { id: "menu_devToolbox", l10nKey: "devToolboxMenuItem", oncommand(event) { let window = event.target.ownerDocument.defaultView; gDevToolsBrowser.toggleToolboxCommand(window.gBrowser, Cu.now()); }, keyId: "toggleToolbox", checkbox: true }, { id: "menu_devtools_separator", separator: true }, { id: "menu_webide", l10nKey: "webide", disabled: true, oncommand() { gDevToolsBrowser.openWebIDE(); }, keyId: "webide", }, { id: "menu_browserToolbox",