Backed out changeset f6f28be8d8f2 (bug 1315781) for XPCShell test timed out

--HG--
extra : rebase_source : 0122a5372b6ac2174d4c37e7cc0169bf9c437178
This commit is contained in:
Iris Hsiao 2016-11-10 14:53:46 +08:00
parent 743953244a
commit 0cc78823fe
76 changed files with 1133 additions and 1134 deletions

View File

@ -106,15 +106,15 @@ function backgroundScript() {
collectedEvents.push({event: "onRemoved", id, info});
});
browser.bookmarks.get(["not-a-bookmark-guid"]).then(expectedError, invalidGuidError => {
browser.bookmarks.get(["not-a-bookmark-guid"]).then(expectedError, error => {
browser.test.assertTrue(
invalidGuidError.message.includes("Invalid value for property 'guid': not-a-bookmark-guid"),
error.message.includes("Invalid value for property 'guid': not-a-bookmark-guid"),
"Expected error thrown when trying to get a bookmark using an invalid guid"
);
return browser.bookmarks.get([nonExistentId]).then(expectedError, nonExistentIdError => {
return browser.bookmarks.get([nonExistentId]).then(expectedError, error => {
browser.test.assertTrue(
nonExistentIdError.message.includes("Bookmark not found"),
error.message.includes("Bookmark not found"),
"Expected error thrown when trying to get a bookmark using a non-existent Id"
);
});
@ -181,7 +181,7 @@ function backgroundScript() {
});
}).then(results => {
browser.test.assertEq(1, results.length, "getTree returns one result");
let bookmark = results[0].children.find(bookmarkItem => bookmarkItem.id == unsortedId);
let bookmark = results[0].children.find(bookmark => bookmark.id == unsortedId);
browser.test.assertEq(
"Other Bookmarks",
bookmark.title,
@ -249,11 +249,11 @@ function backgroundScript() {
browser.bookmarks.create({title: "Mozilla", url: "http://allizom.org/", parentId: createdFolderId}),
browser.bookmarks.create({title: "Mozilla Corporation", url: "http://allizom.com/", parentId: createdFolderId}),
browser.bookmarks.create({title: "Firefox", url: "http://allizom.org/firefox/", parentId: createdFolderId}),
]).then(newBookmarks => {
]).then(results => {
browser.test.assertEq(3, collectedEvents.length, "3 expected events received");
checkOnCreated(newBookmarks[2].id, createdFolderId, 0, "Firefox", "http://allizom.org/firefox/", newBookmarks[2].dateAdded);
checkOnCreated(newBookmarks[1].id, createdFolderId, 0, "Mozilla Corporation", "http://allizom.com/", newBookmarks[1].dateAdded);
checkOnCreated(newBookmarks[0].id, createdFolderId, 0, "Mozilla", "http://allizom.org/", newBookmarks[0].dateAdded);
checkOnCreated(results[2].id, createdFolderId, 0, "Firefox", "http://allizom.org/firefox/", results[2].dateAdded);
checkOnCreated(results[1].id, createdFolderId, 0, "Mozilla Corporation", "http://allizom.com/", results[1].dateAdded);
checkOnCreated(results[0].id, createdFolderId, 0, "Mozilla", "http://allizom.org/", results[0].dateAdded);
return browser.bookmarks.create({
title: "About Mozilla",
@ -267,8 +267,8 @@ function backgroundScript() {
// returns all items on empty object
return browser.bookmarks.search({});
}).then(bookmarksSearchResults => {
browser.test.assertTrue(bookmarksSearchResults.length >= 9, "At least as many bookmarks as added were returned by search({})");
}).then(results => {
browser.test.assertTrue(results.length >= 9, "At least as many bookmarks as added were returned by search({})");
return Promise.resolve().then(() => {
return browser.bookmarks.remove(createdFolderId);
@ -525,10 +525,10 @@ function backgroundScript() {
browser.test.assertEq(1, collectedEvents.length, "1 expected events received");
checkOnRemoved(createdFolderId, bookmarkGuids.unfiledGuid, 1);
return browser.bookmarks.search({}).then(searchResults => {
return browser.bookmarks.search({}).then(results => {
browser.test.assertEq(
startBookmarkCount - 4,
searchResults.length,
results.length,
"Expected number of results returned after removeTree");
});
});

View File

@ -63,9 +63,9 @@ add_task(function* test_delete() {
let visits = [];
let visitDate = new Date(1999, 9, 9, 9, 9).getTime();
function pushVisit(subvisits) {
function pushVisit(visits) {
visitDate += 1000;
subvisits.push({date: new Date(visitDate)});
visits.push({date: new Date(visitDate)});
}
// Add 5 visits for one uri and 3 visits for 3 others
@ -166,7 +166,7 @@ add_task(function* test_search() {
},
];
function background(BGSCRIPT_REFERENCE_DATE) {
function background(REFERENCE_DATE) {
const futureTime = Date.now() + 24 * 60 * 60 * 1000;
browser.test.onMessage.addListener(msg => {
@ -178,7 +178,7 @@ add_task(function* test_search() {
return browser.history.search({text: "example.com", maxResults: 1});
}).then(results => {
browser.test.sendMessage("max-results-search", results);
return browser.history.search({text: "", startTime: BGSCRIPT_REFERENCE_DATE - 2000, endTime: BGSCRIPT_REFERENCE_DATE - 1000});
return browser.history.search({text: "", startTime: REFERENCE_DATE - 2000, endTime: REFERENCE_DATE - 1000});
}).then(results => {
browser.test.sendMessage("date-range-search", results);
return browser.history.search({text: "", startTime: futureTime});

View File

@ -5,10 +5,10 @@
/* globals chrome */
function* testPermission(options) {
function background(bgOptions) {
function background(options) {
browser.test.sendMessage("typeof-namespace", {
browser: typeof browser[bgOptions.namespace],
chrome: typeof chrome[bgOptions.namespace],
browser: typeof browser[options.namespace],
chrome: typeof chrome[options.namespace],
});
}

View File

@ -33,18 +33,18 @@ function waitForBookmarkNotification(aNotification, aCallback, aProperty)
onItemRemoved: function onItemRemoved() {
return this.validate(arguments.callee.name, arguments);
},
onItemChanged: function onItemChanged(id, property, aIsAnno,
aNewValue, aLastModified, type)
onItemChanged: function onItemChanged(aItemId, aProperty, aIsAnno,
aNewValue, aLastModified, aItemType)
{
return this.validate(arguments.callee.name,
{ id,
{ id: aItemId,
get index() {
return PlacesUtils.bookmarks.getItemIndex(this.id);
},
type,
property,
type: aItemType,
property: aProperty,
get url() {
return type == PlacesUtils.bookmarks.TYPE_BOOKMARK ?
return aItemType == PlacesUtils.bookmarks.TYPE_BOOKMARK ?
PlacesUtils.bookmarks.getBookmarkURI(this.id).spec :
null;
},
@ -121,30 +121,30 @@ add_test(function test_container()
{
const TEST_TITLE = "Places folder"
waitForBookmarkNotification("onItemChanged", function(aChangedData)
waitForBookmarkNotification("onItemChanged", function(aData)
{
do_check_eq(aChangedData.title, TEST_TITLE);
do_check_eq(aChangedData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
do_check_eq(aChangedData.index, 1);
do_check_eq(aData.title, TEST_TITLE);
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
do_check_eq(aData.index, 1);
waitForBookmarkNotification("onItemAdded", function(aAddedData)
waitForBookmarkNotification("onItemAdded", function(aData)
{
do_check_eq(aAddedData.title, TEST_TITLE);
do_check_eq(aAddedData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
do_check_eq(aAddedData.index, 2);
let id = aAddedData.id;
do_check_eq(aData.title, TEST_TITLE);
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
do_check_eq(aData.index, 2);
let id = aData.id;
waitForBookmarkNotification("onItemMoved", function(aMovedData)
waitForBookmarkNotification("onItemMoved", function(aData)
{
do_check_eq(aMovedData.id, id);
do_check_eq(aMovedData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
do_check_eq(aMovedData.index, 1);
do_check_eq(aData.id, id);
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
do_check_eq(aData.index, 1);
run_next_test();
});
let txn = PlacesUIUtils.makeTransaction(
wrapNodeByIdAndParent(aAddedData.id, PlacesUtils.unfiledBookmarksFolderId),
wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
0, // Unused for real nodes.
PlacesUtils.unfiledBookmarksFolderId,
1, // Move to position 1.
@ -155,7 +155,7 @@ add_test(function test_container()
try {
let txn = PlacesUIUtils.makeTransaction(
wrapNodeByIdAndParent(aChangedData.id, PlacesUtils.unfiledBookmarksFolderId),
wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
0, // Unused for real nodes.
PlacesUtils.unfiledBookmarksFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX,
@ -181,28 +181,28 @@ add_test(function test_container()
add_test(function test_separator()
{
waitForBookmarkNotification("onItemChanged", function(aChangedData)
waitForBookmarkNotification("onItemChanged", function(aData)
{
do_check_eq(aChangedData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
do_check_eq(aChangedData.index, 3);
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
do_check_eq(aData.index, 3);
waitForBookmarkNotification("onItemAdded", function(aAddedData)
waitForBookmarkNotification("onItemAdded", function(aData)
{
do_check_eq(aAddedData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
do_check_eq(aAddedData.index, 4);
let id = aAddedData.id;
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
do_check_eq(aData.index, 4);
let id = aData.id;
waitForBookmarkNotification("onItemMoved", function(aMovedData)
waitForBookmarkNotification("onItemMoved", function(aData)
{
do_check_eq(aMovedData.id, id);
do_check_eq(aMovedData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
do_check_eq(aMovedData.index, 1);
do_check_eq(aData.id, id);
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
do_check_eq(aData.index, 1);
run_next_test();
});
let txn = PlacesUIUtils.makeTransaction(
wrapNodeByIdAndParent(aAddedData.id, PlacesUtils.unfiledBookmarksFolderId),
wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
0, // Unused for real nodes.
PlacesUtils.unfiledBookmarksFolderId,
1, // Move to position 1.
@ -213,7 +213,7 @@ add_test(function test_separator()
try {
let txn = PlacesUIUtils.makeTransaction(
wrapNodeByIdAndParent(aChangedData.id, PlacesUtils.unfiledBookmarksFolderId),
wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
0, // Unused for real nodes.
PlacesUtils.unfiledBookmarksFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX,
@ -237,32 +237,32 @@ add_test(function test_bookmark()
const TEST_URL = "http://places.moz.org/"
const TEST_TITLE = "Places bookmark"
waitForBookmarkNotification("onItemChanged", function(aChangedData)
waitForBookmarkNotification("onItemChanged", function(aData)
{
do_check_eq(aChangedData.title, TEST_TITLE);
do_check_eq(aChangedData.url, TEST_URL);
do_check_eq(aChangedData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
do_check_eq(aChangedData.index, 5);
do_check_eq(aData.title, TEST_TITLE);
do_check_eq(aData.url, TEST_URL);
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
do_check_eq(aData.index, 5);
waitForBookmarkNotification("onItemAdded", function(aAddedData)
waitForBookmarkNotification("onItemAdded", function(aData)
{
do_check_eq(aAddedData.title, TEST_TITLE);
do_check_eq(aAddedData.url, TEST_URL);
do_check_eq(aAddedData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
do_check_eq(aAddedData.index, 6);
let id = aAddedData.id;
do_check_eq(aData.title, TEST_TITLE);
do_check_eq(aData.url, TEST_URL);
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
do_check_eq(aData.index, 6);
let id = aData.id;
waitForBookmarkNotification("onItemMoved", function(aMovedData)
waitForBookmarkNotification("onItemMoved", function(aData)
{
do_check_eq(aMovedData.id, id);
do_check_eq(aMovedData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
do_check_eq(aMovedData.index, 1);
do_check_eq(aData.id, id);
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
do_check_eq(aData.index, 1);
run_next_test();
});
let txn = PlacesUIUtils.makeTransaction(
wrapNodeByIdAndParent(aAddedData.id, PlacesUtils.unfiledBookmarksFolderId),
wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
0, // Unused for real nodes.
PlacesUtils.unfiledBookmarksFolderId,
1, // Move to position 1.
@ -273,7 +273,7 @@ add_test(function test_bookmark()
try {
let txn = PlacesUIUtils.makeTransaction(
wrapNodeByIdAndParent(aChangedData.id, PlacesUtils.unfiledBookmarksFolderId),
wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
0, // Unused for real nodes.
PlacesUtils.unfiledBookmarksFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX,
@ -302,24 +302,24 @@ add_test(function test_visit()
const TEST_URL = "http://places.moz.org/"
const TEST_TITLE = "Places bookmark"
waitForBookmarkNotification("onItemAdded", function(aAddedData)
waitForBookmarkNotification("onItemAdded", function(aData)
{
do_check_eq(aAddedData.title, TEST_TITLE);
do_check_eq(aAddedData.url, TEST_URL);
do_check_eq(aAddedData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
do_check_eq(aAddedData.index, 7);
do_check_eq(aData.title, TEST_TITLE);
do_check_eq(aData.url, TEST_URL);
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
do_check_eq(aData.index, 7);
waitForBookmarkNotification("onItemAdded", function(aAddedData2)
waitForBookmarkNotification("onItemAdded", function(aData)
{
do_check_eq(aAddedData2.title, TEST_TITLE);
do_check_eq(aAddedData2.url, TEST_URL);
do_check_eq(aAddedData2.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
do_check_eq(aAddedData2.index, 8);
do_check_eq(aData.title, TEST_TITLE);
do_check_eq(aData.url, TEST_URL);
do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
do_check_eq(aData.index, 8);
run_next_test();
});
try {
let node = wrapNodeByIdAndParent(aAddedData.id, PlacesUtils.unfiledBookmarksFolderId);
let node = wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId);
// Simulate a not-bookmarked node, will copy it to a new bookmark.
node.id = -1;
let txn = PlacesUIUtils.makeTransaction(

View File

@ -49,9 +49,9 @@ add_task(function* test_provider_basic() {
provider.getAddonsByTypes(["experiment"], (addons) => {
deferred.resolve(addons);
});
let experimentAddons = yield deferred.promise;
Assert.ok(Array.isArray(experimentAddons), "getAddonsByTypes returns an Array.");
Assert.equal(experimentAddons.length, 0, "No previous add-ons returned.");
let addons = yield deferred.promise;
Assert.ok(Array.isArray(addons), "getAddonsByTypes returns an Array.");
Assert.equal(addons.length, 0, "No previous add-ons returned.");
gManifestObject = {
version: 1,
@ -75,8 +75,8 @@ add_task(function* test_provider_basic() {
provider.getAddonsByTypes(["experiment"], (addons) => {
deferred.resolve(addons);
});
experimentAddons = yield deferred.promise;
Assert.equal(experimentAddons.length, 0, "Still no previous experiment.");
addons = yield deferred.promise;
Assert.equal(addons.length, 0, "Still no previous experiment.");
let experiments = yield e.getExperiments();
Assert.equal(experiments.length, 1, "1 experiment present.");
@ -94,9 +94,9 @@ add_task(function* test_provider_basic() {
provider.getAddonsByTypes(["experiment"], (addons) => {
deferred.resolve(addons);
});
experimentAddons = yield deferred.promise;
Assert.equal(experimentAddons.length, 1, "1 previous add-on known.");
Assert.equal(experimentAddons[0].id, EXPERIMENT1_ID, "ID matches expected.");
addons = yield deferred.promise;
Assert.equal(addons.length, 1, "1 previous add-on known.");
Assert.equal(addons[0].id, EXPERIMENT1_ID, "ID matches expected.");
deferred = Promise.defer();
provider.getAddonByID(EXPERIMENT1_ID, (addon) => {
@ -115,10 +115,10 @@ add_task(function* test_provider_basic() {
AddonManager.getAddonsByTypes(["experiment"], (addons) => {
deferred.resolve(addons);
});
experimentAddons = yield deferred.promise;
Assert.equal(experimentAddons.length, 1, "Got 1 experiment from add-on manager.");
Assert.equal(experimentAddons[0].id, EXPERIMENT1_ID, "ID matches expected.");
Assert.ok(experimentAddons[0].appDisabled, "It is a previous experiment add-on.");
addons = yield deferred.promise;
Assert.equal(addons.length, 1, "Got 1 experiment from add-on manager.");
Assert.equal(addons[0].id, EXPERIMENT1_ID, "ID matches expected.");
Assert.ok(addons[0].appDisabled, "It is a previous experiment add-on.");
});
add_task(function* test_active_and_previous() {
@ -153,17 +153,17 @@ add_task(function* test_active_and_previous() {
provider.getAddonsByTypes(["experiment"], (addons) => {
deferred.resolve(addons);
});
let experimentAddons = yield deferred.promise;
Assert.equal(experimentAddons.length, 1, "1 previous experiment.");
let addons = yield deferred.promise;
Assert.equal(addons.length, 1, "1 previous experiment.");
deferred = Promise.defer();
AddonManager.getAddonsByTypes(["experiment"], (addons) => {
deferred.resolve(addons);
});
experimentAddons = yield deferred.promise;
Assert.equal(experimentAddons.length, 2, "2 experiment add-ons known.");
addons = yield deferred.promise;
Assert.equal(addons.length, 2, "2 experiment add-ons known.");
for (let addon of experimentAddons) {
for (let addon of addons) {
if (addon.id == EXPERIMENT1_ID) {
Assert.equal(addon.isActive, false, "Add-on is not active.");
Assert.ok(addon.appDisabled, "Should be a previous experiment.");

View File

@ -64,12 +64,12 @@ function setManifestPref(manifest) {
Services.prefs.setComplexValue("social.manifest." + manifest.origin, Ci.nsISupportsString, string);
}
function do_wait_observer(obsTopic, cb) {
function do_wait_observer(topic, cb) {
function observer(subject, topic, data) {
Services.obs.removeObserver(observer, topic);
cb();
}
Services.obs.addObserver(observer, obsTopic, false);
Services.obs.addObserver(observer, topic, false);
}
function do_add_providers(cb) {

View File

@ -247,7 +247,7 @@ function setTimeout(fun, timeout) {
let timer = Components.classes["@mozilla.org/timer;1"]
.createInstance(Components.interfaces.nsITimer);
var event = {
notify: function () {
notify: function (timer) {
fun();
}
};
@ -1662,8 +1662,8 @@ add_task(function* test_inadjecentSites() {
badSiteB64.push(DirectoryLinksProvider._generateHash(site));
});
let theList = {"domains": badSiteB64};
let uri = 'data:application/json,' + JSON.stringify(theList);
DirectoryLinksProvider._inadjacentSitesUrl = uri;
let dataURI = 'data:application/json,' + JSON.stringify(theList);
DirectoryLinksProvider._inadjacentSitesUrl = dataURI;
return DirectoryLinksProvider._loadInadjacentSites();
}

View File

@ -332,15 +332,15 @@ function add_connection_test(aHost, aExpectedResult,
aAfterStreamOpen, aFirstPartyDomain) {
const REMOTE_PORT = 8443;
function Connection(host) {
this.host = host;
function Connection(aHost) {
this.host = aHost;
let threadManager = Cc["@mozilla.org/thread-manager;1"]
.getService(Ci.nsIThreadManager);
this.thread = threadManager.currentThread;
this.defer = Promise.defer();
let sts = Cc["@mozilla.org/network/socket-transport-service;1"]
.getService(Ci.nsISocketTransportService);
this.transport = sts.createTransport(["ssl"], 1, host, REMOTE_PORT, null);
this.transport = sts.createTransport(["ssl"], 1, aHost, REMOTE_PORT, null);
// See bug 1129771 - attempting to connect to [::1] when the server is
// listening on 127.0.0.1 causes frequent failures on OS X 10.10.
this.transport.connectionFlags |= Ci.nsISocketTransport.DISABLE_IPV6;
@ -400,11 +400,11 @@ function add_connection_test(aHost, aExpectedResult,
}
};
/* Returns a promise to connect to host that resolves to the result of that
/* Returns a promise to connect to aHost that resolves to the result of that
* connection */
function connectTo(host) {
Services.prefs.setCharPref("network.dns.localDomains", host);
let connection = new Connection(host);
function connectTo(aHost) {
Services.prefs.setCharPref("network.dns.localDomains", aHost);
let connection = new Connection(aHost);
return connection.go();
}

View File

@ -29,11 +29,11 @@ updateAppInfo({
// we need to ensure we setup revocation data before certDB, or we'll start with
// no revocation.txt in the profile
var gProfile = do_get_profile();
var profile = do_get_profile();
// Write out an empty blocklist.xml file to the profile to ensure nothing
// is blocklisted by default
var blockFile = gProfile.clone();
var blockFile = profile.clone();
blockFile.append("blocklist.xml");
var stream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
@ -50,11 +50,11 @@ stream.close();
const PREF_BLOCKLIST_UPDATE_ENABLED = "services.blocklist.update_enabled";
const PREF_ONECRL_VIA_AMO = "security.onecrl.via.amo";
var gRevocations = gProfile.clone();
gRevocations.append("revocations.txt");
if (!gRevocations.exists()) {
var revocations = profile.clone();
revocations.append("revocations.txt");
if (!revocations.exists()) {
let existing = do_get_file("test_onecrl/sample_revocations.txt", false);
existing.copyTo(gProfile, "revocations.txt");
existing.copyTo(profile, "revocations.txt");
}
var certDB = Cc["@mozilla.org/security/x509certdb;1"]
@ -319,12 +319,12 @@ function run_test() {
verify_cert(file, SEC_ERROR_UNKNOWN_ISSUER);
// check that save with no further update is a no-op
let lastModified = gRevocations.lastModifiedTime;
let lastModified = revocations.lastModifiedTime;
// add an already existing entry
certList.revokeCertByIssuerAndSerial("YW5vdGhlciBpbWFnaW5hcnkgaXNzdWVy",
"c2VyaWFsMi4=");
certList.saveEntries();
let newModified = gRevocations.lastModifiedTime;
let newModified = revocations.lastModifiedTime;
equal(lastModified, newModified,
"saveEntries with no modifications should not update the backing file");

View File

@ -46,12 +46,12 @@ const expectedUsagesMap = {
add_task(function* () {
for (let ca of caList) {
addCertFromFile(certdb, "test_cert_keyUsage/" + ca + ".pem", "CTu,CTu,CTu");
let caCert = constructCertFromFile("test_cert_keyUsage/" + ca + ".pem");
yield asyncTestCertificateUsages(certdb, caCert, expectedUsagesMap[ca]);
let cert = constructCertFromFile("test_cert_keyUsage/" + ca + ".pem");
yield asyncTestCertificateUsages(certdb, cert, expectedUsagesMap[ca]);
for (let ee of eeList) {
let eeFullName = ee + "-" + ca;
let eeCert = constructCertFromFile("test_cert_keyUsage/" + eeFullName + ".pem");
yield asyncTestCertificateUsages(certdb, eeCert, expectedUsagesMap[eeFullName]);
let cert = constructCertFromFile("test_cert_keyUsage/" + eeFullName + ".pem");
yield asyncTestCertificateUsages(certdb, cert, expectedUsagesMap[eeFullName]);
}
}
});

View File

@ -69,8 +69,8 @@ function startServer(cert, rc4only) {
equal(status.macLength, rc4only ? 160 : 128, "Using MAC of expected length");
input.asyncWait({
onInputStreamReady: function(streamReadyInput) {
NetUtil.asyncCopy(streamReadyInput, output);
onInputStreamReady: function(input) {
NetUtil.asyncCopy(input, output);
}
}, 0, 0, Services.tm.currentThread);
},
@ -115,17 +115,15 @@ function startClient(port, expectedResult, options = {}) {
let handler = {
onTransportStatus: function(unused, status) {
onTransportStatus: function(transport, status) {
if (status === Ci.nsISocketTransport.STATUS_CONNECTED_TO) {
output.asyncWait(handler, 0, 0, Services.tm.currentThread);
}
},
onInputStreamReady: function(streamReadyInput) {
onInputStreamReady: function(input) {
try {
let data =
NetUtil.readInputStreamToString(streamReadyInput,
streamReadyInput.available());
let data = NetUtil.readInputStreamToString(input, input.available());
equal(Cr.NS_OK, expectedResult, "Connection should succeed");
equal(data, "HELLO", "Echoed data received");
} catch (e) {
@ -134,25 +132,25 @@ function startClient(port, expectedResult, options = {}) {
deferred.reject(e);
}
}
streamReadyInput.close();
input.close();
output.close();
deferred.resolve();
},
onOutputStreamReady: function(streamReadyOutput) {
onOutputStreamReady: function(output) {
try {
try {
streamReadyOutput.write("HELLO", 5);
output.write("HELLO", 5);
} catch (e) {
if (e.result == Cr.NS_BASE_STREAM_WOULD_BLOCK) {
streamReadyOutput.asyncWait(handler, 0, 0, Services.tm.currentThread);
output.asyncWait(handler, 0, 0, Services.tm.currentThread);
return;
}
if (e.result != Cr.NS_OK) {
ok((e.result === expectedResult) ||
(options.allowReset && (e.result === Cr.NS_ERROR_NET_RESET)),
"Actual and expected connection result should match");
streamReadyOutput.close();
output.close();
deferred.resolve();
return;
}

View File

@ -3,7 +3,6 @@ module.exports = {
rules: {
"mozilla/import-headjs-globals": "warn",
"mozilla/mark-test-function-used": "warn",
"no-shadow": "error",
},
// All globals made available in the test environment.

View File

@ -62,7 +62,7 @@ function makeLock(kind) {
let name = "test-xpcom-Barrier-" + ++makeLock.counter;
let barrier = asyncShutdownService.makeBarrier(name);
return {
addBlocker: function(blockerName, condition, state) {
addBlocker: function(name, condition, state) {
if (condition == null) {
// Slight trick as `null` or `undefined` cannot be used as keys
// for `xpcomMap`. Note that this has no incidence on the result
@ -73,7 +73,7 @@ function makeLock(kind) {
let blocker = makeLock.xpcomMap.get(condition);
if (!blocker) {
blocker = {
name: blockerName,
name: name,
state: state,
blockShutdown: function(aBarrierClient) {
return Task.spawn(function*() {

View File

@ -100,15 +100,15 @@ add_task(function* test_phase_removeBlocker() {
};
lock.addBlocker("Wait forever", blocker);
let do_remove_blocker = function(aLock, aBlocker, aShouldRemove) {
do_print("Attempting to remove blocker " + aBlocker + ", expecting result " + aShouldRemove);
let do_remove_blocker = function(lock, blocker, shouldRemove) {
do_print("Attempting to remove blocker " + blocker + ", expecting result " + shouldRemove);
if (kind == "xpcom-barrier") {
// The xpcom variant always returns `undefined`, so we can't
// check its result.
aLock.removeBlocker(aBlocker);
lock.removeBlocker(blocker);
return;
}
do_check_eq(aLock.removeBlocker(aBlocker), aShouldRemove);
do_check_eq(lock.removeBlocker(blocker), shouldRemove);
};
do_remove_blocker(lock, blocker, true);
do_remove_blocker(lock, blocker, false);

View File

@ -197,34 +197,33 @@ function run_test() {
// Site-Specificity
{
// These are all different sites, and setting a pref for one of them
// shouldn't set it for the others.
let uri1 = ContentPrefTest.getURI("http://www.domain1.com/");
let uri2 = ContentPrefTest.getURI("http://foo.domain1.com/");
let uri3 = ContentPrefTest.getURI("http://domain1.com/");
let uri4 = ContentPrefTest.getURI("http://www.domain2.com/");
// These are all different sites, and setting a pref for one of them
// shouldn't set it for the others.
var uri1 = ContentPrefTest.getURI("http://www.domain1.com/");
var uri2 = ContentPrefTest.getURI("http://foo.domain1.com/");
var uri3 = ContentPrefTest.getURI("http://domain1.com/");
var uri4 = ContentPrefTest.getURI("http://www.domain2.com/");
cps.setPref(uri1, "test.site-specificity.uri1", 5);
do_check_false(cps.hasPref(uri2, "test.site-specificity.uri1"));
do_check_false(cps.hasPref(uri3, "test.site-specificity.uri1"));
do_check_false(cps.hasPref(uri4, "test.site-specificity.uri1"));
cps.setPref(uri1, "test.site-specificity.uri1", 5);
do_check_false(cps.hasPref(uri2, "test.site-specificity.uri1"));
do_check_false(cps.hasPref(uri3, "test.site-specificity.uri1"));
do_check_false(cps.hasPref(uri4, "test.site-specificity.uri1"));
cps.setPref(uri2, "test.site-specificity.uri2", 5);
do_check_false(cps.hasPref(uri1, "test.site-specificity.uri2"));
do_check_false(cps.hasPref(uri3, "test.site-specificity.uri2"));
do_check_false(cps.hasPref(uri4, "test.site-specificity.uri2"));
cps.setPref(uri2, "test.site-specificity.uri2", 5);
do_check_false(cps.hasPref(uri1, "test.site-specificity.uri2"));
do_check_false(cps.hasPref(uri3, "test.site-specificity.uri2"));
do_check_false(cps.hasPref(uri4, "test.site-specificity.uri2"));
cps.setPref(uri3, "test.site-specificity.uri3", 5);
do_check_false(cps.hasPref(uri1, "test.site-specificity.uri3"));
do_check_false(cps.hasPref(uri2, "test.site-specificity.uri3"));
do_check_false(cps.hasPref(uri4, "test.site-specificity.uri3"));
cps.setPref(uri3, "test.site-specificity.uri3", 5);
do_check_false(cps.hasPref(uri1, "test.site-specificity.uri3"));
do_check_false(cps.hasPref(uri2, "test.site-specificity.uri3"));
do_check_false(cps.hasPref(uri4, "test.site-specificity.uri3"));
cps.setPref(uri4, "test.site-specificity.uri4", 5);
do_check_false(cps.hasPref(uri1, "test.site-specificity.uri4"));
do_check_false(cps.hasPref(uri2, "test.site-specificity.uri4"));
do_check_false(cps.hasPref(uri3, "test.site-specificity.uri4"));
cps.setPref(uri4, "test.site-specificity.uri4", 5);
do_check_false(cps.hasPref(uri1, "test.site-specificity.uri4"));
do_check_false(cps.hasPref(uri2, "test.site-specificity.uri4"));
do_check_false(cps.hasPref(uri3, "test.site-specificity.uri4"));
}
// Observers

View File

@ -304,110 +304,110 @@ function run_Int64_tests() {
do_check_throws(function() { ctypes.Int64.prototype.toString(); }, TypeError);
do_check_throws(function() { ctypes.Int64.prototype.toSource(); }, TypeError);
let int64 = ctypes.Int64(0);
do_check_true(int64.__proto__ === ctypes.Int64.prototype);
do_check_true(int64 instanceof ctypes.Int64);
let i = ctypes.Int64(0);
do_check_true(i.__proto__ === ctypes.Int64.prototype);
do_check_true(i instanceof ctypes.Int64);
// Test Int64.toString([radix]).
do_check_eq(int64.toString(), "0");
do_check_eq(i.toString(), "0");
for (let radix = 2; radix <= 36; ++radix)
do_check_eq(int64.toString(radix), "0");
do_check_throws(function() { int64.toString(0); }, RangeError);
do_check_throws(function() { int64.toString(1); }, RangeError);
do_check_throws(function() { int64.toString(37); }, RangeError);
do_check_throws(function() { int64.toString(10, 2); }, TypeError);
do_check_eq(i.toString(radix), "0");
do_check_throws(function() { i.toString(0); }, RangeError);
do_check_throws(function() { i.toString(1); }, RangeError);
do_check_throws(function() { i.toString(37); }, RangeError);
do_check_throws(function() { i.toString(10, 2); }, TypeError);
// Test Int64.toSource().
do_check_eq(int64.toSource(), "ctypes.Int64(\"0\")");
do_check_throws(function() { int64.toSource(10); }, TypeError);
do_check_eq(i.toSource(), "ctypes.Int64(\"0\")");
do_check_throws(function() { i.toSource(10); }, TypeError);
int64 = ctypes.Int64("0x28590a1c921def71");
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "2907366152271163249");
do_check_eq(int64.toString(16), "28590a1c921def71");
do_check_eq(int64.toString(2), "10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(int64.toSource(), "ctypes.Int64(\"" + int64.toString(10) + "\")");
i = ctypes.Int64("0x28590a1c921def71");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "2907366152271163249");
do_check_eq(i.toString(16), "28590a1c921def71");
do_check_eq(i.toString(2), "10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(i.toSource(), "ctypes.Int64(\"" + i.toString(10) + "\")");
int64 = ctypes.Int64("-0x28590a1c921def71");
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "-2907366152271163249");
do_check_eq(int64.toString(16), "-28590a1c921def71");
do_check_eq(int64.toString(2), "-10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(int64.toSource(), "ctypes.Int64(\"" + int64.toString(10) + "\")");
i = ctypes.Int64("-0x28590a1c921def71");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "-2907366152271163249");
do_check_eq(i.toString(16), "-28590a1c921def71");
do_check_eq(i.toString(2), "-10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(i.toSource(), "ctypes.Int64(\"" + i.toString(10) + "\")");
int64 = ctypes.Int64("-0X28590A1c921DEf71");
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "-2907366152271163249");
do_check_eq(int64.toString(16), "-28590a1c921def71");
do_check_eq(int64.toString(2), "-10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(int64.toSource(), "ctypes.Int64(\"" + int64.toString(10) + "\")");
i = ctypes.Int64("-0X28590A1c921DEf71");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "-2907366152271163249");
do_check_eq(i.toString(16), "-28590a1c921def71");
do_check_eq(i.toString(2), "-10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(i.toSource(), "ctypes.Int64(\"" + i.toString(10) + "\")");
// Test Int64(primitive double) constructor.
int64 = ctypes.Int64(-0);
do_check_eq(int64.toString(), "0");
i = ctypes.Int64(-0);
do_check_eq(i.toString(), "0");
int64 = ctypes.Int64(0x7ffffffffffff000);
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "9223372036854771712");
do_check_eq(int64.toString(16), "7ffffffffffff000");
do_check_eq(int64.toString(2), "111111111111111111111111111111111111111111111111111000000000000");
i = ctypes.Int64(0x7ffffffffffff000);
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "9223372036854771712");
do_check_eq(i.toString(16), "7ffffffffffff000");
do_check_eq(i.toString(2), "111111111111111111111111111111111111111111111111111000000000000");
int64 = ctypes.Int64(-0x8000000000000000);
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "-9223372036854775808");
do_check_eq(int64.toString(16), "-8000000000000000");
do_check_eq(int64.toString(2), "-1000000000000000000000000000000000000000000000000000000000000000");
i = ctypes.Int64(-0x8000000000000000);
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "-9223372036854775808");
do_check_eq(i.toString(16), "-8000000000000000");
do_check_eq(i.toString(2), "-1000000000000000000000000000000000000000000000000000000000000000");
// Test Int64(string) constructor.
int64 = ctypes.Int64("0x7fffffffffffffff");
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "9223372036854775807");
do_check_eq(int64.toString(16), "7fffffffffffffff");
do_check_eq(int64.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
i = ctypes.Int64("0x7fffffffffffffff");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "9223372036854775807");
do_check_eq(i.toString(16), "7fffffffffffffff");
do_check_eq(i.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
int64 = ctypes.Int64("-0x8000000000000000");
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "-9223372036854775808");
do_check_eq(int64.toString(16), "-8000000000000000");
do_check_eq(int64.toString(2), "-1000000000000000000000000000000000000000000000000000000000000000");
i = ctypes.Int64("-0x8000000000000000");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "-9223372036854775808");
do_check_eq(i.toString(16), "-8000000000000000");
do_check_eq(i.toString(2), "-1000000000000000000000000000000000000000000000000000000000000000");
int64 = ctypes.Int64("9223372036854775807");
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "9223372036854775807");
do_check_eq(int64.toString(16), "7fffffffffffffff");
do_check_eq(int64.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
i = ctypes.Int64("9223372036854775807");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "9223372036854775807");
do_check_eq(i.toString(16), "7fffffffffffffff");
do_check_eq(i.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
int64 = ctypes.Int64("-9223372036854775808");
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "-9223372036854775808");
do_check_eq(int64.toString(16), "-8000000000000000");
do_check_eq(int64.toString(2), "-1000000000000000000000000000000000000000000000000000000000000000");
i = ctypes.Int64("-9223372036854775808");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "-9223372036854775808");
do_check_eq(i.toString(16), "-8000000000000000");
do_check_eq(i.toString(2), "-1000000000000000000000000000000000000000000000000000000000000000");
// Test Int64(other Int64) constructor.
int64 = ctypes.Int64(ctypes.Int64(0));
do_check_eq(int64.toString(), "0");
i = ctypes.Int64(ctypes.Int64(0));
do_check_eq(i.toString(), "0");
int64 = ctypes.Int64(ctypes.Int64("0x7fffffffffffffff"));
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "9223372036854775807");
do_check_eq(int64.toString(16), "7fffffffffffffff");
do_check_eq(int64.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
i = ctypes.Int64(ctypes.Int64("0x7fffffffffffffff"));
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "9223372036854775807");
do_check_eq(i.toString(16), "7fffffffffffffff");
do_check_eq(i.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
int64 = ctypes.Int64(ctypes.Int64("-0x8000000000000000"));
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "-9223372036854775808");
do_check_eq(int64.toString(16), "-8000000000000000");
do_check_eq(int64.toString(2), "-1000000000000000000000000000000000000000000000000000000000000000");
i = ctypes.Int64(ctypes.Int64("-0x8000000000000000"));
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "-9223372036854775808");
do_check_eq(i.toString(16), "-8000000000000000");
do_check_eq(i.toString(2), "-1000000000000000000000000000000000000000000000000000000000000000");
// Test Int64(other UInt64) constructor.
int64 = ctypes.Int64(ctypes.UInt64(0));
do_check_eq(int64.toString(), "0");
i = ctypes.Int64(ctypes.UInt64(0));
do_check_eq(i.toString(), "0");
int64 = ctypes.Int64(ctypes.UInt64("0x7fffffffffffffff"));
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "9223372036854775807");
do_check_eq(int64.toString(16), "7fffffffffffffff");
do_check_eq(int64.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
i = ctypes.Int64(ctypes.UInt64("0x7fffffffffffffff"));
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "9223372036854775807");
do_check_eq(i.toString(16), "7fffffffffffffff");
do_check_eq(i.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
let vals = [-0x8000000000001000, 0x8000000000000000,
ctypes.UInt64("0x8000000000000000"),
@ -474,91 +474,91 @@ function run_UInt64_tests() {
do_check_throws(function() { ctypes.UInt64.prototype.toString(); }, TypeError);
do_check_throws(function() { ctypes.UInt64.prototype.toSource(); }, TypeError);
let uint64 = ctypes.UInt64(0);
do_check_true(uint64.__proto__ === ctypes.UInt64.prototype);
do_check_true(uint64 instanceof ctypes.UInt64);
let i = ctypes.UInt64(0);
do_check_true(i.__proto__ === ctypes.UInt64.prototype);
do_check_true(i instanceof ctypes.UInt64);
// Test UInt64.toString([radix]).
do_check_eq(uint64.toString(), "0");
do_check_eq(i.toString(), "0");
for (let radix = 2; radix <= 36; ++radix)
do_check_eq(uint64.toString(radix), "0");
do_check_throws(function() { uint64.toString(0); }, RangeError);
do_check_throws(function() { uint64.toString(1); }, RangeError);
do_check_throws(function() { uint64.toString(37); }, RangeError);
do_check_throws(function() { uint64.toString(10, 2); }, TypeError);
do_check_eq(i.toString(radix), "0");
do_check_throws(function() { i.toString(0); }, RangeError);
do_check_throws(function() { i.toString(1); }, RangeError);
do_check_throws(function() { i.toString(37); }, RangeError);
do_check_throws(function() { i.toString(10, 2); }, TypeError);
// Test UInt64.toSource().
do_check_eq(uint64.toSource(), "ctypes.UInt64(\"0\")");
do_check_throws(function() { uint64.toSource(10); }, TypeError);
do_check_eq(i.toSource(), "ctypes.UInt64(\"0\")");
do_check_throws(function() { i.toSource(10); }, TypeError);
uint64 = ctypes.UInt64("0x28590a1c921def71");
do_check_eq(uint64.toString(), uint64.toString(10));
do_check_eq(uint64.toString(10), "2907366152271163249");
do_check_eq(uint64.toString(16), "28590a1c921def71");
do_check_eq(uint64.toString(2), "10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(uint64.toSource(), "ctypes.UInt64(\"" + uint64.toString(10) + "\")");
i = ctypes.UInt64("0x28590a1c921def71");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "2907366152271163249");
do_check_eq(i.toString(16), "28590a1c921def71");
do_check_eq(i.toString(2), "10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(i.toSource(), "ctypes.UInt64(\"" + i.toString(10) + "\")");
uint64 = ctypes.UInt64("0X28590A1c921DEf71");
do_check_eq(uint64.toString(), uint64.toString(10));
do_check_eq(uint64.toString(10), "2907366152271163249");
do_check_eq(uint64.toString(16), "28590a1c921def71");
do_check_eq(uint64.toString(2), "10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(uint64.toSource(), "ctypes.UInt64(\"" + uint64.toString(10) + "\")");
i = ctypes.UInt64("0X28590A1c921DEf71");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "2907366152271163249");
do_check_eq(i.toString(16), "28590a1c921def71");
do_check_eq(i.toString(2), "10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(i.toSource(), "ctypes.UInt64(\"" + i.toString(10) + "\")");
// Test UInt64(primitive double) constructor.
uint64 = ctypes.UInt64(-0);
do_check_eq(uint64.toString(), "0");
i = ctypes.UInt64(-0);
do_check_eq(i.toString(), "0");
uint64 = ctypes.UInt64(0xfffffffffffff000);
do_check_eq(uint64.toString(), uint64.toString(10));
do_check_eq(uint64.toString(10), "18446744073709547520");
do_check_eq(uint64.toString(16), "fffffffffffff000");
do_check_eq(uint64.toString(2), "1111111111111111111111111111111111111111111111111111000000000000");
i = ctypes.UInt64(0xfffffffffffff000);
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "18446744073709547520");
do_check_eq(i.toString(16), "fffffffffffff000");
do_check_eq(i.toString(2), "1111111111111111111111111111111111111111111111111111000000000000");
// Test UInt64(string) constructor.
uint64 = ctypes.UInt64("0xffffffffffffffff");
do_check_eq(uint64.toString(), uint64.toString(10));
do_check_eq(uint64.toString(10), "18446744073709551615");
do_check_eq(uint64.toString(16), "ffffffffffffffff");
do_check_eq(uint64.toString(2), "1111111111111111111111111111111111111111111111111111111111111111");
i = ctypes.UInt64("0xffffffffffffffff");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "18446744073709551615");
do_check_eq(i.toString(16), "ffffffffffffffff");
do_check_eq(i.toString(2), "1111111111111111111111111111111111111111111111111111111111111111");
uint64 = ctypes.UInt64("0x0");
do_check_eq(uint64.toString(), uint64.toString(10));
do_check_eq(uint64.toString(10), "0");
do_check_eq(uint64.toString(16), "0");
do_check_eq(uint64.toString(2), "0");
i = ctypes.UInt64("0x0");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "0");
do_check_eq(i.toString(16), "0");
do_check_eq(i.toString(2), "0");
uint64 = ctypes.UInt64("18446744073709551615");
do_check_eq(uint64.toString(), uint64.toString(10));
do_check_eq(uint64.toString(10), "18446744073709551615");
do_check_eq(uint64.toString(16), "ffffffffffffffff");
do_check_eq(uint64.toString(2), "1111111111111111111111111111111111111111111111111111111111111111");
i = ctypes.UInt64("18446744073709551615");
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "18446744073709551615");
do_check_eq(i.toString(16), "ffffffffffffffff");
do_check_eq(i.toString(2), "1111111111111111111111111111111111111111111111111111111111111111");
uint64 = ctypes.UInt64("0");
do_check_eq(uint64.toString(), "0");
i = ctypes.UInt64("0");
do_check_eq(i.toString(), "0");
// Test UInt64(other UInt64) constructor.
uint64 = ctypes.UInt64(ctypes.UInt64(0));
do_check_eq(uint64.toString(), "0");
i = ctypes.UInt64(ctypes.UInt64(0));
do_check_eq(i.toString(), "0");
uint64 = ctypes.UInt64(ctypes.UInt64("0xffffffffffffffff"));
do_check_eq(uint64.toString(), uint64.toString(10));
do_check_eq(uint64.toString(10), "18446744073709551615");
do_check_eq(uint64.toString(16), "ffffffffffffffff");
do_check_eq(uint64.toString(2), "1111111111111111111111111111111111111111111111111111111111111111");
i = ctypes.UInt64(ctypes.UInt64("0xffffffffffffffff"));
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "18446744073709551615");
do_check_eq(i.toString(16), "ffffffffffffffff");
do_check_eq(i.toString(2), "1111111111111111111111111111111111111111111111111111111111111111");
uint64 = ctypes.UInt64(ctypes.UInt64("0x0"));
do_check_eq(uint64.toString(), "0");
i = ctypes.UInt64(ctypes.UInt64("0x0"));
do_check_eq(i.toString(), "0");
// Test UInt64(other Int64) constructor.
uint64 = ctypes.UInt64(ctypes.Int64(0));
do_check_eq(uint64.toString(), "0");
i = ctypes.UInt64(ctypes.Int64(0));
do_check_eq(i.toString(), "0");
uint64 = ctypes.UInt64(ctypes.Int64("0x7fffffffffffffff"));
do_check_eq(uint64.toString(), uint64.toString(10));
do_check_eq(uint64.toString(10), "9223372036854775807");
do_check_eq(uint64.toString(16), "7fffffffffffffff");
do_check_eq(uint64.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
i = ctypes.UInt64(ctypes.Int64("0x7fffffffffffffff"));
do_check_eq(i.toString(), i.toString(10));
do_check_eq(i.toString(10), "9223372036854775807");
do_check_eq(i.toString(16), "7fffffffffffffff");
do_check_eq(i.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
let vals = [-1, 0x10000000000000000, "-1", "-0x1",
ctypes.Int64("-1"), Infinity, -Infinity, NaN, 0.1,
@ -951,9 +951,9 @@ function run_float_tests(library, t, name, size) {
do_check_throws(function () { d.value = vals[i]; }, TypeError);
// Check that values roundtrip through toSource() correctly.
function test_roundtrip(tFn, val)
function test_roundtrip(t, val)
{
let f1 = tFn(val);
let f1 = t(val);
eval("var f2 = " + f1.toSource());
do_check_eq(f1.value, f2.value);
}
@ -1686,11 +1686,11 @@ function run_PointerType_tests() {
do_check_eq(ptrValue(v), ptrValue(p));
// Test 'contents'.
let int32_t = ctypes.int32_t(9);
p = int32_t.address();
do_check_eq(p.contents, int32_t.value);
let i = ctypes.int32_t(9);
p = i.address();
do_check_eq(p.contents, i.value);
p.contents = ctypes.int32_t(12);
do_check_eq(int32_t.value, 12);
do_check_eq(i.value, 12);
// Test 'isNull'.
let n = f_t(0);

View File

@ -79,13 +79,13 @@ function readFileToString(aFilename) {
function promiseSaverComplete(aSaver, aOnTargetChangeFn) {
let deferred = Promise.defer();
aSaver.observer = {
onTargetChange: function BFSO_onSaveComplete(unused, aTarget)
onTargetChange: function BFSO_onSaveComplete(aSaver, aTarget)
{
if (aOnTargetChangeFn) {
aOnTargetChangeFn(aTarget);
}
},
onSaveComplete: function BFSO_onSaveComplete(unused, aStatus)
onSaveComplete: function BFSO_onSaveComplete(aSaver, aStatus)
{
if (Components.isSuccessCode(aStatus)) {
deferred.resolve();

View File

@ -7,12 +7,12 @@
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Downloads.jsm");
const gServer = createHttpServer();
gServer.registerDirectory("/data/", do_get_file("data"));
const server = createHttpServer();
server.registerDirectory("/data/", do_get_file("data"));
const WINDOWS = AppConstants.platform == "win";
const BASE = `http://localhost:${gServer.identity.primaryPort}/data`;
const BASE = `http://localhost:${server.identity.primaryPort}/data`;
const FILE_NAME = "file_download.txt";
const FILE_URL = BASE + "/" + FILE_NAME;
const FILE_NAME_UNIQUE = "file_download(1).txt";

View File

@ -102,14 +102,14 @@ function backgroundScript() {
// set to false to allow other events and options.inorder can be set to
// false to allow the events to arrive in any order.
function waitForEvents(expected, options = {}) {
function compare(a, b) {
if (typeof b == "object" && b != null) {
if (typeof a != "object") {
function compare(received, expected) {
if (typeof expected == "object" && expected != null) {
if (typeof received != "object") {
return false;
}
return Object.keys(b).every(fld => compare(a[fld], b[fld]));
return Object.keys(expected).every(fld => compare(received[fld], expected[fld]));
}
return (a == b);
return (received == expected);
}
const exact = ("exact" in options) ? options.exact : true;

View File

@ -156,12 +156,12 @@ add_task(function* test_search() {
// Search for each individual download and check
// the corresponding DownloadItem.
function* checkDownloadItem(id, expect) {
let item = yield search({id});
equal(item.status, "success", "search() succeeded");
equal(item.downloads.length, 1, "search() found exactly 1 download");
let msg = yield search({id});
equal(msg.status, "success", "search() succeeded");
equal(msg.downloads.length, 1, "search() found exactly 1 download");
Object.keys(expect).forEach(function(field) {
equal(item.downloads[0][field], expect[field], `DownloadItem.${field} is correct"`);
equal(msg.downloads[0][field], expect[field], `DownloadItem.${field} is correct"`);
});
}
yield checkDownloadItem(downloadIds.txt1, {
@ -209,11 +209,11 @@ add_task(function* test_search() {
});
function* checkSearch(query, expected, description, exact) {
let item = yield search(query);
equal(item.status, "success", "search() succeeded");
equal(item.downloads.length, expected.length, `search() for ${description} found exactly ${expected.length} downloads`);
let msg = yield search(query);
equal(msg.status, "success", "search() succeeded");
equal(msg.downloads.length, expected.length, `search() for ${description} found exactly ${expected.length} downloads`);
let receivedIds = item.downloads.map(i => i.id);
let receivedIds = msg.downloads.map(item => item.id);
if (exact) {
receivedIds.forEach((id, idx) => {
equal(id, downloadIds[expected[idx]], `search() for ${description} returned ${expected[idx]} in position ${idx}`);
@ -381,9 +381,9 @@ add_task(function* test_search() {
// Check bad arguments.
function* checkBadSearch(query, pattern, description) {
let item = yield search(query);
equal(item.status, "error", "search() failed");
ok(pattern.test(item.errmsg), `error message for ${description} was correct (${item.errmsg}).`);
let msg = yield search(query);
equal(msg.status, "error", "search() failed");
ok(pattern.test(msg.errmsg), `error message for ${description} was correct (${msg.errmsg}).`);
}
yield checkBadSearch("myquery", /Incorrect argument type/, "query is not an object");

View File

@ -41,8 +41,8 @@ add_task(function* test_legacy_extension_context() {
} else if (msg == "do-connect") {
port = browser.runtime.connect();
port.onMessage.addListener(portMsg => {
browser.test.assertEq("legacy_extension -> webextension port message", portMsg,
port.onMessage.addListener(msg => {
browser.test.assertEq("legacy_extension -> webextension port message", msg,
"Got the expected message from the LegacyExtensionContext");
port.postMessage("webextension -> legacy_extension port message");
});

View File

@ -90,7 +90,7 @@ add_task(function* test_round_trip_perf() {
}
let count = 0;
port.onMessage.addListener(() => {
port.onMessage.addListener(msg => {
if (count == 0) {
// Skip the first round, since it includes the time it takes
// the app to start up.

View File

@ -637,8 +637,8 @@ add_task(function* () {
"should throw for access denied");
}
for (let urlString of ["//foo.html", "http://foo/bar.html"]) {
Assert.throws(() => root.testing.format({strictRelativeUrl: urlString}),
for (let url of ["//foo.html", "http://foo/bar.html"]) {
Assert.throws(() => root.testing.format({strictRelativeUrl: url}),
/must be a relative URL/,
"should throw for non-relative URL");
}
@ -753,10 +753,10 @@ add_task(function* () {
"should throw when passing a Proxy");
if (Symbol.toStringTag) {
let stringTarget = {prop1: 12, prop2: ["value1", "value3"]};
stringTarget[Symbol.toStringTag] = () => "[object Object]";
let stringProxy = new Proxy(stringTarget, {});
Assert.throws(() => root.testing.quack(stringProxy),
let target = {prop1: 12, prop2: ["value1", "value3"]};
target[Symbol.toStringTag] = () => "[object Object]";
let proxy = new Proxy(target, {});
Assert.throws(() => root.testing.quack(proxy),
/Expected a plain JavaScript object, got a Proxy/,
"should throw when passing a Proxy");
}

View File

@ -20,8 +20,8 @@ async function backgroundScript() {
let globalChanges = {};
browser.storage.onChanged.addListener((changes, changedStorage) => {
browser.test.assertEq("local", changedStorage, "storage is local");
browser.storage.onChanged.addListener((changes, storage) => {
browser.test.assertEq("local", storage, "storage is local");
Object.assign(globalChanges, changes);
});

View File

@ -272,8 +272,8 @@ while True:
yield writeManifest(manifestPath, manifest);
}
let mockContext = new MockContext(ID);
let app = new NativeApp(mockContext, "wontdie");
let context = new MockContext(ID);
let app = new NativeApp(context, "wontdie");
// send a message and wait for the reply to make sure the app is running
let MSG = "test";
@ -286,7 +286,7 @@ while True:
app.on("message", listener);
});
let buffer = NativeApp.encodeMessage(mockContext, MSG);
let buffer = NativeApp.encodeMessage(context, MSG);
app.send(buffer);
yield recvPromise;

View File

@ -2469,6 +2469,8 @@ add_task(function* test_history_tryToKeepPartialData()
* mode after they have been launched.
*/
add_task(function* test_launchWhenSucceeded_deleteTempFileOnExit() {
const kDeleteTempFileOnExit = "browser.helperApps.deleteTempFileOnExit";
let customLauncherPath = getTempFile("app-launcher").path;
let autoDeleteTargetPathOne = getTempFile(TEST_TARGET_FILE_NAME).path;
let autoDeleteTargetPathTwo = getTempFile(TEST_TARGET_FILE_NAME).path;

View File

@ -418,9 +418,9 @@ function promiseStartExternalHelperAppServiceDownload(aSourceUrl) {
onStartRequest: function (aRequest, aContext)
{
let requestChannel = aRequest.QueryInterface(Ci.nsIChannel);
let channel = aRequest.QueryInterface(Ci.nsIChannel);
this.contentListener = gExternalHelperAppService.doContent(
requestChannel.contentType, aRequest, null, true);
channel.contentType, aRequest, null, true);
this.contentListener.onStartRequest(aRequest, aContext);
},

View File

@ -81,9 +81,9 @@ function configureToLoadJarEngines()
function installAddonEngine(name = "engine-addon")
{
const XRE_EXTENSIONS_DIR_LIST = "XREExtDL";
const profD = do_get_profile().QueryInterface(Ci.nsILocalFile);
const gProfD = do_get_profile().QueryInterface(Ci.nsILocalFile);
let dir = profD.clone();
let dir = gProfD.clone();
dir.append("extensions");
if (!dir.exists())
dir.create(dir.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
@ -133,9 +133,9 @@ function installDistributionEngine()
{
const XRE_APP_DISTRIBUTION_DIR = "XREAppDist";
const profD = do_get_profile().QueryInterface(Ci.nsILocalFile);
const gProfD = do_get_profile().QueryInterface(Ci.nsILocalFile);
let dir = profD.clone();
let dir = gProfD.clone();
dir.append("distribution");
dir.create(dir.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distDir = dir.clone();

View File

@ -33,9 +33,9 @@ add_task(function* test_engineUpdate() {
yield new Promise(resolve => {
Services.obs.addObserver(function obs(subject, topic, data) {
if (data == "engine-loaded") {
let loadedEngine = subject.QueryInterface(Ci.nsISearchEngine);
let rawEngine = loadedEngine.wrappedJSObject;
equal(loadedEngine.alias, KEYWORD, "Keyword not cleared by update");
let engine = subject.QueryInterface(Ci.nsISearchEngine);
let rawEngine = engine.wrappedJSObject;
equal(engine.alias, KEYWORD, "Keyword not cleared by update");
equal(rawEngine.getAttr("order"), 1, "Order not cleared by update");
Services.obs.removeObserver(obs, TOPIC, false);
resolve();

View File

@ -27,8 +27,8 @@ function run_test() {
removeMetadata();
updateAppInfo();
let server = useHttpServer();
server.registerContentType("sjs", "sjs");
let httpServer = useHttpServer();
httpServer.registerContentType("sjs", "sjs");
do_register_cleanup(() => Task.spawn(function* cleanup() {
// Remove added form history entries

View File

@ -1028,7 +1028,7 @@ add_task(function* test_pluginsWatch_Remove() {
}
// Find the test plugin.
let plugin = gInstalledPlugins.find(p => (p.name == PLUGIN2_NAME));
let plugin = gInstalledPlugins.find(plugin => (plugin.name == PLUGIN2_NAME));
Assert.ok(plugin, "The test plugin must exist.");
// Remove it from the PluginHost.
@ -1397,16 +1397,16 @@ add_task(function* test_defaultSearchEngine() {
TelemetryEnvironment.registerChangeListener("testWatch_SearchDefault", resolve);
});
let engine = yield new Promise((resolve, reject) => {
Services.obs.addObserver(function obs(obsSubject, obsTopic, obsData) {
Services.obs.addObserver(function obs(subject, topic, data) {
try {
let searchEngine = obsSubject.QueryInterface(Ci.nsISearchEngine);
do_print("Observed " + obsData + " for " + searchEngine.name);
if (obsData != "engine-added" || searchEngine.name != "engine-telemetry") {
let engine = subject.QueryInterface(Ci.nsISearchEngine);
do_print("Observed " + data + " for " + engine.name);
if (data != "engine-added" || engine.name != "engine-telemetry") {
return;
}
Services.obs.removeObserver(obs, "browser-search-engine-modified");
resolve(searchEngine);
resolve(engine);
} catch (ex) {
reject(ex);
}

View File

@ -74,7 +74,7 @@ function* runTests() {
// function |getFileForURL| points to the same path as
// |getFilePathForURL|.
if ("getFileForURL" in PageThumbsStorage) {
file = PageThumbsStorage.getFileForURL(URL);
let file = PageThumbsStorage.getFileForURL(URL);
is(file.path, PageThumbsStorage.getFilePathForURL(URL),
"Deprecated getFileForURL and getFilePathForURL return the same path");
}

View File

@ -64,7 +64,7 @@ function uri(aURIString)
function promiseIsURIVisited(aURI)
{
let deferred = Promise.defer();
PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
PlacesUtils.asyncHistory.isURIVisited(aURI, function(aURI, aIsVisited) {
deferred.resolve(aIsVisited);
});
@ -459,22 +459,6 @@ function* test_content_preferences_not_cleared_with_uri_contains_domain()
do_check_false(yield preference_exists(TEST_URI));
}
function push_registration_exists(aURL, ps)
{
return new Promise(resolve => {
let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
.getService(Ci.nsIScriptSecurityManager);
let principal = ssm.createCodebasePrincipalFromOrigin(aURL);
return ps.getSubscription(aURL, principal, (status, record) => {
if (!Components.isSuccessCode(status)) {
resolve(false);
} else {
resolve(!!record);
}
});
});
}
// Push
function* test_push_cleared()
{
@ -495,12 +479,28 @@ function* test_push_cleared()
let db = PushServiceWebSocket.newPushDB();
function push_registration_exists(aURL, ps)
{
return new Promise(resolve => {
let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
.getService(Ci.nsIScriptSecurityManager);
let principal = ssm.createCodebasePrincipalFromOrigin(aURL);
return ps.getSubscription(aURL, principal, (status, record) => {
if (!Components.isSuccessCode(status)) {
resolve(false);
} else {
resolve(!!record);
}
});
});
}
try {
PushService.init({
serverURI: "wss://push.example.org/",
db,
makeWebSocket(uriObj) {
return new MockWebSocket(uriObj, {
makeWebSocket(uri) {
return new MockWebSocket(uri, {
onHello(request) {
this.serverSendMsg(JSON.stringify({
messageType: 'hello',

View File

@ -59,9 +59,9 @@ function test_dsa() {
// XXX: test that RSA parameters throw the correct error
log("about to sign with DSA key");
keyPair.sign("foo", function (rv2, signature) {
log("DSA sign finished ", rv2, signature);
do_check_true(Components.isSuccessCode(rv2));
keyPair.sign("foo", function (rv, signature) {
log("DSA sign finished ", rv, signature);
do_check_true(Components.isSuccessCode(rv));
do_check_true(signature.length > 1);
// TODO: verify the signature with the public key
run_next_test();
@ -80,9 +80,9 @@ function test_rsa() {
do_check_true(keyPair.hexRSAPublicKeyExponent.length > 1);
log("about to sign with RSA key");
keyPair.sign("foo", function (rv2, signature) {
log("RSA sign finished ", rv2, signature);
do_check_true(Components.isSuccessCode(rv2));
keyPair.sign("foo", function (rv, signature) {
log("RSA sign finished ", rv, signature);
do_check_true(Components.isSuccessCode(rv));
do_check_true(signature.length > 1);
run_next_test();
});

View File

@ -52,8 +52,8 @@ function test_get_assertion() {
jwcrypto.generateKeyPair(
"DS160",
function(err, kp) {
jwcrypto.generateAssertion("fake-cert", kp, RP_ORIGIN, (err2, backedAssertion) => {
do_check_null(err2);
jwcrypto.generateAssertion("fake-cert", kp, RP_ORIGIN, (err, backedAssertion) => {
do_check_null(err);
do_check_eq(backedAssertion.split("~").length, 2);
do_check_eq(backedAssertion.split(".").length, 3);
@ -145,8 +145,8 @@ function test_get_assertion_with_offset() {
{ duration: MINUTE_MS,
localtimeOffsetMsec: localtimeOffsetMsec,
now: localMsec},
function(err2, backedAssertion) {
do_check_null(err2);
function(err, backedAssertion) {
do_check_null(err);
// properly formed
let cert;
@ -178,8 +178,8 @@ function test_assertion_lifetime() {
function(err, kp) {
jwcrypto.generateAssertion("fake-cert", kp, RP_ORIGIN,
{duration: MINUTE_MS},
function(err2, backedAssertion) {
do_check_null(err2);
function(err, backedAssertion) {
do_check_null(err);
// properly formed
let cert;
@ -212,8 +212,8 @@ function test_audience_encoding_bug972582() {
function(err, kp) {
do_check_null(err);
jwcrypto.generateAssertion("fake-cert", kp, audience,
function(err2, backedAssertion) {
do_check_null(err2);
function(err, backedAssertion) {
do_check_null(err);
let [cert, assertion] = backedAssertion.split("~");
let components = extractComponents(assertion);

View File

@ -195,7 +195,7 @@ add_task(function* test_subprocess_round_trip_perf() {
let now = Date.now();
const COUNT = 1000;
for (let j = 0; j < COUNT; j++) {
for (let i = 0; i < COUNT; i++) {
let [output] = yield Promise.all([
read(proc.stdout),
proc.stdin.write(LINE),
@ -539,12 +539,12 @@ add_task(function* test_subprocess_workdir() {
arguments: ["-u", TEST_SCRIPT, "pwd"],
}, options));
let pwdOutput = read(proc.stdout);
let pwd = read(proc.stdout);
let {exitCode} = yield proc.wait();
equal(exitCode, 0, "Got expected exit code");
return pwdOutput;
return pwd;
}
let dir = yield pwd({});

View File

@ -1,8 +1,8 @@
"use strict";
let envService = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
const PYTHON = envService.get("PYTHON");
const PYTHON = env.get("PYTHON");
const PYTHON_BIN = OS.Path.basename(PYTHON);
const PYTHON_DIR = OS.Path.dirname(PYTHON);

View File

@ -142,10 +142,10 @@ add_test(function test_checkForAddons_404Error() {
* Tests that a xhr abort() works as expected
*/
add_test(function test_checkForAddons_abort() {
let overriddenXhr = overrideXHR(200, "", { dropRequest: true} );
let xhr = overrideXHR(200, "", { dropRequest: true} );
let installManager = new GMPInstallManager();
let promise = installManager.checkForAddons();
overriddenXhr.abort();
xhr.abort();
promise.then(res => {
do_check_true(res.usedFallback);
installManager.uninit();

View File

@ -489,8 +489,8 @@ add_task(function* log_message_with_params() {
*/
add_task(function* test_log_err_only() {
let log = Log.repository.getLogger("error.only");
let mockFormatter = { format: msg => msg };
let appender = new MockAppender(mockFormatter);
let testFormatter = { format: msg => msg };
let appender = new MockAppender(testFormatter);
log.addAppender(appender);
/*
@ -540,8 +540,8 @@ add_task(function* test_structured_basic() {
*/
add_task(function* log_message_with_params() {
let log = Log.repository.getLogger("error.logger");
let mockFormatter = { format: msg => msg };
let appender = new MockAppender(mockFormatter);
let testFormatter = { format: msg => msg };
let appender = new MockAppender(testFormatter);
log.addAppender(appender);
let testParams = {a:1, b:2};

View File

@ -381,13 +381,13 @@ add_task(function* test_match_url_filters() {
// Run all the the testCases defined above.
for (let currentTest of testCases) {
let {
exceptionMessageContains,
url, filters,
shouldThrow, exceptionMessageContains,
shouldFail, url, filters,
} = currentTest;
if (currentTest.shouldThrow) {
if (shouldThrow) {
expectThrow({url, filters, exceptionMessageContains})
} else if (currentTest.shouldFail) {
} else if (shouldFail) {
expectFail({url, filters});
} else {
expectPass({url, filters});

View File

@ -268,9 +268,10 @@ this.BootstrapMonitor = {
// NOTE: in some of the new tests, we need to received the real objects instead of
// their JSON representations, but most of the current tests expect intallPath
// and resourceURI to have been converted to strings.
const {installPath, resourceURI} = info.data;
info.data = Object.assign({}, subject.wrappedJSObject.data, {
installPath: info.data.installPath,
resourceURI: info.data.resourceURI,
installPath,
resourceURI,
});
}

View File

@ -207,44 +207,44 @@ function run_test() {
function roundtripSet(props, modify, test, secure) {
props.forEach(function (prop) {
var theme = dummy();
modify(theme, prop);
test(roundtrip(theme, secure), prop, theme);
var data = dummy();
modify(data, prop);
test(roundtrip(data, secure), prop, data);
});
}
roundtripSet(MANDATORY, function (theme, prop) {
delete theme[prop];
roundtripSet(MANDATORY, function (data, prop) {
delete data[prop];
}, function (after) {
do_check_eq(after, null);
});
roundtripSet(OPTIONAL, function (theme, prop) {
delete theme[prop];
roundtripSet(OPTIONAL, function (data, prop) {
delete data[prop];
}, function (after) {
do_check_neq(after, null);
});
roundtripSet(MANDATORY, function (theme, prop) {
theme[prop] = "";
roundtripSet(MANDATORY, function (data, prop) {
data[prop] = "";
}, function (after) {
do_check_eq(after, null);
});
roundtripSet(OPTIONAL, function (theme, prop) {
theme[prop] = "";
roundtripSet(OPTIONAL, function (data, prop) {
data[prop] = "";
}, function (after, prop) {
do_check_eq(typeof after[prop], "undefined");
});
roundtripSet(MANDATORY, function (theme, prop) {
theme[prop] = " ";
roundtripSet(MANDATORY, function (data, prop) {
data[prop] = " ";
}, function (after) {
do_check_eq(after, null);
});
roundtripSet(OPTIONAL, function (theme, prop) {
theme[prop] = " ";
roundtripSet(OPTIONAL, function (data, prop) {
data[prop] = " ";
}, function (after, prop) {
do_check_neq(after, null);
do_check_eq(typeof after[prop], "undefined");
@ -258,20 +258,20 @@ function run_test() {
return props.filter(prop => /URL$/.test(prop));
}
roundtripSet(non_urls(MANDATORY.concat(OPTIONAL)), function (theme, prop) {
theme[prop] = prop;
roundtripSet(non_urls(MANDATORY.concat(OPTIONAL)), function (data, prop) {
data[prop] = prop;
}, function (after, prop, before) {
do_check_eq(after[prop], before[prop]);
});
roundtripSet(non_urls(MANDATORY.concat(OPTIONAL)), function (theme, prop) {
theme[prop] = " " + prop + " ";
roundtripSet(non_urls(MANDATORY.concat(OPTIONAL)), function (data, prop) {
data[prop] = " " + prop + " ";
}, function (after, prop, before) {
do_check_eq(after[prop], before[prop].trim());
});
roundtripSet(urls(MANDATORY.concat(OPTIONAL)), function (theme, prop) {
theme[prop] = Math.random().toString();
roundtripSet(urls(MANDATORY.concat(OPTIONAL)), function (data, prop) {
data[prop] = Math.random().toString();
}, function (after, prop, before) {
if (prop == "updateURL")
do_check_eq(typeof after[prop], "undefined");
@ -279,26 +279,26 @@ function run_test() {
do_check_eq(after[prop], "http://lwttest.invalid/" + before[prop]);
});
roundtripSet(urls(MANDATORY.concat(OPTIONAL)), function (theme, prop) {
theme[prop] = Math.random().toString();
roundtripSet(urls(MANDATORY.concat(OPTIONAL)), function (data, prop) {
data[prop] = Math.random().toString();
}, function (after, prop, before) {
do_check_eq(after[prop], "https://lwttest.invalid/" + before[prop]);
}, true);
roundtripSet(urls(MANDATORY.concat(OPTIONAL)), function (theme, prop) {
theme[prop] = "https://sub.lwttest.invalid/" + Math.random().toString();
roundtripSet(urls(MANDATORY.concat(OPTIONAL)), function (data, prop) {
data[prop] = "https://sub.lwttest.invalid/" + Math.random().toString();
}, function (after, prop, before) {
do_check_eq(after[prop], before[prop]);
});
roundtripSet(urls(MANDATORY), function (theme, prop) {
theme[prop] = "ftp://lwttest.invalid/" + Math.random().toString();
roundtripSet(urls(MANDATORY), function (data, prop) {
data[prop] = "ftp://lwttest.invalid/" + Math.random().toString();
}, function (after) {
do_check_eq(after, null);
});
roundtripSet(urls(OPTIONAL), function (theme, prop) {
theme[prop] = "ftp://lwttest.invalid/" + Math.random().toString();
roundtripSet(urls(OPTIONAL), function (data, prop) {
data[prop] = "ftp://lwttest.invalid/" + Math.random().toString();
}, function (after, prop) {
do_check_eq(typeof after[prop], "undefined");
});
@ -546,12 +546,12 @@ function run_test() {
do_test_pending();
AddonManager.getAddonByID("builtInTheme0@personas.mozilla.org", builtInThemeAddon => {
AddonManager.getAddonByID("builtInTheme0@personas.mozilla.org", aAddon => {
// App specific theme can't be uninstalled or disabled,
// but can be enabled (since it isn't already applied).
do_check_eq(hasPermission(builtInThemeAddon, "uninstall"), false);
do_check_eq(hasPermission(builtInThemeAddon, "disable"), false);
do_check_eq(hasPermission(builtInThemeAddon, "enable"), true);
do_check_eq(hasPermission(aAddon, "uninstall"), false);
do_check_eq(hasPermission(aAddon, "disable"), false);
do_check_eq(hasPermission(aAddon, "enable"), true);
ltm.currentTheme = dummy("x0");
do_check_eq([...ltm._builtInThemes].length, 2);
@ -566,12 +566,12 @@ function run_test() {
Assert.throws(() => { ltm.addBuiltInTheme("not a theme object") },
"Exception is thrown adding an invalid theme");
AddonManager.getAddonByID("x0@personas.mozilla.org", x0Addon => {
AddonManager.getAddonByID("x0@personas.mozilla.org", aAddon => {
// Currently applied (non-app-specific) can be uninstalled or disabled,
// but can't be enabled (since it's already applied).
do_check_eq(hasPermission(x0Addon, "uninstall"), true);
do_check_eq(hasPermission(x0Addon, "disable"), true);
do_check_eq(hasPermission(x0Addon, "enable"), false);
do_check_eq(hasPermission(aAddon, "uninstall"), true);
do_check_eq(hasPermission(aAddon, "disable"), true);
do_check_eq(hasPermission(aAddon, "enable"), false);
ltm.forgetUsedTheme("x0");
do_check_eq(ltm.currentTheme, null);

View File

@ -810,16 +810,16 @@ function check_test_15() {
do_check_bootstrappedPref(function() {
restartManager();
AddonManager.getAddonByID(ID1, callback_soon(function(b1_2) {
do_check_neq(b1_2, null);
do_check_eq(b1_2.version, "2.0");
do_check_false(b1_2.appDisabled);
do_check_true(b1_2.userDisabled);
do_check_false(b1_2.isActive);
AddonManager.getAddonByID(ID1, callback_soon(function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "2.0");
do_check_false(b1.appDisabled);
do_check_true(b1.userDisabled);
do_check_false(b1.isActive);
BootstrapMonitor.checkAddonInstalled(ID1, "2.0");
BootstrapMonitor.checkAddonNotStarted(ID1);
b1_2.uninstall();
b1.uninstall();
run_test_16();
}));
@ -849,14 +849,14 @@ function run_test_16() {
gAppInfo.inSafeMode = true;
startupManager(false);
AddonManager.getAddonByID(ID1, callback_soon(function(b1_2) {
AddonManager.getAddonByID(ID1, callback_soon(function(b1) {
// Should still be stopped
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonNotStarted(ID1);
do_check_false(b1_2.isActive);
do_check_eq(b1_2.iconURL, null);
do_check_eq(b1_2.aboutURL, null);
do_check_eq(b1_2.optionsURL, null);
do_check_false(b1.isActive);
do_check_eq(b1.iconURL, null);
do_check_eq(b1.aboutURL, null);
do_check_eq(b1.optionsURL, null);
shutdownManager();
gAppInfo.inSafeMode = false;
@ -866,8 +866,8 @@ function run_test_16() {
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
AddonManager.getAddonByID(ID1, function(b1_3) {
b1_3.uninstall();
AddonManager.getAddonByID(ID1, function(b1) {
b1.uninstall();
do_execute_soon(run_test_17);
});
@ -1080,14 +1080,14 @@ function run_test_22() {
startupManager();
AddonManager.getAddonByID(ID1, function(b1_2) {
AddonManager.getAddonByID(ID1, function(b1) {
// Should have installed and started
BootstrapMonitor.checkAddonInstalled(ID1, "2.0");
BootstrapMonitor.checkAddonStarted(ID1, "2.0");
do_check_neq(b1_2, null);
do_check_eq(b1_2.version, "2.0");
do_check_true(b1_2.isActive);
do_check_false(b1_2.isSystem);
do_check_neq(b1, null);
do_check_eq(b1.version, "2.0");
do_check_true(b1.isActive);
do_check_false(b1.isSystem);
// This won't be set as the bootstrap script was gone so we couldn't
// uninstall it properly
@ -1100,7 +1100,7 @@ function run_test_22() {
do_check_eq(getStartupOldVersion(), undefined);
do_check_bootstrappedPref(function() {
b1_2.uninstall();
b1.uninstall();
run_test_23();
});
@ -1184,8 +1184,8 @@ function check_test_23() {
do_check_eq(list.length, 0);
restartManager();
AddonManager.getAddonByID(ID1, callback_soon(function(b1_2) {
b1_2.uninstall();
AddonManager.getAddonByID(ID1, callback_soon(function(b1) {
b1.uninstall();
restartManager();
testserver.stop(run_test_24);
@ -1266,12 +1266,12 @@ function run_test_25() {
do_check_eq(getUninstallNewVersion(), 4);
BootstrapMonitor.checkAddonNotStarted(ID1);
AddonManager.getAddonByID(ID1, function(b1_2) {
do_check_neq(b1_2, null);
do_check_eq(b1_2.version, "4.0");
do_check_true(b1_2.isActive);
do_check_false(b1_2.isSystem);
do_check_eq(b1_2.pendingOperations, AddonManager.PENDING_NONE);
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "4.0");
do_check_true(b1.isActive);
do_check_false(b1.isSystem);
do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
do_check_bootstrappedPref(run_test_26);
});
@ -1305,12 +1305,12 @@ function run_test_26() {
do_check_eq(getInstallOldVersion(), 4);
BootstrapMonitor.checkAddonStarted(ID1, "1.0");
AddonManager.getAddonByID(ID1, function(b1_2) {
do_check_neq(b1_2, null);
do_check_eq(b1_2.version, "1.0");
do_check_true(b1_2.isActive);
do_check_false(b1_2.isSystem);
do_check_eq(b1_2.pendingOperations, AddonManager.PENDING_NONE);
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_true(b1.isActive);
do_check_false(b1.isSystem);
do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
do_check_bootstrappedPref(run_test_27);
});
@ -1337,22 +1337,22 @@ function run_test_27() {
do_check_eq(getUninstallNewVersion(), 4);
BootstrapMonitor.checkAddonNotStarted(ID1);
AddonManager.getAddonByID(ID1, callback_soon(function(b1_2) {
do_check_neq(b1_2, null);
do_check_eq(b1_2.version, "4.0");
do_check_false(b1_2.isActive);
do_check_eq(b1_2.pendingOperations, AddonManager.PENDING_NONE);
AddonManager.getAddonByID(ID1, callback_soon(function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "4.0");
do_check_false(b1.isActive);
do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
restartManager();
BootstrapMonitor.checkAddonNotInstalled(ID1);
BootstrapMonitor.checkAddonNotStarted(ID1);
AddonManager.getAddonByID(ID1, function(b1_3) {
do_check_neq(b1_3, null);
do_check_eq(b1_3.version, "4.0");
do_check_false(b1_3.isActive);
do_check_eq(b1_3.pendingOperations, AddonManager.PENDING_NONE);
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "4.0");
do_check_false(b1.isActive);
do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
do_check_bootstrappedPref(run_test_28);
});
@ -1384,14 +1384,14 @@ function run_test_28() {
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonNotStarted(ID1);
AddonManager.getAddonByID(ID1, function(b1_2) {
do_check_neq(b1_2, null);
do_check_true(b1_2.userDisabled);
b1_2.userDisabled = false;
do_check_eq(b1_2.version, "1.0");
do_check_true(b1_2.isActive);
do_check_false(b1_2.isSystem);
do_check_eq(b1_2.pendingOperations, AddonManager.PENDING_NONE);
AddonManager.getAddonByID(ID1, function(b1) {
do_check_neq(b1, null);
do_check_true(b1.userDisabled);
b1.userDisabled = false;
do_check_eq(b1.version, "1.0");
do_check_true(b1.isActive);
do_check_false(b1.isSystem);
do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
BootstrapMonitor.checkAddonInstalled(ID1, "1.0");
BootstrapMonitor.checkAddonStarted(ID1, "1.0");

View File

@ -138,9 +138,9 @@ function run_test() {
installAllFiles(ADDONS.map(a => do_get_addon(a.addon)), function() {
restartManager();
AddonManager.getAddonByID(ADDONS[0].id, callback_soon(function(firstAddon) {
do_check_true(firstAddon);
firstAddon.userDisabled = true;
AddonManager.getAddonByID(ADDONS[0].id, callback_soon(function(addon) {
do_check_true(!(!addon));
addon.userDisabled = true;
restartManager();
AddonManager.getAddonsByTypes(["extension"], function(installedItems) {

View File

@ -23,10 +23,10 @@ function run_test()
do_check_eq(addon.name, "Test theme");
restartManager();
AddonManager.getAddonByID(ID, callback_soon(function(addon2) {
do_check_neq(addon2, null);
do_check_eq(addon2.optionsURL, null);
do_check_eq(addon2.aboutURL, null);
AddonManager.getAddonByID(ID, callback_soon(function(addon) {
do_check_neq(addon, null);
do_check_eq(addon.optionsURL, null);
do_check_eq(addon.aboutURL, null);
do_execute_soon(do_test_finished);
}));

View File

@ -236,22 +236,22 @@ function check_test_2() {
do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "classic/1.0");
AddonManager.getAddonsByIDs(["default@tests.mozilla.org",
"alternate@tests.mozilla.org"], function([d2, a2]) {
do_check_neq(d2, null);
do_check_false(d2.userDisabled);
do_check_false(d2.appDisabled);
do_check_true(d2.isActive);
do_check_true(isThemeInAddonsList(profileDir, d2.id));
do_check_false(hasFlag(d2.permissions, AddonManager.PERM_CAN_DISABLE));
do_check_false(hasFlag(d2.permissions, AddonManager.PERM_CAN_ENABLE));
"alternate@tests.mozilla.org"], function([d, a]) {
do_check_neq(d, null);
do_check_false(d.userDisabled);
do_check_false(d.appDisabled);
do_check_true(d.isActive);
do_check_true(isThemeInAddonsList(profileDir, d.id));
do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE));
do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE));
do_check_neq(a2, null);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_false(a2.isActive);
do_check_false(isThemeInAddonsList(profileDir, a2.id));
do_check_false(hasFlag(a2.permissions, AddonManager.PERM_CAN_DISABLE));
do_check_true(hasFlag(a2.permissions, AddonManager.PERM_CAN_ENABLE));
do_check_neq(a, null);
do_check_true(a.userDisabled);
do_check_false(a.appDisabled);
do_check_false(a.isActive);
do_check_false(isThemeInAddonsList(profileDir, a.id));
do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE));
do_check_true(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE));
end_test();
});

View File

@ -49,13 +49,13 @@ function run_test() {
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a2) {
do_check_neq(a2, null);
do_check_eq(a2.version, "2.0");
do_check_false(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_true(a2.isActive);
do_check_true(isExtensionInAddonsList(profileDir, a2.id));
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a) {
do_check_neq(a, null);
do_check_eq(a.version, "2.0");
do_check_false(a.userDisabled);
do_check_false(a.appDisabled);
do_check_true(a.isActive);
do_check_true(isExtensionInAddonsList(profileDir, a.id));
do_execute_soon(do_test_finished);
});

View File

@ -53,12 +53,12 @@ function run_test() {
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org"],
function([a1_2, a2_2]) {
function([a1, a2]) {
// Addon1 should no longer be installed
do_check_eq(a1_2, null);
do_check_eq(a1, null);
// Addon2 should have been detected
do_check_neq(a2_2, null);
do_check_neq(a2, null);
do_execute_soon(do_test_finished);
});

View File

@ -96,20 +96,20 @@ function run_test_1() {
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1_2) {
check_addon_upgrading(a1_2);
AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) {
check_addon_upgrading(a1);
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1_3) {
check_addon_upgrading(a1_3);
AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) {
check_addon_upgrading(a1);
fstream.close();
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1_4) {
check_addon(a1_4, "2.0");
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
check_addon(a1, "2.0");
a1.uninstall();
do_execute_soon(run_test_2);
@ -146,20 +146,20 @@ function run_test_2() {
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1_2) {
check_addon_uninstalling(a1_2, true);
AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) {
check_addon_uninstalling(a1, true);
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1_3) {
check_addon_uninstalling(a1_3, true);
AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) {
check_addon_uninstalling(a1, true);
fstream.close();
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1_4) {
do_check_eq(a1_4, null);
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
do_check_eq(a1, null);
var dir = profileDir.clone();
dir.append(do_get_expected_addon_name("addon1@tests.mozilla.org"));
do_check_false(dir.exists());

View File

@ -84,11 +84,11 @@ function run_test_1() {
onUpdateFinished: function() {
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1_2) {
do_check_neq(a1_2, null);
do_check_false(a1_2.appDisabled);
do_check_true(a1_2.isActive);
do_check_true(isExtensionInAddonsList(userDir, a1_2.id));
AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) {
do_check_neq(a1, null);
do_check_false(a1.appDisabled);
do_check_true(a1.isActive);
do_check_true(isExtensionInAddonsList(userDir, a1.id));
shutdownManager();
@ -103,16 +103,16 @@ function run_test_1() {
startupManager(false);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org"], function([a1_3, a2_3]) {
do_check_neq(a1_3, null);
do_check_false(a1_3.appDisabled);
do_check_true(a1_3.isActive);
do_check_true(isExtensionInAddonsList(userDir, a1_3.id));
"addon2@tests.mozilla.org"], function([a1, a2]) {
do_check_neq(a1, null);
do_check_false(a1.appDisabled);
do_check_true(a1.isActive);
do_check_true(isExtensionInAddonsList(userDir, a1.id));
do_check_neq(a2_3, null);
do_check_false(a2_3.appDisabled);
do_check_true(a2_3.isActive);
do_check_false(isExtensionInAddonsList(userDir, a2_3.id));
do_check_neq(a2, null);
do_check_false(a2.appDisabled);
do_check_true(a2.isActive);
do_check_false(isExtensionInAddonsList(userDir, a2.id));
do_check_eq(Services.prefs.getIntPref("bootstraptest.active_version"), 1);
do_execute_soon(run_test_2);
@ -146,16 +146,16 @@ function run_test_2() {
startupManager(false);
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org"], function([a1_2, a2_2]) {
do_check_neq(a1_2, null);
do_check_false(a1_2.appDisabled);
do_check_true(a1_2.isActive);
do_check_true(isExtensionInAddonsList(userDir, a1_2.id));
"addon2@tests.mozilla.org"], function([a1, a2]) {
do_check_neq(a1, null);
do_check_false(a1.appDisabled);
do_check_true(a1.isActive);
do_check_true(isExtensionInAddonsList(userDir, a1.id));
do_check_neq(a2_2, null);
do_check_true(a2_2.userDisabled);
do_check_false(a2_2.isActive);
do_check_false(isExtensionInAddonsList(userDir, a2_2.id));
do_check_neq(a2, null);
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
do_check_false(isExtensionInAddonsList(userDir, a2.id));
do_check_eq(Services.prefs.getIntPref("bootstraptest.active_version"), 0);
end_test();

View File

@ -148,45 +148,45 @@ function run_test_1() {
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org"],
function([a1_2, a2_2, a3_2, a4_2]) {
do_check_neq(a1_2, null);
do_check_eq(a1_2.version, "2.0");
do_check_false(a1_2.appDisabled);
do_check_false(a1_2.userDisabled);
do_check_true(a1_2.isActive);
function([a1, a2, a3, a4]) {
do_check_neq(a1, null);
do_check_eq(a1.version, "2.0");
do_check_false(a1.appDisabled);
do_check_false(a1.userDisabled);
do_check_true(a1.isActive);
do_check_true(isExtensionInAddonsList(profileDir, addon1.id));
do_check_neq(a2_2, null);
do_check_eq(a2_2.version, "2.0");
do_check_false(a2_2.appDisabled);
do_check_false(a2_2.userDisabled);
do_check_true(a2_2.isActive);
do_check_neq(a2, null);
do_check_eq(a2.version, "2.0");
do_check_false(a2.appDisabled);
do_check_false(a2.userDisabled);
do_check_true(a2.isActive);
do_check_true(isExtensionInAddonsList(profileDir, addon2.id));
// Should stay enabled because we migrate the compat info from
// the previous version of the DB
do_check_neq(a3_2, null);
do_check_eq(a3_2.version, "2.0");
todo_check_false(a3_2.appDisabled); // XXX unresolved issue
do_check_false(a3_2.userDisabled);
todo_check_true(a3_2.isActive); // XXX same
do_check_neq(a3, null);
do_check_eq(a3.version, "2.0");
todo_check_false(a3.appDisabled); // XXX unresolved issue
do_check_false(a3.userDisabled);
todo_check_true(a3.isActive); // XXX same
todo_check_true(isExtensionInAddonsList(profileDir, addon3.id)); // XXX same
do_check_neq(a4_2, null);
do_check_eq(a4_2.version, "2.0");
do_check_true(a4_2.appDisabled);
do_check_false(a4_2.userDisabled);
do_check_false(a4_2.isActive);
do_check_neq(a4, null);
do_check_eq(a4.version, "2.0");
do_check_true(a4.appDisabled);
do_check_false(a4.userDisabled);
do_check_false(a4.isActive);
do_check_false(isExtensionInAddonsList(profileDir, addon4.id));
// Check that install and uninstall haven't been called on the bootstrapped addon
do_check_false(Services.prefs.prefHasUserValue("bootstraptest.install_reason"));
do_check_false(Services.prefs.prefHasUserValue("bootstraptest.uninstall_reason"));
a1_2.uninstall();
a2_2.uninstall();
a3_2.uninstall();
a4_2.uninstall();
a1.uninstall();
a2.uninstall();
a3.uninstall();
a4.uninstall();
do_execute_soon(run_test_2);
});
});
@ -290,45 +290,45 @@ function run_test_2() {
"addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org"],
callback_soon(function([a1_2, a2_2, a3_2, a4_2]) {
do_check_neq(a1_2, null);
do_check_eq(a1_2.version, "2.0");
do_check_true(a1_2.appDisabled);
do_check_false(a1_2.userDisabled);
do_check_false(a1_2.isActive);
callback_soon(function([a1, a2, a3, a4]) {
do_check_neq(a1, null);
do_check_eq(a1.version, "2.0");
do_check_true(a1.appDisabled);
do_check_false(a1.userDisabled);
do_check_false(a1.isActive);
do_check_false(isExtensionInAddonsList(profileDir, addon1.id));
do_check_neq(a2_2, null);
do_check_eq(a2_2.version, "2.0");
do_check_false(a2_2.appDisabled);
do_check_false(a2_2.userDisabled);
do_check_true(a2_2.isActive);
do_check_neq(a2, null);
do_check_eq(a2.version, "2.0");
do_check_false(a2.appDisabled);
do_check_false(a2.userDisabled);
do_check_true(a2.isActive);
do_check_true(isExtensionInAddonsList(profileDir, addon2.id));
// Should become appDisabled because we migrate the compat info from
// the previous version of the DB
do_check_neq(a3_2, null);
do_check_eq(a3_2.version, "2.0");
todo_check_true(a3_2.appDisabled);
do_check_false(a3_2.userDisabled);
todo_check_false(a3_2.isActive);
do_check_neq(a3, null);
do_check_eq(a3.version, "2.0");
todo_check_true(a3.appDisabled);
do_check_false(a3.userDisabled);
todo_check_false(a3.isActive);
todo_check_false(isExtensionInAddonsList(profileDir, addon3.id));
do_check_neq(a4_2, null);
do_check_eq(a4_2.version, "2.0");
do_check_false(a4_2.appDisabled);
do_check_false(a4_2.userDisabled);
do_check_true(a4_2.isActive);
do_check_neq(a4, null);
do_check_eq(a4.version, "2.0");
do_check_false(a4.appDisabled);
do_check_false(a4.userDisabled);
do_check_true(a4.isActive);
do_check_true(isExtensionInAddonsList(profileDir, addon4.id));
// Check that install and uninstall haven't been called on the bootstrapped addon
do_check_false(Services.prefs.prefHasUserValue("bootstraptest.install_reason"));
do_check_false(Services.prefs.prefHasUserValue("bootstraptest.uninstall_reason"));
a1_2.uninstall();
a2_2.uninstall();
a3_2.uninstall();
a4_2.uninstall();
a1.uninstall();
a2.uninstall();
a3.uninstall();
a4.uninstall();
restartManager();
shutdownManager();

View File

@ -88,7 +88,7 @@ function run_test_2() {
function run_test_3() {
AddonManager.getInstallForFile(do_get_addon("test_cacheflush2"), function(aInstall) {
aInstall.addListener({
onInstallStarted: function() {
onInstallStarted: function(aInstall) {
// We should flush the staged XPI when completing the install
gExpectedFile = gProfD.clone();
gExpectedFile.append("extensions");
@ -96,7 +96,7 @@ function run_test_3() {
gExpectedFile.append("addon2@tests.mozilla.org.xpi");
},
onInstallEnded: function() {
onInstallEnded: function(aInstall) {
do_check_eq(gCacheFlushCount, 1);
gExpectedFile = null;
gCacheFlushCount = 0;

View File

@ -265,70 +265,70 @@ function run_test_1() {
"addon7@tests.mozilla.org",
"theme1@tests.mozilla.org",
"theme2@tests.mozilla.org"],
callback_soon(function([a1_2, a2_2, a3_2, a4_2, a5_2, a6_2, a7_2, t1_2, t2_2]) {
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
// Should be correctly recovered
do_check_neq(a1_2, null);
do_check_true(a1_2.isActive);
do_check_false(a1_2.userDisabled);
do_check_false(a1_2.appDisabled);
do_check_eq(a1_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a1, null);
do_check_true(a1.isActive);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(a2_2, null);
do_check_false(a2_2.isActive);
do_check_true(a2_2.userDisabled);
do_check_false(a2_2.appDisabled);
do_check_eq(a2_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
// The compatibility update won't be recovered but it should still be
// active for this session
do_check_neq(a3_2, null);
do_check_true(a3_2.isActive);
do_check_false(a3_2.userDisabled);
do_check_false(a3_2.appDisabled);
do_check_eq(a3_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3, null);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_false(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
// The compatibility update won't be recovered and with strict
// compatibility it would not have been able to tell that it was
// previously userDisabled. However, without strict compat, it wasn't
// appDisabled, so it knows it must have been userDisabled.
do_check_neq(a4_2, null);
do_check_false(a4_2.isActive);
do_check_true(a4_2.userDisabled);
do_check_false(a4_2.appDisabled);
do_check_eq(a4_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_true(a4.userDisabled);
do_check_false(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5_2, null);
do_check_true(a5_2.isActive);
do_check_false(a5_2.userDisabled);
do_check_false(a5_2.appDisabled);
do_check_eq(a5_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_true(a5.isActive);
do_check_false(a5.userDisabled);
do_check_false(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6_2, null);
do_check_true(a6_2.isActive);
do_check_false(a6_2.userDisabled);
do_check_false(a6_2.appDisabled);
do_check_eq(a6_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
do_check_true(a6.isActive);
do_check_false(a6.userDisabled);
do_check_false(a6.appDisabled);
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7_2, null);
do_check_false(a7_2.isActive);
do_check_true(a7_2.userDisabled);
do_check_false(a7_2.appDisabled);
do_check_eq(a7_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_true(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(t1_2, null);
do_check_false(t1_2.isActive);
do_check_true(t1_2.userDisabled);
do_check_false(t1_2.appDisabled);
do_check_eq(t1_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t1, null);
do_check_false(t1.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(t2_2, null);
do_check_true(t2_2.isActive);
do_check_false(t2_2.userDisabled);
do_check_false(t2_2.appDisabled);
do_check_eq(t2_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t2, null);
do_check_true(t2.isActive);
do_check_false(t2.userDisabled);
do_check_false(t2.appDisabled);
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
Assert.throws(shutdownManager);
startupManager(false);
@ -342,60 +342,60 @@ function run_test_1() {
"addon7@tests.mozilla.org",
"theme1@tests.mozilla.org",
"theme2@tests.mozilla.org"],
callback_soon(function([a1_3, a2_3, a3_3, a4_3, a5_3, a6_3, a7_3, t1_3, t2_3]) {
do_check_neq(a1_3, null);
do_check_true(a1_3.isActive);
do_check_false(a1_3.userDisabled);
do_check_false(a1_3.appDisabled);
do_check_eq(a1_3.pendingOperations, AddonManager.PENDING_NONE);
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
do_check_neq(a1, null);
do_check_true(a1.isActive);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a2_3, null);
do_check_false(a2_3.isActive);
do_check_true(a2_3.userDisabled);
do_check_false(a2_3.appDisabled);
do_check_eq(a2_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3_3, null);
do_check_true(a3_3.isActive);
do_check_false(a3_3.userDisabled);
do_check_false(a3_3.appDisabled);
do_check_eq(a3_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3, null);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_false(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4_3, null);
do_check_false(a4_3.isActive);
do_check_true(a4_3.userDisabled);
do_check_false(a4_3.appDisabled);
do_check_eq(a4_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_true(a4.userDisabled);
do_check_false(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5_3, null);
do_check_true(a5_3.isActive);
do_check_false(a5_3.userDisabled);
do_check_false(a5_3.appDisabled);
do_check_eq(a5_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_true(a5.isActive);
do_check_false(a5.userDisabled);
do_check_false(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6_3, null);
do_check_true(a6_3.isActive);
do_check_false(a6_3.userDisabled);
do_check_false(a6_3.appDisabled);
do_check_eq(a6_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
do_check_true(a6.isActive);
do_check_false(a6.userDisabled);
do_check_false(a6.appDisabled);
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7_3, null);
do_check_false(a7_3.isActive);
do_check_true(a7_3.userDisabled);
do_check_false(a7_3.appDisabled);
do_check_eq(a7_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_true(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t1_3, null);
do_check_false(t1_3.isActive);
do_check_true(t1_3.userDisabled);
do_check_false(t1_3.appDisabled);
do_check_eq(t1_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t1, null);
do_check_false(t1.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t2_3, null);
do_check_true(t2_3.isActive);
do_check_false(t2_3.userDisabled);
do_check_false(t2_3.appDisabled);
do_check_eq(t2_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t2, null);
do_check_true(t2.isActive);
do_check_false(t2.userDisabled);
do_check_false(t2.appDisabled);
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
Assert.throws(shutdownManager);

View File

@ -266,68 +266,68 @@ function run_test_1() {
"addon7@tests.mozilla.org",
"theme1@tests.mozilla.org",
"theme2@tests.mozilla.org"],
callback_soon(function([a1_2, a2_2, a3_2, a4_2, a5_2, a6_2, a7_2, t1_2, t2_2]) {
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
// Should be correctly recovered
do_check_neq(a1_2, null);
do_check_true(a1_2.isActive);
do_check_false(a1_2.userDisabled);
do_check_false(a1_2.appDisabled);
do_check_eq(a1_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a1, null);
do_check_true(a1.isActive);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(a2_2, null);
do_check_false(a2_2.isActive);
do_check_true(a2_2.userDisabled);
do_check_false(a2_2.appDisabled);
do_check_eq(a2_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
// The compatibility update won't be recovered but it should still be
// active for this session
do_check_neq(a3_2, null);
do_check_true(a3_2.isActive);
do_check_false(a3_2.userDisabled);
do_check_true(a3_2.appDisabled);
do_check_eq(a3_2.pendingOperations, AddonManager.PENDING_DISABLE);
do_check_neq(a3, null);
do_check_true(a3.isActive);
do_check_false(a3.userDisabled);
do_check_true(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_DISABLE);
// The compatibility update won't be recovered and it will not have been
// able to tell that it was previously userDisabled
do_check_neq(a4_2, null);
do_check_false(a4_2.isActive);
do_check_false(a4_2.userDisabled);
do_check_true(a4_2.appDisabled);
do_check_eq(a4_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_false(a4.userDisabled);
do_check_true(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5_2, null);
do_check_false(a5_2.isActive);
do_check_false(a5_2.userDisabled);
do_check_true(a5_2.appDisabled);
do_check_eq(a5_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6_2, null);
do_check_true(a6_2.isActive);
do_check_false(a6_2.userDisabled);
do_check_false(a6_2.appDisabled);
do_check_eq(a6_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
do_check_true(a6.isActive);
do_check_false(a6.userDisabled);
do_check_false(a6.appDisabled);
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7_2, null);
do_check_false(a7_2.isActive);
do_check_true(a7_2.userDisabled);
do_check_false(a7_2.appDisabled);
do_check_eq(a7_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_true(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(t1_2, null);
do_check_false(t1_2.isActive);
do_check_true(t1_2.userDisabled);
do_check_false(t1_2.appDisabled);
do_check_eq(t1_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t1, null);
do_check_false(t1.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE);
// Should be correctly recovered
do_check_neq(t2_2, null);
do_check_true(t2_2.isActive);
do_check_false(t2_2.userDisabled);
do_check_false(t2_2.appDisabled);
do_check_eq(t2_2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t2, null);
do_check_true(t2.isActive);
do_check_false(t2.userDisabled);
do_check_false(t2.appDisabled);
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
Assert.throws(shutdownManager);
startupManager(false);
@ -341,60 +341,60 @@ function run_test_1() {
"addon7@tests.mozilla.org",
"theme1@tests.mozilla.org",
"theme2@tests.mozilla.org"],
callback_soon(function([a1_3, a2_3, a3_3, a4_3, a5_3, a6_3, a7_3, t1_3, t2_3]) {
do_check_neq(a1_3, null);
do_check_true(a1_3.isActive);
do_check_false(a1_3.userDisabled);
do_check_false(a1_3.appDisabled);
do_check_eq(a1_3.pendingOperations, AddonManager.PENDING_NONE);
callback_soon(function([a1, a2, a3, a4, a5, a6, a7, t1, t2]) {
do_check_neq(a1, null);
do_check_true(a1.isActive);
do_check_false(a1.userDisabled);
do_check_false(a1.appDisabled);
do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a2_3, null);
do_check_false(a2_3.isActive);
do_check_true(a2_3.userDisabled);
do_check_false(a2_3.appDisabled);
do_check_eq(a2_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a2, null);
do_check_false(a2.isActive);
do_check_true(a2.userDisabled);
do_check_false(a2.appDisabled);
do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3_3, null);
do_check_false(a3_3.isActive);
do_check_false(a3_3.userDisabled);
do_check_true(a3_3.appDisabled);
do_check_eq(a3_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a3, null);
do_check_false(a3.isActive);
do_check_false(a3.userDisabled);
do_check_true(a3.appDisabled);
do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4_3, null);
do_check_false(a4_3.isActive);
do_check_false(a4_3.userDisabled);
do_check_true(a4_3.appDisabled);
do_check_eq(a4_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a4, null);
do_check_false(a4.isActive);
do_check_false(a4.userDisabled);
do_check_true(a4.appDisabled);
do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5_3, null);
do_check_false(a5_3.isActive);
do_check_false(a5_3.userDisabled);
do_check_true(a5_3.appDisabled);
do_check_eq(a5_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a5, null);
do_check_false(a5.isActive);
do_check_false(a5.userDisabled);
do_check_true(a5.appDisabled);
do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6_3, null);
do_check_true(a6_3.isActive);
do_check_false(a6_3.userDisabled);
do_check_false(a6_3.appDisabled);
do_check_eq(a6_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a6, null);
do_check_true(a6.isActive);
do_check_false(a6.userDisabled);
do_check_false(a6.appDisabled);
do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7_3, null);
do_check_false(a7_3.isActive);
do_check_true(a7_3.userDisabled);
do_check_false(a7_3.appDisabled);
do_check_eq(a7_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(a7, null);
do_check_false(a7.isActive);
do_check_true(a7.userDisabled);
do_check_false(a7.appDisabled);
do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t1_3, null);
do_check_false(t1_3.isActive);
do_check_true(t1_3.userDisabled);
do_check_false(t1_3.appDisabled);
do_check_eq(t1_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t1, null);
do_check_false(t1.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t2_3, null);
do_check_true(t2_3.isActive);
do_check_false(t2_3.userDisabled);
do_check_false(t2_3.appDisabled);
do_check_eq(t2_3.pendingOperations, AddonManager.PENDING_NONE);
do_check_neq(t2, null);
do_check_true(t2.isActive);
do_check_false(t2.userDisabled);
do_check_false(t2.appDisabled);
do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE);
Assert.throws(shutdownManager);

View File

@ -11,11 +11,11 @@ var ADDON = {
addon: "test_data_directory"
};
function run_test() {
var expectedDir = gProfD.clone();
expectedDir.append("extension-data");
expectedDir.append(ADDON.id);
var expectedDir = gProfD.clone();
expectedDir.append("extension-data");
expectedDir.append(ADDON.id);
function run_test() {
do_test_pending();
do_check_false(expectedDir.exists());

View File

@ -452,10 +452,10 @@ function run_test_16() {
startupManager(false);
AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org",
callback_soon(function(b1_2) {
callback_soon(function(b1) {
// Should still be stopped
do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic"));
do_check_false(b1_2.isActive);
do_check_false(b1.isActive);
shutdownManager();
gAppInfo.inSafeMode = false;
@ -464,8 +464,8 @@ function run_test_16() {
// Should have started
do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic"));
AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1_3) {
b1_3.uninstall();
AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) {
b1.uninstall();
do_execute_soon(run_test_17);
});
@ -583,8 +583,8 @@ function check_test_23() {
do_check_eq(list.length, 0);
restartManager();
AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1_2) {
b1_2.uninstall();
AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) {
b1.uninstall();
do_execute_soon(run_test_25);
});
}));
@ -617,11 +617,11 @@ function run_test_25() {
do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic"));
AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1_2) {
do_check_neq(b1_2, null);
do_check_eq(b1_2.version, "2.0");
do_check_true(b1_2.isActive);
do_check_eq(b1_2.pendingOperations, AddonManager.PENDING_NONE);
AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "2.0");
do_check_true(b1.isActive);
do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
do_execute_soon(run_test_26);
});
@ -650,14 +650,14 @@ function run_test_26() {
do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic"));
AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1_2) {
do_check_neq(b1_2, null);
do_check_eq(b1_2.version, "1.0");
do_check_true(b1_2.isActive);
do_check_eq(b1_2.pendingOperations, AddonManager.PENDING_NONE);
AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) {
do_check_neq(b1, null);
do_check_eq(b1.version, "1.0");
do_check_true(b1.isActive);
do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE);
HunspellEngine.deactivate();
b1_2.uninstall();
b1.uninstall();
do_execute_soon(run_test_27);
});
}));

View File

@ -165,8 +165,8 @@ function run_test_5() {
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1_2) {
do_check_eq(a1_2, null);
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
do_check_eq(a1, null);
do_execute_soon(run_test_6);
});

View File

@ -176,10 +176,10 @@ function run_test_3() {
[PLUGINS[0], PLUGINS[1]] = [PLUGINS[1], PLUGINS[0]];
restartManager();
AddonManager.getAddonByID(gPluginIDs[0], function(p_2) {
do_check_neq(p_2, null);
do_check_eq(p_2.name, "Duplicate Plugin 1");
do_check_eq(p_2.description, "A duplicate plugin");
AddonManager.getAddonByID(gPluginIDs[0], function(p) {
do_check_neq(p, null);
do_check_eq(p.name, "Duplicate Plugin 1");
do_check_eq(p.description, "A duplicate plugin");
do_execute_soon(do_test_finished);
});

View File

@ -247,9 +247,9 @@ function run_test_5() {
restartManager();
AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org"], function([a1_2, a2_2]) {
do_check_eq(a1_2, null);
do_check_eq(a2_2, null);
"addon2@tests.mozilla.org"], function([a1, a2]) {
do_check_eq(a1, null);
do_check_eq(a2, null);
let source = sourceDir.clone();
source.append(addon1.id);
@ -283,8 +283,8 @@ function run_test_6() {
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1_2) {
do_check_eq(a1_2, null);
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
do_check_eq(a1, null);
do_execute_soon(run_test_7);
});
@ -309,11 +309,11 @@ function run_test_7() {
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1_2) {
do_check_neq(a1_2, null);
do_check_eq(a1_2.version, "2.0");
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
do_check_neq(a1, null);
do_check_eq(a1.version, "2.0");
a1_2.uninstall();
a1.uninstall();
do_execute_soon(run_test_8);
});
@ -336,11 +336,11 @@ function run_test_8() {
restartManager();
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1_2) {
do_check_neq(a1_2, null);
do_check_eq(a1_2.version, "2.0");
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
do_check_neq(a1, null);
do_check_eq(a1.version, "2.0");
a1_2.uninstall();
a1.uninstall();
do_execute_soon(run_test_9);
});
@ -364,8 +364,8 @@ function run_test_9() {
restartManager();
AddonManager.getAddonByID(addon1.id, function(a1_2) {
do_check_eq(a1_2, null);
AddonManager.getAddonByID(addon1.id, function(a1) {
do_check_eq(a1, null);
let pointer = profileDir.clone();
pointer.append(addon1.id);

View File

@ -76,9 +76,9 @@ function run_test() {
}
AddonManager.getInstallForFile(do_get_addon("test_getresource"),
callback_soon(function(aInstall_2) {
callback_soon(function(aInstall) {
do_check_false(a1.hasResource("icon.png"));
do_check_true(aInstall_2.addon.hasResource("icon.png"));
do_check_true(aInstall.addon.hasResource("icon.png"));
restartManager();

View File

@ -186,10 +186,10 @@ function check_test_1(installSyncGUID) {
do_check_true(a1.hasResource("install.rdf"));
do_check_false(a1.hasResource("foo.bar"));
let uri2 = do_get_addon_root_uri(profileDir, "addon1@tests.mozilla.org");
do_check_eq(a1.getResourceURI("install.rdf").spec, uri2 + "install.rdf");
do_check_eq(a1.iconURL, uri2 + "icon.png");
do_check_eq(a1.icon64URL, uri2 + "icon64.png");
let uri = do_get_addon_root_uri(profileDir, "addon1@tests.mozilla.org");
do_check_eq(a1.getResourceURI("install.rdf").spec, uri + "install.rdf");
do_check_eq(a1.iconURL, uri + "icon.png");
do_check_eq(a1.icon64URL, uri + "icon64.png");
// Ensure that extension bundle (or icon if unpacked) has updated
// lastModifiedDate.
@ -233,7 +233,7 @@ function run_test_2() {
], check_test_2);
install.addListener({
onDownloadProgress: function() {
onDownloadProgress: function(install) {
do_execute_soon(function() {
Components.utils.forceGC();
});
@ -387,8 +387,8 @@ function check_test_5(install) {
do_check_eq(installs[0].addon, olda2.pendingUpgrade);
restartManager();
AddonManager.getInstallsByTypes(null, function(installs2) {
do_check_eq(installs2.length, 0);
AddonManager.getInstallsByTypes(null, function(installs) {
do_check_eq(installs.length, 0);
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_neq(a2, null);
@ -1148,26 +1148,26 @@ function run_test_16() {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
let url_2 = "http://localhost:" + gPort + "/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url_2, function(aInstall_2) {
aInstall_2.addListener({
let url = "http://localhost:" + gPort + "/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function() {
do_execute_soon(function install2_2_ended() {
do_check_true(aInstall_2.addon.userDisabled);
do_check_true(aInstall.addon.userDisabled);
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2_2) {
do_check_true(a2_2.userDisabled);
do_check_false(a2_2.isActive);
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
a2_2.uninstall();
a2.uninstall();
do_execute_soon(run_test_17);
});
});
}
});
aInstall_2.install();
aInstall.install();
}, "application/x-xpinstall");
});
});
@ -1194,29 +1194,29 @@ function run_test_17() {
do_check_false(a2.userDisabled);
do_check_true(a2.isActive);
let url_2 = "http://localhost:" + gPort + "/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url_2, function(aInstall_2) {
aInstall_2.addListener({
let url = "http://localhost:" + gPort + "/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallStarted: function() {
do_check_false(aInstall_2.addon.userDisabled);
aInstall_2.addon.userDisabled = true;
do_check_false(aInstall.addon.userDisabled);
aInstall.addon.userDisabled = true;
},
onInstallEnded: function() {
do_execute_soon(function install2_2_ended2() {
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2_2) {
do_check_true(a2_2.userDisabled);
do_check_false(a2_2.isActive);
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
a2_2.uninstall();
a2.uninstall();
do_execute_soon(run_test_18);
});
});
}
});
aInstall_2.install();
aInstall.install();
}, "application/x-xpinstall");
});
});
@ -1246,29 +1246,29 @@ function run_test_18() {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
let url_2 = "http://localhost:" + gPort + "/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url_2, function(aInstall_2) {
aInstall_2.addListener({
let url = "http://localhost:" + gPort + "/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallStarted: function() {
do_check_true(aInstall_2.addon.userDisabled);
aInstall_2.addon.userDisabled = false;
do_check_true(aInstall.addon.userDisabled);
aInstall.addon.userDisabled = false;
},
onInstallEnded: function() {
do_execute_soon(function install_2_2_ended3() {
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2_2) {
do_check_false(a2_2.userDisabled);
do_check_true(a2_2.isActive);
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_false(a2.userDisabled);
do_check_true(a2.isActive);
a2_2.uninstall();
a2.uninstall();
do_execute_soon(run_test_18_1);
});
});
}
});
aInstall_2.install();
aInstall.install();
}, "application/x-xpinstall");
});
});
@ -1292,7 +1292,7 @@ function run_test_18_1() {
let url = "http://localhost:" + gPort + "/addons/test_install2_1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function(unused, aAddon) {
onInstallEnded: function(aInstall, aAddon) {
do_execute_soon(function test18_1_install_ended() {
do_check_neq(aAddon.fullDescription, "Repository description");
@ -1320,7 +1320,7 @@ function run_test_19() {
let url = "http://localhost:" + gPort + "/addons/test_install2_1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function(unused, aAddon) {
onInstallEnded: function(aInstall, aAddon) {
do_execute_soon(function test19_install_ended() {
do_check_eq(aAddon.fullDescription, "Repository description");
@ -1346,7 +1346,7 @@ function run_test_20() {
let url = "http://localhost:" + gPort + "/addons/test_install2_1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function(unused, aAddon) {
onInstallEnded: function(aInstall, aAddon) {
do_execute_soon(function test20_install_ended() {
do_check_eq(aAddon.fullDescription, "Repository description");
@ -1633,8 +1633,8 @@ function run_test_26() {
let url = "http://localhost:" + gPort + "/redirect?/addons/test_install1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onDownloadProgress: function(aDownloadProgressInstall) {
aDownloadProgressInstall.cancel();
onDownloadProgress: function(aInstall) {
aInstall.cancel();
}
});

View File

@ -177,10 +177,10 @@ function check_test_1() {
do_check_true(a1.hasResource("install.rdf"));
do_check_false(a1.hasResource("foo.bar"));
let root_uri = do_get_addon_root_uri(profileDir, "addon1@tests.mozilla.org");
do_check_eq(a1.getResourceURI("install.rdf").spec, root_uri + "install.rdf");
do_check_eq(a1.iconURL, root_uri + "icon.png");
do_check_eq(a1.icon64URL, root_uri + "icon64.png");
let uri = do_get_addon_root_uri(profileDir, "addon1@tests.mozilla.org");
do_check_eq(a1.getResourceURI("install.rdf").spec, uri + "install.rdf");
do_check_eq(a1.iconURL, uri + "icon.png");
do_check_eq(a1.icon64URL, uri + "icon64.png");
a1.uninstall();
do_execute_soon(function() { run_test_2(a1) });
@ -216,7 +216,7 @@ function run_test_2(aAddon) {
], check_test_2);
install.addListener({
onDownloadProgress: function() {
onDownloadProgress: function(install) {
do_execute_soon(function() {
Components.utils.forceGC();
});
@ -369,8 +369,8 @@ function check_test_5(install) {
do_check_eq(installs[0].addon, olda2.pendingUpgrade);
restartManager();
AddonManager.getInstallsByTypes(null, function(installs2) {
do_check_eq(installs2.length, 0);
AddonManager.getInstallsByTypes(null, function(installs) {
do_check_eq(installs.length, 0);
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_neq(a2, null);
@ -1129,26 +1129,26 @@ function run_test_16() {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
let url_2 = "http://localhost:4444/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url_2, function(aInstall_2) {
aInstall_2.addListener({
let url = "http://localhost:4444/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function() {
do_execute_soon(function test16_install2() {
do_check_true(aInstall_2.addon.userDisabled);
do_check_true(aInstall.addon.userDisabled);
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2_2) {
do_check_true(a2_2.userDisabled);
do_check_false(a2_2.isActive);
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
a2_2.uninstall();
a2.uninstall();
do_execute_soon(run_test_17);
});
});
}
});
aInstall_2.install();
aInstall.install();
}, "application/x-xpinstall");
});
});
@ -1166,7 +1166,7 @@ function run_test_17() {
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function() {
do_execute_soon(function() {
do_execute_soon(function test17_install1() {
do_check_false(aInstall.addon.userDisabled);
restartManager();
@ -1175,29 +1175,29 @@ function run_test_17() {
do_check_false(a2.userDisabled);
do_check_true(a2.isActive);
let url_2 = "http://localhost:4444/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url_2, function(aInstall_2) {
aInstall_2.addListener({
let url = "http://localhost:4444/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallStarted: function() {
do_check_false(aInstall_2.addon.userDisabled);
aInstall_2.addon.userDisabled = true;
do_check_false(aInstall.addon.userDisabled);
aInstall.addon.userDisabled = true;
},
onInstallEnded: function() {
do_execute_soon(function() {
do_execute_soon(function test17_install1() {
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2_2) {
do_check_true(a2_2.userDisabled);
do_check_false(a2_2.isActive);
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
a2_2.uninstall();
a2.uninstall();
do_execute_soon(run_test_18);
});
});
}
});
aInstall_2.install();
aInstall.install();
}, "application/x-xpinstall");
});
});
@ -1227,29 +1227,29 @@ function run_test_18() {
do_check_true(a2.userDisabled);
do_check_false(a2.isActive);
let url_2 = "http://localhost:4444/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url_2, function(aInstall_2) {
aInstall_2.addListener({
let url = "http://localhost:4444/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallStarted: function() {
do_check_true(aInstall_2.addon.userDisabled);
aInstall_2.addon.userDisabled = false;
do_check_true(aInstall.addon.userDisabled);
aInstall.addon.userDisabled = false;
},
onInstallEnded: function() {
do_execute_soon(function test18_install2() {
restartManager();
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2_2) {
do_check_false(a2_2.userDisabled);
do_check_true(a2_2.isActive);
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) {
do_check_false(a2.userDisabled);
do_check_true(a2.isActive);
a2_2.uninstall();
a2.uninstall();
do_execute_soon(run_test_18_1);
});
});
}
});
aInstall_2.install();
aInstall.install();
}, "application/x-xpinstall");
});
});
@ -1273,7 +1273,7 @@ function run_test_18_1() {
let url = "http://localhost:4444/addons/test_install2_1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function(unused, aAddon) {
onInstallEnded: function(aInstall, aAddon) {
do_execute_soon(function test18_install() {
do_check_neq(aAddon.fullDescription, "Repository description");
@ -1301,7 +1301,7 @@ function run_test_19() {
let url = "http://localhost:4444/addons/test_install2_1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function(unused, aAddon) {
onInstallEnded: function(aInstall, aAddon) {
do_execute_soon(function test19_install() {
do_check_eq(aAddon.fullDescription, "Repository description");
@ -1327,7 +1327,7 @@ function run_test_20() {
let url = "http://localhost:4444/addons/test_install2_1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function(unused, aAddon) {
onInstallEnded: function(aInstall, aAddon) {
do_execute_soon(function test20_install() {
do_check_eq(aAddon.fullDescription, "Repository description");
@ -1614,8 +1614,8 @@ function run_test_26() {
let url = "http://localhost:4444/redirect?/addons/test_install1.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onDownloadProgress: function(aDownloadProgressInstall) {
aDownloadProgressInstall.cancel();
onDownloadProgress: function(aInstall) {
aInstall.cancel();
}
});

View File

@ -148,11 +148,11 @@ function prepare_profile() {
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org",
"addon6@tests.mozilla.org"],
function([a1_2, a2_2, a3_2, a4_2, a5_2, a6_2]) {
a3_2.userDisabled = true;
a4_2.userDisabled = false;
function([a1, a2, a3, a4, a5, a6]) {
a3.userDisabled = true;
a4.userDisabled = false;
a5_2.findUpdates({
a5.findUpdates({
onUpdateFinished: function() {
do_execute_soon(perform_migration);
}

View File

@ -59,21 +59,21 @@ function run_test() {
"caption TEXT, " +
"PRIMARY KEY (addon_internal_id, num)");
let insertStmt = db.createStatement("INSERT INTO addon (id) VALUES (:id)");
insertStmt.params.id = "test1@tests.mozilla.org";
insertStmt.execute();
insertStmt.finalize();
let stmt = db.createStatement("INSERT INTO addon (id) VALUES (:id)");
stmt.params.id = "test1@tests.mozilla.org";
stmt.execute();
stmt.finalize();
insertStmt = db.createStatement("INSERT INTO screenshot VALUES " +
stmt = db.createStatement("INSERT INTO screenshot VALUES " +
"(:addon_internal_id, :num, :url, :thumbnailURL, :caption)");
insertStmt.params.addon_internal_id = 1;
insertStmt.params.num = 0;
insertStmt.params.url = "http://localhost/full1-1.png";
insertStmt.params.thumbnailURL = "http://localhost/thumbnail1-1.png";
insertStmt.params.caption = "Caption 1 - 1";
insertStmt.execute();
insertStmt.finalize();
stmt.params.addon_internal_id = 1;
stmt.params.num = 0;
stmt.params.url = "http://localhost/full1-1.png";
stmt.params.thumbnailURL = "http://localhost/thumbnail1-1.png";
stmt.params.caption = "Caption 1 - 1";
stmt.execute();
stmt.finalize();
db.schemaVersion = 1;
db.close();
@ -108,15 +108,15 @@ function run_test() {
let internalID = db.lastInsertRowID;
db.executeSimpleSQL("INSERT INTO compatibility_override (addon_internal_id, num, type) VALUES('" + internalID + "', '1', 'incompatible')");
let selectStmt = db.createStatement("SELECT COUNT(*) AS count FROM compatibility_override");
selectStmt.executeStep();
do_check_eq(selectStmt.row.count, 1);
selectStmt.reset();
let stmt = db.createStatement("SELECT COUNT(*) AS count FROM compatibility_override");
stmt.executeStep();
do_check_eq(stmt.row.count, 1);
stmt.reset();
db.executeSimpleSQL("DELETE FROM addon");
selectStmt.executeStep();
do_check_eq(selectStmt.row.count, 0);
selectStmt.finalize();
stmt.executeStep();
do_check_eq(stmt.row.count, 0);
stmt.finalize();
db.close();
do_test_finished();

View File

@ -156,14 +156,14 @@ function run_test_2(p) {
do_check_false(p.appDisabled);
do_check_false(p.isActive);
AddonManager.getAddonByID(gID, function(p2) {
do_check_neq(p2, null);
do_check_true(p2.userDisabled);
do_check_false(p2.appDisabled);
do_check_false(p2.isActive);
do_check_eq(p2.name, "Shockwave Flash");
AddonManager.getAddonByID(gID, function(p) {
do_check_neq(p, null);
do_check_true(p.userDisabled);
do_check_false(p.appDisabled);
do_check_false(p.isActive);
do_check_eq(p.name, "Shockwave Flash");
run_test_3(p2);
run_test_3(p);
});
}
@ -184,12 +184,12 @@ function run_test_3(p) {
do_check_false(p.appDisabled);
do_check_true(p.isActive);
AddonManager.getAddonByID(gID, function(p2) {
do_check_neq(p2, null);
do_check_false(p2.userDisabled);
do_check_false(p2.appDisabled);
do_check_true(p2.isActive);
do_check_eq(p2.name, "Shockwave Flash");
AddonManager.getAddonByID(gID, function(p) {
do_check_neq(p, null);
do_check_false(p.userDisabled);
do_check_false(p.appDisabled);
do_check_true(p.isActive);
do_check_eq(p.name, "Shockwave Flash");
do_execute_soon(run_test_4);
});

View File

@ -55,23 +55,23 @@ add_task(function* test_reloading_a_temp_addon() {
const onReload = new Promise(resolve => {
const listener = {
onUninstalling: (addonObj) => {
if (addonObj.id === sampleAddon.id) {
onUninstalling: (addon) => {
if (addon.id === sampleAddon.id) {
receivedOnUninstalling = true;
}
},
onUninstalled: (addonObj) => {
if (addonObj.id === sampleAddon.id) {
onUninstalled: (addon) => {
if (addon.id === sampleAddon.id) {
receivedOnUninstalled = true;
}
},
onInstalling: (addonObj) => {
onInstalling: (addon) => {
receivedOnInstalling = true;
equal(addonObj.id, sampleAddon.id);
equal(addon.id, sampleAddon.id);
},
onInstalled: (addonObj) => {
onInstalled: (addon) => {
receivedOnInstalled = true;
equal(addonObj.id, sampleAddon.id);
equal(addon.id, sampleAddon.id);
// This should be the last event called.
AddonManager.removeAddonListener(listener);
resolve();

View File

@ -54,10 +54,10 @@ function run_test() {
backgroundUpdate(function() {
restartManager();
AddonManager.getAddonByID("addon@tests.mozilla.org", function(a2) {
do_check_neq(a2, null);
do_check_neq(a2.sourceURI, null);
do_check_eq(a2.sourceURI.spec, "http://www.example.com/testaddon.xpi");
AddonManager.getAddonByID("addon@tests.mozilla.org", function(a) {
do_check_neq(a, null);
do_check_neq(a.sourceURI, null);
do_check_eq(a.sourceURI.spec, "http://www.example.com/testaddon.xpi");
do_test_finished();
});

View File

@ -868,31 +868,31 @@ function run_test_12() {
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org"],
function([a1_2, a2_2, a3_2, a4_2, a5_2]) {
do_check_neq(a1_2, null);
do_check_false(a1_2.userDisabled);
do_check_true(a1_2.seen);
do_check_true(a1_2.isActive);
function([a1, a2, a3, a4, a5]) {
do_check_neq(a1, null);
do_check_false(a1.userDisabled);
do_check_true(a1.seen);
do_check_true(a1.isActive);
do_check_neq(a2_2, null);
do_check_false(a2_2.userDisabled);
do_check_true(a2_2.seen);
do_check_true(a2_2.isActive);
do_check_neq(a2, null);
do_check_false(a2.userDisabled);
do_check_true(a2.seen);
do_check_true(a2.isActive);
do_check_neq(a3_2, null);
do_check_true(a3_2.userDisabled);
do_check_false(a3_2.seen);
do_check_false(a3_2.isActive);
do_check_neq(a3, null);
do_check_true(a3.userDisabled);
do_check_false(a3.seen);
do_check_false(a3.isActive);
var dest2 = profileDir.clone();
dest2.append(do_get_expected_addon_name("addon1@tests.mozilla.org"));
dest2.remove(true);
dest2 = userDir.clone();
dest2.append(do_get_expected_addon_name("addon2@tests.mozilla.org"));
dest2.remove(true);
dest2 = globalDir.clone();
dest2.append(do_get_expected_addon_name("addon3@tests.mozilla.org"));
dest2.remove(true);
var dest = profileDir.clone();
dest.append(do_get_expected_addon_name("addon1@tests.mozilla.org"));
dest.remove(true);
dest = userDir.clone();
dest.append(do_get_expected_addon_name("addon2@tests.mozilla.org"));
dest.remove(true);
dest = globalDir.clone();
dest.append(do_get_expected_addon_name("addon3@tests.mozilla.org"));
dest.remove(true);
restartManager();
@ -909,21 +909,21 @@ function run_test_12() {
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org"],
function([a1_3, a2_3, a3_3, a4_3, a5_3]) {
do_check_neq(a1_3, null);
do_check_false(a1_3.userDisabled);
do_check_true(a1_3.seen);
do_check_true(a1_3.isActive);
function([a1, a2, a3, a4, a5]) {
do_check_neq(a1, null);
do_check_false(a1.userDisabled);
do_check_true(a1.seen);
do_check_true(a1.isActive);
do_check_neq(a2_3, null);
do_check_true(a2_3.userDisabled);
do_check_false(a2_3.seen);
do_check_false(a2_3.isActive);
do_check_neq(a2, null);
do_check_true(a2.userDisabled);
do_check_false(a2.seen);
do_check_false(a2.isActive);
do_check_neq(a3_3, null);
do_check_true(a3_3.userDisabled);
do_check_false(a3_3.seen);
do_check_false(a3_3.isActive);
do_check_neq(a3, null);
do_check_true(a3.userDisabled);
do_check_false(a3.seen);
do_check_false(a3.isActive);
do_execute_soon(end_test);
});

View File

@ -32,10 +32,10 @@ add_task(function*() {
let jData = loadJSON(gExtensionsJSON);
for (let addonInstance of jData.addons) {
if (addonInstance.id == ID) {
for (let addon of jData.addons) {
if (addon.id == ID) {
// Set to something that would be an invalid descriptor for this platform
addonInstance.descriptor = AppConstants.platform == "win" ? "/foo/bar" : "C:\\foo\\bar";
addon.descriptor = AppConstants.platform == "win" ? "/foo/bar" : "C:\\foo\\bar";
}
}

View File

@ -857,27 +857,27 @@ function run_test_15() {
do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "theme1/1.0");
AddonManager.getAddonsByIDs(["default@tests.mozilla.org",
"theme1@tests.mozilla.org"],
callback_soon(function([d_2, t1_2]) {
do_check_true(d_2.userDisabled);
do_check_false(d_2.appDisabled);
do_check_false(d_2.isActive);
callback_soon(function([d, t1]) {
do_check_true(d.userDisabled);
do_check_false(d.appDisabled);
do_check_false(d.isActive);
do_check_false(t1_2.userDisabled);
do_check_false(t1_2.appDisabled);
do_check_true(t1_2.isActive);
do_check_false(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_true(t1.isActive);
restartManager("2");
do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "theme1/1.0");
AddonManager.getAddonsByIDs(["default@tests.mozilla.org",
"theme1@tests.mozilla.org"], function([d_3, t1_3]) {
do_check_true(d_3.userDisabled);
do_check_false(d_3.appDisabled);
do_check_false(d_3.isActive);
"theme1@tests.mozilla.org"], function([d, t1]) {
do_check_true(d.userDisabled);
do_check_false(d.appDisabled);
do_check_false(d.isActive);
do_check_false(t1_3.userDisabled);
do_check_false(t1_3.appDisabled);
do_check_true(t1_3.isActive);
do_check_false(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_true(t1.isActive);
do_execute_soon(run_test_16);
});
@ -943,14 +943,14 @@ function run_test_18() {
AddonManager.getAddonsByIDs(["default@tests.mozilla.org",
"theme1@tests.mozilla.org"],
callback_soon(function([d_2, t1_2]) {
do_check_true(d_2.userDisabled);
do_check_false(d_2.appDisabled);
do_check_false(d_2.isActive);
callback_soon(function([d, t1]) {
do_check_true(d.userDisabled);
do_check_false(d.appDisabled);
do_check_false(d.isActive);
do_check_false(t1_2.userDisabled);
do_check_false(t1_2.appDisabled);
do_check_true(t1_2.isActive);
do_check_false(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_true(t1.isActive);
prepare_test({
"theme1@tests.mozilla.org": [
@ -960,28 +960,28 @@ function run_test_18() {
"onEnabling",
]
});
t1_2.userDisabled = true;
t1.userDisabled = true;
ensure_test_completed();
do_check_false(d_2.userDisabled);
do_check_false(d_2.appDisabled);
do_check_false(d_2.isActive);
do_check_false(d.userDisabled);
do_check_false(d.appDisabled);
do_check_false(d.isActive);
do_check_true(t1_2.userDisabled);
do_check_false(t1_2.appDisabled);
do_check_true(t1_2.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_true(t1.isActive);
restartManager();
AddonManager.getAddonsByIDs(["default@tests.mozilla.org",
"theme1@tests.mozilla.org"], function([d_3, t1_3]) {
do_check_false(d_3.userDisabled);
do_check_false(d_3.appDisabled);
do_check_true(d_3.isActive);
"theme1@tests.mozilla.org"], function([d, t1]) {
do_check_false(d.userDisabled);
do_check_false(d.appDisabled);
do_check_true(d.isActive);
do_check_true(t1_3.userDisabled);
do_check_false(t1_3.appDisabled);
do_check_false(t1_3.isActive);
do_check_true(t1.userDisabled);
do_check_false(t1.appDisabled);
do_check_false(t1.isActive);
do_execute_soon(run_test_19);
});
@ -1124,14 +1124,14 @@ function run_test_22() {
restartManager();
AddonManager.getAddonsByIDs(["default@tests.mozilla.org",
"1@personas.mozilla.org"], function([d_2, p1_2]) {
do_check_true(d_2.userDisabled);
do_check_false(d_2.appDisabled);
do_check_false(d_2.isActive);
"1@personas.mozilla.org"], function([d, p1]) {
do_check_true(d.userDisabled);
do_check_false(d.appDisabled);
do_check_false(d.isActive);
do_check_false(p1_2.userDisabled);
do_check_false(p1_2.appDisabled);
do_check_true(p1_2.isActive);
do_check_false(p1.userDisabled);
do_check_false(p1.appDisabled);
do_check_true(p1.isActive);
end_test();
});

View File

@ -54,7 +54,7 @@ let testParams = [
for (let test of testParams) {
let { updateFile, appId } = test;
add_test(function() {
add_test(function run_test() {
writeInstallRDFForExtension({
id: "addon1@tests.mozilla.org",
version: "1.0",
@ -145,14 +145,14 @@ for (let test of testParams) {
// Verify that another update check returns the same AddonInstall
a1.findUpdates({
onNoCompatibilityUpdateAvailable: function() {
onNoCompatibilityUpdateAvailable: function(addon) {
ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
},
onUpdateAvailable: function(newAddon, newInstall) {
AddonManager.getAllInstalls(function(aInstalls2) {
do_check_eq(aInstalls2.length, 1);
do_check_eq(aInstalls2[0], install);
AddonManager.getAllInstalls(function(aInstalls) {
do_check_eq(aInstalls.length, 1);
do_check_eq(aInstalls[0], install);
do_check_eq(newAddon, addon);
do_check_eq(newInstall, install);
@ -164,7 +164,7 @@ for (let test of testParams) {
});
},
onNoUpdateAvailable: function() {
onNoUpdateAvailable: function(addon) {
ok(false, "Should not have seen onNoUpdateAvailable notification");
}
}, AddonManager.UPDATE_WHEN_USER_REQUESTED);
@ -195,7 +195,7 @@ for (let test of testParams) {
ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
},
onUpdateAvailable: function() {
onUpdateAvailable: function(addon, install) {
ok(false, "Should find no available update when one is already downloading");
},
@ -593,16 +593,16 @@ for (let test of testParams) {
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org",
"addon6@tests.mozilla.org"],
function([a1_2, a2_2, a3_2, a4_2, a5_2, a6_2]) {
function([a1, a2, a3, a4, a5, a6]) {
let count = 6;
function next_test() {
a1_2.uninstall();
a2_2.uninstall();
a3_2.uninstall();
a4_2.uninstall();
a5_2.uninstall();
a6_2.uninstall();
a1.uninstall();
a2.uninstall();
a3.uninstall();
a4.uninstall();
a5.uninstall();
a6.uninstall();
restartManager();
run_next_test();
@ -626,12 +626,12 @@ for (let test of testParams) {
}
};
a1_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
a2_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_ADDON_INSTALLED);
a3_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
a4_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "2");
a5_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
a6_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
a1.findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
a2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_ADDON_INSTALLED);
a3.findUpdates(updateListener, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
a4.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "2");
a5.findUpdates(compatListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
a6.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
});
}));
});
@ -975,9 +975,9 @@ for (let test of testParams) {
do_check_neq(a1.syncGUID, null);
let oldGUID = a1.syncGUID;
let url_2 = "http://localhost:" + gPort + "/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url_2, function(aInstall_2) {
aInstall_2.addListener({
let url = "http://localhost:" + gPort + "/addons/test_install2_2.xpi";
AddonManager.getInstallForURL(url, function(aInstall) {
aInstall.addListener({
onInstallEnded: function() {
do_execute_soon(function install_2_2_ended() {
restartManager();
@ -992,7 +992,7 @@ for (let test of testParams) {
});
}
});
aInstall_2.install();
aInstall.install();
}, "application/x-xpinstall");
});
});

View File

@ -98,7 +98,7 @@ function run_test_1() {
do_throw("Should have seen an available update");
},
onUpdateAvailable: function(unused, install) {
onUpdateAvailable: function(addon, install) {
do_check_eq(install.version, "2.0")
},
@ -124,7 +124,7 @@ function run_test_2() {
do_throw("Should have seen an available update");
},
onUpdateAvailable: function(unused, install) {
onUpdateAvailable: function(addon, install) {
do_check_eq(install.version, "2.0")
},
@ -146,7 +146,7 @@ function run_test_3() {
do_throw("Should have not have seen compatibility information");
},
onUpdateAvailable: function() {
onUpdateAvailable: function(addon, install) {
do_throw("Should not have seen an available update");
},
@ -172,7 +172,7 @@ function run_test_4() {
do_throw("Should have seen an available update");
},
onUpdateAvailable: function(unused, install) {
onUpdateAvailable: function(addon, install) {
do_check_eq(install.version, "2.0")
},

View File

@ -52,7 +52,7 @@ let testParams = [
for (let test of testParams) {
let { updateFile, appId } = test;
add_test(function() {
add_test(function run_test() {
writeInstallRDFForExtension({
id: "addon1@tests.mozilla.org",
version: "1.0",
@ -140,14 +140,14 @@ for (let test of testParams) {
// Verify that another update check returns the same AddonInstall
a1.findUpdates({
onNoCompatibilityUpdateAvailable: function() {
onNoCompatibilityUpdateAvailable: function(addon) {
ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
},
onUpdateAvailable: function(newAddon, newInstall) {
AddonManager.getAllInstalls(function(aInstalls2) {
do_check_eq(aInstalls2.length, 1);
do_check_eq(aInstalls2[0], install);
AddonManager.getAllInstalls(function(aInstalls) {
do_check_eq(aInstalls.length, 1);
do_check_eq(aInstalls[0], install);
do_check_eq(newAddon, addon);
do_check_eq(newInstall, install);
@ -159,7 +159,7 @@ for (let test of testParams) {
});
},
onNoUpdateAvailable: function() {
onNoUpdateAvailable: function(addon) {
ok(false, "Should not have seen onNoUpdateAvailable notification");
}
}, AddonManager.UPDATE_WHEN_USER_REQUESTED);
@ -190,7 +190,7 @@ for (let test of testParams) {
ok(false, "Should not have seen onNoCompatibilityUpdateAvailable notification");
},
onUpdateAvailable: function() {
onUpdateAvailable: function(addon, install) {
ok(false, "Should find no available update when one is already downloading");
},
@ -580,16 +580,16 @@ for (let test of testParams) {
"addon4@tests.mozilla.org",
"addon5@tests.mozilla.org",
"addon6@tests.mozilla.org"],
function([a1_2, a2_2, a3_2, a4_2, a5_2, a6_2]) {
function([a1, a2, a3, a4, a5, a6]) {
let count = 6;
function next_test() {
a1_2.uninstall();
a2_2.uninstall();
a3_2.uninstall();
a4_2.uninstall();
a5_2.uninstall();
a6_2.uninstall();
a1.uninstall();
a2.uninstall();
a3.uninstall();
a4.uninstall();
a5.uninstall();
a6.uninstall();
restartManager();
run_next_test();
@ -613,12 +613,12 @@ for (let test of testParams) {
}
};
a1_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
a2_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_ADDON_INSTALLED);
a3_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
a4_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "2");
a5_2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
a6_2.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
a1.findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
a2.findUpdates(compatListener, AddonManager.UPDATE_WHEN_ADDON_INSTALLED);
a3.findUpdates(updateListener, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
a4.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_DETECTED, "2");
a5.findUpdates(compatListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
a6.findUpdates(updateListener, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
});
}));
});

View File

@ -158,12 +158,12 @@ add_task(function*() {
});
add_task(function* test_manifest_localization() {
const extensionId = "webextension3@tests.mozilla.org";
const ID = "webextension3@tests.mozilla.org";
yield promiseInstallAllFiles([do_get_addon("webextension_3")], true);
yield promiseAddonStartup();
let addon = yield promiseAddonByID(extensionId);
let addon = yield promiseAddonByID(ID);
addon.userDisabled = true;
equal(addon.name, "Web Extensiøn foo ☹");
@ -172,7 +172,7 @@ add_task(function* test_manifest_localization() {
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
yield promiseRestartManager();
addon = yield promiseAddonByID(extensionId);
addon = yield promiseAddonByID(ID);
equal(addon.name, "Web Extensiøn le foo ☺");
equal(addon.description, "Descriptïon le bar ☺ of add-on");
@ -180,7 +180,7 @@ add_task(function* test_manifest_localization() {
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "de");
yield promiseRestartManager();
addon = yield promiseAddonByID(extensionId);
addon = yield promiseAddonByID(ID);
equal(addon.name, "Web Extensiøn foo ☹");
equal(addon.description, "Descriptïon bar ☹ of add-on");
@ -262,17 +262,17 @@ add_task(function*() {
add_task(function* test_options_ui() {
let OPTIONS_RE = /^moz-extension:\/\/[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}\/options\.html$/;
const extensionId = "webextension@tests.mozilla.org";
const ID = "webextension@tests.mozilla.org";
yield promiseInstallWebExtension({
manifest: {
applications: {gecko: {id: extensionId}},
applications: {gecko: {id: ID}},
"options_ui": {
"page": "options.html",
},
},
});
let addon = yield promiseAddonByID(extensionId);
let addon = yield promiseAddonByID(ID);
equal(addon.optionsType, AddonManager.OPTIONS_TYPE_INLINE_BROWSER,
"Addon should have an INLINE_BROWSER options type");
@ -333,10 +333,10 @@ add_task(function* test_experiments_api() {
// Experiments are not enabled on release builds.
return;
const extensionId = "meh@experiments.addons.mozilla.org";
const ID = "meh@experiments.addons.mozilla.org";
let addonFile = createTempXPIFile({
id: extensionId,
id: ID,
type: 256,
version: "0.1",
name: "Meh API",
@ -346,10 +346,10 @@ add_task(function* test_experiments_api() {
let addons = yield new Promise(resolve => AddonManager.getAddonsByTypes(["apiextension"], resolve));
let addon = addons.pop();
equal(addon.id, extensionId, "Add-on should be installed as an API extension");
equal(addon.id, ID, "Add-on should be installed as an API extension");
addons = yield new Promise(resolve => AddonManager.getAddonsByTypes(["extension"], resolve));
equal(addons.pop().id, extensionId, "Add-on type should be aliased to extension");
equal(addons.pop().id, ID, "Add-on type should be aliased to extension");
addon.uninstall();
});

View File

@ -51,8 +51,8 @@ add_task(function*() {
let addon = yield promiseAddonByID(ID);
do_check_neq(addon, null);
function check_icons(addon_copy) {
deepEqual(addon_copy.icons, {
function check_icons(addon) {
deepEqual(addon.icons, {
16: uri + "icon16.png",
32: uri + "icon32.png",
48: uri + "icon48.png",

View File

@ -423,7 +423,7 @@ add_task(function* test_strict_min_max() {
// * in min will throw an error
for (let version of ["0.*", "0.*.0"]) {
newId = "strict_min_star@tests.mozilla.org";
let minStarApps = {
let apps = {
applications: {
gecko: {
id: newId,
@ -432,20 +432,20 @@ add_task(function* test_strict_min_max() {
},
}
let minStarTestManifest = Object.assign(minStarApps, MANIFEST);
let testManifest = Object.assign(apps, MANIFEST);
let minStarExtension = ExtensionTestUtils.loadExtension({
manifest: minStarTestManifest,
let extension = ExtensionTestUtils.loadExtension({
manifest: testManifest,
useAddonManager: "temporary",
});
yield Assert.rejects(
minStarExtension.startup(),
extension.startup(),
/The use of '\*' in strict_min_version is invalid/,
"loading an extension with a * in strict_min_version throws an exception");
let minStarAddon = yield promiseAddonByID(newId);
equal(minStarAddon, null, "Add-on is not installed");
let addon = yield promiseAddonByID(newId);
equal(addon, null, "Add-on is not installed");
}
// incompatible extension but with compatibility checking off