mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 957123 - Fix the use of File.prototype.close() by a few AddonManager tests. r=Unfocused
This commit is contained in:
parent
36ed748051
commit
168808d0d9
@ -23,6 +23,11 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/FileUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||
Components.utils.import("resource://gre/modules/Promise.jsm");
|
||||
Components.utils.import("resource://gre/modules/Task.jsm");
|
||||
Components.utils.import("resource://gre/modules/osfile.jsm");
|
||||
|
||||
Services.prefs.setBoolPref("toolkit.osfile.log", true);
|
||||
|
||||
// We need some internal bits of AddonManager
|
||||
let AMscope = Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||
@ -444,6 +449,7 @@ function shutdownManager() {
|
||||
// This would be cleaner if I could get it as the rejection reason from
|
||||
// the AddonManagerInternal.shutdown() promise
|
||||
gXPISaveError = XPIscope.XPIProvider._shutdownError;
|
||||
do_print("gXPISaveError set to: " + gXPISaveError);
|
||||
AddonManagerPrivate.unregisterProvider(XPIscope.XPIProvider);
|
||||
Components.utils.unload("resource://gre/modules/XPIProvider.jsm");
|
||||
}
|
||||
@ -691,6 +697,8 @@ function writeInstallRDFForExtension(aData, aDir, aId, aExtraFile) {
|
||||
*
|
||||
* @param aExt a file pointing to either the packed extension or its unpacked directory.
|
||||
* @param aTime the time to which we set the lastModifiedTime of the extension
|
||||
*
|
||||
* @deprecated Please use promiseSetExtensionModifiedTime instead
|
||||
*/
|
||||
function setExtensionModifiedTime(aExt, aTime) {
|
||||
aExt.lastModifiedTime = aTime;
|
||||
@ -702,6 +710,25 @@ function setExtensionModifiedTime(aExt, aTime) {
|
||||
entries.close();
|
||||
}
|
||||
}
|
||||
function promiseSetExtensionModifiedTime(aPath, aTime) {
|
||||
return Task.spawn(function* () {
|
||||
yield OS.File.setDates(aPath, aTime, aTime);
|
||||
let entries, iterator;
|
||||
try {
|
||||
let iterator = new OS.File.DirectoryIterator(aPath);
|
||||
entries = yield iterator.nextBatch();
|
||||
} catch (ex if ex instanceof OS.File.Error) {
|
||||
return;
|
||||
} finally {
|
||||
if (iterator) {
|
||||
iterator.close();
|
||||
}
|
||||
}
|
||||
for (let entry of entries) {
|
||||
yield promiseSetExtensionModifiedTime(entry.path, aTime);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually installs an XPI file into an install location by either copying the
|
||||
@ -1082,7 +1109,11 @@ function completeAllInstalls(aInstalls, aCallback) {
|
||||
function installAllFiles(aFiles, aCallback, aIgnoreIncompatible) {
|
||||
let count = aFiles.length;
|
||||
let installs = [];
|
||||
|
||||
function callback() {
|
||||
if (aCallback) {
|
||||
aCallback();
|
||||
}
|
||||
}
|
||||
aFiles.forEach(function(aFile) {
|
||||
AddonManager.getInstallForFile(aFile, function(aInstall) {
|
||||
if (!aInstall)
|
||||
@ -1093,11 +1124,18 @@ function installAllFiles(aFiles, aCallback, aIgnoreIncompatible) {
|
||||
installs.push(aInstall);
|
||||
|
||||
if (--count == 0)
|
||||
completeAllInstalls(installs, aCallback);
|
||||
completeAllInstalls(installs, callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function promiseInstallAllFiles(aFiles, aIgnoreIncompatible) {
|
||||
let deferred = Promise.defer();
|
||||
installAllFiles(aFiles, deferred.resolve, aIgnoreIncompatible);
|
||||
return deferred.promise;
|
||||
|
||||
}
|
||||
|
||||
if ("nsIWindowsRegKey" in AM_Ci) {
|
||||
var MockRegistry = {
|
||||
LOCAL_MACHINE: {},
|
||||
@ -1473,3 +1511,17 @@ function callback_soon(aFunction) {
|
||||
}, aFunction.name ? "delayed callback " + aFunction.name : "delayed callback");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A promise-based variant of AddonManager.getAddonsByIDs.
|
||||
*
|
||||
* @param {array} list As the first argument of AddonManager.getAddonsByIDs
|
||||
* @return {promise}
|
||||
* @resolve {array} The list of add-ons sent by AddonManaget.getAddonsByIDs to
|
||||
* its callback.
|
||||
*/
|
||||
function promiseAddonsByIDs(list) {
|
||||
let deferred = Promise.defer();
|
||||
AddonManager.getAddonsByIDs(list, deferred.resolve);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
@ -134,8 +134,7 @@ var theme2 = {
|
||||
const profileDir = gProfD.clone();
|
||||
profileDir.append("extensions");
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
add_task(function* init() {
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
|
||||
|
||||
writeInstallRDFForExtension(addon1, profileDir);
|
||||
@ -154,12 +153,13 @@ function run_test() {
|
||||
// New profile so new add-ons are ignored
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon2@tests.mozilla.org",
|
||||
let [a2, a3, a4, a7, t2] =
|
||||
yield promiseAddonsByIDs(["addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"theme2@tests.mozilla.org"], function([a2, a3, a4,
|
||||
a7, t2]) {
|
||||
"theme2@tests.mozilla.org"]);
|
||||
let deferredUpdateFinished = Promise.defer();
|
||||
// Set up the initial state
|
||||
a2.userDisabled = true;
|
||||
a4.userDisabled = true;
|
||||
@ -170,21 +170,20 @@ function run_test() {
|
||||
a4.findUpdates({
|
||||
onUpdateFinished: function() {
|
||||
// Let the updates finish before restarting the manager
|
||||
do_execute_soon(run_test_1);
|
||||
deferredUpdateFinished.resolve();
|
||||
}
|
||||
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
|
||||
}
|
||||
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
|
||||
});
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
testserver.stop(do_test_finished);
|
||||
}
|
||||
yield deferredUpdateFinished.promise;
|
||||
});
|
||||
|
||||
function run_test_1() {
|
||||
|
||||
add_task(function* run_test_1() {
|
||||
restartManager();
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
let [a1, a2, a3, a4, a5, a6, a7, t1, t2] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
@ -192,8 +191,8 @@ function run_test_1() {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"theme1@tests.mozilla.org",
|
||||
"theme2@tests.mozilla.org"],
|
||||
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
|
||||
"theme2@tests.mozilla.org"]);
|
||||
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
do_check_false(a1.userDisabled);
|
||||
@ -265,9 +264,9 @@ function run_test_1() {
|
||||
if (OS.Constants.libc.O_EXLOCK)
|
||||
options.unixFlags = OS.Constants.libc.O_EXLOCK;
|
||||
|
||||
OS.File.open(gExtensionsJSON.path, {read:true, write:true, existing:true}, options).then(
|
||||
file => {
|
||||
filePermissions = gExtensionsJSON.permissions;
|
||||
let file = yield OS.File.open(gExtensionsJSON.path, {read:true, write:true, existing:true}, options);
|
||||
|
||||
let filePermissions = gExtensionsJSON.permissions;
|
||||
if (!OS.Constants.Win) {
|
||||
gExtensionsJSON.permissions = 0;
|
||||
}
|
||||
@ -277,7 +276,8 @@ function run_test_1() {
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
|
||||
|
||||
// Accessing the add-ons should open and recover the database
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
[a1, a2, a3, a4, a5, a6, a7, t1, t2] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
@ -285,8 +285,8 @@ function run_test_1() {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"theme1@tests.mozilla.org",
|
||||
"theme2@tests.mozilla.org"],
|
||||
callback_soon(function get_after_lock([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
|
||||
"theme2@tests.mozilla.org"]);
|
||||
|
||||
// Should be correctly recovered
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
@ -366,7 +366,8 @@ function run_test_1() {
|
||||
// Shouldn't have seen any startup changes
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
[a1, a2, a3, a4, a5, a6, a7, t1, t2] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
@ -374,8 +375,8 @@ function run_test_1() {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"theme1@tests.mozilla.org",
|
||||
"theme2@tests.mozilla.org"],
|
||||
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
|
||||
"theme2@tests.mozilla.org"]);
|
||||
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
do_check_false(a1.userDisabled);
|
||||
@ -441,7 +442,7 @@ function run_test_1() {
|
||||
// they were previously
|
||||
shutdownManager();
|
||||
do_print("Unlocking " + gExtensionsJSON.path);
|
||||
file.close();
|
||||
yield file.close();
|
||||
gExtensionsJSON.permissions = filePermissions;
|
||||
startupManager();
|
||||
|
||||
@ -449,7 +450,8 @@ function run_test_1() {
|
||||
// Shouldn't have seen any startup changes
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
[a1, a2, a3, a4, a5, a6, a7, t1, t2] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
@ -457,8 +459,8 @@ function run_test_1() {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"theme1@tests.mozilla.org",
|
||||
"theme2@tests.mozilla.org"],
|
||||
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
|
||||
"theme2@tests.mozilla.org"]);
|
||||
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
do_check_false(a1.userDisabled);
|
||||
@ -519,13 +521,9 @@ function run_test_1() {
|
||||
do_check_false(t2.appDisabled);
|
||||
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
|
||||
do_check_true(isThemeInAddonsList(profileDir, t2.id));
|
||||
});
|
||||
|
||||
end_test();
|
||||
}));
|
||||
}));
|
||||
}));
|
||||
},
|
||||
do_report_unexpected_exception
|
||||
);
|
||||
}));
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
@ -71,8 +71,8 @@ var addon5 = {
|
||||
const profileDir = gProfD.clone();
|
||||
profileDir.append("extensions");
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
add_task(function() {
|
||||
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
|
||||
|
||||
writeInstallRDFForExtension(addon1, profileDir);
|
||||
@ -83,7 +83,8 @@ function run_test() {
|
||||
|
||||
// Make it look like add-on 5 was installed some time in the past so the update is
|
||||
// detected
|
||||
setExtensionModifiedTime(getFileForAddon(profileDir, addon5.id), Date.now() - (60000));
|
||||
let path = getFileForAddon(profileDir, addon5.id).path;
|
||||
yield promiseSetExtensionModifiedTime(path, Date.now() - (60000));
|
||||
|
||||
// Startup the profile and setup the initial state
|
||||
startupManager();
|
||||
@ -91,23 +92,26 @@ function run_test() {
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
|
||||
|
||||
AddonManager.getAddonByID("addon2@tests.mozilla.org", callback_soon(function(a2) {
|
||||
let a1, a2, a3, a4, a5, a6;
|
||||
|
||||
[a2] = yield promiseAddonsByIDs(["addon2@tests.mozilla.org"]);
|
||||
a2.userDisabled = true;
|
||||
|
||||
restartManager();
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
[a1, a2, a3, a4, a5] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org"],
|
||||
function([a1, a2, a3, a4, a5]) {
|
||||
"addon5@tests.mozilla.org"]);
|
||||
|
||||
a2.userDisabled = false;
|
||||
a3.userDisabled = true;
|
||||
a4.uninstall();
|
||||
|
||||
installAllFiles([do_get_addon("test_locked2_5"),
|
||||
do_get_addon("test_locked2_6")], function locked_installed() {
|
||||
yield promiseInstallAllFiles([do_get_addon("test_locked2_5"),
|
||||
do_get_addon("test_locked2_6")]);
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
do_check_false(a1.userDisabled);
|
||||
@ -154,9 +158,9 @@ function run_test() {
|
||||
if (OS.Constants.libc.O_EXLOCK)
|
||||
options.unixFlags = OS.Constants.libc.O_EXLOCK;
|
||||
|
||||
OS.File.open(gExtensionsJSON.path, {read:true, write:true, existing:true}, options).then(
|
||||
file => {
|
||||
filePermissions = gExtensionsJSON.permissions;
|
||||
let file = yield OS.File.open(gExtensionsJSON.path, {read:true, write:true, existing:true}, options);
|
||||
|
||||
let filePermissions = gExtensionsJSON.permissions;
|
||||
if (!OS.Constants.Win) {
|
||||
gExtensionsJSON.permissions = 0;
|
||||
}
|
||||
@ -165,13 +169,14 @@ function run_test() {
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
[a1, a2, a3, a4, a5, a6] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org",
|
||||
"addon6@tests.mozilla.org"],
|
||||
callback_soon(function([a1, a2, a3, a4, a5, a6]) {
|
||||
"addon6@tests.mozilla.org"]);
|
||||
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
do_check_false(a1.userDisabled);
|
||||
@ -213,7 +218,7 @@ function run_test() {
|
||||
// After allowing access to the original DB things should still be
|
||||
// back how they were before the lock
|
||||
shutdownManager();
|
||||
file.close();
|
||||
yield file.close();
|
||||
gExtensionsJSON.permissions = filePermissions;
|
||||
startupManager();
|
||||
|
||||
@ -234,13 +239,14 @@ function run_test() {
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_UNINSTALLED, []);
|
||||
}
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
[a1, a2, a3, a4, a5, a6] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon5@tests.mozilla.org",
|
||||
"addon6@tests.mozilla.org"],
|
||||
function([a1, a2, a3, a4, a5, a6]) {
|
||||
"addon6@tests.mozilla.org"]);
|
||||
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
do_check_false(a1.userDisabled);
|
||||
@ -278,18 +284,9 @@ function run_test() {
|
||||
do_check_false(a6.appDisabled);
|
||||
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
|
||||
do_check_true(isExtensionInAddonsList(profileDir, a6.id));
|
||||
});
|
||||
|
||||
end_test();
|
||||
});
|
||||
}));
|
||||
},
|
||||
do_report_unexpected_exception
|
||||
);
|
||||
});
|
||||
});
|
||||
}));
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
do_execute_soon(do_test_finished);
|
||||
}
|
||||
|
@ -134,8 +134,7 @@ var theme2 = {
|
||||
const profileDir = gProfD.clone();
|
||||
profileDir.append("extensions");
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
add_task(function* init() {
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
|
||||
|
||||
writeInstallRDFForExtension(addon1, profileDir);
|
||||
@ -154,13 +153,18 @@ function run_test() {
|
||||
// New profile so new add-ons are ignored
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon2@tests.mozilla.org",
|
||||
let a1, a2, a3, a4, a5, a6, a7, t1, t2;
|
||||
|
||||
[a2, a3, a4, a7, t2] =
|
||||
yield promiseAddonsByIDs(["addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"theme2@tests.mozilla.org"], function([a2, a3, a4,
|
||||
a7, t2]) {
|
||||
"theme2@tests.mozilla.org"]);
|
||||
|
||||
// Set up the initial state
|
||||
let deferredUpdateFinished = Promise.defer();
|
||||
|
||||
a2.userDisabled = true;
|
||||
a4.userDisabled = true;
|
||||
a7.userDisabled = true;
|
||||
@ -169,22 +173,20 @@ function run_test() {
|
||||
onUpdateFinished: function() {
|
||||
a4.findUpdates({
|
||||
onUpdateFinished: function() {
|
||||
do_execute_soon(run_test_1);
|
||||
deferredUpdateFinished.resolve();
|
||||
}
|
||||
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
|
||||
}
|
||||
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
|
||||
});
|
||||
}
|
||||
yield deferredUpdateFinished.promise;
|
||||
});
|
||||
|
||||
function end_test() {
|
||||
testserver.stop(do_test_finished);
|
||||
}
|
||||
add_task(function* run_test_1() {
|
||||
let a1, a2, a3, a4, a5, a6, a7, t1, t2;
|
||||
|
||||
function run_test_1() {
|
||||
restartManager();
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
[a1, a2, a3, a4, a5, a6, a7, t1, t2] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
@ -192,8 +194,8 @@ function run_test_1() {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"theme1@tests.mozilla.org",
|
||||
"theme2@tests.mozilla.org"],
|
||||
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
|
||||
"theme2@tests.mozilla.org"]);
|
||||
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
do_check_false(a1.userDisabled);
|
||||
@ -265,9 +267,9 @@ function run_test_1() {
|
||||
if (OS.Constants.libc.O_EXLOCK)
|
||||
options.unixFlags = OS.Constants.libc.O_EXLOCK;
|
||||
|
||||
OS.File.open(gExtensionsJSON.path, {read:true, write:true, existing:true}, options).then(
|
||||
file => {
|
||||
filePermissions = gExtensionsJSON.permissions;
|
||||
let file = yield OS.File.open(gExtensionsJSON.path, {read:true, write:true, existing:true}, options);
|
||||
|
||||
let filePermissions = gExtensionsJSON.permissions;
|
||||
if (!OS.Constants.Win) {
|
||||
gExtensionsJSON.permissions = 0;
|
||||
}
|
||||
@ -277,7 +279,8 @@ function run_test_1() {
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
|
||||
|
||||
// Accessing the add-ons should open and recover the database
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
[a1, a2, a3, a4, a5, a6, a7, t1, t2] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
@ -285,8 +288,8 @@ function run_test_1() {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"theme1@tests.mozilla.org",
|
||||
"theme2@tests.mozilla.org"],
|
||||
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
|
||||
"theme2@tests.mozilla.org"]);
|
||||
|
||||
// Should be correctly recovered
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
@ -364,7 +367,8 @@ function run_test_1() {
|
||||
// Shouldn't have seen any startup changes
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
[a1, a2, a3, a4, a5, a6, a7, t1, t2] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
@ -372,8 +376,8 @@ function run_test_1() {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"theme1@tests.mozilla.org",
|
||||
"theme2@tests.mozilla.org"],
|
||||
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
|
||||
"theme2@tests.mozilla.org"]);
|
||||
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
do_check_false(a1.userDisabled);
|
||||
@ -439,14 +443,15 @@ function run_test_1() {
|
||||
// back how they were before the lock
|
||||
shutdownManager();
|
||||
do_print("Unlocking " + gExtensionsJSON.path);
|
||||
file.close();
|
||||
yield file.close();
|
||||
gExtensionsJSON.permissions = filePermissions;
|
||||
startupManager(false);
|
||||
|
||||
// Shouldn't have seen any startup changes
|
||||
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
|
||||
|
||||
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
[a1, a2, a3, a4, a5, a6, a7, t1, t2] =
|
||||
yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
|
||||
"addon2@tests.mozilla.org",
|
||||
"addon3@tests.mozilla.org",
|
||||
"addon4@tests.mozilla.org",
|
||||
@ -454,8 +459,8 @@ function run_test_1() {
|
||||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"theme1@tests.mozilla.org",
|
||||
"theme2@tests.mozilla.org"],
|
||||
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
|
||||
"theme2@tests.mozilla.org"]);
|
||||
|
||||
do_check_neq(a1, null);
|
||||
do_check_true(a1.isActive);
|
||||
do_check_false(a1.userDisabled);
|
||||
@ -538,13 +543,9 @@ function run_test_1() {
|
||||
do_check_false(t2.appDisabled);
|
||||
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
|
||||
do_check_true(isThemeInAddonsList(profileDir, t2.id));
|
||||
});
|
||||
|
||||
end_test();
|
||||
}));
|
||||
}));
|
||||
}));
|
||||
},
|
||||
do_report_unexpected_exception
|
||||
);
|
||||
}));
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user