Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* Check for the intended visibility of the "Ignore this warning" text*/ |
michael@0 | 2 | |
michael@0 | 3 | function test() { |
michael@0 | 4 | waitForExplicitFinish(); |
michael@0 | 5 | |
michael@0 | 6 | gBrowser.selectedTab = gBrowser.addTab(); |
michael@0 | 7 | |
michael@0 | 8 | // Navigate to malware site. Can't use an onload listener here since |
michael@0 | 9 | // error pages don't fire onload. Also can't register the DOMContentLoaded |
michael@0 | 10 | // handler here because registering it too soon would mean that we might |
michael@0 | 11 | // get it for about:blank, and not about:blocked. |
michael@0 | 12 | gBrowser.addTabsProgressListener({ |
michael@0 | 13 | onLocationChange: function(aTab, aWebProgress, aRequest, aLocation, aFlags) { |
michael@0 | 14 | if (aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) { |
michael@0 | 15 | gBrowser.removeTabsProgressListener(this); |
michael@0 | 16 | window.addEventListener("DOMContentLoaded", testMalware, true); |
michael@0 | 17 | } |
michael@0 | 18 | } |
michael@0 | 19 | }); |
michael@0 | 20 | content.location = "http://www.itisatrap.org/firefox/its-an-attack.html"; |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | function testMalware() { |
michael@0 | 24 | window.removeEventListener("DOMContentLoaded", testMalware, true); |
michael@0 | 25 | |
michael@0 | 26 | // Confirm that "Ignore this warning" is visible - bug 422410 |
michael@0 | 27 | var el = content.document.getElementById("ignoreWarningButton"); |
michael@0 | 28 | ok(el, "Ignore warning button should be present for malware"); |
michael@0 | 29 | |
michael@0 | 30 | var style = content.getComputedStyle(el, null); |
michael@0 | 31 | is(style.display, "inline-block", "Ignore Warning button should be display:inline-block for malware"); |
michael@0 | 32 | |
michael@0 | 33 | // Now launch the phishing test |
michael@0 | 34 | window.addEventListener("DOMContentLoaded", testPhishing, true); |
michael@0 | 35 | content.location = "http://www.itisatrap.org/firefox/its-a-trap.html"; |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | function testPhishing() { |
michael@0 | 39 | window.removeEventListener("DOMContentLoaded", testPhishing, true); |
michael@0 | 40 | |
michael@0 | 41 | var el = content.document.getElementById("ignoreWarningButton"); |
michael@0 | 42 | ok(el, "Ignore warning button should be present for phishing"); |
michael@0 | 43 | |
michael@0 | 44 | var style = content.getComputedStyle(el, null); |
michael@0 | 45 | is(style.display, "inline-block", "Ignore Warning button should be display:inline-block for phishing"); |
michael@0 | 46 | |
michael@0 | 47 | gBrowser.removeCurrentTab(); |
michael@0 | 48 | finish(); |
michael@0 | 49 | } |