Thu, 15 Jan 2015 21:13:52 +0100
Remove forgotten relic of ABI crash risk averse overloaded method change.
michael@0 | 1 | /* Check for the correct behaviour of the report web forgery/not a web forgery |
michael@0 | 2 | menu items. |
michael@0 | 3 | |
michael@0 | 4 | Mac makes this astonishingly painful to test since their help menu is special magic, |
michael@0 | 5 | but we can at least test it on the other platforms.*/ |
michael@0 | 6 | var menu; |
michael@0 | 7 | |
michael@0 | 8 | function test() { |
michael@0 | 9 | waitForExplicitFinish(); |
michael@0 | 10 | |
michael@0 | 11 | gBrowser.selectedTab = gBrowser.addTab(); |
michael@0 | 12 | |
michael@0 | 13 | // Navigate to a normal site |
michael@0 | 14 | gBrowser.addEventListener("DOMContentLoaded", testNormal, false); |
michael@0 | 15 | content.location = "http://example.com/"; |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | function testNormal() { |
michael@0 | 19 | gBrowser.removeEventListener("DOMContentLoaded", testNormal, false); |
michael@0 | 20 | |
michael@0 | 21 | // open the menu, to force it to update |
michael@0 | 22 | menu = document.getElementById("menu_HelpPopup"); |
michael@0 | 23 | ok(menu, "Help menu should exist!"); |
michael@0 | 24 | |
michael@0 | 25 | menu.addEventListener("popupshown", testNormal_PopupListener, false); |
michael@0 | 26 | menu.openPopup(null, "", 0, 0, false, null); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | function testNormal_PopupListener() { |
michael@0 | 30 | menu.removeEventListener("popupshown", testNormal_PopupListener, false); |
michael@0 | 31 | |
michael@0 | 32 | var reportMenu = document.getElementById("menu_HelpPopup_reportPhishingtoolmenu"); |
michael@0 | 33 | var errorMenu = document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu"); |
michael@0 | 34 | is(reportMenu.hidden, false, "Report phishing menu should be visible on normal sites"); |
michael@0 | 35 | is(errorMenu.hidden, true, "Report error menu item should be hidden on normal sites"); |
michael@0 | 36 | menu.hidePopup(); |
michael@0 | 37 | |
michael@0 | 38 | // Now launch the phishing test. Can't use onload here because error pages don't |
michael@0 | 39 | // fire normal load events. |
michael@0 | 40 | window.addEventListener("DOMContentLoaded", testPhishing, true); |
michael@0 | 41 | content.location = "http://www.itisatrap.org/firefox/its-a-trap.html"; |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | function testPhishing() { |
michael@0 | 45 | window.removeEventListener("DOMContentLoaded", testPhishing, true); |
michael@0 | 46 | |
michael@0 | 47 | menu.addEventListener("popupshown", testPhishing_PopupListener, false); |
michael@0 | 48 | menu.openPopup(null, "", 0, 0, false, null); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | function testPhishing_PopupListener() { |
michael@0 | 52 | menu.removeEventListener("popupshown", testPhishing_PopupListener, false); |
michael@0 | 53 | |
michael@0 | 54 | var reportMenu = document.getElementById("menu_HelpPopup_reportPhishingtoolmenu"); |
michael@0 | 55 | var errorMenu = document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu"); |
michael@0 | 56 | is(reportMenu.hidden, true, "Report phishing menu should be hidden on phishing sites"); |
michael@0 | 57 | is(errorMenu.hidden, false, "Report error menu item should be visible on phishing sites"); |
michael@0 | 58 | menu.hidePopup(); |
michael@0 | 59 | |
michael@0 | 60 | gBrowser.removeCurrentTab(); |
michael@0 | 61 | finish(); |
michael@0 | 62 | } |