mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
ede8c44ef2
This excludes dom/, otherwise the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 2` argument. Differential Revision: https://phabricator.services.mozilla.com/D27456 --HG-- extra : moz-landing-system : lando
76 lines
2.6 KiB
HTML
76 lines
2.6 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=977003
|
|
-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for Bug 977003</title>
|
|
<meta name="author" content="Maksim Lebedev" />
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
<style>
|
|
#target, #listener { background: yellow; }
|
|
</style>
|
|
<script type="application/javascript">
|
|
var target = undefined;
|
|
var listener = undefined;
|
|
var test_down_got = false;
|
|
var test_listener = false;
|
|
|
|
function TargetDownHandler(event) {
|
|
logger("Target receive event: " + event.type);
|
|
logger("Send setPointerCapture to listener");
|
|
listener.setPointerCapture(event.pointerId);
|
|
logger("Send releasePointerCapture from listener");
|
|
listener.releasePointerCapture(event.pointerId);
|
|
logger("set/release was executed");
|
|
test_down_got = true;
|
|
}
|
|
function ListenerHandler(event) {
|
|
logger("Receive event on Listener: " + event.type);
|
|
test_listener = true;
|
|
}
|
|
function logger(message) {
|
|
console.log(message);
|
|
var log = document.getElementById('log');
|
|
log.innerHTML = message + "<br>" + log.innerHTML;
|
|
}
|
|
|
|
function prepareTest() {
|
|
parent.turnOnPointerEvents(executeTest);
|
|
}
|
|
function executeTest()
|
|
{
|
|
logger("executeTest");
|
|
target = document.getElementById("target");
|
|
listener = document.getElementById("listener");
|
|
target.addEventListener("pointerdown", TargetDownHandler);
|
|
listener.addEventListener("gotpointercapture", ListenerHandler);
|
|
listener.addEventListener("lostpointercapture", ListenerHandler);
|
|
var rect = target.getBoundingClientRect();
|
|
synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mousedown"});
|
|
synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mouseup"});
|
|
finishTest();
|
|
}
|
|
function finishTest() {
|
|
parent.is(test_down_got, true, "Part 2: pointerdown event should be received by target");
|
|
parent.is(test_listener, false, "Part 2: listener should not receive any events");
|
|
logger("finishTest");
|
|
parent.finishTest();
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="prepareTest()">
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=977003">Mozilla Bug 977003 Test 2</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
</div>
|
|
<div id="listener">div id=listener</div>
|
|
<div id="target">div id=target</div>
|
|
<pre id="log">
|
|
</pre>
|
|
</body>
|
|
</html>
|