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.

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

mercurial