mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 557710 - add support for system add-ons to fake testing cert r=kmag
MozReview-Commit-ID: IMGlPXKaOYx --HG-- extra : rebase_source : 1e7b314a0146ff4dd159b03b5605c19e5180ac88
This commit is contained in:
parent
125ee98fef
commit
141464cd20
@ -233,6 +233,10 @@ var AddonTestUtils = {
|
||||
appDirForAddons.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
|
||||
this.registerDirectory("XREAddonAppDir", appDirForAddons);
|
||||
|
||||
// Create a directory for system add-on upgrades.
|
||||
this.systemAddonDir = this.profileDir.clone();
|
||||
this.systemAddonDir.append("features");
|
||||
this.systemAddonDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
|
||||
|
||||
// Enable more extensive EM logging
|
||||
Services.prefs.setBoolPref("extensions.logging.enabled", true);
|
||||
@ -413,6 +417,16 @@ var AddonTestUtils = {
|
||||
}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Determine if this is a system add-on, based on install location.
|
||||
*
|
||||
* @param {nsIFile} file File pointer to the add-on.
|
||||
* @returns {boolean} true if install location contains add-on file.
|
||||
*/
|
||||
isSystemAddon(file) {
|
||||
return this.systemAddonDir.contains(file);
|
||||
},
|
||||
|
||||
overrideCertDB() {
|
||||
// Unregister the real database. This only works because the add-ons manager
|
||||
// hasn't started up and grabbed the certificate database yet.
|
||||
@ -436,6 +450,11 @@ var AddonTestUtils = {
|
||||
let id = yield this.getIDFromManifest(manifestURI);
|
||||
|
||||
let fakeCert = {commonName: id};
|
||||
if (this.isSystemAddon(file)) {
|
||||
fakeCert["organizationalUnit"] = "Mozilla Components";
|
||||
} else {
|
||||
fakeCert["organizationalUnit"] = "Preliminary";
|
||||
}
|
||||
|
||||
return [callback, Cr.NS_OK, fakeCert];
|
||||
} catch (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user