|
1 function test() { |
|
2 waitForExplicitFinish(); |
|
3 |
|
4 gBrowser.selectedTab = gBrowser.addTab(); |
|
5 |
|
6 SpecialPowers.setIntPref("ui.tooltipDelay", 0); |
|
7 |
|
8 let doStopPropagation = function (aEvent) |
|
9 { |
|
10 aEvent.stopPropagation(); |
|
11 } |
|
12 |
|
13 let onPopupShown = function (aEvent) |
|
14 { |
|
15 is(aEvent.originalTarget.localName, "tooltip", "tooltip is showing"); |
|
16 |
|
17 let doc = gBrowser.contentDocument; |
|
18 let win = gBrowser.contentWindow; |
|
19 let p2 = doc.getElementById("p2"); |
|
20 setTimeout(function () { |
|
21 EventUtils.synthesizeMouseAtCenter(p2, { type: "mousemove" }, win); }, 0); |
|
22 } |
|
23 |
|
24 let onPopupHiding = function (aEvent) |
|
25 { |
|
26 is(aEvent.originalTarget.localName, "tooltip", "tooltip is hiding"); |
|
27 |
|
28 let doc = gBrowser.contentDocument; |
|
29 |
|
30 doc.removeEventListener("mousemove", doStopPropagation, true); |
|
31 doc.removeEventListener("mouseenter", doStopPropagation, true); |
|
32 doc.removeEventListener("mouseleave", doStopPropagation, true); |
|
33 doc.removeEventListener("mouseover", doStopPropagation, true); |
|
34 doc.removeEventListener("mouseout", doStopPropagation, true); |
|
35 document.removeEventListener("popupshown", onPopupShown, true); |
|
36 document.removeEventListener("popuphiding", onPopupHiding, true); |
|
37 |
|
38 SpecialPowers.clearUserPref("ui.tooltipDelay"); |
|
39 |
|
40 gBrowser.removeCurrentTab(); |
|
41 finish(); |
|
42 } |
|
43 |
|
44 let onLoad = function (aEvent) |
|
45 { |
|
46 let doc = gBrowser.contentDocument; |
|
47 let win = gBrowser.contentWindow; |
|
48 let p1 = doc.getElementById("p1"); |
|
49 let p2 = doc.getElementById("p2"); |
|
50 |
|
51 EventUtils.synthesizeMouseAtCenter(p2, { type: "mousemove" }, win); |
|
52 |
|
53 doc.addEventListener("mousemove", doStopPropagation, true); |
|
54 doc.addEventListener("mouseenter", doStopPropagation, true); |
|
55 doc.addEventListener("mouseleave", doStopPropagation, true); |
|
56 doc.addEventListener("mouseover", doStopPropagation, true); |
|
57 doc.addEventListener("mouseout", doStopPropagation, true); |
|
58 document.addEventListener("popupshown", onPopupShown, true); |
|
59 document.addEventListener("popuphiding", onPopupHiding, true); |
|
60 |
|
61 EventUtils.synthesizeMouseAtCenter(p1, { type: "mousemove" }, win); |
|
62 } |
|
63 |
|
64 gBrowser.selectedBrowser.addEventListener("load", function loadListener() { |
|
65 gBrowser.selectedBrowser.removeEventListener("load", loadListener, true); |
|
66 setTimeout(onLoad, 0); |
|
67 }, true); |
|
68 |
|
69 content.location = "data:text/html," + |
|
70 "<p id=\"p1\" title=\"tooltip is here\">This paragraph has a tooltip.</p>" + |
|
71 "<p id=\"p2\">This paragraph doesn't have tooltip.</p>"; |
|
72 } |