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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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