2018-05-10 21:55:05 +00:00
|
|
|
test("tabs.sendMessage reject when sending to unknown tab id", async (t) => {
|
|
|
|
const res = await browser.runtime.sendMessage("test-tabssendMessage-unknown-tabid");
|
2020-09-17 10:58:54 +00:00
|
|
|
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:
|
2020-12-08 14:34:51 +00:00
|
|
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1583484
|
|
|
|
// and got fixed in Firefox 83 in:
|
2020-09-17 10:58:54 +00:00
|
|
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1665568
|
|
|
|
errorMessage = "Error: tab is null";
|
2020-12-08 14:34:51 +00:00
|
|
|
} else if (firefoxVersion >= 80 && firefoxVersion < 83) {
|
2020-09-17 10:58:54 +00:00
|
|
|
// Raw error message leaked until it got sanitized again with
|
|
|
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1655624
|
|
|
|
errorMessage = "An unexpected error occurred";
|
|
|
|
}
|
2018-05-10 21:55:05 +00:00
|
|
|
t.deepEqual(res, {
|
|
|
|
success: true,
|
|
|
|
isRejected: true,
|
2020-09-17 10:58:54 +00:00
|
|
|
errorMessage,
|
2018-05-10 21:55:05 +00:00
|
|
|
}, "The background page got a rejection as expected");
|
|
|
|
});
|