Skip to content

Commit

Permalink
Rename restart prefs and move new to new category
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye116477 committed Oct 25, 2019
1 parent 9b808de commit 3b74b11
Show file tree
Hide file tree
Showing 14 changed files with 197 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .mozconfig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ac_add_options --enable-ccache=sccache
elif test `uname -m` = ppc64le; then
ac_add_options --enable-ccache=ccache
fi
ac_add_options --enable-lto
#ac_add_options --enable-lto
# Stick to the same channel as Dev Edition would be
ac_add_options --enable-update-channel=aurora
ac_add_options --enable-rust-simd
Expand Down
6 changes: 3 additions & 3 deletions browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1890,13 +1890,13 @@ pref("corroborator.enabled", true);
#endif

// Set bool pref for restart browser purgecache enabled.
pref("browser.restart.purgecache", true);
pref("browser.restart_menu.purgecache", true);

// Set bool pref for restart browser confirmation.
pref("browser.restart.requireconfirm", false);
pref("browser.restart_menu.requireconfirm", false);

// Set bool pref for restart browser panelUI button
pref("browser.restart.showpanelmenubtn", false);
pref("browser.restart_menu.showpanelmenubtn", false);

// Set prefs for tab context menu options
pref("browser.tabs.duplicateTab", true);
Expand Down
6 changes: 3 additions & 3 deletions browser/base/content/utilityOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -1202,16 +1202,16 @@ function updateFileMenuImportUIVisibility(id) {
function restartBrowser() {
let RestartMsg = Services.strings.createBundle("chrome://browser/locale/browser.properties");
try {
if (Services.prefs.getBoolPref("browser.restart.requireconfirm")) {
if (Services.prefs.getBoolPref("browser.restart_menu.requireconfirm")) {
if (Services.prompt.confirm(null, RestartMsg.formatStringFromName("restartPromptTitle.label", [Services.strings.createBundle("chrome://branding/locale/brand.properties").GetStringFromName("brandShortName")], 1),
RestartMsg.formatStringFromName("restartPromptQuestion.label", [Services.strings.createBundle("chrome://branding/locale/brand.properties").GetStringFromName("brandShortName")], 1))) {
if (Services.prefs.getBoolPref("browser.restart.purgecache")) {
if (Services.prefs.getBoolPref("browser.restart_menu.purgecache")) {
Services.appinfo.invalidateCachesOnRestart();
}
Services.startup.quit(Services.startup.eRestart | Services.startup.eAttemptQuit);
}
} else {
if (Services.prefs.getBoolPref("browser.restart.purgecache")) {
if (Services.prefs.getBoolPref("browser.restart_menu.purgecache")) {
Services.appinfo.invalidateCachesOnRestart();
}
Services.startup.quit(Services.startup.eRestart | Services.startup.eAttemptQuit);
Expand Down
4 changes: 2 additions & 2 deletions browser/components/customizableui/content/panelUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ const PanelUI = {
case "popupshowing":
updateEditUIVisibility();
try {
if (!Services.prefs.getBoolPref("browser.restart.showpanelmenubtn")) {
if (!Services.prefs.getBoolPref("browser.restart_menu.showpanelmenubtn")) {
document.getElementById("appMenu-restart-button").hidden = true;
} else {
document.getElementById("appMenu-restart-button").hidden = false;
}
} catch (e) {
throw new Error("We're sorry but something has gone wrong with 'browser.restart.showpanelmenubtn'" + e);
throw new Error("We're sorry but something has gone wrong with 'browser.restart_menu.showpanelmenubtn'" + e);
}
// Fall through
case "popupshown":
Expand Down
72 changes: 72 additions & 0 deletions browser/components/preferences/in-content/advanced.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0.
*/

/* import-globals-from preferences.js */
/* import-globals-from main.js */

var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

Preferences.addAll([
{ id: "browser.restart_menu.purgecache", type: "bool" },
{ id: "browser.restart_menu.requireconfirm", type: "bool" },
{ id: "browser.restart_menu.showpanelmenubtn", type: "bool" },
{ id: "browser.tabs.duplicateTab", type: "bool" },
{ id: "browser.tabs.copyurl", type: "bool" },
{ id: "browser.tabs.copyurl.activetab", type: "bool" },
{ id: "browser.tabs.copyallurls", type: "bool" },
]);

var gAdvancedPane = {
_inited: false,

/**
* Brings the appropriate tab to the front and initializes various bits of UI.
*/
init() {
function setEventListener(aId, aEventType, aCallback) {
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gAdvancedPane));
}

this._inited = true;
var advancedPrefs = document.getElementById("advancedPrefs");

var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
if (preference.value !== null)
advancedPrefs.selectedIndex = preference.value;

setEventListener("advancedPrefs", "select",
gAdvancedPane.tabSelectionChanged);
},

/**
* Stores the identity of the current tab in preferences so that the selected
* tab can be persisted between openings of the preferences window.
*/
tabSelectionChanged() {
if (!this._inited)
return;
var advancedPrefs = document.getElementById("advancedPrefs");
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");

// tabSelectionChanged gets called twice due to the selectedIndex being set
// by both the selectedItem and selectedPanel callstacks. This guard is used
// to prevent double-counting in Telemetry.
if (preference.valueFromPreferences != advancedPrefs.selectedIndex) {
Services.telemetry
.getHistogramById("FX_PREFERENCES_CATEGORY_OPENED")
.add(telemetryBucketForCategory("advanced"));
}

preference.valueFromPreferences = advancedPrefs.selectedIndex;
},

observe(aSubject, aTopic, aData) {
switch (aTopic) {
case "nsPref:changed":
this.updateReadPrefs();
break;
}
},
};
46 changes: 46 additions & 0 deletions browser/components/preferences/in-content/advanced.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0.

<!-- Advanced panel -->

<script src="chrome://browser/content/preferences/in-content/advanced.js"/>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
<html:template id="template-paneAdvanced">
<hbox id="browserAdvancedCategory"
class="subcategory"
hidden="true"
data-category="paneAdvanced">
<html:h1 data-l10n-id="pane-advanced-header"/>
</hbox>

<!-- Restart Menu Item -->
<groupbox id="restartGroup"
data-category="paneRestart"
hidden="true">
<label><html:h2 data-l10n-id="restart-header"/></label>

<checkbox id="browser.restart_menu.showpanelmenubtn" data-l10n-id="restart-paneluibtn"
preference="browser.restart_menu.showpanelmenubtn"/>
<checkbox id="browser.restart_menu.purgecache" data-l10n-id="clean-fast-restart-cache"
preference="browser.restart_menu.purgecache"/>
<checkbox id="browser.restart_menu.requireconfirm" data-l10n-id="restart-reqconfirmation"
preference="browser.restart_menu.requireconfirm"/>
</groupbox>
<groupbox id="tabContextMenu"
data-category="paneTabContextMenu"
hidden="true">
<label><html:h2 data-l10n-id="tabContextMenu-header"/></label>

<checkbox id="browser.tabs.duplicateTab" data-l10n-id="duplicate-tab-options"
preference="browser.tabs.duplicateTab"/>

<checkbox id="browser.tabs.copyurl" data-l10n-id="copy-tab-url-options"
preference="browser.tabs.copyurl"/>

<checkbox id="browser.tabs.copyurl.activetab" data-l10n-id="copy-active-tab-url-options"
preference="browser.tabs.copyurl.activetab"/>

<checkbox id="browser.tabs.copyallurls" data-l10n-id="copy-all-tab-urls-options"
preference="browser.tabs.copyallurls"/>
</groupbox>
</html:template>
10 changes: 3 additions & 7 deletions browser/components/preferences/in-content/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ Preferences.addAll([
{ id: "browser.startup.page", type: "int" },
{ id: "browser.privatebrowsing.autostart", type: "bool" },
{ id: "browser.sessionstore.warnOnQuit", type: "bool" },
{ id: "browser.restart.purgecache", type: "bool" },
{ id: "browser.restart.requireconfirm", type: "bool" },
{ id: "browser.restart.showpanelmenubtn", type: "bool" },
{ id: "browser.restart_menu.purgecache", type: "bool" },
{ id: "browser.restart_menu.requireconfirm", type: "bool" },
{ id: "browser.restart_menu.showpanelmenubtn", type: "bool" },

// Downloads
{ id: "browser.download.useDownloadDir", type: "bool" },
Expand Down Expand Up @@ -138,10 +138,6 @@ Preferences.addAll([
{ id: "browser.tabs.warnOnOpen", type: "bool" },
{ id: "browser.sessionstore.restore_on_demand", type: "bool" },
{ id: "browser.ctrlTab.recentlyUsedOrder", type: "bool" },
{ id: "browser.tabs.duplicateTab", type: "bool" },
{ id: "browser.tabs.copyurl", type: "bool" },
{ id: "browser.tabs.copyurl.activetab", type: "bool" },
{ id: "browser.tabs.copyallurls", type: "bool" },

// CFR
{
Expand Down
31 changes: 13 additions & 18 deletions browser/components/preferences/in-content/main.xul
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,21 @@
</deck>
</vbox>
#endif
<checkbox id="browser.restart.showpanelmenubtn" data-l10n-id="restart-paneluibtn"
preference="browser.restart.showpanelmenubtn"/>
<checkbox id="browser.restart.purgecache" data-l10n-id="clean-fast-restart-cache"
preference="browser.restart.purgecache"/>
<checkbox id="browser.restart.requireconfirm" data-l10n-id="restart-reqconfirmation"
preference="browser.restart.requireconfirm"/>
</groupbox>

<groupbox id="restartGroup"
data-category="paneGeneral"
hidden="true">
<label><html:h2 data-l10n-id="restart-header"/></label>

<checkbox id="browser.restart_menu.showpanelmenubtn" data-l10n-id="restart-paneluibtn"
preference="browser.restart_menu.showpanelmenubtn"/>
<checkbox id="browser.restart_menu.purgecache" data-l10n-id="clean-fast-restart-cache"
preference="browser.restart_menu.purgecache"/>
<checkbox id="browser.restart_menu.requireconfirm" data-l10n-id="restart-reqconfirmation"
preference="browser.restart_menu.requireconfirm"/>
</groupbox>

<!-- Tab preferences -->
<groupbox data-category="paneGeneral"
hidden="true">
Expand Down Expand Up @@ -96,18 +103,6 @@
preference="browser.taskbar.previews.enable"/>
#endif

<checkbox id="browser.tabs.duplicateTab" data-l10n-id="duplicate-tab-options"
preference="browser.tabs.duplicateTab"/>

<checkbox id="browser.tabs.copyurl" data-l10n-id="copy-tab-url-options"
preference="browser.tabs.copyurl"/>

<checkbox id="browser.tabs.copyurl.activetab" data-l10n-id="copy-active-tab-url-options"
preference="browser.tabs.copyurl.activetab"/>

<checkbox id="browser.tabs.copyallurls" data-l10n-id="copy-all-tab-urls-options"
preference="browser.tabs.copyallurls"/>

<vbox id="browserContainersbox" hidden="true">
<hbox id="browserContainersExtensionContent"
align="center" class="extension-controlled">
Expand Down
1 change: 1 addition & 0 deletions browser/components/preferences/in-content/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function init_all() {
register_module("paneSearch", gSearchPane);
register_module("panePrivacy", gPrivacyPane);
register_module("paneContainers", gContainersPane);
register_module("paneAdvanced", gAdvancedPane);
if (Services.prefs.getBoolPref("identity.fxaccounts.enabled")) {
document.getElementById("category-sync").hidden = false;
register_module("paneSync", gSyncPane);
Expand Down
12 changes: 12 additions & 0 deletions browser/components/preferences/in-content/preferences.xul
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@
<image class="category-icon"/>
<label class="category-name" flex="1" data-l10n-id="pane-sync-title2"></label>
</richlistitem>

<richlistitem id="category-advanced"
class="category"
value="paneAdvanced"
helpTopic="prefs-advanced"
data-l10n-id="category-advanced"
data-l10n-attrs="tooltiptext"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1" data-l10n-id="pane-advanced-header"></label>
</richlistitem>
</richlistbox>

<spacer flex="1"/>
Expand Down Expand Up @@ -191,6 +202,7 @@
#include privacy.xul
#include containers.xul
#include sync.xul
#include advanced.xul
</vbox>
</vbox>
</vbox>
Expand Down
8 changes: 8 additions & 0 deletions browser/locales/en-US/browser/preferences/preferences.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -1087,3 +1087,11 @@ choose-download-folder-title = Choose Download Folder:
# $service-name (String) - Name of a cloud storage provider like Dropbox, Google Drive, etc...
save-files-to-cloud-storage =
.label = Save files to { $service-name }
restart-header = Restart Menu Item
pane-advanced-header = Advanced
category-advanced =
.tooltiptext = { pane-advanced-header }
tabContextMenu-header = Tab Context Menu
27 changes: 27 additions & 0 deletions browser/themes/shared/incontentprefs/advanced.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions browser/themes/shared/incontentprefs/preferences.inc.css
Original file line number Diff line number Diff line change
Expand Up @@ -963,3 +963,7 @@ richlistitem .text-link {
richlistitem .text-link:hover {
color: inherit;
}

#category-advanced > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/in-content/advanced.svg#advanced");
}
2 changes: 2 additions & 0 deletions browser/themes/shared/jar.inc.mn
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,5 @@
skin/classic/browser/privatebrowsing/favicon.svg (../shared/privatebrowsing/favicon.svg)
skin/classic/browser/privatebrowsing/private-browsing.svg (../shared/privatebrowsing/private-browsing.svg)
skin/classic/browser/privatebrowsing/tracking-protection.svg (../shared/privatebrowsing/tracking-protection.svg)

skin/classic/browser/preferences/in-content/advanced.svg (../shared/incontentprefs/advanced.svg)

0 comments on commit 3b74b11

Please sign in to comment.