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