michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: michael@0: // Navigate to a site with a broken cert michael@0: window.addEventListener("DOMContentLoaded", testBrokenCert, true); michael@0: content.location = "https://nocert.example.com/"; michael@0: } michael@0: michael@0: function testBrokenCert() { michael@0: window.removeEventListener("DOMContentLoaded", testBrokenCert, true); michael@0: michael@0: // Confirm that we are displaying the contributed error page, not the default michael@0: ok(gBrowser.contentDocument.documentURI.startsWith("about:certerror"), "Broken page should go to about:certerror, not about:neterror"); michael@0: michael@0: // Confirm that the expert section is collapsed michael@0: var expertDiv = gBrowser.contentDocument.getElementById("expertContent"); michael@0: ok(expertDiv, "Expert content div should exist"); michael@0: ok(expertDiv.hasAttribute("collapsed"), "Expert content should be collapsed by default"); michael@0: michael@0: // Tweak the expert mode pref michael@0: gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true); michael@0: michael@0: window.addEventListener("DOMContentLoaded", testExpertPref, true); michael@0: gBrowser.reload(); michael@0: } michael@0: michael@0: function testExpertPref() { michael@0: window.removeEventListener("DOMContentLoaded", testExpertPref, true); michael@0: var expertDiv = gBrowser.contentDocument.getElementById("expertContent"); michael@0: var technicalDiv = gBrowser.contentDocument.getElementById("technicalContent"); michael@0: ok(!expertDiv.hasAttribute("collapsed"), "Expert content should not be collapsed with the expert mode pref set"); michael@0: ok(!technicalDiv.hasAttribute("collapsed"), "Technical content should not be collapsed with the expert mode pref set"); michael@0: michael@0: // Clean up michael@0: gBrowser.removeCurrentTab(); michael@0: if (gPrefService.prefHasUserValue("browser.xul.error_pages.expert_bad_cert")) michael@0: gPrefService.clearUserPref("browser.xul.error_pages.expert_bad_cert"); michael@0: finish(); michael@0: }