зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1421992 - script-generated patch to replace do_check_* functions with their Assert.* equivalents, rs=Gijs.
This commit is contained in:
Родитель
12c47a01be
Коммит
032c961e0a
|
@ -26,14 +26,14 @@ function run_test() {
|
|||
});
|
||||
|
||||
// not setting .originalURI to the original URI is naughty
|
||||
do_check_true(feedFeedURI.equals(feedChannel.originalURI));
|
||||
do_check_true(httpFeedURI.equals(httpChannel.originalURI));
|
||||
do_check_true(httpsFeedURI.equals(httpsChannel.originalURI));
|
||||
Assert.ok(feedFeedURI.equals(feedChannel.originalURI));
|
||||
Assert.ok(httpFeedURI.equals(httpChannel.originalURI));
|
||||
Assert.ok(httpsFeedURI.equals(httpsChannel.originalURI));
|
||||
|
||||
// actually using the horrible mess that's a feed: URI is suicidal
|
||||
do_check_true(httpURI.equals(feedChannel.URI));
|
||||
do_check_true(httpURI.equals(httpChannel.URI));
|
||||
do_check_true(httpsURI.equals(httpsChannel.URI));
|
||||
Assert.ok(httpURI.equals(feedChannel.URI));
|
||||
Assert.ok(httpURI.equals(httpChannel.URI));
|
||||
Assert.ok(httpsURI.equals(httpsChannel.URI));
|
||||
|
||||
// check that we throw creating feed: URIs from file and ftp
|
||||
Assert.throws(function() { Services.io.newURI("feed:ftp://example.com/feed.xml"); },
|
||||
|
|
|
@ -30,7 +30,7 @@ add_task(async function test_search() {
|
|||
});
|
||||
Services.search.init();
|
||||
await observerPromise;
|
||||
do_check_true(Services.search.isInitialized);
|
||||
Assert.ok(Services.search.isInitialized);
|
||||
|
||||
// get initial state of search and check it has correct properties
|
||||
let state = await NewTabSearchProvider.search.asyncGetState();
|
||||
|
|
|
@ -89,10 +89,10 @@ add_test(function test_text_paste() {
|
|||
const TEST_TITLE = "Places bookmark";
|
||||
|
||||
waitForBookmarkNotification("onItemAdded", function(aData) {
|
||||
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, 0);
|
||||
Assert.equal(aData.title, TEST_TITLE);
|
||||
Assert.equal(aData.url, TEST_URL);
|
||||
Assert.equal(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
|
||||
Assert.equal(aData.index, 0);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
|
@ -110,20 +110,20 @@ add_test(function test_container() {
|
|||
const TEST_TITLE = "Places folder";
|
||||
|
||||
waitForBookmarkNotification("onItemChanged", function(aChangedData) {
|
||||
do_check_eq(aChangedData.title, TEST_TITLE);
|
||||
do_check_eq(aChangedData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
|
||||
do_check_eq(aChangedData.index, 1);
|
||||
Assert.equal(aChangedData.title, TEST_TITLE);
|
||||
Assert.equal(aChangedData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
|
||||
Assert.equal(aChangedData.index, 1);
|
||||
|
||||
waitForBookmarkNotification("onItemAdded", function(aAddedData) {
|
||||
do_check_eq(aAddedData.title, TEST_TITLE);
|
||||
do_check_eq(aAddedData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
|
||||
do_check_eq(aAddedData.index, 2);
|
||||
Assert.equal(aAddedData.title, TEST_TITLE);
|
||||
Assert.equal(aAddedData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
|
||||
Assert.equal(aAddedData.index, 2);
|
||||
let id = aAddedData.id;
|
||||
|
||||
waitForBookmarkNotification("onItemMoved", function(aMovedData) {
|
||||
do_check_eq(aMovedData.id, id);
|
||||
do_check_eq(aMovedData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
|
||||
do_check_eq(aMovedData.index, 1);
|
||||
Assert.equal(aMovedData.id, id);
|
||||
Assert.equal(aMovedData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
|
||||
Assert.equal(aMovedData.index, 1);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -166,18 +166,18 @@ add_test(function test_container() {
|
|||
|
||||
add_test(function test_separator() {
|
||||
waitForBookmarkNotification("onItemChanged", function(aChangedData) {
|
||||
do_check_eq(aChangedData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
|
||||
do_check_eq(aChangedData.index, 3);
|
||||
Assert.equal(aChangedData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
|
||||
Assert.equal(aChangedData.index, 3);
|
||||
|
||||
waitForBookmarkNotification("onItemAdded", function(aAddedData) {
|
||||
do_check_eq(aAddedData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
|
||||
do_check_eq(aAddedData.index, 4);
|
||||
Assert.equal(aAddedData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
|
||||
Assert.equal(aAddedData.index, 4);
|
||||
let id = aAddedData.id;
|
||||
|
||||
waitForBookmarkNotification("onItemMoved", function(aMovedData) {
|
||||
do_check_eq(aMovedData.id, id);
|
||||
do_check_eq(aMovedData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
|
||||
do_check_eq(aMovedData.index, 1);
|
||||
Assert.equal(aMovedData.id, id);
|
||||
Assert.equal(aMovedData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
|
||||
Assert.equal(aMovedData.index, 1);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -218,22 +218,22 @@ add_test(function test_bookmark() {
|
|||
const TEST_TITLE = "Places bookmark";
|
||||
|
||||
waitForBookmarkNotification("onItemChanged", function(aChangedData) {
|
||||
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);
|
||||
Assert.equal(aChangedData.title, TEST_TITLE);
|
||||
Assert.equal(aChangedData.url, TEST_URL);
|
||||
Assert.equal(aChangedData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
|
||||
Assert.equal(aChangedData.index, 5);
|
||||
|
||||
waitForBookmarkNotification("onItemAdded", function(aAddedData) {
|
||||
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);
|
||||
Assert.equal(aAddedData.title, TEST_TITLE);
|
||||
Assert.equal(aAddedData.url, TEST_URL);
|
||||
Assert.equal(aAddedData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
|
||||
Assert.equal(aAddedData.index, 6);
|
||||
let id = aAddedData.id;
|
||||
|
||||
waitForBookmarkNotification("onItemMoved", function(aMovedData) {
|
||||
do_check_eq(aMovedData.id, id);
|
||||
do_check_eq(aMovedData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
|
||||
do_check_eq(aMovedData.index, 1);
|
||||
Assert.equal(aMovedData.id, id);
|
||||
Assert.equal(aMovedData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
|
||||
Assert.equal(aMovedData.index, 1);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -279,16 +279,16 @@ add_test(function test_visit() {
|
|||
const TEST_TITLE = "Places bookmark";
|
||||
|
||||
waitForBookmarkNotification("onItemAdded", function(aAddedData) {
|
||||
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);
|
||||
Assert.equal(aAddedData.title, TEST_TITLE);
|
||||
Assert.equal(aAddedData.url, TEST_URL);
|
||||
Assert.equal(aAddedData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
|
||||
Assert.equal(aAddedData.index, 7);
|
||||
|
||||
waitForBookmarkNotification("onItemAdded", function(aAddedData2) {
|
||||
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);
|
||||
Assert.equal(aAddedData2.title, TEST_TITLE);
|
||||
Assert.equal(aAddedData2.url, TEST_URL);
|
||||
Assert.equal(aAddedData2.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
|
||||
Assert.equal(aAddedData2.index, 8);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
|
@ -321,10 +321,10 @@ add_test(function check_annotations() {
|
|||
// Copies should retain the description annotation.
|
||||
let descriptions =
|
||||
PlacesUtils.annotations.getItemsWithAnnotation(PlacesUIUtils.DESCRIPTION_ANNO, {});
|
||||
do_check_eq(descriptions.length, 4);
|
||||
Assert.equal(descriptions.length, 4);
|
||||
|
||||
// Only the original bookmarks should have this annotation.
|
||||
let others = PlacesUtils.annotations.getItemsWithAnnotation("random-anno", {});
|
||||
do_check_eq(others.length, 3);
|
||||
Assert.equal(others.length, 3);
|
||||
run_next_test();
|
||||
});
|
||||
|
|
|
@ -51,5 +51,5 @@ add_task(async function() {
|
|||
|
||||
// Bug 1283076: Nightly bookmark points to Get Involved page, not Getting Started one
|
||||
let chanTitle = AppConstants.NIGHTLY_BUILD ? "Get Involved" : "Getting Started";
|
||||
do_check_eq(bm.title, chanTitle);
|
||||
Assert.equal(bm.title, chanTitle);
|
||||
});
|
||||
|
|
|
@ -86,7 +86,7 @@ add_task(async function test_execute() {
|
|||
try {
|
||||
URIS.forEach(function(aUrl) {
|
||||
stmt.params.page_url = aUrl;
|
||||
do_check_false(stmt.executeStep());
|
||||
Assert.ok(!stmt.executeStep());
|
||||
stmt.reset();
|
||||
});
|
||||
} finally {
|
||||
|
@ -133,7 +133,7 @@ function storeCache(aURL, aContent) {
|
|||
},
|
||||
|
||||
onCacheEntryAvailable(entry, isnew, appcache, status) {
|
||||
do_check_eq(status, Cr.NS_OK);
|
||||
Assert.equal(status, Cr.NS_OK);
|
||||
|
||||
entry.setMetaDataElement("servertype", "0");
|
||||
var os = entry.openOutputStream(0);
|
||||
|
@ -164,7 +164,7 @@ function checkCache(aURL) {
|
|||
return new Promise(resolve => {
|
||||
let checkCacheListener = {
|
||||
onCacheEntryAvailable(entry, isnew, appcache, status) {
|
||||
do_check_eq(status, Cr.NS_ERROR_CACHE_KEY_NOT_FOUND);
|
||||
Assert.equal(status, Cr.NS_ERROR_CACHE_KEY_NOT_FOUND);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -118,7 +118,7 @@ add_task(async function test_shutdown() {
|
|||
|
||||
await SessionWorker.post("write", [output, { isFinalWrite: true, performShutdownCleanup: true}]);
|
||||
|
||||
do_check_false((await File.exists(Paths.recovery)));
|
||||
do_check_false((await File.exists(Paths.recoveryBackup)));
|
||||
Assert.equal(false, (await File.exists(Paths.recovery)));
|
||||
Assert.equal(false, (await File.exists(Paths.recoveryBackup)));
|
||||
await promise_check_contents(Paths.clean, output);
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@ function run_test() {
|
|||
getService(Ci.nsISessionStartup);
|
||||
|
||||
afterSessionStartupInitialization(function cb() {
|
||||
do_check_eq(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
|
||||
Assert.equal(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
|
||||
do_test_finished();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ function run_test() {
|
|||
getService(Ci.nsISessionStartup);
|
||||
|
||||
afterSessionStartupInitialization(function cb() {
|
||||
do_check_eq(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
|
||||
Assert.equal(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ function run_test() {
|
|||
getService(Ci.nsISessionStartup);
|
||||
|
||||
afterSessionStartupInitialization(function cb() {
|
||||
do_check_eq(startup.sessionType, Ci.nsISessionStartup.DEFER_SESSION);
|
||||
Assert.equal(startup.sessionType, Ci.nsISessionStartup.DEFER_SESSION);
|
||||
do_test_finished();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -45,7 +45,7 @@ function checkGConfToShellColor(aGConfColor, aExpectedShellColor) {
|
|||
gGConf.setString(GCONF_BG_COLOR_KEY, aGConfColor);
|
||||
var shellColor = colorToHex(gShell.desktopBackgroundColor);
|
||||
|
||||
do_check_eq(shellColor, aExpectedShellColor);
|
||||
Assert.equal(shellColor, aExpectedShellColor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ function checkShellToGConfColor(aShellColor, aExpectedGConfColor) {
|
|||
gShell.desktopBackgroundColor = hexToColor(aShellColor);
|
||||
var gconfColor = gGConf.getString(GCONF_BG_COLOR_KEY);
|
||||
|
||||
do_check_eq(gconfColor, aExpectedGConfColor);
|
||||
Assert.equal(gconfColor, aExpectedGConfColor);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -71,7 +71,7 @@ async function initProfileStorage(fileName, records, collectionName = "addresses
|
|||
let onChanged = TestUtils.topicObserved("formautofill-storage-changed",
|
||||
(subject, data) => data == "add");
|
||||
for (let record of records) {
|
||||
do_check_true(profileStorage[collectionName].add(record));
|
||||
Assert.ok(profileStorage[collectionName].add(record));
|
||||
await onChanged;
|
||||
}
|
||||
await profileStorage._saveImmediately();
|
||||
|
|
|
@ -12,20 +12,20 @@ add_task(async function test_activeStatus_init() {
|
|||
sinon.spy(formAutofillParent, "_updateStatus");
|
||||
|
||||
// Default status is null before initialization
|
||||
do_check_eq(formAutofillParent._active, null);
|
||||
do_check_eq(Services.ppmm.initialProcessData.autofillEnabled, undefined);
|
||||
Assert.equal(formAutofillParent._active, null);
|
||||
Assert.equal(Services.ppmm.initialProcessData.autofillEnabled, undefined);
|
||||
|
||||
await formAutofillParent.init();
|
||||
// init shouldn't call updateStatus since that requires storage which will
|
||||
// lead to startup time regressions.
|
||||
do_check_eq(formAutofillParent._updateStatus.called, false);
|
||||
do_check_eq(Services.ppmm.initialProcessData.autofillEnabled, undefined);
|
||||
Assert.equal(formAutofillParent._updateStatus.called, false);
|
||||
Assert.equal(Services.ppmm.initialProcessData.autofillEnabled, undefined);
|
||||
|
||||
// Initialize profile storage
|
||||
await formAutofillParent.profileStorage.initialize();
|
||||
// Upon first initializing profile storage, status should be computed.
|
||||
do_check_eq(formAutofillParent._updateStatus.called, true);
|
||||
do_check_eq(Services.ppmm.initialProcessData.autofillEnabled, false);
|
||||
Assert.equal(formAutofillParent._updateStatus.called, true);
|
||||
Assert.equal(Services.ppmm.initialProcessData.autofillEnabled, false);
|
||||
|
||||
formAutofillParent._uninit();
|
||||
});
|
||||
|
@ -40,28 +40,28 @@ add_task(async function test_activeStatus_observe() {
|
|||
formAutofillParent._computeStatus.returns(true);
|
||||
formAutofillParent.observe(null, "nsPref:changed", "extensions.formautofill.addresses.enabled");
|
||||
formAutofillParent.observe(null, "nsPref:changed", "extensions.formautofill.creditCards.enabled");
|
||||
do_check_eq(formAutofillParent._onStatusChanged.called, false);
|
||||
Assert.equal(formAutofillParent._onStatusChanged.called, false);
|
||||
|
||||
// _active != _computeStatus() => Need to trigger _onStatusChanged
|
||||
formAutofillParent._computeStatus.returns(false);
|
||||
formAutofillParent._onStatusChanged.reset();
|
||||
formAutofillParent.observe(null, "nsPref:changed", "extensions.formautofill.addresses.enabled");
|
||||
formAutofillParent.observe(null, "nsPref:changed", "extensions.formautofill.creditCards.enabled");
|
||||
do_check_eq(formAutofillParent._onStatusChanged.called, true);
|
||||
Assert.equal(formAutofillParent._onStatusChanged.called, true);
|
||||
|
||||
// profile changed => Need to trigger _onStatusChanged
|
||||
["add", "update", "remove", "reconcile"].forEach(event => {
|
||||
formAutofillParent._computeStatus.returns(!formAutofillParent._active);
|
||||
formAutofillParent._onStatusChanged.reset();
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", event);
|
||||
do_check_eq(formAutofillParent._onStatusChanged.called, true);
|
||||
Assert.equal(formAutofillParent._onStatusChanged.called, true);
|
||||
});
|
||||
|
||||
// profile metadata updated => No need to trigger _onStatusChanged
|
||||
formAutofillParent._computeStatus.returns(!formAutofillParent._active);
|
||||
formAutofillParent._onStatusChanged.reset();
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "notifyUsed");
|
||||
do_check_eq(formAutofillParent._onStatusChanged.called, false);
|
||||
Assert.equal(formAutofillParent._onStatusChanged.called, false);
|
||||
});
|
||||
|
||||
add_task(async function test_activeStatus_computeStatus() {
|
||||
|
@ -77,31 +77,31 @@ add_task(async function test_activeStatus_computeStatus() {
|
|||
// pref is enabled and profile is empty.
|
||||
Services.prefs.setBoolPref("extensions.formautofill.addresses.enabled", true);
|
||||
Services.prefs.setBoolPref("extensions.formautofill.creditCards.enabled", true);
|
||||
do_check_eq(formAutofillParent._computeStatus(), false);
|
||||
Assert.equal(formAutofillParent._computeStatus(), false);
|
||||
|
||||
// pref is disabled and profile is empty.
|
||||
Services.prefs.setBoolPref("extensions.formautofill.addresses.enabled", false);
|
||||
Services.prefs.setBoolPref("extensions.formautofill.creditCards.enabled", false);
|
||||
do_check_eq(formAutofillParent._computeStatus(), false);
|
||||
Assert.equal(formAutofillParent._computeStatus(), false);
|
||||
|
||||
profileStorage.addresses.getAll.returns([{"given-name": "John"}]);
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "add");
|
||||
// pref is enabled and profile is not empty.
|
||||
Services.prefs.setBoolPref("extensions.formautofill.addresses.enabled", true);
|
||||
Services.prefs.setBoolPref("extensions.formautofill.addresses.enabled", true);
|
||||
do_check_eq(formAutofillParent._computeStatus(), true);
|
||||
Assert.equal(formAutofillParent._computeStatus(), true);
|
||||
|
||||
// pref is partial enabled and profile is not empty.
|
||||
Services.prefs.setBoolPref("extensions.formautofill.addresses.enabled", true);
|
||||
Services.prefs.setBoolPref("extensions.formautofill.creditCards.enabled", false);
|
||||
do_check_eq(formAutofillParent._computeStatus(), true);
|
||||
Assert.equal(formAutofillParent._computeStatus(), true);
|
||||
Services.prefs.setBoolPref("extensions.formautofill.addresses.enabled", false);
|
||||
Services.prefs.setBoolPref("extensions.formautofill.creditCards.enabled", true);
|
||||
do_check_eq(formAutofillParent._computeStatus(), true);
|
||||
Assert.equal(formAutofillParent._computeStatus(), true);
|
||||
|
||||
|
||||
// pref is disabled and profile is not empty.
|
||||
Services.prefs.setBoolPref("extensions.formautofill.addresses.enabled", false);
|
||||
Services.prefs.setBoolPref("extensions.formautofill.creditCards.enabled", false);
|
||||
do_check_eq(formAutofillParent._computeStatus(), false);
|
||||
Assert.equal(formAutofillParent._computeStatus(), false);
|
||||
});
|
||||
|
|
|
@ -255,15 +255,15 @@ const MERGE_TESTCASES = [
|
|||
|
||||
let do_check_record_matches = (recordWithMeta, record) => {
|
||||
for (let key in record) {
|
||||
do_check_eq(recordWithMeta[key], record[key]);
|
||||
Assert.equal(recordWithMeta[key], record[key]);
|
||||
}
|
||||
};
|
||||
|
||||
add_task(async function test_initialize() {
|
||||
let profileStorage = await initProfileStorage(TEST_STORE_FILE_NAME);
|
||||
|
||||
do_check_eq(profileStorage._store.data.version, 1);
|
||||
do_check_eq(profileStorage._store.data.addresses.length, 0);
|
||||
Assert.equal(profileStorage._store.data.version, 1);
|
||||
Assert.equal(profileStorage._store.data.addresses.length, 0);
|
||||
|
||||
let data = profileStorage._store.data;
|
||||
Assert.deepEqual(data.addresses, []);
|
||||
|
@ -285,20 +285,20 @@ add_task(async function test_getAll() {
|
|||
|
||||
let addresses = profileStorage.addresses.getAll();
|
||||
|
||||
do_check_eq(addresses.length, 2);
|
||||
Assert.equal(addresses.length, 2);
|
||||
do_check_record_matches(addresses[0], TEST_ADDRESS_1);
|
||||
do_check_record_matches(addresses[1], TEST_ADDRESS_2);
|
||||
|
||||
// Check computed fields.
|
||||
do_check_eq(addresses[0].name, "Timothy John Berners-Lee");
|
||||
do_check_eq(addresses[0]["address-line1"], "32 Vassar Street");
|
||||
do_check_eq(addresses[0]["address-line2"], "MIT Room 32-G524");
|
||||
Assert.equal(addresses[0].name, "Timothy John Berners-Lee");
|
||||
Assert.equal(addresses[0]["address-line1"], "32 Vassar Street");
|
||||
Assert.equal(addresses[0]["address-line2"], "MIT Room 32-G524");
|
||||
|
||||
// Test with rawData set.
|
||||
addresses = profileStorage.addresses.getAll({rawData: true});
|
||||
do_check_eq(addresses[0].name, undefined);
|
||||
do_check_eq(addresses[0]["address-line1"], undefined);
|
||||
do_check_eq(addresses[0]["address-line2"], undefined);
|
||||
Assert.equal(addresses[0].name, undefined);
|
||||
Assert.equal(addresses[0]["address-line1"], undefined);
|
||||
Assert.equal(addresses[0]["address-line2"], undefined);
|
||||
|
||||
// Modifying output shouldn't affect the storage.
|
||||
addresses[0].organization = "test";
|
||||
|
@ -317,15 +317,15 @@ add_task(async function test_get() {
|
|||
|
||||
// Test with rawData set.
|
||||
address = profileStorage.addresses.get(guid, {rawData: true});
|
||||
do_check_eq(address.name, undefined);
|
||||
do_check_eq(address["address-line1"], undefined);
|
||||
do_check_eq(address["address-line2"], undefined);
|
||||
Assert.equal(address.name, undefined);
|
||||
Assert.equal(address["address-line1"], undefined);
|
||||
Assert.equal(address["address-line2"], undefined);
|
||||
|
||||
// Modifying output shouldn't affect the storage.
|
||||
address.organization = "test";
|
||||
do_check_record_matches(profileStorage.addresses.get(guid), TEST_ADDRESS_1);
|
||||
|
||||
do_check_eq(profileStorage.addresses.get("INVALID_GUID"), null);
|
||||
Assert.equal(profileStorage.addresses.get("INVALID_GUID"), null);
|
||||
});
|
||||
|
||||
add_task(async function test_add() {
|
||||
|
@ -334,28 +334,28 @@ add_task(async function test_add() {
|
|||
|
||||
let addresses = profileStorage.addresses.getAll();
|
||||
|
||||
do_check_eq(addresses.length, 2);
|
||||
Assert.equal(addresses.length, 2);
|
||||
|
||||
do_check_record_matches(addresses[0], TEST_ADDRESS_1);
|
||||
do_check_record_matches(addresses[1], TEST_ADDRESS_2);
|
||||
|
||||
do_check_neq(addresses[0].guid, undefined);
|
||||
do_check_eq(addresses[0].version, 1);
|
||||
do_check_neq(addresses[0].timeCreated, undefined);
|
||||
do_check_eq(addresses[0].timeLastModified, addresses[0].timeCreated);
|
||||
do_check_eq(addresses[0].timeLastUsed, 0);
|
||||
do_check_eq(addresses[0].timesUsed, 0);
|
||||
Assert.notEqual(addresses[0].guid, undefined);
|
||||
Assert.equal(addresses[0].version, 1);
|
||||
Assert.notEqual(addresses[0].timeCreated, undefined);
|
||||
Assert.equal(addresses[0].timeLastModified, addresses[0].timeCreated);
|
||||
Assert.equal(addresses[0].timeLastUsed, 0);
|
||||
Assert.equal(addresses[0].timesUsed, 0);
|
||||
|
||||
// Empty string should be deleted before saving.
|
||||
profileStorage.addresses.add(TEST_ADDRESS_WITH_EMPTY_FIELD);
|
||||
let address = profileStorage.addresses._data[2];
|
||||
do_check_eq(address.name, TEST_ADDRESS_WITH_EMPTY_FIELD.name);
|
||||
do_check_eq(address["street-address"], undefined);
|
||||
Assert.equal(address.name, TEST_ADDRESS_WITH_EMPTY_FIELD.name);
|
||||
Assert.equal(address["street-address"], undefined);
|
||||
|
||||
// Empty computed fields shouldn't cause any problem.
|
||||
profileStorage.addresses.add(TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD);
|
||||
address = profileStorage.addresses._data[3];
|
||||
do_check_eq(address.email, TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD.email);
|
||||
Assert.equal(address.email, TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD.email);
|
||||
|
||||
Assert.throws(() => profileStorage.addresses.add(TEST_ADDRESS_WITH_INVALID_FIELD),
|
||||
/"invalidField" is not a valid field\./);
|
||||
|
@ -381,7 +381,7 @@ add_task(async function test_update() {
|
|||
data == "update" && subject.QueryInterface(Ci.nsISupportsString).data == guid
|
||||
);
|
||||
|
||||
do_check_neq(addresses[1].country, undefined);
|
||||
Assert.notEqual(addresses[1].country, undefined);
|
||||
|
||||
profileStorage.addresses.update(guid, TEST_ADDRESS_3);
|
||||
await onChanged;
|
||||
|
@ -391,10 +391,10 @@ add_task(async function test_update() {
|
|||
|
||||
let address = profileStorage.addresses.get(guid, {rawData: true});
|
||||
|
||||
do_check_eq(address.country, undefined);
|
||||
do_check_neq(address.timeLastModified, timeLastModified);
|
||||
Assert.equal(address.country, undefined);
|
||||
Assert.notEqual(address.timeLastModified, timeLastModified);
|
||||
do_check_record_matches(address, TEST_ADDRESS_3);
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
|
||||
// Test preserveOldProperties parameter and field with empty string.
|
||||
profileStorage.addresses.update(guid, TEST_ADDRESS_WITH_EMPTY_FIELD, true);
|
||||
|
@ -405,26 +405,26 @@ add_task(async function test_update() {
|
|||
|
||||
address = profileStorage.addresses.get(guid, {rawData: true});
|
||||
|
||||
do_check_eq(address["given-name"], "Tim");
|
||||
do_check_eq(address["family-name"], "Berners");
|
||||
do_check_eq(address["street-address"], undefined);
|
||||
do_check_eq(address["postal-code"], "12345");
|
||||
do_check_neq(address.timeLastModified, timeLastModified);
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.addresses, guid), 2);
|
||||
Assert.equal(address["given-name"], "Tim");
|
||||
Assert.equal(address["family-name"], "Berners");
|
||||
Assert.equal(address["street-address"], undefined);
|
||||
Assert.equal(address["postal-code"], "12345");
|
||||
Assert.notEqual(address.timeLastModified, timeLastModified);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.addresses, guid), 2);
|
||||
|
||||
// Empty string should be deleted while updating.
|
||||
profileStorage.addresses.update(profileStorage.addresses._data[0].guid, TEST_ADDRESS_WITH_EMPTY_FIELD);
|
||||
address = profileStorage.addresses._data[0];
|
||||
do_check_eq(address.name, TEST_ADDRESS_WITH_EMPTY_FIELD.name);
|
||||
do_check_eq(address["street-address"], undefined);
|
||||
Assert.equal(address.name, TEST_ADDRESS_WITH_EMPTY_FIELD.name);
|
||||
Assert.equal(address["street-address"], undefined);
|
||||
|
||||
// Empty computed fields shouldn't cause any problem.
|
||||
profileStorage.addresses.update(profileStorage.addresses._data[0].guid, TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD, false);
|
||||
address = profileStorage.addresses._data[0];
|
||||
do_check_eq(address.email, TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD.email);
|
||||
Assert.equal(address.email, TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD.email);
|
||||
profileStorage.addresses.update(profileStorage.addresses._data[1].guid, TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD, true);
|
||||
address = profileStorage.addresses._data[1];
|
||||
do_check_eq(address.email, TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD.email);
|
||||
Assert.equal(address.email, TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD.email);
|
||||
|
||||
Assert.throws(
|
||||
() => profileStorage.addresses.update("INVALID_GUID", TEST_ADDRESS_3),
|
||||
|
@ -473,11 +473,11 @@ add_task(async function test_notifyUsed() {
|
|||
|
||||
let address = profileStorage.addresses.get(guid);
|
||||
|
||||
do_check_eq(address.timesUsed, timesUsed + 1);
|
||||
do_check_neq(address.timeLastUsed, timeLastUsed);
|
||||
Assert.equal(address.timesUsed, timesUsed + 1);
|
||||
Assert.notEqual(address.timeLastUsed, timeLastUsed);
|
||||
|
||||
// Using a record should not bump its change counter.
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.addresses, guid),
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.addresses, guid),
|
||||
changeCounter);
|
||||
|
||||
Assert.throws(() => profileStorage.addresses.notifyUsed("INVALID_GUID"),
|
||||
|
@ -494,16 +494,16 @@ add_task(async function test_remove() {
|
|||
let onChanged = TestUtils.topicObserved("formautofill-storage-changed",
|
||||
(subject, data) => data == "remove");
|
||||
|
||||
do_check_eq(addresses.length, 2);
|
||||
Assert.equal(addresses.length, 2);
|
||||
|
||||
profileStorage.addresses.remove(guid);
|
||||
await onChanged;
|
||||
|
||||
addresses = profileStorage.addresses.getAll();
|
||||
|
||||
do_check_eq(addresses.length, 1);
|
||||
Assert.equal(addresses.length, 1);
|
||||
|
||||
do_check_eq(profileStorage.addresses.get(guid), null);
|
||||
Assert.equal(profileStorage.addresses.get(guid), null);
|
||||
});
|
||||
|
||||
MERGE_TESTCASES.forEach((testcase) => {
|
||||
|
@ -524,7 +524,7 @@ MERGE_TESTCASES.forEach((testcase) => {
|
|||
|
||||
// Force to create sync metadata.
|
||||
profileStorage.addresses.pullSyncChanges();
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
|
||||
Assert.ok(profileStorage.addresses.mergeIfPossible(guid,
|
||||
testcase.addressToMerge,
|
||||
|
@ -540,12 +540,12 @@ MERGE_TESTCASES.forEach((testcase) => {
|
|||
Assert.equal(addresses[0].timeLastModified, timeLastModified);
|
||||
|
||||
// No need to bump the change counter if the data is unchanged.
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
} else {
|
||||
Assert.notEqual(addresses[0].timeLastModified, timeLastModified);
|
||||
|
||||
// Record merging should bump the change counter.
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.addresses, guid), 2);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.addresses, guid), 2);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -558,14 +558,14 @@ add_task(async function test_merge_same_address() {
|
|||
|
||||
// Force to create sync metadata.
|
||||
profileStorage.addresses.pullSyncChanges();
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
|
||||
// Merge same address will still return true but it won't update timeLastModified.
|
||||
Assert.ok(profileStorage.addresses.mergeIfPossible(guid, TEST_ADDRESS_1));
|
||||
Assert.equal(addresses[0].timeLastModified, timeLastModified);
|
||||
|
||||
// ... and won't bump the change counter, either.
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
});
|
||||
|
||||
add_task(async function test_merge_unable_merge() {
|
||||
|
@ -577,21 +577,21 @@ add_task(async function test_merge_unable_merge() {
|
|||
|
||||
// Force to create sync metadata.
|
||||
profileStorage.addresses.pullSyncChanges();
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
|
||||
// Unable to merge because of conflict
|
||||
do_check_eq(profileStorage.addresses.mergeIfPossible(guid, TEST_ADDRESS_3), false);
|
||||
Assert.equal(profileStorage.addresses.mergeIfPossible(guid, TEST_ADDRESS_3), false);
|
||||
|
||||
// Unable to merge because no overlap
|
||||
do_check_eq(profileStorage.addresses.mergeIfPossible(guid, TEST_ADDRESS_4), false);
|
||||
Assert.equal(profileStorage.addresses.mergeIfPossible(guid, TEST_ADDRESS_4), false);
|
||||
|
||||
// Unable to strict merge because subset with empty string
|
||||
let subset = Object.assign({}, TEST_ADDRESS_1);
|
||||
subset.organization = "";
|
||||
do_check_eq(profileStorage.addresses.mergeIfPossible(guid, subset, true), false);
|
||||
Assert.equal(profileStorage.addresses.mergeIfPossible(guid, subset, true), false);
|
||||
|
||||
// Shouldn't bump the change counter
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.addresses, guid), 1);
|
||||
});
|
||||
|
||||
add_task(async function test_mergeToStorage() {
|
||||
|
@ -601,12 +601,12 @@ add_task(async function test_mergeToStorage() {
|
|||
let anotherAddress = profileStorage.addresses._clone(TEST_ADDRESS_2);
|
||||
profileStorage.addresses.add(anotherAddress);
|
||||
anotherAddress.email = "timbl@w3.org";
|
||||
do_check_eq(profileStorage.addresses.mergeToStorage(anotherAddress).length, 2);
|
||||
do_check_eq(profileStorage.addresses.getAll()[1].email, anotherAddress.email);
|
||||
do_check_eq(profileStorage.addresses.getAll()[2].email, anotherAddress.email);
|
||||
Assert.equal(profileStorage.addresses.mergeToStorage(anotherAddress).length, 2);
|
||||
Assert.equal(profileStorage.addresses.getAll()[1].email, anotherAddress.email);
|
||||
Assert.equal(profileStorage.addresses.getAll()[2].email, anotherAddress.email);
|
||||
|
||||
// Empty computed fields shouldn't cause any problem.
|
||||
do_check_eq(profileStorage.addresses.mergeToStorage(TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD).length, 3);
|
||||
Assert.equal(profileStorage.addresses.mergeToStorage(TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD).length, 3);
|
||||
});
|
||||
|
||||
add_task(async function test_mergeToStorage_strict() {
|
||||
|
@ -615,9 +615,9 @@ add_task(async function test_mergeToStorage_strict() {
|
|||
// Try to merge a subset with empty string
|
||||
let anotherAddress = profileStorage.addresses._clone(TEST_ADDRESS_1);
|
||||
anotherAddress.email = "";
|
||||
do_check_eq(profileStorage.addresses.mergeToStorage(anotherAddress, true).length, 0);
|
||||
do_check_eq(profileStorage.addresses.getAll()[0].email, TEST_ADDRESS_1.email);
|
||||
Assert.equal(profileStorage.addresses.mergeToStorage(anotherAddress, true).length, 0);
|
||||
Assert.equal(profileStorage.addresses.getAll()[0].email, TEST_ADDRESS_1.email);
|
||||
|
||||
// Empty computed fields shouldn't cause any problem.
|
||||
do_check_eq(profileStorage.addresses.mergeToStorage(TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD, true).length, 1);
|
||||
Assert.equal(profileStorage.addresses.mergeToStorage(TEST_ADDRESS_WITH_EMPTY_COMPUTED_FIELD, true).length, 1);
|
||||
});
|
||||
|
|
|
@ -150,9 +150,9 @@ let prepareTestCreditCards = async function(path) {
|
|||
|
||||
let onChanged = TestUtils.topicObserved("formautofill-storage-changed",
|
||||
(subject, data) => data == "add");
|
||||
do_check_true(profileStorage.creditCards.add(TEST_CREDIT_CARD_1));
|
||||
Assert.ok(profileStorage.creditCards.add(TEST_CREDIT_CARD_1));
|
||||
await onChanged;
|
||||
do_check_true(profileStorage.creditCards.add(TEST_CREDIT_CARD_2));
|
||||
Assert.ok(profileStorage.creditCards.add(TEST_CREDIT_CARD_2));
|
||||
await onChanged;
|
||||
await profileStorage._saveImmediately();
|
||||
};
|
||||
|
@ -163,12 +163,12 @@ let do_check_credit_card_matches = (creditCardWithMeta, creditCard) => {
|
|||
for (let key in creditCard) {
|
||||
if (key == "cc-number") {
|
||||
let matches = reCCNumber.exec(creditCardWithMeta["cc-number"]);
|
||||
do_check_neq(matches, null);
|
||||
do_check_eq(creditCardWithMeta["cc-number"].length, creditCard["cc-number"].length);
|
||||
do_check_eq(creditCard["cc-number"].endsWith(matches[2]), true);
|
||||
do_check_neq(creditCard["cc-number-encrypted"], "");
|
||||
Assert.notEqual(matches, null);
|
||||
Assert.equal(creditCardWithMeta["cc-number"].length, creditCard["cc-number"].length);
|
||||
Assert.equal(creditCard["cc-number"].endsWith(matches[2]), true);
|
||||
Assert.notEqual(creditCard["cc-number-encrypted"], "");
|
||||
} else {
|
||||
do_check_eq(creditCardWithMeta[key], creditCard[key]);
|
||||
Assert.equal(creditCardWithMeta[key], creditCard[key]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -178,8 +178,8 @@ add_task(async function test_initialize() {
|
|||
let profileStorage = new ProfileStorage(path);
|
||||
await profileStorage.initialize();
|
||||
|
||||
do_check_eq(profileStorage._store.data.version, 1);
|
||||
do_check_eq(profileStorage._store.data.creditCards.length, 0);
|
||||
Assert.equal(profileStorage._store.data.version, 1);
|
||||
Assert.equal(profileStorage._store.data.creditCards.length, 0);
|
||||
|
||||
let data = profileStorage._store.data;
|
||||
Assert.deepEqual(data.creditCards, []);
|
||||
|
@ -201,20 +201,20 @@ add_task(async function test_getAll() {
|
|||
|
||||
let creditCards = profileStorage.creditCards.getAll();
|
||||
|
||||
do_check_eq(creditCards.length, 2);
|
||||
Assert.equal(creditCards.length, 2);
|
||||
do_check_credit_card_matches(creditCards[0], TEST_CREDIT_CARD_1);
|
||||
do_check_credit_card_matches(creditCards[1], TEST_CREDIT_CARD_2);
|
||||
|
||||
// Check computed fields.
|
||||
do_check_eq(creditCards[0]["cc-given-name"], "John");
|
||||
do_check_eq(creditCards[0]["cc-family-name"], "Doe");
|
||||
do_check_eq(creditCards[0]["cc-exp"], "2017-04");
|
||||
Assert.equal(creditCards[0]["cc-given-name"], "John");
|
||||
Assert.equal(creditCards[0]["cc-family-name"], "Doe");
|
||||
Assert.equal(creditCards[0]["cc-exp"], "2017-04");
|
||||
|
||||
// Test with rawData set.
|
||||
creditCards = profileStorage.creditCards.getAll({rawData: true});
|
||||
do_check_eq(creditCards[0]["cc-given-name"], undefined);
|
||||
do_check_eq(creditCards[0]["cc-family-name"], undefined);
|
||||
do_check_eq(creditCards[0]["cc-exp"], undefined);
|
||||
Assert.equal(creditCards[0]["cc-given-name"], undefined);
|
||||
Assert.equal(creditCards[0]["cc-family-name"], undefined);
|
||||
Assert.equal(creditCards[0]["cc-exp"], undefined);
|
||||
|
||||
// Modifying output shouldn't affect the storage.
|
||||
creditCards[0]["cc-name"] = "test";
|
||||
|
@ -238,7 +238,7 @@ add_task(async function test_get() {
|
|||
creditCards[0]["cc-name"] = "test";
|
||||
do_check_credit_card_matches(profileStorage.creditCards.get(guid), TEST_CREDIT_CARD_1);
|
||||
|
||||
do_check_eq(profileStorage.creditCards.get("INVALID_GUID"), null);
|
||||
Assert.equal(profileStorage.creditCards.get("INVALID_GUID"), null);
|
||||
});
|
||||
|
||||
add_task(async function test_add() {
|
||||
|
@ -250,28 +250,28 @@ add_task(async function test_add() {
|
|||
|
||||
let creditCards = profileStorage.creditCards.getAll();
|
||||
|
||||
do_check_eq(creditCards.length, 2);
|
||||
Assert.equal(creditCards.length, 2);
|
||||
|
||||
do_check_credit_card_matches(creditCards[0], TEST_CREDIT_CARD_1);
|
||||
do_check_credit_card_matches(creditCards[1], TEST_CREDIT_CARD_2);
|
||||
|
||||
do_check_neq(creditCards[0].guid, undefined);
|
||||
do_check_eq(creditCards[0].version, 1);
|
||||
do_check_neq(creditCards[0].timeCreated, undefined);
|
||||
do_check_eq(creditCards[0].timeLastModified, creditCards[0].timeCreated);
|
||||
do_check_eq(creditCards[0].timeLastUsed, 0);
|
||||
do_check_eq(creditCards[0].timesUsed, 0);
|
||||
Assert.notEqual(creditCards[0].guid, undefined);
|
||||
Assert.equal(creditCards[0].version, 1);
|
||||
Assert.notEqual(creditCards[0].timeCreated, undefined);
|
||||
Assert.equal(creditCards[0].timeLastModified, creditCards[0].timeCreated);
|
||||
Assert.equal(creditCards[0].timeLastUsed, 0);
|
||||
Assert.equal(creditCards[0].timesUsed, 0);
|
||||
|
||||
// Empty string should be deleted before saving.
|
||||
profileStorage.creditCards.add(TEST_CREDIT_CARD_WITH_EMPTY_FIELD);
|
||||
let creditCard = profileStorage.creditCards._data[2];
|
||||
do_check_eq(creditCard["cc-exp-month"], TEST_CREDIT_CARD_WITH_EMPTY_FIELD["cc-exp-month"]);
|
||||
do_check_eq(creditCard["cc-name"], undefined);
|
||||
Assert.equal(creditCard["cc-exp-month"], TEST_CREDIT_CARD_WITH_EMPTY_FIELD["cc-exp-month"]);
|
||||
Assert.equal(creditCard["cc-name"], undefined);
|
||||
|
||||
// Empty computed fields shouldn't cause any problem.
|
||||
profileStorage.creditCards.add(TEST_CREDIT_CARD_WITH_EMPTY_COMPUTED_FIELD);
|
||||
creditCard = profileStorage.creditCards._data[3];
|
||||
do_check_eq(creditCard["cc-number"],
|
||||
Assert.equal(creditCard["cc-number"],
|
||||
profileStorage.creditCards._getMaskedCCNumber(TEST_CREDIT_CARD_WITH_EMPTY_COMPUTED_FIELD["cc-number"]));
|
||||
|
||||
Assert.throws(() => profileStorage.creditCards.add(TEST_CREDIT_CARD_WITH_INVALID_FIELD),
|
||||
|
@ -298,7 +298,7 @@ add_task(async function test_update() {
|
|||
let onChanged = TestUtils.topicObserved("formautofill-storage-changed",
|
||||
(subject, data) => data == "update");
|
||||
|
||||
do_check_neq(creditCards[1]["cc-name"], undefined);
|
||||
Assert.notEqual(creditCards[1]["cc-name"], undefined);
|
||||
profileStorage.creditCards.update(guid, TEST_CREDIT_CARD_3);
|
||||
await onChanged;
|
||||
await profileStorage._saveImmediately();
|
||||
|
@ -308,24 +308,24 @@ add_task(async function test_update() {
|
|||
|
||||
let creditCard = profileStorage.creditCards.get(guid);
|
||||
|
||||
do_check_eq(creditCard["cc-name"], undefined);
|
||||
do_check_neq(creditCard.timeLastModified, timeLastModified);
|
||||
Assert.equal(creditCard["cc-name"], undefined);
|
||||
Assert.notEqual(creditCard.timeLastModified, timeLastModified);
|
||||
do_check_credit_card_matches(creditCard, TEST_CREDIT_CARD_3);
|
||||
|
||||
// Empty string should be deleted while updating.
|
||||
profileStorage.creditCards.update(profileStorage.creditCards._data[0].guid, TEST_CREDIT_CARD_WITH_EMPTY_FIELD);
|
||||
creditCard = profileStorage.creditCards._data[0];
|
||||
do_check_eq(creditCard["cc-exp-month"], TEST_CREDIT_CARD_WITH_EMPTY_FIELD["cc-exp-month"]);
|
||||
do_check_eq(creditCard["cc-name"], undefined);
|
||||
Assert.equal(creditCard["cc-exp-month"], TEST_CREDIT_CARD_WITH_EMPTY_FIELD["cc-exp-month"]);
|
||||
Assert.equal(creditCard["cc-name"], undefined);
|
||||
|
||||
// Empty computed fields shouldn't cause any problem.
|
||||
profileStorage.creditCards.update(profileStorage.creditCards._data[0].guid, TEST_CREDIT_CARD_WITH_EMPTY_COMPUTED_FIELD, false);
|
||||
creditCard = profileStorage.creditCards._data[0];
|
||||
do_check_eq(creditCard["cc-number"],
|
||||
Assert.equal(creditCard["cc-number"],
|
||||
profileStorage.creditCards._getMaskedCCNumber(TEST_CREDIT_CARD_WITH_EMPTY_COMPUTED_FIELD["cc-number"]));
|
||||
profileStorage.creditCards.update(profileStorage.creditCards._data[1].guid, TEST_CREDIT_CARD_WITH_EMPTY_COMPUTED_FIELD, true);
|
||||
creditCard = profileStorage.creditCards._data[1];
|
||||
do_check_eq(creditCard["cc-number"],
|
||||
Assert.equal(creditCard["cc-number"],
|
||||
profileStorage.creditCards._getMaskedCCNumber(TEST_CREDIT_CARD_WITH_EMPTY_COMPUTED_FIELD["cc-number"]));
|
||||
|
||||
Assert.throws(
|
||||
|
@ -367,17 +367,17 @@ add_task(async function test_validate() {
|
|||
|
||||
let creditCards = profileStorage.creditCards.getAll();
|
||||
|
||||
do_check_eq(creditCards[0]["cc-exp-month"], undefined);
|
||||
do_check_eq(creditCards[0]["cc-exp-year"], undefined);
|
||||
do_check_eq(creditCards[0]["cc-exp"], undefined);
|
||||
Assert.equal(creditCards[0]["cc-exp-month"], undefined);
|
||||
Assert.equal(creditCards[0]["cc-exp-year"], undefined);
|
||||
Assert.equal(creditCards[0]["cc-exp"], undefined);
|
||||
|
||||
let month = TEST_CREDIT_CARD_WITH_2_DIGITS_YEAR["cc-exp-month"];
|
||||
let year = parseInt(TEST_CREDIT_CARD_WITH_2_DIGITS_YEAR["cc-exp-year"], 10) + 2000;
|
||||
do_check_eq(creditCards[1]["cc-exp-month"], month);
|
||||
do_check_eq(creditCards[1]["cc-exp-year"], year);
|
||||
do_check_eq(creditCards[1]["cc-exp"], year + "-" + month.toString().padStart(2, "0"));
|
||||
Assert.equal(creditCards[1]["cc-exp-month"], month);
|
||||
Assert.equal(creditCards[1]["cc-exp-year"], year);
|
||||
Assert.equal(creditCards[1]["cc-exp"], year + "-" + month.toString().padStart(2, "0"));
|
||||
|
||||
do_check_eq(creditCards[2]["cc-number"].length, 16);
|
||||
Assert.equal(creditCards[2]["cc-number"].length, 16);
|
||||
});
|
||||
|
||||
add_task(async function test_notifyUsed() {
|
||||
|
@ -404,8 +404,8 @@ add_task(async function test_notifyUsed() {
|
|||
|
||||
let creditCard = profileStorage.creditCards.get(guid);
|
||||
|
||||
do_check_eq(creditCard.timesUsed, timesUsed + 1);
|
||||
do_check_neq(creditCard.timeLastUsed, timeLastUsed);
|
||||
Assert.equal(creditCard.timesUsed, timesUsed + 1);
|
||||
Assert.notEqual(creditCard.timeLastUsed, timeLastUsed);
|
||||
|
||||
Assert.throws(() => profileStorage.creditCards.notifyUsed("INVALID_GUID"),
|
||||
/No matching record\./);
|
||||
|
@ -424,7 +424,7 @@ add_task(async function test_remove() {
|
|||
let onChanged = TestUtils.topicObserved("formautofill-storage-changed",
|
||||
(subject, data) => data == "remove");
|
||||
|
||||
do_check_eq(creditCards.length, 2);
|
||||
Assert.equal(creditCards.length, 2);
|
||||
|
||||
profileStorage.creditCards.remove(guid);
|
||||
await onChanged;
|
||||
|
@ -435,9 +435,9 @@ add_task(async function test_remove() {
|
|||
|
||||
creditCards = profileStorage.creditCards.getAll();
|
||||
|
||||
do_check_eq(creditCards.length, 1);
|
||||
Assert.equal(creditCards.length, 1);
|
||||
|
||||
do_check_eq(profileStorage.creditCards.get(guid), null);
|
||||
Assert.equal(profileStorage.creditCards.get(guid), null);
|
||||
});
|
||||
|
||||
MERGE_TESTCASES.forEach((testcase) => {
|
||||
|
@ -457,7 +457,7 @@ MERGE_TESTCASES.forEach((testcase) => {
|
|||
);
|
||||
// Force to create sync metadata.
|
||||
profileStorage.creditCards.pullSyncChanges();
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.creditCards, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.creditCards, guid), 1);
|
||||
Assert.ok(profileStorage.creditCards.mergeIfPossible(guid, testcase.creditCardToMerge));
|
||||
if (!testcase.noNeedToUpdate) {
|
||||
await onMerged;
|
||||
|
@ -468,12 +468,12 @@ MERGE_TESTCASES.forEach((testcase) => {
|
|||
if (!testcase.noNeedToUpdate) {
|
||||
// Record merging should update timeLastModified and bump the change counter.
|
||||
Assert.notEqual(creditCards[0].timeLastModified, timeLastModified);
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.creditCards, guid), 2);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.creditCards, guid), 2);
|
||||
} else {
|
||||
// Subset record merging should not update timeLastModified and the change
|
||||
// counter is still the same.
|
||||
Assert.equal(creditCards[0].timeLastModified, timeLastModified);
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.creditCards, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.creditCards, guid), 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -487,21 +487,21 @@ add_task(async function test_merge_unable_merge() {
|
|||
let guid = creditCards[0].guid;
|
||||
// Force to create sync metadata.
|
||||
profileStorage.creditCards.pullSyncChanges();
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.creditCards, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.creditCards, guid), 1);
|
||||
|
||||
// Unable to merge because of conflict
|
||||
let anotherCreditCard = profileStorage.creditCards._clone(TEST_CREDIT_CARD_1);
|
||||
anotherCreditCard["cc-name"] = "Foo Bar";
|
||||
do_check_eq(profileStorage.creditCards.mergeIfPossible(guid, anotherCreditCard), false);
|
||||
Assert.equal(profileStorage.creditCards.mergeIfPossible(guid, anotherCreditCard), false);
|
||||
// The change counter is unchanged.
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.creditCards, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.creditCards, guid), 1);
|
||||
|
||||
// Unable to merge because no credit card number
|
||||
anotherCreditCard = profileStorage.creditCards._clone(TEST_CREDIT_CARD_1);
|
||||
anotherCreditCard["cc-number"] = "";
|
||||
do_check_eq(profileStorage.creditCards.mergeIfPossible(guid, anotherCreditCard), false);
|
||||
Assert.equal(profileStorage.creditCards.mergeIfPossible(guid, anotherCreditCard), false);
|
||||
// The change counter is still unchanged.
|
||||
do_check_eq(getSyncChangeCounter(profileStorage.creditCards, guid), 1);
|
||||
Assert.equal(getSyncChangeCounter(profileStorage.creditCards, guid), 1);
|
||||
});
|
||||
|
||||
add_task(async function test_mergeToStorage() {
|
||||
|
@ -511,14 +511,14 @@ add_task(async function test_mergeToStorage() {
|
|||
// Merge a creditCard to storage
|
||||
let anotherCreditCard = profileStorage.creditCards._clone(TEST_CREDIT_CARD_3);
|
||||
anotherCreditCard["cc-name"] = "Foo Bar";
|
||||
do_check_eq(profileStorage.creditCards.mergeToStorage(anotherCreditCard).length, 2);
|
||||
do_check_eq(profileStorage.creditCards.getAll()[0]["cc-name"], "Foo Bar");
|
||||
do_check_eq(profileStorage.creditCards.getAll()[0]["cc-exp"], "2000-01");
|
||||
do_check_eq(profileStorage.creditCards.getAll()[1]["cc-name"], "Foo Bar");
|
||||
do_check_eq(profileStorage.creditCards.getAll()[1]["cc-exp"], "2000-01");
|
||||
Assert.equal(profileStorage.creditCards.mergeToStorage(anotherCreditCard).length, 2);
|
||||
Assert.equal(profileStorage.creditCards.getAll()[0]["cc-name"], "Foo Bar");
|
||||
Assert.equal(profileStorage.creditCards.getAll()[0]["cc-exp"], "2000-01");
|
||||
Assert.equal(profileStorage.creditCards.getAll()[1]["cc-name"], "Foo Bar");
|
||||
Assert.equal(profileStorage.creditCards.getAll()[1]["cc-exp"], "2000-01");
|
||||
|
||||
// Empty computed fields shouldn't cause any problem.
|
||||
do_check_eq(profileStorage.creditCards.mergeToStorage(TEST_CREDIT_CARD_WITH_EMPTY_COMPUTED_FIELD).length, 0);
|
||||
Assert.equal(profileStorage.creditCards.mergeToStorage(TEST_CREDIT_CARD_WITH_EMPTY_COMPUTED_FIELD).length, 0);
|
||||
});
|
||||
|
||||
add_task(async function test_getDuplicateGuid() {
|
||||
|
@ -528,26 +528,26 @@ add_task(async function test_getDuplicateGuid() {
|
|||
let guid = profileStorage.creditCards._data[0].guid;
|
||||
|
||||
// Absolutely a duplicate.
|
||||
do_check_eq(profileStorage.creditCards.getDuplicateGuid(TEST_CREDIT_CARD_3), guid);
|
||||
Assert.equal(profileStorage.creditCards.getDuplicateGuid(TEST_CREDIT_CARD_3), guid);
|
||||
|
||||
// Absolutely not a duplicate.
|
||||
do_check_eq(profileStorage.creditCards.getDuplicateGuid(TEST_CREDIT_CARD_1), null);
|
||||
Assert.equal(profileStorage.creditCards.getDuplicateGuid(TEST_CREDIT_CARD_1), null);
|
||||
|
||||
// Subset shouldn't be treated as a duplicate.
|
||||
let record = Object.assign({}, TEST_CREDIT_CARD_3);
|
||||
delete record["cc-exp-month"];
|
||||
do_check_eq(profileStorage.creditCards.getDuplicateGuid(record), null);
|
||||
Assert.equal(profileStorage.creditCards.getDuplicateGuid(record), null);
|
||||
|
||||
// Superset shouldn't be treated as a duplicate.
|
||||
record = Object.assign({}, TEST_CREDIT_CARD_3);
|
||||
record["cc-name"] = "John Doe";
|
||||
do_check_eq(profileStorage.creditCards.getDuplicateGuid(record), null);
|
||||
Assert.equal(profileStorage.creditCards.getDuplicateGuid(record), null);
|
||||
|
||||
// Numbers with the same last 4 digits shouldn't be treated as a duplicate.
|
||||
record = Object.assign({}, TEST_CREDIT_CARD_3);
|
||||
let last4Digits = record["cc-number"].substr(-4);
|
||||
record["cc-number"] = "000000000000" + last4Digits;
|
||||
do_check_eq(profileStorage.creditCards.getDuplicateGuid(record), null);
|
||||
Assert.equal(profileStorage.creditCards.getDuplicateGuid(record), null);
|
||||
|
||||
// ... However, we treat numbers with the same last 4 digits as a duplicate if
|
||||
// the master password is enabled.
|
||||
|
@ -555,10 +555,10 @@ add_task(async function test_getDuplicateGuid() {
|
|||
let token = tokendb.getInternalKeyToken();
|
||||
token.reset();
|
||||
token.initPassword("password");
|
||||
do_check_eq(profileStorage.creditCards.getDuplicateGuid(record), guid);
|
||||
Assert.equal(profileStorage.creditCards.getDuplicateGuid(record), guid);
|
||||
|
||||
// ... Even though the master password is enabled and the last 4 digits are the
|
||||
// same, an invalid credit card number should never be treated as a duplicate.
|
||||
record["cc-number"] = "************" + last4Digits;
|
||||
do_check_eq(profileStorage.creditCards.getDuplicateGuid(record), null);
|
||||
Assert.equal(profileStorage.creditCards.getDuplicateGuid(record), null);
|
||||
});
|
||||
|
|
|
@ -78,7 +78,7 @@ add_task(async function test_getRecords() {
|
|||
await formAutofillParent._getRecords({collectionName}, target);
|
||||
mock.verify();
|
||||
if (collection) {
|
||||
do_check_eq(collection.getAll.called, true);
|
||||
Assert.equal(collection.getAll.called, true);
|
||||
collection.getAll.restore();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ Services.scriptloader.loadSubScript(bootstrapURI, sandbox, "utf-8");
|
|||
do_print("bootstrapURI: " + bootstrapURI);
|
||||
|
||||
add_task(async function test_defaultTestEnvironment() {
|
||||
do_check_true(sandbox.isAvailable());
|
||||
Assert.ok(sandbox.isAvailable());
|
||||
});
|
||||
|
||||
add_task(async function test_unsupportedRegion() {
|
||||
|
@ -19,7 +19,7 @@ add_task(async function test_unsupportedRegion() {
|
|||
do_register_cleanup(function cleanupRegion() {
|
||||
Services.prefs.clearUserPref("browser.search.region");
|
||||
});
|
||||
do_check_false(sandbox.isAvailable());
|
||||
Assert.ok(!sandbox.isAvailable());
|
||||
});
|
||||
|
||||
add_task(async function test_supportedRegion() {
|
||||
|
@ -28,5 +28,5 @@ add_task(async function test_supportedRegion() {
|
|||
do_register_cleanup(function cleanupRegion() {
|
||||
Services.prefs.clearUserPref("browser.search.region");
|
||||
});
|
||||
do_check_true(sandbox.isAvailable());
|
||||
Assert.ok(sandbox.isAvailable());
|
||||
});
|
||||
|
|
|
@ -70,6 +70,6 @@ add_task(async function test_isCJKName() {
|
|||
TESTCASES.forEach(testcase => {
|
||||
do_print("Starting testcase: " + testcase.fullName);
|
||||
let result = FormAutofillNameUtils._isCJKName(testcase.fullName);
|
||||
do_check_eq(result, testcase.expectedResult);
|
||||
Assert.equal(result, testcase.expectedResult);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -232,7 +232,7 @@ const CREDIT_CARD_TESTCASES = [
|
|||
|
||||
let do_check_record_matches = (expectedRecord, record) => {
|
||||
for (let key in expectedRecord) {
|
||||
do_check_eq(expectedRecord[key], record[key]);
|
||||
Assert.equal(expectedRecord[key], record[key]);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -279,6 +279,6 @@ add_task(async function test_joinName() {
|
|||
TESTCASES.forEach(testcase => {
|
||||
do_print("Starting testcase: " + testcase.description);
|
||||
let name = FormAutofillNameUtils.joinNameParts(testcase.nameParts);
|
||||
do_check_eq(name, testcase.expectedFullName || testcase.fullName);
|
||||
Assert.equal(name, testcase.expectedFullName || testcase.fullName);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,46 +9,46 @@ Cu.import("resource://formautofill/phonenumberutils/PhoneNumberNormalizer.jsm");
|
|||
|
||||
function IsPlain(dial, expected) {
|
||||
let result = PhoneNumber.IsPlain(dial);
|
||||
do_check_eq(result, expected);
|
||||
Assert.equal(result, expected);
|
||||
}
|
||||
|
||||
function Normalize(dial, expected) {
|
||||
let result = PhoneNumberNormalizer.Normalize(dial);
|
||||
do_check_eq(result, expected);
|
||||
Assert.equal(result, expected);
|
||||
}
|
||||
|
||||
function CantParse(dial, currentRegion) {
|
||||
let result = PhoneNumber.Parse(dial, currentRegion);
|
||||
do_check_null(result);
|
||||
Assert.equal(null, result);
|
||||
}
|
||||
|
||||
function Parse(dial, currentRegion) {
|
||||
let result = PhoneNumber.Parse(dial, currentRegion);
|
||||
do_check_neq(result, null);
|
||||
Assert.notEqual(result, null);
|
||||
return result;
|
||||
}
|
||||
|
||||
function Test(dial, currentRegion, nationalNumber, region) {
|
||||
let result = Parse(dial, currentRegion);
|
||||
do_check_eq(result.nationalNumber, nationalNumber);
|
||||
do_check_eq(result.region, region);
|
||||
Assert.equal(result.nationalNumber, nationalNumber);
|
||||
Assert.equal(result.region, region);
|
||||
return result;
|
||||
}
|
||||
|
||||
function TestProperties(dial, currentRegion) {
|
||||
let result = Parse(dial, currentRegion);
|
||||
do_check_true(result.internationalFormat);
|
||||
do_check_true(result.internationalNumber);
|
||||
do_check_true(result.nationalFormat);
|
||||
do_check_true(result.nationalNumber);
|
||||
do_check_true(result.countryName);
|
||||
do_check_true(result.countryCode);
|
||||
Assert.ok(result.internationalFormat);
|
||||
Assert.ok(result.internationalNumber);
|
||||
Assert.ok(result.nationalFormat);
|
||||
Assert.ok(result.nationalNumber);
|
||||
Assert.ok(result.countryName);
|
||||
Assert.ok(result.countryCode);
|
||||
}
|
||||
|
||||
function Format(dial, currentRegion, nationalNumber, region, nationalFormat, internationalFormat) {
|
||||
let result = Test(dial, currentRegion, nationalNumber, region);
|
||||
do_check_eq(result.nationalFormat, nationalFormat);
|
||||
do_check_eq(result.internationalFormat, internationalFormat);
|
||||
Assert.equal(result.nationalFormat, nationalFormat);
|
||||
Assert.equal(result.internationalFormat, internationalFormat);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ add_task(async function test_phoneNumber() {
|
|||
AllEqual(["01187654321", "0411187654321", "551187654321", "90411187654321", "+551187654321"], "BR");
|
||||
AllEqual(["011987654321", "04111987654321", "5511987654321", "904111987654321", "+5511987654321"], "BR");
|
||||
|
||||
do_check_eq(PhoneNumberNormalizer.Normalize("123abc", true), "123");
|
||||
do_check_eq(PhoneNumberNormalizer.Normalize("12345", true), "12345");
|
||||
do_check_eq(PhoneNumberNormalizer.Normalize("1abcd", false), "12223");
|
||||
Assert.equal(PhoneNumberNormalizer.Normalize("123abc", true), "123");
|
||||
Assert.equal(PhoneNumberNormalizer.Normalize("12345", true), "12345");
|
||||
Assert.equal(PhoneNumberNormalizer.Normalize("1abcd", false), "12223");
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@ add_task(async function test_profileSavedFieldNames_init() {
|
|||
|
||||
await formAutofillParent.init();
|
||||
await formAutofillParent.profileStorage.initialize();
|
||||
do_check_eq(formAutofillParent._updateSavedFieldNames.called, true);
|
||||
Assert.equal(formAutofillParent._updateSavedFieldNames.called, true);
|
||||
|
||||
formAutofillParent._uninit();
|
||||
});
|
||||
|
@ -27,13 +27,13 @@ add_task(async function test_profileSavedFieldNames_observe() {
|
|||
// profile changed => Need to trigger updateValidFields
|
||||
["add", "update", "remove", "reconcile"].forEach(event => {
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "add");
|
||||
do_check_eq(formAutofillParent._updateSavedFieldNames.called, true);
|
||||
Assert.equal(formAutofillParent._updateSavedFieldNames.called, true);
|
||||
});
|
||||
|
||||
// profile metadata updated => no need to trigger updateValidFields
|
||||
formAutofillParent._updateSavedFieldNames.reset();
|
||||
formAutofillParent.observe(null, "formautofill-storage-changed", "notifyUsed");
|
||||
do_check_eq(formAutofillParent._updateSavedFieldNames.called, false);
|
||||
Assert.equal(formAutofillParent._updateSavedFieldNames.called, false);
|
||||
});
|
||||
|
||||
add_task(async function test_profileSavedFieldNames_update() {
|
||||
|
@ -48,7 +48,7 @@ add_task(async function test_profileSavedFieldNames_update() {
|
|||
|
||||
// The set is empty if there's no profile in the store.
|
||||
formAutofillParent._updateSavedFieldNames();
|
||||
do_check_eq(Services.ppmm.initialProcessData.autofillSavedFieldNames.size, 0);
|
||||
Assert.equal(Services.ppmm.initialProcessData.autofillSavedFieldNames.size, 0);
|
||||
|
||||
// 2 profiles with 4 valid fields.
|
||||
let fakeStorage = [{
|
||||
|
@ -76,14 +76,14 @@ add_task(async function test_profileSavedFieldNames_update() {
|
|||
formAutofillParent._updateSavedFieldNames();
|
||||
|
||||
let autofillSavedFieldNames = Services.ppmm.initialProcessData.autofillSavedFieldNames;
|
||||
do_check_eq(autofillSavedFieldNames.size, 4);
|
||||
do_check_eq(autofillSavedFieldNames.has("organization"), true);
|
||||
do_check_eq(autofillSavedFieldNames.has("street-address"), true);
|
||||
do_check_eq(autofillSavedFieldNames.has("tel"), true);
|
||||
do_check_eq(autofillSavedFieldNames.has("email"), false);
|
||||
do_check_eq(autofillSavedFieldNames.has("guid"), false);
|
||||
do_check_eq(autofillSavedFieldNames.has("timeCreated"), false);
|
||||
do_check_eq(autofillSavedFieldNames.has("timeLastUsed"), false);
|
||||
do_check_eq(autofillSavedFieldNames.has("timeLastModified"), false);
|
||||
do_check_eq(autofillSavedFieldNames.has("timesUsed"), false);
|
||||
Assert.equal(autofillSavedFieldNames.size, 4);
|
||||
Assert.equal(autofillSavedFieldNames.has("organization"), true);
|
||||
Assert.equal(autofillSavedFieldNames.has("street-address"), true);
|
||||
Assert.equal(autofillSavedFieldNames.has("tel"), true);
|
||||
Assert.equal(autofillSavedFieldNames.has("email"), false);
|
||||
Assert.equal(autofillSavedFieldNames.has("guid"), false);
|
||||
Assert.equal(autofillSavedFieldNames.has("timeCreated"), false);
|
||||
Assert.equal(autofillSavedFieldNames.has("timeLastUsed"), false);
|
||||
Assert.equal(autofillSavedFieldNames.has("timeLastModified"), false);
|
||||
Assert.equal(autofillSavedFieldNames.has("timesUsed"), false);
|
||||
});
|
||||
|
|
|
@ -79,14 +79,14 @@ add_task(async function test_pushChanges() {
|
|||
await onChanged;
|
||||
|
||||
changeCounter = getSyncChangeCounter(profileStorage.addresses, guid);
|
||||
do_check_eq(changeCounter, 2);
|
||||
Assert.equal(changeCounter, 2);
|
||||
|
||||
profileStorage.addresses.pushSyncChanges(changes);
|
||||
address = profileStorage.addresses.get(guid);
|
||||
changeCounter = getSyncChangeCounter(profileStorage.addresses, guid);
|
||||
|
||||
// Counter should still be 1, since our sync didn't record the mid-sync change
|
||||
do_check_eq(changeCounter, 1, "Counter shouldn't be zero because it didn't record update");
|
||||
Assert.equal(changeCounter, 1, "Counter shouldn't be zero because it didn't record update");
|
||||
|
||||
// now, push a new set of changes, which should make the changeCounter 0
|
||||
profileStorage.addresses.pushSyncChanges({
|
||||
|
@ -99,7 +99,7 @@ add_task(async function test_pushChanges() {
|
|||
});
|
||||
|
||||
changeCounter = getSyncChangeCounter(profileStorage.addresses, guid);
|
||||
do_check_eq(changeCounter, 0);
|
||||
Assert.equal(changeCounter, 0);
|
||||
});
|
||||
|
||||
async function checkingSyncChange(action, callback) {
|
||||
|
|
|
@ -54,7 +54,7 @@ add_storage_task(async function test_simple_tombstone(storage, record) {
|
|||
do_print("check simple tombstone semantics");
|
||||
|
||||
let guid = storage.add(record);
|
||||
do_check_eq(storage.getAll().length, 1);
|
||||
Assert.equal(storage.getAll().length, 1);
|
||||
|
||||
storage.remove(guid);
|
||||
|
||||
|
@ -73,7 +73,7 @@ add_storage_task(async function test_simple_synctombstone(storage, record) {
|
|||
do_print("check simple tombstone semantics for synced records");
|
||||
|
||||
let guid = storage.add(record);
|
||||
do_check_eq(storage.getAll().length, 1);
|
||||
Assert.equal(storage.getAll().length, 1);
|
||||
|
||||
storage.pullSyncChanges(); // force sync metadata, which triggers tombstone behaviour.
|
||||
|
||||
|
|
|
@ -834,7 +834,7 @@ const CREDIT_CARD_NORMALIZE_TESTCASES = [
|
|||
|
||||
let do_check_record_matches = (expectedRecord, record) => {
|
||||
for (let key in expectedRecord) {
|
||||
do_check_eq(expectedRecord[key], record[key]);
|
||||
Assert.equal(expectedRecord[key], record[key]);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ add_task(async function() {
|
|||
resetOnboardingDefaultState();
|
||||
OnboardingTourType.check();
|
||||
|
||||
do_check_eq(Preferences.get(PREF_TOUR_TYPE), "new", "should show the new user tour");
|
||||
do_check_eq(Preferences.get(PREF_TOURSET_VERSION), TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_TOUR_TYPE), "new", "should show the new user tour");
|
||||
Assert.equal(Preferences.get(PREF_TOURSET_VERSION), TOURSET_VERSION,
|
||||
"tourset version should not change");
|
||||
do_check_eq(Preferences.get(PREF_SEEN_TOURSET_VERSION), TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_SEEN_TOURSET_VERSION), TOURSET_VERSION,
|
||||
"seen tourset version should be set as the tourset version");
|
||||
});
|
||||
|
||||
|
@ -25,10 +25,10 @@ add_task(async function() {
|
|||
Preferences.set(PREF_SEEN_TOURSET_VERSION, TOURSET_VERSION);
|
||||
OnboardingTourType.check();
|
||||
|
||||
do_check_eq(Preferences.get(PREF_TOUR_TYPE), "new", "should show the new user tour");
|
||||
do_check_eq(Preferences.get(PREF_TOURSET_VERSION), TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_TOUR_TYPE), "new", "should show the new user tour");
|
||||
Assert.equal(Preferences.get(PREF_TOURSET_VERSION), TOURSET_VERSION,
|
||||
"tourset version should not change");
|
||||
do_check_eq(Preferences.get(PREF_SEEN_TOURSET_VERSION), TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_SEEN_TOURSET_VERSION), TOURSET_VERSION,
|
||||
"seen tourset version should be set as the tourset version");
|
||||
});
|
||||
|
||||
|
@ -39,10 +39,10 @@ add_task(async function() {
|
|||
Preferences.set(PREF_SEEN_TOURSET_VERSION, TOURSET_VERSION);
|
||||
OnboardingTourType.check();
|
||||
|
||||
do_check_eq(Preferences.get(PREF_TOUR_TYPE), "new", "should show the new user tour");
|
||||
do_check_eq(Preferences.get(PREF_TOURSET_VERSION), TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_TOUR_TYPE), "new", "should show the new user tour");
|
||||
Assert.equal(Preferences.get(PREF_TOURSET_VERSION), TOURSET_VERSION,
|
||||
"tourset version should not change");
|
||||
do_check_eq(Preferences.get(PREF_SEEN_TOURSET_VERSION), TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_SEEN_TOURSET_VERSION), TOURSET_VERSION,
|
||||
"seen tourset version should be set as the tourset version");
|
||||
});
|
||||
|
||||
|
@ -54,10 +54,10 @@ add_task(async function() {
|
|||
Preferences.set(PREF_SEEN_TOURSET_VERSION, TOURSET_VERSION);
|
||||
OnboardingTourType.check();
|
||||
|
||||
do_check_eq(Preferences.get(PREF_TOUR_TYPE), "update", "should show the update user tour");
|
||||
do_check_eq(Preferences.get(PREF_TOURSET_VERSION), NEXT_TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_TOUR_TYPE), "update", "should show the update user tour");
|
||||
Assert.equal(Preferences.get(PREF_TOURSET_VERSION), NEXT_TOURSET_VERSION,
|
||||
"tourset version should not change");
|
||||
do_check_eq(Preferences.get(PREF_SEEN_TOURSET_VERSION), NEXT_TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_SEEN_TOURSET_VERSION), NEXT_TOURSET_VERSION,
|
||||
"seen tourset version should be set as the tourset version");
|
||||
});
|
||||
|
||||
|
@ -69,10 +69,10 @@ add_task(async function() {
|
|||
Preferences.set(PREF_SEEN_TOURSET_VERSION, TOURSET_VERSION);
|
||||
OnboardingTourType.check();
|
||||
|
||||
do_check_eq(Preferences.get(PREF_TOUR_TYPE), "update", "should show the update user tour");
|
||||
do_check_eq(Preferences.get(PREF_TOURSET_VERSION), NEXT_TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_TOUR_TYPE), "update", "should show the update user tour");
|
||||
Assert.equal(Preferences.get(PREF_TOURSET_VERSION), NEXT_TOURSET_VERSION,
|
||||
"tourset version should not change");
|
||||
do_check_eq(Preferences.get(PREF_SEEN_TOURSET_VERSION), NEXT_TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_SEEN_TOURSET_VERSION), NEXT_TOURSET_VERSION,
|
||||
"seen tourset version should be set as the tourset version");
|
||||
});
|
||||
|
||||
|
@ -81,9 +81,9 @@ add_task(async function() {
|
|||
resetOldProfileDefaultState();
|
||||
OnboardingTourType.check();
|
||||
|
||||
do_check_eq(Preferences.get(PREF_TOUR_TYPE), "update", "should show the update user tour");
|
||||
do_check_eq(Preferences.get(PREF_TOURSET_VERSION), TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_TOUR_TYPE), "update", "should show the update user tour");
|
||||
Assert.equal(Preferences.get(PREF_TOURSET_VERSION), TOURSET_VERSION,
|
||||
"tourset version should not change");
|
||||
do_check_eq(Preferences.get(PREF_SEEN_TOURSET_VERSION), TOURSET_VERSION,
|
||||
Assert.equal(Preferences.get(PREF_SEEN_TOURSET_VERSION), TOURSET_VERSION,
|
||||
"seen tourset version should be set as the tourset version");
|
||||
});
|
||||
|
|
|
@ -75,17 +75,17 @@ function getHttpHandler(path) {
|
|||
|
||||
function isIdentical(actual, expected) {
|
||||
if (expected == null) {
|
||||
do_check_eq(actual, expected);
|
||||
Assert.equal(actual, expected);
|
||||
} else if (typeof expected == "object") {
|
||||
// Make sure all the keys match up
|
||||
do_check_eq(Object.keys(actual).sort() + "", Object.keys(expected).sort());
|
||||
Assert.equal(Object.keys(actual).sort() + "", Object.keys(expected).sort());
|
||||
|
||||
// Recursively check each value individually
|
||||
Object.keys(expected).forEach(key => {
|
||||
isIdentical(actual[key], expected[key]);
|
||||
});
|
||||
} else {
|
||||
do_check_eq(actual, expected);
|
||||
Assert.equal(actual, expected);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ function promiseSetupDirectoryLinksProvider(options = {}) {
|
|||
await DirectoryLinksProvider.init();
|
||||
Services.locale.setRequestedLocales([options.locale || "en-US"]);
|
||||
await promiseDirectoryDownloadOnPrefChange(kSourceUrlPref, linksURL);
|
||||
do_check_eq(DirectoryLinksProvider._linksURL, linksURL);
|
||||
Assert.equal(DirectoryLinksProvider._linksURL, linksURL);
|
||||
DirectoryLinksProvider._lastDownloadMS = options.lastDownloadMS || 0;
|
||||
})();
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ add_task(async function test_fetchAndCacheLinks_remote() {
|
|||
await cleanJsonFile();
|
||||
// this must trigger directory links json download and save it to cache file
|
||||
await promiseDirectoryDownloadOnPrefChange(kSourceUrlPref, kExampleURL + "%LOCALE%");
|
||||
do_check_eq(gLastRequestPath, kExamplePath + "en-US");
|
||||
Assert.equal(gLastRequestPath, kExamplePath + "en-US");
|
||||
let data = await readJsonFile();
|
||||
isIdentical(data, kHttpHandlerData[kExamplePath]);
|
||||
});
|
||||
|
@ -215,7 +215,7 @@ add_task(async function test_fetchAndCacheLinks_malformedURI() {
|
|||
await DirectoryLinksProvider._fetchAndCacheLinks(someJunk);
|
||||
do_throw("Malformed URIs should fail");
|
||||
} catch (e) {
|
||||
do_check_eq(e, "Error fetching " + someJunk);
|
||||
Assert.equal(e, "Error fetching " + someJunk);
|
||||
}
|
||||
|
||||
// File should be empty.
|
||||
|
@ -231,7 +231,7 @@ add_task(async function test_fetchAndCacheLinks_unknownHost() {
|
|||
await DirectoryLinksProvider._fetchAndCacheLinks(nonExistentServer);
|
||||
do_throw("BAD URIs should fail");
|
||||
} catch (e) {
|
||||
do_check_true(e.startsWith("Fetching " + nonExistentServer + " results in error code: "));
|
||||
Assert.ok(e.startsWith("Fetching " + nonExistentServer + " results in error code: "));
|
||||
}
|
||||
|
||||
// File should be empty.
|
||||
|
@ -243,7 +243,7 @@ add_task(async function test_fetchAndCacheLinks_non200Status() {
|
|||
await DirectoryLinksProvider.init();
|
||||
await cleanJsonFile();
|
||||
await promiseDirectoryDownloadOnPrefChange(kSourceUrlPref, kFailURL);
|
||||
do_check_eq(gLastRequestPath, kFailPath);
|
||||
Assert.equal(gLastRequestPath, kFailPath);
|
||||
let data = await readJsonFile();
|
||||
isIdentical(data, {});
|
||||
});
|
||||
|
@ -254,12 +254,12 @@ add_task(async function test_DirectoryLinksProvider__linkObservers() {
|
|||
|
||||
let testObserver = new LinksChangeObserver();
|
||||
DirectoryLinksProvider.addObserver(testObserver);
|
||||
do_check_eq(DirectoryLinksProvider._observers.size, 1);
|
||||
Assert.equal(DirectoryLinksProvider._observers.size, 1);
|
||||
DirectoryLinksProvider._fetchAndCacheLinksIfNecessary(true);
|
||||
|
||||
await testObserver.deferred.promise;
|
||||
DirectoryLinksProvider._removeObservers();
|
||||
do_check_eq(DirectoryLinksProvider._observers.size, 0);
|
||||
Assert.equal(DirectoryLinksProvider._observers.size, 0);
|
||||
|
||||
await promiseCleanDirectoryLinksProvider();
|
||||
});
|
||||
|
@ -268,7 +268,7 @@ add_task(async function test_DirectoryLinksProvider__prefObserver_url() {
|
|||
await promiseSetupDirectoryLinksProvider({linksURL: kTestURL});
|
||||
|
||||
let links = await fetchData();
|
||||
do_check_eq(links.length, 1);
|
||||
Assert.equal(links.length, 1);
|
||||
let expectedData = [{url: "http://example.com", title: "LocalSource", frecency: DIRECTORY_FRECENCY, lastVisitDate: 1}];
|
||||
isIdentical(links, expectedData);
|
||||
|
||||
|
@ -277,7 +277,7 @@ add_task(async function test_DirectoryLinksProvider__prefObserver_url() {
|
|||
// 2. invalid source url is correctly handled
|
||||
let exampleUrl = "http://localhost:56789/bad";
|
||||
await promiseDirectoryDownloadOnPrefChange(kSourceUrlPref, exampleUrl);
|
||||
do_check_eq(DirectoryLinksProvider._linksURL, exampleUrl);
|
||||
Assert.equal(DirectoryLinksProvider._linksURL, exampleUrl);
|
||||
|
||||
// since the download fail, the directory file must remain the same
|
||||
let newLinks = await fetchData();
|
||||
|
@ -301,7 +301,7 @@ add_task(async function test_DirectoryLinksProvider_getLinks_noDirectoryData() {
|
|||
await promiseSetupDirectoryLinksProvider({linksURL: dataURI});
|
||||
|
||||
let links = await fetchData();
|
||||
do_check_eq(links.length, 0);
|
||||
Assert.equal(links.length, 0);
|
||||
await promiseCleanDirectoryLinksProvider();
|
||||
});
|
||||
|
||||
|
@ -316,18 +316,18 @@ add_task(async function test_DirectoryLinksProvider_getLinks_badData() {
|
|||
|
||||
// Make sure we get nothing for incorrectly formatted data
|
||||
let links = await fetchData();
|
||||
do_check_eq(links.length, 0);
|
||||
Assert.equal(links.length, 0);
|
||||
await promiseCleanDirectoryLinksProvider();
|
||||
});
|
||||
|
||||
add_task(function test_DirectoryLinksProvider_needsDownload() {
|
||||
// test timestamping
|
||||
DirectoryLinksProvider._lastDownloadMS = 0;
|
||||
do_check_true(DirectoryLinksProvider._needsDownload);
|
||||
Assert.ok(DirectoryLinksProvider._needsDownload);
|
||||
DirectoryLinksProvider._lastDownloadMS = Date.now();
|
||||
do_check_false(DirectoryLinksProvider._needsDownload);
|
||||
Assert.ok(!DirectoryLinksProvider._needsDownload);
|
||||
DirectoryLinksProvider._lastDownloadMS = Date.now() - (60 * 60 * 24 + 1) * 1000;
|
||||
do_check_true(DirectoryLinksProvider._needsDownload);
|
||||
Assert.ok(DirectoryLinksProvider._needsDownload);
|
||||
DirectoryLinksProvider._lastDownloadMS = 0;
|
||||
});
|
||||
|
||||
|
@ -340,7 +340,7 @@ add_task(async function test_DirectoryLinksProvider_fetchAndCacheLinksIfNecessar
|
|||
|
||||
// inspect lastDownloadMS timestamp which should be 5 seconds less then now()
|
||||
let lastDownloadMS = DirectoryLinksProvider._lastDownloadMS;
|
||||
do_check_true((Date.now() - lastDownloadMS) < 5000);
|
||||
Assert.ok((Date.now() - lastDownloadMS) < 5000);
|
||||
|
||||
// we should have fetched a new file during setup
|
||||
let data = await readJsonFile();
|
||||
|
@ -348,7 +348,7 @@ add_task(async function test_DirectoryLinksProvider_fetchAndCacheLinksIfNecessar
|
|||
|
||||
// attempt to download again - the timestamp should not change
|
||||
await DirectoryLinksProvider._fetchAndCacheLinksIfNecessary();
|
||||
do_check_eq(DirectoryLinksProvider._lastDownloadMS, lastDownloadMS);
|
||||
Assert.equal(DirectoryLinksProvider._lastDownloadMS, lastDownloadMS);
|
||||
|
||||
// clean the file and force the download
|
||||
await cleanJsonFile();
|
||||
|
@ -362,12 +362,12 @@ add_task(async function test_DirectoryLinksProvider_fetchAndCacheLinksIfNecessar
|
|||
await DirectoryLinksProvider._fetchAndCacheLinksIfNecessary(true);
|
||||
data = await readJsonFile();
|
||||
isIdentical(data, kURLData);
|
||||
do_check_eq(DirectoryLinksProvider._lastDownloadMS, lastDownloadMS);
|
||||
Assert.equal(DirectoryLinksProvider._lastDownloadMS, lastDownloadMS);
|
||||
|
||||
// _fetchAndCacheLinksIfNecessary must return same promise if download is in progress
|
||||
let downloadPromise = DirectoryLinksProvider._fetchAndCacheLinksIfNecessary(true);
|
||||
let anotherPromise = DirectoryLinksProvider._fetchAndCacheLinksIfNecessary(true);
|
||||
do_check_true(downloadPromise === anotherPromise);
|
||||
Assert.ok(downloadPromise === anotherPromise);
|
||||
await downloadPromise;
|
||||
|
||||
await promiseCleanDirectoryLinksProvider();
|
||||
|
@ -381,13 +381,13 @@ add_task(async function test_DirectoryLinksProvider_fetchDirectoryOnPrefChange()
|
|||
|
||||
await cleanJsonFile();
|
||||
// ensure that provider does not think it needs to download
|
||||
do_check_false(DirectoryLinksProvider._needsDownload);
|
||||
Assert.ok(!DirectoryLinksProvider._needsDownload);
|
||||
|
||||
// change the source URL, which should force directory download
|
||||
await promiseDirectoryDownloadOnPrefChange(kSourceUrlPref, kExampleURL);
|
||||
// then wait for testObserver to fire and test that json is downloaded
|
||||
await testObserver.deferred.promise;
|
||||
do_check_eq(gLastRequestPath, kExamplePath);
|
||||
Assert.equal(gLastRequestPath, kExamplePath);
|
||||
let data = await readJsonFile();
|
||||
isIdentical(data, kHttpHandlerData[kExamplePath]);
|
||||
|
||||
|
@ -434,11 +434,11 @@ add_task(async function test_DirectoryLinksProvider_getAllowedLinks() {
|
|||
await promiseSetupDirectoryLinksProvider({linksURL: dataURI});
|
||||
|
||||
let links = await fetchData();
|
||||
do_check_eq(links.length, 2);
|
||||
Assert.equal(links.length, 2);
|
||||
|
||||
// The only remaining url should be http and https
|
||||
do_check_eq(links[0].url, data.directory[1].url);
|
||||
do_check_eq(links[1].url, data.directory[3].url);
|
||||
Assert.equal(links[0].url, data.directory[1].url);
|
||||
Assert.equal(links[1].url, data.directory[3].url);
|
||||
});
|
||||
|
||||
add_task(async function test_DirectoryLinksProvider_getAllowedImages() {
|
||||
|
@ -455,11 +455,11 @@ add_task(async function test_DirectoryLinksProvider_getAllowedImages() {
|
|||
await promiseSetupDirectoryLinksProvider({linksURL: dataURI});
|
||||
|
||||
let links = await fetchData();
|
||||
do_check_eq(links.length, 2);
|
||||
Assert.equal(links.length, 2);
|
||||
|
||||
// The only remaining images should be https and data
|
||||
do_check_eq(links[0].imageURI, data.directory[3].imageURI);
|
||||
do_check_eq(links[1].imageURI, data.directory[5].imageURI);
|
||||
Assert.equal(links[0].imageURI, data.directory[3].imageURI);
|
||||
Assert.equal(links[1].imageURI, data.directory[5].imageURI);
|
||||
});
|
||||
|
||||
add_task(async function test_DirectoryLinksProvider_getAllowedImages_base() {
|
||||
|
@ -477,13 +477,13 @@ add_task(async function test_DirectoryLinksProvider_getAllowedImages_base() {
|
|||
DirectoryLinksProvider.__linksURLModified = false;
|
||||
|
||||
let links = await fetchData();
|
||||
do_check_eq(links.length, 4);
|
||||
Assert.equal(links.length, 4);
|
||||
|
||||
// The only remaining images should be https with mozilla.net or data URI
|
||||
do_check_eq(links[0].url, data.directory[1].url);
|
||||
do_check_eq(links[1].url, data.directory[2].url);
|
||||
do_check_eq(links[2].url, data.directory[3].url);
|
||||
do_check_eq(links[3].url, data.directory[4].url);
|
||||
Assert.equal(links[0].url, data.directory[1].url);
|
||||
Assert.equal(links[1].url, data.directory[2].url);
|
||||
Assert.equal(links[2].url, data.directory[3].url);
|
||||
Assert.equal(links[3].url, data.directory[4].url);
|
||||
});
|
||||
|
||||
add_task(async function test_DirectoryLinksProvider_getAllowedEnhancedImages() {
|
||||
|
@ -500,17 +500,17 @@ add_task(async function test_DirectoryLinksProvider_getAllowedEnhancedImages() {
|
|||
await promiseSetupDirectoryLinksProvider({linksURL: dataURI});
|
||||
|
||||
let links = await fetchData();
|
||||
do_check_eq(links.length, 2);
|
||||
Assert.equal(links.length, 2);
|
||||
|
||||
// The only remaining enhancedImages should be http and https and data
|
||||
do_check_eq(links[0].enhancedImageURI, data.directory[3].enhancedImageURI);
|
||||
do_check_eq(links[1].enhancedImageURI, data.directory[5].enhancedImageURI);
|
||||
Assert.equal(links[0].enhancedImageURI, data.directory[3].enhancedImageURI);
|
||||
Assert.equal(links[1].enhancedImageURI, data.directory[5].enhancedImageURI);
|
||||
});
|
||||
|
||||
add_task(function test_DirectoryLinksProvider_setDefaultEnhanced() {
|
||||
function checkDefault(expected) {
|
||||
Services.prefs.clearUserPref(kNewtabEnhancedPref);
|
||||
do_check_eq(Services.prefs.getBoolPref(kNewtabEnhancedPref), expected);
|
||||
Assert.equal(Services.prefs.getBoolPref(kNewtabEnhancedPref), expected);
|
||||
}
|
||||
|
||||
// Use the default donottrack prefs (enabled = false)
|
||||
|
@ -530,5 +530,5 @@ add_task(function test_DirectoryLinksProvider_setDefaultEnhanced() {
|
|||
});
|
||||
|
||||
add_task(function test_DirectoryLinksProvider_anonymous() {
|
||||
do_check_true(DirectoryLinksProvider._newXHR().mozAnon);
|
||||
Assert.ok(DirectoryLinksProvider._newXHR().mozAnon);
|
||||
});
|
||||
|
|
|
@ -9,27 +9,27 @@ function makeURI(uri) { return Services.io.newURI(uri); }
|
|||
function checkThrows(f) {
|
||||
var threw = false;
|
||||
try { f(); } catch (e) { threw = true; }
|
||||
do_check_true(threw);
|
||||
Assert.ok(threw);
|
||||
}
|
||||
|
||||
function checkCrossOrigin(a, b) {
|
||||
do_check_false(a.equals(b));
|
||||
do_check_false(a.equalsConsideringDomain(b));
|
||||
do_check_false(a.subsumes(b));
|
||||
do_check_false(a.subsumesConsideringDomain(b));
|
||||
do_check_false(b.subsumes(a));
|
||||
do_check_false(b.subsumesConsideringDomain(a));
|
||||
Assert.ok(!a.equals(b));
|
||||
Assert.ok(!a.equalsConsideringDomain(b));
|
||||
Assert.ok(!a.subsumes(b));
|
||||
Assert.ok(!a.subsumesConsideringDomain(b));
|
||||
Assert.ok(!b.subsumes(a));
|
||||
Assert.ok(!b.subsumesConsideringDomain(a));
|
||||
}
|
||||
|
||||
function checkOriginAttributes(prin, attrs, suffix) {
|
||||
attrs = attrs || {};
|
||||
do_check_eq(prin.originAttributes.appId, attrs.appId || 0);
|
||||
do_check_eq(prin.originAttributes.inIsolatedMozBrowser, attrs.inIsolatedMozBrowser || false);
|
||||
do_check_eq(prin.originSuffix, suffix || "");
|
||||
do_check_eq(ChromeUtils.originAttributesToSuffix(attrs), suffix || "");
|
||||
do_check_true(ChromeUtils.originAttributesMatchPattern(prin.originAttributes, attrs));
|
||||
Assert.equal(prin.originAttributes.appId, attrs.appId || 0);
|
||||
Assert.equal(prin.originAttributes.inIsolatedMozBrowser, attrs.inIsolatedMozBrowser || false);
|
||||
Assert.equal(prin.originSuffix, suffix || "");
|
||||
Assert.equal(ChromeUtils.originAttributesToSuffix(attrs), suffix || "");
|
||||
Assert.ok(ChromeUtils.originAttributesMatchPattern(prin.originAttributes, attrs));
|
||||
if (!prin.isNullPrincipal && !prin.origin.startsWith("[")) {
|
||||
do_check_true(ssm.createCodebasePrincipalFromOrigin(prin.origin).equals(prin));
|
||||
Assert.ok(ssm.createCodebasePrincipalFromOrigin(prin.origin).equals(prin));
|
||||
} else {
|
||||
checkThrows(() => ssm.createCodebasePrincipalFromOrigin(prin.origin));
|
||||
}
|
||||
|
@ -57,31 +57,31 @@ function checkValues(attrs, values) {
|
|||
values = values || {};
|
||||
// printAttrs("attrs", attrs);
|
||||
// printAttrs("values", values);
|
||||
do_check_eq(attrs.appId, values.appId || 0);
|
||||
do_check_eq(attrs.userContextId, values.userContextId || 0);
|
||||
do_check_eq(attrs.inIsolatedMozBrowser, values.inIsolatedMozBrowser || false);
|
||||
do_check_eq(attrs.privateBrowsingId, values.privateBrowsingId || "");
|
||||
do_check_eq(attrs.firstPartyDomain, values.firstPartyDomain || "");
|
||||
Assert.equal(attrs.appId, values.appId || 0);
|
||||
Assert.equal(attrs.userContextId, values.userContextId || 0);
|
||||
Assert.equal(attrs.inIsolatedMozBrowser, values.inIsolatedMozBrowser || false);
|
||||
Assert.equal(attrs.privateBrowsingId, values.privateBrowsingId || "");
|
||||
Assert.equal(attrs.firstPartyDomain, values.firstPartyDomain || "");
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
// Attributeless origins.
|
||||
do_check_eq(ssm.getSystemPrincipal().origin, "[System Principal]");
|
||||
Assert.equal(ssm.getSystemPrincipal().origin, "[System Principal]");
|
||||
checkOriginAttributes(ssm.getSystemPrincipal());
|
||||
var exampleOrg = ssm.createCodebasePrincipal(makeURI("http://example.org"), {});
|
||||
do_check_eq(exampleOrg.origin, "http://example.org");
|
||||
Assert.equal(exampleOrg.origin, "http://example.org");
|
||||
checkOriginAttributes(exampleOrg);
|
||||
var exampleCom = ssm.createCodebasePrincipal(makeURI("https://www.example.com:123"), {});
|
||||
do_check_eq(exampleCom.origin, "https://www.example.com:123");
|
||||
Assert.equal(exampleCom.origin, "https://www.example.com:123");
|
||||
checkOriginAttributes(exampleCom);
|
||||
var nullPrin = Cu.getObjectPrincipal(new Cu.Sandbox(null));
|
||||
do_check_true(/^moz-nullprincipal:\{([0-9]|[a-z]|\-){36}\}$/.test(nullPrin.origin));
|
||||
Assert.ok(/^moz-nullprincipal:\{([0-9]|[a-z]|\-){36}\}$/.test(nullPrin.origin));
|
||||
checkOriginAttributes(nullPrin);
|
||||
var ipv6Prin = ssm.createCodebasePrincipal(makeURI("https://[2001:db8::ff00:42:8329]:123"), {});
|
||||
do_check_eq(ipv6Prin.origin, "https://[2001:db8::ff00:42:8329]:123");
|
||||
Assert.equal(ipv6Prin.origin, "https://[2001:db8::ff00:42:8329]:123");
|
||||
checkOriginAttributes(ipv6Prin);
|
||||
var ipv6NPPrin = ssm.createCodebasePrincipal(makeURI("https://[2001:db8::ff00:42:8329]"), {});
|
||||
do_check_eq(ipv6NPPrin.origin, "https://[2001:db8::ff00:42:8329]");
|
||||
Assert.equal(ipv6NPPrin.origin, "https://[2001:db8::ff00:42:8329]");
|
||||
checkOriginAttributes(ipv6NPPrin);
|
||||
var ep = Cu.getObjectPrincipal(Cu.Sandbox([exampleCom, nullPrin, exampleOrg]));
|
||||
checkOriginAttributes(ep);
|
||||
|
@ -89,10 +89,10 @@ function run_test() {
|
|||
checkCrossOrigin(exampleOrg, nullPrin);
|
||||
|
||||
// nsEP origins should be in lexical order.
|
||||
do_check_eq(ep.origin, `[Expanded Principal [${exampleOrg.origin}, ${exampleCom.origin}, ${nullPrin.origin}]]`);
|
||||
Assert.equal(ep.origin, `[Expanded Principal [${exampleOrg.origin}, ${exampleCom.origin}, ${nullPrin.origin}]]`);
|
||||
|
||||
// Make sure createCodebasePrincipal does what the rest of gecko does.
|
||||
do_check_true(exampleOrg.equals(Cu.getObjectPrincipal(new Cu.Sandbox("http://example.org"))));
|
||||
Assert.ok(exampleOrg.equals(Cu.getObjectPrincipal(new Cu.Sandbox("http://example.org"))));
|
||||
|
||||
//
|
||||
// Test origin attributes.
|
||||
|
@ -103,31 +103,31 @@ function run_test() {
|
|||
var nullPrin_app = ssm.createNullPrincipal({appId: 42});
|
||||
checkOriginAttributes(exampleOrg_app, {appId: 42}, "^appId=42");
|
||||
checkOriginAttributes(nullPrin_app, {appId: 42}, "^appId=42");
|
||||
do_check_eq(exampleOrg_app.origin, "http://example.org^appId=42");
|
||||
Assert.equal(exampleOrg_app.origin, "http://example.org^appId=42");
|
||||
|
||||
// Just browser.
|
||||
var exampleOrg_browser = ssm.createCodebasePrincipal(makeURI("http://example.org"), {inIsolatedMozBrowser: true});
|
||||
var nullPrin_browser = ssm.createNullPrincipal({inIsolatedMozBrowser: true});
|
||||
checkOriginAttributes(exampleOrg_browser, {inIsolatedMozBrowser: true}, "^inBrowser=1");
|
||||
checkOriginAttributes(nullPrin_browser, {inIsolatedMozBrowser: true}, "^inBrowser=1");
|
||||
do_check_eq(exampleOrg_browser.origin, "http://example.org^inBrowser=1");
|
||||
Assert.equal(exampleOrg_browser.origin, "http://example.org^inBrowser=1");
|
||||
|
||||
// App and browser.
|
||||
var exampleOrg_appBrowser = ssm.createCodebasePrincipal(makeURI("http://example.org"), {inIsolatedMozBrowser: true, appId: 42});
|
||||
var nullPrin_appBrowser = ssm.createNullPrincipal({inIsolatedMozBrowser: true, appId: 42});
|
||||
checkOriginAttributes(exampleOrg_appBrowser, {appId: 42, inIsolatedMozBrowser: true}, "^appId=42&inBrowser=1");
|
||||
checkOriginAttributes(nullPrin_appBrowser, {appId: 42, inIsolatedMozBrowser: true}, "^appId=42&inBrowser=1");
|
||||
do_check_eq(exampleOrg_appBrowser.origin, "http://example.org^appId=42&inBrowser=1");
|
||||
Assert.equal(exampleOrg_appBrowser.origin, "http://example.org^appId=42&inBrowser=1");
|
||||
|
||||
// App and browser, different domain.
|
||||
var exampleCom_appBrowser = ssm.createCodebasePrincipal(makeURI("https://www.example.com:123"), {appId: 42, inIsolatedMozBrowser: true});
|
||||
checkOriginAttributes(exampleCom_appBrowser, {appId: 42, inIsolatedMozBrowser: true}, "^appId=42&inBrowser=1");
|
||||
do_check_eq(exampleCom_appBrowser.origin, "https://www.example.com:123^appId=42&inBrowser=1");
|
||||
Assert.equal(exampleCom_appBrowser.origin, "https://www.example.com:123^appId=42&inBrowser=1");
|
||||
|
||||
// First party Uri
|
||||
var exampleOrg_firstPartyDomain = ssm.createCodebasePrincipal(makeURI("http://example.org"), {firstPartyDomain: "example.org"});
|
||||
checkOriginAttributes(exampleOrg_firstPartyDomain, { firstPartyDomain: "example.org" }, "^firstPartyDomain=example.org");
|
||||
do_check_eq(exampleOrg_firstPartyDomain.origin, "http://example.org^firstPartyDomain=example.org");
|
||||
Assert.equal(exampleOrg_firstPartyDomain.origin, "http://example.org^firstPartyDomain=example.org");
|
||||
|
||||
// Make sure we don't crash when serializing principals with UNKNOWN_APP_ID.
|
||||
try {
|
||||
|
@ -139,21 +139,21 @@ function run_test() {
|
|||
binaryStream.writeCompoundObject(simplePrin, Ci.nsISupports, true); // eslint-disable-line no-undef
|
||||
binaryStream.close();
|
||||
} catch (e) {
|
||||
do_check_true(true);
|
||||
Assert.ok(true);
|
||||
}
|
||||
|
||||
|
||||
// Just userContext.
|
||||
var exampleOrg_userContext = ssm.createCodebasePrincipal(makeURI("http://example.org"), {userContextId: 42});
|
||||
checkOriginAttributes(exampleOrg_userContext, { userContextId: 42 }, "^userContextId=42");
|
||||
do_check_eq(exampleOrg_userContext.origin, "http://example.org^userContextId=42");
|
||||
Assert.equal(exampleOrg_userContext.origin, "http://example.org^userContextId=42");
|
||||
|
||||
// UserContext and App.
|
||||
var exampleOrg_userContextApp = ssm.createCodebasePrincipal(makeURI("http://example.org"), {appId: 24, userContextId: 42});
|
||||
var nullPrin_userContextApp = ssm.createNullPrincipal({appId: 24, userContextId: 42});
|
||||
checkOriginAttributes(exampleOrg_userContextApp, {appId: 24, userContextId: 42}, "^appId=24&userContextId=42");
|
||||
checkOriginAttributes(nullPrin_userContextApp, {appId: 24, userContextId: 42}, "^appId=24&userContextId=42");
|
||||
do_check_eq(exampleOrg_userContextApp.origin, "http://example.org^appId=24&userContextId=42");
|
||||
Assert.equal(exampleOrg_userContextApp.origin, "http://example.org^appId=24&userContextId=42");
|
||||
|
||||
checkSandboxOriginAttributes(null, {});
|
||||
checkSandboxOriginAttributes("http://example.org", {});
|
||||
|
@ -177,10 +177,10 @@ function run_test() {
|
|||
|
||||
// Check Principal kinds.
|
||||
function checkKind(prin, kind) {
|
||||
do_check_eq(prin.isNullPrincipal, kind == "nullPrincipal");
|
||||
do_check_eq(prin.isCodebasePrincipal, kind == "codebasePrincipal");
|
||||
do_check_eq(prin.isExpandedPrincipal, kind == "expandedPrincipal");
|
||||
do_check_eq(prin.isSystemPrincipal, kind == "systemPrincipal");
|
||||
Assert.equal(prin.isNullPrincipal, kind == "nullPrincipal");
|
||||
Assert.equal(prin.isCodebasePrincipal, kind == "codebasePrincipal");
|
||||
Assert.equal(prin.isExpandedPrincipal, kind == "expandedPrincipal");
|
||||
Assert.equal(prin.isSystemPrincipal, kind == "systemPrincipal");
|
||||
}
|
||||
checkKind(ssm.createNullPrincipal({}), "nullPrincipal");
|
||||
checkKind(ssm.createCodebasePrincipal(makeURI("http://www.example.com"), {}), "codebasePrincipal");
|
||||
|
@ -210,14 +210,14 @@ function run_test() {
|
|||
tests.forEach(t => {
|
||||
let attrs = ChromeUtils.createOriginAttributesFromOrigin(uri + t[0]);
|
||||
checkValues(attrs, t[1]);
|
||||
do_check_eq(ChromeUtils.originAttributesToSuffix(attrs), t[0]);
|
||||
Assert.equal(ChromeUtils.originAttributesToSuffix(attrs), t[0]);
|
||||
});
|
||||
|
||||
// check that we can create an origin attributes from a dict properly
|
||||
tests.forEach(t => {
|
||||
let attrs = ChromeUtils.fillNonDefaultOriginAttributes(t[1]);
|
||||
checkValues(attrs, t[1]);
|
||||
do_check_eq(ChromeUtils.originAttributesToSuffix(attrs), t[0]);
|
||||
Assert.equal(ChromeUtils.originAttributesToSuffix(attrs), t[0]);
|
||||
});
|
||||
|
||||
// each row in the set_tests array has these values:
|
||||
|
@ -241,7 +241,7 @@ function run_test() {
|
|||
mod[key] = t[2][key];
|
||||
}
|
||||
checkValues(mod, t[3]);
|
||||
do_check_eq(ChromeUtils.originAttributesToSuffix(mod), t[4]);
|
||||
Assert.equal(ChromeUtils.originAttributesToSuffix(mod), t[4]);
|
||||
});
|
||||
|
||||
// each row in the dflt_tests array has these values:
|
||||
|
@ -262,7 +262,7 @@ function run_test() {
|
|||
let mod = orig;
|
||||
mod.userContextId = 0;
|
||||
checkValues(mod, t[2]);
|
||||
do_check_eq(ChromeUtils.originAttributesToSuffix(mod), t[3]);
|
||||
Assert.equal(ChromeUtils.originAttributesToSuffix(mod), t[3]);
|
||||
});
|
||||
|
||||
// each row in the dflt2_tests array has these values:
|
||||
|
@ -283,7 +283,7 @@ function run_test() {
|
|||
let mod = orig;
|
||||
mod.firstPartyDomain = "";
|
||||
checkValues(mod, t[2]);
|
||||
do_check_eq(ChromeUtils.originAttributesToSuffix(mod), t[3]);
|
||||
Assert.equal(ChromeUtils.originAttributesToSuffix(mod), t[3]);
|
||||
});
|
||||
|
||||
var fileURI = makeURI("file:///foo/bar").QueryInterface(Ci.nsIFileURL);
|
||||
|
@ -294,11 +294,11 @@ function run_test() {
|
|||
fileTests.forEach(t => {
|
||||
Services.prefs.setBoolPref("security.fileuri.strict_origin_policy", t[0]);
|
||||
var filePrin = ssm.createCodebasePrincipal(fileURI, {});
|
||||
do_check_eq(filePrin.origin, t[1]);
|
||||
Assert.equal(filePrin.origin, t[1]);
|
||||
});
|
||||
Services.prefs.clearUserPref("security.fileuri.strict_origin_policy");
|
||||
|
||||
var aboutBlankURI = makeURI("about:blank");
|
||||
var aboutBlankPrin = ssm.createCodebasePrincipal(aboutBlankURI, {});
|
||||
do_check_true(/^moz-nullprincipal:\{([0-9]|[a-z]|\-){36}\}$/.test(aboutBlankPrin.origin));
|
||||
Assert.ok(/^moz-nullprincipal:\{([0-9]|[a-z]|\-){36}\}$/.test(aboutBlankPrin.origin));
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ function is_registered(name) {
|
|||
}
|
||||
|
||||
function run_test() {
|
||||
do_check_true(is_registered("test1"));
|
||||
do_check_false(is_registered("test2"));
|
||||
do_check_true(is_registered("test3"));
|
||||
do_check_false(is_registered("test4"));
|
||||
Assert.ok(is_registered("test1"));
|
||||
Assert.ok(!is_registered("test2"));
|
||||
Assert.ok(is_registered("test3"));
|
||||
Assert.ok(!is_registered("test4"));
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ var gCR;
|
|||
function check_accessibility(spec, desired) {
|
||||
var uri = Services.io.newURI(spec);
|
||||
var actual = gCR.allowContentToAccess(uri);
|
||||
do_check_eq(desired, actual);
|
||||
Assert.equal(desired, actual);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -29,7 +29,7 @@ function test_succeeded_mapping(namespace) {
|
|||
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
|
||||
try {
|
||||
var result = chromeReg.convertChromeURL(uri);
|
||||
do_check_eq(result.spec, target);
|
||||
Assert.equal(result.spec, target);
|
||||
} catch (ex) {
|
||||
do_throw(namespace);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ function test_succeeded_mapping(namespace) {
|
|||
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
|
||||
try {
|
||||
var result = chromeReg.convertChromeURL(uri);
|
||||
do_check_eq(result.spec, target);
|
||||
Assert.equal(result.spec, target);
|
||||
} catch (ex) {
|
||||
do_throw(namespace);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ function test_succeeded_mapping(namespace) {
|
|||
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
|
||||
try {
|
||||
var result = chromeReg.convertChromeURL(uri);
|
||||
do_check_eq(result.spec, target);
|
||||
Assert.equal(result.spec, target);
|
||||
} catch (ex) {
|
||||
do_throw(namespace);
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ var rph = Services.io.getProtocolHandler("resource")
|
|||
|
||||
function test_succeeded_mapping(namespace, target) {
|
||||
try {
|
||||
do_check_true(rph.hasSubstitution(namespace));
|
||||
Assert.ok(rph.hasSubstitution(namespace));
|
||||
var uri = Services.io.newURI("resource://" + namespace);
|
||||
dump("### checking for " + target + ", getting " + rph.resolveURI(uri) + "\n");
|
||||
do_check_eq(rph.resolveURI(uri), target);
|
||||
Assert.equal(rph.resolveURI(uri), target);
|
||||
} catch (ex) {
|
||||
dump(ex + "\n");
|
||||
do_throw(namespace);
|
||||
|
@ -37,7 +37,7 @@ function test_succeeded_mapping(namespace, target) {
|
|||
}
|
||||
|
||||
function test_failed_mapping(namespace) {
|
||||
do_check_false(rph.hasSubstitution(namespace));
|
||||
Assert.ok(!rph.hasSubstitution(namespace));
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -22,8 +22,8 @@ function test_uri(obj) {
|
|||
if (failed)
|
||||
do_throw(message);
|
||||
if (obj.result) {
|
||||
do_check_true(uri != null);
|
||||
do_check_eq(uri.spec, obj.uri);
|
||||
Assert.ok(uri != null);
|
||||
Assert.equal(uri.spec, obj.uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ function test_mapping(chromeURL, target) {
|
|||
|
||||
try {
|
||||
var result = gCR.convertChromeURL(uri);
|
||||
do_check_eq(result.spec, target);
|
||||
Assert.equal(result.spec, target);
|
||||
} catch (ex) {
|
||||
do_throw(chromeURL + " not Registered");
|
||||
}
|
||||
|
|
|
@ -31,15 +31,15 @@ function run_test() {
|
|||
|
||||
// without override
|
||||
Services.locale.setRequestedLocales(["de"]);
|
||||
do_check_eq(chromeReg.getSelectedLocale("basepack"), "en-US");
|
||||
do_check_eq(chromeReg.getSelectedLocale("overpack"), "de");
|
||||
do_check_matches(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
|
||||
Assert.equal(chromeReg.getSelectedLocale("basepack"), "en-US");
|
||||
Assert.equal(chromeReg.getSelectedLocale("overpack"), "de");
|
||||
Assert.deepEqual(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
|
||||
["en-US", "fr"]);
|
||||
|
||||
// with override
|
||||
Services.prefs.setCharPref("chrome.override_package.basepack", "overpack");
|
||||
do_check_eq(chromeReg.getSelectedLocale("basepack"), "de");
|
||||
do_check_matches(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
|
||||
Assert.equal(chromeReg.getSelectedLocale("basepack"), "de");
|
||||
Assert.deepEqual(enum_to_array(chromeReg.getLocalesForPackage("basepack")),
|
||||
["de", "en-US"]);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ function run_test() {
|
|||
// this throws for packages that are not registered
|
||||
let file = cr.convertChromeURL(sourceURI).QueryInterface(Ci.nsIFileURL).file;
|
||||
|
||||
do_check_true(file.equals(do_get_file("data/test_crlf.xul", true)));
|
||||
Assert.ok(file.equals(do_get_file("data/test_crlf.xul", true)));
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ function run_test() {
|
|||
// this throws for packages that are not registered
|
||||
let uri = cr.convertChromeURL(sourceURI).spec;
|
||||
|
||||
do_check_eq(expectedURI, uri);
|
||||
Assert.equal(expectedURI, uri);
|
||||
} catch (e) {
|
||||
dump(e + "\n");
|
||||
do_throw("Should have registered our URI!");
|
||||
|
|
|
@ -192,11 +192,11 @@ function run_test() {
|
|||
}
|
||||
|
||||
if (protocol.shouldRegister) {
|
||||
do_check_eq(expectedURI, uri);
|
||||
Assert.equal(expectedURI, uri);
|
||||
} else {
|
||||
// Overrides will not throw, so we'll get to here. We want to make
|
||||
// sure that the two strings are not the same in this situation.
|
||||
do_check_neq(expectedURI, uri);
|
||||
Assert.notEqual(expectedURI, uri);
|
||||
}
|
||||
} catch (e) {
|
||||
if (protocol.shouldRegister) {
|
||||
|
|
|
@ -72,7 +72,7 @@ function do_run_test() {
|
|||
uri = cr.convertChromeURL(sourceURI).spec;
|
||||
}
|
||||
|
||||
do_check_eq(expectedURI, uri);
|
||||
Assert.equal(expectedURI, uri);
|
||||
} catch (e) {
|
||||
dump(e + "\n");
|
||||
do_throw("Should have registered a handler for type '" +
|
||||
|
|
|
@ -60,13 +60,13 @@ function run_test() {
|
|||
let tokens = splitBy(value, splitChar);
|
||||
|
||||
do_print("Checking that the number of parsed tokens is correct");
|
||||
do_check_eq(tokens.length, expected.length);
|
||||
Assert.equal(tokens.length, expected.length);
|
||||
|
||||
for (let i = 0; i < tokens.length; i++) {
|
||||
do_print("Checking the data in token " + i);
|
||||
do_check_eq(tokens[i].value, expected[i].value);
|
||||
Assert.equal(tokens[i].value, expected[i].value);
|
||||
if (expected[i].type) {
|
||||
do_check_eq(tokens[i].type, expected[i].type);
|
||||
Assert.equal(tokens[i].type, expected[i].type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,17 +118,17 @@ function run_test() {
|
|||
];
|
||||
let tokens = parseAttribute(namespaceURI, tagName, attributes, attributeName);
|
||||
if (!expected) {
|
||||
do_check_true(!tokens);
|
||||
Assert.ok(!tokens);
|
||||
continue;
|
||||
}
|
||||
|
||||
do_print("Checking that the number of parsed tokens is correct");
|
||||
do_check_eq(tokens.length, expected.length);
|
||||
Assert.equal(tokens.length, expected.length);
|
||||
|
||||
for (let i = 0; i < tokens.length; i++) {
|
||||
do_print("Checking the data in token " + i);
|
||||
do_check_eq(tokens[i].value, expected[i].value);
|
||||
do_check_eq(tokens[i].type, expected[i].type);
|
||||
Assert.equal(tokens[i].value, expected[i].value);
|
||||
Assert.equal(tokens[i].type, expected[i].type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,27 +23,27 @@ function offsetsGetterReturnsData() {
|
|||
let b = new BezierCanvas(getCanvasMock(), getCubicBezier(), [.25, 0]);
|
||||
let offsets = b.offsets;
|
||||
|
||||
do_check_eq(offsets.length, 2);
|
||||
Assert.equal(offsets.length, 2);
|
||||
|
||||
do_check_true("top" in offsets[0]);
|
||||
do_check_true("left" in offsets[0]);
|
||||
do_check_true("top" in offsets[1]);
|
||||
do_check_true("left" in offsets[1]);
|
||||
Assert.ok("top" in offsets[0]);
|
||||
Assert.ok("left" in offsets[0]);
|
||||
Assert.ok("top" in offsets[1]);
|
||||
Assert.ok("left" in offsets[1]);
|
||||
|
||||
do_check_eq(offsets[0].top, "300px");
|
||||
do_check_eq(offsets[0].left, "0px");
|
||||
do_check_eq(offsets[1].top, "100px");
|
||||
do_check_eq(offsets[1].left, "200px");
|
||||
Assert.equal(offsets[0].top, "300px");
|
||||
Assert.equal(offsets[0].left, "0px");
|
||||
Assert.equal(offsets[1].top, "100px");
|
||||
Assert.equal(offsets[1].left, "200px");
|
||||
|
||||
do_print("offsets getter returns data according to current padding");
|
||||
|
||||
b = new BezierCanvas(getCanvasMock(), getCubicBezier(), [0, 0]);
|
||||
offsets = b.offsets;
|
||||
|
||||
do_check_eq(offsets[0].top, "400px");
|
||||
do_check_eq(offsets[0].left, "0px");
|
||||
do_check_eq(offsets[1].top, "0px");
|
||||
do_check_eq(offsets[1].left, "200px");
|
||||
Assert.equal(offsets[0].top, "400px");
|
||||
Assert.equal(offsets[0].left, "0px");
|
||||
Assert.equal(offsets[1].top, "0px");
|
||||
Assert.equal(offsets[1].left, "200px");
|
||||
}
|
||||
|
||||
function convertsOffsetsToCoordinates() {
|
||||
|
@ -55,23 +55,23 @@ function convertsOffsetsToCoordinates() {
|
|||
left: "0px",
|
||||
top: "0px"
|
||||
}});
|
||||
do_check_eq(coordinates.length, 2);
|
||||
do_check_eq(coordinates[0], 0);
|
||||
do_check_eq(coordinates[1], 1.5);
|
||||
Assert.equal(coordinates.length, 2);
|
||||
Assert.equal(coordinates[0], 0);
|
||||
Assert.equal(coordinates[1], 1.5);
|
||||
|
||||
coordinates = b.offsetsToCoordinates({style: {
|
||||
left: "0px",
|
||||
top: "300px"
|
||||
}});
|
||||
do_check_eq(coordinates[0], 0);
|
||||
do_check_eq(coordinates[1], 0);
|
||||
Assert.equal(coordinates[0], 0);
|
||||
Assert.equal(coordinates[1], 0);
|
||||
|
||||
coordinates = b.offsetsToCoordinates({style: {
|
||||
left: "200px",
|
||||
top: "100px"
|
||||
}});
|
||||
do_check_eq(coordinates[0], 1);
|
||||
do_check_eq(coordinates[1], 1);
|
||||
Assert.equal(coordinates[0], 1);
|
||||
Assert.equal(coordinates[1], 1);
|
||||
}
|
||||
|
||||
function plotsCanvas() {
|
||||
|
@ -84,7 +84,7 @@ function plotsCanvas() {
|
|||
};
|
||||
b.plot();
|
||||
|
||||
do_check_true(hasDrawnCurve);
|
||||
Assert.ok(hasDrawnCurve);
|
||||
}
|
||||
|
||||
function getCubicBezier() {
|
||||
|
|
|
@ -54,10 +54,10 @@ function convertsStringCoordinates() {
|
|||
do_print("Converts string coordinates to numbers");
|
||||
let c = new CubicBezier(["0", "1", ".5", "-2"]);
|
||||
|
||||
do_check_eq(c.coordinates[0], 0);
|
||||
do_check_eq(c.coordinates[1], 1);
|
||||
do_check_eq(c.coordinates[2], .5);
|
||||
do_check_eq(c.coordinates[3], -2);
|
||||
Assert.equal(c.coordinates[0], 0);
|
||||
Assert.equal(c.coordinates[1], 1);
|
||||
Assert.equal(c.coordinates[2], .5);
|
||||
Assert.equal(c.coordinates[3], -2);
|
||||
}
|
||||
|
||||
function coordinatesToStringOutputsAString() {
|
||||
|
@ -65,47 +65,47 @@ function coordinatesToStringOutputsAString() {
|
|||
|
||||
let c = new CubicBezier(["0", "1", "0.5", "-2"]);
|
||||
let string = c.coordinates.toString();
|
||||
do_check_eq(string, "0,1,.5,-2");
|
||||
Assert.equal(string, "0,1,.5,-2");
|
||||
|
||||
c = new CubicBezier([1, 1, 1, 1]);
|
||||
string = c.coordinates.toString();
|
||||
do_check_eq(string, "1,1,1,1");
|
||||
Assert.equal(string, "1,1,1,1");
|
||||
}
|
||||
|
||||
function pointGettersReturnPointCoordinatesArrays() {
|
||||
do_print("Points getters return arrays of coordinates");
|
||||
|
||||
let c = new CubicBezier([0, .2, .5, 1]);
|
||||
do_check_eq(c.P1[0], 0);
|
||||
do_check_eq(c.P1[1], .2);
|
||||
do_check_eq(c.P2[0], .5);
|
||||
do_check_eq(c.P2[1], 1);
|
||||
Assert.equal(c.P1[0], 0);
|
||||
Assert.equal(c.P1[1], .2);
|
||||
Assert.equal(c.P2[0], .5);
|
||||
Assert.equal(c.P2[1], 1);
|
||||
}
|
||||
|
||||
function toStringOutputsCubicBezierValue() {
|
||||
do_print("toString() outputs the cubic-bezier() value");
|
||||
|
||||
let c = new CubicBezier([0, 1, 1, 0]);
|
||||
do_check_eq(c.toString(), "cubic-bezier(0,1,1,0)");
|
||||
Assert.equal(c.toString(), "cubic-bezier(0,1,1,0)");
|
||||
}
|
||||
|
||||
function toStringOutputsCssPresetValues() {
|
||||
do_print("toString() outputs the css predefined values");
|
||||
|
||||
let c = new CubicBezier([0, 0, 1, 1]);
|
||||
do_check_eq(c.toString(), "linear");
|
||||
Assert.equal(c.toString(), "linear");
|
||||
|
||||
c = new CubicBezier([0.25, 0.1, 0.25, 1]);
|
||||
do_check_eq(c.toString(), "ease");
|
||||
Assert.equal(c.toString(), "ease");
|
||||
|
||||
c = new CubicBezier([0.42, 0, 1, 1]);
|
||||
do_check_eq(c.toString(), "ease-in");
|
||||
Assert.equal(c.toString(), "ease-in");
|
||||
|
||||
c = new CubicBezier([0, 0, 0.58, 1]);
|
||||
do_check_eq(c.toString(), "ease-out");
|
||||
Assert.equal(c.toString(), "ease-out");
|
||||
|
||||
c = new CubicBezier([0.42, 0, 0.58, 1]);
|
||||
do_check_eq(c.toString(), "ease-in-out");
|
||||
Assert.equal(c.toString(), "ease-in-out");
|
||||
}
|
||||
|
||||
function testParseTimingFunction() {
|
||||
|
@ -142,5 +142,5 @@ function do_check_throws(cb, info) {
|
|||
hasThrown = true;
|
||||
}
|
||||
|
||||
do_check_true(hasThrown);
|
||||
Assert.ok(hasThrown);
|
||||
}
|
||||
|
|
|
@ -395,10 +395,10 @@ function run_basic_tests() {
|
|||
"string");
|
||||
if (test.throws) {
|
||||
do_print("Exception expected");
|
||||
do_check_true(true);
|
||||
Assert.ok(true);
|
||||
} else {
|
||||
do_print("Exception unexpected\n" + e);
|
||||
do_check_true(false);
|
||||
Assert.ok(false);
|
||||
}
|
||||
}
|
||||
if (output) {
|
||||
|
@ -455,12 +455,12 @@ function run_named_tests() {
|
|||
function assertOutput(actual, expected) {
|
||||
if (actual.length === expected.length) {
|
||||
for (let i = 0; i < expected.length; i++) {
|
||||
do_check_true(!!actual[i]);
|
||||
Assert.ok(!!actual[i]);
|
||||
do_print("Check that the output item has the expected name, " +
|
||||
"value and priority");
|
||||
do_check_eq(expected[i].name, actual[i].name);
|
||||
do_check_eq(expected[i].value, actual[i].value);
|
||||
do_check_eq(expected[i].priority, actual[i].priority);
|
||||
Assert.equal(expected[i].name, actual[i].name);
|
||||
Assert.equal(expected[i].value, actual[i].value);
|
||||
Assert.equal(expected[i].priority, actual[i].priority);
|
||||
deepEqual(expected[i].offsets, actual[i].offsets);
|
||||
if ("commentOffsets" in expected[i]) {
|
||||
deepEqual(expected[i].commentOffsets, actual[i].commentOffsets);
|
||||
|
@ -471,6 +471,6 @@ function assertOutput(actual, expected) {
|
|||
do_print("Actual output contained: {name: " + prop.name + ", value: " +
|
||||
prop.value + ", priority: " + prop.priority + "}");
|
||||
}
|
||||
do_check_eq(actual.length, expected.length);
|
||||
Assert.equal(actual.length, expected.length);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,10 +77,10 @@ function run_test() {
|
|||
"value");
|
||||
if (test.throws) {
|
||||
do_print("Exception expected");
|
||||
do_check_true(true);
|
||||
Assert.ok(true);
|
||||
} else {
|
||||
do_print("Exception unexpected\n" + e);
|
||||
do_check_true(false);
|
||||
Assert.ok(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,6 @@ function run_test() {
|
|||
|
||||
function assertOutput(actual, expected) {
|
||||
do_print("Check that the output has the expected value and priority");
|
||||
do_check_eq(expected.value, actual.value);
|
||||
do_check_eq(expected.priority, actual.priority);
|
||||
Assert.equal(expected.value, actual.value);
|
||||
Assert.equal(expected.priority, actual.priority);
|
||||
}
|
||||
|
|
|
@ -32,67 +32,67 @@ function run_test() {
|
|||
});
|
||||
}
|
||||
|
||||
do_check_false(stack.canUndo());
|
||||
do_check_false(stack.canRedo());
|
||||
Assert.ok(!stack.canUndo());
|
||||
Assert.ok(!stack.canRedo());
|
||||
|
||||
// Check adding up to the limit of the size
|
||||
add("a");
|
||||
do_check_true(stack.canUndo());
|
||||
do_check_false(stack.canRedo());
|
||||
Assert.ok(stack.canUndo());
|
||||
Assert.ok(!stack.canRedo());
|
||||
|
||||
add("b");
|
||||
add("c");
|
||||
add("d");
|
||||
add("e");
|
||||
|
||||
do_check_eq(str, "abcde");
|
||||
Assert.equal(str, "abcde");
|
||||
|
||||
// Check a simple undo+redo
|
||||
stack.undo();
|
||||
|
||||
do_check_eq(str, "abcd");
|
||||
do_check_true(stack.canRedo());
|
||||
Assert.equal(str, "abcd");
|
||||
Assert.ok(stack.canRedo());
|
||||
|
||||
stack.redo();
|
||||
do_check_eq(str, "abcde");
|
||||
do_check_false(stack.canRedo());
|
||||
Assert.equal(str, "abcde");
|
||||
Assert.ok(!stack.canRedo());
|
||||
|
||||
// Check an undo followed by a new action
|
||||
stack.undo();
|
||||
do_check_eq(str, "abcd");
|
||||
Assert.equal(str, "abcd");
|
||||
|
||||
add("q");
|
||||
do_check_eq(str, "abcdq");
|
||||
do_check_false(stack.canRedo());
|
||||
Assert.equal(str, "abcdq");
|
||||
Assert.ok(!stack.canRedo());
|
||||
|
||||
stack.undo();
|
||||
do_check_eq(str, "abcd");
|
||||
Assert.equal(str, "abcd");
|
||||
stack.redo();
|
||||
do_check_eq(str, "abcdq");
|
||||
Assert.equal(str, "abcdq");
|
||||
|
||||
// Revert back to the beginning of the queue...
|
||||
while (stack.canUndo()) {
|
||||
stack.undo();
|
||||
}
|
||||
do_check_eq(str, "");
|
||||
Assert.equal(str, "");
|
||||
|
||||
// Now put it all back....
|
||||
while (stack.canRedo()) {
|
||||
stack.redo();
|
||||
}
|
||||
do_check_eq(str, "abcdq");
|
||||
Assert.equal(str, "abcdq");
|
||||
|
||||
// Now go over the undo limit...
|
||||
add("1");
|
||||
add("2");
|
||||
add("3");
|
||||
|
||||
do_check_eq(str, "abcdq123");
|
||||
Assert.equal(str, "abcdq123");
|
||||
|
||||
// And now undoing the whole stack should only undo 5 actions.
|
||||
while (stack.canUndo()) {
|
||||
stack.undo();
|
||||
}
|
||||
|
||||
do_check_eq(str, "abc");
|
||||
Assert.equal(str, "abc");
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ function run_test() {
|
|||
const files = [{ type: "full", name: "test", text: code }];
|
||||
|
||||
server.request({ query: query, files: files }, (error, response) => {
|
||||
do_check_eq(error, null);
|
||||
do_check_true(!!response);
|
||||
do_check_true(Array.isArray(response.completions));
|
||||
do_check_true(response.completions.indexOf("concat") != -1);
|
||||
Assert.equal(error, null);
|
||||
Assert.ok(!!response);
|
||||
Assert.ok(Array.isArray(response.completions));
|
||||
Assert.ok(response.completions.indexOf("concat") != -1);
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ function run_test() {
|
|||
const tern = require("devtools/client/sourceeditor/tern/tern");
|
||||
const ecma5 = require("devtools/client/sourceeditor/tern/ecma5");
|
||||
const browser = require("devtools/client/sourceeditor/tern/browser");
|
||||
do_check_true(!!tern);
|
||||
do_check_true(!!ecma5);
|
||||
do_check_true(!!browser);
|
||||
do_check_eq(typeof tern.Server, "function");
|
||||
Assert.ok(!!tern);
|
||||
Assert.ok(!!ecma5);
|
||||
Assert.ok(!!browser);
|
||||
Assert.equal(typeof tern.Server, "function");
|
||||
}
|
||||
|
|
|
@ -24,13 +24,13 @@ function run_test() {
|
|||
}
|
||||
|
||||
function test_nesting() {
|
||||
do_check_eq(inspector.eventLoopNestLevel, 0);
|
||||
Assert.equal(inspector.eventLoopNestLevel, 0);
|
||||
|
||||
tm.dispatchToMainThread({ run: enterEventLoop});
|
||||
|
||||
do_check_eq(inspector.enterNestedEventLoop(requestor(gCount)), 0);
|
||||
do_check_eq(inspector.eventLoopNestLevel, 0);
|
||||
do_check_eq(inspector.lastNestRequestor, null);
|
||||
Assert.equal(inspector.enterNestedEventLoop(requestor(gCount)), 0);
|
||||
Assert.equal(inspector.eventLoopNestLevel, 0);
|
||||
Assert.equal(inspector.lastNestRequestor, null);
|
||||
}
|
||||
|
||||
function enterEventLoop() {
|
||||
|
@ -39,25 +39,25 @@ function enterEventLoop() {
|
|||
|
||||
Object.create(requestor(gCount));
|
||||
|
||||
do_check_eq(inspector.eventLoopNestLevel, gCount);
|
||||
do_check_eq(inspector.lastNestRequestor.url, requestor(gCount - 1).url);
|
||||
do_check_eq(inspector.lastNestRequestor.connection, requestor(gCount - 1).connection);
|
||||
do_check_eq(inspector.enterNestedEventLoop(requestor(gCount)), gCount);
|
||||
Assert.equal(inspector.eventLoopNestLevel, gCount);
|
||||
Assert.equal(inspector.lastNestRequestor.url, requestor(gCount - 1).url);
|
||||
Assert.equal(inspector.lastNestRequestor.connection, requestor(gCount - 1).connection);
|
||||
Assert.equal(inspector.enterNestedEventLoop(requestor(gCount)), gCount);
|
||||
} else {
|
||||
do_check_eq(gCount, MAX + 1);
|
||||
Assert.equal(gCount, MAX + 1);
|
||||
tm.dispatchToMainThread({ run: exitEventLoop});
|
||||
}
|
||||
}
|
||||
|
||||
function exitEventLoop() {
|
||||
if (inspector.lastNestRequestor != null) {
|
||||
do_check_eq(inspector.lastNestRequestor.url, requestor(gCount - 1).url);
|
||||
do_check_eq(inspector.lastNestRequestor.connection, requestor(gCount - 1).connection);
|
||||
Assert.equal(inspector.lastNestRequestor.url, requestor(gCount - 1).url);
|
||||
Assert.equal(inspector.lastNestRequestor.connection, requestor(gCount - 1).connection);
|
||||
if (gCount-- > 1) {
|
||||
tm.dispatchToMainThread({ run: exitEventLoop});
|
||||
}
|
||||
|
||||
do_check_eq(inspector.exitNestedEventLoop(), gCount);
|
||||
do_check_eq(inspector.eventLoopNestLevel, gCount);
|
||||
Assert.equal(inspector.exitNestedEventLoop(), gCount);
|
||||
Assert.equal(inspector.eventLoopNestLevel, gCount);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -330,11 +330,11 @@ function check_except(func) {
|
|||
try {
|
||||
func();
|
||||
} catch (e) {
|
||||
do_check_true(true);
|
||||
Assert.ok(true);
|
||||
return;
|
||||
}
|
||||
dumpn("Should have thrown an exception: " + func.toString());
|
||||
do_check_true(false);
|
||||
Assert.ok(false);
|
||||
}
|
||||
|
||||
function testGlobal(name) {
|
||||
|
@ -565,13 +565,13 @@ TracingTransport.prototype = {
|
|||
|
||||
expectSend: function (expected) {
|
||||
let packet = this.packets[this.checkIndex++];
|
||||
do_check_eq(packet.type, "sent");
|
||||
Assert.equal(packet.type, "sent");
|
||||
deepEqual(packet.packet, this.normalize(expected));
|
||||
},
|
||||
|
||||
expectReceive: function (expected) {
|
||||
let packet = this.packets[this.checkIndex++];
|
||||
do_check_eq(packet.type, "received");
|
||||
Assert.equal(packet.type, "received");
|
||||
deepEqual(packet.packet, this.normalize(expected));
|
||||
},
|
||||
|
||||
|
|
|
@ -44,18 +44,18 @@ function registerNewActor() {
|
|||
.then(talkToNewActor)
|
||||
.catch(e => {
|
||||
DevToolsUtils.reportException("registerNewActor", e);
|
||||
do_check_true(false);
|
||||
Assert.ok(false);
|
||||
});
|
||||
}
|
||||
|
||||
function talkToNewActor() {
|
||||
gClient.listTabs(({ helloActor }) => {
|
||||
do_check_true(!!helloActor);
|
||||
Assert.ok(!!helloActor);
|
||||
gClient.request({
|
||||
to: helloActor,
|
||||
type: "hello"
|
||||
}, response => {
|
||||
do_check_true(!response.error);
|
||||
Assert.ok(!response.error);
|
||||
unregisterNewActor();
|
||||
});
|
||||
});
|
||||
|
@ -67,13 +67,13 @@ function unregisterNewActor() {
|
|||
.then(testActorIsUnregistered)
|
||||
.catch(e => {
|
||||
DevToolsUtils.reportException("unregisterNewActor", e);
|
||||
do_check_true(false);
|
||||
Assert.ok(false);
|
||||
});
|
||||
}
|
||||
|
||||
function testActorIsUnregistered() {
|
||||
gClient.listTabs(({ helloActor }) => {
|
||||
do_check_true(!helloActor);
|
||||
Assert.ok(!helloActor);
|
||||
|
||||
Services.prefs.setBoolPref("devtools.debugger.forbid-certified-apps", gOldPref);
|
||||
finishClient(gClient);
|
||||
|
|
|
@ -46,7 +46,7 @@ function init() {
|
|||
function test_pre_init_global_actor() {
|
||||
gClient.request({ to: gActors.preInitGlobalActor, type: "ping" },
|
||||
function onResponse(response) {
|
||||
do_check_eq(response.message, "pong");
|
||||
Assert.equal(response.message, "pong");
|
||||
run_next_test();
|
||||
}
|
||||
);
|
||||
|
@ -55,7 +55,7 @@ function test_pre_init_global_actor() {
|
|||
function test_pre_init_tab_actor() {
|
||||
gClient.request({ to: gActors.preInitTabActor, type: "ping" },
|
||||
function onResponse(response) {
|
||||
do_check_eq(response.message, "pong");
|
||||
Assert.equal(response.message, "pong");
|
||||
run_next_test();
|
||||
}
|
||||
);
|
||||
|
@ -64,7 +64,7 @@ function test_pre_init_tab_actor() {
|
|||
function test_post_init_global_actor() {
|
||||
gClient.request({ to: gActors.postInitGlobalActor, type: "ping" },
|
||||
function onResponse(response) {
|
||||
do_check_eq(response.message, "pong");
|
||||
Assert.equal(response.message, "pong");
|
||||
run_next_test();
|
||||
}
|
||||
);
|
||||
|
@ -73,7 +73,7 @@ function test_post_init_global_actor() {
|
|||
function test_post_init_tab_actor() {
|
||||
gClient.request({ to: gActors.postInitTabActor, type: "ping" },
|
||||
function onResponse(response) {
|
||||
do_check_eq(response.message, "pong");
|
||||
Assert.equal(response.message, "pong");
|
||||
run_next_test();
|
||||
}
|
||||
);
|
||||
|
@ -91,10 +91,10 @@ function test_stable_global_actor_instances() {
|
|||
let postInitGlobalActor = getActorInstance(connID, gActors.postInitGlobalActor);
|
||||
let preInitGlobalActor = getActorInstance(connID, gActors.preInitGlobalActor);
|
||||
gClient.listTabs(function onListTabs(response) {
|
||||
do_check_eq(postInitGlobalActor,
|
||||
getActorInstance(connID, response.postInitGlobalActor));
|
||||
do_check_eq(preInitGlobalActor,
|
||||
getActorInstance(connID, response.preInitGlobalActor));
|
||||
Assert.equal(postInitGlobalActor,
|
||||
getActorInstance(connID, response.postInitGlobalActor));
|
||||
Assert.equal(preInitGlobalActor,
|
||||
getActorInstance(connID, response.preInitGlobalActor));
|
||||
run_next_test();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -82,6 +82,6 @@ function run_test() {
|
|||
animation[key] = props[key];
|
||||
}
|
||||
let actor = AnimationPlayerActor({}, animation);
|
||||
do_check_eq(actor.getName(), expectedName);
|
||||
Assert.equal(actor.getName(), expectedName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,6 @@ function run_test() {
|
|||
for (let { desc, animation, expectedType } of TEST_DATA) {
|
||||
do_print(desc);
|
||||
let actor = AnimationPlayerActor({}, animation);
|
||||
do_check_eq(actor.getType(), expectedType);
|
||||
Assert.equal(actor.getType(), expectedType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ function run_test() {
|
|||
|
||||
function test_attach(tabClient) {
|
||||
tabClient.attachThread({}, function (response, threadClient) {
|
||||
do_check_eq(threadClient.state, "paused");
|
||||
Assert.equal(threadClient.state, "paused");
|
||||
threadClient.resume(cleanup);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -40,52 +40,52 @@ const testBlackBox = Task.async(function* () {
|
|||
const { sources } = yield getSources(gThreadClient);
|
||||
let sourceClient = gThreadClient.source(
|
||||
sources.filter(s => s.url == BLACK_BOXED_URL)[0]);
|
||||
do_check_true(!sourceClient.isBlackBoxed,
|
||||
"By default the source is not black boxed.");
|
||||
Assert.ok(!sourceClient.isBlackBoxed,
|
||||
"By default the source is not black boxed.");
|
||||
|
||||
// Test that we can step into `doStuff` when we are not black boxed.
|
||||
yield runTest(
|
||||
function onSteppedLocation(location) {
|
||||
do_check_eq(location.source.url, BLACK_BOXED_URL);
|
||||
do_check_eq(location.line, 2);
|
||||
Assert.equal(location.source.url, BLACK_BOXED_URL);
|
||||
Assert.equal(location.line, 2);
|
||||
},
|
||||
function onDebuggerStatementFrames(frames) {
|
||||
do_check_true(!frames.some(f => f.where.source.isBlackBoxed));
|
||||
Assert.ok(!frames.some(f => f.where.source.isBlackBoxed));
|
||||
}
|
||||
);
|
||||
|
||||
yield blackBox(sourceClient);
|
||||
do_check_true(sourceClient.isBlackBoxed);
|
||||
Assert.ok(sourceClient.isBlackBoxed);
|
||||
|
||||
// Test that we step through `doStuff` when we are black boxed and its frame
|
||||
// doesn't show up.
|
||||
yield runTest(
|
||||
function onSteppedLocation(location) {
|
||||
do_check_eq(location.source.url, SOURCE_URL);
|
||||
do_check_eq(location.line, 4);
|
||||
Assert.equal(location.source.url, SOURCE_URL);
|
||||
Assert.equal(location.line, 4);
|
||||
},
|
||||
function onDebuggerStatementFrames(frames) {
|
||||
for (let f of frames) {
|
||||
if (f.where.source.url == BLACK_BOXED_URL) {
|
||||
do_check_true(f.where.source.isBlackBoxed);
|
||||
Assert.ok(f.where.source.isBlackBoxed);
|
||||
} else {
|
||||
do_check_true(!f.where.source.isBlackBoxed);
|
||||
Assert.ok(!f.where.source.isBlackBoxed);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
yield unBlackBox(sourceClient);
|
||||
do_check_true(!sourceClient.isBlackBoxed);
|
||||
Assert.ok(!sourceClient.isBlackBoxed);
|
||||
|
||||
// Test that we can step into `doStuff` again.
|
||||
yield runTest(
|
||||
function onSteppedLocation(location) {
|
||||
do_check_eq(location.source.url, BLACK_BOXED_URL);
|
||||
do_check_eq(location.line, 2);
|
||||
Assert.equal(location.source.url, BLACK_BOXED_URL);
|
||||
Assert.equal(location.line, 2);
|
||||
},
|
||||
function onDebuggerStatementFrames(frames) {
|
||||
do_check_true(!frames.some(f => f.where.source.isBlackBoxed));
|
||||
Assert.ok(!frames.some(f => f.where.source.isBlackBoxed));
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -125,7 +125,7 @@ function evalCode() {
|
|||
const runTest = Task.async(function* (onSteppedLocation, onDebuggerStatementFrames) {
|
||||
let packet = yield executeOnNextTickAndWaitForPause(gDebuggee.runTest,
|
||||
gClient);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
|
||||
yield stepIn(gClient, gThreadClient);
|
||||
yield stepIn(gClient, gThreadClient);
|
||||
|
@ -135,7 +135,7 @@ const runTest = Task.async(function* (onSteppedLocation, onDebuggerStatementFram
|
|||
onSteppedLocation(location);
|
||||
|
||||
packet = yield resumeAndWaitForPause(gClient, gThreadClient);
|
||||
do_check_eq(packet.why.type, "debuggerStatement");
|
||||
Assert.equal(packet.why.type, "debuggerStatement");
|
||||
|
||||
let { frames } = yield getFrames(gThreadClient, 0, 100);
|
||||
onDebuggerStatementFrames(frames);
|
||||
|
|
|
@ -46,7 +46,7 @@ function test_black_box() {
|
|||
source.setBreakpoint({
|
||||
line: 2
|
||||
}, function (response) {
|
||||
do_check_true(!response.error, "Should be able to set breakpoint.");
|
||||
Assert.ok(!response.error, "Should be able to set breakpoint.");
|
||||
gThreadClient.resume(test_black_box_breakpoint);
|
||||
});
|
||||
}
|
||||
|
@ -83,15 +83,15 @@ function test_black_box() {
|
|||
|
||||
function test_black_box_breakpoint() {
|
||||
gThreadClient.getSources(function ({error, sources}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
let sourceClient = gThreadClient.source(
|
||||
sources.filter(s => s.url == BLACK_BOXED_URL)[0]
|
||||
);
|
||||
sourceClient.blackBox(function ({error}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
|
||||
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||
do_check_eq(
|
||||
Assert.equal(
|
||||
packet.why.type, "debuggerStatement",
|
||||
"We should pass over the breakpoint since the source is black boxed.");
|
||||
gThreadClient.resume(test_unblack_box_breakpoint.bind(null, sourceClient));
|
||||
|
@ -103,10 +103,10 @@ function test_black_box_breakpoint() {
|
|||
|
||||
function test_unblack_box_breakpoint(sourceClient) {
|
||||
sourceClient.unblackBox(function ({error}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||
do_check_eq(packet.why.type, "breakpoint",
|
||||
"We should hit the breakpoint again");
|
||||
Assert.equal(packet.why.type, "breakpoint",
|
||||
"We should hit the breakpoint again");
|
||||
|
||||
// We will hit the debugger statement on resume, so do this
|
||||
// nastiness to skip over it.
|
||||
|
|
|
@ -37,7 +37,7 @@ function test_black_box() {
|
|||
line: 4
|
||||
}, function ({error}, bpClient) {
|
||||
gBpClient = bpClient;
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
gThreadClient.resume(test_black_box_dbg_statement);
|
||||
});
|
||||
});
|
||||
|
@ -73,19 +73,19 @@ function test_black_box() {
|
|||
|
||||
function test_black_box_dbg_statement() {
|
||||
gThreadClient.getSources(function ({error, sources}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
let sourceClient = gThreadClient.source(
|
||||
sources.filter(s => s.url == BLACK_BOXED_URL)[0]
|
||||
);
|
||||
|
||||
sourceClient.blackBox(function ({error}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
|
||||
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||
do_check_eq(packet.why.type, "breakpoint",
|
||||
"We should pass over the debugger statement.");
|
||||
Assert.equal(packet.why.type, "breakpoint",
|
||||
"We should pass over the debugger statement.");
|
||||
gBpClient.remove(function ({error}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
gThreadClient.resume(test_unblack_box_dbg_statement.bind(null, sourceClient));
|
||||
});
|
||||
});
|
||||
|
@ -96,11 +96,11 @@ function test_black_box_dbg_statement() {
|
|||
|
||||
function test_unblack_box_dbg_statement(sourceClient) {
|
||||
sourceClient.unblackBox(function ({error}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
|
||||
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||
do_check_eq(packet.why.type, "debuggerStatement",
|
||||
"We should stop at the debugger statement again");
|
||||
Assert.equal(packet.why.type, "debuggerStatement",
|
||||
"We should stop at the debugger statement again");
|
||||
finishClient(gClient);
|
||||
});
|
||||
gDebuggee.runTest();
|
||||
|
|
|
@ -43,7 +43,7 @@ function test_black_box() {
|
|||
source.setBreakpoint({
|
||||
line: 2
|
||||
}, function (response) {
|
||||
do_check_true(!response.error, "Should be able to set breakpoint.");
|
||||
Assert.ok(!response.error, "Should be able to set breakpoint.");
|
||||
test_black_box_paused();
|
||||
});
|
||||
}
|
||||
|
@ -80,15 +80,15 @@ function test_black_box() {
|
|||
|
||||
function test_black_box_paused() {
|
||||
gThreadClient.getSources(function ({error, sources}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
let sourceClient = gThreadClient.source(
|
||||
sources.filter(s => s.url == BLACK_BOXED_URL)[0]
|
||||
);
|
||||
|
||||
sourceClient.blackBox(function ({error, pausedInSource}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
do_check_true(pausedInSource,
|
||||
"We should be notified that we are currently paused in this source");
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
Assert.ok(pausedInSource,
|
||||
"We should be notified that we are currently paused in this source");
|
||||
finishClient(gClient);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -70,18 +70,18 @@ function test_black_box() {
|
|||
|
||||
function test_black_box_exception() {
|
||||
gThreadClient.getSources(function ({error, sources}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
let sourceClient = gThreadClient.source(
|
||||
sources.filter(s => s.url == BLACK_BOXED_URL)[0]
|
||||
);
|
||||
|
||||
sourceClient.blackBox(function ({error}) {
|
||||
do_check_true(!error, "Should not get an error: " + error);
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
gThreadClient.pauseOnExceptions(true);
|
||||
|
||||
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||
do_check_eq(packet.frame.where.source.url, SOURCE_URL,
|
||||
"We shouldn't pause while in the black boxed source.");
|
||||
Assert.equal(packet.frame.where.source.url, SOURCE_URL,
|
||||
"We shouldn't pause while in the black boxed source.");
|
||||
finishClient(gClient);
|
||||
});
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ function run_test() {
|
|||
.then(run_code)
|
||||
.then(test_correct_location)
|
||||
.catch(function (error) {
|
||||
do_check_true(false, "Should not get an error, got " + error);
|
||||
Assert.ok(false, "Should not get an error, got " + error);
|
||||
})
|
||||
.then(function () {
|
||||
finishClient(gClient);
|
||||
|
@ -73,14 +73,14 @@ function black_box_code() {
|
|||
const d = defer();
|
||||
|
||||
gThreadClient.getSources(function ({ sources, error }) {
|
||||
do_check_true(!error, "Shouldn't get an error getting sources");
|
||||
Assert.ok(!error, "Shouldn't get an error getting sources");
|
||||
const source = sources.filter((s) => {
|
||||
return s.url.indexOf("b.js") !== -1;
|
||||
})[0];
|
||||
do_check_true(!!source, "We should have our source in the sources list");
|
||||
Assert.ok(!!source, "We should have our source in the sources list");
|
||||
|
||||
gThreadClient.source(source).blackBox(function ({ error }) {
|
||||
do_check_true(!error, "Should not get an error black boxing");
|
||||
Assert.ok(!error, "Should not get an error black boxing");
|
||||
d.resolve(true);
|
||||
});
|
||||
});
|
||||
|
@ -101,9 +101,9 @@ function run_code() {
|
|||
}
|
||||
|
||||
function test_correct_location(packet) {
|
||||
do_check_eq(packet.why.type, "debuggerStatement",
|
||||
"Should hit a debugger statement.");
|
||||
do_check_eq(packet.frame.where.source.url, "http://example.com/c.js",
|
||||
"Should have skipped over the debugger statement in the" +
|
||||
" black boxed source");
|
||||
Assert.equal(packet.why.type, "debuggerStatement",
|
||||
"Should hit a debugger statement.");
|
||||
Assert.equal(packet.frame.where.source.url, "http://example.com/c.js",
|
||||
"Should have skipped over the debugger statement in the" +
|
||||
" black boxed source");
|
||||
}
|
||||
|
|
|
@ -43,14 +43,14 @@ function test_simple_breakpoint() {
|
|||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
Assert.equal(gDebuggee.a, 1);
|
||||
Assert.equal(gDebuggee.b, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -42,15 +42,15 @@ function test_breakpoint_running() {
|
|||
|
||||
// Setting the breakpoint later should interrupt the debuggee.
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "interrupted");
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "interrupted");
|
||||
});
|
||||
|
||||
let source = gThreadClient.source(packet.frame.where.source);
|
||||
source.setBreakpoint(location, function (response) {
|
||||
// Eval scripts don't stick around long enough for the breakpoint to be set,
|
||||
// so just make sure we got the expected response from the actor.
|
||||
do_check_neq(response.error, "noScript");
|
||||
Assert.notEqual(response.error, "noScript");
|
||||
|
||||
do_execute_soon(function () {
|
||||
gClient.close().then(gCallback);
|
||||
|
|
|
@ -42,8 +42,8 @@ var test_no_skip_breakpoint = Task.async(function* (source, location) {
|
|||
Object.assign({}, location, { noSliding: true })
|
||||
);
|
||||
|
||||
do_check_true(!response.actualLocation);
|
||||
do_check_eq(bpClient.location.line, gDebuggee.line0 + 3);
|
||||
Assert.ok(!response.actualLocation);
|
||||
Assert.equal(bpClient.location.line, gDebuggee.line0 + 3);
|
||||
yield bpClient.remove();
|
||||
});
|
||||
|
||||
|
@ -58,20 +58,20 @@ var test_skip_breakpoint = function () {
|
|||
|
||||
// Now make sure that the breakpoint properly slides forward one line.
|
||||
const [response, bpClient] = yield source.setBreakpoint(location);
|
||||
do_check_true(!!response.actualLocation);
|
||||
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||
Assert.ok(!!response.actualLocation);
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
Assert.equal(gDebuggee.a, 1);
|
||||
Assert.equal(gDebuggee.b, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -41,18 +41,18 @@ function test_child_breakpoint() {
|
|||
|
||||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
// actualLocation is not returned when breakpoints don't skip forward.
|
||||
do_check_eq(response.actualLocation, undefined);
|
||||
Assert.equal(response.actualLocation, undefined);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
Assert.equal(gDebuggee.a, 1);
|
||||
Assert.equal(gDebuggee.b, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -42,19 +42,19 @@ function test_child_skip_breakpoint() {
|
|||
|
||||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
// Check that the breakpoint has properly skipped forward one line.
|
||||
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
Assert.equal(gDebuggee.a, 1);
|
||||
Assert.equal(gDebuggee.b, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -42,19 +42,19 @@ function test_nested_breakpoint() {
|
|||
|
||||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
// Check that the breakpoint has properly skipped forward one line.
|
||||
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
Assert.equal(gDebuggee.a, 1);
|
||||
Assert.equal(gDebuggee.b, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -42,19 +42,19 @@ function test_second_child_skip_breakpoint() {
|
|||
|
||||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
// Check that the breakpoint has properly skipped forward one line.
|
||||
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
Assert.equal(gDebuggee.a, 1);
|
||||
Assert.equal(gDebuggee.b, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -50,19 +50,19 @@ function test_child_skip_breakpoint() {
|
|||
|
||||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
// Check that the breakpoint has properly skipped forward one line.
|
||||
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
Assert.equal(gDebuggee.a, 1);
|
||||
Assert.equal(gDebuggee.b, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -43,13 +43,13 @@ function test_remove_breakpoint() {
|
|||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a, undefined);
|
||||
Assert.equal(gDebuggee.a, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
@ -58,7 +58,7 @@ function test_remove_breakpoint() {
|
|||
function (event, packet) {
|
||||
// The breakpoint should not be hit again.
|
||||
gThreadClient.resume(function () {
|
||||
do_check_true(false);
|
||||
Assert.ok(false);
|
||||
});
|
||||
});
|
||||
gThreadClient.resume();
|
||||
|
@ -82,7 +82,7 @@ function test_remove_breakpoint() {
|
|||
gDebuggee);
|
||||
/* eslint-enable */
|
||||
if (!done) {
|
||||
do_check_true(false);
|
||||
Assert.ok(false);
|
||||
}
|
||||
gClient.close().then(gCallback);
|
||||
}
|
||||
|
|
|
@ -42,23 +42,23 @@ function test_child_breakpoint() {
|
|||
|
||||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
// actualLocation is not returned when breakpoints don't skip forward.
|
||||
do_check_eq(response.actualLocation, undefined);
|
||||
Assert.equal(response.actualLocation, undefined);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.i, 0);
|
||||
Assert.equal(gDebuggee.i, 0);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.i, 1);
|
||||
Assert.equal(gDebuggee.i, 1);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -42,24 +42,24 @@ function test_child_breakpoint() {
|
|||
|
||||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
// actualLocation is not returned when breakpoints don't skip forward.
|
||||
do_check_eq(response.actualLocation, undefined);
|
||||
Assert.equal(response.actualLocation, undefined);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a, undefined);
|
||||
Assert.equal(gDebuggee.a, undefined);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a.b, 1);
|
||||
do_check_eq(gDebuggee.res, undefined);
|
||||
Assert.equal(gDebuggee.a.b, 1);
|
||||
Assert.equal(gDebuggee.res, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -46,8 +46,8 @@ function test_child_skip_breakpoint() {
|
|||
|
||||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
// Check that the breakpoint has properly skipped forward one line.
|
||||
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
gBpActor = response.actor;
|
||||
|
||||
// Set more breakpoints at the same location.
|
||||
|
@ -70,13 +70,13 @@ function test_child_skip_breakpoint() {
|
|||
|
||||
// Set many breakpoints at the same location.
|
||||
function set_breakpoints(source, location) {
|
||||
do_check_neq(gCount, NUM_BREAKPOINTS);
|
||||
Assert.notEqual(gCount, NUM_BREAKPOINTS);
|
||||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
// Check that the breakpoint has properly skipped forward one line.
|
||||
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
// Check that the same breakpoint actor was returned.
|
||||
do_check_eq(response.actor, gBpActor);
|
||||
Assert.equal(response.actor, gBpActor);
|
||||
|
||||
if (++gCount < NUM_BREAKPOINTS) {
|
||||
set_breakpoints(source, location);
|
||||
|
@ -87,18 +87,18 @@ function set_breakpoints(source, location) {
|
|||
// remained.
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
// Check that the breakpoint worked.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
Assert.equal(gDebuggee.a, 1);
|
||||
Assert.equal(gDebuggee.b, undefined);
|
||||
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// We don't expect any more pauses after the breakpoint was hit once.
|
||||
do_check_true(false);
|
||||
Assert.ok(false);
|
||||
});
|
||||
gThreadClient.resume(function () {
|
||||
// Give any remaining breakpoints a chance to trigger.
|
||||
|
|
|
@ -44,48 +44,48 @@ function test_simple_breakpoint() {
|
|||
const testCallbacks = [
|
||||
function (packet) {
|
||||
// Check that the stepping worked.
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
},
|
||||
function (packet) {
|
||||
// Entered the foo function call frame.
|
||||
do_check_eq(packet.frame.where.line, location.line);
|
||||
do_check_neq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
Assert.notEqual(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
},
|
||||
function (packet) {
|
||||
// At the end of the foo function call frame.
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||
do_check_neq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||
Assert.notEqual(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
},
|
||||
function (packet) {
|
||||
// Check that the breakpoint wasn't the reason for this pause, but
|
||||
// that the frame is about to be popped while stepping.
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||
do_check_neq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
do_check_eq(packet.why.frameFinished.return.type, "undefined");
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||
Assert.notEqual(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.why.frameFinished.return.type, "undefined");
|
||||
},
|
||||
function (packet) {
|
||||
// The foo function call frame was just popped from the stack.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
do_check_eq(packet.poppedFrames.length, 1);
|
||||
Assert.equal(gDebuggee.a, 1);
|
||||
Assert.equal(gDebuggee.b, undefined);
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.poppedFrames.length, 1);
|
||||
},
|
||||
function (packet) {
|
||||
// Check that the debugger statement wasn't the reason for this pause.
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 6);
|
||||
do_check_neq(packet.why.type, "debuggerStatement");
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 6);
|
||||
Assert.notEqual(packet.why.type, "debuggerStatement");
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
},
|
||||
function (packet) {
|
||||
// Check that the debugger statement wasn't the reason for this pause.
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 7);
|
||||
do_check_neq(packet.why.type, "debuggerStatement");
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 7);
|
||||
Assert.notEqual(packet.why.type, "debuggerStatement");
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -44,46 +44,46 @@ function test_simple_breakpoint() {
|
|||
const testCallbacks = [
|
||||
function (packet) {
|
||||
// Check that the stepping worked.
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
},
|
||||
function (packet) {
|
||||
// Reached the breakpoint.
|
||||
do_check_eq(packet.frame.where.line, location.line);
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_neq(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.notEqual(packet.why.type, "resumeLimit");
|
||||
},
|
||||
function (packet) {
|
||||
// Stepped to the closing brace of the function.
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
},
|
||||
function (packet) {
|
||||
// The frame is about to be popped while stepping.
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||
do_check_neq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
do_check_eq(packet.why.frameFinished.return.type, "undefined");
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||
Assert.notEqual(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.why.frameFinished.return.type, "undefined");
|
||||
},
|
||||
function (packet) {
|
||||
// The foo function call frame was just popped from the stack.
|
||||
do_check_eq(gDebuggee.a, 1);
|
||||
do_check_eq(gDebuggee.b, undefined);
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
do_check_eq(packet.poppedFrames.length, 1);
|
||||
Assert.equal(gDebuggee.a, 1);
|
||||
Assert.equal(gDebuggee.b, undefined);
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.poppedFrames.length, 1);
|
||||
},
|
||||
function (packet) {
|
||||
// Check that the debugger statement wasn't the reason for this pause.
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 6);
|
||||
do_check_neq(packet.why.type, "debuggerStatement");
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 6);
|
||||
Assert.notEqual(packet.why.type, "debuggerStatement");
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
},
|
||||
function (packet) {
|
||||
// Check that the debugger statement wasn't the reason for this pause.
|
||||
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 7);
|
||||
do_check_neq(packet.why.type, "debuggerStatement");
|
||||
do_check_eq(packet.why.type, "resumeLimit");
|
||||
Assert.equal(packet.frame.where.line, gDebuggee.line0 + 7);
|
||||
Assert.notEqual(packet.why.type, "debuggerStatement");
|
||||
Assert.equal(packet.why.type, "resumeLimit");
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ const testSameBreakpoint = Task.async(function* () {
|
|||
let [, firstBpClient] = yield setBreakpoint(source, wholeLineLocation);
|
||||
let [, secondBpClient] = yield setBreakpoint(source, wholeLineLocation);
|
||||
|
||||
do_check_eq(firstBpClient.actor, secondBpClient.actor,
|
||||
"Should get the same actor w/ whole line breakpoints");
|
||||
Assert.equal(firstBpClient.actor, secondBpClient.actor,
|
||||
"Should get the same actor w/ whole line breakpoints");
|
||||
|
||||
// Specific column
|
||||
|
||||
|
@ -52,8 +52,8 @@ const testSameBreakpoint = Task.async(function* () {
|
|||
[, firstBpClient] = yield setBreakpoint(source, columnLocation);
|
||||
[, secondBpClient] = yield setBreakpoint(source, columnLocation);
|
||||
|
||||
do_check_eq(secondBpClient.actor, secondBpClient.actor,
|
||||
"Should get the same actor column breakpoints");
|
||||
Assert.equal(secondBpClient.actor, secondBpClient.actor,
|
||||
"Should get the same actor column breakpoints");
|
||||
|
||||
finishClient(gClient);
|
||||
});
|
||||
|
|
|
@ -47,16 +47,16 @@ function test_column_breakpoint() {
|
|||
|
||||
source.setBreakpoint(location, function (response, bpClient) {
|
||||
gThreadClient.addListener("paused", function onPaused(event, packet) {
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line);
|
||||
do_check_eq(packet.frame.where.column, location.column);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
Assert.equal(packet.frame.where.column, location.column);
|
||||
|
||||
do_check_eq(gDebuggee.acc, timesBreakpointHit);
|
||||
do_check_eq(packet.frame.environment.bindings.variables.i.value,
|
||||
timesBreakpointHit);
|
||||
Assert.equal(gDebuggee.acc, timesBreakpointHit);
|
||||
Assert.equal(packet.frame.environment.bindings.variables.i.value,
|
||||
timesBreakpointHit);
|
||||
|
||||
if (++timesBreakpointHit === 3) {
|
||||
gThreadClient.removeListener("paused", onPaused);
|
||||
|
|
|
@ -64,14 +64,14 @@ function set_breakpoints(event, packet) {
|
|||
|
||||
source.setBreakpoint(firstLocation, function ({ error, actualLocation },
|
||||
breakpointClient) {
|
||||
do_check_true(!error, "Should not get an error setting the breakpoint");
|
||||
do_check_true(!actualLocation, "Should not get an actualLocation");
|
||||
Assert.ok(!error, "Should not get an error setting the breakpoint");
|
||||
Assert.ok(!actualLocation, "Should not get an actualLocation");
|
||||
first = breakpointClient;
|
||||
|
||||
source.setBreakpoint(secondLocation, function ({ error, actualLocation },
|
||||
breakpointClient) {
|
||||
do_check_true(!error, "Should not get an error setting the breakpoint");
|
||||
do_check_true(!actualLocation, "Should not get an actualLocation");
|
||||
Assert.ok(!error, "Should not get an error setting the breakpoint");
|
||||
Assert.ok(!actualLocation, "Should not get an actualLocation");
|
||||
second = breakpointClient;
|
||||
|
||||
test_different_actors(first, second);
|
||||
|
@ -80,41 +80,41 @@ function set_breakpoints(event, packet) {
|
|||
}
|
||||
|
||||
function test_different_actors(first, second) {
|
||||
do_check_neq(first.actor, second.actor,
|
||||
"Each breakpoint should have a different actor");
|
||||
Assert.notEqual(first.actor, second.actor,
|
||||
"Each breakpoint should have a different actor");
|
||||
test_remove_one(first, second);
|
||||
}
|
||||
|
||||
function test_remove_one(first, second) {
|
||||
first.remove(function ({error}) {
|
||||
do_check_true(!error, "Should not get an error removing a breakpoint");
|
||||
Assert.ok(!error, "Should not get an error removing a breakpoint");
|
||||
|
||||
let hitSecond;
|
||||
gClient.addListener("paused", function _onPaused(event, {why, frame}) {
|
||||
if (why.type == "breakpoint") {
|
||||
hitSecond = true;
|
||||
do_check_eq(why.actors.length, 1,
|
||||
"Should only be paused because of one breakpoint actor");
|
||||
do_check_eq(why.actors[0], second.actor,
|
||||
"Should be paused because of the correct breakpoint actor");
|
||||
do_check_eq(frame.where.line, secondLocation.line,
|
||||
"Should be at the right line");
|
||||
do_check_eq(frame.where.column, secondLocation.column,
|
||||
"Should be at the right column");
|
||||
Assert.equal(why.actors.length, 1,
|
||||
"Should only be paused because of one breakpoint actor");
|
||||
Assert.equal(why.actors[0], second.actor,
|
||||
"Should be paused because of the correct breakpoint actor");
|
||||
Assert.equal(frame.where.line, secondLocation.line,
|
||||
"Should be at the right line");
|
||||
Assert.equal(frame.where.column, secondLocation.column,
|
||||
"Should be at the right column");
|
||||
gThreadClient.resume();
|
||||
return;
|
||||
}
|
||||
|
||||
if (why.type == "debuggerStatement") {
|
||||
gClient.removeListener("paused", _onPaused);
|
||||
do_check_true(hitSecond,
|
||||
"We should still hit `second`, but not `first`.");
|
||||
Assert.ok(hitSecond,
|
||||
"We should still hit `second`, but not `first`.");
|
||||
|
||||
gClient.close().then(gCallback);
|
||||
return;
|
||||
}
|
||||
|
||||
do_check_true(false, "Should never get here");
|
||||
Assert.ok(false, "Should never get here");
|
||||
});
|
||||
|
||||
gThreadClient.resume(() => gDebuggee.foo());
|
||||
|
|
|
@ -56,7 +56,7 @@ function setBreakpoint(event, packet) {
|
|||
gClient.addOneTimeListener("resumed", runCode);
|
||||
|
||||
source.setBreakpoint({ line: 2 }, ({ error }) => {
|
||||
do_check_true(!error);
|
||||
Assert.ok(!error);
|
||||
gThreadClient.resume();
|
||||
});
|
||||
}
|
||||
|
@ -67,16 +67,16 @@ function runCode() {
|
|||
}
|
||||
|
||||
function testBPHit(event, { why }) {
|
||||
do_check_eq(why.type, "breakpoint");
|
||||
Assert.equal(why.type, "breakpoint");
|
||||
gClient.addOneTimeListener("paused", testDbgStatement);
|
||||
gThreadClient.resume();
|
||||
}
|
||||
|
||||
function testDbgStatement(event, { why }) {
|
||||
// Should continue to the debugger statement.
|
||||
do_check_eq(why.type, "debuggerStatement");
|
||||
Assert.equal(why.type, "debuggerStatement");
|
||||
// Not break on another offset from the same line (that isn't an entry point
|
||||
// to the line)
|
||||
do_check_neq(why.type, "breakpoint");
|
||||
Assert.notEqual(why.type, "breakpoint");
|
||||
gClient.close().then(gCallback);
|
||||
}
|
||||
|
|
|
@ -50,11 +50,11 @@ const test = Task.async(function* () {
|
|||
|
||||
yield resume(gThreadClient);
|
||||
packet = yield waitForPause(gClient);
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||
do_check_eq(packet.frame.where.line, location.line);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.why.actors[0], bpClient.actor);
|
||||
Assert.equal(packet.frame.where.source.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
|
||||
yield resume(gThreadClient);
|
||||
finishClient(gClient);
|
||||
|
|
|
@ -54,7 +54,7 @@ const test = Task.async(function* () {
|
|||
yield source.setBreakpoint(location2).then(_ => {
|
||||
do_throw("no code shall not be found the specified line or below it");
|
||||
}, reason => {
|
||||
do_check_eq(reason.error, "noCodeAtLineColumn");
|
||||
Assert.equal(reason.error, "noCodeAtLineColumn");
|
||||
ok(reason.message);
|
||||
});
|
||||
|
||||
|
|
|
@ -29,28 +29,28 @@ function test_get_actor() {
|
|||
};
|
||||
|
||||
// Shouldn't have breakpoint
|
||||
do_check_eq(null, bpStore.getActor(location),
|
||||
"Breakpoint not added and shouldn't exist.");
|
||||
Assert.equal(null, bpStore.getActor(location),
|
||||
"Breakpoint not added and shouldn't exist.");
|
||||
|
||||
bpStore.setActor(location, {});
|
||||
do_check_true(!!bpStore.getActor(location),
|
||||
"Breakpoint added but not found in Breakpoint Store.");
|
||||
Assert.ok(!!bpStore.getActor(location),
|
||||
"Breakpoint added but not found in Breakpoint Store.");
|
||||
|
||||
bpStore.deleteActor(location);
|
||||
do_check_eq(null, bpStore.getActor(location),
|
||||
"Breakpoint removed but still exists.");
|
||||
Assert.equal(null, bpStore.getActor(location),
|
||||
"Breakpoint removed but still exists.");
|
||||
|
||||
// Same checks for breakpoint with a column
|
||||
do_check_eq(null, bpStore.getActor(columnLocation),
|
||||
"Breakpoint with column not added and shouldn't exist.");
|
||||
Assert.equal(null, bpStore.getActor(columnLocation),
|
||||
"Breakpoint with column not added and shouldn't exist.");
|
||||
|
||||
bpStore.setActor(columnLocation, {});
|
||||
do_check_true(!!bpStore.getActor(columnLocation),
|
||||
"Breakpoint with column added but not found in Breakpoint Store.");
|
||||
Assert.ok(!!bpStore.getActor(columnLocation),
|
||||
"Breakpoint with column added but not found in Breakpoint Store.");
|
||||
|
||||
bpStore.deleteActor(columnLocation);
|
||||
do_check_eq(null, bpStore.getActor(columnLocation),
|
||||
"Breakpoint with column removed but still exists in Breakpoint Store.");
|
||||
Assert.equal(null, bpStore.getActor(columnLocation),
|
||||
"Breakpoint with column removed but still exists in Breakpoint Store.");
|
||||
}
|
||||
|
||||
function test_set_actor() {
|
||||
|
@ -62,8 +62,8 @@ function test_set_actor() {
|
|||
originalColumn: 9
|
||||
};
|
||||
bpStore.setActor(location, {});
|
||||
do_check_true(!!bpStore.getActor(location),
|
||||
"We should have the column breakpoint we just added");
|
||||
Assert.ok(!!bpStore.getActor(location),
|
||||
"We should have the column breakpoint we just added");
|
||||
|
||||
// Breakpoint without column (whole line breakpoint)
|
||||
location = {
|
||||
|
@ -71,8 +71,8 @@ function test_set_actor() {
|
|||
originalLine: 103
|
||||
};
|
||||
bpStore.setActor(location, {});
|
||||
do_check_true(!!bpStore.getActor(location),
|
||||
"We should have the whole line breakpoint we just added");
|
||||
Assert.ok(!!bpStore.getActor(location),
|
||||
"We should have the whole line breakpoint we just added");
|
||||
}
|
||||
|
||||
function test_delete_actor() {
|
||||
|
@ -85,8 +85,8 @@ function test_delete_actor() {
|
|||
};
|
||||
bpStore.setActor(location, {});
|
||||
bpStore.deleteActor(location);
|
||||
do_check_eq(bpStore.getActor(location), null,
|
||||
"We should not have the column breakpoint anymore");
|
||||
Assert.equal(bpStore.getActor(location), null,
|
||||
"We should not have the column breakpoint anymore");
|
||||
|
||||
// Breakpoint without column (whole line breakpoint)
|
||||
location = {
|
||||
|
@ -95,8 +95,8 @@ function test_delete_actor() {
|
|||
};
|
||||
bpStore.setActor(location, {});
|
||||
bpStore.deleteActor(location);
|
||||
do_check_eq(bpStore.getActor(location), null,
|
||||
"We should not have the whole line breakpoint anymore");
|
||||
Assert.equal(bpStore.getActor(location), null,
|
||||
"We should not have the whole line breakpoint anymore");
|
||||
}
|
||||
|
||||
function test_find_actors() {
|
||||
|
@ -123,8 +123,8 @@ function test_find_actors() {
|
|||
for (let bp of bpStore.findActors()) {
|
||||
bpSet.delete(bp);
|
||||
}
|
||||
do_check_eq(bpSet.size, 0,
|
||||
"Should be able to iterate over all breakpoints");
|
||||
Assert.equal(bpSet.size, 0,
|
||||
"Should be able to iterate over all breakpoints");
|
||||
|
||||
// Breakpoints by URL
|
||||
|
||||
|
@ -134,8 +134,8 @@ function test_find_actors() {
|
|||
for (let bp of bpStore.findActors({ originalSourceActor: { actorID: "actor1" } })) {
|
||||
bpSet.delete(bp);
|
||||
}
|
||||
do_check_eq(bpSet.size, 0,
|
||||
"Should be able to filter the iteration by url");
|
||||
Assert.equal(bpSet.size, 0,
|
||||
"Should be able to filter the iteration by url");
|
||||
|
||||
// Breakpoints by URL and line
|
||||
|
||||
|
@ -146,17 +146,17 @@ function test_find_actors() {
|
|||
for (let bp of bpStore.findActors({ originalSourceActor: { actorID: "actor1" },
|
||||
originalLine: 10 })) {
|
||||
if (first) {
|
||||
do_check_eq(bp.originalColumn, undefined,
|
||||
"Should always get the whole line breakpoint first");
|
||||
Assert.equal(bp.originalColumn, undefined,
|
||||
"Should always get the whole line breakpoint first");
|
||||
first = false;
|
||||
} else {
|
||||
do_check_neq(bp.originalColumn, undefined,
|
||||
"Should not get the whole line breakpoint any time other than first.");
|
||||
Assert.notEqual(bp.originalColumn, undefined,
|
||||
"Should not get the whole line breakpoint any time other than first.");
|
||||
}
|
||||
bpSet.delete(bp);
|
||||
}
|
||||
do_check_eq(bpSet.size, 0,
|
||||
"Should be able to filter the iteration by url and line");
|
||||
Assert.equal(bpSet.size, 0,
|
||||
"Should be able to filter the iteration by url and line");
|
||||
}
|
||||
|
||||
function test_duplicate_actors() {
|
||||
|
@ -170,7 +170,7 @@ function test_duplicate_actors() {
|
|||
};
|
||||
bpStore.setActor(location, {});
|
||||
bpStore.setActor(location, {});
|
||||
do_check_eq(bpStore.size, 1, "We should have only 1 column breakpoint");
|
||||
Assert.equal(bpStore.size, 1, "We should have only 1 column breakpoint");
|
||||
bpStore.deleteActor(location);
|
||||
|
||||
// Breakpoint without column (whole line breakpoint)
|
||||
|
@ -180,6 +180,6 @@ function test_duplicate_actors() {
|
|||
};
|
||||
bpStore.setActor(location, {});
|
||||
bpStore.setActor(location, {});
|
||||
do_check_eq(bpStore.size, 1, "We should have only 1 whole line breakpoint");
|
||||
Assert.equal(bpStore.size, 1, "We should have only 1 whole line breakpoint");
|
||||
bpStore.deleteActor(location);
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ function test_client_request_callback() {
|
|||
to: gActorId,
|
||||
type: "hello"
|
||||
}, response => {
|
||||
do_check_eq(response.from, gActorId);
|
||||
do_check_eq(response.hello, "world");
|
||||
Assert.equal(response.from, gActorId);
|
||||
Assert.equal(response.hello, "world");
|
||||
checkStack("test_client_request_callback");
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -93,8 +93,8 @@ function test_client_request_promise() {
|
|||
});
|
||||
|
||||
request.then(response => {
|
||||
do_check_eq(response.from, gActorId);
|
||||
do_check_eq(response.hello, "world");
|
||||
Assert.equal(response.from, gActorId);
|
||||
Assert.equal(response.hello, "world");
|
||||
checkStack("test_client_request_promise");
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -111,9 +111,9 @@ function test_client_request_promise_error() {
|
|||
request.then(() => {
|
||||
do_throw("Promise shouldn't be resolved on error");
|
||||
}, response => {
|
||||
do_check_eq(response.from, gActorId);
|
||||
do_check_eq(response.error, "code");
|
||||
do_check_eq(response.message, "human message");
|
||||
Assert.equal(response.from, gActorId);
|
||||
Assert.equal(response.error, "code");
|
||||
Assert.equal(response.message, "human message");
|
||||
checkStack("test_client_request_promise_error");
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -126,8 +126,8 @@ function test_client_request_event_emitter() {
|
|||
type: "hello"
|
||||
});
|
||||
request.on("json-reply", reply => {
|
||||
do_check_eq(reply.from, gActorId);
|
||||
do_check_eq(reply.hello, "world");
|
||||
Assert.equal(reply.from, gActorId);
|
||||
Assert.equal(reply.hello, "world");
|
||||
checkStack("test_client_request_event_emitter");
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -151,9 +151,9 @@ function test_close_client_while_sending_requests() {
|
|||
|
||||
let expectReply = defer();
|
||||
gClient.expectReply("root", function (response) {
|
||||
do_check_eq(response.error, "connectionClosed");
|
||||
do_check_eq(response.message,
|
||||
"server side packet can't be received as the connection just closed.");
|
||||
Assert.equal(response.error, "connectionClosed");
|
||||
Assert.equal(response.message,
|
||||
"server side packet can't be received as the connection just closed.");
|
||||
expectReply.resolve();
|
||||
});
|
||||
|
||||
|
@ -161,17 +161,17 @@ function test_close_client_while_sending_requests() {
|
|||
activeRequest.then(() => {
|
||||
ok(false, "First request unexpectedly succeed while closing the connection");
|
||||
}, response => {
|
||||
do_check_eq(response.error, "connectionClosed");
|
||||
do_check_eq(response.message, "'hello' active request packet to '" +
|
||||
gActorId + "' can't be sent as the connection just closed.");
|
||||
Assert.equal(response.error, "connectionClosed");
|
||||
Assert.equal(response.message, "'hello' active request packet to '" +
|
||||
gActorId + "' can't be sent as the connection just closed.");
|
||||
})
|
||||
.then(() => pendingRequest)
|
||||
.then(() => {
|
||||
ok(false, "Second request unexpectedly succeed while closing the connection");
|
||||
}, response => {
|
||||
do_check_eq(response.error, "connectionClosed");
|
||||
do_check_eq(response.message, "'hello' pending request packet to '" +
|
||||
gActorId + "' can't be sent as the connection just closed.");
|
||||
Assert.equal(response.error, "connectionClosed");
|
||||
Assert.equal(response.message, "'hello' pending request packet to '" +
|
||||
gActorId + "' can't be sent as the connection just closed.");
|
||||
})
|
||||
.then(() => expectReply.promise)
|
||||
.then(run_next_test);
|
||||
|
@ -190,7 +190,7 @@ function test_client_request_after_close() {
|
|||
ok(false, "Request succeed even after client.close");
|
||||
}, response => {
|
||||
ok(true, "Request failed after client.close");
|
||||
do_check_eq(response.error, "connectionClosed");
|
||||
Assert.equal(response.error, "connectionClosed");
|
||||
ok(response.message.match(
|
||||
/'hello' request packet to '.*' can't be sent as the connection is closed./));
|
||||
run_next_test();
|
||||
|
@ -205,7 +205,7 @@ function test_client_request_after_close_callback() {
|
|||
type: "hello"
|
||||
}, response => {
|
||||
ok(true, "Request failed after client.close");
|
||||
do_check_eq(response.error, "connectionClosed");
|
||||
Assert.equal(response.error, "connectionClosed");
|
||||
ok(response.message.match(
|
||||
/'hello' request packet to '.*' can't be sent as the connection is closed./));
|
||||
run_next_test();
|
||||
|
|
|
@ -35,8 +35,8 @@ function test_simple_breakpoint() {
|
|||
}, function (response, bpClient) {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.why.type, "breakpoint");
|
||||
do_check_eq(packet.frame.where.line, 3);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.frame.where.line, 3);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -35,8 +35,8 @@ function test_simple_breakpoint() {
|
|||
}, function (response, bpClient) {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.why.type, "debuggerStatement");
|
||||
do_check_eq(packet.frame.where.line, 4);
|
||||
Assert.equal(packet.why.type, "debuggerStatement");
|
||||
Assert.equal(packet.frame.where.line, 4);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -35,8 +35,8 @@ function test_simple_breakpoint() {
|
|||
}, function (response, bpClient) {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value.
|
||||
do_check_eq(packet.why.type, "breakpointConditionThrown");
|
||||
do_check_eq(packet.frame.where.line, 3);
|
||||
Assert.equal(packet.why.type, "breakpointConditionThrown");
|
||||
Assert.equal(packet.frame.where.line, 3);
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function (response) {
|
||||
|
|
|
@ -17,7 +17,7 @@ function run_test() {
|
|||
gClient = new DebuggerClient(transport);
|
||||
gClient.addListener("connected", function (event, type, traits) {
|
||||
gClient.listTabs((response) => {
|
||||
do_check_true("tabs" in response);
|
||||
Assert.ok("tabs" in response);
|
||||
for (let tab of response.tabs) {
|
||||
if (tab.title == "test-1") {
|
||||
test_attach_tab(tab.actor);
|
||||
|
@ -25,7 +25,7 @@ function run_test() {
|
|||
}
|
||||
}
|
||||
// We should have found our tab in the list.
|
||||
do_check_true(false);
|
||||
Assert.ok(false);
|
||||
return undefined;
|
||||
});
|
||||
});
|
||||
|
@ -38,10 +38,10 @@ function run_test() {
|
|||
// Attach to |tabActor|, and check the response.
|
||||
function test_attach_tab(tabActor) {
|
||||
gClient.request({ to: tabActor, type: "attach" }, function (response) {
|
||||
do_check_false("error" in response);
|
||||
do_check_eq(response.from, tabActor);
|
||||
do_check_eq(response.type, "tabAttached");
|
||||
do_check_true(typeof response.threadActor === "string");
|
||||
Assert.equal(false, "error" in response);
|
||||
Assert.equal(response.from, tabActor);
|
||||
Assert.equal(response.type, "tabAttached");
|
||||
Assert.ok(typeof response.threadActor === "string");
|
||||
|
||||
test_attach_thread(response.threadActor);
|
||||
});
|
||||
|
@ -50,11 +50,11 @@ function test_attach_tab(tabActor) {
|
|||
// Attach to |threadActor|, check the response, and resume it.
|
||||
function test_attach_thread(threadActor) {
|
||||
gClient.request({ to: threadActor, type: "attach" }, function (response) {
|
||||
do_check_false("error" in response);
|
||||
do_check_eq(response.from, threadActor);
|
||||
do_check_eq(response.type, "paused");
|
||||
do_check_true("why" in response);
|
||||
do_check_eq(response.why.type, "attached");
|
||||
Assert.equal(false, "error" in response);
|
||||
Assert.equal(response.from, threadActor);
|
||||
Assert.equal(response.type, "paused");
|
||||
Assert.ok("why" in response);
|
||||
Assert.equal(response.why.type, "attached");
|
||||
|
||||
test_resume_thread(threadActor);
|
||||
});
|
||||
|
@ -65,33 +65,33 @@ function test_attach_thread(threadActor) {
|
|||
function test_resume_thread(threadActor) {
|
||||
// Allow the client to resume execution.
|
||||
gClient.request({ to: threadActor, type: "resume" }, function (response) {
|
||||
do_check_false("error" in response);
|
||||
do_check_eq(response.from, threadActor);
|
||||
do_check_eq(response.type, "resumed");
|
||||
Assert.equal(false, "error" in response);
|
||||
Assert.equal(response.from, threadActor);
|
||||
Assert.equal(response.type, "resumed");
|
||||
|
||||
do_check_eq(xpcInspector.eventLoopNestLevel, 0);
|
||||
Assert.equal(xpcInspector.eventLoopNestLevel, 0);
|
||||
|
||||
// Now that we know we're resumed, we can make the debuggee do something.
|
||||
Cu.evalInSandbox("var a = true; var b = false; debugger; var b = true;", gDebuggee);
|
||||
// Now make sure that we've run the code after the debugger statement...
|
||||
do_check_true(gDebuggee.b);
|
||||
Assert.ok(gDebuggee.b);
|
||||
});
|
||||
|
||||
gClient.addListener("paused", function (name, packet) {
|
||||
do_check_eq(name, "paused");
|
||||
do_check_false("error" in packet);
|
||||
do_check_eq(packet.from, threadActor);
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_true("actor" in packet);
|
||||
do_check_true("why" in packet);
|
||||
do_check_eq(packet.why.type, "debuggerStatement");
|
||||
Assert.equal(name, "paused");
|
||||
Assert.equal(false, "error" in packet);
|
||||
Assert.equal(packet.from, threadActor);
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.ok("actor" in packet);
|
||||
Assert.ok("why" in packet);
|
||||
Assert.equal(packet.why.type, "debuggerStatement");
|
||||
|
||||
// Reach around the protocol to check that the debuggee is in the state
|
||||
// we expect.
|
||||
do_check_true(gDebuggee.a);
|
||||
do_check_false(gDebuggee.b);
|
||||
Assert.ok(gDebuggee.a);
|
||||
Assert.ok(!gDebuggee.b);
|
||||
|
||||
do_check_eq(xpcInspector.eventLoopNestLevel, 1);
|
||||
Assert.equal(xpcInspector.eventLoopNestLevel, 1);
|
||||
|
||||
// Let the debuggee continue execution.
|
||||
gClient.request({ to: threadActor, type: "resume" }, cleanup);
|
||||
|
@ -105,7 +105,7 @@ function cleanup() {
|
|||
|
||||
try {
|
||||
let inspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
||||
do_check_eq(inspector.eventLoopNestLevel, 0);
|
||||
Assert.equal(inspector.eventLoopNestLevel, 0);
|
||||
} catch (e) {
|
||||
dump(e);
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ function run_test() {
|
|||
function test_threadAttach(threadActorID) {
|
||||
do_print("Trying to attach to thread " + threadActorID);
|
||||
gTabClient.attachThread({}, function (response, threadClient) {
|
||||
do_check_eq(threadClient.state, "paused");
|
||||
do_check_eq(threadClient.actor, threadActorID);
|
||||
Assert.equal(threadClient.state, "paused");
|
||||
Assert.equal(threadClient.actor, threadActorID);
|
||||
threadClient.resume(function () {
|
||||
do_check_eq(threadClient.state, "attached");
|
||||
Assert.equal(threadClient.state, "attached");
|
||||
test_debugger_statement(threadClient);
|
||||
});
|
||||
});
|
||||
|
@ -37,14 +37,14 @@ function test_threadAttach(threadActorID) {
|
|||
|
||||
function test_debugger_statement(threadClient) {
|
||||
threadClient.addListener("paused", function (event, packet) {
|
||||
do_check_eq(threadClient.state, "paused");
|
||||
Assert.equal(threadClient.state, "paused");
|
||||
// Reach around the protocol to check that the debuggee is in the state
|
||||
// we expect.
|
||||
do_check_true(gDebuggee.a);
|
||||
do_check_false(gDebuggee.b);
|
||||
Assert.ok(gDebuggee.a);
|
||||
Assert.ok(!gDebuggee.b);
|
||||
|
||||
let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
||||
do_check_eq(xpcInspector.eventLoopNestLevel, 1);
|
||||
Assert.equal(xpcInspector.eventLoopNestLevel, 1);
|
||||
|
||||
threadClient.resume(cleanup);
|
||||
});
|
||||
|
@ -52,7 +52,7 @@ function test_debugger_statement(threadClient) {
|
|||
Cu.evalInSandbox("var a = true; var b = false; debugger; var b = true;", gDebuggee);
|
||||
|
||||
// Now make sure that we've run the code after the debugger statement...
|
||||
do_check_true(gDebuggee.b);
|
||||
Assert.ok(gDebuggee.b);
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
|
@ -62,7 +62,7 @@ function cleanup() {
|
|||
|
||||
try {
|
||||
let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
||||
do_check_eq(xpcInspector.eventLoopNestLevel, 0);
|
||||
Assert.equal(xpcInspector.eventLoopNestLevel, 0);
|
||||
} catch (e) {
|
||||
dump(e);
|
||||
}
|
||||
|
|
|
@ -30,17 +30,17 @@ function run_test() {
|
|||
let client1 = DebuggerServer.connectPipe();
|
||||
client1.hooks = {
|
||||
onPacket: function (packet1) {
|
||||
do_check_eq(packet1.from, "root");
|
||||
do_check_eq(packet1.applicationType, "xpcshell-tests");
|
||||
Assert.equal(packet1.from, "root");
|
||||
Assert.equal(packet1.applicationType, "xpcshell-tests");
|
||||
|
||||
// Spin up a second connection, make sure it has its own root
|
||||
// actor.
|
||||
let client2 = DebuggerServer.connectPipe();
|
||||
client2.hooks = {
|
||||
onPacket: function (packet2) {
|
||||
do_check_eq(packet2.from, "root");
|
||||
do_check_neq(packet1.testConnectionPrefix,
|
||||
packet2.testConnectionPrefix);
|
||||
Assert.equal(packet2.from, "root");
|
||||
Assert.notEqual(packet1.testConnectionPrefix,
|
||||
packet2.testConnectionPrefix);
|
||||
client2.close();
|
||||
},
|
||||
onClosed: function (result) {
|
||||
|
|
|
@ -30,18 +30,18 @@ function test_simple_eval() {
|
|||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
let arg1Actor = packet.frame.arguments[0].actor;
|
||||
gThreadClient.eval(null, "({ obj: true })", function (response) {
|
||||
do_check_eq(response.type, "resumed");
|
||||
Assert.equal(response.type, "resumed");
|
||||
// Expect a pause notification immediately.
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value...
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "clientEvaluated");
|
||||
do_check_eq(packet.why.frameFinished.return.type, "object");
|
||||
do_check_eq(packet.why.frameFinished.return.class, "Object");
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "clientEvaluated");
|
||||
Assert.equal(packet.why.frameFinished.return.type, "object");
|
||||
Assert.equal(packet.why.frameFinished.return.class, "Object");
|
||||
|
||||
// Make sure the previous pause lifetime was correctly dropped.
|
||||
gClient.request({ to: arg1Actor, type: "bogusRequest" }, function (response) {
|
||||
do_check_eq(response.error, "noSuchActor");
|
||||
Assert.equal(response.error, "noSuchActor");
|
||||
gThreadClient.resume(function () {
|
||||
finishClient(gClient);
|
||||
});
|
||||
|
|
|
@ -29,13 +29,13 @@ function run_test() {
|
|||
function test_throw_eval() {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
gThreadClient.eval(null, "throw 'failure'", function (response) {
|
||||
do_check_eq(response.type, "resumed");
|
||||
Assert.equal(response.type, "resumed");
|
||||
// Expect a pause notification immediately.
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value...
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "clientEvaluated");
|
||||
do_check_eq(packet.why.frameFinished.throw, "failure");
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "clientEvaluated");
|
||||
Assert.equal(packet.why.frameFinished.throw, "failure");
|
||||
gThreadClient.resume(function () {
|
||||
finishClient(gClient);
|
||||
});
|
||||
|
|
|
@ -29,14 +29,14 @@ function run_test() {
|
|||
function test_syntax_error_eval() {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
gThreadClient.eval(null, "%$@!@#", function (response) {
|
||||
do_check_eq(response.type, "resumed");
|
||||
Assert.equal(response.type, "resumed");
|
||||
// Expect a pause notification immediately.
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// Check the return value...
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "clientEvaluated");
|
||||
do_check_eq(packet.why.frameFinished.throw.type, "object");
|
||||
do_check_eq(packet.why.frameFinished.throw.class, "Error");
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "clientEvaluated");
|
||||
Assert.equal(packet.why.frameFinished.throw.type, "object");
|
||||
Assert.equal(packet.why.frameFinished.throw.class, "Error");
|
||||
|
||||
gThreadClient.resume(function () {
|
||||
finishClient(gClient);
|
||||
|
|
|
@ -34,19 +34,19 @@ function test_different_frames_eval() {
|
|||
|
||||
// Eval against the top frame...
|
||||
gThreadClient.eval(frame0.actor, "arg", function (response) {
|
||||
do_check_eq(response.type, "resumed");
|
||||
Assert.equal(response.type, "resumed");
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// 'arg' should have been evaluated in frame0
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.type, "clientEvaluated");
|
||||
do_check_eq(packet.why.frameFinished.return, "arg0");
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.type, "clientEvaluated");
|
||||
Assert.equal(packet.why.frameFinished.return, "arg0");
|
||||
|
||||
// Now eval against the second frame.
|
||||
gThreadClient.eval(frame1.actor, "arg", function (response) {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
// 'arg' should have been evaluated in frame1
|
||||
do_check_eq(packet.type, "paused");
|
||||
do_check_eq(packet.why.frameFinished.return, "arg1");
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.why.frameFinished.return, "arg1");
|
||||
|
||||
gThreadClient.resume(function () {
|
||||
finishClient(gClient);
|
||||
|
|
|
@ -30,15 +30,15 @@ function test_pauses_eval() {
|
|||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
gThreadClient.eval(null, "debugger", function (response) {
|
||||
// Expect a resume then a debuggerStatement pause.
|
||||
do_check_eq(response.type, "resumed");
|
||||
Assert.equal(response.type, "resumed");
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
do_check_eq(packet.why.type, "debuggerStatement");
|
||||
Assert.equal(packet.why.type, "debuggerStatement");
|
||||
// Resume from the debugger statement should immediately re-pause
|
||||
// with a clientEvaluated reason.
|
||||
gThreadClient.resume(function (packet) {
|
||||
do_check_eq(packet.type, "resumed");
|
||||
Assert.equal(packet.type, "resumed");
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
do_check_eq(packet.why.type, "clientEvaluated");
|
||||
Assert.equal(packet.why.type, "clientEvaluated");
|
||||
gThreadClient.resume(function () {
|
||||
finishClient(gClient);
|
||||
});
|
||||
|
|
|
@ -25,7 +25,7 @@ function run_test() {
|
|||
client.listTabs(function (resp) {
|
||||
front = new EventLoopLagFront(client, resp);
|
||||
front.start().then(success => {
|
||||
do_check_true(success);
|
||||
Assert.ok(success);
|
||||
front.once("event-loop-lag", gotLagEvent);
|
||||
do_execute_soon(lag);
|
||||
});
|
||||
|
@ -47,7 +47,7 @@ function run_test() {
|
|||
// fails to detect the lag.
|
||||
function gotLagEvent(time) {
|
||||
do_print("lag: " + time);
|
||||
do_check_true(time >= threshold);
|
||||
Assert.ok(time >= threshold);
|
||||
front.stop().then(() => {
|
||||
finishClient(client);
|
||||
});
|
||||
|
|
|
@ -88,10 +88,10 @@ function tryActors(reachables, completed) {
|
|||
{ to: actor, type: "echo", value: "tango"},
|
||||
(response) => {
|
||||
if (reachables.has(actor)) {
|
||||
do_check_matches({ from: actor, to: actor,
|
||||
Assert.deepEqual({ from: actor, to: actor,
|
||||
type: "echo", value: "tango" }, response);
|
||||
} else {
|
||||
do_check_matches({ from: actor, error: "noSuchActor",
|
||||
Assert.deepEqual({ from: actor, error: "noSuchActor",
|
||||
message: "No such actor for ID: " + actor }, response);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ function run_test() {
|
|||
|
||||
function test_pause_frame() {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||
do_check_true(!!packet.frame);
|
||||
do_check_true(!!packet.frame.actor);
|
||||
do_check_eq(packet.frame.callee.name, "stopMe");
|
||||
Assert.ok(!!packet.frame);
|
||||
Assert.ok(!!packet.frame.actor);
|
||||
Assert.equal(packet.frame.callee.name, "stopMe");
|
||||
gThreadClient.resume(function () {
|
||||
finishClient(gClient);
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@ function run_test() {
|
|||
function test_pause_frame() {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet1) {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet2) {
|
||||
do_check_eq(packet1.frame.actor, packet2.frame.actor);
|
||||
Assert.equal(packet1.frame.actor, packet2.frame.actor);
|
||||
gThreadClient.resume(function () {
|
||||
finishClient(gClient);
|
||||
});
|
||||
|
|
|
@ -30,8 +30,8 @@ function test_pause_frame() {
|
|||
gThreadClient.addOneTimeListener("paused", function (event, packet1) {
|
||||
gThreadClient.addOneTimeListener("paused", function (event, packet2) {
|
||||
let poppedFrames = packet2.poppedFrames;
|
||||
do_check_eq(typeof (poppedFrames), typeof ([]));
|
||||
do_check_true(poppedFrames.indexOf(packet1.frame.actor) >= 0);
|
||||
Assert.equal(typeof (poppedFrames), typeof ([]));
|
||||
Assert.ok(poppedFrames.indexOf(packet1.frame.actor) >= 0);
|
||||
gThreadClient.resume(function () {
|
||||
finishClient(gClient);
|
||||
});
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче