browser_bug424101.js
Go to the documentation of this file.
1 /* Make sure that the context menu appears on form elements */
2 
3 function test() {
5 
6  let newTab = gBrowser.addTab();
7  gBrowser.selectedTab = newTab;
8  let newBrowser = gBrowser.getBrowserForTab(newTab);
9 
10  newBrowser.addEventListener("load", function() {
11  newBrowser.removeEventListener("load", arguments.callee, true);
12 
13  let doc = newBrowser.contentWindow.document;
14  let testInput = function(type, expected) {
15  let element = doc.createElement("input");
16  element.setAttribute("type", type);
17  doc.body.appendChild(element);
18  document.popupNode = element;
19 
20  let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
21  let contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
22 
23  is(contextMenu.shouldDisplay, expected, "context menu behavior for <input type=" + type + "> is wrong");
24  };
25  let testElement = function(tag, expected) {
26  let element = doc.createElement(tag);
27  doc.body.appendChild(element);
28  document.popupNode = element;
29 
30  let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
31  let contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
32 
33  is(contextMenu.shouldDisplay, expected, "context menu behavior for <" + tag + "> is wrong");
34  };
35 
36  testInput("text", true);
37  testInput("password", true);
38  testInput("image", true);
39  testInput("button", false);
40  testInput("submit", false);
41  testInput("reset", false);
42  testInput("checkbox", false);
43  testInput("radio", false);
44  testElement("button", false);
45  testElement("select", false);
46  testElement("option", false);
47  testElement("optgroup", false);
48 
49  // cleanup
50  document.popupNode = null;
51  gBrowser.removeCurrentTab();
52  finish();
53  }, true);
54  newBrowser.loadURI("data:text/html,test");
55 }
function doc() browser.contentDocument
var newBrowser
function test()
waitForExplicitFinish()
return null
Definition: FeedWriter.js:1143
var expected
return!aWindow arguments!aWindow arguments[0]
function nsContextMenu(aXulMenu, aBrowser)
dataSBGenres SBProperties tag
Definition: tuner2.js:871