From 5359706e7ab5d164748786aa2fd040eca52ed5f3 Mon Sep 17 00:00:00 2001 From: JustOff Date: Mon, 3 Sep 2018 21:15:53 +0300 Subject: Update 'browser.newtab.url' when it's used for new tabs and 'browser.startup.homepage' changes --- .../palemoon/components/preferences/tabs.js | 49 ---------------------- 1 file changed, 49 deletions(-) (limited to 'application/palemoon/components/preferences/tabs.js') diff --git a/application/palemoon/components/preferences/tabs.js b/application/palemoon/components/preferences/tabs.js index f0ad8490c..4d57a29fb 100644 --- a/application/palemoon/components/preferences/tabs.js +++ b/application/palemoon/components/preferences/tabs.js @@ -104,54 +104,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); } } }; -- cgit v1.2.3