summaryrefslogtreecommitdiffstats
path: root/application/palemoon/components/preferences/tabs.js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-09-07 02:41:04 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-09-07 02:41:04 +0200
commitd31ab5ff448c6070e04d8913ebeeacfd295c680c (patch)
tree56d56b0a5f30a1faad19f47ae936445b625f0f34 /application/palemoon/components/preferences/tabs.js
parent871530bfe347486cc04653d722040675e8a6f53a (diff)
parent6c4be625921e2974ea230817f882f1a36f55b688 (diff)
downloadUXP-d31ab5ff448c6070e04d8913ebeeacfd295c680c.tar
UXP-d31ab5ff448c6070e04d8913ebeeacfd295c680c.tar.gz
UXP-d31ab5ff448c6070e04d8913ebeeacfd295c680c.tar.lz
UXP-d31ab5ff448c6070e04d8913ebeeacfd295c680c.tar.xz
UXP-d31ab5ff448c6070e04d8913ebeeacfd295c680c.zip
Merge branch 'master' of https://github.com/MoonchildProductions/UXP
Diffstat (limited to 'application/palemoon/components/preferences/tabs.js')
-rw-r--r--application/palemoon/components/preferences/tabs.js54
1 files changed, 4 insertions, 50 deletions
diff --git a/application/palemoon/components/preferences/tabs.js b/application/palemoon/components/preferences/tabs.js
index f0ad8490c..17084a770 100644
--- a/application/palemoon/components/preferences/tabs.js
+++ b/application/palemoon/components/preferences/tabs.js
@@ -85,11 +85,14 @@ var gTabsPane = {
let newtabUrlPref = document.getElementById("browser.newtab.url");
let newtabUrlSanitizedPref = document.getElementById("browser.newtab.myhome");
let newtabUrlChoice = document.getElementById("browser.newtab.choice");
+ let defaultStartupHomepage = Services.prefs.getDefaultBranch("browser.")
+ .getComplexValue("startup.homepage",
+ Components.interfaces.nsIPrefLocalizedString).data;
switch (newtabUrlPref.value) {
case "about:logopage":
newtabUrlChoice.value = 1;
break;
- case "http://start.palemoon.org/":
+ case defaultStartupHomepage:
newtabUrlChoice.value = 2;
break;
case newtabUrlSanitizedPref.value:
@@ -104,54 +107,5 @@ var gTabsPane = {
// We need this to consider instantApply.
this.newtabPageCustom = newtabUrlPref.value;
}
- },
-
- /**
- * Writes browser.newtab.url with the appropriate value.
- * 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 and
- * from browser.newtab.choice's oncommand to consider instantApply.
- */
- writeNewtabUrl: function(newtabUrlChoice) {
- try {
- 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";
- break;
- case 2:
- 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;
- break;
- case 4:
- newtabUrlPref = "about:newtab";
- break;
- default:
- // 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); }
}
};