fix(test): fix expectation of tabs-sendmessage-expectation in Firefox

Work-around for upstream regression @ https://bugzilla.mozilla.org/show_bug.cgi?id=1665568
This commit is contained in:
Rob Wu 2020-09-17 12:58:54 +02:00
parent 5f13763d5e
commit d6a789bf54
1 changed files with 12 additions and 1 deletions

View File

@ -1,8 +1,19 @@
test("tabs.sendMessage reject when sending to unknown tab id", async (t) => { test("tabs.sendMessage reject when sending to unknown tab id", async (t) => {
const res = await browser.runtime.sendMessage("test-tabssendMessage-unknown-tabid"); const res = await browser.runtime.sendMessage("test-tabssendMessage-unknown-tabid");
let errorMessage = "Could not establish connection. Receiving end does not exist.";
const firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || ["", "0"])[1];
if (firefoxVersion === 79) {
// Value of error message regressed in:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1665568
errorMessage = "Error: tab is null";
} else if (firefoxVersion >= 80) {
// Raw error message leaked until it got sanitized again with
// https://bugzilla.mozilla.org/show_bug.cgi?id=1655624
errorMessage = "An unexpected error occurred";
}
t.deepEqual(res, { t.deepEqual(res, {
success: true, success: true,
isRejected: true, isRejected: true,
errorMessage: "Could not establish connection. Receiving end does not exist.", errorMessage,
}, "The background page got a rejection as expected"); }, "The background page got a rejection as expected");
}); });