browser_bug633691.js (2782B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ 3 */ 4 5 add_setup(async function () { 6 await SpecialPowers.pushPrefEnv({ 7 set: [["test.wait300msAfterTabSwitch", true]], 8 }); 9 }); 10 11 add_task(async function testFalse() { 12 await setSecurityCertErrorsFeltPrivacyToFalse(); 13 14 const URL = "data:text/html,<iframe width='700' height='700'></iframe>"; 15 await BrowserTestUtils.withNewTab( 16 { gBrowser, url: URL }, 17 async function (browser) { 18 let context = await SpecialPowers.spawn(browser, [], function () { 19 let iframe = content.document.querySelector("iframe"); 20 iframe.src = "https://expired.example.com/"; 21 return BrowsingContext.getFromWindow(iframe.contentWindow); 22 }); 23 await TestUtils.waitForCondition(() => { 24 let frame = context.currentWindowGlobal; 25 return frame && frame.documentURI.spec.startsWith("about:certerror"); 26 }); 27 await SpecialPowers.spawn(context, [], async function () { 28 await ContentTaskUtils.waitForCondition( 29 () => content.document.readyState == "interactive" 30 ); 31 let aP = content.document.getElementById("badCertAdvancedPanel"); 32 Assert.ok(aP, "Advanced content should exist"); 33 Assert.ok( 34 ContentTaskUtils.isHidden(aP), 35 "Advanced content should not be visible by default" 36 ); 37 }); 38 } 39 ); 40 }); 41 42 add_task(async function testTrue() { 43 await setSecurityCertErrorsFeltPrivacyToTrue(); 44 const URL = "data:text/html,<iframe width='700' height='700'></iframe>"; 45 await BrowserTestUtils.withNewTab( 46 { gBrowser, url: URL }, 47 async function (browser) { 48 let context = await SpecialPowers.spawn(browser, [], function () { 49 const iframe = content.document.querySelector("iframe"); 50 iframe.src = "https://expired.example.com/"; 51 return BrowsingContext.getFromWindow(iframe.contentWindow); 52 }); 53 await TestUtils.waitForCondition(() => { 54 let frame = context.currentWindowGlobal; 55 return frame && frame.documentURI.spec.startsWith("about:certerror"); 56 }); 57 await SpecialPowers.spawn(context, [], async function () { 58 await ContentTaskUtils.waitForCondition( 59 () => content.document.readyState == "interactive" 60 ); 61 const netErrorCardElement = await ContentTaskUtils.waitForCondition( 62 () => content.document.querySelector("net-error-card") 63 ); 64 const netErrorCard = netErrorCardElement.wrappedJSObject; 65 Assert.ok(netErrorCard.advancedButton, "Advanced content should exist"); 66 Assert.ok( 67 !netErrorCard.advancedContainer, 68 "Advanced content should not be visible by default" 69 ); 70 }); 71 } 72 ); 73 });