2 <?xml-stylesheet type=
"text/css" href=
"chrome://global/skin"?>
3 <?xml-stylesheet type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css"?>
5 https://bugzilla.mozilla.org/show_bug.cgi?id=987230
7 <window title=
"Mozilla Bug 987230"
8 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
9 onload=
"SimpleTest.waitForFocus(startTest, window)">
10 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <script src=
"chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
14 <!-- test results are displayed in the html:body -->
15 <body xmlns=
"http://www.w3.org/1999/xhtml">
16 <a href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=987230"
17 target=
"_blank">Mozilla Bug
987230</a>
22 <toolbarbutton id=
"toolbarbutton-anchor"
24 consumeanchor=
"toolbarbutton-anchor"
25 onclick=
"onAnchorClick(event)"
26 style=
"padding: 50px !important; list-style-image: url(chrome://branding/content/icon32.png)"/>
29 <hbox id=
"hbox-anchor"
31 onclick=
"onAnchorClick(event)">
32 <hbox id=
"inner-anchor"
33 consumeanchor=
"hbox-anchor"
43 onpopupshown=
"onMyPopupShown(event)"
44 onpopuphidden=
"onMyPopupHidden(event)">This is a test popup
</panel>
46 <!-- test code goes here -->
47 <script type=
"application/javascript">
49 /** Test for Bug
987230 **/
50 SimpleTest.waitForExplicitFinish();
52 SimpleTest.requestCompleteLog();
54 function onMyPopupHidden(e) {
55 ok(true,
"Popup hidden");
56 if (outerAnchor.id ==
"toolbarbutton-anchor") {
57 popupHasShown = false;
58 outerAnchor = document.getElementById(
"hbox-anchor");
59 anchor = document.getElementById(
"inner-anchor");
62 //XXXgijs set mouse position back outside the iframe:
63 let frameRect = window.frameElement.getBoundingClientRect();
64 let scale = window.devicePixelRatio;
65 let outsideOfFrameX = (window.mozInnerScreenX + frameRect.width +
100) * scale;
66 let outsideOfFrameY = Math.max(
0, window.mozInnerScreenY -
100) * scale;
68 info(
"Mousemove: " + outsideOfFrameX +
", " + outsideOfFrameY +
69 " (from innerscreen " + window.mozInnerScreenX +
", " + window.mozInnerScreenY +
70 " and rect width " + frameRect.width +
" and scale " + scale +
")");
71 synthesizeNativeMouseEvent({
73 screenX: outsideOfFrameX,
74 screenY: outsideOfFrameY,
75 scale:
"inScreenPixels",
76 elementOnWidget: null,
82 let popupHasShown = false;
83 function onMyPopupShown(e) {
85 synthesizeNativeMouseEvent({ type:
"click", target: outerAnchor, offsetX:
5, offsetY:
5 });
88 function onAnchorClick(e) {
89 info(
"click: " + e.target.id);
90 ok(!popupHasShown,
"Popup should only be shown once");
91 popup.openPopup(anchor,
"bottomcenter topright");
94 let popup, outerAnchor, anchor;
96 function startTest() {
97 popup = document.getElementById(
"mypopup");
98 outerAnchor = document.getElementById(
"toolbarbutton-anchor");
99 anchor = outerAnchor.icon;
103 function nextTest(e) {
104 synthesizeMouse(outerAnchor,
5,
5, {});