|
1 function test() { |
|
2 waitForExplicitFinish(); |
|
3 |
|
4 gBrowser.selectedTab = gBrowser.addTab(); |
|
5 |
|
6 SpecialPowers.setIntPref("ui.tooltipDelay", 0); |
|
7 |
|
8 var popup = false; |
|
9 var doc; |
|
10 var win; |
|
11 var p1; |
|
12 |
|
13 let onPopupShown = function(aEvent) { |
|
14 popup = true; |
|
15 } |
|
16 |
|
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); |
|
22 |
|
23 setTimeout(function() { |
|
24 is(popup, false, "shouldn't get tooltip after click"); |
|
25 |
|
26 document.removeEventListener("popupshown", onPopupShown, true); |
|
27 SpecialPowers.clearUserPref("ui.tooltipDelay"); |
|
28 |
|
29 gBrowser.removeCurrentTab(); |
|
30 finish(); |
|
31 }, 200); |
|
32 } |
|
33 |
|
34 let onLoad = function (aEvent) { |
|
35 doc = gBrowser.contentDocument; |
|
36 win = gBrowser.contentWindow; |
|
37 p1 = doc.getElementById("p1"); |
|
38 |
|
39 document.addEventListener("popupshown", onPopupShown, true); |
|
40 |
|
41 runTest(); |
|
42 } |
|
43 |
|
44 gBrowser.selectedBrowser.addEventListener("load", function loadListener() { |
|
45 gBrowser.selectedBrowser.removeEventListener("load", loadListener, true); |
|
46 setTimeout(onLoad, 0); |
|
47 }, true); |
|
48 |
|
49 content.location = "data:text/html," + |
|
50 "<p id=\"p1\" title=\"tooltip is here\">This paragraph has a tooltip.</p>"; |
|
51 } |