diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index f580b5892778d..b87755c1964c0 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -274865,6 +274865,41 @@ {} ] ], + "fetch/cross-origin-resource-policy/resources/green.png": [ + [ + {} + ] + ], + "fetch/cross-origin-resource-policy/resources/hello.py": [ + [ + {} + ] + ], + "fetch/cross-origin-resource-policy/resources/iframe.py": [ + [ + {} + ] + ], + "fetch/cross-origin-resource-policy/resources/iframeFetch.html": [ + [ + {} + ] + ], + "fetch/cross-origin-resource-policy/resources/image.py": [ + [ + {} + ] + ], + "fetch/cross-origin-resource-policy/resources/redirect.py": [ + [ + {} + ] + ], + "fetch/cross-origin-resource-policy/resources/script.py": [ + [ + {} + ] + ], "fetch/data-urls/README.md": [ [ {} @@ -338884,6 +338919,36 @@ {} ] ], + "fetch/cross-origin-resource-policy/fetch-in-iframe.html": [ + [ + "/fetch/cross-origin-resource-policy/fetch-in-iframe.html", + {} + ] + ], + "fetch/cross-origin-resource-policy/fetch.html": [ + [ + "/fetch/cross-origin-resource-policy/fetch.html", + {} + ] + ], + "fetch/cross-origin-resource-policy/iframe-loads.html": [ + [ + "/fetch/cross-origin-resource-policy/iframe-loads.html", + {} + ] + ], + "fetch/cross-origin-resource-policy/image-loads.html": [ + [ + "/fetch/cross-origin-resource-policy/image-loads.html", + {} + ] + ], + "fetch/cross-origin-resource-policy/script-loads.html": [ + [ + "/fetch/cross-origin-resource-policy/script-loads.html", + {} + ] + ], "fetch/data-urls/base64.any.js": [ [ "/fetch/data-urls/base64.any.html", @@ -418318,7 +418383,7 @@ "support" ], "common/get-host-info.sub.js": [ - "4175d0fff3555e25a646b0673a082fefdc113fe0", + "1eae4a7e29b73d60b9832ef5d8c808f6fd10db5c", "support" ], "common/get-host-info.sub.js.headers": [ @@ -569125,6 +569190,54 @@ "465d933f4e52ef4e5a4bd0de40873410195843cd", "testharness" ], + "fetch/cross-origin-resource-policy/fetch-in-iframe.html": [ + "4d836bed1e90a2d14b1651c0f3229b3f3d0b6b91", + "testharness" + ], + "fetch/cross-origin-resource-policy/fetch.html": [ + "6a881615d9df0750b640298725be56e60cd5804c", + "testharness" + ], + "fetch/cross-origin-resource-policy/iframe-loads.html": [ + "8429fdb1695fc73c853dc37bf29544b8139d5396", + "testharness" + ], + "fetch/cross-origin-resource-policy/image-loads.html": [ + "6e81ede4b474b2516ec735d4d8f99694b4124773", + "testharness" + ], + "fetch/cross-origin-resource-policy/resources/green.png": [ + "ef91d21307a12b2cfaf33a90dffe16aa1cba42c9", + "support" + ], + "fetch/cross-origin-resource-policy/resources/hello.py": [ + "0d8e30350c97fd6a040b14348929cf7e87e0e406", + "support" + ], + "fetch/cross-origin-resource-policy/resources/iframe.py": [ + "d8f4af86d37d2f257b4166a1f7d3001d55eeda69", + "support" + ], + "fetch/cross-origin-resource-policy/resources/iframeFetch.html": [ + "d66a9c958288a97469e8cfa75eba973e9f35e190", + "support" + ], + "fetch/cross-origin-resource-policy/resources/image.py": [ + "72f4bbf045fbb61623246d44b763bd06024c0f63", + "support" + ], + "fetch/cross-origin-resource-policy/resources/redirect.py": [ + "eb237d6f61e042db8454efad97a7ca58ea90eba9", + "support" + ], + "fetch/cross-origin-resource-policy/resources/script.py": [ + "330a0ae1420b41e63bd639fa24f75e64e4528bcc", + "support" + ], + "fetch/cross-origin-resource-policy/script-loads.html": [ + "cd28267293f2d20ee78d6b946fe6b8793edf1bae", + "testharness" + ], "fetch/data-urls/README.md": [ "868cb170fa0c5626008fef77e37dee16e76b10d5", "support" diff --git a/testing/web-platform/tests/common/get-host-info.sub.js b/testing/web-platform/tests/common/get-host-info.sub.js index 58ef01c345f75..48ac19cbd08f5 100644 --- a/testing/web-platform/tests/common/get-host-info.sub.js +++ b/testing/web-platform/tests/common/get-host-info.sub.js @@ -6,6 +6,7 @@ function get_host_info() { var ORIGINAL_HOST = '{{host}}'; var REMOTE_HOST = (ORIGINAL_HOST === 'localhost') ? '127.0.0.1' : ('www1.' + ORIGINAL_HOST); var OTHER_HOST = '{{domains[www2]}}'; + var NOTSAMESITE_HOST = (ORIGINAL_HOST === 'localhost') ? '127.0.0.1' : ('not-' + ORIGINAL_HOST); return { HTTP_PORT: HTTP_PORT, @@ -19,6 +20,7 @@ function get_host_info() { HTTPS_ORIGIN_WITH_CREDS: 'https://foo:bar@' + ORIGINAL_HOST + ':' + HTTPS_PORT, HTTP_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + ORIGINAL_HOST + ':' + HTTP_PORT2, HTTP_REMOTE_ORIGIN: 'http://' + REMOTE_HOST + ':' + HTTP_PORT, + HTTP_NOTSAMESITE_ORIGIN: 'http://' + NOTSAMESITE_HOST + ':' + HTTP_PORT, HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + REMOTE_HOST + ':' + HTTP_PORT2, HTTPS_REMOTE_ORIGIN: 'https://' + REMOTE_HOST + ':' + HTTPS_PORT, HTTPS_REMOTE_ORIGIN_WITH_CREDS: 'https://foo:bar@' + REMOTE_HOST + ':' + HTTPS_PORT, diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/fetch-in-iframe.html b/testing/web-platform/tests/fetch/cross-origin-resource-policy/fetch-in-iframe.html new file mode 100644 index 0000000000000..cc6a3a81bcf4c --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/fetch-in-iframe.html @@ -0,0 +1,67 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/fetch.html b/testing/web-platform/tests/fetch/cross-origin-resource-policy/fetch.html new file mode 100644 index 0000000000000..7cf8d60050aa7 --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/fetch.html @@ -0,0 +1,83 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/iframe-loads.html b/testing/web-platform/tests/fetch/cross-origin-resource-policy/iframe-loads.html new file mode 100644 index 0000000000000..63902c302b7ce --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/iframe-loads.html @@ -0,0 +1,46 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/image-loads.html b/testing/web-platform/tests/fetch/cross-origin-resource-policy/image-loads.html new file mode 100644 index 0000000000000..8a0458f107abd --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/image-loads.html @@ -0,0 +1,53 @@ + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/green.png b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/green.png new file mode 100644 index 0000000000000..28a1faab37797 Binary files /dev/null and b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/green.png differ diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/hello.py b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/hello.py new file mode 100644 index 0000000000000..2b7cb6c6fc9fa --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/hello.py @@ -0,0 +1,6 @@ +def main(request, response): + headers = [("Cross-Origin-Resource-Policy", request.GET['corp'])] + if 'origin' in request.headers: + headers.append(('Access-Control-Allow-Origin', request.headers['origin'])) + + return 200, headers, "hello" diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/iframe.py b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/iframe.py new file mode 100644 index 0000000000000..5872842c673ba --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/iframe.py @@ -0,0 +1,5 @@ +def main(request, response): + headers = [("Content-Type", "text/html"), + ("Cross-Origin-Resource-Policy", request.GET['corp'])] + return 200, headers, "

The iframe

" + diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/iframeFetch.html b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/iframeFetch.html new file mode 100644 index 0000000000000..257185805d96d --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/iframeFetch.html @@ -0,0 +1,19 @@ + + + + + + +

The iframe making a same origin fetch call.

+ + diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/image.py b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/image.py new file mode 100644 index 0000000000000..ba6198135a2aa --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/image.py @@ -0,0 +1,21 @@ +import os.path + +def main(request, response): + type = request.GET.first("type", None) + + body = open(os.path.join(os.path.dirname(__file__), "green.png"), "rb").read() + + response.add_required_headers = False + response.writer.write_status(200) + + if 'corp' in request.GET: + response.writer.write_header("cross-origin-resource-policy", request.GET['corp']) + if 'acao' in request.GET: + response.writer.write_header("access-control-allow-origin", request.GET['acao']) + response.writer.write_header("content-length", len(body)) + if(type != None): + response.writer.write_header("content-type", type) + response.writer.end_headers() + + response.writer.write(body) + diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/redirect.py b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/redirect.py new file mode 100644 index 0000000000000..73793b074272e --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/redirect.py @@ -0,0 +1,6 @@ +def main(request, response): + headers = [("Location", request.GET['redirectTo'])] + if 'corp' in request.GET: + headers.append(('Cross-Origin-Resource-Policy', request.GET['corp'])) + + return 302, headers, "" diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/script.py b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/script.py new file mode 100644 index 0000000000000..c9bd6b9c9ee86 --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/resources/script.py @@ -0,0 +1,6 @@ +def main(request, response): + headers = [("Cross-Origin-Resource-Policy", request.GET['corp'])] + if 'origin' in request.headers: + headers.append(('Access-Control-Allow-Origin', request.headers['origin'])) + + return 200, headers, "" diff --git a/testing/web-platform/tests/fetch/cross-origin-resource-policy/script-loads.html b/testing/web-platform/tests/fetch/cross-origin-resource-policy/script-loads.html new file mode 100644 index 0000000000000..5850e0109f18c --- /dev/null +++ b/testing/web-platform/tests/fetch/cross-origin-resource-policy/script-loads.html @@ -0,0 +1,51 @@ + + + + + + + + +
+ + +