Backed out changeset ef2824384b3d (bug 1647360) for multiple failures. CLOSED TREE

This commit is contained in:
Razvan Maries 2020-06-26 21:06:26 +03:00
Родитель 5871df542a
Коммит 62010bbf25
3 изменённых файлов: 30 добавлений и 34 удалений

Просмотреть файл

@ -21,9 +21,6 @@ const PREF_LANGPACK_SIGNATURES = "extensions.langpacks.signatures.required";
const PREF_ALLOW_EXPERIMENTS = "extensions.experiments.enabled"; const PREF_ALLOW_EXPERIMENTS = "extensions.experiments.enabled";
const PREF_EM_SIDELOAD_SCOPES = "extensions.sideloadScopes"; const PREF_EM_SIDELOAD_SCOPES = "extensions.sideloadScopes";
const PREF_IS_EMBEDDED = "extensions.isembedded"; const PREF_IS_EMBEDDED = "extensions.isembedded";
const PREF_UPDATE_REQUIREBUILTINCERTS = "extensions.update.requireBuiltInCerts";
const PREF_INSTALL_REQUIREBUILTINCERTS =
"extensions.install.requireBuiltInCerts";
var AddonSettings = {}; var AddonSettings = {};
@ -56,27 +53,6 @@ if (AppConstants.MOZ_REQUIRE_SIGNING && !Cu.isInAutomation) {
); );
} }
/**
* Require the use of certs shipped with Firefox for
* addon install and update, if the distribution does
* not require addon signing and is not ESR.
*/
XPCOMUtils.defineLazyPreferenceGetter(
AddonSettings,
"INSTALL_REQUIREBUILTINCERTS",
PREF_INSTALL_REQUIREBUILTINCERTS,
!AppConstants.MOZ_REQUIRE_SIGNING &&
!AppConstants.MOZ_APP_VERSION_DISPLAY.endsWith("esr")
);
XPCOMUtils.defineLazyPreferenceGetter(
AddonSettings,
"UPDATE_REQUIREBUILTINCERTS",
PREF_UPDATE_REQUIREBUILTINCERTS,
!AppConstants.MOZ_REQUIRE_SIGNING &&
!AppConstants.MOZ_APP_VERSION_DISPLAY.endsWith("esr")
);
// Whether or not we're running in GeckoView embedded in an Android app // Whether or not we're running in GeckoView embedded in an Android app
if (Cu.isInAutomation) { if (Cu.isInAutomation) {
XPCOMUtils.defineLazyPreferenceGetter( XPCOMUtils.defineLazyPreferenceGetter(

Просмотреть файл

@ -14,6 +14,8 @@ var EXPORTED_SYMBOLS = ["AddonUpdateChecker"];
const TIMEOUT = 60 * 1000; const TIMEOUT = 60 * 1000;
const TOOLKIT_ID = "toolkit@mozilla.org"; const TOOLKIT_ID = "toolkit@mozilla.org";
const PREF_UPDATE_REQUIREBUILTINCERTS = "extensions.update.requireBuiltInCerts";
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter( ChromeUtils.defineModuleGetter(
@ -43,8 +45,8 @@ ChromeUtils.defineModuleGetter(
); );
ChromeUtils.defineModuleGetter( ChromeUtils.defineModuleGetter(
this, this,
"AddonSettings", "AppConstants",
"resource://gre/modules/AddonSettings.jsm" "resource://gre/modules/AppConstants.jsm"
); );
const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm"); const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
@ -271,12 +273,18 @@ function UpdateParser(aId, aUrl, aObserver) {
this.observer = aObserver; this.observer = aObserver;
this.url = aUrl; this.url = aUrl;
let requireBuiltIn = Services.prefs.getBoolPref(
PREF_UPDATE_REQUIREBUILTINCERTS,
!AppConstants.MOZ_REQUIRE_SIGNING &&
!AppConstants.MOZ_APP_VERSION_DISPLAY.endsWith("esr")
);
logger.debug("Requesting " + aUrl); logger.debug("Requesting " + aUrl);
try { try {
this.request = new ServiceRequest({ mozAnon: true }); this.request = new ServiceRequest({ mozAnon: true });
this.request.open("GET", this.url, true); this.request.open("GET", this.url, true);
this.request.channel.notificationCallbacks = new CertUtils.BadCertHandler( this.request.channel.notificationCallbacks = new CertUtils.BadCertHandler(
!AddonSettings.UPDATE_REQUIREBUILTINCERTS !requireBuiltIn
); );
this.request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE; this.request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
// Prevent the request from writing to cache. // Prevent the request from writing to cache.
@ -306,11 +314,14 @@ UpdateParser.prototype = {
this.request = null; this.request = null;
this._doneAt = new Error("place holder"); this._doneAt = new Error("place holder");
let requireBuiltIn = Services.prefs.getBoolPref(
PREF_UPDATE_REQUIREBUILTINCERTS,
!AppConstants.MOZ_REQUIRE_SIGNING &&
!AppConstants.MOZ_APP_VERSION_DISPLAY.endsWith("esr")
);
try { try {
CertUtils.checkCert( CertUtils.checkCert(request.channel, !requireBuiltIn);
request.channel,
!AddonSettings.UPDATE_REQUIREBUILTINCERTS
);
} catch (e) { } catch (e) {
logger.warn("Request failed: " + this.url + " - " + e); logger.warn("Request failed: " + this.url + " - " + e);
this.notifyError(AddonManager.ERROR_DOWNLOAD_ERROR); this.notifyError(AddonManager.ERROR_DOWNLOAD_ERROR);

Просмотреть файл

@ -185,6 +185,8 @@ function flushJarCache(aJarFile) {
const PREF_EM_UPDATE_BACKGROUND_URL = "extensions.update.background.url"; const PREF_EM_UPDATE_BACKGROUND_URL = "extensions.update.background.url";
const PREF_EM_UPDATE_URL = "extensions.update.url"; const PREF_EM_UPDATE_URL = "extensions.update.url";
const PREF_XPI_SIGNATURES_DEV_ROOT = "xpinstall.signatures.dev-root"; const PREF_XPI_SIGNATURES_DEV_ROOT = "xpinstall.signatures.dev-root";
const PREF_INSTALL_REQUIREBUILTINCERTS =
"extensions.install.requireBuiltInCerts";
const KEY_TEMPDIR = "TmpD"; const KEY_TEMPDIR = "TmpD";
@ -2227,9 +2229,12 @@ var DownloadAddonInstall = class extends AddonInstall {
].createInstance(Ci.nsIStreamListenerTee); ].createInstance(Ci.nsIStreamListenerTee);
listener.init(this, this.stream); listener.init(this, this.stream);
try { try {
this.badCertHandler = new CertUtils.BadCertHandler( let requireBuiltIn = Services.prefs.getBoolPref(
!AddonSettings.INSTALL_REQUIREBUILTINCERTS PREF_INSTALL_REQUIREBUILTINCERTS,
!AppConstants.MOZ_REQUIRE_SIGNING &&
!AppConstants.MOZ_APP_VERSION_DISPLAY.endsWith("esr")
); );
this.badCertHandler = new CertUtils.BadCertHandler(!requireBuiltIn);
this.channel = NetUtil.newChannel({ this.channel = NetUtil.newChannel({
uri: this.sourceURI, uri: this.sourceURI,
@ -2398,7 +2403,11 @@ var DownloadAddonInstall = class extends AddonInstall {
try { try {
CertUtils.checkCert( CertUtils.checkCert(
aRequest, aRequest,
!AddonSettings.INSTALL_REQUIREBUILTINCERTS !Services.prefs.getBoolPref(
PREF_INSTALL_REQUIREBUILTINCERTS,
!AppConstants.MOZ_REQUIRE_SIGNING &&
!AppConstants.MOZ_APP_VERSION_DISPLAY.endsWith("esr")
)
); );
} catch (e) { } catch (e) {
this.downloadFailed(AddonManager.ERROR_NETWORK_FAILURE, e); this.downloadFailed(AddonManager.ERROR_NETWORK_FAILURE, e);