browser/base/content/test/general/browser_bug424101.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Make sure that the context menu appears on form elements */
michael@0 2
michael@0 3 function test() {
michael@0 4 waitForExplicitFinish();
michael@0 5
michael@0 6 gBrowser.selectedTab = gBrowser.addTab();
michael@0 7
michael@0 8 gBrowser.selectedBrowser.addEventListener("load", function() {
michael@0 9 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
michael@0 10
michael@0 11 let doc = gBrowser.contentDocument;
michael@0 12 let testInput = function(type, expected) {
michael@0 13 let element = doc.createElement("input");
michael@0 14 element.setAttribute("type", type);
michael@0 15 doc.body.appendChild(element);
michael@0 16 document.popupNode = element;
michael@0 17
michael@0 18 let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
michael@0 19 let contextMenu = new nsContextMenu(contentAreaContextMenu);
michael@0 20
michael@0 21 is(contextMenu.shouldDisplay, expected, "context menu behavior for <input type=" + type + "> is wrong");
michael@0 22 };
michael@0 23 let testElement = function(tag, expected) {
michael@0 24 let element = doc.createElement(tag);
michael@0 25 doc.body.appendChild(element);
michael@0 26 document.popupNode = element;
michael@0 27
michael@0 28 let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
michael@0 29 let contextMenu = new nsContextMenu(contentAreaContextMenu);
michael@0 30
michael@0 31 is(contextMenu.shouldDisplay, expected, "context menu behavior for <" + tag + "> is wrong");
michael@0 32 };
michael@0 33
michael@0 34 testInput("text", true);
michael@0 35 testInput("password", true);
michael@0 36 testInput("image", true);
michael@0 37 testInput("button", true);
michael@0 38 testInput("submit", true);
michael@0 39 testInput("reset", true);
michael@0 40 testInput("checkbox", true);
michael@0 41 testInput("radio", true);
michael@0 42 testElement("button", true);
michael@0 43 testElement("select", true);
michael@0 44 testElement("option", true);
michael@0 45 testElement("optgroup", true);
michael@0 46
michael@0 47 // cleanup
michael@0 48 document.popupNode = null;
michael@0 49 gBrowser.removeCurrentTab();
michael@0 50 finish();
michael@0 51 }, true);
michael@0 52 content.location = "data:text/html,test";
michael@0 53 }

mercurial