Bug 1470455 - Add the 'expected' arguments to throws/rejects for toolkit. r?Mossop
MozReview-Commit-ID: Ln9EpDpTR91
--- a/toolkit/components/extensions/test/xpcshell/test_ext_legacy_extension_embedding.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_legacy_extension_embedding.js
@@ -136,29 +136,29 @@ async function createManifestErrorTestCa
await embeddedExtension.shutdown();
}
add_task(async function test_startup_error_empty_manifest() {
const id = "empty-manifest@test.embedded.web.extension";
const files = {
"webextension/manifest.json": ``,
};
- const expectedError = "(NS_BASE_STREAM_CLOSED)";
+ const expectedError = /NS_BASE_STREAM_CLOSED/;
let fakeHybridAddonFile = Extension.generateZipFile(files);
await createManifestErrorTestCase(id, fakeHybridAddonFile, expectedError);
});
add_task(async function test_startup_error_invalid_json_manifest() {
const id = "invalid-json-manifest@test.embedded.web.extension";
const files = {
"webextension/manifest.json": `{ "name": }`,
};
- const expectedError = "JSON.parse:";
+ const expectedError = /JSON.parse:/;
let fakeHybridAddonFile = Extension.generateZipFile(files);
await createManifestErrorTestCase(id, fakeHybridAddonFile, expectedError);
});
add_task(async function test_startup_error_blocking_validation_errors() {
const id = "blocking-manifest-validation-error@test.embedded.web.extension";
--- a/toolkit/modules/tests/xpcshell/test_MatchURLFilters.js
+++ b/toolkit/modules/tests/xpcshell/test_MatchURLFilters.js
@@ -35,27 +35,27 @@ function expectThrow({url, filters, exce
add_task(async function test_match_url_filters() {
const shouldPass = true;
const shouldFail = true;
const shouldThrow = true;
var testCases = [
// Empty, undefined and null filters.
- {shouldThrow, exceptionMessageContains: "filters array should not be empty",
+ {shouldThrow, exceptionMessageContains: /filters array should not be empty/,
filters: [], url: "http://mozilla.org", },
- {shouldThrow, exceptionMessageContains: "filters should be an array",
+ {shouldThrow, exceptionMessageContains: /filters should be an array/,
filters: undefined, url: "http://mozilla.org"},
- {shouldThrow, exceptionMessageContains: "filters should be an array",
+ {shouldThrow, exceptionMessageContains: /filters should be an array/,
filters: null, url: "http://mozilla.org"},
// Wrong formats (in a real webextension this will be blocked by the schema validation).
- {shouldThrow, exceptionMessageContains: "filters should be an array", filters: {},
+ {shouldThrow, exceptionMessageContains: /filters should be an array/, filters: {},
url: "http://mozilla.org"},
- {shouldThrow, exceptionMessageContains: "filters should be an array",
+ {shouldThrow, exceptionMessageContains: /filters should be an array/,
filters: {nonExistentCriteria: true}, url: "http://mozilla.org", },
{shouldPass, filters: [{nonExistentCriteria: true}], url: "http://mozilla.org"},
// Schemes filter over various url schemes.
{shouldPass, filters: [{schemes: ["http"]}], url: "http://mozilla.org"},
{shouldPass, filters: [{schemes: ["https"]}], url: "https://mozilla.org"},
{shouldPass, filters: [{schemes: ["ftp"]}], url: "ftp://fake/ftp/url"},
{shouldPass, filters: [{schemes: ["about"]}], url: "about:blank"},