Skip to content

Commit

Permalink
fix(test): fix expectation of tabs-sendmessage-expectation in Firefox
Browse files Browse the repository at this point in the history
Work-around for upstream regression @ https://bugzilla.mozilla.org/show_bug.cgi?id=1665568
  • Loading branch information
Rob--W committed Sep 17, 2020
1 parent 5f13763 commit d6a789b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/fixtures/tabs-sendmessage-extension/content.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
test("tabs.sendMessage reject when sending to unknown tab id", async (t) => {
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, {
success: true,
isRejected: true,
errorMessage: "Could not establish connection. Receiving end does not exist.",
errorMessage,
}, "The background page got a rejection as expected");
});

0 comments on commit d6a789b

Please sign in to comment.