2009-03-03 20:11:14 +00:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=333198
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 333198</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
2010-09-01 20:44:48 +00:00
|
|
|
<!-- setTimeout so that the test starts after paint suppression ends -->
|
|
|
|
<body onload="setTimeout(runTest,0);">
|
2009-03-03 20:11:14 +00:00
|
|
|
<iframe id="ifr"></iframe><br>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=333198">Mozilla Bug 333198</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 333198 **/
|
|
|
|
|
2009-03-25 14:11:11 +00:00
|
|
|
var focusTester;
|
|
|
|
var focusTester2;
|
|
|
|
var focusCount = 0;
|
2009-03-03 20:11:14 +00:00
|
|
|
var eventCount = 0;
|
|
|
|
function clickHandler() {
|
|
|
|
++eventCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
function suppressEvents(suppress) {
|
2012-08-23 18:45:28 +00:00
|
|
|
SpecialPowers.DOMWindowUtils.suppressEventHandling(suppress);
|
2009-03-03 20:11:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function sendEvents() {
|
2012-08-23 18:45:28 +00:00
|
|
|
windowUtils = SpecialPowers.getDOMWindowUtils(window);
|
2009-03-03 20:11:14 +00:00
|
|
|
windowUtils.sendMouseEvent("mousedown", 1, 1, 0, 1, 0);
|
|
|
|
windowUtils.sendMouseEvent("mouseup", 1, 1, 0, 1, 0);
|
|
|
|
|
2012-08-23 18:45:28 +00:00
|
|
|
iframeUtils = SpecialPowers.getDOMWindowUtils(document.getElementById("ifr").contentWindow);
|
2009-03-03 20:11:14 +00:00
|
|
|
iframeUtils.sendMouseEvent("mousedown", 1, 1, 0, 1, 0);
|
|
|
|
iframeUtils.sendMouseEvent("mouseup", 1, 1, 0, 1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
function runTest() {
|
2009-03-25 14:11:11 +00:00
|
|
|
window.focus();
|
|
|
|
focusTester = document.getElementsByTagName("input")[0];
|
|
|
|
focusTester.blur();
|
2009-03-03 20:11:14 +00:00
|
|
|
window.addEventListener("click", clickHandler, true);
|
|
|
|
var ifr = document.getElementById("ifr")
|
|
|
|
ifr.contentWindow.addEventListener("click", clickHandler, true);
|
|
|
|
sendEvents();
|
|
|
|
is(eventCount, 2, "Wrong event count(1)");
|
|
|
|
suppressEvents(true);
|
|
|
|
sendEvents();
|
|
|
|
is(eventCount, 2, "Wrong event count(2)");
|
|
|
|
suppressEvents(false);
|
|
|
|
sendEvents();
|
|
|
|
is(eventCount, 4, "Wrong event count(2)");
|
2009-03-25 14:11:11 +00:00
|
|
|
|
|
|
|
is(focusCount, 0, "Wrong focus count (1)");
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
xhr.open("GET", window.location, false);
|
|
|
|
xhr.onload = function() {
|
|
|
|
focusTester.focus();
|
|
|
|
is(focusCount, 1, "Wrong focus count (2)");
|
|
|
|
focusTester.blur();
|
|
|
|
}
|
|
|
|
xhr.send();
|
|
|
|
|
|
|
|
focusTester.focus();
|
|
|
|
is(focusCount, 2, "Wrong focus count (3)");
|
|
|
|
|
2009-03-03 20:11:14 +00:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
2009-03-25 14:11:11 +00:00
|
|
|
<input type="text" onfocus="++focusCount;">
|
2009-03-03 20:11:14 +00:00
|
|
|
</body>
|
|
|
|
</html>
|