Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

/* Any copyright is dedicated to the Public Domain.
"use strict";
const TAB_URL =
function assertImageLoaded(tab) {
return ContentTask.spawn(tab.linkedBrowser, {}, () => {
const img = content.document.getElementsByTagName("img")[0];
ok(!!img, "Image tag should exist");
ok(img.complete && img.naturalWidth > 0, "Image should have loaded ");
});
}
add_task(async function test_bug1874801() {
await SpecialPowers.pushPrefEnv({
set: [
["security.mixed_content.upgrade_display_content", false],
["dom.security.https_first", true],
["dom.security.https_only_mode", true],
],
});
// Open Tab
const tabToClose = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
TAB_URL,
true
);
// Make sure the image was loaded via HTTPS
await assertImageLoaded(tabToClose);
// Close Tab
const tabClosePromise =
BrowserTestUtils.waitForSessionStoreUpdate(tabToClose);
BrowserTestUtils.removeTab(tabToClose);
await tabClosePromise;
// Restore Tab
const restoredTabPromise = BrowserTestUtils.waitForNewTab(
gBrowser,
TAB_URL,
true
);
undoCloseTab();
const restoredTab = await restoredTabPromise;
// Make sure the image was loaded via HTTPS
await assertImageLoaded(restoredTab);
});