mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1256399 use temporary addon installation for update tests r=mossop a=testonly
MozReview-Commit-ID: AdjNzZrA79N
This commit is contained in:
parent
a94a592a9a
commit
9b05494a00
@ -67,21 +67,22 @@ function runTest() {
|
|||||||
file.append(FILE_UPDATE_ARCHIVE);
|
file.append(FILE_UPDATE_ARCHIVE);
|
||||||
ok(!file.exists(), file.path + " should not exist");
|
ok(!file.exists(), file.path + " should not exist");
|
||||||
|
|
||||||
let addonPrepDir = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR,
|
resetAddons(() => {
|
||||||
Ci.nsILocalFile);
|
let addonPrepDir = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR,
|
||||||
addonPrepDir.append(ADDON_PREP_DIR);
|
Ci.nsILocalFile);
|
||||||
// Not being able to remove the directory used to create the test add-ons
|
addonPrepDir.append(ADDON_PREP_DIR);
|
||||||
// will not adversely affect subsequent tests so wrap it in a try block and
|
// Not being able to remove the directory used to create the test add-ons
|
||||||
// don't test whether its removal was successful.
|
// will not adversely affect subsequent tests so wrap it in a try block and
|
||||||
try {
|
// don't test whether its removal was successful.
|
||||||
removeDirRecursive(addonPrepDir);
|
try {
|
||||||
}
|
removeDirRecursive(addonPrepDir);
|
||||||
catch (e) {
|
}
|
||||||
logTestInfo("Unable to remove directory. Path: " + addonPrepDir.path +
|
catch (e) {
|
||||||
", Exception: " + e);
|
logTestInfo("Unable to remove directory. Path: " + addonPrepDir.path +
|
||||||
}
|
", Exception: " + e);
|
||||||
|
}
|
||||||
resetAddons(cleanupRestoreUpdaterBackup);
|
cleanupRestoreUpdaterBackup();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1316,45 +1316,14 @@ function setupAddons(aCallback) {
|
|||||||
Services.prefs.setCharPref(PREF_DISABLEDADDONS, disabledAddons.join(" "));
|
Services.prefs.setCharPref(PREF_DISABLEDADDONS, disabledAddons.join(" "));
|
||||||
|
|
||||||
// Install the test add-ons.
|
// Install the test add-ons.
|
||||||
let xpiFiles = getTestAddonXPIFiles();
|
let promises = getTestAddonXPIFiles().map(function(aFile) {
|
||||||
let xpiCount = xpiFiles.length;
|
return AddonManager.installTemporaryAddon(aFile).then(addon => {
|
||||||
let installs = [];
|
if (getAddonTestType(addon.name) == "userdisabled") {
|
||||||
xpiFiles.forEach(function(aFile) {
|
addon.userDisabled = true;
|
||||||
AddonManager.getInstallForFile(aFile, function(aInstall) {
|
|
||||||
if (!aInstall) {
|
|
||||||
throw "No AddonInstall created for " + aFile.path;
|
|
||||||
}
|
|
||||||
|
|
||||||
installs.push(aInstall);
|
|
||||||
|
|
||||||
if (--xpiCount == 0) {
|
|
||||||
let installCount = installs.length;
|
|
||||||
let installCompleted = function(aInstall) {
|
|
||||||
aInstall.removeListener(listener);
|
|
||||||
|
|
||||||
if (getAddonTestType(aInstall.addon.name) == "userdisabled") {
|
|
||||||
aInstall.addon.userDisabled = true;
|
|
||||||
}
|
|
||||||
if (--installCount == 0) {
|
|
||||||
setNoUpdateAddonsDisabledState();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let listener = {
|
|
||||||
onDownloadFailed: installCompleted,
|
|
||||||
onDownloadCancelled: installCompleted,
|
|
||||||
onInstallFailed: installCompleted,
|
|
||||||
onInstallCancelled: installCompleted,
|
|
||||||
onInstallEnded: installCompleted
|
|
||||||
};
|
|
||||||
|
|
||||||
installs.forEach(function(aInstall) {
|
|
||||||
aInstall.addListener(listener);
|
|
||||||
aInstall.install();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
return Promise.all(promises).then(setNoUpdateAddonsDisabledState);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user