browser_iframe_buttons.js (1625B)
1 /* Any copyright is dedicated to the Public Domain. 2 https://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Ensure the buttons at the buttom of the HTTPS-Only error page do not get 7 // displayed in an iframe (Bug 1909396). 8 9 add_task(async function test_iframe_buttons() { 10 await BrowserTestUtils.withNewTab( 11 "https://example.com/browser/dom/security/test/https-only/file_iframe_buttons.html", 12 async function (browser) { 13 await SpecialPowers.pushPrefEnv({ 14 set: [["dom.security.https_only_mode", true]], 15 }); 16 17 await SpecialPowers.spawn(browser, [], async function () { 18 const iframe = content.document.getElementById("iframe"); 19 // eslint-disable-next-line @microsoft/sdl/no-insecure-url 20 iframe.src = "http://nocert.example.com"; 21 22 await ContentTaskUtils.waitForCondition( 23 () => iframe.contentWindow.document.readyState === "interactive", 24 "Iframe error page should have loaded" 25 ); 26 27 ok( 28 !!iframe.contentWindow.document.getElementById("explanation-iframe"), 29 "#explanation-iframe should exist" 30 ); 31 32 is( 33 iframe.contentWindow.document 34 .getElementById("explanation-iframe") 35 .getAttribute("hidden"), 36 null, 37 "#explanation-iframe should not be hidden" 38 ); 39 40 for (const id of ["explanation-continue", "goBack", "openInsecure"]) { 41 is( 42 iframe.contentWindow.document.getElementById(id), 43 null, 44 `#${id} should have been removed` 45 ); 46 } 47 }); 48 } 49 ); 50 });