michael@0: /* Make sure that the context menu appears on form elements */ michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: michael@0: gBrowser.selectedBrowser.addEventListener("load", function() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); michael@0: michael@0: let doc = gBrowser.contentDocument; michael@0: let testInput = function(type, expected) { michael@0: let element = doc.createElement("input"); michael@0: element.setAttribute("type", type); michael@0: doc.body.appendChild(element); michael@0: document.popupNode = element; michael@0: michael@0: let contentAreaContextMenu = document.getElementById("contentAreaContextMenu"); michael@0: let contextMenu = new nsContextMenu(contentAreaContextMenu); michael@0: michael@0: is(contextMenu.shouldDisplay, expected, "context menu behavior for is wrong"); michael@0: }; michael@0: let testElement = function(tag, expected) { michael@0: let element = doc.createElement(tag); michael@0: doc.body.appendChild(element); michael@0: document.popupNode = element; michael@0: michael@0: let contentAreaContextMenu = document.getElementById("contentAreaContextMenu"); michael@0: let contextMenu = new nsContextMenu(contentAreaContextMenu); michael@0: michael@0: is(contextMenu.shouldDisplay, expected, "context menu behavior for <" + tag + "> is wrong"); michael@0: }; michael@0: michael@0: testInput("text", true); michael@0: testInput("password", true); michael@0: testInput("image", true); michael@0: testInput("button", true); michael@0: testInput("submit", true); michael@0: testInput("reset", true); michael@0: testInput("checkbox", true); michael@0: testInput("radio", true); michael@0: testElement("button", true); michael@0: testElement("select", true); michael@0: testElement("option", true); michael@0: testElement("optgroup", true); michael@0: michael@0: // cleanup michael@0: document.popupNode = null; michael@0: gBrowser.removeCurrentTab(); michael@0: finish(); michael@0: }, true); michael@0: content.location = "data:text/html,test"; michael@0: }