summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/bug1080360_inner.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /layout/base/tests/bug1080360_inner.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/base/tests/bug1080360_inner.html')
-rw-r--r--layout/base/tests/bug1080360_inner.html83
1 files changed, 83 insertions, 0 deletions
diff --git a/layout/base/tests/bug1080360_inner.html b/layout/base/tests/bug1080360_inner.html
new file mode 100644
index 000000000..95862f9c6
--- /dev/null
+++ b/layout/base/tests/bug1080360_inner.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1080360
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1080360</title>
+ <meta name="author" content="Maksim Lebedev" />
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style>
+ #target, #listener { background: yellow; padding: 10px; }
+ </style>
+ <script type="application/javascript">
+ var target = undefined;
+ var listener = undefined;
+ var test_target = false;
+ var test_listener_got = false;
+ var test_listener_lost = false;
+ var test_document = false;
+
+ function TargetHandler(event) {
+ logger("Target receive event: " + event.type);
+ listener.setPointerCapture(event.pointerId);
+ test_target = true;
+ }
+ function ListenerHandler(event) {
+ logger("Listener receive event: " + event.type);
+ if(event.type == "gotpointercapture") {
+ test_listener_got = true;
+ listener.parentNode.removeChild(listener);
+ }
+ if(event.type == "lostpointercapture")
+ test_listener_lost = true;
+ }
+ function DocumentHandler(event) {
+ logger("Document receive event: " + event.type);
+ if(event.type == "lostpointercapture")
+ test_document = 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", TargetHandler, false);
+ listener.addEventListener("gotpointercapture", ListenerHandler, false);
+ listener.addEventListener("lostpointercapture", ListenerHandler, false);
+ document.addEventListener("lostpointercapture", DocumentHandler, false);
+ var rect = target.getBoundingClientRect();
+ synthesizePointer(target, rect.width/2, rect.height/2, {type: "pointerdown"});
+ synthesizePointer(target, rect.width/2, rect.height/2, {type: "pointermove"});
+ synthesizePointer(target, rect.width/2, rect.height/2, {type: "pointerup"});
+ finishTest();
+ }
+ function finishTest() {
+ parent.is(test_target, true, "pointerdown event should be received by target");
+ parent.is(test_listener_got, true, "gotpointercapture event should be received by listener");
+ parent.is(test_listener_lost, false, "listener should not receive lostpointercapture event");
+ parent.is(test_document, true, "document should receive lostpointercapture event");
+ logger("finishTest");
+ parent.finishTest();
+ }
+ </script>
+</head>
+<body onload="prepareTest()">
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1080360">Mozilla Bug 1080360</a>
+ <div id="target">div id=target</div>
+ <div id="listener">div id=listener</div>
+ <pre id="log"></pre>
+</body>
+</html>