From 188820aab13129552a1697b3d73e416c0325ad2b Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Mon, 16 Dec 2024 01:00:21 +0000 Subject: [PATCH] Bug 1936249 [wpt PR 49617] - Add WPT test for Document-Policy: expect-no-linked-resources, a=testonly Automatic update from web-platform-tests Add WPT test for Document-Policy: expect-no-linked-resources Add a tentative and optional test case for https://github.com/whatwg/html/pull/10718. -- wpt-commits: e2df4d406f762be154339148fe953629493c28c5 wpt-pr: 49617 UltraBlame original commit: b1a14a183e2577943fca32880cea619e42f2980f --- ...-speculative-fetch.tentative.optional.html | 331 ++++++++++++++++++ .../resources/no-speculative-fetch.sub.html | 93 +++++ .../no-speculative-fetch.sub.html.headers | 11 + .../resources/stash.py | 129 +++++++ 4 files changed, 564 insertions(+) create mode 100644 testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html create mode 100644 testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/no-speculative-fetch.sub.html create mode 100644 testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/no-speculative-fetch.sub.html.headers create mode 100644 testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/stash.py diff --git a/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html b/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html new file mode 100644 index 0000000000000..c35b4e7c83120 --- /dev/null +++ b/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html @@ -0,0 +1,331 @@ +< +! +DOCTYPE +html +> +< +meta +charset += +utf +- +8 +> +< +title +> +Speculative +parsing +expect +- +no +- +linked +- +resources +Document +- +Policy +< +/ +title +> +< +meta +name += +" +timeout +" +content += +" +long +" +> +< +script +src += +/ +resources +/ +testharness +. +js +> +< +/ +script +> +< +script +src += +/ +resources +/ +testharnessreport +. +js +> +< +/ +script +> +< +script +src += +" +/ +resources +/ +testdriver +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +resources +/ +testdriver +- +vendor +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +common +/ +utils +. +js +" +> +< +/ +script +> +< +script +> +async +function +get_results +( +uuid +) +{ +const +response += +await +fetch +( +/ +html +/ +syntax +/ +speculative +- +parsing +/ +expect +- +no +- +linked +- +resources +/ +resources +/ +stash +. +py +? +action += +get +& +uuid += +{ +uuid +} +) +; +return +await +response +. +text +( +) +; +} +promise_test +( +async +( +) += +> +{ +const +uuid += +token +( +) +; +await +test_driver +. +bless +( +' +Open +a +URL +with +expect +- +no +- +linked +- +resources +Document +- +Policy +' +) +; +const +popup += +window +. +open +( +/ +html +/ +syntax +/ +speculative +- +parsing +/ +expect +- +no +- +linked +- +resources +/ +resources +/ +no +- +speculative +- +fetch +. +sub +. +html +? +pipe += +sub +& +uuid += +{ +uuid +} +' +_blank +' +) +; +await +new +Promise +( +resolve += +> +popup +. +addEventListener +( +' +load +' +resolve +) +) +; +const +result += +await +get_results +( +uuid +) +; +assert_equals +( +result +' +' +' +speculative +case +fetched +' +) +; +} +expect +- +no +- +linked +- +resources +hint +was +ignored +) +; +< +/ +script +> diff --git a/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/no-speculative-fetch.sub.html b/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/no-speculative-fetch.sub.html new file mode 100644 index 0000000000000..3c86f3040438d --- /dev/null +++ b/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/no-speculative-fetch.sub.html @@ -0,0 +1,93 @@ +< +! +doctype +html +> +< +title +> +Navigating +to +a +page +with +expect +- +no +- +linked +- +resources +< +/ +title +> +< +body +> +< +script +> +document +. +write +( +' +< +plaintext +> +' +) +; +< +/ +script +> +< +img +src += +" +/ +html +/ +syntax +/ +speculative +- +parsing +/ +expect +- +no +- +linked +- +resources +/ +resources +/ +stash +. +py +? +action += +put +& +uuid += +{ +{ +GET +[ +uuid +] +} +} +" +> +< +/ +body +> diff --git a/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/no-speculative-fetch.sub.html.headers b/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/no-speculative-fetch.sub.html.headers new file mode 100644 index 0000000000000..c6d0e407813a8 --- /dev/null +++ b/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/no-speculative-fetch.sub.html.headers @@ -0,0 +1,11 @@ +Document +- +Policy +: +expect +- +no +- +linked +- +resources diff --git a/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/stash.py b/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/stash.py new file mode 100644 index 0000000000000..3e1bc6127e076 --- /dev/null +++ b/testing/web-platform/tests/html/syntax/speculative-parsing/expect-no-linked-resources/resources/stash.py @@ -0,0 +1,129 @@ +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