From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../web-platform/tests/is-input-pending/META.yml | 1 + .../web-platform/tests/is-input-pending/README.md | 3 + .../tests/is-input-pending/idlharness.window.js | 14 +++++ .../tests/is-input-pending/resources/blank.html | 2 + .../is-input-pending/resources/input-onmessage.js | 25 ++++++++ .../resources/pending-input-utils.js | 68 ++++++++++++++++++++++ .../cross-origin-subframe-complex-clip.sub.html | 27 +++++++++ ...ss-origin-subframe-masked-complex-clip.sub.html | 34 +++++++++++ ...subframe-masked-pointer-events-mixed-2.sub.html | 45 ++++++++++++++ ...n-subframe-masked-pointer-events-mixed.sub.html | 43 ++++++++++++++ ...in-subframe-masked-pointer-events-none.sub.html | 33 +++++++++++ .../cross-origin-subframe-overlap.sub.html | 28 +++++++++ ...ss-origin-subframe-pointer-events-none.sub.html | 26 +++++++++ .../cross-origin-subframe-transformed.sub.html | 27 +++++++++ .../security/cross-origin-subframe.sub.html | 21 +++++++ .../tentative/same-origin-subframe.sub.html | 32 ++++++++++ .../tests/is-input-pending/tentative/toplevel.html | 26 +++++++++ 17 files changed, 455 insertions(+) create mode 100644 testing/web-platform/tests/is-input-pending/META.yml create mode 100644 testing/web-platform/tests/is-input-pending/README.md create mode 100644 testing/web-platform/tests/is-input-pending/idlharness.window.js create mode 100644 testing/web-platform/tests/is-input-pending/resources/blank.html create mode 100644 testing/web-platform/tests/is-input-pending/resources/input-onmessage.js create mode 100644 testing/web-platform/tests/is-input-pending/resources/pending-input-utils.js create mode 100644 testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-complex-clip.sub.html create mode 100644 testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-complex-clip.sub.html create mode 100644 testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-mixed-2.sub.html create mode 100644 testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-mixed.sub.html create mode 100644 testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-none.sub.html create mode 100644 testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-overlap.sub.html create mode 100644 testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-pointer-events-none.sub.html create mode 100644 testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-transformed.sub.html create mode 100644 testing/web-platform/tests/is-input-pending/security/cross-origin-subframe.sub.html create mode 100644 testing/web-platform/tests/is-input-pending/tentative/same-origin-subframe.sub.html create mode 100644 testing/web-platform/tests/is-input-pending/tentative/toplevel.html (limited to 'testing/web-platform/tests/is-input-pending') diff --git a/testing/web-platform/tests/is-input-pending/META.yml b/testing/web-platform/tests/is-input-pending/META.yml new file mode 100644 index 0000000000..f0cc50994a --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/META.yml @@ -0,0 +1 @@ +spec: https://wicg.github.io/is-input-pending/ diff --git a/testing/web-platform/tests/is-input-pending/README.md b/testing/web-platform/tests/is-input-pending/README.md new file mode 100644 index 0000000000..7994b1a4ec --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/README.md @@ -0,0 +1,3 @@ +- `security/` contains tests intended to ensure that input is not detectable cross-origin. +- `tentative/` contains tests to detect common cases where it may be beneficial to pending input. + - All positive tests are marked as tentative, as the spec permits UAs to omit reporting pending input. diff --git a/testing/web-platform/tests/is-input-pending/idlharness.window.js b/testing/web-platform/tests/is-input-pending/idlharness.window.js new file mode 100644 index 0000000000..726dd137dd --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/idlharness.window.js @@ -0,0 +1,14 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://wicg.github.io/is-input-pending/ + +idl_test( + ['is-input-pending'], + ['html', 'dom'], + async idl_array => { + idl_array.add_objects({ + Scheduling: ['navigator.scheduling'], + }); + } +); diff --git a/testing/web-platform/tests/is-input-pending/resources/blank.html b/testing/web-platform/tests/is-input-pending/resources/blank.html new file mode 100644 index 0000000000..f27d7148d3 --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/resources/blank.html @@ -0,0 +1,2 @@ + + diff --git a/testing/web-platform/tests/is-input-pending/resources/input-onmessage.js b/testing/web-platform/tests/is-input-pending/resources/input-onmessage.js new file mode 100644 index 0000000000..919c939d1f --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/resources/input-onmessage.js @@ -0,0 +1,25 @@ +// Responds to onmessage events from other frames to check for pending input. +onmessage = async e => { + if (e.data !== 'check-input') return; + + const discreteOptions = { includeContinuous: false }; + const continuousOptions = { includeContinuous: true }; + + // Use a reasonable time to wait after dispatching events, since we want to be + // able to test for cases where isInputPending returns false. + const DISPATCH_WAIT_TIME_MS = 500; + + // Wait a reasonable amount of time for the event to be enqueued. + const end = performance.now() + DISPATCH_WAIT_TIME_MS; + let hasDiscrete; + let hasContinuous; + do { + hasDiscrete = navigator.scheduling.isInputPending(discreteOptions); + hasContinuous = navigator.scheduling.isInputPending(continuousOptions); + } while (performance.now() < end && !(hasDiscrete && hasContinuous)); + + e.source.postMessage({ + discrete: hasDiscrete, + continuous: hasContinuous, + }, '*'); +} diff --git a/testing/web-platform/tests/is-input-pending/resources/pending-input-utils.js b/testing/web-platform/tests/is-input-pending/resources/pending-input-utils.js new file mode 100644 index 0000000000..489c16827a --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/resources/pending-input-utils.js @@ -0,0 +1,68 @@ +// Dispatches the given sequence of actions and verifies isInputPending state +// after dispatch according to expectations. Returns when all dispatched input +// has been handled. +const pendingActionTest = async (label, target, actionCallback, expectations) => { + promise_test(async () => { + // Give focus to the page first, before running the test. + await new test_driver.Actions() + .pointerMove(0, 0) + .pointerDown() + .pointerUp() + .send(); + + // Register a handler to fetch the result of isInputPending from the target + // window. + const resultPromise = new Promise(res => { + window.addEventListener('message', function handler(e) { + if (e.data === 'check-input') return; + res(e.data); + window.removeEventListener('message', handler); + }); + }); + + // Signal to the target window to monitor isInputPending. + target.postMessage('check-input', '*'); + + const actions = actionCallback(); + const actionsPromise = actions.send(); + + const {discrete, continuous} = await resultPromise; + + assert_equals(discrete, expectations.discrete, 'detected discrete input'); + assert_equals(continuous, expectations.continuous, 'detected continuous input'); + + await actionsPromise; + }, label); +} + +const PendingInputUtils = { + testDetectNoPendingInput(target, actionCallback, label) { + pendingActionTest(label, target, actionCallback, { + discrete: false, + continuous: false, + }); + }, + + testDetectDiscretePendingInput(target, actionCallback, label) { + pendingActionTest(label, target, actionCallback, { + discrete: true, + continuous: true, + }); + }, + + testDetectContinuousPendingInput(target, actionCallback, label) { + pendingActionTest(label, target, actionCallback, { + discrete: false, + continuous: true, + }); + }, + + // Simulates a pointer event at the given coordinates, and tests that the + // given target window cannot access it. Intended for cross-origin compliance + // tests. + testCannotAccessPendingInputAt(target, x, y, label) { + PendingInputUtils.testDetectNoPendingInput(target, () => { + return new test_driver.Actions().pointerMove(x, y).pointerDown().pointerUp(); + }, label); + }, +} diff --git a/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-complex-clip.sub.html b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-complex-clip.sub.html new file mode 100644 index 0000000000..0bbe9c0782 --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-complex-clip.sub.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + +
+ +

Ensure that a parent frame cannot detect events on a cross-origin subframe with a complex clip.

+ + + diff --git a/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-complex-clip.sub.html b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-complex-clip.sub.html new file mode 100644 index 0000000000..e5a3d310a9 --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-complex-clip.sub.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + +
+

Ensure that a parent frame cannot detect events on a cross-origin subframe masked by a div with a complex clip.

+ + + diff --git a/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-mixed-2.sub.html b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-mixed-2.sub.html new file mode 100644 index 0000000000..55cbc48b7d --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-mixed-2.sub.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + +
+
+
+

Ensure that a parent frame cannot detect events on top of a cross-origin subframe masked by a div with a `pointer-events: none` child.

+ + + diff --git a/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-mixed.sub.html b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-mixed.sub.html new file mode 100644 index 0000000000..b0363682ef --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-mixed.sub.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + + +
+
+
+ +

Ensure that a parent frame cannot can events on top of a cross-origin subframe masked by a div with `pointer-events: none` and a `pointer-events: initial` child.

+ + + diff --git a/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-none.sub.html b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-none.sub.html new file mode 100644 index 0000000000..a3f971cdfd --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-masked-pointer-events-none.sub.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + +
+ +

Ensure that a parent frame cannot detect events on a cross-origin subframe masked by a div with `pointer-events: none`.

+ + + diff --git a/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-overlap.sub.html b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-overlap.sub.html new file mode 100644 index 0000000000..377eedbf35 --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-overlap.sub.html @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + +

Ensure that two overlapping subframes cannot detect events from each other.

+ + + diff --git a/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-pointer-events-none.sub.html b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-pointer-events-none.sub.html new file mode 100644 index 0000000000..371a92866a --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-pointer-events-none.sub.html @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + +

Ensure that a subframe cannot detect events if it has `pointer-events: none`.

+ + + diff --git a/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-transformed.sub.html b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-transformed.sub.html new file mode 100644 index 0000000000..5dac5aa36b --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe-transformed.sub.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + +

Ensure that a parent frame cannot detect events on a cross-origin subframe when the subframe does not intersect and is not an axis-aligned rect.

+ + + diff --git a/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe.sub.html b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe.sub.html new file mode 100644 index 0000000000..d513fa94fc --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/security/cross-origin-subframe.sub.html @@ -0,0 +1,21 @@ + + + + + + + + + + + + + +

Ensure that a parent frame cannot detect events on a cross-origin subframe.

+ + + diff --git a/testing/web-platform/tests/is-input-pending/tentative/same-origin-subframe.sub.html b/testing/web-platform/tests/is-input-pending/tentative/same-origin-subframe.sub.html new file mode 100644 index 0000000000..ee85bc4d06 --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/tentative/same-origin-subframe.sub.html @@ -0,0 +1,32 @@ + + + + + + + + + + + + + +

Ensure that a parent frame can detect events on one of its same-origin subframes.

+ + + diff --git a/testing/web-platform/tests/is-input-pending/tentative/toplevel.html b/testing/web-platform/tests/is-input-pending/tentative/toplevel.html new file mode 100644 index 0000000000..4b60571d53 --- /dev/null +++ b/testing/web-platform/tests/is-input-pending/tentative/toplevel.html @@ -0,0 +1,26 @@ + + + + + + + + + + + + +

Ensure that pointer events dispatched the to the toplevel document are detectable by isInputPending.

+ + + -- cgit v1.2.3