Bug 1359276 Part 1 Use a lazy preference getter for app.support.baseURL
MozReview-Commit-ID: 1hjioz5iso
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -43,16 +43,19 @@ XPCOMUtils.defineLazyModuleGetter(this,
XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
"resource:///modules/experiments/Experiments.jsm");
XPCOMUtils.defineLazyPreferenceGetter(this, "WEBEXT_PERMISSION_PROMPTS",
"extensions.webextPermissionPrompts", false);
XPCOMUtils.defineLazyPreferenceGetter(this, "ALLOW_NON_MPC",
"extensions.allow-non-mpc-extensions", true);
+XPCOMUtils.defineLazyPreferenceGetter(this, "SUPPORT_URL", "app.support.baseURL",
+ "", null, val => Services.urlFormatter.formatURL(val));
+
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane";
const PREF_XPI_ENABLED = "xpinstall.enabled";
const PREF_MAXRESULTS = "extensions.getAddons.maxResults";
const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
const PREF_GETADDONS_CACHE_ID_ENABLED = "extensions.%ID%.getAddons.cache.enabled";
const PREF_UI_TYPE_HIDDEN = "extensions.ui.%TYPE%.hidden";
const PREF_UI_LASTCATEGORY = "extensions.ui.lastCategory";
@@ -2821,18 +2824,17 @@ var gListView = {
this._listBox.addEventListener("keydown", (aEvent) => {
if (aEvent.keyCode == aEvent.DOM_VK_RETURN) {
var item = this._listBox.selectedItem;
if (item)
item.showInDetailView();
}
});
- document.getElementById("signing-learn-more").setAttribute("href",
- Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons");
+ document.getElementById("signing-learn-more").setAttribute("href", SUPPORT_URL + "unsigned-addons");
let findSignedAddonsLink = document.getElementById("find-alternative-addons");
try {
findSignedAddonsLink.setAttribute("href",
Services.urlFormatter.formatURLPref("extensions.getAddons.link.url"));
} catch (e) {
findSignedAddonsLink.classList.remove("text-link");
}
@@ -2841,17 +2843,17 @@ var gListView = {
document.getElementById("signing-dev-manual-link").setAttribute("href",
Services.prefs.getCharPref("xpinstall.signatures.devInfoURL"));
} catch (e) {
document.getElementById("signing-dev-info").hidden = true;
}
if (Preferences.get("plugin.load_flash_only", true)) {
document.getElementById("plugindeprecation-learnmore-link")
- .setAttribute("href", Services.urlFormatter.formatURLPref("app.support.baseURL") + "npapi");
+ .setAttribute("href", SUPPORT_URL + "npapi");
} else {
document.getElementById("plugindeprecation-notice").hidden = true;
}
if (Preferences.get("extensions.getAddons.themes.browseURL", "")) {
document.getElementById("getthemes-learnmore-link")
.setAttribute("href", Services.urlFormatter.formatURLPref("extensions.getAddons.themes.browseURL"));
} else {
@@ -3396,17 +3398,17 @@ var gDetailView = {
errorLink.hidden = false;
} else if (!isCorrectlySigned(this._addon) && SIGNING_REQUIRED) {
this.node.setAttribute("notification", "error");
document.getElementById("detail-error").textContent = gStrings.ext.formatStringFromName(
"details.notification.unsignedAndDisabled", [this._addon.name, gStrings.brandShortName], 2
);
let errorLink = document.getElementById("detail-error-link");
errorLink.value = gStrings.ext.GetStringFromName("details.notification.unsigned.link");
- errorLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons";
+ errorLink.href = SUPPORT_URL + "unsigned-addons";
errorLink.hidden = false;
} else if (!this._addon.isCompatible && (AddonManager.checkCompatibility ||
(this._addon.blocklistState != Ci.nsIBlocklistService.STATE_SOFTBLOCKED))) {
this.node.setAttribute("notification", "warning");
document.getElementById("detail-warning").textContent = gStrings.ext.formatStringFromName(
"details.notification.incompatible",
[this._addon.name, gStrings.brandShortName, gStrings.appVersion], 3
);
@@ -3421,17 +3423,17 @@ var gDetailView = {
errorLink.href = "https://wiki.mozilla.org/Add-ons/ShimsNightly";
} else if (!isCorrectlySigned(this._addon)) {
this.node.setAttribute("notification", "warning");
document.getElementById("detail-warning").textContent = gStrings.ext.formatStringFromName(
"details.notification.unsigned", [this._addon.name, gStrings.brandShortName], 2
);
var warningLink = document.getElementById("detail-warning-link");
warningLink.value = gStrings.ext.GetStringFromName("details.notification.unsigned.link");
- warningLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons";
+ warningLink.href = SUPPORT_URL + "unsigned-addons";
warningLink.hidden = false;
} else if (this._addon.blocklistState == Ci.nsIBlocklistService.STATE_SOFTBLOCKED) {
this.node.setAttribute("notification", "warning");
document.getElementById("detail-warning").textContent = gStrings.ext.formatStringFromName(
"details.notification.softblocked",
[this._addon.name], 1
);
let warningLink = document.getElementById("detail-warning-link");
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -1302,17 +1302,17 @@
this._errorLink.href = this.mAddon.blocklistURL;
this._errorLink.hidden = false;
} else if (!isUpgrade && !isCorrectlySigned(this.mAddon) && SIGNING_REQUIRED) {
this.setAttribute("notification", "error");
this._error.textContent = gStrings.ext.formatStringFromName(
"notification.unsignedAndDisabled", [this.mAddon.name, gStrings.brandShortName], 2
);
this._errorLink.value = gStrings.ext.GetStringFromName("notification.unsigned.link");
- this._errorLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons";
+ this._errorLink.href = SUPPORT_URL + "unsigned-addons";
this._errorLink.hidden = false;
} else if ((!isUpgrade && !this.mAddon.isCompatible) && (AddonManager.checkCompatibility
|| (this.mAddon.blocklistState != Ci.nsIBlocklistService.STATE_SOFTBLOCKED))) {
this.setAttribute("notification", "warning");
this._warning.textContent = gStrings.ext.formatStringFromName(
"notification.incompatible",
[this.mAddon.name, gStrings.brandShortName, gStrings.appVersion], 3
);
@@ -1329,17 +1329,17 @@
this._errorLink.href = "https://wiki.mozilla.org/Add-ons/ShimsNightly";
this._errorLink.hidden = false;
} else if (!isUpgrade && !isCorrectlySigned(this.mAddon)) {
this.setAttribute("notification", "warning");
this._warning.textContent = gStrings.ext.formatStringFromName(
"notification.unsigned", [this.mAddon.name, gStrings.brandShortName], 2
);
this._warningLink.value = gStrings.ext.GetStringFromName("notification.unsigned.link");
- this._warningLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons";
+ this._warningLink.href = SUPPORT_URL + "unsigned-addons";
this._warningLink.hidden = false;
} else if (!isUpgrade && this.mAddon.blocklistState == Ci.nsIBlocklistService.STATE_SOFTBLOCKED) {
this.setAttribute("notification", "warning");
this._warning.textContent = gStrings.ext.formatStringFromName(
"notification.softblocked",
[this.mAddon.name], 1
);
this._warningLink.value = gStrings.ext.GetStringFromName("notification.softblocked.link");