mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 15:27:30 +09:00
Sync Pale Moon code
This commit is contained in:
parent
8a0a9fcfa5
commit
1648d92f30
15 changed files with 74 additions and 26 deletions
|
|
@ -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); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue