merge mozilla-central to autoland. r=merge a=merge

--HG--
extra : rebase_source : db451eb58e88563fe7709c8f4b3e69135df66253
This commit is contained in:
Sebastian Hengst 2017-12-21 13:38:16 +02:00
Родитель 67204b6593 22c55eb7b7
Коммит 92ed624d10
2089 изменённых файлов: 28230 добавлений и 27956 удалений

Просмотреть файл

@ -156,7 +156,7 @@ XULListboxAccessible::NativeRole()
{
// A richlistbox is used with the new autocomplete URL bar, and has a parent
// popup <panel>.
if (mContent->GetParent()->IsXULElement(nsGkAtoms::panel))
if (mContent->GetParent() && mContent->GetParent()->IsXULElement(nsGkAtoms::panel))
return roles::COMBOBOX_LIST;
return IsMulticolumn() ? roles::TABLE : roles::LISTBOX;

Просмотреть файл

@ -3,3 +3,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOZ_APP_DISPLAYNAME=Nightly
MOZ_MACBUNDLE_ID=nightly

Просмотреть файл

@ -46,7 +46,7 @@ function createHttpServer(port = -1) {
let server = new HttpServer();
server.start(port);
do_register_cleanup(() => {
registerCleanupFunction(() => {
return new Promise(resolve => {
server.stop(resolve);
});

Просмотреть файл

@ -55,7 +55,7 @@ add_task(async function testSettingsProperties() {
const SINGLE_OPTION = "cache";
const SINGLE_PREF = "privacy.cpd.cache";
do_register_cleanup(() => {
registerCleanupFunction(() => {
Preferences.reset(SINGLE_PREF);
});
@ -100,7 +100,7 @@ add_task(async function testSettingsSince() {
await extension.startup();
do_register_cleanup(() => {
registerCleanupFunction(() => {
Preferences.reset(TIMESPAN_PREF);
});

Просмотреть файл

@ -13,7 +13,7 @@ tmpDir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let baseDir = OS.Path.join(tmpDir.path, slug);
OS.File.makeDir(baseDir);
do_register_cleanup(() => {
registerCleanupFunction(() => {
tmpDir.remove(true);
});
@ -57,7 +57,7 @@ async function setupManifests(modules) {
};
Services.dirsvc.registerProvider(dirProvider);
do_register_cleanup(() => {
registerCleanupFunction(() => {
Services.dirsvc.unregisterProvider(dirProvider);
});
@ -70,7 +70,7 @@ async function setupManifests(modules) {
const REGKEY = String.raw`Software\Mozilla\PKCS11Modules`;
let registry = new MockRegistry();
do_register_cleanup(() => {
registerCleanupFunction(() => {
registry.shutdown();
});

Просмотреть файл

@ -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"); },

Просмотреть файл

@ -64,7 +64,7 @@ function registerFakePath(key, file) {
}
dirsvc.set(key, file);
do_register_cleanup(() => {
registerCleanupFunction(() => {
dirsvc.undefine(key);
if (originalFile) {
dirsvc.set(key, originalFile);

Просмотреть файл

@ -131,7 +131,7 @@ add_task(async function setup() {
dbConn = await Sqlite.openConnection({ path: loginDataFile.path });
registerFakePath("LocalAppData", do_get_file("AppData/Local/"));
do_register_cleanup(() => {
registerCleanupFunction(() => {
Services.logins.removeAllLogins();
crypto.finalize();
return dbConn.close();

Просмотреть файл

@ -335,7 +335,7 @@ add_task(async function test_passwordsAvailable() {
let crypto = new OSCrypto();
let hashes = []; // the hashes of all migrator websites, this is going to be used for the clean up
do_register_cleanup(() => {
registerCleanupFunction(() => {
Services.logins.removeAllLogins();
logins = Services.logins.getAllLogins({});
Assert.equal(logins.length, 0, "There are no logins after the cleanup");

Просмотреть файл

@ -66,7 +66,7 @@ add_task(async function() {
let data = ctypes.char16_t.array()(256);
let sizeRef = DWORD(256).address();
do_register_cleanup(() => {
registerCleanupFunction(() => {
// Remove the cookie.
try {
let expired = new Date(new Date().setDate(date - 2));
@ -91,7 +91,7 @@ add_task(async function() {
// Sanity check the cookie has been created.
Assert.ok(getIECookie(COOKIE.href, COOKIE.name, data, sizeRef),
"Found the added persistent IE cookie");
do_print("Found cookie: " + data.readString());
info("Found cookie: " + data.readString());
Assert.equal(data.readString(), `${COOKIE.name}=${COOKIE.value}`,
"Found the expected cookie");

Просмотреть файл

@ -10,7 +10,7 @@ add_task(async function setup() {
tmpFile.append("TestDB");
dbConn = await Sqlite.openConnection({ path: tmpFile.path });
do_register_cleanup(() => {
registerCleanupFunction(() => {
dbConn.close();
OS.File.remove(tmpFile.path);
});

Просмотреть файл

@ -25,7 +25,7 @@ AutoMigrateBackstage.MigrationUtils = new Proxy({}, {
},
});
do_register_cleanup(function() {
registerCleanupFunction(function() {
AutoMigrateBackstage.MigrationUtils = MigrationUtils;
});
@ -116,7 +116,7 @@ add_task(async function checkProfilePicking() {
add_task(async function checkIntegration() {
gShimmedMigrator = {
get sourceProfiles() {
do_print("Read sourceProfiles");
info("Read sourceProfiles");
return null;
},
getMigrateData(profileToMigrate) {
@ -147,7 +147,7 @@ add_task(async function checkUndoPreconditions() {
let shouldAddData = false;
gShimmedMigrator = {
get sourceProfiles() {
do_print("Read sourceProfiles");
info("Read sourceProfiles");
return null;
},
getMigrateData(profileToMigrate) {
@ -630,17 +630,17 @@ add_task(async function checkUndoVisitsState() {
wrongMethodDeferred.reject(new Error("Unexpected call to onPageChanged " + uri.spec));
},
onFrecencyChanged(aURI) {
do_print("frecency change");
info("frecency change");
Assert.ok(frecencyChangesExpected.has(aURI.spec),
"Should be expecting frecency change for " + aURI.spec);
frecencyChangesExpected.get(aURI.spec).resolve();
},
onManyFrecenciesChanged() {
do_print("Many frecencies changed");
info("Many frecencies changed");
wrongMethodDeferred.reject(new Error("This test can't deal with onManyFrecenciesChanged to be called"));
},
onDeleteURI(aURI) {
do_print("delete uri");
info("delete uri");
Assert.ok(uriDeletedExpected.has(aURI.spec),
"Should be expecting uri deletion for " + aURI.spec);
uriDeletedExpected.get(aURI.spec).resolve();

Просмотреть файл

@ -33,7 +33,7 @@ function cleanup() {
aboutNewTabService.resetNewTabURL();
}
do_register_cleanup(cleanup);
registerCleanupFunction(cleanup);
add_task(async function test_as_and_prerender_initialized() {
Assert.equal(aboutNewTabService.activityStreamEnabled, Services.prefs.getBoolPref(ACTIVITY_STREAM_PREF),

Просмотреть файл

@ -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,7 +89,7 @@ function rebuildSmartBookmarks() {
};
Services.console.reset();
Services.console.registerListener(consoleListener);
do_register_cleanup(() => {
registerCleanupFunction(() => {
try {
Services.console.unregisterListener(consoleListener);
} catch (ex) { /* will likely fail */ }

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function smart_bookmarks_disabled() {
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
Assert.equal(smartBookmarkItemIds.length, 0);
do_print("check that pref has not been bumped up");
info("check that pref has not been bumped up");
Assert.equal(Services.prefs.getIntPref("browser.places.smartBookmarksVersion"), -1);
});
@ -32,7 +32,7 @@ add_task(async function create_smart_bookmarks() {
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
Assert.notEqual(smartBookmarkItemIds.length, 0);
do_print("check that pref has been bumped up");
info("check that pref has been bumped up");
Assert.ok(Services.prefs.getIntPref("browser.places.smartBookmarksVersion") > 0);
});
@ -40,7 +40,7 @@ add_task(async function remove_smart_bookmark_and_restore() {
let smartBookmarkItemIds =
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
let smartBookmarksCount = smartBookmarkItemIds.length;
do_print("remove one smart bookmark and restore");
info("remove one smart bookmark and restore");
let guid = await PlacesUtils.promiseItemGuid(smartBookmarkItemIds[0]);
await PlacesUtils.bookmarks.remove(guid);
@ -51,7 +51,7 @@ add_task(async function remove_smart_bookmark_and_restore() {
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
Assert.equal(smartBookmarkItemIds.length, smartBookmarksCount);
do_print("check that pref has been bumped up");
info("check that pref has been bumped up");
Assert.ok(Services.prefs.getIntPref("browser.places.smartBookmarksVersion") > 0);
});
@ -59,7 +59,7 @@ add_task(async function move_smart_bookmark_rename_and_restore() {
let smartBookmarkItemIds =
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
let smartBookmarksCount = smartBookmarkItemIds.length;
do_print("smart bookmark should be restored in place");
info("smart bookmark should be restored in place");
let guid = await PlacesUtils.promiseItemGuid(smartBookmarkItemIds[0]);
let bm = await PlacesUtils.bookmarks.fetch(guid);
@ -94,6 +94,6 @@ add_task(async function move_smart_bookmark_rename_and_restore() {
Assert.equal(bm.parentGuid, subfolder.guid);
Assert.equal(bm.title, oldTitle);
do_print("check that pref has been bumped up");
info("check that pref has been bumped up");
Assert.ok(Services.prefs.getIntPref("browser.places.smartBookmarksVersion") > 0);
});

Просмотреть файл

@ -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();
});

Просмотреть файл

@ -13,7 +13,7 @@ add_task(async function() {
remove_bookmarks_html();
Services.prefs.setBoolPref("browser.bookmarks.autoExportHTML", true);
do_register_cleanup(() => Services.prefs.clearUserPref("browser.bookmarks.autoExportHTML"));
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.bookmarks.autoExportHTML"));
// Initialize nsBrowserGlue before Places.
Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsISupports);

Просмотреть файл

@ -21,7 +21,7 @@ function run_test() {
run_next_test();
}
do_register_cleanup(function() {
registerCleanupFunction(function() {
remove_bookmarks_html();
remove_all_JSON_backups();
return PlacesUtils.bookmarks.eraseEverything();

Просмотреть файл

@ -19,7 +19,7 @@ function run_test() {
run_next_test();
}
do_register_cleanup(remove_bookmarks_html);
registerCleanupFunction(remove_bookmarks_html);
add_task(async function() {
// Create a corrupt database.

Просмотреть файл

@ -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);
});

Просмотреть файл

@ -35,7 +35,7 @@ function run_test() {
run_next_test();
}
do_register_cleanup(function() {
registerCleanupFunction(function() {
// Remove the distribution file, even if the test failed, otherwise all
// next tests will import it.
let iniFile = gProfD.clone();

Просмотреть файл

@ -19,7 +19,7 @@ function run_test() {
run_next_test();
}
do_register_cleanup(remove_bookmarks_html);
registerCleanupFunction(remove_bookmarks_html);
add_task(async function test_migrate_bookmarks() {
// Initialize Places through the History Service and check that a new

Просмотреть файл

@ -26,7 +26,7 @@ add_task(async function setup() {
// Create our JSON backup from bookmarks.glue.json.
create_JSON_backup("bookmarks.glue.json");
do_register_cleanup(function() {
registerCleanupFunction(function() {
remove_bookmarks_html();
remove_all_JSON_backups();
@ -35,7 +35,7 @@ add_task(async function setup() {
});
function simulatePlacesInit() {
do_print("Simulate Places init");
info("Simulate Places init");
// Force nsBrowserGlue::_initPlaces().
bg.observe(null, TOPIC_BROWSERGLUE_TEST, TOPICDATA_FORCE_PLACES_INIT);
return promiseTopicObserved("places-browser-init-complete");
@ -57,7 +57,7 @@ add_task(async function test_checkPreferences() {
});
add_task(async function test_import() {
do_print("Import from bookmarks.html if importBookmarksHTML is true.");
info("Import from bookmarks.html if importBookmarksHTML is true.");
await PlacesUtils.bookmarks.eraseEverything();
@ -85,8 +85,8 @@ add_task(async function test_import() {
});
add_task(async function test_import_noSmartBookmarks() {
do_print("import from bookmarks.html, but don't create smart bookmarks " +
"if they are disabled");
info("import from bookmarks.html, but don't create smart bookmarks " +
"if they are disabled");
await PlacesUtils.bookmarks.eraseEverything();
@ -115,8 +115,8 @@ add_task(async function test_import_noSmartBookmarks() {
});
add_task(async function test_import_autoExport_updatedSmartBookmarks() {
do_print("Import from bookmarks.html, but don't create smart bookmarks " +
"if autoExportHTML is true and they are at latest version");
info("Import from bookmarks.html, but don't create smart bookmarks " +
"if autoExportHTML is true and they are at latest version");
await PlacesUtils.bookmarks.eraseEverything();
@ -148,8 +148,8 @@ add_task(async function test_import_autoExport_updatedSmartBookmarks() {
});
add_task(async function test_import_autoExport_oldSmartBookmarks() {
do_print("Import from bookmarks.html, and create smart bookmarks if " +
"autoExportHTML is true and they are not at latest version.");
info("Import from bookmarks.html, and create smart bookmarks if " +
"autoExportHTML is true and they are not at latest version.");
await PlacesUtils.bookmarks.eraseEverything();
@ -181,8 +181,8 @@ add_task(async function test_import_autoExport_oldSmartBookmarks() {
});
add_task(async function test_restore() {
do_print("restore from default bookmarks.html if " +
"restore_default_bookmarks is true.");
info("restore from default bookmarks.html if " +
"restore_default_bookmarks is true.");
await PlacesUtils.bookmarks.eraseEverything();
@ -208,8 +208,8 @@ add_task(async function test_restore() {
});
add_task(async function test_restore_import() {
do_print("setting both importBookmarksHTML and " +
"restore_default_bookmarks should restore defaults.");
info("setting both importBookmarksHTML and " +
"restore_default_bookmarks should restore defaults.");
await PlacesUtils.bookmarks.eraseEverything();

Просмотреть файл

@ -24,7 +24,7 @@ function run_test() {
run_next_test();
}
do_register_cleanup(function() {
registerCleanupFunction(function() {
remove_bookmarks_html();
remove_all_JSON_backups();
return PlacesUtils.bookmarks.eraseEverything();

Просмотреть файл

@ -20,7 +20,7 @@ function run_test() {
run_next_test();
}
do_register_cleanup(() => PlacesUtils.bookmarks.eraseEverything());
registerCleanupFunction(() => PlacesUtils.bookmarks.eraseEverything());
function countFolderChildren(aFolderItemId) {
let rootNode = PlacesUtils.getFolderContents(aFolderItemId).root;
@ -53,7 +53,7 @@ add_task(async function setup() {
});
add_task(async function test_version_0() {
do_print("All smart bookmarks are created if smart bookmarks version is 0.");
info("All smart bookmarks are created if smart bookmarks version is 0.");
// Sanity check: we should have default bookmark.
Assert.ok(await PlacesUtils.bookmarks.fetch({
@ -83,7 +83,7 @@ add_task(async function test_version_0() {
});
add_task(async function test_version_change() {
do_print("An existing smart bookmark is replaced when version changes.");
info("An existing smart bookmark is replaced when version changes.");
// Sanity check: we have a smart bookmark on the toolbar.
let bm = await PlacesUtils.bookmarks.fetch({
@ -128,7 +128,7 @@ add_task(async function test_version_change() {
});
add_task(async function test_version_change_pos() {
do_print("bookmarks position is retained when version changes.");
info("bookmarks position is retained when version changes.");
// Sanity check items.
Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
@ -168,7 +168,7 @@ add_task(async function test_version_change_pos() {
});
add_task(async function test_version_change_pos_moved() {
do_print("moved bookmarks position is retained when version changes.");
info("moved bookmarks position is retained when version changes.");
// Sanity check items.
Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
@ -227,7 +227,7 @@ add_task(async function test_version_change_pos_moved() {
});
add_task(async function test_recreation() {
do_print("An explicitly removed smart bookmark should not be recreated.");
info("An explicitly removed smart bookmark should not be recreated.");
// Remove toolbar's smart bookmarks
let bm = await PlacesUtils.bookmarks.fetch({
@ -260,7 +260,7 @@ add_task(async function test_recreation() {
});
add_task(async function test_recreation_version_0() {
do_print("Even if a smart bookmark has been removed recreate it if version is 0.");
info("Even if a smart bookmark has been removed recreate it if version is 0.");
// Sanity check items.
Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),

Просмотреть файл

@ -12,7 +12,7 @@ var gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"]
.getService(Ci.nsIObserver);
var gGetBoolPref = Services.prefs.getBoolPref;
do_register_cleanup(cleanup);
registerCleanupFunction(cleanup);
function cleanup() {
let prefix = "browser.urlbar.suggest.";
@ -34,7 +34,7 @@ function setupBehaviorAndMigrate(aDefaultBehavior, aAutocompleteEnabled = true)
}
add_task(async function() {
do_print("Migrate default.behavior = 0");
info("Migrate default.behavior = 0");
setupBehaviorAndMigrate(0);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -48,7 +48,7 @@ add_task(async function() {
});
add_task(async function() {
do_print("Migrate default.behavior = 1");
info("Migrate default.behavior = 1");
setupBehaviorAndMigrate(1);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -62,7 +62,7 @@ add_task(async function() {
});
add_task(async function() {
do_print("Migrate default.behavior = 2");
info("Migrate default.behavior = 2");
setupBehaviorAndMigrate(2);
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history"), false,
@ -76,7 +76,7 @@ add_task(async function() {
});
add_task(async function() {
do_print("Migrate default.behavior = 3");
info("Migrate default.behavior = 3");
setupBehaviorAndMigrate(3);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -90,7 +90,7 @@ add_task(async function() {
});
add_task(async function() {
do_print("Migrate default.behavior = 19");
info("Migrate default.behavior = 19");
setupBehaviorAndMigrate(19);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -104,7 +104,7 @@ add_task(async function() {
});
add_task(async function() {
do_print("Migrate default.behavior = 33");
info("Migrate default.behavior = 33");
setupBehaviorAndMigrate(33);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -118,7 +118,7 @@ add_task(async function() {
});
add_task(async function() {
do_print("Migrate default.behavior = 129");
info("Migrate default.behavior = 129");
setupBehaviorAndMigrate(129);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -132,7 +132,7 @@ add_task(async function() {
});
add_task(async function() {
do_print("Migrate default.behavior = 0, autocomplete.enabled = false");
info("Migrate default.behavior = 0, autocomplete.enabled = false");
setupBehaviorAndMigrate(0, false);
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history"), false,

Просмотреть файл

@ -40,7 +40,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
var timeInMicroseconds = Date.now() * 1000;
add_task(async function test_execute() {
do_print("Initialize browserglue before Places");
info("Initialize browserglue before Places");
// Avoid default bookmarks import.
let glue = Cc["@mozilla.org/browser/browserglue;1"].
@ -61,20 +61,20 @@ add_task(async function test_execute() {
Services.prefs.setBoolPref("privacy.sanitize.sanitizeOnShutdown", true);
do_print("Add visits.");
info("Add visits.");
for (let aUrl of URIS) {
await PlacesTestUtils.addVisits({
uri: uri(aUrl), visitDate: timeInMicroseconds++,
transition: PlacesUtils.history.TRANSITION_TYPED
});
}
do_print("Add cache.");
info("Add cache.");
await storeCache(FTP_URL, "testData");
do_print("Add form history.");
info("Add form history.");
await addFormHistory();
Assert.equal((await getFormHistoryCount()), 1, "Added form history");
do_print("Simulate and wait shutdown.");
info("Simulate and wait shutdown.");
await shutdownPlaces();
Assert.equal((await getFormHistoryCount()), 0, "Form history cleared");
@ -86,14 +86,14 @@ 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 {
stmt.finalize();
}
do_print("Check cache");
info("Check cache");
// Check cache.
await checkCache(FTP_URL);
});
@ -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();
}
};

Просмотреть файл

@ -28,7 +28,7 @@ add_task(async function() {
gAllBookmarksFolderIdGetter = Object.getOwnPropertyDescriptor(PlacesUIUtils, "allBookmarksFolderId");
Assert.equal(typeof(gAllBookmarksFolderIdGetter.get), "function");
do_register_cleanup(() => PlacesUtils.bookmarks.eraseEverything());
registerCleanupFunction(() => PlacesUtils.bookmarks.eraseEverything());
});
add_task(async function() {

Просмотреть файл

@ -1,42 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<!DOCTYPE prefwindow [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % doNotTrackDTD SYSTEM "chrome://browser/locale/preferences/donottrack.dtd">
%brandDTD;
%doNotTrackDTD;
]>
<prefwindow id="DoNotTrackDialog" type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&window.title;"
style="width: &window.width;; height: &window.height;;"
dlgbuttons="accept,cancel">
<prefpane>
<preferences>
<preference id="privacy.donottrackheader.enabled"
name="privacy.donottrackheader.enabled"
type="bool"/>
</preferences>
<hbox align="center" pack="start">
<!-- Work around focus ring not showing properly. -->
<spacer style="width: 1em;"/>
<checkbox label="&doNotTrackCheckbox2.label;"
accesskey="&doNotTrackCheckbox2.accesskey;"
preference="privacy.donottrackheader.enabled"/>
</hbox>
<description flex="1" class="doNotTrackLearnMore">
&doNotTrackTPInfo.description;
<label class="text-link"
href="https://www.mozilla.org/dnt">&doNotTrackLearnMore.label;</label>
</description>
</prefpane>
</prefwindow>

Просмотреть файл

@ -624,14 +624,6 @@ var gPrivacyPane = {
null, params);
},
/**
* Displays the Do Not Track settings dialog.
*/
showDoNotTrackSettings() {
gSubDialog.open("chrome://browser/content/preferences/donottrack.xul",
"resizable=no");
},
// HISTORY
/*

Просмотреть файл

@ -12,7 +12,6 @@ browser.jar:
content/browser/preferences/cookies.js
* content/browser/preferences/connection.xul
content/browser/preferences/connection.js
content/browser/preferences/donottrack.xul
* content/browser/preferences/fonts.xul
content/browser/preferences/fonts.js
content/browser/preferences/handlers.xml

Просмотреть файл

@ -7,10 +7,10 @@ const {OS} = Cu.import("resource://gre/modules/osfile.jsm", {});
// Call a function once initialization of SessionStartup is complete
function afterSessionStartupInitialization(cb) {
do_print("Waiting for session startup initialization");
info("Waiting for session startup initialization");
let observer = function() {
try {
do_print("Session startup initialization observed");
info("Session startup initialization observed");
Services.obs.removeObserver(observer, "sessionstore-state-finalized");
cb();
} catch (ex) {

Просмотреть файл

@ -39,7 +39,7 @@ var decoder;
function promise_check_exist(path, shouldExist) {
return (async function() {
do_print("Ensuring that " + path + (shouldExist ? " exists" : " does not exist"));
info("Ensuring that " + path + (shouldExist ? " exists" : " does not exist"));
if ((await OS.File.exists(path)) != shouldExist) {
throw new Error("File " + path + " should " + (shouldExist ? "exist" : "not exist"));
}
@ -48,7 +48,7 @@ function promise_check_exist(path, shouldExist) {
function promise_check_contents(path, expect) {
return (async function() {
do_print("Checking whether " + path + " has the right contents");
info("Checking whether " + path + " has the right contents");
let actual = await OS.File.read(path, { encoding: "utf-8", compression: "lz4" });
Assert.deepEqual(JSON.parse(actual), expect, `File ${path} contains the expected data.`);
})();
@ -66,14 +66,14 @@ add_task(async function test_first_write_backup() {
let initial_content = generateFileContents("initial");
let new_content = generateFileContents("test_1");
do_print("Before the first write, none of the files should exist");
info("Before the first write, none of the files should exist");
await promise_check_exist(Paths.backups, false);
await File.makeDir(Paths.backups);
await File.writeAtomic(Paths.clean, JSON.stringify(initial_content), { encoding: "utf-8", compression: "lz4" });
await SessionFile.write(new_content);
do_print("After first write, a few files should have been created");
info("After first write, a few files should have been created");
await promise_check_exist(Paths.backups, true);
await promise_check_exist(Paths.clean, false);
await promise_check_exist(Paths.cleanBackup, true);
@ -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);
});

Просмотреть файл

@ -17,7 +17,7 @@ updateAppInfo({
function promise_check_exist(path, shouldExist) {
return (async function() {
do_print("Ensuring that " + path + (shouldExist ? " exists" : " does not exist"));
info("Ensuring that " + path + (shouldExist ? " exists" : " does not exist"));
if ((await OS.File.exists(path)) != shouldExist) {
throw new Error("File " + path + " should " + (shouldExist ? "exist" : "not exist"));
}
@ -26,7 +26,7 @@ function promise_check_exist(path, shouldExist) {
function promise_check_contents(path, expect) {
return (async function() {
do_print("Checking whether " + path + " has the right contents");
info("Checking whether " + path + " has the right contents");
let actual = await OS.File.read(path, { encoding: "utf-8", compression: "lz4" });
Assert.deepEqual(JSON.parse(actual), expect, `File ${path} contains the expected data.`);
})();

Просмотреть файл

@ -37,7 +37,7 @@ add_task(async function setup() {
await SessionFile.read();
// Reset prefs on cleanup.
do_register_cleanup(() => {
registerCleanupFunction(() => {
Services.prefs.clearUserPref("browser.sessionstore.max_serialize_back");
Services.prefs.clearUserPref("browser.sessionstore.max_serialize_forward");
});

Просмотреть файл

@ -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() {

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function test_check_cleanup_loop_prefs() {
"should have left non-loop pref 'loo.createdRoom' untouched");
});
do_register_cleanup(() => {
registerCleanupFunction(() => {
Services.prefs.clearUserPref("browser.migration.version");
Services.prefs.clearUserPref("loop.createdRoom");
Services.prefs.clearUserPref("loop1.createdRoom");

Просмотреть файл

@ -79,7 +79,7 @@ function run_test() {
run_next_test();
}
do_register_cleanup(function() {
registerCleanupFunction(function() {
// Remove the distribution dir, even if the test failed, otherwise all
// next tests will use it.
let distDir = gProfD.clone();

Просмотреть файл

@ -112,7 +112,7 @@ function setupTest() {
Services.prefs.setBoolPref(PREF_LOAD_FROM_PROFILE, true);
}
do_register_cleanup(function() {
registerCleanupFunction(function() {
deleteDistribution();
Services.prefs.clearUserPref(PREF_LOAD_FROM_PROFILE);
});

Просмотреть файл

@ -33,7 +33,7 @@ add_task(async function test_setup() {
let port = gHttpServer.identity.primaryPort;
gHttpRoot = "http://localhost:" + port + "/";
gHttpServer.registerDirectory("/", do_get_cwd());
do_register_cleanup(() => gHttpServer.stop(() => {}));
registerCleanupFunction(() => gHttpServer.stop(() => {}));
patchPolicy(gPolicy, {
updatechannel: () => "nightly",

Просмотреть файл

@ -55,7 +55,7 @@ add_task(async function test_setup() {
response.processAsync();
response.finish();
});
do_register_cleanup(() => gHttpServer.stop(() => {}));
registerCleanupFunction(() => gHttpServer.stop(() => {}));
Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);

Просмотреть файл

@ -36,7 +36,7 @@ add_task(async function test_setup() {
response.processAsync();
response.finish();
});
do_register_cleanup(() => gHttpServer.stop(() => {}));
registerCleanupFunction(() => gHttpServer.stop(() => {}));
Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);

Просмотреть файл

@ -36,7 +36,7 @@ add_task(async function test_setup() {
response.processAsync();
response.finish();
});
do_register_cleanup(() => gHttpServer.stop(() => {}));
registerCleanupFunction(() => gHttpServer.stop(() => {}));
Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
@ -83,7 +83,7 @@ add_task(async function test_setup() {
],
};
do_print("gManifestObject: " + JSON.stringify(gManifestObject));
info("gManifestObject: " + JSON.stringify(gManifestObject));
// In order for the addon manager to work properly, we hack
// Experiments.instance which is used by the XPIProvider

Просмотреть файл

@ -37,7 +37,7 @@ add_task(async function test_setup() {
response.processAsync();
response.finish();
});
do_register_cleanup(() => gHttpServer.stop(() => {}));
registerCleanupFunction(() => gHttpServer.stop(() => {}));
Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);

Просмотреть файл

@ -20,7 +20,7 @@ function run_test() {
let port = gHttpServer.identity.primaryPort;
gHttpRoot = "http://localhost:" + port + "/";
gHttpServer.registerDirectory("/", do_get_cwd());
do_register_cleanup(() => gHttpServer.stop(() => {}));
registerCleanupFunction(() => gHttpServer.stop(() => {}));
Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function test_setup() {
response.write("["); // never finish!
});
do_register_cleanup(() => httpServer.stop(() => {}));
registerCleanupFunction(() => httpServer.stop(() => {}));
Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);

Просмотреть файл

@ -26,7 +26,7 @@ add_task(function test_setup() {
res.processAsync();
res.finish();
});
do_register_cleanup(() => gHttpServer.stop(() => {}));
registerCleanupFunction(() => gHttpServer.stop(() => {}));
Services.prefs.setBoolPref("experiments.enabled", true);
Services.prefs.setCharPref("experiments.manifest.uri",

Просмотреть файл

@ -24,7 +24,7 @@ var gManifestHandlerURI = null;
const TLOG = TELEMETRY_LOG;
function checkEvent(event, id, data) {
do_print("Checking message " + id);
info("Checking message " + id);
Assert.equal(event[0], id, "id should match");
Assert.ok(event[1] > 0, "timestamp should be greater than 0");
@ -55,7 +55,7 @@ add_task(async function test_setup() {
response.processAsync();
response.finish();
});
do_register_cleanup(() => gHttpServer.stop(() => {}));
registerCleanupFunction(() => gHttpServer.stop(() => {}));
Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
@ -131,7 +131,7 @@ add_task(async function test_telemetryBasics() {
expectedLogLength += 2;
let log = TelemetryLog.entries();
do_print("Telemetry log: " + JSON.stringify(log));
info("Telemetry log: " + JSON.stringify(log));
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
checkEvent(log[log.length - 2], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.REJECTED, EXPERIMENT1_ID, "startTime"]);

Просмотреть файл

@ -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();
@ -82,8 +82,8 @@ function verifySectionFieldDetails(sections, expectedResults) {
Assert.equal(sections.length, expectedResults.length, "Expected section count.");
sections.forEach((sectionInfo, sectionIndex) => {
let expectedSectionInfo = expectedResults[sectionIndex];
do_print("FieldName Prediction Results: " + sectionInfo.map(i => i.fieldName));
do_print("FieldName Expected Results: " + expectedSectionInfo.map(i => i.fieldName));
info("FieldName Prediction Results: " + sectionInfo.map(i => i.fieldName));
info("FieldName Expected Results: " + expectedSectionInfo.map(i => i.fieldName));
Assert.equal(sectionInfo.length, expectedSectionInfo.length, "Expected field count.");
sectionInfo.forEach((field, fieldIndex) => {
@ -101,7 +101,7 @@ function runHeuristicsTest(patterns, fixturePathPrefix) {
patterns.forEach(testPattern => {
add_task(async function() {
do_print("Starting test fixture: " + testPattern.fixturePath);
info("Starting test fixture: " + testPattern.fixturePath);
let file = do_get_file(fixturePathPrefix + testPattern.fixturePath);
let doc = MockDocument.createTestDocumentFromFile("http://localhost:8080/test/", file);
@ -180,7 +180,7 @@ add_task(async function head_initialize() {
Services.prefs.setBoolPref("dom.forms.autocomplete.formautofill", true);
// Clean up after every test.
do_register_cleanup(function head_cleanup() {
registerCleanupFunction(function head_cleanup() {
Services.prefs.clearUserPref("extensions.formautofill.available");
Services.prefs.clearUserPref("extensions.formautofill.creditCards.available");
Services.prefs.clearUserPref("extensions.formautofill.heuristics.enabled");

Просмотреть файл

@ -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,33 +40,33 @@ 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() {
let formAutofillParent = new FormAutofillParent();
do_register_cleanup(function cleanup() {
registerCleanupFunction(function cleanup() {
Services.prefs.clearUserPref("extensions.formautofill.addresses.enabled");
Services.prefs.clearUserPref("extensions.formautofill.creditCards.enabled");
});
@ -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);
});

Просмотреть файл

@ -65,7 +65,7 @@ add_task(async function test_loadDataState() {
SUPPORT_COUNTRIES_TESTCASES.forEach(testcase => {
add_task(async function test_support_country() {
do_print("Starting testcase: Check " + testcase.country + " metadata");
info("Starting testcase: Check " + testcase.country + " metadata");
let metadata = FormAutofillUtils.getCountryAddressData(testcase.country);
Assert.ok(testcase.properties.every(key => metadata[key]),
"These properties should exist: " + testcase.properties);

Просмотреть файл

@ -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,21 +494,21 @@ 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) => {
add_task(async function test_merge() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let profileStorage = await initProfileStorage(TEST_STORE_FILE_NAME,
[testcase.addressInStorage]);
let addresses = profileStorage.addresses.getAll();
@ -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);
});

Просмотреть файл

@ -490,7 +490,7 @@ function do_test(testcases, testFn) {
(function() {
let testcase = tc;
add_task(async function() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let ccNumber = testcase.profileData["cc-number"];
if (ccNumber) {
testcase.profileData["cc-number-encrypted"] = await MasterPassword.encrypt(ccNumber);
@ -512,7 +512,7 @@ function do_test(testcases, testFn) {
if (e.result != Cr.NS_ERROR_ABORT) {
throw e;
}
do_print("User canceled master password entry");
info("User canceled master password entry");
}
return string;
};

Просмотреть файл

@ -436,7 +436,7 @@ for (let tc of TESTCASES) {
(function() {
let testcase = tc;
add_task(async function() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let doc = MockDocument.createTestDocument("http://localhost:8080/test/",
testcase.document);

Просмотреть файл

@ -369,7 +369,7 @@ const TESTCASES = [
for (let testcase of TESTCASES) {
add_task(async function() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let doc = MockDocument.createTestDocument("http://localhost:8080/test/", testcase.document);
let form = doc.querySelector("form");

Просмотреть файл

@ -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,14 +435,14 @@ 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) => {
add_task(async function test_merge() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let profileStorage = await initProfileStorage(TEST_STORE_FILE_NAME,
[testcase.creditCardInStorage],
"creditCards");
@ -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);
});

Просмотреть файл

@ -53,7 +53,7 @@ const TESTCASES = [
TESTCASES.forEach(testcase => {
add_task(async function() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
LabelUtils._labelStrings = new WeakMap();
let doc = MockDocument.createTestDocument(

Просмотреть файл

@ -77,7 +77,7 @@ const TESTCASES = [
TESTCASES.forEach(testcase => {
add_task(async function() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let doc = MockDocument.createTestDocument(
"http://localhost:8080/test/", testcase.document);

Просмотреть файл

@ -925,7 +925,7 @@ const TESTCASES = [
for (let testcase of TESTCASES) {
add_task(async function() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let doc = MockDocument.createTestDocument("http://localhost:8080/test/",
testcase.document);

Просмотреть файл

@ -40,13 +40,13 @@ add_task(async function test_isAddressField_isCreditCardField() {
};
for (let fieldName of Object.keys(TEST_CASES)) {
do_print("Starting testcase: " + fieldName);
let info = TEST_CASES[fieldName];
info("Starting testcase: " + fieldName);
let field = TEST_CASES[fieldName];
Assert.equal(FormAutofillUtils.isAddressField(fieldName),
info.isAddressField,
field.isAddressField,
"isAddressField");
Assert.equal(FormAutofillUtils.isCreditCardField(fieldName),
info.isCreditCardField,
field.isCreditCardField,
"isCreditCardField");
}
});

Просмотреть файл

@ -80,7 +80,7 @@ function inputDetailAssertion(detail, expected) {
TESTCASES.forEach(testcase => {
add_task(async function() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let doc = MockDocument.createTestDocument(
"http://localhost:8080/test/", testcase.document);

Просмотреть файл

@ -237,7 +237,7 @@ const TESTCASES = [
TESTCASES.forEach(testcase => {
add_task(async function() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let doc = MockDocument.createTestDocument(
"http://localhost:8080/test/", testcase.document);
@ -251,7 +251,7 @@ TESTCASES.forEach(testcase => {
});
add_task(async function test_regexp_list() {
do_print("Verify the fieldName support for select element.");
info("Verify the fieldName support for select element.");
let SUPPORT_LIST = {
"email": null, // email
"tel-extension": null, // tel-extension
@ -286,8 +286,8 @@ add_task(async function test_regexp_list() {
contactType: "",
} : null),
};
do_print(testcase.description);
do_print(testcase.document);
info(testcase.description);
info(testcase.document);
let doc = MockDocument.createTestDocument(
"http://localhost:8080/test/", testcase.document);

Просмотреть файл

@ -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();
}
}
@ -152,7 +152,7 @@ add_task(async function test_getRecords_addresses() {
];
for (let testCase of testCases) {
do_print("Starting testcase: " + testCase.description);
info("Starting testcase: " + testCase.description);
let mock = sinon.mock(target);
mock.expects("sendAsyncMessage").once().withExactArgs("FormAutofill:Records",
testCase.expectedResult);
@ -248,7 +248,7 @@ add_task(async function test_getRecords_creditCards() {
];
for (let testCase of testCases) {
do_print("Starting testcase: " + testCase.description);
info("Starting testcase: " + testCase.description);
if (testCase.mpEnabled) {
let tokendb = Cc["@mozilla.org/security/pk11tokendb;1"].createInstance(Ci.nsIPK11TokenDB);
let token = tokendb.getInternalKeyToken();

Просмотреть файл

@ -7,26 +7,26 @@
// Load bootstrap.js into a sandbox to be able to test `isAvailable`
let sandbox = {};
Services.scriptloader.loadSubScript(bootstrapURI, sandbox, "utf-8");
do_print("bootstrapURI: " + bootstrapURI);
info("bootstrapURI: " + bootstrapURI);
add_task(async function test_defaultTestEnvironment() {
do_check_true(sandbox.isAvailable());
Assert.ok(sandbox.isAvailable());
});
add_task(async function test_unsupportedRegion() {
Services.prefs.setCharPref("extensions.formautofill.available", "detect");
Services.prefs.setCharPref("browser.search.region", "ZZ");
do_register_cleanup(function cleanupRegion() {
registerCleanupFunction(function cleanupRegion() {
Services.prefs.clearUserPref("browser.search.region");
});
do_check_false(sandbox.isAvailable());
Assert.ok(!sandbox.isAvailable());
});
add_task(async function test_supportedRegion() {
Services.prefs.setCharPref("extensions.formautofill.available", "detect");
Services.prefs.setCharPref("browser.search.region", "US");
do_register_cleanup(function cleanupRegion() {
registerCleanupFunction(function cleanupRegion() {
Services.prefs.clearUserPref("browser.search.region");
});
do_check_true(sandbox.isAvailable());
Assert.ok(sandbox.isAvailable());
});

Просмотреть файл

@ -68,8 +68,8 @@ const TESTCASES = [
add_task(async function test_isCJKName() {
TESTCASES.forEach(testcase => {
do_print("Starting testcase: " + testcase.fullName);
info("Starting testcase: " + testcase.fullName);
let result = FormAutofillNameUtils._isCJKName(testcase.fullName);
do_check_eq(result, testcase.expectedResult);
Assert.equal(result, testcase.expectedResult);
});
});

Просмотреть файл

@ -67,7 +67,7 @@ const TESTCASES = [
TESTCASES.forEach(testcase => {
add_task(async function() {
do_print("Starting testcase: " + testcase.document);
info("Starting testcase: " + testcase.document);
let doc = MockDocument.createTestDocument(
"http://localhost:8080/test/", testcase.document);

Просмотреть файл

@ -67,7 +67,7 @@ FormAutofillContent._markAsAutofillField = function(field) {
TESTCASES.forEach(testcase => {
add_task(async function() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
markedFieldId = [];

Просмотреть файл

@ -62,7 +62,7 @@ do_get_profile();
let windowWatcherCID =
MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1",
gWindowWatcher);
do_register_cleanup(() => {
registerCleanupFunction(() => {
MockRegistrar.unregister(windowWatcherCID);
});
@ -70,7 +70,7 @@ TESTCASES.forEach(testcase => {
let token = MasterPassword._token;
add_task(async function test_encrypt_decrypt() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
token.initPassword(testcase.masterPassword);
// Test only: Force the token login without asking for master password

Просмотреть файл

@ -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]);
}
};
@ -243,7 +243,7 @@ add_task(async function test_migrateAddressRecords() {
await profileStorage.initialize();
ADDRESS_TESTCASES.forEach(testcase => {
do_print(testcase.description);
info(testcase.description);
profileStorage.addresses._migrateRecord(testcase.record);
do_check_record_matches(testcase.expectedResult, testcase.record);
});
@ -256,7 +256,7 @@ add_task(async function test_migrateCreditCardRecords() {
await profileStorage.initialize();
CREDIT_CARD_TESTCASES.forEach(testcase => {
do_print(testcase.description);
info(testcase.description);
profileStorage.creditCards._migrateRecord(testcase.record);
do_check_record_matches(testcase.expectedResult, testcase.record);
});

Просмотреть файл

@ -268,7 +268,7 @@ const TESTCASES = [
add_task(async function test_splitName() {
TESTCASES.forEach(testcase => {
if (testcase.fullName) {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let nameParts = FormAutofillNameUtils.splitName(testcase.fullName);
Assert.deepEqual(nameParts, testcase.nameParts);
}
@ -277,8 +277,8 @@ add_task(async function test_splitName() {
add_task(async function test_joinName() {
TESTCASES.forEach(testcase => {
do_print("Starting testcase: " + testcase.description);
info("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);
});
});

Просмотреть файл

@ -489,7 +489,7 @@ const TESTCASES = [
];
add_task(async function handle_earlyformsubmit_event() {
do_print("Starting testcase: Test an invalid form element");
info("Starting testcase: Test an invalid form element");
let fakeForm = MOCK_DOC.createElement("form");
sinon.spy(FormAutofillContent, "_onFormSubmit");
@ -558,7 +558,7 @@ add_task(async function autofill_disabled() {
TESTCASES.forEach(testcase => {
add_task(async function check_records_saving_is_called_correctly() {
do_print("Starting testcase: " + testcase.description);
info("Starting testcase: " + testcase.description);
let form = MOCK_DOC.getElementById("form1");
form.reset();

Просмотреть файл

@ -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");
});

Просмотреть файл

@ -351,7 +351,7 @@ let testSets = [{
add_task(async function test_all_patterns() {
testSets.forEach(({collectionConstructor, testCases}) => {
testCases.forEach(testCase => {
do_print("Starting testcase: " + testCase.description);
info("Starting testcase: " + testCase.description);
let actual = new collectionConstructor(testCase.searchString,
testCase.fieldName,
testCase.allFieldNames,

Просмотреть файл

@ -994,12 +994,12 @@ add_task(async function test_reconcile_three_way_merge() {
};
for (let collectionName in TESTCASES) {
do_print(`Start to test reconcile on ${collectionName}`);
info(`Start to test reconcile on ${collectionName}`);
let profileStorage = await initProfileStorage(TEST_STORE_FILE_NAME, null, collectionName);
for (let test of TESTCASES[collectionName]) {
do_print(test.description);
info(test.description);
profileStorage[collectionName].add(test.parent, {sourceSync: true});

Просмотреть файл

@ -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,19 +27,19 @@ 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() {
let formAutofillParent = new FormAutofillParent();
await formAutofillParent.init();
do_register_cleanup(function cleanup() {
registerCleanupFunction(function cleanup() {
Services.prefs.clearUserPref("extensions.formautofill.addresses.enabled");
});
@ -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) {

Просмотреть файл

@ -51,10 +51,10 @@ function add_storage_task(test_function) {
}
add_storage_task(async function test_simple_tombstone(storage, record) {
do_print("check simple tombstone semantics");
info("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);
@ -70,10 +70,10 @@ add_storage_task(async function test_simple_tombstone(storage, record) {
});
add_storage_task(async function test_simple_synctombstone(storage, record) {
do_print("check simple tombstone semantics for synced records");
info("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.
@ -98,7 +98,7 @@ add_storage_task(async function test_simple_synctombstone(storage, record) {
});
add_storage_task(async function test_add_tombstone(storage, record) {
do_print("Should be able to add a new tombstone");
info("Should be able to add a new tombstone");
let guid = storage.add({guid: "test-guid-1", deleted: true});
// should be unable to get it normally.
@ -120,13 +120,13 @@ add_storage_task(async function test_add_tombstone(storage, record) {
});
add_storage_task(async function test_add_tombstone_without_guid(storage, record) {
do_print("Should not be able to add a new tombstone without specifying the guid");
info("Should not be able to add a new tombstone without specifying the guid");
Assert.throws(() => { storage.add({deleted: true}); });
Assert.equal(storage.getAll({includeDeleted: true}).length, 0);
});
add_storage_task(async function test_add_tombstone_existing_guid(storage, record) {
do_print("Should not be able to add a new tombstone when a record with that ID exists");
info("Should not be able to add a new tombstone when a record with that ID exists");
let guid = storage.add(record);
Assert.throws(() => { storage.add({guid, deleted: true}); });
@ -136,13 +136,13 @@ add_storage_task(async function test_add_tombstone_existing_guid(storage, record
});
add_storage_task(async function test_update_tombstone(storage, record) {
do_print("Updating a tombstone should fail");
info("Updating a tombstone should fail");
let guid = storage.add({guid: "test-guid-1", deleted: true});
Assert.throws(() => storage.update(guid, {}), /No matching record./);
});
add_storage_task(async function test_remove_existing_tombstone(storage, record) {
do_print("Removing a record that's already a tombstone should be a no-op");
info("Removing a record that's already a tombstone should be a no-op");
let guid = storage.add({guid: "test-guid-1", deleted: true, timeLastModified: 1234});
storage.remove(guid);

Просмотреть файл

@ -58,10 +58,10 @@ function expectLocalProfiles(profileStorage, expected) {
ok(objectMatches(thisGot, thisExpected));
}
} catch (ex) {
do_print("Comparing expected profiles:");
do_print(JSON.stringify(expected, undefined, 2));
do_print("against actual profiles:");
do_print(JSON.stringify(profiles, undefined, 2));
info("Comparing expected profiles:");
info(JSON.stringify(expected, undefined, 2));
info("against actual profiles:");
info(JSON.stringify(profiles, undefined, 2));
throw ex;
}
}

Просмотреть файл

@ -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]);
}
};
@ -845,7 +845,7 @@ add_task(async function test_computeAddressFields() {
await profileStorage.initialize();
ADDRESS_COMPUTE_TESTCASES.forEach(testcase => {
do_print("Verify testcase: " + testcase.description);
info("Verify testcase: " + testcase.description);
let guid = profileStorage.addresses.add(testcase.address);
let address = profileStorage.addresses.get(guid);
@ -862,7 +862,7 @@ add_task(async function test_normalizeAddressFields() {
await profileStorage.initialize();
ADDRESS_NORMALIZE_TESTCASES.forEach(testcase => {
do_print("Verify testcase: " + testcase.description);
info("Verify testcase: " + testcase.description);
let guid = profileStorage.addresses.add(testcase.address);
let address = profileStorage.addresses.get(guid);
@ -879,7 +879,7 @@ add_task(async function test_computeCreditCardFields() {
await profileStorage.initialize();
CREDIT_CARD_COMPUTE_TESTCASES.forEach(testcase => {
do_print("Verify testcase: " + testcase.description);
info("Verify testcase: " + testcase.description);
let guid = profileStorage.creditCards.add(testcase.creditCard);
let creditCard = profileStorage.creditCards.get(guid);
@ -896,7 +896,7 @@ add_task(async function test_normalizeCreditCardFields() {
await profileStorage.initialize();
CREDIT_CARD_NORMALIZE_TESTCASES.forEach(testcase => {
do_print("Verify testcase: " + testcase.description);
info("Verify testcase: " + testcase.description);
let guid = profileStorage.creditCards.add(testcase.creditCard);
let creditCard = profileStorage.creditCards.get(guid, {rawData: true});

Просмотреть файл

@ -53,7 +53,7 @@ function Call_PpbFunc(obj) {
// PPAPIInstance constructor(id, rt, info, window, eventHandler, containerWindow, mm)
let instance = new PPAPIInstance(instanceId, rt, info, new Mock_Window(), null /*docShell.chromeEventHandler*/, null, new Mock_MessageManager());
do_register_cleanup(function () {
registerCleanupFunction(function () {
resHandler.setSubstitution("ppapi.js", null);
})

Просмотреть файл

@ -7,83 +7,83 @@
Cu.import("resource://onboarding/modules/OnboardingTourType.jsm");
add_task(async function() {
do_print("Starting testcase: When New user open the browser first time");
info("Starting testcase: When New user open the browser first time");
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");
});
add_task(async function() {
do_print("Starting testcase: When New user restart the browser");
info("Starting testcase: When New user restart the browser");
resetOnboardingDefaultState();
Preferences.set(PREF_TOUR_TYPE, "new");
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");
});
add_task(async function() {
do_print("Starting testcase: When New User choosed to hide the overlay and restart the browser");
info("Starting testcase: When New User choosed to hide the overlay and restart the browser");
resetOnboardingDefaultState();
Preferences.set(PREF_TOUR_TYPE, "new");
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");
});
add_task(async function() {
do_print("Starting testcase: When New User updated to the next major version and restart the browser");
info("Starting testcase: When New User updated to the next major version and restart the browser");
resetOnboardingDefaultState();
Preferences.set(PREF_TOURSET_VERSION, NEXT_TOURSET_VERSION);
Preferences.set(PREF_TOUR_TYPE, "new");
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");
});
add_task(async function() {
do_print("Starting testcase: When New User prefer hide the tour, then updated to the next major version and restart the browser");
info("Starting testcase: When New User prefer hide the tour, then updated to the next major version and restart the browser");
resetOnboardingDefaultState();
Preferences.set(PREF_TOURSET_VERSION, NEXT_TOURSET_VERSION);
Preferences.set(PREF_TOUR_TYPE, "new");
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");
});
add_task(async function() {
do_print("Starting testcase: When User update from browser version < 56");
info("Starting testcase: When User update from browser version < 56");
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");
});

Просмотреть файл

@ -1,13 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY window.title "Do Not Track">
<!ENTITY window.width "50em">
<!ENTITY window.height "10em">
<!ENTITY doNotTrackCheckbox2.label "Always apply Do Not Track">
<!ENTITY doNotTrackCheckbox2.accesskey "A">
<!ENTITY doNotTrackTPInfo.description "&brandShortName; will send a signal that you dont want to be tracked whenever Tracking Protection is on.">
<!ENTITY doNotTrackLearnMore.label "Learn More">

Просмотреть файл

@ -72,7 +72,6 @@
locale/browser/preferences/containers.properties (%chrome/browser/preferences/containers.properties)
locale/browser/preferences/content.dtd (%chrome/browser/preferences/content.dtd)
locale/browser/preferences/cookies.dtd (%chrome/browser/preferences/cookies.dtd)
locale/browser/preferences/donottrack.dtd (%chrome/browser/preferences/donottrack.dtd)
locale/browser/preferences/fonts.dtd (%chrome/browser/preferences/fonts.dtd)
locale/browser/preferences/languages.dtd (%chrome/browser/preferences/languages.dtd)
locale/browser/preferences/main.dtd (%chrome/browser/preferences/main.dtd)

Просмотреть файл

@ -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;
})();
}
@ -165,7 +165,7 @@ function run_test() {
run_next_test();
// Teardown.
do_register_cleanup(function() {
registerCleanupFunction(function() {
server.stop(function() { });
DirectoryLinksProvider.reset();
Services.locale.setRequestedLocales(origReqLocales);
@ -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));
}
@ -44,12 +44,12 @@ function checkSandboxOriginAttributes(arr, attrs, options) {
// utility function useful for debugging
function printAttrs(name, attrs) {
do_print(name + " {\n" +
"\tappId: " + attrs.appId + ",\n" +
"\tuserContextId: " + attrs.userContextId + ",\n" +
"\tinIsolatedMozBrowser: " + attrs.inIsolatedMozBrowser + ",\n" +
"\tprivateBrowsingId: '" + attrs.privateBrowsingId + "',\n" +
"\tfirstPartyDomain: '" + attrs.firstPartyDomain + "'\n}");
info(name + " {\n" +
"\tappId: " + attrs.appId + ",\n" +
"\tuserContextId: " + attrs.userContextId + ",\n" +
"\tinIsolatedMozBrowser: " + attrs.inIsolatedMozBrowser + ",\n" +
"\tprivateBrowsingId: '" + attrs.privateBrowsingId + "',\n" +
"\tfirstPartyDomain: '" + attrs.firstPartyDomain + "'\n}");
}
@ -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!");

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше