mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1226386: Remove most of the preprocessing from the add-ons manager. r=gps
For build speed, for correct line numbers in errors, for faster development, for so many reasons. Still a couple of cases left mostly in XUL files for different strings on Windows. Bonus: The new lexical scope means ADDON_SIGNING and REQUIRE_SIGNING can just be declared as regular constants and outside code can't get to them easily.
This commit is contained in:
parent
e57ecaa9f7
commit
2d1f1a0303
@ -8988,11 +8988,6 @@ AC_SUBST(DMG_TOOL)
|
||||
dnl Host JavaScript runtime, if any, to use during cross compiles.
|
||||
AC_SUBST(JS_BINARY)
|
||||
|
||||
if test "$MOZ_DEBUG"; then
|
||||
MOZ_EM_DEBUG=1
|
||||
fi
|
||||
AC_SUBST(MOZ_EM_DEBUG)
|
||||
|
||||
AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
|
||||
|
||||
if test -n "$COMPILE_ENVIRONMENT"; then
|
||||
|
@ -21,6 +21,9 @@ if ("@mozilla.org/xre/app-info;1" in Cc) {
|
||||
}
|
||||
}
|
||||
|
||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
const MOZ_COMPATIBILITY_NIGHTLY = !['aurora', 'beta', 'release', 'esr'].includes(AppConstants.MOZ_UPDATE_CHANNEL);
|
||||
|
||||
const PREF_BLOCKLIST_PINGCOUNTVERSION = "extensions.blocklist.pingCountVersion";
|
||||
const PREF_DEFAULT_PROVIDERS_ENABLED = "extensions.defaultProviders.enabled";
|
||||
@ -55,11 +58,9 @@ const FILE_BLOCKLIST = "blocklist.xml";
|
||||
|
||||
const BRANCH_REGEXP = /^([^\.]+\.[0-9]+[a-z]*).*/gi;
|
||||
const PREF_EM_CHECK_COMPATIBILITY_BASE = "extensions.checkCompatibility";
|
||||
#ifdef MOZ_COMPATIBILITY_NIGHTLY
|
||||
var PREF_EM_CHECK_COMPATIBILITY = PREF_EM_CHECK_COMPATIBILITY_BASE + ".nightly";
|
||||
#else
|
||||
var PREF_EM_CHECK_COMPATIBILITY;
|
||||
#endif
|
||||
var PREF_EM_CHECK_COMPATIBILITY = MOZ_COMPATIBILITY_NIGHTLY ?
|
||||
PREF_EM_CHECK_COMPATIBILITY_BASE + ".nightly" :
|
||||
undefined;
|
||||
|
||||
const TOOLKIT_ID = "toolkit@mozilla.org";
|
||||
|
||||
@ -911,10 +912,10 @@ var AddonManagerInternal = {
|
||||
this.validateBlocklist();
|
||||
}
|
||||
|
||||
#ifndef MOZ_COMPATIBILITY_NIGHTLY
|
||||
PREF_EM_CHECK_COMPATIBILITY = PREF_EM_CHECK_COMPATIBILITY_BASE + "." +
|
||||
Services.appinfo.version.replace(BRANCH_REGEXP, "$1");
|
||||
#endif
|
||||
if (!MOZ_COMPATIBILITY_NIGHTLY) {
|
||||
PREF_EM_CHECK_COMPATIBILITY = PREF_EM_CHECK_COMPATIBILITY_BASE + "." +
|
||||
Services.appinfo.version.replace(BRANCH_REGEXP, "$1");
|
||||
}
|
||||
|
||||
try {
|
||||
gCheckCompatibility = Services.prefs.getBoolPref(PREF_EM_CHECK_COMPATIBILITY);
|
||||
@ -3138,11 +3139,9 @@ this.AddonManager = {
|
||||
// case-by-case basis.
|
||||
STATE_ASK_TO_ACTIVATE: "askToActivate",
|
||||
|
||||
#ifdef MOZ_EM_DEBUG
|
||||
get __AddonManagerInternal__() {
|
||||
return AddonManagerInternal;
|
||||
return AppConstants.DEBUG ? AddonManagerInternal : undefined;
|
||||
},
|
||||
#endif
|
||||
|
||||
get isReady() {
|
||||
return gStartupComplete && !gShutdownInProgress;
|
||||
|
@ -15,6 +15,12 @@ Cu.import("resource://gre/modules/DownloadUtils.jsm");
|
||||
Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
Cu.import("resource://gre/modules/addons/AddonRepository.jsm");
|
||||
|
||||
const CONSTANTS = {};
|
||||
Cu.import("resource://gre/modules/addons/AddonConstants.jsm", CONSTANTS);
|
||||
const SIGNING_REQUIRED = CONSTANTS.REQUIRE_SIGNING ?
|
||||
true :
|
||||
Services.prefs.getBoolPref("xpinstall.signatures.required");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
|
||||
"resource://gre/modules/PluralForm.jsm");
|
||||
|
||||
@ -3796,9 +3802,3 @@ var gDragDrop = {
|
||||
aEvent.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_REQUIRE_SIGNING
|
||||
const SIGNING_REQUIRED = true;
|
||||
#else
|
||||
const SIGNING_REQUIRED = Services.prefs.getBoolPref("xpinstall.signatures.required");
|
||||
#endif
|
||||
|
31
toolkit/mozapps/extensions/internal/AddonConstants.jsm
Normal file
31
toolkit/mozapps/extensions/internal/AddonConstants.jsm
Normal file
@ -0,0 +1,31 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ "ADDON_SIGNING", "REQUIRE_SIGNING" ];
|
||||
|
||||
// Make these non-changable properties so they can't be manipulated from other
|
||||
// code in the app.
|
||||
Object.defineProperty(this, "ADDON_SIGNING", {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
#ifdef MOZ_ADDON_SIGNING
|
||||
value: true,
|
||||
#else
|
||||
value: false,
|
||||
#endif
|
||||
});
|
||||
|
||||
Object.defineProperty(this, "REQUIRE_SIGNING", {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
#ifdef MOZ_REQUIRE_SIGNING
|
||||
value: true,
|
||||
#else
|
||||
value: false,
|
||||
#endif
|
||||
});
|
@ -11,10 +11,14 @@ const Cu = Components.utils;
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["XPIProvider"];
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||
Components.utils.import("resource://gre/modules/Preferences.jsm");
|
||||
const CONSTANTS = {};
|
||||
Cu.import("resource://gre/modules/addons/AddonConstants.jsm", CONSTANTS);
|
||||
const { ADDON_SIGNING, REQUIRE_SIGNING } = CONSTANTS
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
Cu.import("resource://gre/modules/Preferences.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository",
|
||||
"resource://gre/modules/addons/AddonRepository.jsm");
|
||||
@ -48,6 +52,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "ProductAddonChecker",
|
||||
"resource://gre/modules/addons/ProductAddonChecker.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
|
||||
"resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "Blocklist",
|
||||
"@mozilla.org/extensions/blocklist;1",
|
||||
@ -158,9 +164,8 @@ const TOOLKIT_ID = "toolkit@mozilla.org";
|
||||
|
||||
const XPI_SIGNATURE_CHECK_PERIOD = 24 * 60 * 60;
|
||||
|
||||
// The value for this is in Makefile.in
|
||||
#expand const DB_SCHEMA = __MOZ_EXTENSIONS_DB_SCHEMA__;
|
||||
XPCOMUtils.defineConstant(this, "DB_SCHEMA", DB_SCHEMA);
|
||||
XPCOMUtils.defineConstant(this, "DB_SCHEMA", 17);
|
||||
|
||||
const NOTIFICATION_TOOLBOXPROCESS_LOADED = "ToolboxProcessLoaded";
|
||||
|
||||
// Properties that exist in the install manifest
|
||||
@ -288,6 +293,7 @@ function loadLazyObjects() {
|
||||
ADDON_SIGNING,
|
||||
SIGNED_TYPES,
|
||||
BOOTSTRAP_REASONS,
|
||||
DB_SCHEMA,
|
||||
AddonInternal,
|
||||
XPIProvider,
|
||||
XPIStates,
|
||||
@ -6154,11 +6160,9 @@ AddonInstall.createUpdate = function AI_createUpdate(aCallback, aAddon, aUpdate)
|
||||
* The AddonInstall to create a wrapper for
|
||||
*/
|
||||
function AddonInstallWrapper(aInstall) {
|
||||
#ifdef MOZ_EM_DEBUG
|
||||
this.__defineGetter__("__AddonInstallInternal__", function AIW_debugGetter() {
|
||||
return aInstall;
|
||||
return AppConstants.DEBUG ? aInstall : undefined;
|
||||
});
|
||||
#endif
|
||||
|
||||
["name", "version", "icons", "releaseNotesURI", "file", "state", "error",
|
||||
"progress", "maxProgress", "certificate", "certName"].forEach(function(aProp) {
|
||||
@ -6722,11 +6726,9 @@ function createWrapper(aAddon) {
|
||||
* the public API.
|
||||
*/
|
||||
function AddonWrapper(aAddon) {
|
||||
#ifdef MOZ_EM_DEBUG
|
||||
this.__defineGetter__("__AddonInternal__", function AW_debugGetter() {
|
||||
return aAddon;
|
||||
return AppConstants.DEBUG ? aAddon : undefined;
|
||||
});
|
||||
#endif
|
||||
|
||||
function chooseValue(aObj, aProp) {
|
||||
let repositoryAddon = aAddon._repositoryAddon;
|
||||
@ -7962,7 +7964,6 @@ const TemporaryInstallLocation = {
|
||||
getStagingDir: () => {},
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
/**
|
||||
* An object that identifies a registry install location for add-ons. The location
|
||||
* consists of a registry key which contains string values mapping ID to the
|
||||
@ -8012,11 +8013,9 @@ WinRegInstallLocation.prototype = {
|
||||
let appVendor = Services.appinfo.vendor;
|
||||
let appName = Services.appinfo.name;
|
||||
|
||||
#ifdef MOZ_THUNDERBIRD
|
||||
// XXX Thunderbird doesn't specify a vendor string
|
||||
if (appVendor == "")
|
||||
if (AppConstants.MOZ_APP_NAME == "thunderbird" && appVendor == "")
|
||||
appVendor = "Mozilla";
|
||||
#endif
|
||||
|
||||
// XULRunner-based apps may intentionally not specify a vendor
|
||||
if (appVendor != "")
|
||||
@ -8083,31 +8082,6 @@ WinRegInstallLocation.prototype = {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// Make these non-changable properties so they can't be manipulated from other
|
||||
// code in the app.
|
||||
Object.defineProperty(this, "ADDON_SIGNING", {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
#ifdef MOZ_ADDON_SIGNING
|
||||
value: true,
|
||||
#else
|
||||
value: false,
|
||||
#endif
|
||||
});
|
||||
|
||||
Object.defineProperty(this, "REQUIRE_SIGNING", {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
#ifdef MOZ_REQUIRE_SIGNING
|
||||
value: true,
|
||||
#else
|
||||
value: false,
|
||||
#endif
|
||||
});
|
||||
|
||||
var addonTypes = [
|
||||
new AddonManagerPrivate.AddonType("extension", URI_EXTENSION_STRINGS,
|
||||
|
@ -41,9 +41,6 @@ const FILE_JSON_DB = "extensions.json";
|
||||
const FILE_OLD_DATABASE = "extensions.rdf";
|
||||
const FILE_XPI_ADDONS_LIST = "extensions.ini";
|
||||
|
||||
// The value for this is in Makefile.in
|
||||
#expand const DB_SCHEMA = __MOZ_EXTENSIONS_DB_SCHEMA__;
|
||||
|
||||
// The last version of DB_SCHEMA implemented in SQLITE
|
||||
const LAST_SQLITE_DB_SCHEMA = 14;
|
||||
const PREF_DB_SCHEMA = "extensions.databaseSchema";
|
||||
|
@ -15,6 +15,8 @@ EXTRA_JS_MODULES.addons += [
|
||||
'ProductAddonChecker.jsm',
|
||||
'SpellCheckDictionaryBootstrap.js',
|
||||
'WebExtensionBootstrap.js',
|
||||
'XPIProvider.jsm',
|
||||
'XPIProviderUtils.js',
|
||||
]
|
||||
|
||||
# Don't ship unused providers on Android
|
||||
@ -24,18 +26,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
|
||||
]
|
||||
|
||||
EXTRA_PP_JS_MODULES.addons += [
|
||||
'XPIProvider.jsm',
|
||||
'XPIProviderUtils.js',
|
||||
'AddonConstants.jsm',
|
||||
]
|
||||
|
||||
# This is used in multiple places, so is defined here to avoid it getting
|
||||
# out of sync.
|
||||
DEFINES['MOZ_EXTENSIONS_DB_SCHEMA'] = 17
|
||||
|
||||
# Additional debugging info is exposed in debug builds
|
||||
if CONFIG['MOZ_EM_DEBUG']:
|
||||
DEFINES['MOZ_EM_DEBUG'] = 1
|
||||
|
||||
if CONFIG['MOZ_ADDON_SIGNING']:
|
||||
DEFINES['MOZ_ADDON_SIGNING'] = 1
|
||||
|
||||
|
@ -6,7 +6,7 @@ toolkit.jar:
|
||||
% content mozapps %content/mozapps/
|
||||
* content/mozapps/extensions/extensions.xul (content/extensions.xul)
|
||||
content/mozapps/extensions/extensions.css (content/extensions.css)
|
||||
* content/mozapps/extensions/extensions.js (content/extensions.js)
|
||||
content/mozapps/extensions/extensions.js (content/extensions.js)
|
||||
* content/mozapps/extensions/extensions.xml (content/extensions.xml)
|
||||
content/mozapps/extensions/updateinfo.xsl (content/updateinfo.xsl)
|
||||
content/mozapps/extensions/about.xul (content/about.xul)
|
||||
|
@ -30,22 +30,12 @@ EXTRA_PP_COMPONENTS += [
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'AddonManager.jsm',
|
||||
'ChromeManifestParser.jsm',
|
||||
'DeferredSave.jsm',
|
||||
'LightweightThemeManager.jsm',
|
||||
]
|
||||
|
||||
EXTRA_PP_JS_MODULES += [
|
||||
'AddonManager.jsm'
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_UPDATE_CHANNEL'] not in ('aurora', 'beta', 'release', 'esr'):
|
||||
DEFINES['MOZ_COMPATIBILITY_NIGHTLY'] = 1
|
||||
|
||||
# Additional debugging info is exposed in debug builds
|
||||
if CONFIG['MOZ_EM_DEBUG']:
|
||||
DEFINES['MOZ_EM_DEBUG'] = 1
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
||||
|
||||
EXPORTS.mozilla += [
|
||||
|
Loading…
Reference in New Issue
Block a user