summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-01-21 18:50:02 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-01-21 18:50:02 +0100
commit4d6ac28d3114e2eca2313019372f9761ca1a1885 (patch)
treef854bc7d5787f18719a15137c48352dd9b84410f
parenta7f63b58f314b3e50e55c5b9d4ac623b6d5af2f3 (diff)
downloaduxp-4d6ac28d3114e2eca2313019372f9761ca1a1885.tar.gz
Issue #1318 - Make the conversion into an addition, instead.
-rw-r--r--modules/libpref/init/all.js2
-rw-r--r--toolkit/mozapps/extensions/content/extensions.xml5
-rw-r--r--toolkit/mozapps/extensions/internal/AddonRepository.jsm14
-rw-r--r--toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm25
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProvider.jsm19
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProviderUtils.js2
-rw-r--r--toolkit/mozapps/extensions/internal/moz.build4
7 files changed, 54 insertions, 17 deletions
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 37eea95e26..43212888ba 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4671,8 +4671,10 @@ pref("xpinstall.signatures.required", false);
pref("extensions.alwaysUnpack", false);
pref("extensions.minCompatiblePlatformVersion", "2.0");
pref("extensions.webExtensionsMinPlatformVersion", "42.0a1");
+#ifdef MOZ_PHOENIX_EXTENSIONS
// Additionally allow Firefox-only extensions?
pref("extensions.phoenixCompatibility", false);
+#endif
// Other webextensions prefs
pref("extensions.webextensions.keepStorageOnUninstall", false);
diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml
index 0353dcad38..543b79c9ec 100644
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -857,9 +857,10 @@
<xul:label anonid="name" class="name" crop="end" flex="1"
xbl:inherits="value=name,tooltiptext=name"/>
<xul:label anonid="version" class="version"/>
- <!-- phoenix compat indicator -->
+#ifdef MOZ_PHOENIX_EXTENSIONS
<xul:label class="nativeIndicator nativeAddon" value="●" tooltiptext="&addon.nativeAddon;"/>
<xul:label class="nativeIndicator compatAddon" value="●" tooltiptext="&addon.compatAddon;"/>
+#endif
<xul:label class="disabled-postfix" value="&addon.disabled.postfix;"/>
<xul:label class="update-postfix" value="&addon.update.postfix;"/>
<xul:spacer flex="5000"/> <!-- Necessary to make the name crop -->
@@ -1357,11 +1358,13 @@
[this.mAddon.name], 1);
} else {
this.removeAttribute("notification");
+#ifdef MOZ_PHOENIX_EXTENSIONS
if (Services.prefs.getBoolPref("extensions.phoenixCompatibility", false) &&
this.mAddon.type == "extension") {
// Setting this attribute will reveal the compatibility indicator
this.setAttribute("native", this.mAddon.native);
}
+#endif
}
}
diff --git a/toolkit/mozapps/extensions/internal/AddonRepository.jsm b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
index aad31d144d..97f823f47c 100644
--- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -45,8 +45,6 @@ const PREF_METADATA_LASTUPDATE = "extensions.getAddons.cache.lastUpdat
const PREF_METADATA_UPDATETHRESHOLD_SEC = "extensions.getAddons.cache.updateThreshold";
const DEFAULT_METADATA_UPDATETHRESHOLD_SEC = 172800; // two days
-const PREF_PHOENIXCOMPATIBILITY = "extensions.phoenixCompatibility"; // dual-GUID
-
const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml";
const API_VERSION = "1.5";
@@ -65,9 +63,11 @@ const BLANK_DB = function() {
};
}
-const TOOLKIT_ID = "toolkit@mozilla.org";
-const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
-
+const TOOLKIT_ID = "toolkit@mozilla.org";
+#ifdef MOZ_PHOENIX_EXTENSIONS
+const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
+const PREF_PHOENIXCOMPATIBILITY = "extensions.phoenixCompatibility"; // dual-GUID
+#endif
Cu.import("resource://gre/modules/Log.jsm");
const LOGGER_ID = "addons.repository";
@@ -1255,9 +1255,13 @@ this.AddonRepository = {
let results = [];
function isSameApplication(aAppNode) {
+#ifdef MOZ_PHOENIX_EXTENSIONS
let phoenixCompat = Services.prefs.getBoolPref(PREF_PHOENIXCOMPATIBILITY, false);
if (self._getTextContent(aAppNode) == Services.appinfo.ID ||
(phoenixCompat && self._getTextContent(aAppNode) == FIREFOX_ID)) {
+#else
+ if (self._getTextContent(aAppNode) == Services.appinfo.ID) {
+#endif
return true;
}
return false;
diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
index 93875aa4fc..75d903952e 100644
--- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
@@ -24,12 +24,14 @@ const PREFIX_THEME = "urn:mozilla:theme:";
const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml";
const TOOLKIT_ID = "toolkit@mozilla.org";
+#ifdef MOZ_PHOENIX_EXTENSIONS
const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
const FIREFOX_APPCOMPATVERSION = "56.9"
+const PREF_PHOENIXCOMPATIBILITY = "extensions.phoenixCompatibility";
+#endif
const PREF_UPDATE_REQUIREBUILTINCERTS = "extensions.update.requireBuiltInCerts";
const PREF_EM_MIN_COMPAT_APP_VERSION = "extensions.minCompatibleAppVersion";
-const PREF_PHOENIXCOMPATIBILITY = "extensions.phoenixCompatibility";
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -499,7 +501,9 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) {
let appID = Services.appinfo.ID;
let platformVersion = Services.appinfo.platformVersion;
+#ifdef MOZ_PHOENIX_EXTENSIONS
let phoenixCompat = Services.prefs.getBoolPref(PREF_PHOENIXCOMPATIBILITY, false);
+#endif
// The list of available updates
let updates = getProperty(addon, "updates", "array", []);
@@ -525,6 +529,7 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) {
maxVersion: getRequiredProperty(app, "max_version", "string"),
}
}
+#ifdef MOZ_PHOENIX_EXTENSIONS
else if (phoenixCompat && FIREFOX_ID in applications) {
logger.debug("update.json: Dual-GUID targetApplication");
app = getProperty(applications, FIREFOX_ID, "object");
@@ -535,6 +540,7 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) {
maxVersion: getRequiredProperty(app, "max_version", "string"),
}
}
+#endif
else if (TOOLKIT_ID in applications) {
logger.debug("update.json: Toolkit targetApplication");
app = getProperty(applications, TOOLKIT_ID, "object");
@@ -560,7 +566,7 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) {
#endif
maxVersion: '*',
};
-#ifdef MOZ_PHOENIX
+#if defined(MOZ_PHOENIX) && defined(MOZ_PHOENIX_EXTENSIONS)
if (phoenixCompat) {
appEntry.maxVersion = FIREFOX_APPCOMPATVERSION;
}
@@ -820,17 +826,21 @@ function matchesVersions(aUpdate, aAppVersion, aPlatformVersion,
if (aUpdate.strictCompatibility && !aIgnoreStrictCompat)
aIgnoreMaxVersion = false;
+#ifdef MOZ_PHOENIX_EXTENSIONS
let phoenixCompat = Services.prefs.getBoolPref(PREF_PHOENIXCOMPATIBILITY, false);
+#endif
let result = false;
for (let app of aUpdate.targetApplications) {
if (app.id == Services.appinfo.ID) {
return (Services.vc.compare(aAppVersion, app.minVersion) >= 0) &&
(aIgnoreMaxVersion || (Services.vc.compare(aAppVersion, app.maxVersion) <= 0));
}
+#ifdef MOZ_PHOENIX_EXTENSIONS
if (phoenixCompat && app.id == FIREFOX_ID) {
return (Services.vc.compare(aAppVersion, app.minVersion) >= 0) &&
(aIgnoreMaxVersion || (Services.vc.compare(aAppVersion, app.maxVersion) <= 0));
}
+#endif
if (app.id == TOOLKIT_ID) {
result = (Services.vc.compare(aPlatformVersion, app.minVersion) >= 0) &&
(aIgnoreMaxVersion || (Services.vc.compare(aPlatformVersion, app.maxVersion) <= 0));
@@ -882,15 +892,20 @@ this.AddonUpdateChecker = {
aAppVersion = Services.appinfo.version;
if (!aPlatformVersion)
aPlatformVersion = Services.appinfo.platformVersion;
+#ifdef MOZ_PHOENIX_EXTENSIONS
let phoenixCompat = Services.prefs.getBoolPref(PREF_PHOENIXCOMPATIBILITY, false);
+#endif
for (let update of aUpdates) {
if (Services.vc.compare(update.version, aVersion) == 0) {
if (aIgnoreCompatibility) {
for (let targetApp of update.targetApplications) {
let id = targetApp.id;
- if (id == Services.appinfo.ID ||
- id == TOOLKIT_ID ||
- (phoenixCompat && id == FIREFOX_ID)) {
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ if (id == Services.appinfo.ID || (phoenixCompat && id == FIREFOX_ID) ||
+ id == TOOLKIT_ID)
+#else
+ if (id == Services.appinfo.ID || id == TOOLKIT_ID)
+#endif
return update;
}
}
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
index 3c3a9829fb..c4688e391b 100644
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -95,7 +95,6 @@ const PREF_INTERPOSITION_ENABLED = "extensions.interposition.enabled";
const PREF_EM_MIN_COMPAT_APP_VERSION = "extensions.minCompatibleAppVersion";
const PREF_EM_MIN_COMPAT_PLATFORM_VERSION = "extensions.minCompatiblePlatformVersion";
-const PREF_PHOENIXCOMPATIBILITY = "extensions.phoenixCompatibility";
const URI_EXTENSION_SELECT_DIALOG = "chrome://mozapps/content/extensions/selectAddons.xul";
const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
@@ -139,6 +138,7 @@ const TOOLKIT_ID = "toolkit@mozilla.org";
#ifdef MOZ_PHOENIX_EXTENSIONS
const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
const FIREFOX_APPCOMPATVERSION = "56.9"
+const PREF_PHOENIXCOMPATIBILITY = "extensions.phoenixCompatibility";
#endif
// The value for this is in Makefile.in
@@ -6453,7 +6453,6 @@ AddonInternal.prototype = {
}
let app = this.matchingTargetApplication;
- let phoenixCompat = Services.prefs.getBoolPref(PREF_PHOENIXCOMPATIBILITY, false);
if (!app)
return false;
@@ -6463,11 +6462,15 @@ AddonInternal.prototype = {
if (!aPlatformVersion)
aPlatformVersion = Services.appinfo.platformVersion;
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ let phoenixCompat = Services.prefs.getBoolPref(PREF_PHOENIXCOMPATIBILITY, false);
this.native = false;
+#endif
let version;
if (app.id == Services.appinfo.ID) {
version = aAppVersion;
+#ifdef MOZ_PHOENIX_EXTENSIONS
this.native = true;
}
else if (phoenixCompat && app.id == FIREFOX_ID) {
@@ -6475,6 +6478,7 @@ AddonInternal.prototype = {
if (this.type == "locale")
//Never allow language packs in Firefox compatibility mode
return false;
+#endif
}
else if (app.id == TOOLKIT_ID)
version = aPlatformVersion
@@ -6498,7 +6502,11 @@ AddonInternal.prototype = {
// Extremely old extensions should not be compatible by default.
let minCompatVersion;
+#ifdef MOZ_PHOENIX_EXTENSIONS
if (app.id == Services.appinfo.ID || (phoenixCompat && app.id == FIREFOX_ID))
+#else
+ if (app.id == Services.appinfo.ID)
+#endif
minCompatVersion = XPIProvider.minCompatibleAppVersion;
else if (app.id == TOOLKIT_ID)
minCompatVersion = XPIProvider.minCompatiblePlatformVersion;
@@ -6516,15 +6524,14 @@ AddonInternal.prototype = {
get matchingTargetApplication() {
let app = null;
- let phoenixCompat = Services.prefs.getBoolPref(PREF_PHOENIXCOMPATIBILITY, false);
for (let targetApp of this.targetApplications) {
if (targetApp.id == Services.appinfo.ID)
return targetApp;
if (targetApp.id == TOOLKIT_ID)
app = targetApp;
}
-
- if (phoenixCompat) {
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ if (Services.prefs.getBoolPref(PREF_PHOENIXCOMPATIBILITY, false)) {
//Special case: check for Firefox TargetApps. this has to be done AFTER
//the initial check to make sure appinfo.ID is preferred, even if
//Firefox is listed before it in the install manifest.
@@ -6533,7 +6540,7 @@ AddonInternal.prototype = {
return targetApp;
}
}
-
+#endif
// Return toolkit ID if toolkit.
return app;
},
diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
index 2e617fc138..69d774e4a0 100644
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -71,7 +71,9 @@ const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type",
"softDisabled", "foreignInstall", "hasBinaryComponents",
"strictCompatibility", "locales", "targetApplications",
"targetPlatforms", "multiprocessCompatible",
+#ifdef MOZ_PHOENIX_EXTENSIONS
"native"
+#endif
];
// Time to wait before async save of XPI JSON database, in milliseconds
diff --git a/toolkit/mozapps/extensions/internal/moz.build b/toolkit/mozapps/extensions/internal/moz.build
index a299d243ce..337df3104e 100644
--- a/toolkit/mozapps/extensions/internal/moz.build
+++ b/toolkit/mozapps/extensions/internal/moz.build
@@ -34,3 +34,7 @@ DEFINES['MOZ_EXTENSIONS_DB_SCHEMA'] = 16
# Additional debugging info is exposed in debug builds
if CONFIG['MOZ_EM_DEBUG']:
DEFINES['MOZ_EM_DEBUG'] = 1
+
+# Apperently this needs to be defined because it isn't picked up automagically any more
+if CONFIG['MOZ_PHOENIX_EXTENSIONS']:
+ DEFINES['MOZ_PHOENIX_EXTENSIONS'] = 1 \ No newline at end of file