Skip to content

Instantly share code, notes, and snippets.

diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -6591,17 +6591,19 @@ AddonInstall.createSystemAddonInstall =
let location = XPIProvider.installLocationsByName[KEY_APP_SYSTEM_ADDONS];
let file = location.getFileForAddonID(aAddonID);
let url = Services.io.newFileURI(file);
try {
Components.utils.import("resource://gre/modules/Services.jsm");
class API extends ExtensionAPI {
getAPI(context) {
return {
diskcache: {
capacity() {
let diskCapacity = Services.prefs.getIntPref("browser.cache.disk.capacity");
return `Disk cache capacity is: ${diskCapacity}`;
},
diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -2033,22 +2033,18 @@ this.XPIDatabaseReconcile = {
}
}
// Validate the updated system add-ons
let systemAddonLocation = XPIProvider.installLocationsByName[KEY_APP_SYSTEM_ADDONS];
let addons = currentAddons.get(KEY_APP_SYSTEM_ADDONS) || new Map();
diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -62,20 +62,21 @@ const PREF_EM_CHECK_COMPATIBILITY_BASE =
var PREF_EM_CHECK_COMPATIBILITY = MOZ_COMPATIBILITY_NIGHTLY ?
PREF_EM_CHECK_COMPATIBILITY_BASE + ".nightly" :
undefined;
const TOOLKIT_ID = "toolkit@mozilla.org";
diff --git a/toolkit/modules/GMPInstallManager.jsm b/toolkit/modules/GMPInstallManager.jsm
--- a/toolkit/modules/GMPInstallManager.jsm
+++ b/toolkit/modules/GMPInstallManager.jsm
@@ -99,17 +99,17 @@ GMPInstallManager.prototype = {
let certs = null;
if (!Services.prefs.prefHasUserValue(GMPPrefs.KEY_URL_OVERRIDE)) {
allowNonBuiltIn = !GMPPrefs.get(GMPPrefs.KEY_CERT_REQUIREBUILTIN, true);
if (GMPPrefs.get(GMPPrefs.KEY_CERT_CHECKATTRS, true)) {
certs = gCertUtils.readCertPrefs(GMPPrefs.KEY_CERTS_BRANCH);
}
diff --git a/toolkit/components/extensions/Extension.jsm b/toolkit/components/extensions/Extension.jsm
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -1198,21 +1198,23 @@ this.Extension.generateXPI = function(id
/**
* A skeleton Extension-like object, used for testing, which installs an
* add-on via the add-on manager when startup() is called, and
* uninstalles it on shutdown().
*
* @param {string} id
diff --git a/toolkit/components/extensions/ext-runtime.js b/toolkit/components/extensions/ext-runtime.js
--- a/toolkit/components/extensions/ext-runtime.js
+++ b/toolkit/components/extensions/ext-runtime.js
@@ -1,15 +1,17 @@
"use strict";
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
diff --git a/toolkit/components/extensions/Extension.jsm b/toolkit/components/extensions/Extension.jsm
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -1085,16 +1085,18 @@ this.Extension = function(addonData) {
this.onShutdown = new Set();
this.uninstallURL = null;
this.permissions = new Set();
this.whiteListedHosts = null;
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFilePicker#Constants currently lists the following file picker modes:
modeOpen "Load a file."
modeSave "Save a file."
modeGetFolder "Select a folder/directory."
modeOpenMultiple "Load multiple files."
There isn't a mode that allows either a single file or a single directory, in the same picker (or multiple files+folders, not sure this matters).
There are at least a few places in Firefox that work around this by allowing the user to pick any file in a directory and treating that as if the directory was selected if the file extension was unrecognized - for instance temporary add-on loading in about:debugging allows loading XPIs or selecting an unpacked add-on in a directory. I
<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:extension:delay-upgrade@test.mozilla.org">
<em:updates>
<Seq>
<!-- app id compatible update available -->
<li>