From 81775b06b069a545412db64a45347ef263bcc5fa Mon Sep 17 00:00:00 2001 From: "Alex N. Jose" Date: Tue, 10 Dec 2024 16:50:31 +0530 Subject: [PATCH] Add WPT test for Document-Policy: expect-no-linked-resources This PR adds a tentative and optional test case for https://github.com/whatwg/html/pull/10718 --- ...-speculative-fetch.tentative.optional.html | 26 +++++++++++++++++++ ...culative-fetch.tentative.optional.sub.html | 10 +++++++ ...-fetch.tentative.optional.sub.html.headers | 1 + .../expect-no-linked-resources/stash.js | 6 +++++ .../expect-no-linked-resources/stash.py | 11 ++++++++ 5 files changed, 54 insertions(+) create mode 100644 html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html create mode 100644 html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html create mode 100644 html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html.headers create mode 100644 html/syntax/speculative-parsing/expect-no-linked-resources/stash.js create mode 100644 html/syntax/speculative-parsing/expect-no-linked-resources/stash.py diff --git a/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html b/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html new file mode 100644 index 00000000000000..479a06209a5cb8 --- /dev/null +++ b/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html @@ -0,0 +1,26 @@ + + +Speculative parsing, expect-no-linked-resources Document-Policy + + + + + + + + \ No newline at end of file diff --git a/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html b/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html new file mode 100644 index 00000000000000..15d4cddf2d0d27 --- /dev/null +++ b/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html @@ -0,0 +1,10 @@ + +Navigating to a page with expect-no-linked-resources + + + + + \ No newline at end of file diff --git a/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html.headers b/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html.headers new file mode 100644 index 00000000000000..ff1502d32fc24a --- /dev/null +++ b/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html.headers @@ -0,0 +1 @@ +Document-Policy: expect-no-linked-resources diff --git a/html/syntax/speculative-parsing/expect-no-linked-resources/stash.js b/html/syntax/speculative-parsing/expect-no-linked-resources/stash.js new file mode 100644 index 00000000000000..c7197555db3568 --- /dev/null +++ b/html/syntax/speculative-parsing/expect-no-linked-resources/stash.js @@ -0,0 +1,6 @@ +// Fetch test results from the Stash +async function get_results(uuid) { + const response = await fetch(`/html/syntax/speculative-parsing/expect-no-linked-resources/stash.py?action=get&uuid=${uuid}`); + const text = await response.text(); + return text; +} \ No newline at end of file diff --git a/html/syntax/speculative-parsing/expect-no-linked-resources/stash.py b/html/syntax/speculative-parsing/expect-no-linked-resources/stash.py new file mode 100644 index 00000000000000..73e1f3abe5ecee --- /dev/null +++ b/html/syntax/speculative-parsing/expect-no-linked-resources/stash.py @@ -0,0 +1,11 @@ +import time + +def main(request, response): + if request.GET[b"action"] == b"put": + # Received result data from target page + request.server.stash.put(request.GET[b"uuid"], request.GET[b"uuid"], u'/expect-no-linked-resources/') + return u"ok" + else: + # Request for result data from test page + value = request.server.stash.take(request.GET[b"uuid"], u'/expect-no-linked-resources/') + return value