mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-07 07:47:30 +09:00
Prevent mistaken overwriting of browser.newtab.url when using the browser preferences dialog
This commit is contained in:
parent
091435f2fd
commit
3b9e91ba75
2 changed files with 39 additions and 26 deletions
|
|
@ -78,34 +78,13 @@ var gTabsPane = {
|
|||
/**
|
||||
* Determines the value of the New Tab display drop-down based
|
||||
* on the value of browser.newtab.url.
|
||||
*
|
||||
* @returns the appropriate value of browser.newtab.choice
|
||||
*/
|
||||
readNewtabUrl: function() {
|
||||
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 defaultStartupHomepage:
|
||||
newtabUrlChoice.value = 2;
|
||||
break;
|
||||
case newtabUrlSanitizedPref.value:
|
||||
newtabUrlChoice.value = 3;
|
||||
break;
|
||||
case "about:newtab":
|
||||
newtabUrlChoice.value = 4;
|
||||
break;
|
||||
default: // Custom URL entered.
|
||||
document.getElementById("newtabPageCustom").hidden = false;
|
||||
newtabUrlChoice.value = 0;
|
||||
// We need this to consider instantApply.
|
||||
this.newtabPageCustom = newtabUrlPref.value;
|
||||
newtabUrlChoice.value = gNewtabUrl.getNewtabChoice();
|
||||
if (newtabUrlChoice.value == 0) {
|
||||
document.getElementById("newtabPageCustom").hidden = false;
|
||||
}
|
||||
gNewtabUrl.newtabUrlChoiceIsSet = true;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue