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