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.

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

mercurial