Truly independent web browser
Tests/LibWeb: Let the HTTP server substitute imported .sub tests
Jelle Raaijmakersd4142f13da8f
diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.iniindex d1e25a1ea41..523da840abc 100644--- a/Tests/LibWeb/TestConfig.ini+++ b/Tests/LibWeb/TestConfig.ini@@ -1127,6 +1127,16 @@ Text/input/wpt-import/sanitizer-api/sethtml-safety.htmlText/input/wpt-import/sanitizer-api/sethtml-tree-construction.htmlText/input/wpt-import/sanitizer-api/sethtmlunsafe-toplevel-template-script.html+; The fullscreen tests are .sub.html templates, which the HTTP server substitutes.+Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html+Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.html+Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen-timing.sub.html+Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.html+Text/input/wpt-import/fullscreen/api/element-ready-check-allowed-cross-origin.sub.html+Text/input/wpt-import/fullscreen/api/element-ready-check-not-allowed-cross-origin.sub.html+Text/input/wpt-import/fullscreen/api/element-request-fullscreen-cross-origin.sub.html+Text/input/wpt-import/fullscreen/api/navigate-iframe.sub.html+[CapFrameRate]; Ends a smooth scroll once 20 frames see no change, which frames faster than the compositor's ticks doText/input/wpt-import/css/cssom-view/scroll-behavior-default-css.html@@ -1355,23 +1365,19 @@ Text/input/keyboard-scroll-cursor-into-view.html; https://github.com/LadybirdBrowser/ladybird/issues/8151Text/input/wpt-import/fullscreen/rendering/fullscreen-root-block-scroll.html-; Timing out Fullscreen tests, a lot of them caused by http(s) mixed content blocking.-Text/input/wpt-import/fullscreen/api/navigate-iframe.sub.html-Text/input/wpt-import/fullscreen/api/element-ready-check-allowed-cross-origin.sub.html-Text/input/wpt-import/fullscreen/api/element-request-fullscreen-cross-origin.sub.html-Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen-timing.sub.html-Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html-Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.html-Text/input/wpt-import/fullscreen/api/element-request-fullscreen-and-remove-iframe.html-Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.html-Ref/input/wpt-import/fullscreen/rendering/exit-fullscreen-scroll-to-unscrollable-area-overflow-x-hidden.html-Ref/input/wpt-import/fullscreen/rendering/fullscreen-root-fills-page.html-Ref/input/wpt-import/fullscreen/rendering/backdrop-object.html+; Timing out Fullscreen testsRef/input/wpt-import/fullscreen/rendering/backdrop-iframe.htmlRef/input/wpt-import/fullscreen/rendering/backdrop-inherit.html+Ref/input/wpt-import/fullscreen/rendering/backdrop-object.htmlRef/input/wpt-import/fullscreen/rendering/exit-fullscreen-scroll-to-unscrollable-area-overflow-hidden.html+Ref/input/wpt-import/fullscreen/rendering/exit-fullscreen-scroll-to-unscrollable-area-overflow-x-hidden.html+Ref/input/wpt-import/fullscreen/rendering/fullscreen-root-fills-page.html+Text/input/wpt-import/fullscreen/api/element-request-fullscreen-cross-origin.sub.html++; Fullscreen tests that no longer time out, but without an identified fixCrash/wpt-import/fullscreen/crashtests/chrome-1312699.htmlCrash/wpt-import/fullscreen/crashtests/content-visibility-crash.html+Text/input/wpt-import/fullscreen/api/element-request-fullscreen-and-remove-iframe.html; Requires ladybird to cancel pending javascript navigations in form submission, see: https://github.com/whatwg/html/issues/12120Text/input/wpt-import/html/semantics/forms/form-submission-0/jsurl-navigation-then-form-submit.html@@ -1408,14 +1414,3 @@ Text/input/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-target.htm; Flaky due to performing a lot of fetches, and us not cleaning up sockets fast enough.; https://github.com/LadybirdBrowser/ladybird/issues/11033Text/input/wpt-import/scroll-to-text-fragment/redirects.html--; Cross-origin iframe to wpt.live gets blocked.-Text/input/wpt-import/scroll-to-text-fragment/iframes.sub.html--; The test hardcodes www.not-wpt.live, which the LibWeb test server cannot route locally.-Text/input/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.html--; These tests hardcode external wpt.live origins that the local test server cannot route.-Text/input/wpt-import/fetch/api/basic/integrity.sub.any.html-Text/input/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.html-Text/input/wpt-import/fetch/api/basic/integrity.sub.any.worker.htmldiff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.txtindex 1bafd930966..c579e929a9e 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.sharedworker.txt@@ -2,8 +2,8 @@ Harness status: OKFound 18 tests-16 Pass-2 Fail+17 Pass+1 FailPass Empty string integrityPass SHA-256 integrityPass SHA-384 integrity@@ -17,8 +17,8 @@ Pass Multiple integrities: invalid stronger than validPass Multiple integrities: invalid as strong as validPass Multiple integrities: both are validPass Multiple integrities: both are invalid-Fail CORS empty integrity-Fail CORS SHA-512 integrity+Pass CORS empty integrity+Pass CORS SHA-512 integrityPass CORS invalid integrity-Pass Empty string integrity for opaque response+Fail Empty string integrity for opaque responsePass SHA-* integrity for opaque response\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.txtindex 1bafd930966..c579e929a9e 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.txt@@ -2,8 +2,8 @@ Harness status: OKFound 18 tests-16 Pass-2 Fail+17 Pass+1 FailPass Empty string integrityPass SHA-256 integrityPass SHA-384 integrity@@ -17,8 +17,8 @@ Pass Multiple integrities: invalid stronger than validPass Multiple integrities: invalid as strong as validPass Multiple integrities: both are validPass Multiple integrities: both are invalid-Fail CORS empty integrity-Fail CORS SHA-512 integrity+Pass CORS empty integrity+Pass CORS SHA-512 integrityPass CORS invalid integrity-Pass Empty string integrity for opaque response+Fail Empty string integrity for opaque responsePass SHA-* integrity for opaque response\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.worker.txtindex 1bafd930966..c579e929a9e 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/api/basic/integrity.sub.any.worker.txt@@ -2,8 +2,8 @@ Harness status: OKFound 18 tests-16 Pass-2 Fail+17 Pass+1 FailPass Empty string integrityPass SHA-256 integrityPass SHA-384 integrity@@ -17,8 +17,8 @@ Pass Multiple integrities: invalid stronger than validPass Multiple integrities: invalid as strong as validPass Multiple integrities: both are validPass Multiple integrities: both are invalid-Fail CORS empty integrity-Fail CORS SHA-512 integrity+Pass CORS empty integrity+Pass CORS SHA-512 integrityPass CORS invalid integrity-Pass Empty string integrity for opaque response+Fail Empty string integrity for opaque responsePass SHA-* integrity for opaque response\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.txtindex e69de29bb2d..82491c64b7f 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.txt@@ -0,0 +1,9 @@+Harness status: OK++Found 4 tests++4 Pass+Pass Fullscreen enabled test: same-origin-default+Pass Fullscreen enabled test: same-origin-allow+Pass Fullscreen enabled test: cross-origin-default+Pass Fullscreen enabled test: cross-origin-allow\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.txtindex e69de29bb2d..668ef821aa2 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 1 tests++1 Fail+Fail+ Document#fullscreenEnabled removing allowfullscreen after load and then+ navigatingdiff --git a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen-timing.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen-timing.sub.txtindex e69de29bb2d..69f40477140 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen-timing.sub.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen-timing.sub.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Document#fullscreenEnabled setting allowfullscreen after document creation, before response\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.txtindex e69de29bb2d..9ef69638b8c 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Document#fullscreenEnabled setting allowfullscreen after load and then navigating\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/element-ready-check-allowed-cross-origin.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/element-ready-check-allowed-cross-origin.sub.txtindex e69de29bb2d..107d9888687 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/element-ready-check-allowed-cross-origin.sub.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/element-ready-check-allowed-cross-origin.sub.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Element ready check with allowfullscreen attribute\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/element-ready-check-not-allowed-cross-origin.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/element-ready-check-not-allowed-cross-origin.sub.txtindex d6a33ae658a..f778c737b17 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/element-ready-check-not-allowed-cross-origin.sub.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/element-ready-check-not-allowed-cross-origin.sub.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Cross-origin element ready check with no allowfullscreen or allow attribute\ No newline at end of file+1 Pass+Pass Cross-origin element ready check with no allowfullscreen or allow attribute\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/navigate-iframe.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/navigate-iframe.sub.txtindex e69de29bb2d..946bc6e724e 100644--- a/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/navigate-iframe.sub.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/fullscreen/api/navigate-iframe.sub.txt@@ -0,0 +1,11 @@+Harness status: OK++Found 5 tests++4 Pass+1 Fail+Pass same_to_cross+Pass cross_to_same+Pass same_to_same+Pass cross_to_cross+Fail allowed_cross_to_same\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/scroll-to-text-fragment/iframes.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/scroll-to-text-fragment/iframes.sub.txtindex e69de29bb2d..969caf17dd2 100644--- a/Tests/LibWeb/Text/expected/wpt-import/scroll-to-text-fragment/iframes.sub.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/scroll-to-text-fragment/iframes.sub.txt@@ -0,0 +1,11 @@+Harness status: OK++Found 5 tests++4 Pass+1 Fail+Pass Text fragment specified in iframe.src+Fail Navigate same-origin iframe via window.location+Pass Navigate cross-origin iframe via window.location+Pass Non-matching text with element-id fallback+Pass Cross-origin with element-id fallback\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.txtindex 49e17325df1..7c49eb90cb3 100644--- a/Tests/LibWeb/Text/expected/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.txt@@ -2,9 +2,10 @@ Harness status: OKFound 5 tests-5 Fail-Fail Test that a text fragment directive requires a user activation (user_activation=true).+4 Pass+1 Fail+Pass Test that a text fragment directive requires a user activation (user_activation=true).Fail Test that a text fragment directive requires a user activation (user_activation=false).-Fail Test that a text fragment directive is not activated when there is a window opener (noopener=true).-Fail Test that a text fragment directive is not activated when there is a window opener (noopener=false).-Fail Test that a text fragment directive is not activated within an iframe.\ No newline at end of file+Pass Test that a text fragment directive is not activated when there is a window opener (noopener=true).+Pass Test that a text fragment directive is not activated when there is a window opener (noopener=false).+Pass Test that a text fragment directive is not activated within an iframe.\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.jsindex 0339a5c5f14..e3cfd1b2f6e 100644--- a/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.js+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/api/basic/integrity.sub.any.js@@ -37,8 +37,8 @@ const invalidSha512 = "sha512-oUceBRNxPxnY60g/VtPCj2syT4wo4EZh2CgYdWy9veW8+OsReTconst path = dirname(location.pathname) + RESOURCES_DIR + "top.txt";const url = path;const corsUrl =- `http://wpt.live:8000${path}?pipe=header(Access-Control-Allow-Origin,*)`;-const corsUrl2 = `https://wpt.live:443${path}`+ `http://{{host}}:{{ports[http][1]}}${path}?pipe=header(Access-Control-Allow-Origin,*)`;+const corsUrl2 = `https://{{host}}:{{ports[https][0]}}${path}`integrity("Empty string integrity", url, "", /* initRequestMode */ undefined,/* shouldPass */ true);diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.htmlindex 855dc2ed424..a49c2528964 100644--- a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html@@ -1,12 +1,12 @@<!DOCTYPE html><title>Document#fullscreenEnabled</title>-<script src="../../resources/testharness.js"></script>-<script src="../../resources/testharnessreport.js"></script>+<script src="/resources/testharness.js"></script>+<script src="/resources/testharnessreport.js"></script><div id="log"></div><iframe src="resources/report-fullscreen-enabled.html" name="same-origin-default"></iframe><iframe src="resources/report-fullscreen-enabled.html" allowfullscreen name="same-origin-allow"></iframe>-<iframe src="http://not-wpt.live:80/fullscreen/api/resources/report-fullscreen-enabled.html" name="cross-origin-default"></iframe>-<iframe src="http://not-wpt.live:8000/fullscreen/api/resources/report-fullscreen-enabled.html" allowfullscreen name="cross-origin-allow"></iframe>+<iframe src="http://{{hosts[alt][]}}:{{ports[http][0]}}/fullscreen/api/resources/report-fullscreen-enabled.html" name="cross-origin-default"></iframe>+<iframe src="http://{{hosts[alt][]}}:{{ports[http][1]}}/fullscreen/api/resources/report-fullscreen-enabled.html" allowfullscreen name="cross-origin-allow"></iframe><script>var expectations = {"same-origin-default": true,diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.htmlindex 1f084a5c7e8..687a4ff1e41 100644--- a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.html+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.html@@ -3,8 +3,8 @@Document#fullscreenEnabled removing allowfullscreen after load and thennavigating</title>-<script src="../../resources/testharness.js"></script>-<script src="../../resources/testharnessreport.js"></script>+<script src="/resources/testharness.js"></script>+<script src="/resources/testharnessreport.js"></script><div id="log"></div><iframe></iframe><script>@@ -35,7 +35,7 @@0,location.pathname.lastIndexOf("/") + 1);- iframe.src = `http://wpt.live:80${path}resources/echo-fullscreenEnabled.html`;+ iframe.src = `http://{{hosts[][]}}:{{ports[http][0]}}${path}resources/echo-fullscreenEnabled.html`;});assert_true(diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen-timing.sub.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen-timing.sub.htmlindex ab440f5f5fa..49d91c8501d 100644--- a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen-timing.sub.html+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen-timing.sub.html@@ -1,7 +1,7 @@<!DOCTYPE html><title>Document#fullscreenEnabled setting allowfullscreen after document creation, before response</title>-<script src="../../resources/testharness.js"></script>-<script src="../../resources/testharnessreport.js"></script>+<script src="/resources/testharness.js"></script>+<script src="/resources/testharnessreport.js"></script><div id="log"></div><script>// Set allowfullscreen attribute in a timeout after <iframe> has been inserted to the document.@@ -12,7 +12,7 @@ async_test((t) => {// no allowfullscreen attributeconst path = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);- iframe.src = "http://wpt.live:80" + path + "resources/echo-fullscreenEnabled.html?pipe=trickle(d1)";+ iframe.src = "http://{{hosts[][]}}:{{ports[http][0]}}" + path + "resources/echo-fullscreenEnabled.html?pipe=trickle(d1)";iframe.onload = t.step_func(() => {iframe.contentWindow.postMessage('What is document.fullscreenEnabled?', '*');});diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.htmlindex a33c426bee3..4894fa06633 100644--- a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.html+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.html@@ -1,7 +1,7 @@<!DOCTYPE html><title>Document#fullscreenEnabled setting allowfullscreen after load and then navigating</title>-<script src="../../resources/testharness.js"></script>-<script src="../../resources/testharnessreport.js"></script>+<script src="/resources/testharness.js"></script>+<script src="/resources/testharnessreport.js"></script><div id="log"></div><script>async_test((t) => {@@ -11,7 +11,7 @@ async_test((t) => {let i = 0;const path = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);- iframe.src = "http://wpt.live:80" + path + "resources/echo-fullscreenEnabled.html";+ iframe.src = "http://{{hosts[][]}}:{{ports[http][0]}}" + path + "resources/echo-fullscreenEnabled.html";iframe.onload = t.step_func(() => {if (i === 0) {iframe.allowFullscreen = true;diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-ready-check-allowed-cross-origin.sub.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-ready-check-allowed-cross-origin.sub.htmlindex ef3bca15189..84ff3fed318 100644--- a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-ready-check-allowed-cross-origin.sub.html+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-ready-check-allowed-cross-origin.sub.html@@ -1,9 +1,9 @@<!DOCTYPE html><title>Element ready check with allowfullscreen attribute</title>-<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="/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="../trusted-click.js"></script><iframe name="cross-origin-allowed" allowfullscreen></iframe><script>@@ -13,7 +13,7 @@await new Promise((resolve) => {iframe.onload = resolve;iframe.src =- "http://not-wpt.live:80/fullscreen/api/resources/attempt-fullscreen.html";+ "http://{{hosts[alt][]}}:{{ports[http][0]}}/fullscreen/api/resources/attempt-fullscreen.html";});// Activate the child frame.diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-ready-check-not-allowed-cross-origin.sub.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-ready-check-not-allowed-cross-origin.sub.htmlindex b655c22f467..00aaee7f2a3 100644--- a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-ready-check-not-allowed-cross-origin.sub.html+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-ready-check-not-allowed-cross-origin.sub.html@@ -1,9 +1,9 @@<!DOCTYPE html><title>Element ready check with no allowfullscreen attribute</title>-<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="/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="../trusted-click.js"></script><body><iframe name="cross-origin-default"></iframe>@@ -21,7 +21,7 @@await new Promise((resolve) => {iframe.onload = resolve;iframe.src =- "http://not-wpt.live:80/fullscreen/api/resources/attempt-fullscreen.html";+ "http://{{hosts[alt][]}}:{{ports[http][0]}}/fullscreen/api/resources/attempt-fullscreen.html";});// Trigger the child frame to report as soon as its content is loaded.await trusted_click();diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-request-fullscreen-cross-origin.sub.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-request-fullscreen-cross-origin.sub.htmlindex 41d98bb44d1..5f3a397bbc6 100644--- a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-request-fullscreen-cross-origin.sub.html+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/element-request-fullscreen-cross-origin.sub.html@@ -2,10 +2,10 @@<title>Element#requestFullscreen() works properly with a tree of cross-origin iframes</title>-<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="/resources/testharness.js"></script>+<script src="/resources/testharnessreport.js"></script>+<script src="/resources/testdriver.js"></script>+<script src="/resources/testdriver-vendor.js"></script><body><script>@@ -48,31 +48,31 @@const iframes = [{name: "A",- src: "http://wpt.live:80/fullscreen/api/resources/recursive-iframe-fullscreen.html?a",+ src: "http://{{hosts[][]}}:{{ports[http][0]}}/fullscreen/api/resources/recursive-iframe-fullscreen.html?a",allow_fullscreen: true,expectedEvents: ["fullscreenchange"],},{name: "B",- src: "http://wpt.live:8000/fullscreen/api/resources/recursive-iframe-fullscreen.html?b",+ src: "http://{{hosts[][]}}:{{ports[http][1]}}/fullscreen/api/resources/recursive-iframe-fullscreen.html?b",allow_fullscreen: true,expectedEvents: ["fullscreenchange"],},{name: "C",- src: "http://not-wpt.live:80/fullscreen/api/resources/recursive-iframe-fullscreen.html?c",+ src: "http://{{hosts[alt][]}}:{{ports[http][0]}}/fullscreen/api/resources/recursive-iframe-fullscreen.html?c",allow_fullscreen: true,expectedEvents: ["fullscreenchange"],},{name: "D",- src: "http://not-wpt.live:8000/fullscreen/api/resources/recursive-iframe-fullscreen.html?d",+ src: "http://{{hosts[alt][]}}:{{ports[http][1]}}/fullscreen/api/resources/recursive-iframe-fullscreen.html?d",allow_fullscreen: true,expectedEvents: ["fullscreenchange"],},{name: "E",- src: "http://wpt.live:80/fullscreen/api/resources/recursive-iframe-fullscreen.html?e",+ src: "http://{{hosts[][]}}:{{ports[http][0]}}/fullscreen/api/resources/recursive-iframe-fullscreen.html?e",allow_fullscreen: true,expectedEvents: [],},diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/navigate-iframe.sub.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/navigate-iframe.sub.htmlindex ce09c56ac79..9aa0e6908d1 100644--- a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/navigate-iframe.sub.html+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/navigate-iframe.sub.html@@ -3,8 +3,8 @@<head><title>Document#fullscreenEnabled</title><meta charset="UTF-8" />- <script src="../../resources/testharness.js"></script>- <script src="../../resources/testharnessreport.js"></script>+ <script src="/resources/testharness.js"></script>+ <script src="/resources/testharnessreport.js"></script></head><body><div id="log"></div>@@ -33,7 +33,7 @@ var expectations = {"cross_to_same": {allowlist: "", iframe_src: "cross", iframe_dest: "same", target_result: false},"same_to_same": {allowlist: "", iframe_src: "same", iframe_dest: "same", target_result: true},"cross_to_cross": {allowlist: "", iframe_src: "cross", iframe_dest: "cross", target_result: false},- "allowed_cross_to_same": {allowlist: "'self' http://not-wpt.live:80",+ "allowed_cross_to_same": {allowlist: "'self' http://{{hosts[alt][]}}:{{ports[http][0]}}",iframe_src: "cross", iframe_dest: "same", target_result: true},};@@ -49,8 +49,8 @@ for (const [test, {allowlist, iframe_src, iframe_dest, target_result}] of Objectiframe.contentWindow.postMessage({dest: iframe_dest}, "*");});- let hostname = iframe_src === "same" ? "wpt.live" : "not-wpt.live";- iframe.src = `http://${hostname}:80/fullscreen/api/resources/navigate.sub.html`;+ let hostname = iframe_src === "same" ? "{{hosts[][]}}" : "{{hosts[alt][]}}";+ iframe.src = `http://${hostname}:{{ports[http][0]}}/fullscreen/api/resources/navigate.sub.html`;window.addEventListener('message', e => {if (e.data.report?.api == "fullscreen") {diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/attempt-fullscreen.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/attempt-fullscreen.htmlnew file mode 100644index 00000000000..98cca045160--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/attempt-fullscreen.html@@ -0,0 +1,48 @@+<!DOCTYPE html>+<meta charset="utf-8" />+<title>IFrame Fullscreen API success reporter</title>+<body></body>+<script>+ window.addEventListener("message", async (e) => {+ switch (e.data.action) {+ case "report":+ await sendReport();+ break;+ default:+ parent.postMessage(+ {+ report: {+ api: "fullscreen",+ result: `Unknown action ${e.data.action}`,+ frame: window.name,+ },+ },+ "*"+ );+ }+ });++ async function sendReport() {+ let didSucceed = true;+ let error;+ let errorMessage;+ try {+ await document.body.requestFullscreen();+ } catch (e) {+ didSucceed = false;+ error = e.name;+ errorMessage = e.message;+ } finally {+ const data = {+ report: {+ api: "fullscreen",+ result: didSucceed,+ frame: window.name,+ error,+ errorMessage,+ },+ };+ parent.postMessage(data, "*");+ }+ }+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/echo-fullscreenEnabled.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/echo-fullscreenEnabled.htmlnew file mode 100644index 00000000000..ad5edf79866--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/echo-fullscreenEnabled.html@@ -0,0 +1,11 @@+<!doctype html>+<script>+window.onmessage = (e) => {+ if (e.data === 'What is document.fullscreenEnabled?') {+ e.source.postMessage(document.fullscreenEnabled, '*');+ } else {+ e.source.postMessage('Incorrect message', '*');+ }+}+</script>+<p>This page echos document.fullscreenEnabled.</p>diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/navigate.sub.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/navigate.sub.htmlnew file mode 100644index 00000000000..4630c2e1c5f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/navigate.sub.html@@ -0,0 +1,24 @@+<!DOCTYPE HTML>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <title>This page just redirects back to same-origin!</title>+ </head>+ <body>+ <h1>Redirect me away!</h1>+ <script>++ window.addEventListener("message", async (e) => {+ switch (e.data.dest) {+ case "same":+ window.location.replace("http://{{hosts[][]}}:{{ports[http][0]}}/fullscreen/api/resources/report-fullscreen-enabled.html")+ break;+ case "cross":+ window.location.replace("http://{{hosts[alt][]}}:{{ports[http][0]}}/fullscreen/api/resources/report-fullscreen-enabled.html")+ break;+ }+ });++ </script>+ </body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/recursive-iframe-fullscreen.html b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/recursive-iframe-fullscreen.htmlnew file mode 100644index 00000000000..d242a3b3e68--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fullscreen/api/resources/recursive-iframe-fullscreen.html@@ -0,0 +1,86 @@+<!DOCTYPE html>+<meta charset="utf-8" />+<title>Recursive IFrame Fullscreen API success reporter</title>+<body>+ <script src="/resources/testdriver.js"></script>+ <script src="/resources/testdriver-vendor.js"></script>+ <script src="../../trusted-click.js"></script>+ <script>+ let child_frame = null;+ const events = [];++ document.onfullscreenchange = () => {+ events.push("fullscreenchange");+ };++ document.onfullscreenerror = () => {+ events.push("fullscreenerror");+ };++ function send_report() {+ window.top.postMessage(+ {+ name: window.name,+ action: "report",+ report: {+ api: "fullscreen",+ frame: window.name,+ fullscreenElementIsNull: document.fullscreenElement === null,+ events,+ },+ },+ "*"+ );+ }++ async function create_child_frame({ src, name, allow_fullscreen }) {+ child_frame = document.createElement("iframe");+ child_frame.allow = allow_fullscreen ? "fullscreen" : "";+ child_frame.name = name;+ child_frame.style.width = "100%";+ child_frame.style.height = "100%";+ document.body.appendChild(child_frame);+ await new Promise((resolve) => {+ child_frame.addEventListener("load", resolve, { once: true });+ child_frame.src = src;+ });+ window.top.postMessage({ action: "load", name }, "*");+ }++ async function go_fullscreen() {+ await trusted_click(document.body);+ let error;+ try {+ await document.body.requestFullscreen();+ } catch (err) {+ error = err.name;+ } finally {+ window.top.postMessage(+ { action: "requestFullscreen", name: window.name, error },+ "*"+ );+ }+ }++ window.addEventListener("message", async (e) => {+ // Massage is not for us, try to pass it on...+ if (e.data.name !== window.name) {+ child_frame?.contentWindow.postMessage(e.data, "*");+ return;+ }+ switch (e.data.action) {+ case "requestReport":+ send_report();+ break;+ case "requestFullscreen":+ await go_fullscreen();+ break;+ case "addIframe":+ await create_child_frame(e.data.iframe);+ break;+ default:+ window.top.postMessage(e.data, "*");+ }+ });+ </script>+</body>diff --git a/Tests/LibWeb/Text/input/wpt-import/scroll-to-text-fragment/iframes.sub.html b/Tests/LibWeb/Text/input/wpt-import/scroll-to-text-fragment/iframes.sub.htmlindex c732572fe54..eb6594c2839 100644--- a/Tests/LibWeb/Text/input/wpt-import/scroll-to-text-fragment/iframes.sub.html+++ b/Tests/LibWeb/Text/input/wpt-import/scroll-to-text-fragment/iframes.sub.html@@ -3,8 +3,8 @@<meta charset=utf-8><meta name="timeout" content="long"><link rel="help" href="https://wicg.github.io/ScrollToTextFragment/">-<script src="../resources/testharness.js"></script>-<script src="../resources/testharnessreport.js"></script>+<script src="/resources/testharness.js"></script>+<script src="/resources/testharnessreport.js"></script><script>function getResult(iframe) {return new Promise((resolve) => {@@ -108,6 +108,6 @@</div><div>Cross-Origin:- <iframe id="crossorigin" src="http://www.wpt.live:80/scroll-to-text-fragment/iframe-target.html"></iframe>+ <iframe id="crossorigin" src="http://{{hosts[][www]}}:{{ports[http][0]}}/scroll-to-text-fragment/iframe-target.html"></iframe></div></body>diff --git a/Tests/LibWeb/Text/input/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.html b/Tests/LibWeb/Text/input/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.htmlindex 280d78087da..bac9c132e2f 100644--- a/Tests/LibWeb/Text/input/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.html+++ b/Tests/LibWeb/Text/input/wpt-import/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.html@@ -1,12 +1,13 @@<!doctype html><title>Navigating to a text fragment directive</title><meta charset=utf-8>+<meta name="timeout" content="long"><link rel="help" href="https://wicg.github.io/ScrollToTextFragment/">-<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 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 src="stash.js"></script><script>// Test security restriction for user activation@@ -34,7 +35,7 @@ for (let user_activation of [true, false]) {}), `Test that a text fragment directive requires a user activation (user_activation=${user_activation}).`);}-const crossOriginTarget = "http://www.not-wpt.live:80/scroll-to-text-fragment/scroll-to-text-fragment-target.html";+const crossOriginTarget = "http://{{hosts[alt][www]}}:{{ports[http][0]}}/scroll-to-text-fragment/scroll-to-text-fragment-target.html";// Test security restriction for no window openerfor (let noopener of [true, false]) {