layout/xul/test/browser_bug685470.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 function test() {
     2   waitForExplicitFinish();
     4   gBrowser.selectedTab = gBrowser.addTab();
     6   SpecialPowers.setIntPref("ui.tooltipDelay", 0);
     8   var popup = false;
     9   var doc;
    10   var win;
    11   var p1;
    13   let onPopupShown = function(aEvent) {
    14     popup = true;
    15   }
    17   // test that a mouse click prior to the tooltip appearing blocks it
    18   let runTest = function() {
    19     EventUtils.synthesizeMouseAtCenter(p1, { type: "mousemove" }, win);
    20     EventUtils.sendMouseEvent({type:'mousedown'}, p1, win);
    21     EventUtils.sendMouseEvent({type:'mouseup'}, p1, win);
    23     setTimeout(function() {
    24       is(popup, false, "shouldn't get tooltip after click");
    26       document.removeEventListener("popupshown", onPopupShown, true);
    27       SpecialPowers.clearUserPref("ui.tooltipDelay");
    29       gBrowser.removeCurrentTab();
    30       finish();
    31     }, 200);
    32   }
    34   let onLoad = function (aEvent) {
    35     doc = gBrowser.contentDocument;
    36     win = gBrowser.contentWindow;
    37     p1 = doc.getElementById("p1");
    39     document.addEventListener("popupshown", onPopupShown, true);
    41     runTest();
    42   }
    44   gBrowser.selectedBrowser.addEventListener("load", function loadListener() {
    45     gBrowser.selectedBrowser.removeEventListener("load", loadListener, true);
    46     setTimeout(onLoad, 0);
    47   }, true);
    49   content.location = "data:text/html," +
    50     "<p id=\"p1\" title=\"tooltip is here\">This paragraph has a tooltip.</p>";
    51 }

mercurial