|
1 function test() { |
|
2 waitForExplicitFinish(); |
|
3 |
|
4 gBrowser.selectedTab = gBrowser.addTab(); |
|
5 |
|
6 // Navigate to a site with a broken cert |
|
7 window.addEventListener("DOMContentLoaded", testBrokenCert, true); |
|
8 content.location = "https://nocert.example.com/"; |
|
9 } |
|
10 |
|
11 function testBrokenCert() { |
|
12 window.removeEventListener("DOMContentLoaded", testBrokenCert, true); |
|
13 |
|
14 // Confirm that we are displaying the contributed error page, not the default |
|
15 ok(gBrowser.contentDocument.documentURI.startsWith("about:certerror"), "Broken page should go to about:certerror, not about:neterror"); |
|
16 |
|
17 // Confirm that the expert section is collapsed |
|
18 var expertDiv = gBrowser.contentDocument.getElementById("expertContent"); |
|
19 ok(expertDiv, "Expert content div should exist"); |
|
20 ok(expertDiv.hasAttribute("collapsed"), "Expert content should be collapsed by default"); |
|
21 |
|
22 // Tweak the expert mode pref |
|
23 gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true); |
|
24 |
|
25 window.addEventListener("DOMContentLoaded", testExpertPref, true); |
|
26 gBrowser.reload(); |
|
27 } |
|
28 |
|
29 function testExpertPref() { |
|
30 window.removeEventListener("DOMContentLoaded", testExpertPref, true); |
|
31 var expertDiv = gBrowser.contentDocument.getElementById("expertContent"); |
|
32 var technicalDiv = gBrowser.contentDocument.getElementById("technicalContent"); |
|
33 ok(!expertDiv.hasAttribute("collapsed"), "Expert content should not be collapsed with the expert mode pref set"); |
|
34 ok(!technicalDiv.hasAttribute("collapsed"), "Technical content should not be collapsed with the expert mode pref set"); |
|
35 |
|
36 // Clean up |
|
37 gBrowser.removeCurrentTab(); |
|
38 if (gPrefService.prefHasUserValue("browser.xul.error_pages.expert_bad_cert")) |
|
39 gPrefService.clearUserPref("browser.xul.error_pages.expert_bad_cert"); |
|
40 finish(); |
|
41 } |