Bug 1668219 - [devtools] Remove devtools.performance.new-panel-enabled preference. r=julienw.

Remove occurences of the pref (except in devtools/client/performance, which
will be removed further in the stack).

Differential Revision: https://phabricator.services.mozilla.com/D145459
This commit is contained in:
Nicolas Chevobbe 2022-05-06 17:16:26 +00:00
parent f7ae125a11
commit faee16015f
10 changed files with 17 additions and 225 deletions

View File

@ -2573,9 +2573,6 @@ pref("devtools.browserconsole.input.editorWidth", 0);
// Display an onboarding UI for the Editor mode.
pref("devtools.webconsole.input.editorOnboarding", true);
// Enable the new performance panel in all channels of Firefox.
pref("devtools.performance.new-panel-enabled", true);
// Enable message grouping in the console, true by default
pref("devtools.webconsole.groupWarningMessages", true);

View File

@ -37,7 +37,7 @@ tags = webextensions
[browser_aboutdebugging_addons_debug_nobg.js]
tags = webextensions
[browser_aboutdebugging_addons_debug_popup.js]
skip-if =
skip-if =
(verify && debug) || (debug && os == "linux" && bits == 64) # verify: crashes on shutdown, timeouts linux debug Bug 1299001
win10_2004 && bits == 64 && !debug # Bug 1744778
tags = webextensions
@ -77,8 +77,6 @@ skip-if = (os == 'linux' && bits == 32) # ADB start() fails on linux 32, see Bug
[browser_aboutdebugging_devtoolstoolbox_navigate_back_forward.js]
[browser_aboutdebugging_devtoolstoolbox_navigate_reload_button.js]
[browser_aboutdebugging_devtoolstoolbox_navigate_to_url.js]
[browser_aboutdebugging_devtoolstoolbox_performance.js]
skip-if = os == 'linux' && e10s && (asan || tsan || debug) # Same skip-if as old perf panel test suite. Bug 1254821
[browser_aboutdebugging_devtoolstoolbox_reload.js]
skip-if = verify || ccov || (os == 'linux' && debug) #bug 1544828, test loads the toolbox 2 times for each panel, might timeout or OOM
[browser_aboutdebugging_devtoolstoolbox_shortcuts.js]

View File

@ -1,63 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// This test can take a long time to run on debug builds.
requestLongerTimeout(2);
/* import-globals-from helper-collapsibilities.js */
Services.scriptloader.loadSubScript(
CHROME_URL_ROOT + "helper-collapsibilities.js",
this
);
/**
* Check that graphs used by the old performance panel are correctly displayed.
*/
add_task(async function() {
info("Force all debug target panes to be expanded");
prepareCollapsibilitiesTest();
info("Force old performance panel");
await pushPref("devtools.performance.new-panel-enabled", false);
const { document, tab, window } = await openAboutDebugging();
await selectThisFirefoxPage(document, window.AboutDebugging.store);
const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox(
document,
tab,
window
);
info("Select performance panel");
const toolbox = getToolbox(devtoolsWindow);
await toolbox.selectTool("performance");
// Retrieve shared helpers for the old performance panel.
const {
startRecording,
stopRecording,
} = require("devtools/client/performance/test/helpers/actions");
const performancePanel = toolbox.getCurrentPanel();
await startRecording(performancePanel);
const {
idleWait,
} = require("devtools/client/performance/test/helpers/wait-utils");
await idleWait(100);
info("Stop recording");
await stopRecording(performancePanel);
info("Select the call tree");
const { EVENTS, DetailsView, JsCallTreeView } = performancePanel.panelWin;
const rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED);
await DetailsView.selectView("js-calltree");
info("Wait for the call tree to be rendered");
await rendered;
await closeAboutDevtoolsToolbox(document, devtoolsTab, window);
await removeTab(tab);
});

View File

@ -23,16 +23,6 @@ const TOOLS = [
"accessibility",
];
// If the new performance panel is enabled, it's not available in about:debugging toolboxes.
if (
Services.prefs.getBoolPref(
"devtools.performance.new-panel-enabled",
false
) === false
) {
TOOLS.push("performance");
}
/**
* Test whether about:devtools-toolbox display correctly after reloading.
*/

View File

@ -38,11 +38,6 @@ loader.lazyGetter(
"MemoryPanel",
() => require("devtools/client/memory/panel").MemoryPanel
);
loader.lazyGetter(
this,
"PerformancePanel",
() => require("devtools/client/performance/panel").PerformancePanel
);
loader.lazyGetter(
this,
"NewPerformancePanel",
@ -259,6 +254,7 @@ Tools.performance = {
id: "performance",
ordinal: 6,
icon: "chrome://devtools/skin/images/tool-profiler.svg",
url: "chrome://devtools/content/performance-new/index.xhtml",
visibilityswitch: "devtools.performance.enabled",
label: l10n("performance.label"),
panelLabel: l10n("performance.panelLabel"),
@ -270,54 +266,20 @@ Tools.performance = {
},
accesskey: l10n("performance.accesskey"),
inMenu: false,
isToolSupported: function(toolbox) {
// Only use the new performance panel on local tab toolboxes, as they are guaranteed
// to have a performance actor.
// Remote tab toolboxes (eg about:devtools-toolbox from about:debugging) should not
// use the performance panel; about:debugging provides a "Profile performance" button
// which can be used instead, without having the overhead of starting a remote toolbox.
// Also accept the Browser Toolbox, so that we can profile its process via a second browser toolbox.
return toolbox.target.isLocalTab || toolbox.isBrowserToolbox;
},
build: function(frame, toolbox, commands) {
return new NewPerformancePanel(frame, toolbox, commands);
},
};
function switchPerformancePanel() {
if (
Services.prefs.getBoolPref("devtools.performance.new-panel-enabled", false)
) {
Tools.performance.url =
"chrome://devtools/content/performance-new/index.xhtml";
Tools.performance.build = function(frame, toolbox, commands) {
return new NewPerformancePanel(frame, toolbox, commands);
};
Tools.performance.isToolSupported = function(toolbox) {
// Only use the new performance panel on local tab toolboxes, as they are guaranteed
// to have a performance actor.
// Remote tab toolboxes (eg about:devtools-toolbox from about:debugging) should not
// use the performance panel; about:debugging provides a "Profile performance" button
// which can be used instead, without having the overhead of starting a remote toolbox.
// Also accept the Browser Toolbox, so that we can profile its process via a second browser toolbox.
return toolbox.target.isLocalTab || toolbox.isBrowserToolbox;
};
} else {
Tools.performance.url = "chrome://devtools/content/performance/index.xhtml";
Tools.performance.build = function(frame, toolbox, commands) {
return new PerformancePanel(frame, toolbox, commands);
};
Tools.performance.isToolSupported = function(toolbox) {
return toolbox.target.hasActor("performance");
};
}
}
switchPerformancePanel();
const prefObserver = { observe: switchPerformancePanel };
Services.prefs.addObserver(
"devtools.performance.new-panel-enabled",
prefObserver
);
const unloadObserver = function(subject) {
if (subject.wrappedJSObject == require("@loader/unload")) {
Services.prefs.removeObserver(
"devtools.performance.new-panel-enabled",
prefObserver
);
Services.obs.removeObserver(unloadObserver, "devtools:loader:destroy");
}
};
Services.obs.addObserver(unloadObserver, "devtools:loader:destroy");
Tools.memory = {
id: "memory",
ordinal: 7,

View File

@ -129,10 +129,8 @@ function setPrefDefaults() {
);
Services.prefs.setBoolPref("layout.css.emulate-moz-box-with-flex", false);
// We force enabling the new performance panel in the browser toolbox,
// even if it was disabled in firefox.
// We force enabling the performance panel in the browser toolbox.
Services.prefs.setBoolPref("devtools.performance.enabled", true);
Services.prefs.setBoolPref("devtools.performance.new-panel-enabled", true);
}
window.addEventListener(

View File

@ -726,7 +726,6 @@ Toolbox.prototype = {
if (targetFront.isDestroyed()) {
return;
}
await this.initPerformance();
}
if (targetFront.targetForm.ignoreSubFrames) {
@ -1024,17 +1023,6 @@ Toolbox.prototype = {
});
}
// Lazily connect to the profiler here and don't wait for it to complete,
// used to intercept console.profile calls before the performance tools are open.
const performanceFrontConnection = this.initPerformance();
// If in testing environment, wait for performance connection to finish,
// so we don't have to explicitly wait for this in tests; ideally, all tests
// will handle this on their own, but each have their own tear down function.
if (flags.testing) {
await performanceFrontConnection;
}
await this.initHarAutomation();
this.emit("ready");
@ -2224,10 +2212,7 @@ Toolbox.prototype = {
*/
_applyNewPerfPanelEnabled: function() {
this.commands.targetConfigurationCommand.updateConfiguration({
isNewPerfPanelEnabled: Services.prefs.getBoolPref(
"devtools.performance.new-panel-enabled",
false
),
isNewPerfPanelEnabled: true,
});
},
@ -4188,33 +4173,6 @@ Toolbox.prototype = {
return this.topDoc.getElementById("toolbox-menu");
},
/**
* Connects to the Gecko Profiler when the developer tools are open. This is
* necessary because of the WebConsole's `profile` and `profileEnd` methods.
*/
async initPerformance() {
// If:
// - target does not have performance actor (addons)
// - or client uses the new performance panel (incompatible with console.profile())
// do not even register the shared performance connection.
const isNewPerfPanel = Services.prefs.getBoolPref(
"devtools.performance.new-panel-enabled",
false
);
if (isNewPerfPanel || !this.target.hasActor("performance")) {
return;
}
if (this.target.isDestroyed()) {
return;
}
const performanceFront = await this.target.getFront("performance");
performanceFront.once("console-profile-start", () =>
this._onPerformanceFrontEvent(performanceFront)
);
return performanceFront;
},
/**
* Called when a "console-profile-start" event comes from the PerformanceFront. If
* the performance tool is already loaded when the first event comes in, immediately

View File

@ -105,8 +105,7 @@ perftools-tools-threads-input-label =
.title = These thread names are a comma separated list that is used to enable profiling of the threads in the profiler. The name needs to be only a partial match of the thread name to be included. It is whitespace sensitive.
## Onboarding UI labels. These labels are displayed in the new performance panel UI, when
## both devtools.performance.new-panel-onboarding & devtools.performance.new-panel-enabled
## preferences are true.
## devtools.performance.new-panel-onboarding preference is true.
perftools-onboarding-message = <b>New</b>: { -profiler-brand-name } is now integrated into Developer Tools. <a>Learn more</a> about this powerful new tool.

View File

@ -480,10 +480,6 @@ async function withDevToolsPanel(url, callback, aWindow = window) {
const { gBrowser } = aWindow;
SpecialPowers.pushPrefEnv({
set: [["devtools.performance.new-panel-enabled", "true"]],
});
const { gDevTools } = require("devtools/client/framework/devtools");
info(`Create a new tab with url "${url}".`);

View File

@ -3,11 +3,6 @@
"use strict";
const {
waitForRecordingStartedEvents,
waitForRecordingStoppedEvents,
} = require("devtools/client/performance/test/helpers/actions");
// Check console.profile() shows a warning with the new performance panel.
const TEST_URI =
"data:text/html;charset=utf8,<!DOCTYPE html><h1>test console.profile</h1>";
@ -16,7 +11,6 @@ const EXPECTED_WARNING =
"console.profile is not compatible with the new Performance recorder";
add_task(async function consoleProfileWarningWithNewPerfPanel() {
await pushPref("devtools.performance.new-panel-enabled", true);
const hud = await openNewTabAndConsole(TEST_URI);
info("Use console.profile in the content page");
@ -30,40 +24,3 @@ add_task(async function consoleProfileWarningWithNewPerfPanel() {
);
ok(true, "The expected warning was displayed.");
});
// Check console.profile() shows no warning with the old performance panel.
add_task(async function consoleProfileNoWarningWithOldPerfPanel() {
await pushPref("devtools.performance.new-panel-enabled", false);
const hud = await openNewTabAndConsole(TEST_URI);
await hud.toolbox.loadTool("performance");
const perfPanel = hud.toolbox.getPanel("performance");
const profileStarted = waitForRecordingStartedEvents(perfPanel, {
// only emitted for manual recordings
skipWaitingForBackendReady: true,
});
const profileStopped = waitForRecordingStoppedEvents(perfPanel, {
// only emitted for manual recordings
skipWaitingForBackendReady: true,
});
info("Use console.profile in the content page");
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
content.wrappedJSObject.console.profile();
});
await profileStarted;
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
content.wrappedJSObject.console.profileEnd();
});
await profileStopped;
// Wait for one second to give some time to the warning to be displayed.
await wait(1000);
ok(
!findMessage(hud, EXPECTED_WARNING),
"The console.profile warning was not displayed."
);
});