fune/toolkit/components/thumbnails/test/browser_thumbnails_removed_tab.js
Oriol Brufau 638f28425f Bug 1775638 - Fix flaky browser_adoptTab_failure.js. r=Gijs
_captureRemoteThumbnail was already checking that the provided browser
hadn't been removed at the beginning, but due to using "await" this
could also happen in the middle, causing an exception.

That was the reason for flakyness in browser_adoptTab_failure.js

This patch adds extra checks, and replaces "aBrowser.parentNode" with
the more meaningful "aBrowser.isConnected", since there is no need to
use "parentNode" to get the "ownerDocument".

Differential Revision: https://phabricator.services.mozilla.com/D166264
2023-01-09 12:31:49 +00:00

13 lines
447 B
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(async function thumbnails_bug1775638() {
const tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"https://example.com"
);
const canvas = document.createElement("canvas");
const promise = PageThumbs.captureToCanvas(tab.linkedBrowser, canvas);
gBrowser.removeTab(tab);
is(await promise, canvas);
});