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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 function test() {
     2   waitForExplicitFinish();
     4   gBrowser.selectedTab = gBrowser.addTab();
     6   // Navigate to a site with a broken cert
     7   window.addEventListener("DOMContentLoaded", testBrokenCert, true);
     8   content.location = "https://nocert.example.com/";
     9 }
    11 function testBrokenCert() {
    12   window.removeEventListener("DOMContentLoaded", testBrokenCert, true);
    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");
    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");
    22   // Tweak the expert mode pref
    23   gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
    25   window.addEventListener("DOMContentLoaded", testExpertPref, true);
    26   gBrowser.reload();
    27 }
    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");
    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 }

mercurial