browser_bug415846.js
Go to the documentation of this file.
1 /* Check for the correct behaviour of the report web forgery/not a web forgery
2 menu items.
3 
4 Mac makes this astonishingly painful to test since their help menu is special magic,
5 but we can at least test it on the other platforms.*/
7 var menu;
8 
9 function test() {
10 
12 
13  var newTab = gBrowser.addTab();
14  gBrowser.selectedTab = newTab;
15  newBrowser = gBrowser.getBrowserForTab(newTab);
16 
17  // Navigate to a normal site
18  gBrowser.addEventListener("load", testNormal, false);
19  newBrowser.contentWindow.location = 'http://example.com/';
20 }
21 
22 function testNormal() {
23  gBrowser.removeEventListener("load", testNormal, false);
24 
25  // open the menu, to force it to update
26  menu = document.getElementById("menu_HelpPopup");
27  ok(menu, "Help menu should exist!");
28 
29  menu.addEventListener("popupshown", testNormal_PopupListener, false);
30  menu.openPopup(null, "", 0, 0, false, null);
31 }
32 
34  menu.removeEventListener("popupshown", testNormal_PopupListener, false);
35 
36  var reportMenu = document.getElementById("menu_HelpPopup_reportPhishingtoolmenu");
37  var errorMenu = document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu");
38  is(reportMenu.hidden, false, "Report phishing menu should be visible on normal sites");
39  is(errorMenu.hidden, true, "Report error menu item should be hidden on normal sites");
40  menu.hidePopup();
41 
42  // Now launch the phishing test. Can't use onload here because error pages don't
43  // fire normal load events.
44  newBrowser.contentWindow.location = 'http://www.mozilla.com/firefox/its-a-trap.html';
45  window.setTimeout(testPhishing, 2000);
46 }
47 
48 function testPhishing() {
49  menu.addEventListener("popupshown", testPhishing_PopupListener, false);
50  menu.openPopup(null, "", 0, 0, false, null);
51 }
52 
54  menu.removeEventListener("popupshown", testPhishing_PopupListener, false);
55 
56  var reportMenu = document.getElementById("menu_HelpPopup_reportPhishingtoolmenu");
57  var errorMenu = document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu");
58  is(reportMenu.hidden, true, "Report phishing menu should be hidden on phishing sites");
59  is(errorMenu.hidden, false, "Report error menu item should be visible on phishing sites");
60  menu.hidePopup();
61 
62  gBrowser.removeCurrentTab();
63  finish();
64 }
var menu
var newBrowser
let window
function testNormal_PopupListener()
function testPhishing()
function testNormal()
waitForExplicitFinish()
return null
Definition: FeedWriter.js:1143
function testPhishing_PopupListener()
function test()