browser/base/content/test/general/browser_bug431826.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_bug431826.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +function test() {
     1.5 +  waitForExplicitFinish();
     1.6 +
     1.7 +  gBrowser.selectedTab = gBrowser.addTab();
     1.8 +
     1.9 +  // Navigate to a site with a broken cert
    1.10 +  window.addEventListener("DOMContentLoaded", testBrokenCert, true);
    1.11 +  content.location = "https://nocert.example.com/";
    1.12 +}
    1.13 +
    1.14 +function testBrokenCert() {
    1.15 +  window.removeEventListener("DOMContentLoaded", testBrokenCert, true);
    1.16 +
    1.17 +  // Confirm that we are displaying the contributed error page, not the default
    1.18 +  ok(gBrowser.contentDocument.documentURI.startsWith("about:certerror"), "Broken page should go to about:certerror, not about:neterror");
    1.19 +
    1.20 +  // Confirm that the expert section is collapsed
    1.21 +  var expertDiv = gBrowser.contentDocument.getElementById("expertContent");
    1.22 +  ok(expertDiv, "Expert content div should exist");
    1.23 +  ok(expertDiv.hasAttribute("collapsed"), "Expert content should be collapsed by default");
    1.24 +
    1.25 +  // Tweak the expert mode pref
    1.26 +  gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
    1.27 +
    1.28 +  window.addEventListener("DOMContentLoaded", testExpertPref, true);
    1.29 +  gBrowser.reload();
    1.30 +}
    1.31 +
    1.32 +function testExpertPref() {
    1.33 +  window.removeEventListener("DOMContentLoaded", testExpertPref, true);
    1.34 +  var expertDiv = gBrowser.contentDocument.getElementById("expertContent");
    1.35 +  var technicalDiv = gBrowser.contentDocument.getElementById("technicalContent");
    1.36 +  ok(!expertDiv.hasAttribute("collapsed"), "Expert content should not be collapsed with the expert mode pref set");
    1.37 +  ok(!technicalDiv.hasAttribute("collapsed"), "Technical content should not be collapsed with the expert mode pref set");
    1.38 +
    1.39 +  // Clean up
    1.40 +  gBrowser.removeCurrentTab();
    1.41 +  if (gPrefService.prefHasUserValue("browser.xul.error_pages.expert_bad_cert"))
    1.42 +    gPrefService.clearUserPref("browser.xul.error_pages.expert_bad_cert");
    1.43 +  finish();
    1.44 +}

mercurial