browser_net_security-warnings.js (1754B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Test that warning indicators are shown when appropriate. 8 */ 9 10 const TEST_CASES = [ 11 { 12 desc: "no warnings", 13 uri: "https://example.com" + CORS_SJS_PATH, 14 warnCipher: null, 15 }, 16 ]; 17 18 add_task(async function () { 19 const { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL, { 20 requestCount: 1, 21 }); 22 const { document, store, windowRequire } = monitor.panelWin; 23 const Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); 24 25 store.dispatch(Actions.batchEnable(false)); 26 27 for (const test of TEST_CASES) { 28 info("Testing site with " + test.desc); 29 30 info("Performing request to " + test.uri); 31 let wait = waitForNetworkEvents(monitor, 1); 32 await SpecialPowers.spawn( 33 tab.linkedBrowser, 34 [test.uri], 35 async function (url) { 36 content.wrappedJSObject.performRequests(1, url); 37 } 38 ); 39 await wait; 40 41 info("Wait until the Security Tab is visible"); 42 wait = waitForDOM(document, "#security-tab"); 43 44 info("Selecting the request."); 45 EventUtils.sendMouseEvent( 46 { type: "mousedown" }, 47 document.querySelectorAll(".request-list-item")[0] 48 ); 49 await wait; 50 51 if (!document.querySelector("#security-tab[aria-selected=true]")) { 52 info("Selecting the Security Tab"); 53 wait = waitForDOM(document, "#security-panel .properties-view"); 54 clickOnSidebarTab(document, "security"); 55 await wait; 56 } 57 58 is( 59 document.querySelector("#security-warning-cipher"), 60 test.warnCipher, 61 "Cipher suite warning is hidden." 62 ); 63 64 await clearNetworkEvents(monitor); 65 } 66 67 return teardown(monitor); 68 });