2008-10-29 08:54:51 -07:00
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
2009-09-16 03:21:19 -07:00
|
|
|
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
|
|
|
2008-10-29 08:54:51 -07:00
|
|
|
// Navigate to a site with a broken cert
|
2009-04-21 13:17:14 -07:00
|
|
|
window.addEventListener("DOMContentLoaded", testBrokenCert, true);
|
2009-09-16 03:21:19 -07:00
|
|
|
content.location = "https://nocert.example.com/";
|
2008-10-29 08:54:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function testBrokenCert() {
|
2009-04-21 13:17:14 -07:00
|
|
|
window.removeEventListener("DOMContentLoaded", testBrokenCert, true);
|
2009-09-16 03:21:19 -07:00
|
|
|
|
2008-10-29 08:54:51 -07:00
|
|
|
// Confirm that we are displaying the contributed error page, not the default
|
2009-09-16 03:21:19 -07:00
|
|
|
ok(/^about:certerror/.test(gBrowser.contentDocument.documentURI), "Broken page should go to about:certerror, not about:neterror");
|
|
|
|
|
2008-10-29 08:54:51 -07:00
|
|
|
// Confirm that the expert section is collapsed
|
2009-09-16 03:21:19 -07:00
|
|
|
var expertDiv = gBrowser.contentDocument.getElementById("expertContent");
|
2008-10-29 08:54:51 -07:00
|
|
|
ok(expertDiv, "Expert content div should exist");
|
|
|
|
ok(expertDiv.hasAttribute("collapsed"), "Expert content should be collapsed by default");
|
2009-09-16 03:21:19 -07:00
|
|
|
|
2008-10-29 08:54:51 -07:00
|
|
|
// Tweak the expert mode pref
|
2009-09-16 03:21:19 -07:00
|
|
|
gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
|
|
|
|
|
2009-04-21 13:17:14 -07:00
|
|
|
window.addEventListener("DOMContentLoaded", testExpertPref, true);
|
2009-09-16 03:21:19 -07:00
|
|
|
gBrowser.reload();
|
2008-10-29 08:54:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function testExpertPref() {
|
2009-04-21 13:17:14 -07:00
|
|
|
window.removeEventListener("DOMContentLoaded", testExpertPref, true);
|
2009-09-16 03:21:19 -07:00
|
|
|
var expertDiv = gBrowser.contentDocument.getElementById("expertContent");
|
|
|
|
var technicalDiv = gBrowser.contentDocument.getElementById("technicalContent");
|
2008-10-29 08:54:51 -07:00
|
|
|
ok(!expertDiv.hasAttribute("collapsed"), "Expert content should not be collapsed with the expert mode pref set");
|
2008-12-09 05:03:27 -08:00
|
|
|
ok(!technicalDiv.hasAttribute("collapsed"), "Technical content should not be collapsed with the expert mode pref set");
|
2009-09-16 03:21:19 -07:00
|
|
|
|
2008-10-29 08:54:51 -07:00
|
|
|
// Clean up
|
|
|
|
gBrowser.removeCurrentTab();
|
2009-10-29 06:44:10 -07:00
|
|
|
if (gPrefService.prefHasUserValue("browser.xul.error_pages.expert_bad_cert"))
|
|
|
|
gPrefService.clearUserPref("browser.xul.error_pages.expert_bad_cert");
|
2008-10-29 08:54:51 -07:00
|
|
|
finish();
|
|
|
|
}
|