browser_net_security-error.js (1260B)
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 Security details tab shows an error message with broken connections. 8 */ 9 10 add_task(async function () { 11 const { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL, { 12 requestCount: 1, 13 }); 14 const { document, store, windowRequire } = monitor.panelWin; 15 const Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); 16 17 store.dispatch(Actions.batchEnable(false)); 18 19 info("Requesting a resource that has a certificate problem."); 20 21 const requestsDone = waitForNetworkEvents(monitor, 1); 22 await SpecialPowers.spawn(tab.linkedBrowser, [], async function () { 23 content.wrappedJSObject.performRequests(1, "https://nocert.example.com"); 24 }); 25 await requestsDone; 26 27 const securityInfoLoaded = waitForDOM(document, ".security-info-value"); 28 store.dispatch(Actions.toggleNetworkDetails()); 29 30 await waitUntil(() => document.querySelector("#security-tab")); 31 clickOnSidebarTab(document, "security"); 32 await securityInfoLoaded; 33 34 const errormsg = document.querySelector(".security-info-value"); 35 isnot(errormsg.textContent, "", "Error message is not empty."); 36 37 return teardown(monitor); 38 });