diff --git a/.eslintrc.js b/.eslintrc.js index bd97f421ddcb..451de6c6f302 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -39,15 +39,5 @@ module.exports = { "env": { "mozilla/browser-window": true } - }, { - // XXX Bug 1452706. These directories are still being fixed, so turn off - // mozilla/require-expected-throws-or-rejects for now. - "files": [ - "services/fxaccounts/**", - "toolkit/components/**", - ], - "rules": { - "mozilla/rejects-requires-await": "off", - } }] }; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_debugging_utils.js b/toolkit/components/extensions/test/xpcshell/test_ext_debugging_utils.js index 4daa4bffa995..7ca0a4c9b7c5 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_debugging_utils.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_debugging_utils.js @@ -60,8 +60,8 @@ add_task(async function testExtensionDebuggingUtilsCleanup() { const waitRejection = ExtensionParent.DebugUtils.getExtensionProcessBrowser(nonExistentAddonActor); - Assert.rejects(waitRejection, /Extension not found/, - "Reject with the expected message for non existent addons"); + await Assert.rejects(waitRejection, /Extension not found/, + "Reject with the expected message for non existent addons"); equal(debugBrowserPromises.size, 1, "No additional debugging resources has been allocated"); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_async.js b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_async.js index 7aee7ad62961..696e5999bc29 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_async.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_schemas_async.js @@ -273,10 +273,10 @@ add_task(async function testAsyncResults() { if (!isChromeCompat) { // No promises for chrome. await Assert.rejects( testnamespace.async_required(), /ONE/, - "should reject testnamespace.async_required()").catch(() => {}); + "should reject testnamespace.async_required()"); await Assert.rejects( testnamespace.async_optional(), /TWO/, - "should reject testnamespace.async_optional()").catch(() => {}); + "should reject testnamespace.async_optional()"); } Assert.equal(await runFailCallback(testnamespace.async_required), "ONE"); diff --git a/toolkit/components/normandy/test/browser/browser_AddonStudies.js b/toolkit/components/normandy/test/browser/browser_AddonStudies.js index 4840665fc5de..397dfd649991 100644 --- a/toolkit/components/normandy/test/browser/browser_AddonStudies.js +++ b/toolkit/components/normandy/test/browser/browser_AddonStudies.js @@ -119,7 +119,7 @@ add_task(async function testStartRequiredArguments() { for (const key in requiredArguments) { const args = Object.assign({}, requiredArguments); delete args[key]; - Assert.rejects( + await Assert.rejects( AddonStudies.start(args), /Required arguments/, `start rejects when missing required argument ${key}.` @@ -132,7 +132,7 @@ decorate_task( studyFactory(), ]), async function testStartExisting([study]) { - Assert.rejects( + await Assert.rejects( AddonStudies.start(startArgsFactory({recipeId: study.recipeId})), /already exists/, "start rejects when a study exists with the given recipeId already." diff --git a/toolkit/components/normandy/test/browser/browser_BaseAction.js b/toolkit/components/normandy/test/browser/browser_BaseAction.js index 6f816d7a6ca2..2eff43690bcc 100644 --- a/toolkit/components/normandy/test/browser/browser_BaseAction.js +++ b/toolkit/components/normandy/test/browser/browser_BaseAction.js @@ -106,7 +106,7 @@ decorate_task( await action.runRecipe(recipe1); await action.finalize(); - Assert.rejects( + await Assert.rejects( action.runRecipe(recipe2), /^Error: Action has already been finalized$/, "running recipes after finalization is an error", diff --git a/toolkit/components/osfile/tests/xpcshell/test_osfile_win_async_setPermissions.js b/toolkit/components/osfile/tests/xpcshell/test_osfile_win_async_setPermissions.js index f618fae7ef7b..aff535a4cc83 100644 --- a/toolkit/components/osfile/tests/xpcshell/test_osfile_win_async_setPermissions.js +++ b/toolkit/components/osfile/tests/xpcshell/test_osfile_win_async_setPermissions.js @@ -87,9 +87,9 @@ add_task(async function test_file_setPermissions() { add_task(async function test_non_existant_file_path_setPermissions() { let path = OS.Path.join(OS.Constants.Path.tmpDir, "test_osfile_win_async_setPermissions_path.tmp"); - Assert.rejects(OS.File.setPermissions(path, {winAttributes: {readOnly: true}}), - /The system cannot find the file specified/, - "setPermissions failed as expected on a non-existant file path"); + await Assert.rejects(OS.File.setPermissions(path, {winAttributes: {readOnly: true}}), + /The system cannot find the file specified/, + "setPermissions failed as expected on a non-existant file path"); }); // Test application to Check setPermissions on a invalid file handle. @@ -101,9 +101,9 @@ add_task(async function test_closed_file_handle_setPermissions() { try { let fd = await OS.File.open(path, { write: true }); await fd.close(); - Assert.rejects(fd.setPermissions(path, {winAttributes: {readOnly: true}}), - /The handle is invalid/, - "setPermissions failed as expected on a invalid file handle"); + await Assert.rejects(fd.setPermissions(path, {winAttributes: {readOnly: true}}), + /The handle is invalid/, + "setPermissions failed as expected on a invalid file handle"); } finally { await OS.File.remove(path); } diff --git a/toolkit/components/places/tests/bookmarks/test_bookmarks_update.js b/toolkit/components/places/tests/bookmarks/test_bookmarks_update.js index 6b2cf7bebe5e..9348ac0b5c57 100644 --- a/toolkit/components/places/tests/bookmarks/test_bookmarks_update.js +++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_update.js @@ -85,7 +85,7 @@ add_task(async function move_roots_fail() { PlacesUtils.bookmarks.tagsGuid, PlacesUtils.bookmarks.mobileGuid]; for (let guid of guids) { - Assert.rejects(PlacesUtils.bookmarks.update({ + await Assert.rejects(PlacesUtils.bookmarks.update({ guid, index: -1, parentGuid: PlacesUtils.bookmarks.unfiledGuid, diff --git a/toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js b/toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js index 52a51936475e..0fb131375313 100644 --- a/toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js +++ b/toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js @@ -228,7 +228,7 @@ add_task(async function test_html_restore_nonexist() { info("HTML restore: nonexistent file should fail"); let file = Services.dirsvc.get("ProfD", Ci.nsIFile); file.append("this file doesn't exist because nobody created it 2"); - Assert.rejects(BookmarkHTMLUtils.importFromFile(file.path), + await Assert.rejects(BookmarkHTMLUtils.importFromFile(file.path), /Cannot import from nonexisting html file/, "Restore should reject for a non-existent file."); await checkObservers(expectPromises, expectedData); @@ -288,7 +288,7 @@ add_task(async function test_html_init_restore_nonexist() { info("HTML initial restore: nonexistent file should fail"); let file = Services.dirsvc.get("ProfD", Ci.nsIFile); file.append("this file doesn't exist because nobody created it 3"); - Assert.rejects(BookmarkHTMLUtils.importFromFile(file.path, { replace: true }), + await Assert.rejects(BookmarkHTMLUtils.importFromFile(file.path, { replace: true }), /Cannot import from nonexisting html file/, "Restore should reject for a non-existent file."); await checkObservers(expectPromises, expectedData); diff --git a/toolkit/components/satchel/test/unit/test_history_api.js b/toolkit/components/satchel/test/unit/test_history_api.js index 59387537a148..ec6b7f600e7f 100644 --- a/toolkit/components/satchel/test/unit/test_history_api.js +++ b/toolkit/components/satchel/test/unit/test_history_api.js @@ -383,26 +383,26 @@ add_task(async function() { Services.prefs.setBoolPref("browser.formfill.enable", false); // Cannot use arrow functions, see bug 1237961. - Assert.rejects(promiseUpdate( + await Assert.rejects(promiseUpdate( { op: "bump", fieldname: "field5", value: "value5" }), - function(err) { return err.result == Ci.mozIStorageError.MISUSE; }, - "bumping when form history is disabled should fail"); - Assert.rejects(promiseUpdate( + function(err) { return err.result == Ci.mozIStorageError.MISUSE; }, + "bumping when form history is disabled should fail"); + await Assert.rejects(promiseUpdate( { op: "add", fieldname: "field5", value: "value5" }), - function(err) { return err.result == Ci.mozIStorageError.MISUSE; }, - "Adding when form history is disabled should fail"); - Assert.rejects(promiseUpdate([ + function(err) { return err.result == Ci.mozIStorageError.MISUSE; }, + "Adding when form history is disabled should fail"); + await Assert.rejects(promiseUpdate([ { op: "update", fieldname: "field5", value: "value5" }, { op: "remove", fieldname: "field5", value: "value5" }, ]), - function(err) { return err.result == Ci.mozIStorageError.MISUSE; }, - "mixed operations when form history is disabled should fail"); - Assert.rejects(promiseUpdate([ + function(err) { return err.result == Ci.mozIStorageError.MISUSE; }, + "mixed operations when form history is disabled should fail"); + await Assert.rejects(promiseUpdate([ null, undefined, "", 1, {}, { op: "remove", fieldname: "field5", value: "value5" }, ]), - function(err) { return err.result == Ci.mozIStorageError.MISUSE; }, - "Invalid entries when form history is disabled should fail"); + function(err) { return err.result == Ci.mozIStorageError.MISUSE; }, + "Invalid entries when form history is disabled should fail"); // Remove should work though. await promiseUpdate([{ op: "remove", fieldname: "field5", value: null },