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 --- .../resources/child-message-event-api.html | 24 +++++++++++ .../html/user-activation/resources/child-one.html | 29 +++++++++++++ .../html/user-activation/resources/child-two.html | 29 +++++++++++++ .../consumption-crossorigin-child.sub.html | 29 +++++++++++++ .../resources/consumption-sameorigin-child.html | 29 +++++++++++++ .../propagation-crossorigin-child.sub.html | 27 ++++++++++++ .../resources/propagation-sameorigin-child.html | 27 ++++++++++++ .../tests/html/user-activation/resources/utils.js | 48 ++++++++++++++++++++++ 8 files changed, 242 insertions(+) create mode 100644 testing/web-platform/tests/html/user-activation/resources/child-message-event-api.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/child-one.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/child-two.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/consumption-crossorigin-child.sub.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/consumption-sameorigin-child.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/propagation-crossorigin-child.sub.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/propagation-sameorigin-child.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/utils.js (limited to 'testing/web-platform/tests/html/user-activation/resources') diff --git a/testing/web-platform/tests/html/user-activation/resources/child-message-event-api.html b/testing/web-platform/tests/html/user-activation/resources/child-message-event-api.html new file mode 100644 index 0000000000..a0001633c2 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/child-message-event-api.html @@ -0,0 +1,24 @@ + + + + diff --git a/testing/web-platform/tests/html/user-activation/resources/child-one.html b/testing/web-platform/tests/html/user-activation/resources/child-one.html new file mode 100644 index 0000000000..9668372620 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/child-one.html @@ -0,0 +1,29 @@ + + + + diff --git a/testing/web-platform/tests/html/user-activation/resources/child-two.html b/testing/web-platform/tests/html/user-activation/resources/child-two.html new file mode 100644 index 0000000000..9fb68dbd51 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/child-two.html @@ -0,0 +1,29 @@ + + + + diff --git a/testing/web-platform/tests/html/user-activation/resources/consumption-crossorigin-child.sub.html b/testing/web-platform/tests/html/user-activation/resources/consumption-crossorigin-child.sub.html new file mode 100644 index 0000000000..518e000d0b --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/consumption-crossorigin-child.sub.html @@ -0,0 +1,29 @@ + + + + + + + +
Cross-origin child frame
+ + + diff --git a/testing/web-platform/tests/html/user-activation/resources/consumption-sameorigin-child.html b/testing/web-platform/tests/html/user-activation/resources/consumption-sameorigin-child.html new file mode 100644 index 0000000000..9e421fc0f1 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/consumption-sameorigin-child.html @@ -0,0 +1,29 @@ + + + + + + + +
Same-origin child frame
+ + + diff --git a/testing/web-platform/tests/html/user-activation/resources/propagation-crossorigin-child.sub.html b/testing/web-platform/tests/html/user-activation/resources/propagation-crossorigin-child.sub.html new file mode 100644 index 0000000000..e920566a21 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/propagation-crossorigin-child.sub.html @@ -0,0 +1,27 @@ + + + + + + + +
Cross-origin child frame
+ + + diff --git a/testing/web-platform/tests/html/user-activation/resources/propagation-sameorigin-child.html b/testing/web-platform/tests/html/user-activation/resources/propagation-sameorigin-child.html new file mode 100644 index 0000000000..69ad50cb71 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/propagation-sameorigin-child.html @@ -0,0 +1,27 @@ + + + + + + + +
Same-origin child frame
+ + + diff --git a/testing/web-platform/tests/html/user-activation/resources/utils.js b/testing/web-platform/tests/html/user-activation/resources/utils.js new file mode 100644 index 0000000000..5d3302583f --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/utils.js @@ -0,0 +1,48 @@ +function delayByFrames(f, num_frames) { + function recurse(depth) { + if (depth == 0) + f(); + else + requestAnimationFrame(() => recurse(depth-1)); + } + recurse(num_frames); +} + +// Returns a Promise which is resolved with the event object when the event is +// fired. +function getEvent(eventType) { + return new Promise(resolve => { + document.body.addEventListener(eventType, e => resolve(e), {once: true}); + }); +} + + +// Returns a Promise which is resolved with a "true" iff transient activation +// was available and successfully consumed. +// +// This function relies on Fullscreen API to check/consume user activation +// state. +async function consumeTransientActivation() { + try { + await document.body.requestFullscreen(); + await document.exitFullscreen(); + return true; + } catch(e) { + return false; + } +} + +function receiveMessage(type) { + return new Promise((resolve) => { + window.addEventListener("message", function listener(event) { + if (typeof event.data !== "string") { + return; + } + const data = JSON.parse(event.data); + if (data.type === type) { + window.removeEventListener("message", listener); + resolve(data); + } + }); + }); +} -- cgit v1.2.3