summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.js3
-rw-r--r--application/palemoon/locales/en-US/chrome/browser/browser.properties2
-rw-r--r--browser/locales/en-US/chrome/browser/browser.properties2
-rw-r--r--devtools/moz.build12
-rw-r--r--devtools/server/child.js2
-rw-r--r--devtools/server/main.js2
-rw-r--r--devtools/shared/heapsnapshot/moz.build19
-rw-r--r--mobile/android/chrome/content/InputWidgetHelper.js2
-rw-r--r--security/manager/.eslintrc.js3
-rw-r--r--services/fxaccounts/FxAccountsProfileClient.jsm4
-rw-r--r--services/fxaccounts/FxAccountsStorage.jsm2
-rw-r--r--services/sync/modules/record.js4
-rw-r--r--services/sync/modules/service.js2
-rw-r--r--services/sync/tps/extensions/mozmill/resource/driver/controller.js2
-rw-r--r--services/sync/tps/extensions/mozmill/resource/modules/assertions.js2
-rw-r--r--toolkit/.eslintrc.js3
-rw-r--r--toolkit/components/osfile/modules/osfile_unix_front.jsm4
-rw-r--r--toolkit/components/osfile/modules/osfile_win_front.jsm4
-rw-r--r--toolkit/components/reader/.eslintrc.js3
-rw-r--r--toolkit/components/search/nsSearchService.js9
-rw-r--r--toolkit/components/webextensions/.eslintrc.js3
-rw-r--r--toolkit/modules/Sqlite.jsm2
-rw-r--r--toolkit/mozapps/extensions/AddonManager.jsm2
-rw-r--r--toolkit/mozapps/extensions/content/extensions.js4
-rw-r--r--toolkit/mozapps/extensions/content/extensions.xml2
-rw-r--r--toolkit/mozapps/extensions/content/extensions.xul6
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProvider.jsm75
-rw-r--r--toolkit/toolkit.mozbuild3
28 files changed, 107 insertions, 76 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
index a7a886292..3d3ad2b80 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -7,6 +7,9 @@ module.exports = {
],
"rules": {
"mozilla/import-globals": "warn",
+
+ // No (!foo in bar) or (!object instanceof Class)
+ "no-unsafe-negation": "error",
},
"env": {
"es6": true
diff --git a/application/palemoon/locales/en-US/chrome/browser/browser.properties b/application/palemoon/locales/en-US/chrome/browser/browser.properties
index 5dd4ba6d6..481a061d9 100644
--- a/application/palemoon/locales/en-US/chrome/browser/browser.properties
+++ b/application/palemoon/locales/en-US/chrome/browser/browser.properties
@@ -59,6 +59,7 @@ addonError-1=The add-on could not be downloaded because of a connection failure
addonError-2=The add-on from #2 could not be installed because it does not match the add-on #3 expected.
addonError-3=The add-on downloaded from #2 could not be installed because it appears to be corrupt.
addonError-4=#1 could not be installed because #3 cannot modify the needed file.
+addonError-8=The add-on downloaded from #2 could not be installed because #3 does not support Jetpack (SDK) extensions.
addonError-9=The add-on downloaded from #2 could not be installed because #3 does not support WebExtensions.
# LOCALIZATION NOTE (addonLocalError-1, addonLocalError-2, addonLocalError-3, addonLocalError-4, addonErrorIncompatible, addonErrorBlocklisted):
@@ -67,6 +68,7 @@ addonLocalError-1=This add-on could not be installed because of a filesystem err
addonLocalError-2=This add-on could not be installed because it does not match the add-on #3 expected.
addonLocalError-3=This add-on could not be installed because it appears to be corrupt.
addonLocalError-4=#1 could not be installed because #3 cannot modify the needed file.
+addonLocalError-8=This add-on could not be installed because #3 does not support Jetpack (SDK) extensions.
addonLocalError-9=This add-on could not be installed because #3 does not support WebExtensions.
addonErrorIncompatible=#1 could not be installed because it is not compatible with #3 #4.
addonErrorBlocklisted=#1 could not be installed because it has a high risk of causing stability or security problems.
diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties
index 31f61632b..f7f3e9339 100644
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -85,12 +85,14 @@ addonInstallError-2=The add-on could not be installed because it does not match
addonInstallError-3=The add-on downloaded from this site could not be installed because it appears to be corrupt.
addonInstallError-4=%2$S could not be installed because %1$S cannot modify the needed file.
addonInstallError-5=%1$S has prevented this site from installing an unverified add-on.
+addonInstallError-8=%2$S could not be installed because %1$S does not support Jetpack (SDK) extensions.
addonInstallError-9=%2$S could not be installed because %1$S does not support WebExtensions.
addonLocalInstallError-1=This add-on could not be installed because of a filesystem error.
addonLocalInstallError-2=This add-on could not be installed because it does not match the add-on %1$S expected.
addonLocalInstallError-3=This add-on could not be installed because it appears to be corrupt.
addonLocalInstallError-4=%2$S could not be installed because %1$S cannot modify the needed file.
addonLocalInstallError-5=This add-on could not be installed because it has not been verified.
+addonLocalInstallError-8=%2$S could not be installed because %1$S does not support Jetpack (SDK) extensions.
addonLocalInstallError-9=%2$S could not be installed because %1$S does not support WebExtensions.
diff --git a/devtools/moz.build b/devtools/moz.build
index 8e368facb..dd9f90c5a 100644
--- a/devtools/moz.build
+++ b/devtools/moz.build
@@ -7,11 +7,13 @@
if CONFIG['MOZ_DEVTOOLS']:
DIRS += ['client']
-
-DIRS += [
- 'server',
- 'shared',
-]
+if CONFIG['MOZ_DEVTOOLS_SERVER']:
+ DIRS += [
+ 'server',
+ 'shared',
+ ]
+else:
+ DIRS += ['shared/heapsnapshot/']
# /browser uses DIST_SUBDIR. We opt-in to this treatment when building
# DevTools for the browser to keep the root omni.ja slim for use by external XUL
diff --git a/devtools/server/child.js b/devtools/server/child.js
index e2838f08d..c69b0a3fb 100644
--- a/devtools/server/child.js
+++ b/devtools/server/child.js
@@ -61,7 +61,7 @@ try {
try {
m = require(module);
- if (!setupChild in m) {
+ if (!(setupChild in m)) {
dumpn(`ERROR: module '${module}' does not export '${setupChild}'`);
return false;
}
diff --git a/devtools/server/main.js b/devtools/server/main.js
index 475995493..ac76adb83 100644
--- a/devtools/server/main.js
+++ b/devtools/server/main.js
@@ -1040,7 +1040,7 @@ var DebuggerServer = {
try {
m = require(module);
- if (!setupParent in m) {
+ if (!(setupParent in m)) {
dumpn(`ERROR: module '${module}' does not export '${setupParent}'`);
return false;
}
diff --git a/devtools/shared/heapsnapshot/moz.build b/devtools/shared/heapsnapshot/moz.build
index d020da727..fa9ef3915 100644
--- a/devtools/shared/heapsnapshot/moz.build
+++ b/devtools/shared/heapsnapshot/moz.build
@@ -48,15 +48,16 @@ DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True
FINAL_LIBRARY = 'xul'
-DevToolsModules(
- 'census-tree-node.js',
- 'CensusUtils.js',
- 'DominatorTreeNode.js',
- 'HeapAnalysesClient.js',
- 'HeapAnalysesWorker.js',
- 'HeapSnapshotFileUtils.js',
- 'shortest-paths.js',
-)
+if CONFIG['MOZ_DEVTOOLS_SERVER']:
+ DevToolsModules(
+ 'census-tree-node.js',
+ 'CensusUtils.js',
+ 'DominatorTreeNode.js',
+ 'HeapAnalysesClient.js',
+ 'HeapAnalysesWorker.js',
+ 'HeapSnapshotFileUtils.js',
+ 'shortest-paths.js',
+ )
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-error=shadow']
diff --git a/mobile/android/chrome/content/InputWidgetHelper.js b/mobile/android/chrome/content/InputWidgetHelper.js
index 9c753bd7b..cf66a263e 100644
--- a/mobile/android/chrome/content/InputWidgetHelper.js
+++ b/mobile/android/chrome/content/InputWidgetHelper.js
@@ -63,7 +63,7 @@ var InputWidgetHelper = {
},
hasInputWidget: function(aElement) {
- if (!aElement instanceof HTMLInputElement)
+ if (!(aElement instanceof HTMLInputElement))
return false;
let type = aElement.getAttribute('type');
diff --git a/security/manager/.eslintrc.js b/security/manager/.eslintrc.js
index dc9d688aa..6b292f366 100644
--- a/security/manager/.eslintrc.js
+++ b/security/manager/.eslintrc.js
@@ -131,9 +131,6 @@ module.exports = { // eslint-disable-line no-undef
// No reassigning native JS objects
"no-native-reassign": "error",
- // No (!foo in bar)
- "no-negated-in-lhs": "error",
-
// Nested ternary statements are confusing
"no-nested-ternary": "error",
diff --git a/services/fxaccounts/FxAccountsProfileClient.jsm b/services/fxaccounts/FxAccountsProfileClient.jsm
index 37115a3fa..1e5edc634 100644
--- a/services/fxaccounts/FxAccountsProfileClient.jsm
+++ b/services/fxaccounts/FxAccountsProfileClient.jsm
@@ -89,7 +89,7 @@ this.FxAccountsProfileClient.prototype = {
try {
return (yield this._rawRequest(path, method, token));
} catch (ex) {
- if (!ex instanceof FxAccountsProfileClientError || ex.code != 401) {
+ if (!(ex instanceof FxAccountsProfileClientError) || ex.code != 401) {
throw ex;
}
// If this object was instantiated with a token then we don't refresh it.
@@ -105,7 +105,7 @@ this.FxAccountsProfileClient.prototype = {
try {
return (yield this._rawRequest(path, method, token));
} catch (ex) {
- if (!ex instanceof FxAccountsProfileClientError || ex.code != 401) {
+ if (!(ex instanceof FxAccountsProfileClientError) || ex.code != 401) {
throw ex;
}
log.info("Retry fetching the profile still returned a 401 - revoking our token and failing");
diff --git a/services/fxaccounts/FxAccountsStorage.jsm b/services/fxaccounts/FxAccountsStorage.jsm
index 021763b92..43e2d21a0 100644
--- a/services/fxaccounts/FxAccountsStorage.jsm
+++ b/services/fxaccounts/FxAccountsStorage.jsm
@@ -403,7 +403,7 @@ this.FxAccountsStorageManager.prototype = {
try {
yield this.secureStorage.set(this.cachedPlain.uid, toWriteSecure);
} catch (ex) {
- if (!ex instanceof this.secureStorage.STORAGE_LOCKED) {
+ if (!(ex instanceof this.secureStorage.STORAGE_LOCKED)) {
throw ex;
}
// This shouldn't be possible as once it is unlocked it can't be
diff --git a/services/sync/modules/record.js b/services/sync/modules/record.js
index 02f7f281a..f7a69d9ef 100644
--- a/services/sync/modules/record.js
+++ b/services/sync/modules/record.js
@@ -43,7 +43,7 @@ WBORecord.prototype = {
// Get thyself from your URI, then deserialize.
// Set thine 'response' field.
fetch: function fetch(resource) {
- if (!resource instanceof Resource) {
+ if (!(resource instanceof Resource)) {
throw new Error("First argument must be a Resource instance.");
}
@@ -56,7 +56,7 @@ WBORecord.prototype = {
},
upload: function upload(resource) {
- if (!resource instanceof Resource) {
+ if (!(resource instanceof Resource)) {
throw new Error("First argument must be a Resource instance.");
}
diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js
index b0eb0f41d..5c91323b5 100644
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -455,7 +455,7 @@ Sync11Service.prototype = {
this.clientsEngine = new ClientEngine(this);
for (let name of engines) {
- if (!name in ENGINE_MODULES) {
+ if (!(name in ENGINE_MODULES)) {
this._log.info("Do not know about engine: " + name);
continue;
}
diff --git a/services/sync/tps/extensions/mozmill/resource/driver/controller.js b/services/sync/tps/extensions/mozmill/resource/driver/controller.js
index a378ce51f..8d66a41ae 100644
--- a/services/sync/tps/extensions/mozmill/resource/driver/controller.js
+++ b/services/sync/tps/extensions/mozmill/resource/driver/controller.js
@@ -978,7 +978,7 @@ function browserAdditions (controller) {
}, "Timeout", timeout, aInterval);
}
catch (ex) {
- if (!ex instanceof errors.TimeoutError) {
+ if (!(ex instanceof errors.TimeoutError)) {
throw ex;
}
timed_out = true;
diff --git a/services/sync/tps/extensions/mozmill/resource/modules/assertions.js b/services/sync/tps/extensions/mozmill/resource/modules/assertions.js
index c9991acf0..c76f95747 100644
--- a/services/sync/tps/extensions/mozmill/resource/modules/assertions.js
+++ b/services/sync/tps/extensions/mozmill/resource/modules/assertions.js
@@ -659,7 +659,7 @@ Expect.prototype.waitFor = function Expect_waitFor(aCallback, aMessage, aTimeout
Assert.prototype.waitFor.apply(this, arguments);
}
catch (ex) {
- if (!ex instanceof errors.AssertionError) {
+ if (!(ex instanceof errors.AssertionError)) {
throw ex;
}
message = ex.message;
diff --git a/toolkit/.eslintrc.js b/toolkit/.eslintrc.js
index 181f19f29..891a114b3 100644
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -111,9 +111,6 @@ module.exports = {
// No reassigning native JS objects
"no-native-reassign": "error",
- // No (!foo in bar)
- "no-negated-in-lhs": "error",
-
// Nested ternary statements are confusing
"no-nested-ternary": "error",
diff --git a/toolkit/components/osfile/modules/osfile_unix_front.jsm b/toolkit/components/osfile/modules/osfile_unix_front.jsm
index 19a27ae1a..bd60d4d84 100644
--- a/toolkit/components/osfile/modules/osfile_unix_front.jsm
+++ b/toolkit/components/osfile/modules/osfile_unix_front.jsm
@@ -838,7 +838,7 @@
* implementation.
*/
File.DirectoryIterator.Entry.toMsg = function toMsg(value) {
- if (!value instanceof File.DirectoryIterator.Entry) {
+ if (!(value instanceof File.DirectoryIterator.Entry)) {
throw new TypeError("parameter of " +
"File.DirectoryIterator.Entry.toMsg must be a " +
"File.DirectoryIterator.Entry");
@@ -905,7 +905,7 @@
* is asymmetric and returns an object with a different implementation.
*/
File.Info.toMsg = function toMsg(stat) {
- if (!stat instanceof File.Info) {
+ if (!(stat instanceof File.Info)) {
throw new TypeError("parameter of File.Info.toMsg must be a File.Info");
}
let serialized = {};
diff --git a/toolkit/components/osfile/modules/osfile_win_front.jsm b/toolkit/components/osfile/modules/osfile_win_front.jsm
index 387dd08b5..1123b251c 100644
--- a/toolkit/components/osfile/modules/osfile_win_front.jsm
+++ b/toolkit/components/osfile/modules/osfile_win_front.jsm
@@ -909,7 +909,7 @@
* implementation.
*/
File.DirectoryIterator.Entry.toMsg = function toMsg(value) {
- if (!value instanceof File.DirectoryIterator.Entry) {
+ if (!(value instanceof File.DirectoryIterator.Entry)) {
throw new TypeError("parameter of " +
"File.DirectoryIterator.Entry.toMsg must be a " +
"File.DirectoryIterator.Entry");
@@ -958,7 +958,7 @@
* is asymmetric and returns an object with a different implementation.
*/
File.Info.toMsg = function toMsg(stat) {
- if (!stat instanceof File.Info) {
+ if (!(stat instanceof File.Info)) {
throw new TypeError("parameter of File.Info.toMsg must be a File.Info");
}
let serialized = {};
diff --git a/toolkit/components/reader/.eslintrc.js b/toolkit/components/reader/.eslintrc.js
index 1c09e0bf7..617c1f9cf 100644
--- a/toolkit/components/reader/.eslintrc.js
+++ b/toolkit/components/reader/.eslintrc.js
@@ -109,9 +109,6 @@ module.exports = {
// No reassigning native JS objects
"no-native-reassign": "error",
- // No (!foo in bar)
- "no-negated-in-lhs": "error",
-
// Nested ternary statements are confusing
"no-nested-ternary": "error",
diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js
index fb3f69f4c..9f9003516 100644
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -23,8 +23,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
- "resource://gre/modules/Deprecated.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SearchStaticData",
"resource://gre/modules/SearchStaticData.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
@@ -2695,13 +2693,6 @@ SearchService.prototype = {
return;
}
- let warning =
- "Search service falling back to synchronous initialization. " +
- "This is generally the consequence of an add-on using a deprecated " +
- "search service API.";
- Deprecated.warning(warning, "https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIBrowserSearchService#async_warning");
- LOG(warning);
-
this._syncInit();
if (!Components.isSuccessCode(this._initRV)) {
throw this._initRV;
diff --git a/toolkit/components/webextensions/.eslintrc.js b/toolkit/components/webextensions/.eslintrc.js
index 70196fc6a..70f91ab6d 100644
--- a/toolkit/components/webextensions/.eslintrc.js
+++ b/toolkit/components/webextensions/.eslintrc.js
@@ -173,9 +173,6 @@ module.exports = { // eslint-disable-line no-undef
// No reassigning native JS objects
"no-native-reassign": "error",
- // No (!foo in bar)
- "no-negated-in-lhs": "error",
-
// Nested ternary statements are confusing
"no-nested-ternary": "error",
diff --git a/toolkit/modules/Sqlite.jsm b/toolkit/modules/Sqlite.jsm
index e8d986c0e..6f7a7d94c 100644
--- a/toolkit/modules/Sqlite.jsm
+++ b/toolkit/modules/Sqlite.jsm
@@ -995,7 +995,7 @@ function cloneStorageConnection(options) {
if (!source) {
throw new TypeError("connection not specified in clone options.");
}
- if (!source instanceof Ci.mozIStorageAsyncConnection) {
+ if (!(source instanceof Ci.mozIStorageAsyncConnection)) {
throw new TypeError("Connection must be a valid Storage connection.");
}
diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm
index 3913c2088..d4c3a6967 100644
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -2671,6 +2671,8 @@ this.AddonManager = {
ERROR_CORRUPT_FILE: -3,
// An error occured trying to write to the filesystem.
ERROR_FILE_ACCESS: -4,
+ // The downloaded file seems to be Jetpack.
+ ERROR_JETPACKSDK_FILE: -8,
// The downloaded file seems to be WebExtension.
ERROR_WEBEXT_FILE: -9,
diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js
index 8d9c132e6..fc4392231 100644
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -18,10 +18,12 @@ Cu.import("resource://gre/modules/addons/AddonRepository.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
+#ifdef MOZ_DEVTOOLS
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () {
return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}).
BrowserToolboxProcess;
});
+#endif
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane";
@@ -1002,6 +1004,7 @@ var gViewController = {
}
},
+#ifdef MOZ_DEVTOOLS
cmd_debugItem: {
doCommand: function cmd_debugItem_doCommand(aAddon) {
BrowserToolboxProcess.init({ addonID: aAddon.id });
@@ -1015,6 +1018,7 @@ var gViewController = {
return aAddon && aAddon.isDebuggable && debuggerEnabled && remoteEnabled;
}
},
+#endif
cmd_showItemPreferences: {
isEnabled: function cmd_showItemPreferences_isEnabled(aAddon) {
diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml
index 7fe17be2a..cbd05bfa9 100644
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -1628,11 +1628,13 @@
]]></body>
</method>
+#ifdef MOZ_DEVTOOLS
<method name="debug">
<body><![CDATA[
gViewController.doCommand("cmd_debugItem", this.mAddon);
]]></body>
</method>
+#endif
<method name="showPreferences">
<body><![CDATA[
diff --git a/toolkit/mozapps/extensions/content/extensions.xul b/toolkit/mozapps/extensions/content/extensions.xul
index c1a8edc86..c5eeb534f 100644
--- a/toolkit/mozapps/extensions/content/extensions.xul
+++ b/toolkit/mozapps/extensions/content/extensions.xul
@@ -53,8 +53,10 @@
<menuitem id="menuitem_uninstallItem" command="cmd_uninstallItem"
label="&cmd.uninstallAddon.label;"
accesskey="&cmd.uninstallAddon.accesskey;"/>
+#ifdef MOZ_DEVTOOLS
<menuitem id="menuitem_debugItem" command="cmd_debugItem"
label="&cmd.debugAddon.label;"/>
+#endif
<menuseparator id="addonitem-menuseparator" />
<menuitem id="menuitem_preferences" command="cmd_showItemPreferences"
#ifdef XP_WIN
@@ -101,7 +103,9 @@
<command id="cmd_findItemUpdates"/>
<command id="cmd_showItemPreferences"/>
<command id="cmd_showItemAbout"/>
+#ifdef MOZ_DEVTOOLS
<command id="cmd_debugItem"/>
+#endif
<command id="cmd_enableItem"/>
<command id="cmd_disableItem"/>
<command id="cmd_installItem"/>
@@ -631,9 +635,11 @@
#endif
command="cmd_showItemPreferences"/>
<spacer flex="1"/>
+#ifdef MOZ_DEVTOOLS
<button id="detail-debug-btn" class="addon-control debug"
label="Debug"
command="cmd_debugItem" />
+#endif
<button id="detail-enable-btn" class="addon-control enable"
label="&cmd.enableAddon.label;"
accesskey="&cmd.enableAddon.accesskey;"
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
index e1883fb6a..5b3585cd8 100644
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -36,8 +36,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
+#ifdef MOZ_DEVTOOLS
XPCOMUtils.defineLazyModuleGetter(this, "BrowserToolboxProcess",
"resource://devtools/client/framework/ToolboxProcess.jsm");
+#endif
XPCOMUtils.defineLazyModuleGetter(this, "ConsoleAPI",
"resource://gre/modules/Console.jsm");
@@ -110,6 +112,10 @@ const DIR_TRASH = "trash";
const FILE_DATABASE = "extensions.json";
const FILE_OLD_CACHE = "extensions.cache";
const FILE_INSTALL_MANIFEST = "install.rdf";
+#ifndef MOZ_JETPACK
+const FILE_JETPACK_MANIFEST_1 = "harness-options.json";
+const FILE_JETPACK_MANIFEST_2 = "package.json";
+#endif
const FILE_WEBEXT_MANIFEST = "manifest.json";
const FILE_XPI_ADDONS_LIST = "extensions.ini";
@@ -138,7 +144,9 @@ const FIREFOX_APPCOMPATVERSION = "56.9"
// The value for this is in Makefile.in
#expand const DB_SCHEMA = __MOZ_EXTENSIONS_DB_SCHEMA__;
+#ifdef MOZ_DEVTOOLS
const NOTIFICATION_TOOLBOXPROCESS_LOADED = "ToolboxProcessLoaded";
+#endif
// Properties that exist in the install manifest
const PROP_METADATA = ["id", "version", "type", "internalName", "updateURL",
@@ -1063,37 +1071,36 @@ function loadManifestFromDir(aDir) {
* @throws if the XPI file does not contain a valid install manifest.
* Throws with |webext:true| if a WebExtension manifest was found
* to distinguish between WebExtensions and corrupt files.
+ * Throws with |jetpacksdk:true| if a Jetpack files were found
+ * if Jetpack its self isn't built.
*/
function loadManifestFromZipReader(aZipReader) {
- let zis;
- try {
- zis = aZipReader.getInputStream(FILE_INSTALL_MANIFEST);
- } catch (e) {
- // We're going to throw here, but depending on whether we have a
- // WebExtension manifest in the XPI, we'll throw with the webext flag.
- try {
- let zws = aZipReader.getInputStream(FILE_WEBEXT_MANIFEST);
- zws.close();
- } catch(e2) {
- // We have neither an install manifest nor a WebExtension manifest;
- // this means the extension file has a structural problem.
- // Just pass the original error up the chain in that case.
+ // If WebExtension but not install.rdf throw an error
+ if (aZipReader.hasEntry(FILE_WEBEXT_MANIFEST)) {
+ if (!aZipReader.hasEntry(FILE_INSTALL_MANIFEST)) {
throw {
- name: e.name,
- message: e.message
+ name: "UnsupportedExtension",
+ message: Services.appinfo.name + " does not support WebExtensions",
+ webext: true
};
}
- // If we get here, we have a WebExtension manifest but no install
- // manifest. Pass the error up the chain with the webext flag.
+ }
+
+#ifndef MOZ_JETPACK
+ // If Jetpack is not built throw an error
+ if (aZipReader.hasEntry(FILE_JETPACK_MANIFEST_1) ||
+ aZipReader.hasEntry(FILE_JETPACK_MANIFEST_2)) {
throw {
- name: e.name,
- message: e.message,
- webext: true
+ name: "UnsupportedExtension",
+ message: Services.appinfo.name + " does not support Jetpack Extensions",
+ jetpacksdk: true
};
}
-
- // We found an install manifest, so it's either a regular or hybrid
- // extension. Continue processing.
+#endif
+
+ // Attempt to open install.rdf else throw normally
+ let zis = aZipReader.getInputStream(FILE_INSTALL_MANIFEST);
+ // Create a buffered input stream for install.rdf
let bis = Cc["@mozilla.org/network/buffered-input-stream;1"].
createInstance(Ci.nsIBufferedInputStream);
bis.init(zis, 4096);
@@ -1122,7 +1129,9 @@ function loadManifestFromZipReader(aZipReader) {
return addon;
}
finally {
+ // Close the buffered input stream
bis.close();
+ // Close the input stream to install.rdf
zis.close();
}
}
@@ -1846,8 +1855,10 @@ this.XPIProvider = {
_enabledExperiments: null,
// A Map from an add-on install to its ID
_addonFileMap: new Map(),
+#ifdef MOZ_DEVTOOLS
// Flag to know if ToolboxProcess.jsm has already been loaded by someone or not
_toolboxProcessLoaded: false,
+#endif
// Have we started shutting down bootstrap add-ons?
_closing: false,
@@ -2083,6 +2094,8 @@ this.XPIProvider = {
Services.prefs.addObserver(PREF_EM_MIN_COMPAT_APP_VERSION, this, false);
Services.prefs.addObserver(PREF_EM_MIN_COMPAT_PLATFORM_VERSION, this, false);
Services.obs.addObserver(this, NOTIFICATION_FLUSH_PERMISSIONS, false);
+
+#ifdef MOZ_DEVTOOLS
if (Cu.isModuleLoaded("resource://devtools/client/framework/ToolboxProcess.jsm")) {
// If BrowserToolboxProcess is already loaded, set the boolean to true
// and do whatever is needed
@@ -2094,6 +2107,7 @@ this.XPIProvider = {
// Else, wait for it to load
Services.obs.addObserver(this, NOTIFICATION_TOOLBOXPROCESS_LOADED, false);
}
+#endif
let flushCaches = this.checkForChanges(aAppChanged, aOldAppVersion,
aOldPlatformVersion);
@@ -4088,12 +4102,14 @@ this.XPIProvider = {
}
return;
}
+#ifdef MOZ_DEVTOOLS
else if (aTopic == NOTIFICATION_TOOLBOXPROCESS_LOADED) {
Services.obs.removeObserver(this, NOTIFICATION_TOOLBOXPROCESS_LOADED, false);
this._toolboxProcessLoaded = true;
BrowserToolboxProcess.on("connectionchange",
this.onDebugConnectionChange.bind(this));
}
+#endif
if (aTopic == "nsPref:changed") {
switch (aData) {
@@ -4358,12 +4374,14 @@ this.XPIProvider = {
logger.warn("Error loading bootstrap.js for " + aId, e);
}
+#ifdef MOZ_DEVTOOLS
// Only access BrowserToolboxProcess if ToolboxProcess.jsm has been
// initialized as otherwise, when it will be initialized, all addons'
// globals will be added anyways
if (this._toolboxProcessLoaded) {
BrowserToolboxProcess.setAddonOptions(aId, { global: this.bootstrapScopes[aId] });
}
+#endif
},
/**
@@ -4383,11 +4401,13 @@ this.XPIProvider = {
this.persistBootstrappedAddons();
this.addAddonsToCrashReporter();
+#ifdef MOZ_DEVTOOLS
// Only access BrowserToolboxProcess if ToolboxProcess.jsm has been
// initialized as otherwise, there won't be any addon globals added to it
if (this._toolboxProcessLoaded) {
BrowserToolboxProcess.setAddonOptions(aId, { global: null });
}
+#endif
},
/**
@@ -5005,6 +5025,11 @@ AddonInstall.prototype = {
if (e.webext) {
logger.warn("WebExtension XPI", e);
this.error = AddonManager.ERROR_WEBEXT_FILE;
+#ifndef MOZ_JETPACK
+ } else if (e.jetpacksdk) {
+ logger.warn("Jetpack XPI", e);
+ this.error = AddonManager.ERROR_JETPACKSDK_FILE;
+#endif
} else {
logger.warn("Invalid XPI", e);
this.error = AddonManager.ERROR_CORRUPT_FILE;
@@ -5646,6 +5671,10 @@ AddonInstall.prototype = {
catch (e) {
if (e.webext) {
this.downloadFailed(AddonManager.ERROR_WEBEXT_FILE, e);
+#ifndef MOZ_JETPACK
+ } else if (e.jetpacksdk) {
+ this.downloadFailed(AddonManager.ERROR_JETPACKSDK_FILE, e);
+#endif
} else {
this.downloadFailed(AddonManager.ERROR_CORRUPT_FILE, e);
}
diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild
index 3b3bf80ae..b06c58162 100644
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -132,8 +132,7 @@ DIRS += [
if CONFIG['MOZ_PREF_EXTENSIONS']:
DIRS += ['/extensions/pref']
-if CONFIG['MOZ_DEVTOOLS_SERVER']:
- DIRS += ['/devtools']
+DIRS += ['/devtools']
DIRS += [
'/services',