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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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