From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- .../resources/echo-cookie-header.py | 12 +++++ .../resources/embedded_responder.js | 56 ++++++++++++++++++++++ .../hasStorageAccess-ABA-iframe.https.html | 7 +++ ...hasStorageAccess-ABA-iframe.sub.https.window.js | 9 ++++ .../resources/hasStorageAccess-iframe.html | 8 ++++ .../resources/hasStorageAccess-iframe.https.html | 8 ++++ .../resources/permissions-iframe.https.html | 10 ++++ .../requestStorageAccess-ABA-iframe.https.html | 7 +++ ...estStorageAccess-ABA-iframe.sub.https.window.js | 12 +++++ .../resources/requestStorageAccess-iframe.html | 10 ++++ .../requestStorageAccess-iframe.https.html | 11 +++++ .../resources/script-with-cookie-header.py | 19 ++++++++ 12 files changed, 169 insertions(+) create mode 100644 testing/web-platform/tests/storage-access-api/resources/echo-cookie-header.py create mode 100644 testing/web-platform/tests/storage-access-api/resources/embedded_responder.js create mode 100644 testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-ABA-iframe.https.html create mode 100644 testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-ABA-iframe.sub.https.window.js create mode 100644 testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-iframe.html create mode 100644 testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-iframe.https.html create mode 100644 testing/web-platform/tests/storage-access-api/resources/permissions-iframe.https.html create mode 100644 testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-ABA-iframe.https.html create mode 100644 testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-ABA-iframe.sub.https.window.js create mode 100644 testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-iframe.html create mode 100644 testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-iframe.https.html create mode 100644 testing/web-platform/tests/storage-access-api/resources/script-with-cookie-header.py (limited to 'testing/web-platform/tests/storage-access-api/resources') diff --git a/testing/web-platform/tests/storage-access-api/resources/echo-cookie-header.py b/testing/web-platform/tests/storage-access-api/resources/echo-cookie-header.py new file mode 100644 index 0000000000..f1599e3a89 --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/echo-cookie-header.py @@ -0,0 +1,12 @@ +def main(request, response): + # Set the cors enabled headers. + origin = request.headers.get(b"Origin") + headers = [] + if origin is not None and origin != b"null": + headers.append((b"Content-Type", b"text/plain")) + headers.append((b"Access-Control-Allow-Origin", origin)) + headers.append((b"Access-Control-Allow-Credentials", 'true')) + + cookie_header = request.headers.get(b"Cookie", b"") + + return (200, headers, cookie_header) diff --git a/testing/web-platform/tests/storage-access-api/resources/embedded_responder.js b/testing/web-platform/tests/storage-access-api/resources/embedded_responder.js new file mode 100644 index 0000000000..634079289b --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/embedded_responder.js @@ -0,0 +1,56 @@ +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +"use strict"; + +test_driver.set_test_context(window.top); + +window.addEventListener("message", async (event) => { + function reply(data) { + event.source.postMessage( + {timestamp: event.data.timestamp, data}, event.origin); + } + + switch (event.data["command"]) { + case "hasStorageAccess": + reply(await document.hasStorageAccess()); + break; + case "requestStorageAccess": { + const obtainedAccess = await document.requestStorageAccess() + .then(() => true, () => false); + reply(obtainedAccess); + } + break; + case "write document.cookie": + document.cookie = event.data.cookie; + reply(undefined); + break; + case "document.cookie": + reply(document.cookie); + break; + case "set_permission": + await test_driver.set_permission(...event.data.args); + reply(undefined); + break; + case "observe_permission_change": + const status = await navigator.permissions.query({name: "storage-access"}); + status.addEventListener("change", (event) => { + reply(event.target.state) + }, { once: true }); + break; + case "reload": + window.location.reload(); + break; + case "navigate": + window.location.href = event.data.url; + break; + case "httpCookies": + // The `httpCookies` variable is defined/set by + // script-with-cookie-header.py. + reply(httpCookies); + break; + case "cors fetch": + reply(await fetch(event.data.url, {mode: 'cors', credentials: 'include'}).then((resp) => resp.text())); + break; + default: + } +}); diff --git a/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-ABA-iframe.https.html b/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-ABA-iframe.https.html new file mode 100644 index 0000000000..c9f23f02ac --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-ABA-iframe.https.html @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-ABA-iframe.sub.https.window.js b/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-ABA-iframe.sub.https.window.js new file mode 100644 index 0000000000..126ae00201 --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-ABA-iframe.sub.https.window.js @@ -0,0 +1,9 @@ +// META: script=../helpers.js +'use strict'; + +// This expects to be run in an iframe that is cross-site to the top-level frame. +(async function() { + // Create a test with a single-child iframe that is same-site to the top-level frame but cross-site to the iframe + // that is being created here, for the purpose of testing hasStorageAccess in an A(B(A)) frame tree setting. + RunTestsInIFrame("https://{{host}}:{{ports[https][0]}}/storage-access-api/resources/hasStorageAccess-iframe.https.html?testCase=ABA"); +})(); diff --git a/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-iframe.html b/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-iframe.html new file mode 100644 index 0000000000..d57c3961e5 --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-iframe.html @@ -0,0 +1,8 @@ + + + + + + +
+ diff --git a/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-iframe.https.html b/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-iframe.https.html new file mode 100644 index 0000000000..95169503c2 --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/hasStorageAccess-iframe.https.html @@ -0,0 +1,8 @@ + + + + + + +
+ diff --git a/testing/web-platform/tests/storage-access-api/resources/permissions-iframe.https.html b/testing/web-platform/tests/storage-access-api/resources/permissions-iframe.https.html new file mode 100644 index 0000000000..b83a05c3f1 --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/permissions-iframe.https.html @@ -0,0 +1,10 @@ + + + + + + + + +
+ diff --git a/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-ABA-iframe.https.html b/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-ABA-iframe.https.html new file mode 100644 index 0000000000..7452ff89a0 --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-ABA-iframe.https.html @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-ABA-iframe.sub.https.window.js b/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-ABA-iframe.sub.https.window.js new file mode 100644 index 0000000000..8bfef8022a --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-ABA-iframe.sub.https.window.js @@ -0,0 +1,12 @@ +// META: script=../helpers.js +'use strict'; + +// This expects to be run in an iframe that is cross-site to the top-level +// frame. +(async function() { + // Create a test with a single-child iframe that is same-site to the top-level + // frame but cross-site to the iframe that is being created here, for the + // purpose of testing requestStorageAccess in an A(B(A)) frame tree setting. + RunTestsInIFrame( + 'https://{{domains[www]}}:{{ports[https][0]}}/storage-access-api/resources/requestStorageAccess-iframe.https.html?testCase=ABA'); +})(); diff --git a/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-iframe.html b/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-iframe.html new file mode 100644 index 0000000000..8b47786e17 --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-iframe.html @@ -0,0 +1,10 @@ + + + + + + + + +
+ diff --git a/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-iframe.https.html b/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-iframe.https.html new file mode 100644 index 0000000000..828af799e6 --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/requestStorageAccess-iframe.https.html @@ -0,0 +1,11 @@ + + + + + + + + + +
+ diff --git a/testing/web-platform/tests/storage-access-api/resources/script-with-cookie-header.py b/testing/web-platform/tests/storage-access-api/resources/script-with-cookie-header.py new file mode 100644 index 0000000000..83129a5559 --- /dev/null +++ b/testing/web-platform/tests/storage-access-api/resources/script-with-cookie-header.py @@ -0,0 +1,19 @@ +def main(request, response): + script = request.GET.first(b"script") + cookie_header = request.headers.get(b"Cookie", b"") + + body = b""" + + + Subframe with HTTP Cookies + + + + + + + """ % (cookie_header, script) + + return (200, [], body) -- cgit v1.2.3