1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
7 * Test that Security details tab contains the expected data.
10 add_task(async
function () {
11 await
pushPref("security.pki.certificate_transparency.mode", 1);
13 const { tab
, monitor
} = await
initNetMonitor(CUSTOM_GET_URL
, {
16 const { document
, store
, windowRequire
} = monitor
.panelWin
;
17 const Actions
= windowRequire("devtools/client/netmonitor/src/actions/index");
19 store
.dispatch(Actions
.batchEnable(false));
21 info("Performing a secure request.");
22 const REQUESTS_URL
= "https://example.com" + CORS_SJS_PATH
;
23 const wait
= waitForNetworkEvents(monitor
, 1);
24 await SpecialPowers
.spawn(
27 async
function (url
) {
28 content
.wrappedJSObject
.performRequests(1, url
);
33 store
.dispatch(Actions
.toggleNetworkDetails());
34 clickOnSidebarTab(document
, "security");
36 document
.querySelector("#security-panel .security-info-value")
39 const tabpanel
= document
.querySelector("#security-panel");
40 const textboxes
= tabpanel
.querySelectorAll(".security-info-value");
43 // The protocol will be TLS but the exact version depends on which protocol
44 // the test server example.com supports.
45 const protocol
= textboxes
[0].textContent
;
46 ok(protocol
.startsWith('"TLS'), "The protocol " + protocol
+ " seems valid.");
48 // The cipher suite used by the test server example.com might change at any
49 // moment but all of them should start with "TLS_".
50 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml
51 const suite
= textboxes
[1].textContent
;
52 ok(suite
.startsWith('"TLS_'), "The suite " + suite
+ " seems valid.");
56 tabpanel
.querySelectorAll(".treeLabel.objectLabel")[1].textContent
,
58 "Label has the expected value."
60 // These two values can change. So only check they're not empty.
61 Assert
.notStrictEqual(
62 textboxes
[2].textContent
,
64 "Label value is not empty."
66 Assert
.notStrictEqual(
67 textboxes
[3].textContent
,
69 "Label value is not empty."
71 is(textboxes
[4].textContent
, '"Disabled"', "Label has the expected value.");
72 is(textboxes
[5].textContent
, '"Disabled"', "Label has the expected value.");
76 textboxes
[6].textContent
,
78 "Label has the expected value."
81 textboxes
[7].textContent
,
83 "Label has the expected value."
86 textboxes
[8].textContent
,
88 "Label has the expected value."
92 textboxes
[9].textContent
,
93 '"Temporary Certificate Authority"',
94 "Label has the expected value."
97 textboxes
[10].textContent
,
99 "Label has the expected value."
102 textboxes
[11].textContent
,
103 '"Profile Guided Optimization"',
104 "Label has the expected value."
107 // Locale sensitive and varies between timezones. Can't compare equality or
108 // the test fails depending on which part of the world the test is executed.
110 // cert validity begins
111 isnot(textboxes
[12].textContent
, "", "Label was not empty.");
112 // cert validity expires
113 isnot(textboxes
[13].textContent
, "", "Label was not empty.");
115 // cert sha1 fingerprint
116 isnot(textboxes
[14].textContent
, "", "Label was not empty.");
117 // cert sha256 fingerprint
118 isnot(textboxes
[15].textContent
, "", "Label was not empty.");
120 // Certificate transparency
121 isnot(textboxes
[16].textContent
, "", "Label was not empty.");
123 await
teardown(monitor
);