Truly independent web browser
Tests: Import Cross-Origin-Resource-Policy WPT tests
Shannon Booth53cfaf56bda6
diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.iniindex 9a063a124a5..edcbe2d5a0a 100644--- a/Tests/LibWeb/TestConfig.ini+++ b/Tests/LibWeb/TestConfig.ini@@ -1,4 +1,9 @@[LoadFromHttpServer]+Text/input/wpt-import/fetch/cross-origin-resource-policy/fetch-in-iframe.html+Text/input/wpt-import/fetch/cross-origin-resource-policy/iframe-loads.html+Text/input/wpt-import/fetch/cross-origin-resource-policy/image-loads.html+Text/input/wpt-import/fetch/cross-origin-resource-policy/script-loads.html+Text/input/wpt-import/fetch/cross-origin-resource-policy/syntax.any.htmlText/input/wpt-import/dom/events/event-listener-not-fully-active-adopted-node.htmlText/input/wpt-import/dom/events/event-listener-not-fully-active-navigated.htmlCrash/DOM/shared-resource-request-finalize-while-in-flight.htmldiff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/fetch-in-iframe.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/fetch-in-iframe.txtnew file mode 100644index 00000000000..9a1d017af8e--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/fetch-in-iframe.txt@@ -0,0 +1,10 @@+Harness status: OK++Found 5 tests++5 Pass+Pass Cross-origin fetch in a data: iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-origin' response header.+Pass Cross-origin fetch in a data: iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-site' response header.+Pass Cross-origin fetch in a cross origin iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-origin' response header.+Pass Cross-origin fetch in a cross origin iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-site' response header.+Pass Same-origin fetch in a cross origin iframe load succeeds if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-origin' response header.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/iframe-loads.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/iframe-loads.txtnew file mode 100644index 00000000000..32f4295caf8--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/iframe-loads.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Pass+Pass Load an iframe that has Cross-Origin-Resource-Policy header\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/image-loads.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/image-loads.txtnew file mode 100644index 00000000000..0fbbb0936f6--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/image-loads.txt@@ -0,0 +1,12 @@+Harness status: OK++Found 6 tests++4 Pass+2 Fail+Pass Same-origin image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.+Pass Same-origin image load with a 'Cross-Origin-Resource-Policy: same-site' response header.+Pass Cross-origin cors image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.+Pass Cross-origin cors image load with a 'Cross-Origin-Resource-Policy: same-site' response header.+Fail Cross-origin no-cors image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.+Fail Cross-origin no-cors image load with a 'Cross-Origin-Resource-Policy: same-site' response header.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/script-loads.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/script-loads.txtnew file mode 100644index 00000000000..850e980b47b--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/script-loads.txt@@ -0,0 +1,11 @@+Harness status: OK++Found 6 tests++6 Pass+Pass Same-origin script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.+Pass Same-origin script load with a 'Cross-Origin-Resource-Policy: same-site' response header.+Pass Cross-origin cors script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.+Pass Cross-origin cors script load with a 'Cross-Origin-Resource-Policy: same-site' response header.+Pass Cross-origin no-cors script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.+Pass Cross-origin no-cors script load with a 'Cross-Origin-Resource-Policy: same-site' response header.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/syntax.any.txt b/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/syntax.any.txtnew file mode 100644index 00000000000..0a771397708--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/fetch/cross-origin-resource-policy/syntax.any.txt@@ -0,0 +1,12 @@+Harness status: OK++Found 7 tests++7 Pass+Pass Parsing Cross-Origin-Resource-Policy: same+Pass Parsing Cross-Origin-Resource-Policy: same, same-origin+Pass Parsing Cross-Origin-Resource-Policy: SAME-ORIGIN+Pass Parsing Cross-Origin-Resource-Policy: Same-Origin+Pass Parsing Cross-Origin-Resource-Policy: same-origin, <>+Pass Parsing Cross-Origin-Resource-Policy: same-origin, same-origin+Pass Parsing Cross-Origin-Resource-Policy: https://www.example.com\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/fetch-in-iframe.html b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/fetch-in-iframe.htmlnew file mode 100644index 00000000000..e27c99cf994--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/fetch-in-iframe.html@@ -0,0 +1,67 @@+<!DOCTYPE html>+<html>+<head>+ <script src="../../resources/testharness.js"></script>+ <script src="../../resources/testharnessreport.js"></script>+ <script src="../../common/get-host-info.sub.js"></script>+</head>+<body>+ <script>+const host = get_host_info();+const remoteBaseURL = host.HTTP_REMOTE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;+const notSameSiteBaseURL = host.HTTP_NOTSAMESITE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;+const localBaseURL = host.HTTP_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;++function with_iframe(url)+{+ return new Promise(function(resolve) {+ var frame = document.createElement('iframe');+ frame.src = url;+ frame.onload = function() { resolve(frame); };+ document.body.appendChild(frame);+ });+}++function loadIFrameAndFetch(iframeURL, fetchURL, expectedFetchResult, title)+{+ promise_test(async () => {+ const frame = await with_iframe(iframeURL);+ let receiveMessage;+ const promise = new Promise((resolve, reject) => {+ receiveMessage = (event) => {+ if (event.data !== expectedFetchResult) {+ reject("Received unexpected message " + event.data);+ return;+ }+ resolve();+ }+ window.addEventListener("message", receiveMessage, false);+ });+ frame.contentWindow.postMessage(fetchURL, "*");+ return promise.finally(() => {+ frame.remove();+ window.removeEventListener("message", receiveMessage, false);+ });+ }, title);+}++// This above data URL should be equivalent to resources/iframeFetch.html+var dataIFrameURL = "data:text/html;base64,PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KICAgIDxzY3JpcHQ+CiAgICAgICAgZnVuY3Rpb24gcHJvY2Vzc01lc3NhZ2UoZXZlbnQpCiAgICAgICAgewogICAgICAgICAgICBmZXRjaChldmVudC5kYXRhLCB7IG1vZGU6ICJuby1jb3JzIiB9KS50aGVuKCgpID0+IHsKICAgICAgICAgICAgICAgIHBhcmVudC5wb3N0TWVzc2FnZSgib2siLCAiKiIpOwogICAgICAgICAgICB9LCAoKSA9PiB7CiAgICAgICAgICAgICAgICBwYXJlbnQucG9zdE1lc3NhZ2UoImtvIiwgIioiKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIiwgcHJvY2Vzc01lc3NhZ2UsIGZhbHNlKTsKICAgIDwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PgogICAgPGgzPlRoZSBpZnJhbWUgbWFraW5nIGEgc2FtZSBvcmlnaW4gZmV0Y2ggY2FsbC48L2gzPgo8L2JvZHk+CjwvaHRtbD4K";++loadIFrameAndFetch(dataIFrameURL, localBaseURL + "resources/hello.py?corp=same-origin", "ko",+ "Cross-origin fetch in a data: iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-origin' response header.");++loadIFrameAndFetch(dataIFrameURL, localBaseURL + "resources/hello.py?corp=same-site", "ko",+ "Cross-origin fetch in a data: iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-site' response header.");++loadIFrameAndFetch(remoteBaseURL + "resources/iframeFetch.html", localBaseURL + "resources/hello.py?corp=same-origin", "ko",+ "Cross-origin fetch in a cross origin iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-origin' response header.");++loadIFrameAndFetch(notSameSiteBaseURL + "resources/iframeFetch.html", localBaseURL + "resources/hello.py?corp=same-site", "ko",+ "Cross-origin fetch in a cross origin iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-site' response header.");++loadIFrameAndFetch(remoteBaseURL + "resources/iframeFetch.html", remoteBaseURL + "resources/hello.py?corp=same-origin", "ok",+ "Same-origin fetch in a cross origin iframe load succeeds if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-origin' response header.");+ </script>+</body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/iframe-loads.html b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/iframe-loads.htmlnew file mode 100644index 00000000000..913e5099ad3--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/iframe-loads.html@@ -0,0 +1,46 @@+<!DOCTYPE html>+<html>+<head>+ <script src="../../resources/testharness.js"></script>+ <script src="../../resources/testharnessreport.js"></script>+ <script src="../../common/get-host-info.sub.js"></script>+</head>+<body>+ <script>+const host = get_host_info();+const remoteBaseURL = host.HTTP_REMOTE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;+const localBaseURL = host.HTTP_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;++function with_iframe(url) {+ return new Promise(function(resolve) {+ var frame = document.createElement('iframe');+ frame.src = url;+ frame.onload = function() { resolve(frame); };+ document.body.appendChild(frame);+ });+}++promise_test(async() => {+ const url = remoteBaseURL + "resources/iframe.py?corp=same-origin";++ await new Promise((resolve, reject) => {+ return fetch(url, { mode: "no-cors" }).then(reject, resolve);+ });++ const iframe = await with_iframe(url);+ return new Promise((resolve, reject) => {+ window.addEventListener("message", (event) => {+ if (event.data !== "pong") {+ reject(event.data);+ return;+ }+ resolve();+ }, false);+ iframe.contentWindow.postMessage("ping", "*");+ }).finally(() => {+ iframe.remove();+ });+}, "Load an iframe that has Cross-Origin-Resource-Policy header");+ </script>+</body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/image-loads.html b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/image-loads.htmlnew file mode 100644index 00000000000..96e2123f4f1--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/image-loads.html@@ -0,0 +1,54 @@+<!DOCTYPE html>+<html>+<head>+ <script src="../../resources/testharness.js"></script>+ <script src="../../resources/testharnessreport.js"></script>+ <script src="../../common/get-host-info.sub.js"></script>+</head>+<body>+ <div id="testDiv"></div>+ <script>+const host = get_host_info();+const notSameSiteBaseURL = host.HTTP_NOTSAMESITE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;+const ok = true;+const ko = false;+const noCors = false;++function loadImage(url, shoudLoad, corsMode, title)+{+ const testDiv = document.getElementById("testDiv");+ promise_test(() => {+ const img = new Image();+ if (corsMode)+ img.crossOrigin = corsMode;+ img.src = url;+ return new Promise((resolve, reject) => {+ img.onload = shoudLoad ? resolve : reject;+ img.onerror = shoudLoad ? reject : resolve;+ testDiv.appendChild(img);+ }).finally(() => {+ testDiv.innerHTML = "";+ });+ }, title);+}++loadImage("./resources/image.py?corp=same-origin", ok, noCors,+ "Same-origin image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");++loadImage("./resources/image.py?corp=same-site", ok, noCors,+ "Same-origin image load with a 'Cross-Origin-Resource-Policy: same-site' response header.");++loadImage(notSameSiteBaseURL + "resources/image.py?corp=same-origin&acao=*", ok, "anonymous",+ "Cross-origin cors image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");++loadImage(notSameSiteBaseURL + "resources/image.py?corp=same-site&acao=*", ok, "anonymous",+ "Cross-origin cors image load with a 'Cross-Origin-Resource-Policy: same-site' response header.");++loadImage(notSameSiteBaseURL + "resources/image.py?corp=same-origin&acao=*", ko, noCors,+ "Cross-origin no-cors image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");++loadImage(notSameSiteBaseURL + "resources/image.py?corp=same-site&acao=*", ko, noCors,+ "Cross-origin no-cors image load with a 'Cross-Origin-Resource-Policy: same-site' response header.");+ </script>+</body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/green.png b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/green.pngnew file mode 100644index 00000000000..28a1faab377Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/green.png differdiff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/hello.py b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/hello.pynew file mode 100644index 00000000000..2b1cb84bad2--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/hello.py@@ -0,0 +1,6 @@+def main(request, response):+ headers = [(b"Cross-Origin-Resource-Policy", request.GET[b'corp'])]+ if b'origin' in request.headers:+ headers.append((b'Access-Control-Allow-Origin', request.headers[b'origin']))++ return 200, headers, b"hello"diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/iframe.py b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/iframe.pynew file mode 100644index 00000000000..815ecf5927c--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/iframe.py@@ -0,0 +1,5 @@+def main(request, response):+ headers = [(b"Content-Type", b"text/html"),+ (b"Cross-Origin-Resource-Policy", request.GET[b'corp'])]+ return 200, headers, b"<body><h3>The iframe</h3><script>window.onmessage = () => { parent.postMessage('pong', '*'); }</script></body>"+diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/iframeFetch.html b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/iframeFetch.htmlnew file mode 100644index 00000000000..257185805d9--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/iframeFetch.html@@ -0,0 +1,19 @@+<!DOCTYPE html>+<html>+<head>+ <script>+ function processMessage(event)+ {+ fetch(event.data, { mode: "no-cors" }).then(() => {+ parent.postMessage("ok", "*");+ }, () => {+ parent.postMessage("ko", "*");+ });+ }+ window.addEventListener("message", processMessage, false);+ </script>+</head>+<body>+ <h3>The iframe making a same origin fetch call.</h3>+</body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/image.py b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/image.pynew file mode 100644index 00000000000..2a779cf11bf--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/image.py@@ -0,0 +1,22 @@+import os.path++from wptserve.utils import isomorphic_decode++def main(request, response):+ type = request.GET.first(b"type", None)++ body = open(os.path.join(os.path.dirname(isomorphic_decode(__file__)), u"green.png"), u"rb").read()++ response.add_required_headers = False+ response.writer.write_status(200)++ if b'corp' in request.GET:+ response.writer.write_header(b"cross-origin-resource-policy", request.GET[b'corp'])+ if b'acao' in request.GET:+ response.writer.write_header(b"access-control-allow-origin", request.GET[b'acao'])+ response.writer.write_header(b"content-length", len(body))+ if(type != None):+ response.writer.write_header(b"content-type", type)+ response.writer.end_headers()++ response.writer.write(body)diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/redirect.py b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/redirect.pynew file mode 100644index 00000000000..0dad4dd923b--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/redirect.py@@ -0,0 +1,6 @@+def main(request, response):+ headers = [(b"Location", request.GET[b'redirectTo'])]+ if b'corp' in request.GET:+ headers.append((b'Cross-Origin-Resource-Policy', request.GET[b'corp']))++ return 302, headers, b""diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/script.py b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/script.pynew file mode 100644index 00000000000..58f8d341547--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/resources/script.py@@ -0,0 +1,6 @@+def main(request, response):+ headers = [(b"Cross-Origin-Resource-Policy", request.GET[b'corp'])]+ if b'origin' in request.headers:+ headers.append((b'Access-Control-Allow-Origin', request.headers[b'origin']))++ return 200, headers, b""diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/script-loads.html b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/script-loads.htmlnew file mode 100644index 00000000000..a5e1750acff--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/script-loads.html@@ -0,0 +1,52 @@+<!DOCTYPE html>+<html>+<head>+ <script src="../../resources/testharness.js"></script>+ <script src="../../resources/testharnessreport.js"></script>+ <script src="../../common/get-host-info.sub.js"></script>+</head>+<body>+ <div id="testDiv"></div>+ <script>+const host = get_host_info();+const notSameSiteBaseURL = host.HTTP_NOTSAMESITE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;+const ok = true;+const ko = false;+const noCors = false;++function loadScript(url, shoudLoad, corsMode, title)+{+ const testDiv = document.getElementById("testDiv");+ promise_test(() => {+ const script = document.createElement("script");+ if (corsMode)+ script.crossOrigin = corsMode;+ script.src = url;+ return new Promise((resolve, reject) => {+ script.onload = shoudLoad ? resolve : reject;+ script.onerror = shoudLoad ? reject : resolve;+ testDiv.appendChild(script);+ });+ }, title);+}++loadScript("./resources/script.py?corp=same-origin", ok, noCors,+ "Same-origin script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");++loadScript("./resources/script.py?corp=same-site", ok, noCors,+ "Same-origin script load with a 'Cross-Origin-Resource-Policy: same-site' response header.");++loadScript(notSameSiteBaseURL + "resources/script.py?corp=same-origin&acao=*", ok, "anonymous",+ "Cross-origin cors script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");++loadScript(notSameSiteBaseURL + "resources/script.py?corp=same-site&acao=*", ok, "anonymous",+ "Cross-origin cors script load with a 'Cross-Origin-Resource-Policy: same-site' response header.");++loadScript(notSameSiteBaseURL + "resources/script.py?corp=same-origin&acao=*", ko, noCors,+ "Cross-origin no-cors script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");++loadScript(notSameSiteBaseURL + "resources/script.py?corp=same-site&acao=*", ko, noCors,+ "Cross-origin no-cors script load with a 'Cross-Origin-Resource-Policy: same-site' response header.");+ </script>+</body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/syntax.any.html b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/syntax.any.htmlnew file mode 100644index 00000000000..12d815742db--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/syntax.any.html@@ -0,0 +1,15 @@+<!doctype html>+<meta charset=utf-8>++<script>+self.GLOBAL = {+ isWindow: function() { return true; },+ isWorker: function() { return false; },+ isShadowRealm: function() { return false; },+};+</script>+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<script src="../../common/get-host-info.sub.js"></script>+<div id=log></div>+<script src="../../fetch/cross-origin-resource-policy/syntax.any.js"></script>diff --git a/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/syntax.any.js b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/syntax.any.jsnew file mode 100644index 00000000000..dc874977a63--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/fetch/cross-origin-resource-policy/syntax.any.js@@ -0,0 +1,19 @@+// META: script=/common/get-host-info.sub.js++const crossOriginURL = get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/cross-origin-resource-policy/resources/hello.py?corp=";++[+ "same",+ "same, same-origin",+ "SAME-ORIGIN",+ "Same-Origin",+ "same-origin, <>",+ "same-origin, same-origin",+ "https://www.example.com", // See https://github.com/whatwg/fetch/issues/760+].forEach(incorrectHeaderValue => {+ // Note: an incorrect value results in a successful load, so this test is only meaningful in+ // implementations with support for the header.+ promise_test(t => {+ return fetch(crossOriginURL + encodeURIComponent(incorrectHeaderValue), { mode: "no-cors" });+ }, "Parsing Cross-Origin-Resource-Policy: " + incorrectHeaderValue);+});