diff options
Diffstat (limited to 'application/palemoon/components/preferences')
4 files changed, 34 insertions, 35 deletions
diff --git a/application/palemoon/components/preferences/aboutPermissions.js b/application/palemoon/components/preferences/aboutPermissions.js index 4d803145d..106d45f89 100644 --- a/application/palemoon/components/preferences/aboutPermissions.js +++ b/application/palemoon/components/preferences/aboutPermissions.js @@ -2,9 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -let Ci = Components.interfaces; -let Cc = Components.classes; -let Cu = Components.utils; +var Ci = Components.interfaces; +var Cc = Components.classes; +var Cu = Components.utils; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/PluralForm.jsm"); diff --git a/application/palemoon/components/preferences/security.js b/application/palemoon/components/preferences/security.js index a337f398c..56664bf66 100644 --- a/application/palemoon/components/preferences/security.js +++ b/application/palemoon/components/preferences/security.js @@ -3,6 +3,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper", + "resource://gre/modules/LoginHelper.jsm"); + Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); var gSecurityPane = { @@ -141,7 +144,7 @@ var gSecurityPane = { */ _initMasterPasswordUI: function () { - var noMP = !this._masterPasswordSet(); + var noMP = !LoginHelper.isMasterPasswordSet(); var button = document.getElementById("changeMasterPassword"); button.disabled = noMP; @@ -151,26 +154,6 @@ var gSecurityPane = { }, /** - * Returns true if the user has a master password set and false otherwise. - */ - _masterPasswordSet: function () - { - const Cc = Components.classes, Ci = Components.interfaces; - var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"]. - getService(Ci.nsIPKCS11ModuleDB); - var slot = secmodDB.findSlotByName(""); - if (slot) { - var status = slot.status; - var hasMP = status != Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED && - status != Ci.nsIPKCS11Slot.SLOT_READY; - return hasMP; - } else { - // XXX I have no bloody idea what this means - return false; - } - }, - - /** * Enables/disables the master password button depending on the state of the * "use master password" checkbox, and prompts for master password removal if * one is set. diff --git a/application/palemoon/components/preferences/tabs.js b/application/palemoon/components/preferences/tabs.js index 9e15d8bb4..f0ad8490c 100644 --- a/application/palemoon/components/preferences/tabs.js +++ b/application/palemoon/components/preferences/tabs.js @@ -89,7 +89,7 @@ var gTabsPane = { case "about:logopage": newtabUrlChoice.value = 1; break; - case "https://start.palemoon.org/": + case "http://start.palemoon.org/": newtabUrlChoice.value = 2; break; case newtabUrlSanitizedPref.value: @@ -101,6 +101,8 @@ var gTabsPane = { default: // Custom URL entered. document.getElementById("newtabPageCustom").hidden = false; newtabUrlChoice.value = 0; + // We need this to consider instantApply. + this.newtabPageCustom = newtabUrlPref.value; } }, @@ -109,32 +111,45 @@ var gTabsPane = { * if the choice is "my home page", get and sanitize the browser home page * URL to make it suitable for newtab use. * - * Called from prefwindow's ondialogaccept handler. + * Called from prefwindow's ondialogaccept handler and + * from browser.newtab.choice's oncommand to consider instantApply. */ - writeNewtabUrl: function() { + writeNewtabUrl: function(newtabUrlChoice) { try { - let newtabUrlChoice = Services.prefs.getIntPref("browser.newtab.choice"); - let browserHomepageUrl = Services.prefs.getCharPref("browser.startup.homepage"); + if (newtabUrlChoice) { + if (Services.prefs.getBoolPref("browser.preferences.instantApply")) { + newtabUrlChoice = parseInt(newtabUrlChoice); + } else { + return; + } + } else { + newtabUrlChoice = Services.prefs.getIntPref("browser.newtab.choice"); + } + let browserHomepageUrl = Services.prefs.getComplexValue("browser.startup.homepage", + Components.interfaces.nsIPrefLocalizedString).data; let newtabUrlPref = Services.prefs.getCharPref("browser.newtab.url"); switch (newtabUrlChoice) { case 1: - newtabUrlPref="about:logopage"; + newtabUrlPref = "about:logopage"; break; case 2: - newtabUrlPref="https://start.palemoon.org/"; + newtabUrlPref = "http://start.palemoon.org/"; break; case 3: // If url is a pipe-delimited set of pages, just take the first one. let newtabUrlSanitizedPref=browserHomepageUrl.split("|")[0]; // XXX: do we need extra sanitation here, e.g. for invalid URLs? Services.prefs.setCharPref("browser.newtab.myhome", newtabUrlSanitizedPref); - newtabUrlPref=newtabUrlSanitizedPref; + newtabUrlPref = newtabUrlSanitizedPref; break; case 4: - newtabUrlPref="about:newtab"; + newtabUrlPref = "about:newtab"; break; default: - // In case of any other value it's a custom URL, so don't change anything... + // In case of any other value it's a custom URL, consider instantApply. + if (this.newtabPageCustom) { + newtabUrlPref = this.newtabPageCustom; + } } Services.prefs.setCharPref("browser.newtab.url",newtabUrlPref); } catch(e) { console.error(e); } diff --git a/application/palemoon/components/preferences/tabs.xul b/application/palemoon/components/preferences/tabs.xul index fc15a87ef..f5b44b776 100644 --- a/application/palemoon/components/preferences/tabs.xul +++ b/application/palemoon/components/preferences/tabs.xul @@ -84,7 +84,8 @@ <label value="&newtabPage.label;"/> <menulist id="newtabPage" - preference="browser.newtab.choice"> + preference="browser.newtab.choice" + oncommand="gTabsPane.writeNewtabUrl(event.target.value);"> <menupopup> <menuitem label="&newtabPage.custom.label;" value="0" id="newtabPageCustom" hidden="true" /> <menuitem label="&newtabPage.blank.label;" value="1" /> |