summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorJeremy Andrews <athenian200@outlook.com>2022-10-02 22:17:27 -0500
committerJeremy Andrews <athenian200@outlook.com>2022-10-02 22:17:27 -0500
commitcb61e1a3543dc1ed017433d0983678225b49a46f (patch)
tree07872f712475f06007b5e5bdfe71547750fef562 /toolkit
parentb83dd4e5e8b95f61fa2c25b1635793f919e4f101 (diff)
downloaduxp-cb61e1a3543dc1ed017433d0983678225b49a46f.tar.gz
Issue #2012 - Allow other UXP applications to use dual-GUID system.
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/mozapps/extensions/internal/AddonRepository.jsm11
-rw-r--r--toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm18
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProvider.jsm18
3 files changed, 23 insertions, 24 deletions
diff --git a/toolkit/mozapps/extensions/internal/AddonRepository.jsm b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
index 9750e99445..044ede8df2 100644
--- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -39,8 +39,10 @@ const PREF_GETADDONS_BROWSERECOMMENDED = "extensions.getAddons.recommended.bro
const PREF_GETADDONS_GETRECOMMENDED = "extensions.getAddons.recommended.url";
const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseURL";
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
-const PREF_GETADDONS_DB_SCHEMA = "extensions.getAddons.databaseSchema"
-
+const PREF_GETADDONS_DB_SCHEMA = "extensions.getAddons.databaseSchema";
+#ifdef MOZ_PHOENIX_EXTENSIONS
+const PREF_FAKEID = "extensions.guid.fakeId";
+#endif
const PREF_METADATA_LASTUPDATE = "extensions.getAddons.cache.lastUpdate";
const PREF_METADATA_UPDATETHRESHOLD_SEC = "extensions.getAddons.cache.updateThreshold";
const DEFAULT_METADATA_UPDATETHRESHOLD_SEC = 172800; // two days
@@ -64,9 +66,6 @@ const BLANK_DB = function() {
}
const TOOLKIT_ID = "toolkit@mozilla.org";
-#ifdef MOZ_PHOENIX_EXTENSIONS
-const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
-#endif
Cu.import("resource://gre/modules/Log.jsm");
const LOGGER_ID = "addons.repository";
@@ -1256,7 +1255,7 @@ this.AddonRepository = {
function isSameApplication(aAppNode) {
#ifdef MOZ_PHOENIX_EXTENSIONS
if (self._getTextContent(aAppNode) == Services.appinfo.ID ||
- self._getTextContent(aAppNode) == FIREFOX_ID) {
+ self._getTextContent(aAppNode) == Services.prefs.getCharPref(PREF_FAKEID)) {
#else
if (self._getTextContent(aAppNode) == Services.appinfo.ID) {
#endif
diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
index 7eb8c9b9d5..7ea92fc1b1 100644
--- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
@@ -24,8 +24,8 @@ const PREFIX_THEME = "urn:mozilla:theme:";
const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml";
const TOOLKIT_ID = "toolkit@mozilla.org";
-const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
-const FIREFOX_APPCOMPATVERSION = "56.9"
+const PREF_FAKEID = "extensions.guid.fakeId";
+const PREF_APPCOMPATVERSION = "extensions.guid.appCompatVersion";
const PREF_UPDATE_REQUIREBUILTINCERTS = "extensions.update.requireBuiltInCerts";
const PREF_EM_MIN_COMPAT_APP_VERSION = "extensions.minCompatibleAppVersion";
@@ -524,12 +524,12 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) {
}
}
#ifdef MOZ_PHOENIX_EXTENSIONS
- else if (FIREFOX_ID in applications) {
+ else if (Services.prefs.getCharPref(PREF_FAKEID) in applications) {
logger.debug("update.json: Dual-GUID targetApplication");
- app = getProperty(applications, FIREFOX_ID, "object");
+ app = getProperty(applications, Services.prefs.getCharPref(PREF_FAKEID), "object");
appEntry = {
- id: FIREFOX_ID,
+ id: Services.prefs.getCharPref(PREF_FAKEID),
minVersion: getRequiredProperty(app, "min_version", "string"),
maxVersion: getRequiredProperty(app, "max_version", "string"),
}
@@ -551,7 +551,7 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) {
appEntry = {
#ifdef MOZ_PHOENIX
- id: FIREFOX_ID,
+ id: Services.prefs.getCharPref(PREF_FAKEID),
minVersion: getProperty(app, "strict_min_version", "string",
Services.prefs.getCharPref(PREF_EM_MIN_COMPAT_APP_VERSION)),
#else
@@ -559,7 +559,7 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) {
minVersion: platformVersion,
#endif
#if defined(MOZ_PHOENIX) && defined(MOZ_PHOENIX_EXTENSIONS)
- maxVersion: FIREFOX_APPCOMPATVERSION,
+ maxVersion: Services.prefs.getCharPref(PREF_APPCOMPATVERSION),
#else
maxVersion: '*',
#endif
@@ -834,7 +834,7 @@ function matchesVersions(aUpdate, aAppVersion, aPlatformVersion,
(aIgnoreMaxVersion || (Services.vc.compare(aAppVersion, app.maxVersion) <= 0));
}
#ifdef MOZ_PHOENIX_EXTENSIONS
- if (app.id == FIREFOX_ID) {
+ if (app.id == Services.prefs.getCharPref(PREF_FAKEID)) {
return (Services.vc.compare(aAppVersion, app.minVersion) >= 0) &&
(aIgnoreMaxVersion || (Services.vc.compare(aAppVersion, app.maxVersion) <= 0));
}
@@ -897,7 +897,7 @@ this.AddonUpdateChecker = {
for (let targetApp of update.targetApplications) {
let id = targetApp.id;
#ifdef MOZ_PHOENIX_EXTENSIONS
- if (id == Services.appinfo.ID || id == FIREFOX_ID ||
+ if (id == Services.appinfo.ID || id == Services.prefs.getCharPref(PREF_FAKEID) ||
id == TOOLKIT_ID)
#else
if (id == Services.appinfo.ID || id == TOOLKIT_ID)
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
index e12549094d..e867a101ac 100644
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -135,8 +135,8 @@ const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#";
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_FAKEID = "extensions.guid.fakeId";
+const PREF_APPCOMPATVERSION = "extensions.guid.appCompatVersion";
#endif
// The value for this is in Makefile.in
@@ -6413,10 +6413,10 @@ AddonInternal.prototype = {
#ifdef MOZ_PHOENIX_EXTENSIONS
this.native = true;
}
- else if (app.id == FIREFOX_ID) {
- version = FIREFOX_APPCOMPATVERSION;
+ else if (app.id == Services.prefs.getCharPref(PREF_FAKEID)) {
+ version = Services.prefs.getCharPref(PREF_APPCOMPATVERSION);
if (this.type != "extension")
- //Only allow extensions in Firefox compatibility mode
+ //Only allow extensions in Fake GUID compatibility mode
return false;
#endif
}
@@ -6447,7 +6447,7 @@ AddonInternal.prototype = {
// Extremely old extensions should not be compatible by default.
let minCompatVersion;
#ifdef MOZ_PHOENIX_EXTENSIONS
- if (app.id == Services.appinfo.ID || app.id == FIREFOX_ID)
+ if (app.id == Services.appinfo.ID || app.id == Services.prefs.getCharPref(PREF_FAKEID))
#else
if (app.id == Services.appinfo.ID)
#endif
@@ -6475,13 +6475,13 @@ AddonInternal.prototype = {
app = targetApp;
}
#ifdef MOZ_PHOENIX_EXTENSIONS
- // Special case: check for Firefox TargetApps. this has to be done AFTER
+ // Special case: check for Fake GUID 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.
+ // Fake GUID is listed before it in the install manifest.
// Only do this for extensions. Other types should not be allowed.
if (this.type == "extension") {
for (let targetApp of this.targetApplications) {
- if (targetApp.id == FIREFOX_ID) //Firefox GUID
+ if (targetApp.id == Services.prefs.getCharPref(PREF_FAKEID)) //Fake GUID
return targetApp;
}
}