summaryrefslogtreecommitdiffstats
path: root/dom/events/test/test_dom_activate_event.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 /dom/events/test/test_dom_activate_event.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 'dom/events/test/test_dom_activate_event.html')
-rw-r--r--dom/events/test/test_dom_activate_event.html89
1 files changed, 89 insertions, 0 deletions
diff --git a/dom/events/test/test_dom_activate_event.html b/dom/events/test/test_dom_activate_event.html
new file mode 100644
index 000000000..22e32d988
--- /dev/null
+++ b/dom/events/test/test_dom_activate_event.html
@@ -0,0 +1,89 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test DOMActivate event</title>
+ <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"/>
+</head>
+<body>
+<p id="display">
+<a id="a" href="#dummy">link</a>
+<button id="button">button</button>
+<input id="checkbox" type="checkbox">
+<input id="radio" type="radio">
+<input id="submit" type="submit">
+<input id="ibutton" type="button">
+<input id="reset" type="reset">
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(runTests);
+
+function runIsTrustedTestCausedByTrustedClick(aElement, aNextTest)
+{
+ const kDescription = "runIsTrustedTestCausedByTrustedClick(aElement.id=" + aElement.id + "): ";
+ var DOMActivateFired = false;
+ aElement.addEventListener("DOMActivate", function (aEvent) {
+ DOMActivateFired = true;
+ ok(aEvent.isTrusted, kDescription + "DOMActivate event should be trusted event");
+ aElement.removeEventListener("DOMActivate", arguments.callee);
+ aNextTest();
+ });
+ aElement.addEventListener("click", function (aEvent) {
+ ok(aEvent.isTrusted, kDescription + "click event should be trusted event");
+ aElement.removeEventListener("click", arguments.callee);
+ });
+ synthesizeMouseAtCenter(aElement, {});
+}
+
+function runIsTrustedTestCausedByUntrustedClick(aElement, aNextTest)
+{
+ const kDescription = "runIsTrustedTestCausedByUntrustedClick(aElement.id=" + aElement.id + "): ";
+ var DOMActivateFired = false;
+ aElement.addEventListener("DOMActivate", function (aEvent) {
+ DOMActivateFired = true;
+ ok(aEvent.isTrusted,
+ kDescription + "DOMActivate event should be trusted event even if it's caused by untrusted event");
+ aElement.removeEventListener("DOMActivate", arguments.callee);
+ aNextTest();
+ });
+ aElement.addEventListener("click", function (aEvent) {
+ ok(!aEvent.isTrusted, kDescription + "click event should be untrusted event");
+ aElement.removeEventListener("click", arguments.callee);
+ });
+ var click = new MouseEvent("click", { button: 0 });
+ aElement.dispatchEvent(click);
+}
+
+function runTests()
+{
+ // XXX Don't add indentation here. If you add indentation, the diff will be
+ // complicated when somebody adds new tests.
+ runIsTrustedTestCausedByTrustedClick(document.getElementById("a"), function () {
+ runIsTrustedTestCausedByTrustedClick(document.getElementById("button"), function () {
+ runIsTrustedTestCausedByTrustedClick(document.getElementById("checkbox"), function () {
+ runIsTrustedTestCausedByTrustedClick(document.getElementById("radio"), function () {
+ runIsTrustedTestCausedByTrustedClick(document.getElementById("submit"), function () {
+ runIsTrustedTestCausedByTrustedClick(document.getElementById("ibutton"), function () {
+ runIsTrustedTestCausedByTrustedClick(document.getElementById("reset"), function () {
+ runIsTrustedTestCausedByUntrustedClick(document.getElementById("a"), function () {
+ runIsTrustedTestCausedByUntrustedClick(document.getElementById("button"), function () {
+ runIsTrustedTestCausedByUntrustedClick(document.getElementById("checkbox"), function () {
+ runIsTrustedTestCausedByUntrustedClick(document.getElementById("radio"), function () {
+ runIsTrustedTestCausedByUntrustedClick(document.getElementById("submit"), function () {
+ runIsTrustedTestCausedByUntrustedClick(document.getElementById("ibutton"), function () {
+ runIsTrustedTestCausedByUntrustedClick(document.getElementById("reset"), function () {
+ SimpleTest.finish();
+ });});});});});});});});});});});});});});
+}
+
+</script>
+</pre>
+</body>
+</html>