зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1761356 - Remove devtools auto theme notification. r=jdescottes
I think it's fair to say that this is not a new feature anymore. This avoids showing the notification every time a developer uses devtools on a local build or so (with a clean profile). Differential Revision: https://phabricator.services.mozilla.com/D142000
This commit is contained in:
Родитель
6720cb7921
Коммит
0010cb6fc4
|
@ -143,7 +143,6 @@ run-if = e10s
|
|||
[browser_toolbox_telemetry_exit.js]
|
||||
[browser_toolbox_textbox_context_menu.js]
|
||||
[browser_toolbox_theme.js]
|
||||
[browser_toolbox_theme_auto_notification.js]
|
||||
[browser_toolbox_theme_registration.js]
|
||||
[browser_toolbox_toggle.js]
|
||||
[browser_toolbox_tool_ready.js]
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const SHOW_THEME_NOTIFICATION_PREF = "devtools.theme.show-auto-theme-info";
|
||||
const FORCE_THEME_NOTIFICATION_PREF = "devtools.theme.force-auto-theme-info";
|
||||
|
||||
// Test the Toolbox Notification displayed for the new "auto" theme.
|
||||
add_task(async function() {
|
||||
// The auto-theme notification is normally only displayed when Firefox uses a
|
||||
// dark color scheme. To make testing easier, we expose a preference to bypass
|
||||
// this is check.
|
||||
await pushPref(FORCE_THEME_NOTIFICATION_PREF, true);
|
||||
|
||||
// Force SHOW_THEME_NOTIFICATION_PREF to true in case a previous test already
|
||||
// dismissed the notification.
|
||||
await pushPref(SHOW_THEME_NOTIFICATION_PREF, true);
|
||||
|
||||
const tab = await addTab("data:text/html,test");
|
||||
let toolbox = await gDevTools.showToolboxForTab(tab);
|
||||
|
||||
info("Check the auto-theme notification is displayed");
|
||||
let notification = await waitFor(() => getAutoThemeNotification(toolbox));
|
||||
ok(notification, "A notification was displayed");
|
||||
|
||||
info("Click on the settings button from the notification");
|
||||
const onSettingsCallbackDone = toolbox.once("test-theme-settings-opened");
|
||||
const settingsButton = notification.querySelector(".notificationButton");
|
||||
settingsButton.click();
|
||||
|
||||
info("Wait until the open settings button callback is done");
|
||||
await onSettingsCallbackDone;
|
||||
is(toolbox.currentToolId, "options", "The options panel was selected");
|
||||
|
||||
info("Close and reopen the toolbox");
|
||||
await toolbox.destroy();
|
||||
toolbox = await gDevTools.showToolboxForTab(tab);
|
||||
|
||||
info("Check the notification is displayed again");
|
||||
notification = await waitFor(() => getAutoThemeNotification(toolbox));
|
||||
ok(notification, "A notification was displayed after reopening the toolbox");
|
||||
|
||||
info("Close the notification");
|
||||
const closeButton = notification.querySelector(".messageCloseButton");
|
||||
closeButton.click();
|
||||
|
||||
info("Wait for the notification to be removed");
|
||||
await waitFor(() => !getAutoThemeNotification(toolbox));
|
||||
|
||||
info("Close and reopen the toolbox");
|
||||
await toolbox.destroy();
|
||||
toolbox = await gDevTools.showToolboxForTab(tab);
|
||||
|
||||
await wait(1000);
|
||||
ok(!getAutoThemeNotification(toolbox));
|
||||
is(
|
||||
Services.prefs.getBoolPref(SHOW_THEME_NOTIFICATION_PREF),
|
||||
false,
|
||||
"The show theme notification preference was set to false"
|
||||
);
|
||||
});
|
||||
|
||||
function getAutoThemeNotification(toolbox) {
|
||||
return toolbox.doc.querySelector(
|
||||
'.notification[data-key="auto-theme-notification"]'
|
||||
);
|
||||
}
|
|
@ -13,8 +13,6 @@ const MAX_ORDINAL = 99;
|
|||
const SPLITCONSOLE_ENABLED_PREF = "devtools.toolbox.splitconsoleEnabled";
|
||||
const SPLITCONSOLE_HEIGHT_PREF = "devtools.toolbox.splitconsoleHeight";
|
||||
const DISABLE_AUTOHIDE_PREF = "ui.popup.disable_autohide";
|
||||
const FORCE_THEME_NOTIFICATION_PREF = "devtools.theme.force-auto-theme-info";
|
||||
const SHOW_THEME_NOTIFICATION_PREF = "devtools.theme.show-auto-theme-info";
|
||||
const PSEUDO_LOCALE_PREF = "intl.l10n.pseudo";
|
||||
const HOST_HISTOGRAM = "DEVTOOLS_TOOLBOX_HOST";
|
||||
const CURRENT_THEME_SCALAR = "devtools.current_theme";
|
||||
|
@ -808,58 +806,6 @@ Toolbox.prototype = {
|
|||
);
|
||||
},
|
||||
|
||||
_showAutoThemeNotification() {
|
||||
// Skip the notification when:
|
||||
if (
|
||||
// - Firefox is not using a dark color scheme.
|
||||
!Services.appinfo.chromeColorSchemeIsDark &&
|
||||
// - The test preference to bypasse the dark-color-scheme check is false.
|
||||
!Services.prefs.getBoolPref(FORCE_THEME_NOTIFICATION_PREF, false)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only show the notification for users with the auto theme.
|
||||
if (Services.prefs.getCharPref("devtools.theme") !== "auto") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not show the notification again if it was previously dismissed.
|
||||
if (!Services.prefs.getBoolPref(SHOW_THEME_NOTIFICATION_PREF, false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Show the notification.
|
||||
const box = this.getNotificationBox();
|
||||
const brandShorterName = Services.strings
|
||||
.createBundle("chrome://branding/locale/brand.properties")
|
||||
.GetStringFromName("brandShorterName");
|
||||
|
||||
box.appendNotification(
|
||||
L10N.getFormatStr("toolbox.autoThemeNotification", brandShorterName),
|
||||
"auto-theme-notification",
|
||||
"",
|
||||
box.PRIORITY_NEW,
|
||||
[
|
||||
{
|
||||
label: L10N.getStr("toolbox.autoThemeNotification.settingsButton"),
|
||||
callback: async () => {
|
||||
const { panelDoc } = await this.selectTool("options");
|
||||
panelDoc.querySelector("#devtools-theme-box").scrollIntoView();
|
||||
// Emit a test event to avoid unhandled promise rejections in tests.
|
||||
this.emitForTests("test-theme-settings-opened");
|
||||
},
|
||||
},
|
||||
],
|
||||
evt => {
|
||||
if (evt === "removed") {
|
||||
// Flip the preference when the notification is dismissed.
|
||||
Services.prefs.setBoolPref(SHOW_THEME_NOTIFICATION_PREF, false);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the toolbox
|
||||
*/
|
||||
|
@ -1091,8 +1037,6 @@ Toolbox.prototype = {
|
|||
|
||||
await this.initHarAutomation();
|
||||
|
||||
this._showAutoThemeNotification();
|
||||
|
||||
this.emit("ready");
|
||||
this._resolveIsOpen();
|
||||
}
|
||||
|
|
|
@ -86,19 +86,6 @@ toolbox.viewJsSourceInDebugger.label=Open File in Debugger
|
|||
|
||||
toolbox.resumeOrderWarning=Page did not resume after the debugger was attached. To fix this, please close and re-open the toolbox.
|
||||
|
||||
# LOCALIZATION NOTE (toolbox.autoThemeNotification)
|
||||
# Notification displayed in the toolbox notification box when the DevTools theme
|
||||
# is set to auto and the user is using a dark Firefox theme.
|
||||
# %S is the brand shorter name (eg Firefox)
|
||||
toolbox.autoThemeNotification=DevTools now follow the overall %S theme. You can revert to Light or Dark theme in the Settings panel.
|
||||
|
||||
# LOCALIZATION NOTE (toolbox.autoThemeNotification.settingsButton)
|
||||
# Text of the button displayed in the auto theme notification to open the settings
|
||||
# panel.
|
||||
# "Settings" refers to the name of the settings panel, and should most likely be
|
||||
# the same as toolbox.meatballMenu.settings.label.
|
||||
toolbox.autoThemeNotification.settingsButton=Open Settings
|
||||
|
||||
# LOCALIZATION NOTE (toolbox.help.key)
|
||||
# Key shortcut used to open the options panel
|
||||
toolbox.help.key=F1
|
||||
|
|
|
@ -4478,9 +4478,6 @@ pref("devtools.jsonview.enabled", true);
|
|||
// Default theme ("auto", "dark" or "light").
|
||||
pref("devtools.theme", "auto", sticky);
|
||||
|
||||
// Display a notification about the new default DevTools theme "auto".
|
||||
pref("devtools.theme.show-auto-theme-info", true);
|
||||
|
||||
// Completely disable DevTools entry points, as well as all DevTools command
|
||||
// line arguments This should be merged with devtools.enabled, see Bug 1440675.
|
||||
pref("devtools.policy.disabled", false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче