summaryrefslogtreecommitdiffstats
path: root/application/palemoon/components/preferences/newtaburl.js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-03-29 16:04:01 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-03-29 16:04:01 +0100
commit88083f8c683c18f4de68a20c863a82a9da65db8f (patch)
tree926656892d9d80260da02ea8ea71031b140c51df /application/palemoon/components/preferences/newtaburl.js
parentf999f544aad04069b03704d994a99352263f600b (diff)
parent843e4ceffd6ce21a6e6db37419335eafdc543e18 (diff)
downloadUXP-88083f8c683c18f4de68a20c863a82a9da65db8f.tar
UXP-88083f8c683c18f4de68a20c863a82a9da65db8f.tar.gz
UXP-88083f8c683c18f4de68a20c863a82a9da65db8f.tar.lz
UXP-88083f8c683c18f4de68a20c863a82a9da65db8f.tar.xz
UXP-88083f8c683c18f4de68a20c863a82a9da65db8f.zip
Merge branch 'master' into Sync-weave
Diffstat (limited to 'application/palemoon/components/preferences/newtaburl.js')
-rw-r--r--application/palemoon/components/preferences/newtaburl.js36
1 files changed, 35 insertions, 1 deletions
diff --git a/application/palemoon/components/preferences/newtaburl.js b/application/palemoon/components/preferences/newtaburl.js
index ac0eec1c5..3c82df846 100644
--- a/application/palemoon/components/preferences/newtaburl.js
+++ b/application/palemoon/components/preferences/newtaburl.js
@@ -22,7 +22,11 @@ var gNewtabUrl = {
return;
}
} else {
- newtabUrlChoice = Services.prefs.getIntPref("browser.newtab.choice");
+ if (this.newtabUrlChoiceIsSet) {
+ newtabUrlChoice = Services.prefs.getIntPref("browser.newtab.choice");
+ } else {
+ newtabUrlChoice = this.getNewtabChoice();
+ }
}
if (browserHomepageUrl || browserHomepageUrl == "") {
if (Services.prefs.getBoolPref("browser.preferences.instantApply")) {
@@ -64,5 +68,35 @@ var gNewtabUrl = {
}
Services.prefs.setCharPref("browser.newtab.url",newtabUrlPref);
} catch(e) { console.error(e); }
+ },
+
+ /**
+ * Determines the value of browser.newtab.choice based
+ * on the value of browser.newtab.url
+ *
+ * @returns the value of browser.newtab.choice
+ */
+ getNewtabChoice: function() {
+ let newtabUrlPref = Services.prefs.getCharPref("browser.newtab.url");
+ let browserHomepageUrl = Services.prefs.getComplexValue("browser.startup.homepage",
+ Components.interfaces.nsIPrefLocalizedString).data;
+ let newtabUrlSanitizedPref = browserHomepageUrl.split("|")[0];
+ let defaultStartupHomepage = Services.prefs.getDefaultBranch("browser.")
+ .getComplexValue("startup.homepage",
+ Components.interfaces.nsIPrefLocalizedString).data;
+ switch (newtabUrlPref) {
+ case "about:logopage":
+ return 1;
+ case defaultStartupHomepage:
+ return 2;
+ case newtabUrlSanitizedPref:
+ return 3;
+ case "about:newtab":
+ return 4;
+ default: // Custom URL entered.
+ // We need this to consider instantApply.
+ this.newtabPageCustom = newtabUrlPref;
+ return 0;
+ }
}
};