summaryrefslogtreecommitdiffstats
path: root/dom/events/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /dom/events/test
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/events/test')
-rw-r--r--dom/events/test/clipboard/mochitest.toml7
-rw-r--r--dom/events/test/clipboard/test_async_clipboard.xhtml10
-rw-r--r--dom/events/test/clipboard/test_async_clipboard_datatransfer.html89
-rw-r--r--dom/events/test/mochitest.toml2
-rw-r--r--dom/events/test/pointerevents/mochitest.toml15
-rw-r--r--dom/events/test/pointerevents/test_wpt_pointerevent_change-touch-action-onpointerdown_touch-manual.html39
-rw-r--r--dom/events/test/pointerevents/test_wpt_pointerevent_constructor.html26
-rw-r--r--dom/events/test/pointerevents/test_wpt_pointerevent_pointerId_scope-manual.html27
-rw-r--r--dom/events/test/pointerevents/wpt/pointerevent_change-touch-action-onpointerdown_touch-manual.html135
-rw-r--r--dom/events/test/pointerevents/wpt/pointerevent_constructor.html106
-rw-r--r--dom/events/test/pointerevents/wpt/pointerevent_pointerId_scope-manual.html82
-rw-r--r--dom/events/test/test_all_synthetic_events.html10
-rw-r--r--dom/events/test/test_eventctors.html22
-rw-r--r--dom/events/test/test_marquee_events.html31
14 files changed, 128 insertions, 473 deletions
diff --git a/dom/events/test/clipboard/mochitest.toml b/dom/events/test/clipboard/mochitest.toml
index 7829915267..98cbd3ddb5 100644
--- a/dom/events/test/clipboard/mochitest.toml
+++ b/dom/events/test/clipboard/mochitest.toml
@@ -1,5 +1,12 @@
[DEFAULT]
+["test_async_clipboard_datatransfer.html"]
+scheme = "https"
+skip-if = [
+ "headless", # headless doesn't support custom type
+ "os == 'android'", # android doesn't support custom type
+]
+
["test_paste_image.html"]
skip-if = [
"headless", # Bug 1405869
diff --git a/dom/events/test/clipboard/test_async_clipboard.xhtml b/dom/events/test/clipboard/test_async_clipboard.xhtml
index ec54809077..8a882fd24d 100644
--- a/dom/events/test/clipboard/test_async_clipboard.xhtml
+++ b/dom/events/test/clipboard/test_async_clipboard.xhtml
@@ -74,15 +74,7 @@
});
const items = await navigator.clipboard.read();
-
- // Bug 1756955: at least on Ubuntu 20.04, clearing the clipboard leads to
- // one item with no types.
- if (!items.length ||
- (items.length == 1 && !items[0].types.length)) {
- ok(true, "read() read the right thing from empty clipboard");
- } else {
- ok(false, "read() read the wrong thing from empty clipboard");
- }
+ ok(!items.length, "read() read the right thing from empty clipboard");
}
async function testNoContentsReadText() {
diff --git a/dom/events/test/clipboard/test_async_clipboard_datatransfer.html b/dom/events/test/clipboard/test_async_clipboard_datatransfer.html
new file mode 100644
index 0000000000..ab4151f4f5
--- /dev/null
+++ b/dom/events/test/clipboard/test_async_clipboard_datatransfer.html
@@ -0,0 +1,89 @@
+<html>
+<head>
+<title>Test for bug 1756955</title>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script>
+
+const kIsMac = navigator.platform.indexOf("Mac") > -1;
+
+async function copyByDataTransfer(aItems) {
+ const copyPromise = new Promise(resolve => {
+ document.addEventListener("copy", (e) => {
+ e.preventDefault();
+ for (const [key, value] of Object.entries(aItems)) {
+ e.clipboardData.setData(key, value);
+ }
+ resolve();
+ }, { once: true });
+ });
+ synthesizeKey(
+ "c",
+ kIsMac ? { accelKey: true } : { ctrlKey: true }
+ );
+ await copyPromise;
+}
+
+async function paste(aCallback) {
+ const pastePromise = new Promise(resolve => {
+ document.addEventListener("paste", (e) => {
+ resolve(aCallback(e.clipboardData));
+ }, { once: true });
+ });
+ synthesizeKey(
+ "v",
+ kIsMac ? { accelKey: true } : { ctrlKey: true }
+ );
+ await pastePromise;
+}
+
+add_setup(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["dom.events.asyncClipboard.readText", true],
+ ["dom.events.asyncClipboard.clipboardItem", true],
+ ],
+ });
+});
+
+add_task(async function test_mandatory_type() {
+ const items = {
+ "text/plain": "X" + Math.random(),
+ "custom/foo": "X" + Math.random(),
+ };
+ await copyByDataTransfer(items);
+ await paste(async (clipboardData) => {
+ for (const [key, value] of Object.entries(items)) {
+ is(clipboardData.getData(key), value, `Check ${key} type`);
+ }
+
+ let clipboardItems = await navigator.clipboard.read();
+ is(clipboardItems.length, 1, "Should only one clipboardItem");
+ is(clipboardItems[0].types.length, 1, "Should only one type");
+ is(await clipboardItems[0].getType("text/plain").then(blob => blob.text()),
+ items["text/plain"],
+ "Check text/plain type in clipbordItem");
+ });
+});
+
+add_task(async function test_no_mandatory_type() {
+ const items = {
+ "custom/foo": "X" + Math.random(),
+ };
+ await copyByDataTransfer(items);
+ await paste(async (clipboardData) => {
+ for (const [key, value] of Object.entries(items)) {
+ is(clipboardData.getData(key), value, `Check ${key} type`);
+ }
+
+ let clipboardItems = await navigator.clipboard.read();
+ is(clipboardItems.length, 0, "Should only have no clipboardItem");
+ });
+});
+
+</script>
+</head>
+<body>
+</body>
+</html>
diff --git a/dom/events/test/mochitest.toml b/dom/events/test/mochitest.toml
index 53675a8f49..19a082b1e3 100644
--- a/dom/events/test/mochitest.toml
+++ b/dom/events/test/mochitest.toml
@@ -448,8 +448,6 @@ skip-if = [
["test_legacy_touch_api.html"]
-["test_marquee_events.html"]
-
["test_messageEvent.html"]
["test_messageEvent_init.html"]
diff --git a/dom/events/test/pointerevents/mochitest.toml b/dom/events/test/pointerevents/mochitest.toml
index 340704f94e..c22e1bdf94 100644
--- a/dom/events/test/pointerevents/mochitest.toml
+++ b/dom/events/test/pointerevents/mochitest.toml
@@ -126,17 +126,6 @@ skip-if = [
"http2",
]
-["test_wpt_pointerevent_change-touch-action-onpointerdown_touch-manual.html"]
-support-files = ["wpt/pointerevent_change-touch-action-onpointerdown_touch-manual.html"]
-disabled = "disabled"
-
-["test_wpt_pointerevent_constructor.html"]
-support-files = ["wpt/pointerevent_constructor.html"]
-skip-if = [
- "http3",
- "http2",
-]
-
["test_wpt_pointerevent_drag_interaction-manual.html"]
support-files = ["wpt/html/pointerevent_drag_interaction-manual.html"]
skip-if = [
@@ -158,10 +147,6 @@ skip-if = [
support-files = ["wpt/pointerevent_multiple_primary_pointers_boundary_events-manual.html"]
disabled = "should be investigated"
-["test_wpt_pointerevent_pointerId_scope-manual.html"]
-support-files = ["wpt/resources/pointerevent_pointerId_scope-iframe.html"]
-disabled = "should be investigated"
-
["test_wpt_pointerevent_pointercancel_touch-manual.html"]
support-files = ["wpt/pointerevent_pointercancel_touch-manual.html"]
skip-if = [
diff --git a/dom/events/test/pointerevents/test_wpt_pointerevent_change-touch-action-onpointerdown_touch-manual.html b/dom/events/test/pointerevents/test_wpt_pointerevent_change-touch-action-onpointerdown_touch-manual.html
deleted file mode 100644
index f95b16c850..0000000000
--- a/dom/events/test/pointerevents/test_wpt_pointerevent_change-touch-action-onpointerdown_touch-manual.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1000870
--->
- <head>
- <meta charset="utf-8">
- <title>Test for Bug 1000870</title>
- <meta name="author" content="Maksim Lebedev" />
- <script src="/tests/SimpleTest/SimpleTest.js"></script>
- <script src="/tests/SimpleTest/EventUtils.js"></script>
- <script type="text/javascript" src="mochitest_support_external.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <script type="text/javascript">
- SimpleTest.waitForExplicitFinish();
- function startTest() {
- runTestInNewWindow("pointerevent_change-touch-action-onpointerdown_touch-manual.html");
- }
- function executeTest(int_win) {
- const WM_VSCROLL = 0x0115;
- sendTouchEvent(int_win, "target0", "touchstart");
- sendTouchEvent(int_win, "target0", "touchmove");
- sendTouchEvent(int_win, "target0", "touchend");
-
- // NOTE: This testcase is about that modifying touch-action during a
- // pointerdown callback "should not" affect the gesture detection of the
- // touch session started by the pointerdown. That is, a scroll should
- // still fired by gesture detection, instead of launching by our own.
- var utils = _getDOMWindowUtils(int_win);
- var target0 = int_win.document.getElementById("target0");
- utils.sendNativeMouseScrollEvent(target0.getBoundingClientRect().left + 5,
- target0.getBoundingClientRect().top + 5,
- WM_VSCROLL, 10, 10, 0, 0, 0, target0);
- }
- </script>
- </head>
- <body>
- </body>
-</html>
diff --git a/dom/events/test/pointerevents/test_wpt_pointerevent_constructor.html b/dom/events/test/pointerevents/test_wpt_pointerevent_constructor.html
deleted file mode 100644
index 058e32a967..0000000000
--- a/dom/events/test/pointerevents/test_wpt_pointerevent_constructor.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1000870
--->
- <head>
- <meta charset="utf-8">
- <title>Test for Bug 1000870</title>
- <meta name="author" content="Maksim Lebedev" />
- <script src="/tests/SimpleTest/SimpleTest.js"></script>
- <script src="/tests/SimpleTest/EventUtils.js"></script>
- <script type="text/javascript" src="mochitest_support_external.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <script type="text/javascript">
- SimpleTest.waitForExplicitFinish();
- function startTest() {
- runTestInNewWindow("wpt/pointerevent_constructor.html");
- }
- function executeTest(int_win) {
- // Function should be, but can be empty
- }
- </script>
- </head>
- <body>
- </body>
-</html>
diff --git a/dom/events/test/pointerevents/test_wpt_pointerevent_pointerId_scope-manual.html b/dom/events/test/pointerevents/test_wpt_pointerevent_pointerId_scope-manual.html
deleted file mode 100644
index f52bf7fc20..0000000000
--- a/dom/events/test/pointerevents/test_wpt_pointerevent_pointerId_scope-manual.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1000870
--->
- <head>
- <meta charset="utf-8">
- <title>Test for Bug 1000870</title>
- <meta name="author" content="Maksim Lebedev" />
- <script src="/tests/SimpleTest/SimpleTest.js"></script>
- <script src="/tests/SimpleTest/EventUtils.js"></script>
- <script type="text/javascript" src="mochitest_support_external.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <script type="text/javascript">
- SimpleTest.waitForExplicitFinish();
- function startTest() {
- runTestInNewWindow("wpt/pointerevent_pointerId_scope-manual.html");
- }
- function executeTest(int_win) {
- sendTouchEvent(int_win, "target0", "touchstart");
- sendTouchEvent(int_win, "target0", "touchend");
- }
- </script>
- </head>
- <body>
- </body>
-</html>
diff --git a/dom/events/test/pointerevents/wpt/pointerevent_change-touch-action-onpointerdown_touch-manual.html b/dom/events/test/pointerevents/wpt/pointerevent_change-touch-action-onpointerdown_touch-manual.html
deleted file mode 100644
index 04d56cb7a5..0000000000
--- a/dom/events/test/pointerevents/wpt/pointerevent_change-touch-action-onpointerdown_touch-manual.html
+++ /dev/null
@@ -1,135 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <title>Change touch-action on pointerdown</title>
- <meta name="viewport" content="width=device-width">
- <link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
- <script src="/resources/testharness.js"></script>
- <script src="/resources/testharnessreport.js"></script>
- <script src="pointerevent_support.js"></script>
- <style>
- #target0 {
- background: black;
- width: 700px;
- height: 430px;
- color: white;
- overflow-y: auto;
- overflow-x: auto;
- white-space: nowrap;
- }
- </style>
- </head>
- <body onload="run()">
- <h1>Pointer Events touch-action attribute support</h1>
- <h4>Test Description: Press and hold your touch. Try to scroll text in any direction.
- Then release your touch and try to scroll again. Expected: no panning.
- </h4>
- <p>Note: this test is for touch-devices only</p>
- <div id="target0" style="touch-action: auto;">
- <p>
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem
- nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat.
- Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit
- lobortis nisl ut aliquip ex ea commodo consequat.
- </p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem
- nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat.
- Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit
- lobortis nisl ut aliquip ex ea commodo consequat.
- </p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem
- nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat.
- Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit
- lobortis nisl ut aliquip ex ea commodo consequat.
- </p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem
- nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat.
- Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit
- lobortis nisl ut aliquip ex ea commodo consequat.
- </p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- <p>Lorem ipsum dolor sit amet...</p>
- </div>
- <script type='text/javascript'>
- var detected_pointertypes = {};
-
- var styleIsChanged = false;
- var scrollIsReceived = false;
- var firstTouchCompleted = false;
- var countToPass = 50;
- var xScr0, yScr0, xScr1, yScr1;
-
- setup({ explicit_done: true });
- add_completion_callback(showPointerTypes);
-
- function run() {
- var target0 = document.getElementById("target0");
-
- on_event(target0, 'scroll', function(event) {
- if(!scrollIsReceived && firstTouchCompleted) {
- test(function() {
- failOnScroll();
- }, "scroll was received while shouldn't");
- scrollIsReceived = true;
- }
- done();
- });
-
- on_event(target0, 'pointerdown', function(event) {
- detected_pointertypes[event.pointerType] = true;
- if(!styleIsChanged) {
- var before = document.getElementById('target0').style.touchAction;
-
- document.getElementById('target0').style.touchAction = 'none';
-
- var after = document.getElementById('target0').style.touchAction;
-
- test(function() {
- assert_true(before != after, "touch-action was changed");
- }, "touch-action was changed");
-
- styleIsChanged = true;
- }
- });
-
- on_event(target0, 'pointerup', function(event) {
- firstTouchCompleted = true;
- });
- }
- </script>
- <h1>touch-action: auto to none</h1>
- <div id="complete-notice">
- <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>
- </div>
- <div id="log"></div>
- </body>
-</html> \ No newline at end of file
diff --git a/dom/events/test/pointerevents/wpt/pointerevent_constructor.html b/dom/events/test/pointerevents/wpt/pointerevent_constructor.html
deleted file mode 100644
index b2a779d1f7..0000000000
--- a/dom/events/test/pointerevents/wpt/pointerevent_constructor.html
+++ /dev/null
@@ -1,106 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <title>PointerEvent: Constructor test</title>
- <meta name="viewport" content="width=device-width">
- <link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
- <script src="/resources/testharness.js"></script>
- <script src="/resources/testharnessreport.js"></script>
- <!-- Additional helper script for common checks across event types -->
- <script type="text/javascript" src="pointerevent_support.js"></script>
- </head>
- <body>
- <h1>PointerEvent: Dispatch custom event</h1>
- <h4>Test Description: This test checks if PointerEvent constructor works properly using synthetic pointerover and pointerout events. For valid results, this test must be run without generating real (trusted) pointerover or pointerout events on the black rectangle below.</h4>
- <div id="target0"></div>
- <script>
- var detected_pointertypes = {};
- add_completion_callback(showPointerTypes);
-
- async_test(function() {
- var target0 = document.getElementById("target0");
- // set values for non-default constructor
- var testBubbles = true;
- var testCancelable = true;
- var testPointerId = 42;
- var testPointerType = 'pen';
- var testClientX = 300;
- var testClientY = 500;
- var testWidth = 3;
- var testHeight = 5;
- var testTiltX = -45;
- var testTiltY = 30;
- var testButton = 0;
- var testButtons = 1;
- var testPressure = 0.4;
- var testIsPrimary = true;
-
- on_event(target0, "pointerover", this.step_func(function(event) {
- detected_pointertypes[ event.pointerType ] = true;
- generate_tests(assert_equals, [
- ["custom bubbles", event.bubbles, testBubbles],
- ["custom cancelable", event.cancelable, testCancelable],
- ["custom pointerId", event.pointerId, testPointerId],
- ["custom pointerType", event.pointerType, testPointerType],
- ["custom button", event.button, testButton],
- ["custom buttons", event.buttons, testButtons],
- ["custom width", event.width, testWidth],
- ["custom height", event.height, testHeight],
- ["custom clientX", event.clientX, testClientX],
- ["custom clientY", event.clientY, testClientY],
- ["custom tiltX", event.tiltX, testTiltX],
- ["custom tiltY", event.tiltY, testTiltY],
- ["custom isPrimary", event.isPrimary, testIsPrimary]
- ]);
- test(function() {
- assert_approx_equals(event.pressure, testPressure, 0.00000001, "custom pressure: ");
- }, "custom pressure: ");
- }));
-
- on_event(target0, "pointerout", this.step_func(function(event) {
- generate_tests(assert_equals, [
- ["default pointerId", event.pointerId, 0],
- ["default pointerType", event.pointerType, ""],
- ["default width", event.width, 1],
- ["default height", event.height, 1],
- ["default tiltX", event.tiltX, 0],
- ["default tiltY", event.tiltY, 0],
- ["default pressure", event.pressure, 0],
- ["default isPrimary", event.isPrimary, false]
- ]);
- }));
-
- on_event(window, "load", this.step_func_done(function() {
- assert_not_equals(window.PointerEvent, undefined);
-
- var pointerEventCustom = new PointerEvent("pointerover",
- {bubbles: testBubbles,
- cancelable: testCancelable,
- pointerId: testPointerId,
- pointerType: testPointerType,
- width: testWidth,
- height: testHeight,
- clientX: testClientX,
- clientY: testClientY,
- tiltX: testTiltX,
- tiltY: testTiltY,
- button: testButton,
- buttons: testButtons,
- pressure: testPressure,
- isPrimary: testIsPrimary
- });
- // A PointerEvent created with a PointerEvent constructor must have all its attributes set to the corresponding values provided to the constructor.
- // For attributes where values are not provided to the constructor, the corresponding default values must be used.
- // TA: 12.1
- target0.dispatchEvent(pointerEventCustom);
- var pointerEventDefault = new PointerEvent("pointerout");
- target0.dispatchEvent(pointerEventDefault);
- }, "PointerEvent constructor"));
- })
- </script>
- <div id="complete-notice">
- <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>
- </div>
- <div id="log"></div>
- </body>
-</html>
diff --git a/dom/events/test/pointerevents/wpt/pointerevent_pointerId_scope-manual.html b/dom/events/test/pointerevents/wpt/pointerevent_pointerId_scope-manual.html
deleted file mode 100644
index 3640cb6f6b..0000000000
--- a/dom/events/test/pointerevents/wpt/pointerevent_pointerId_scope-manual.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!doctype html>
-<html>
- <!--
-Test cases for Pointer Events v1 spec
-This document references Test Assertions (abbrev TA below) written by Cathy Chan
-http://www.w3.org/wiki/PointerEvents/TestAssertions
--->
- <head>
- <title>Pointer Events pointerdown tests</title>
- <meta name="viewport" content="width=device-width">
- <link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
- <script src="/resources/testharness.js"></script>
- <script src="/resources/testharnessreport.js"></script>
- <!-- Additional helper script for common checks across event types -->
- <script type="text/javascript" src="pointerevent_support.js"></script>
- <script>
- var detected_pointertypes = {};
- var test_pointerEvent = async_test("pointerId of an active pointer is the same across iframes");
- // showPointerTypes is defined in pointerevent_support.js
- // Requirements: the callback function will reference the test_pointerEvent object and
- // will fail unless the async_test is created with the var name "test_pointerEvent".
- add_completion_callback(showPointerTypes);
- var detected_pointertypes = {};
-
- function run() {
- var target0 = document.getElementById("target0");
- var pointerover_pointerId = null;
- var pointerover_pointerType = null;
-
- var eventList = ['pointerenter', 'pointerover', 'pointermove', 'pointerout', 'pointerleave'];
- var receivedEvents = {};
- var receivedEventsInnerFrame = {};
-
-
- function checkPointerId(event, inner) {
- detected_pointertypes[event.pointerType] = true;
- var eventName = (inner ? "inner frame " : "" ) + event.type;
- test_pointerEvent.step(function() {
- assert_equals(event.pointerId, pointerover_pointerId, "PointerId of " + eventName + " is not correct");
- assert_equals(event.pointerType, pointerover_pointerType, "PointerType of " + eventName + " is not correct");
- }, eventName + ".pointerId were the same as first pointerover");
- }
-
- on_event(window, "message", function(event) {
- var pe_event = JSON.parse(event.data);
- receivedEventsInnerFrame[pe_event.type] = 1;
- checkPointerId(pe_event, true);
- if (Object.keys(receivedEvents).length == eventList.length && Object.keys(receivedEventsInnerFrame).length == eventList.length)
- test_pointerEvent.done();
- });
-
- eventList.forEach(function(eventName) {
- on_event(target0, eventName, function (event) {
- if (pointerover_pointerId === null && event.type == 'pointerover') {
- pointerover_pointerId = event.pointerId;
- pointerover_pointerType = event.pointerType;
- } else {
- checkPointerId(event, false);
- }
- receivedEvents[event.type] = 1;
- });
- });
- }
- </script>
- </head>
- <body onload="run()">
- <h1>Pointer Events pointerdown tests</h1>
- Complete the following actions:
- <ol>
- <li>Start with your pointing device outside of black box, then move it into black box. If using touch just press in black box and don't release.
- <li>Move your pointing device into purple box (without leaving the digitizer range if you are using hover supported pen or without releasing touch if using touch). Then move it out of the purple box.
- </ol>
- <div id="target0" class="touchActionNone">
- </div>
- <iframe src="resources/pointerevent_pointerId_scope-iframe.html" id="innerframe"></iframe>
- <div id="complete-notice">
- <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>
- <p>Refresh the page to run the tests again with a different pointer type.</p>
- </div>
- <div id="log"></div>
- </body>
-</html>
diff --git a/dom/events/test/test_all_synthetic_events.html b/dom/events/test/test_all_synthetic_events.html
index d8de1a9148..3a00227f1b 100644
--- a/dom/events/test/test_all_synthetic_events.html
+++ b/dom/events/test/test_all_synthetic_events.html
@@ -376,6 +376,13 @@ const kEventConstructors = {
return new TCPServerSocketEvent(aName, aProps);
},
},
+ TextEvent : { create (aName, aProps) {
+ var e = document.createEvent("textevent");
+ e.initTextEvent("textInput", aProps.bubbles, aProps.cancelable,
+ aProps.view, aProps.data);
+ return e;
+ },
+ },
TimeEvent: { create: null
// Cannot create untrusted event from JS
},
@@ -477,7 +484,8 @@ function test() {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{"set": [["dom.w3c_touch_events.legacy_apis.enabled", true],
- ["layout.css.content-visibility.enabled", true]]},
+ ["layout.css.content-visibility.enabled", true],
+ ["dom.events.textevent.enabled", true]]},
function() {
test();
SimpleTest.finish();
diff --git a/dom/events/test/test_eventctors.html b/dom/events/test/test_eventctors.html
index 01ae59493e..26b9d647bf 100644
--- a/dom/events/test/test_eventctors.html
+++ b/dom/events/test/test_eventctors.html
@@ -924,6 +924,28 @@ is(e.dataTransfer, null, "InputEvent.dataTransfer should be null in default");
is(e.inputType, "", "InputEvent.inputType should be empty string in default");
is(e.isComposing, false, "InputEvent.isComposing should be false in default");
+// TextEvent
+if (SpecialPowers.getBoolPref("dom.events.textevent.enabled")) {
+ try {
+ e = new TextEvent();
+ ok(false, "TextEvent should not have constructor");
+ } catch (exp) {
+ ok(true, "TextEvent does not have a constructor");
+ }
+ try {
+ e = new TextEvent("foo");
+ ok(false, "TextEvent should not have constructor");
+ } catch (exp) {
+ ok(true, "TextEvent does not have a constructor taking a event type");
+ }
+ try {
+ e = new TextEvent("foo", {});
+ ok(false, "TextEvent should not have constructor");
+ } catch (exp) {
+ ok(true, "TextEvent does not have a constructor taking event type and a dictionary");
+ }
+}
+
</script>
</pre>
</body>
diff --git a/dom/events/test/test_marquee_events.html b/dom/events/test/test_marquee_events.html
deleted file mode 100644
index 22d0eafdf1..0000000000
--- a/dom/events/test/test_marquee_events.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<html>
-<head>
- <meta charset="utf-8">
- <title>Test for bug 1425874</title>
- <link rel="stylesheet" href="/tests/SimpleTest/test.css">
- <script src="/tests/SimpleTest/SimpleTest.js"></script>
- <script src="/tests/SimpleTest/EventUtils.js"></script>
-</head>
-<body>
- <script>
- var wasEventCalled;
- function callEventWithAttributeHandler(element, evt) {
- wasEventCalled = false;
- let el = document.createElement(element);
- el.setAttribute(`on${evt}`, "wasEventCalled = true");
- el.dispatchEvent(new Event(evt));
- return wasEventCalled;
- }
-
- info("Make sure the EventNameType_HTMLMarqueeOnly events only compile for marquee");
-
- ok(!callEventWithAttributeHandler("div", "bounce"), "no onbounce for div");
- ok(!callEventWithAttributeHandler("div", "finish"), "no onfinish for div");
- ok(!callEventWithAttributeHandler("div", "start"), "no onstart for div");
-
- ok(callEventWithAttributeHandler("marquee", "bounce"), "onbounce for marquee");
- ok(callEventWithAttributeHandler("marquee", "finish"), "onfinish for marquee");
- ok(callEventWithAttributeHandler("marquee", "start"), "onstart for marquee");
- </script>
-</body>
-</html>