From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/web-bundle/META.yml | 5 + testing/web-platform/tests/web-bundle/README.md | 10 + .../check-accept-header-and-return-bundle.py | 21 ++ .../resources/check-cookie-and-return-bundle.py | 29 ++ ...heck-sec-fetch-dest-header-and-return-bundle.py | 21 ++ .../tests/web-bundle/resources/corp.har | 140 +++++++++ .../web-bundle/resources/cross-origin-no-cors.har | 48 +++ .../tests/web-bundle/resources/cross-origin.har | 48 +++ .../resources/dynamic1/classic_script.js | 1 + .../web-bundle/resources/dynamic1/resource1.js | 1 + .../web-bundle/resources/dynamic1/resource2.js | 1 + .../web-bundle/resources/dynamic1/resource3.js | 1 + .../web-bundle/resources/dynamic1/resource4.js | 1 + .../resources/dynamic2/classic_script.js | 1 + .../web-bundle/resources/dynamic2/resource1.js | 1 + .../web-bundle/resources/dynamic2/resource2.js | 1 + .../web-bundle/resources/dynamic2/resource3.js | 1 + .../web-bundle/resources/dynamic2/resource4.js | 1 + .../web-bundle/resources/generate-test-wbns.sh | 105 +++++++ .../web-bundle/resources/location/location.html | 2 + .../web-bundle/resources/location/location.js | 2 + .../web-bundle/resources/nested/nested-sub.wbn | Bin 0 -> 3395 bytes .../tests/web-bundle/resources/nested/resource.js | 0 .../resources/non-utf8-query-encoding.har | 25 ++ .../resources/path-restriction/other/resource.js | 1 + .../resources/path-restriction/resource.js | 1 + .../resources/path-restriction/wbn-resource.js | 1 + .../resources/path-restriction/wbn/resource.js | 1 + .../resources/path-restriction/wbn/sub/resource.js | 1 + .../resources/path-restriction/wbn1/resource.js | 1 + .../tests/web-bundle/resources/relative-url.har | 139 +++++++++ .../web-bundle/resources/simple-cross-origin.har | 29 ++ .../static-element/out-of-scope/script.js | 1 + .../resources/static-element/resources/script.js | 1 + .../resources/style-imported-from-file.css | 3 + .../resources/style-imported-from-tag.css | 3 + .../resources/static-element/resources/style.css | 5 + .../resources/static-element/scopes/script.js | 1 + .../scopes/style-imported-from-file.css | 3 + .../scopes/style-imported-from-tag.css | 3 + .../resources/static-element/scopes/style.css | 5 + .../web-bundle/resources/subresource/fail.png | Bin 0 -> 759 bytes .../web-bundle/resources/subresource/pass.png | Bin 0 -> 1689 bytes .../tests/web-bundle/resources/subresource/root.js | 1 + .../web-bundle/resources/subresource/submodule.js | 1 + .../tests/web-bundle/resources/test-helpers.js | 122 ++++++++ .../tests/web-bundle/resources/uuid-in-package.har | 44 +++ .../tests/web-bundle/resources/wbn/__dir__.headers | 2 + .../resources/wbn/cors/__dir__.sub.headers | 4 + .../tests/web-bundle/resources/wbn/cors/corp.wbn | Bin 0 -> 1491 bytes .../resources/wbn/cors/cross-origin-b2.wbn | Bin 0 -> 423 bytes .../web-bundle/resources/wbn/cors/cross-origin.wbn | Bin 0 -> 423 bytes .../resources/wbn/dynamic/__dir__.headers | 1 + .../resources/wbn/dynamic/classic_script.js | 1 + .../web-bundle/resources/wbn/dynamic/resource1.js | 1 + .../web-bundle/resources/wbn/dynamic/resource2.js | 1 + .../web-bundle/resources/wbn/dynamic/resource3.js | 1 + .../web-bundle/resources/wbn/dynamic/resource4.js | 1 + .../resources/wbn/dynamic1-crossorigin.wbn | Bin 0 -> 1498 bytes .../tests/web-bundle/resources/wbn/dynamic1.wbn | Bin 0 -> 1473 bytes .../tests/web-bundle/resources/wbn/dynamic2.wbn | Bin 0 -> 1473 bytes .../tests/web-bundle/resources/wbn/location.wbn | Bin 0 -> 681 bytes .../tests/web-bundle/resources/wbn/nested-main.wbn | Bin 0 -> 3964 bytes .../resources/wbn/no-cors/__dir__.headers | 2 + .../resources/wbn/no-cors/cross-origin-b2.wbn | Bin 0 -> 429 bytes .../resources/wbn/no-cors/cross-origin.wbn | Bin 0 -> 429 bytes .../resources/wbn/non-utf8-query-encoding.wbn | Bin 0 -> 376 bytes .../web-bundle/resources/wbn/path-restriction.wbn | Bin 0 -> 1737 bytes .../web-bundle/resources/wbn/relative-url.wbn | Bin 0 -> 1093 bytes .../resources/wbn/relative-url.wbn.sub.headers | 3 + .../resources/wbn/simple-cross-origin.wbn | Bin 0 -> 246 bytes .../web-bundle/resources/wbn/static-element.wbn | Bin 0 -> 2940 bytes .../wbn/static-element/out-of-scope/script.js | 1 + .../wbn/static-element/resources/script.js | 1 + .../resources/style-imported-from-file.css | 3 + .../resources/style-imported-from-tag.css | 3 + .../wbn/static-element/resources/style.css | 5 + .../resources/wbn/static-element/scopes/script.js | 1 + .../scopes/style-imported-from-file.css | 3 + .../scopes/style-imported-from-tag.css | 3 + .../resources/wbn/static-element/scopes/style.css | 5 + .../tests/web-bundle/resources/wbn/subresource.wbn | Bin 0 -> 3395 bytes .../web-bundle/resources/wbn/uuid-in-package.wbn | Bin 0 -> 397 bytes .../accept-header.https.tentative.html | 22 ++ .../subresource-loading/coep.https.tentative.html | 127 ++++++++ .../coep.https.tentative.html.headers | 2 + .../subresource-loading/corp.https.tentative.html | 73 +++++ .../credentials.https.tentative.sub.html | 173 +++++++++++ .../csp-allowed.https.tentative.html | 89 ++++++ .../csp-blocked.https.tentative.html | 162 ++++++++++ .../csp-blocked.https.tentative.html.sub.headers | 6 + .../csp-blockes-bundle.https.tentative.html | 66 +++++ .../element-removal.https.tentative.html | 32 ++ .../invalid-json.https.tentative.html | 47 +++ .../nested-bundle.https.tentative.html | 36 +++ .../network-error.https.tentative.sub.html | 31 ++ .../not-found.https.tentative.html | 33 +++ .../path-restriction.https.tentative.html | 52 ++++ ...url-in-web-bundle-cors.https.tentative.sub.html | 60 ++++ ...relative-url-in-web-bundle.https.tentative.html | 60 ++++ .../relative-url-resources.https.tentative.html | 80 +++++ .../relative-url-scopes.https.tentative.html | 85 ++++++ ...elative-url-static-element.https.tentative.html | 34 +++ .../relative-url-with-base.https.tentative.html | 67 +++++ .../request-destination.https.tentative.sub.html | 49 +++ ...-attributes-consistent.https.tentative.sub.html | 88 ++++++ .../resource-timing.https.tentative.html | 55 ++++ .../resources/check-cookie-and-return-bundle.py | 25 ++ .../service-worker-controlled-iframe.html | 1 + .../service-worker-for-request-monitor.js | 12 + .../reuse-web-bundle-resource.https.tentative.html | 329 +++++++++++++++++++++ .../service-worker-controlled.https.tentative.html | 138 +++++++++ ...atic-element-with-base.https.tentative.sub.html | 65 ++++ .../static-element.https.tentative.sub.html | 68 +++++ .../subframe-from-web-bundle.https.tentative.html | 134 +++++++++ .../subresource-load.https.tentative.sub.html | 294 ++++++++++++++++++ .../supports-webbundle.https.tentative.html | 15 + 117 files changed, 3485 insertions(+) create mode 100644 testing/web-platform/tests/web-bundle/META.yml create mode 100644 testing/web-platform/tests/web-bundle/README.md create mode 100644 testing/web-platform/tests/web-bundle/resources/check-accept-header-and-return-bundle.py create mode 100644 testing/web-platform/tests/web-bundle/resources/check-cookie-and-return-bundle.py create mode 100644 testing/web-platform/tests/web-bundle/resources/check-sec-fetch-dest-header-and-return-bundle.py create mode 100644 testing/web-platform/tests/web-bundle/resources/corp.har create mode 100644 testing/web-platform/tests/web-bundle/resources/cross-origin-no-cors.har create mode 100644 testing/web-platform/tests/web-bundle/resources/cross-origin.har create mode 100644 testing/web-platform/tests/web-bundle/resources/dynamic1/classic_script.js create mode 100644 testing/web-platform/tests/web-bundle/resources/dynamic1/resource1.js create mode 100644 testing/web-platform/tests/web-bundle/resources/dynamic1/resource2.js create mode 100644 testing/web-platform/tests/web-bundle/resources/dynamic1/resource3.js create mode 100644 testing/web-platform/tests/web-bundle/resources/dynamic1/resource4.js create mode 100644 testing/web-platform/tests/web-bundle/resources/dynamic2/classic_script.js create mode 100644 testing/web-platform/tests/web-bundle/resources/dynamic2/resource1.js create mode 100644 testing/web-platform/tests/web-bundle/resources/dynamic2/resource2.js create mode 100644 testing/web-platform/tests/web-bundle/resources/dynamic2/resource3.js create mode 100644 testing/web-platform/tests/web-bundle/resources/dynamic2/resource4.js create mode 100755 testing/web-platform/tests/web-bundle/resources/generate-test-wbns.sh create mode 100644 testing/web-platform/tests/web-bundle/resources/location/location.html create mode 100644 testing/web-platform/tests/web-bundle/resources/location/location.js create mode 100644 testing/web-platform/tests/web-bundle/resources/nested/nested-sub.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/nested/resource.js create mode 100644 testing/web-platform/tests/web-bundle/resources/non-utf8-query-encoding.har create mode 100644 testing/web-platform/tests/web-bundle/resources/path-restriction/other/resource.js create mode 100644 testing/web-platform/tests/web-bundle/resources/path-restriction/resource.js create mode 100644 testing/web-platform/tests/web-bundle/resources/path-restriction/wbn-resource.js create mode 100644 testing/web-platform/tests/web-bundle/resources/path-restriction/wbn/resource.js create mode 100644 testing/web-platform/tests/web-bundle/resources/path-restriction/wbn/sub/resource.js create mode 100644 testing/web-platform/tests/web-bundle/resources/path-restriction/wbn1/resource.js create mode 100644 testing/web-platform/tests/web-bundle/resources/relative-url.har create mode 100644 testing/web-platform/tests/web-bundle/resources/simple-cross-origin.har create mode 100644 testing/web-platform/tests/web-bundle/resources/static-element/out-of-scope/script.js create mode 100644 testing/web-platform/tests/web-bundle/resources/static-element/resources/script.js create mode 100644 testing/web-platform/tests/web-bundle/resources/static-element/resources/style-imported-from-file.css create mode 100644 testing/web-platform/tests/web-bundle/resources/static-element/resources/style-imported-from-tag.css create mode 100644 testing/web-platform/tests/web-bundle/resources/static-element/resources/style.css create mode 100644 testing/web-platform/tests/web-bundle/resources/static-element/scopes/script.js create mode 100644 testing/web-platform/tests/web-bundle/resources/static-element/scopes/style-imported-from-file.css create mode 100644 testing/web-platform/tests/web-bundle/resources/static-element/scopes/style-imported-from-tag.css create mode 100644 testing/web-platform/tests/web-bundle/resources/static-element/scopes/style.css create mode 100644 testing/web-platform/tests/web-bundle/resources/subresource/fail.png create mode 100644 testing/web-platform/tests/web-bundle/resources/subresource/pass.png create mode 100644 testing/web-platform/tests/web-bundle/resources/subresource/root.js create mode 100644 testing/web-platform/tests/web-bundle/resources/subresource/submodule.js create mode 100644 testing/web-platform/tests/web-bundle/resources/test-helpers.js create mode 100644 testing/web-platform/tests/web-bundle/resources/uuid-in-package.har create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/__dir__.headers create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/cors/__dir__.sub.headers create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/cors/corp.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin-b2.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/dynamic/__dir__.headers create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/dynamic/classic_script.js create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource1.js create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource2.js create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource3.js create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource4.js create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/dynamic1-crossorigin.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/dynamic1.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/dynamic2.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/location.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/nested-main.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/no-cors/__dir__.headers create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin-b2.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/non-utf8-query-encoding.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/path-restriction.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbn.sub.headers create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/simple-cross-origin.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/static-element.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/static-element/out-of-scope/script.js create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/script.js create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style-imported-from-file.css create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style-imported-from-tag.css create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style.css create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/script.js create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style-imported-from-file.css create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style-imported-from-tag.css create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style.css create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/subresource.wbn create mode 100644 testing/web-platform/tests/web-bundle/resources/wbn/uuid-in-package.wbn create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/accept-header.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/coep.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/coep.https.tentative.html.headers create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/corp.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/credentials.https.tentative.sub.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/csp-allowed.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/csp-blocked.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/csp-blocked.https.tentative.html.sub.headers create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/csp-blockes-bundle.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/element-removal.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/invalid-json.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/nested-bundle.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/network-error.https.tentative.sub.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/not-found.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/path-restriction.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/relative-url-in-web-bundle-cors.https.tentative.sub.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/relative-url-in-web-bundle.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/relative-url-resources.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/relative-url-scopes.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/relative-url-static-element.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/relative-url-with-base.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/request-destination.https.tentative.sub.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/resource-timing-attributes-consistent.https.tentative.sub.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/resource-timing.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/resources/check-cookie-and-return-bundle.py create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/resources/service-worker-controlled-iframe.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/resources/service-worker-for-request-monitor.js create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/reuse-web-bundle-resource.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/service-worker-controlled.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/static-element-with-base.https.tentative.sub.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/static-element.https.tentative.sub.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/subframe-from-web-bundle.https.tentative.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/subresource-load.https.tentative.sub.html create mode 100644 testing/web-platform/tests/web-bundle/subresource-loading/supports-webbundle.https.tentative.html (limited to 'testing/web-platform/tests/web-bundle') diff --git a/testing/web-platform/tests/web-bundle/META.yml b/testing/web-platform/tests/web-bundle/META.yml new file mode 100644 index 0000000000..0f1912b23a --- /dev/null +++ b/testing/web-platform/tests/web-bundle/META.yml @@ -0,0 +1,5 @@ +spec: https://wicg.github.io/webpackage/draft-yasskin-wpack-bundled-exchanges.html +suggested_reviewers: + - horo + - irori + - jyasskin diff --git a/testing/web-platform/tests/web-bundle/README.md b/testing/web-platform/tests/web-bundle/README.md new file mode 100644 index 0000000000..3e300818e2 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/README.md @@ -0,0 +1,10 @@ +This directory contains tests for the +[Web Bundles](https://wicg.github.io/webpackage/draft-yasskin-wpack-bundled-exchanges.html). + +`generate-test-wbns.sh` requires command-line tools in the +[webpackage repository](https://github.com/WICG/webpackage). +To install them, run: +``` +go install github.com/WICG/webpackage/go/bundle/cmd/...@latest +export PATH=$PATH:$(go env GOPATH)/bin +``` diff --git a/testing/web-platform/tests/web-bundle/resources/check-accept-header-and-return-bundle.py b/testing/web-platform/tests/web-bundle/resources/check-accept-header-and-return-bundle.py new file mode 100644 index 0000000000..1fb63a57cb --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/check-accept-header-and-return-bundle.py @@ -0,0 +1,21 @@ +import os + +# Returns the content of ./wbn/subresource.wbn if the request has an "Accept" +# header including "application/webbundle;v=b2" type, otherwise returns an +# empty body with status code 400. + +def main(request, response): + headers = [ + (b"Content-Type", b"application/webbundle"), + (b"X-Content-Type-Options", b"nosniff"), + ] + + accept_values = request.headers.get(b"accept", b"").split(b",") + if b"application/webbundle;v=b2" in accept_values: + with open( + os.path.join(os.path.dirname(__file__), "./wbn/subresource.wbn"), + "rb", + ) as f: + return (200, headers, f.read()) + else: + return (400, [], "") diff --git a/testing/web-platform/tests/web-bundle/resources/check-cookie-and-return-bundle.py b/testing/web-platform/tests/web-bundle/resources/check-cookie-and-return-bundle.py new file mode 100644 index 0000000000..89a22c432e --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/check-cookie-and-return-bundle.py @@ -0,0 +1,29 @@ +import os + + +def main(request, response): + origin = request.headers.get(b"origin") + + if origin is not None: + response.headers.set(b"Access-Control-Allow-Origin", origin) + response.headers.set(b"Access-Control-Allow-Methods", b"GET") + response.headers.set(b"Access-Control-Allow-Credentials", b"true") + + headers = [ + (b"Content-Type", b"application/webbundle"), + (b"X-Content-Type-Options", b"nosniff"), + ] + + cookie = request.cookies.first(b"milk", None) + if (cookie is not None) and cookie.value == b"1": + if request.GET.get(b"bundle", None) == b"cross-origin": + bundle = "./wbn/simple-cross-origin.wbn" + else: + bundle = "./wbn/subresource.wbn" + with open( + os.path.join(os.path.dirname(__file__), bundle), + "rb", + ) as f: + return (200, headers, f.read()) + else: + return (400, [], "") diff --git a/testing/web-platform/tests/web-bundle/resources/check-sec-fetch-dest-header-and-return-bundle.py b/testing/web-platform/tests/web-bundle/resources/check-sec-fetch-dest-header-and-return-bundle.py new file mode 100644 index 0000000000..da36e49320 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/check-sec-fetch-dest-header-and-return-bundle.py @@ -0,0 +1,21 @@ +import os + + +def main(request, response): + origin = request.headers.get(b"origin") + if origin is not None: + response.headers.set(b"Access-Control-Allow-Origin", origin) + + headers = [ + (b"Content-Type", b"application/webbundle"), + (b"X-Content-Type-Options", b"nosniff"), + ] + + if request.headers.get(b"sec-fetch-dest", None) == b"webbundle": + with open( + os.path.join(os.path.dirname(__file__), "./wbn/subresource.wbn"), + "rb", + ) as f: + return (200, headers, f.read()) + else: + return (400, [], "") diff --git a/testing/web-platform/tests/web-bundle/resources/corp.har b/testing/web-platform/tests/web-bundle/resources/corp.har new file mode 100644 index 0000000000..e1b0393957 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/corp.har @@ -0,0 +1,140 @@ +{ + "log": { + "entries": [ + { + "request": { + "method": "GET", + "url": "https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/no-corp.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + } + ], + "content": { + "text": "scriptLoaded('no-corp.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/corp-same-origin.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + }, + { + "name": "Cross-Origin-Resource-Policy", + "value": "same-origin" + } + ], + "content": { + "text": "scriptLoaded('corp-same-origin.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/corp-cross-origin.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + }, + { + "name": "Cross-Origin-Resource-Policy", + "value": "cross-origin" + } + ], + "content": { + "text": "scriptLoaded('corp-cross-origin.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "uuid-in-package:5eafff38-e0a0-4661-bde0-434255aa9d93", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/html" + } + ], + "content": { + "text": "" + } + } + }, + { + "request": { + "method": "GET", + "url": "uuid-in-package:7e13b47a-8b91-4a0e-997c-993a5e2f3a34", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/html" + }, + { + "name": "Cross-Origin-Resource-Policy", + "value": "same-origin" + } + ], + "content": { + "text": "" + } + } + }, + { + "request": { + "method": "GET", + "url": "uuid-in-package:86d5b696-8867-4454-8b07-51239a0817f7", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/html" + }, + { + "name": "Cross-Origin-Embedder-Policy", + "value": "require-corp" + }, + { + "name": "Cross-Origin-Resource-Policy", + "value": "cross-origin" + } + ], + "content": { + "text": "" + } + } + } + ] + } +} diff --git a/testing/web-platform/tests/web-bundle/resources/cross-origin-no-cors.har b/testing/web-platform/tests/web-bundle/resources/cross-origin-no-cors.har new file mode 100644 index 0000000000..c31a0963fd --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/cross-origin-no-cors.har @@ -0,0 +1,48 @@ +{ + "log": { + "entries": [ + { + "request": { + "method": "GET", + "url": "https://www1.web-platform.test:8444/web-bundle/resources/wbn/no-cors/resource.cors.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + }, + { + "name": "Access-Control-Allow-Origin", + "value": "*" + } + ], + "content": { + "text": "scriptLoaded('resource.cors.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://www1.web-platform.test:8444/web-bundle/resources/wbn/no-cors/resource.no-cors.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + } + ], + "content": { + "text": "scriptLoaded('resource.no-cors.js');" + } + } + } + ] + } +} \ No newline at end of file diff --git a/testing/web-platform/tests/web-bundle/resources/cross-origin.har b/testing/web-platform/tests/web-bundle/resources/cross-origin.har new file mode 100644 index 0000000000..2c33449cbe --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/cross-origin.har @@ -0,0 +1,48 @@ +{ + "log": { + "entries": [ + { + "request": { + "method": "GET", + "url": "https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/resource.cors.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + }, + { + "name": "Access-Control-Allow-Origin", + "value": "*" + } + ], + "content": { + "text": "scriptLoaded('resource.cors.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "https://www1.web-platform.test:8444/web-bundle/resources/wbn/cors/resource.no-cors.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + } + ], + "content": { + "text": "scriptLoaded('resource.no-cors.js');" + } + } + } + ] + } +} \ No newline at end of file diff --git a/testing/web-platform/tests/web-bundle/resources/dynamic1/classic_script.js b/testing/web-platform/tests/web-bundle/resources/dynamic1/classic_script.js new file mode 100644 index 0000000000..5fcf045906 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/dynamic1/classic_script.js @@ -0,0 +1 @@ +window.report_result('classic script from dynamic1.wbn'); diff --git a/testing/web-platform/tests/web-bundle/resources/dynamic1/resource1.js b/testing/web-platform/tests/web-bundle/resources/dynamic1/resource1.js new file mode 100644 index 0000000000..6fd1de600e --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/dynamic1/resource1.js @@ -0,0 +1 @@ +export const result = 'resource1 from dynamic1.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/dynamic1/resource2.js b/testing/web-platform/tests/web-bundle/resources/dynamic1/resource2.js new file mode 100644 index 0000000000..3cf012b21a --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/dynamic1/resource2.js @@ -0,0 +1 @@ +export const result = 'resource2 from dynamic1.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/dynamic1/resource3.js b/testing/web-platform/tests/web-bundle/resources/dynamic1/resource3.js new file mode 100644 index 0000000000..c8a4e258b8 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/dynamic1/resource3.js @@ -0,0 +1 @@ +export const result = 'resource3 from dynamic1.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/dynamic1/resource4.js b/testing/web-platform/tests/web-bundle/resources/dynamic1/resource4.js new file mode 100644 index 0000000000..0b2f7920b0 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/dynamic1/resource4.js @@ -0,0 +1 @@ +export const result = 'resource4 from dynamic1.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/dynamic2/classic_script.js b/testing/web-platform/tests/web-bundle/resources/dynamic2/classic_script.js new file mode 100644 index 0000000000..546d8a503d --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/dynamic2/classic_script.js @@ -0,0 +1 @@ +window.report_result('classic script from dynamic2.wbn'); diff --git a/testing/web-platform/tests/web-bundle/resources/dynamic2/resource1.js b/testing/web-platform/tests/web-bundle/resources/dynamic2/resource1.js new file mode 100644 index 0000000000..c6f751cec4 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/dynamic2/resource1.js @@ -0,0 +1 @@ +export const result = 'resource1 from dynamic2.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/dynamic2/resource2.js b/testing/web-platform/tests/web-bundle/resources/dynamic2/resource2.js new file mode 100644 index 0000000000..b4278ee1c1 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/dynamic2/resource2.js @@ -0,0 +1 @@ +export const result = 'resource2 from dynamic2.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/dynamic2/resource3.js b/testing/web-platform/tests/web-bundle/resources/dynamic2/resource3.js new file mode 100644 index 0000000000..0dad7ea7bf --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/dynamic2/resource3.js @@ -0,0 +1 @@ +export const result = 'resource3 from dynamic2.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/dynamic2/resource4.js b/testing/web-platform/tests/web-bundle/resources/dynamic2/resource4.js new file mode 100644 index 0000000000..e51cf7f5dc --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/dynamic2/resource4.js @@ -0,0 +1 @@ +export const result = 'resource4 from dynamic2.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/generate-test-wbns.sh b/testing/web-platform/tests/web-bundle/resources/generate-test-wbns.sh new file mode 100755 index 0000000000..418a56e0e7 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/generate-test-wbns.sh @@ -0,0 +1,105 @@ +#!/bin/sh + +set -e + +if ! command -v gen-bundle > /dev/null 2>&1; then + echo "gen-bundle is not installed. Please run:" + echo " go install github.com/WICG/webpackage/go/bundle/cmd/...@latest" + echo ' export PATH=$PATH:$(go env GOPATH)/bin' + exit 1 +fi + +# TODO: Stop hard-coding "web-platform.test" when generating Web Bundles on the +# fly. +wpt_test_origin=https://web-platform.test:8444 +wpt_test_remote_origin=https://www1.web-platform.test:8444 + +gen-bundle \ + -version b2 \ + -baseURL $wpt_test_origin/web-bundle/resources/wbn/static-element/ \ + -primaryURL $wpt_test_origin/web-bundle/resources/wbn/static-element/resources/style.css \ + -dir static-element/ \ + -o wbn/static-element.wbn + +# Create a bundle, nested-main.wbn, which includes nested-sub.wbn. +cp -a wbn/subresource.wbn nested/nested-sub.wbn +gen-bundle \ + -version b2 \ + -baseURL $wpt_test_origin/web-bundle/resources/wbn/ \ + -primaryURL $wpt_test_origin/web-bundle/resources/wbn/resource.js \ + -dir nested/ \ + -o wbn/nested-main.wbn + +gen-bundle \ + -version b2 \ + -har non-utf8-query-encoding.har \ + -primaryURL $wpt_test_origin/web-bundle/resources/wbn/static-element/resources/script.js?x=%A4%A2 \ + -o wbn/non-utf8-query-encoding.wbn + +gen-bundle \ + -version b2 \ + -har corp.har \ + -primaryURL $wpt_test_remote_origin/web-bundle/resources/wbn/cors/no-corp.js \ + -o wbn/cors/corp.wbn + +gen-bundle \ + -version b2 \ + -baseURL $wpt_test_origin/web-bundle/resources/wbn/ \ + -primaryURL $wpt_test_origin/web-bundle/resources/wbn/location.html \ + -dir location/ \ + -o wbn/location.wbn + +gen-bundle \ + -version b2 \ + -har relative-url.har \ + -o wbn/relative-url.wbn + +gen-bundle \ + -version b2 \ + -baseURL $wpt_test_origin/web-bundle/resources/wbn/ \ + -dir subresource/ \ + -o wbn/subresource.wbn + +gen-bundle \ + -version b2 \ + -baseURL $wpt_test_origin/web-bundle/resources/wbn/dynamic/ \ + -dir dynamic1/ \ + -o wbn/dynamic1.wbn + +gen-bundle \ + -version b2 \ + -baseURL $wpt_test_origin/web-bundle/resources/wbn/dynamic/ \ + -dir dynamic2/ \ + -o wbn/dynamic2.wbn + +gen-bundle \ + -version b2 \ + -baseURL $wpt_test_remote_origin/web-bundle/resources/wbn/dynamic/ \ + -dir dynamic1/ \ + -o wbn/dynamic1-crossorigin.wbn + +gen-bundle \ + -version b2 \ + -baseURL $wpt_test_origin/web-bundle/resources/ \ + -dir path-restriction/ \ + -o wbn/path-restriction.wbn + +gen-bundle \ + -version b2 \ + -har cross-origin.har \ + -o wbn/cors/cross-origin.wbn + +gen-bundle \ + -version b2 \ + -har cross-origin-no-cors.har \ + -o wbn/no-cors/cross-origin.wbn + +gen-bundle \ + -version b2 \ + -har uuid-in-package.har \ + -o wbn/uuid-in-package.wbn + +gen-bundle \ + -version b2 \ + -har simple-cross-origin.har \ + -o wbn/simple-cross-origin.wbn diff --git a/testing/web-platform/tests/web-bundle/resources/location/location.html b/testing/web-platform/tests/web-bundle/resources/location/location.html new file mode 100644 index 0000000000..e272dad23d --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/location/location.html @@ -0,0 +1,2 @@ + + diff --git a/testing/web-platform/tests/web-bundle/resources/location/location.js b/testing/web-platform/tests/web-bundle/resources/location/location.js new file mode 100644 index 0000000000..a1dbba7366 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/location/location.js @@ -0,0 +1,2 @@ + +window.opener.postMessage({location: location.href}, '*'); diff --git a/testing/web-platform/tests/web-bundle/resources/nested/nested-sub.wbn b/testing/web-platform/tests/web-bundle/resources/nested/nested-sub.wbn new file mode 100644 index 0000000000..840773f8db Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/nested/nested-sub.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/nested/resource.js b/testing/web-platform/tests/web-bundle/resources/nested/resource.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/testing/web-platform/tests/web-bundle/resources/non-utf8-query-encoding.har b/testing/web-platform/tests/web-bundle/resources/non-utf8-query-encoding.har new file mode 100644 index 0000000000..c4acfdb227 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/non-utf8-query-encoding.har @@ -0,0 +1,25 @@ +{ + "log": { + "entries": [ + { + "request": { + "method": "GET", + "url": "https://web-platform.test:8444/web-bundle/resources/wbn/static-element/resources/script.js?x=%A4%A2", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "application/javascript" + } + ], + "content": { + "text": "const resources_script_result = 'loaded from webbundle';" + } + } + } + ] + } +} diff --git a/testing/web-platform/tests/web-bundle/resources/path-restriction/other/resource.js b/testing/web-platform/tests/web-bundle/resources/path-restriction/other/resource.js new file mode 100644 index 0000000000..a4967d2285 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/path-restriction/other/resource.js @@ -0,0 +1 @@ +export const result = 'resource from path-restriction.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/path-restriction/resource.js b/testing/web-platform/tests/web-bundle/resources/path-restriction/resource.js new file mode 100644 index 0000000000..a4967d2285 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/path-restriction/resource.js @@ -0,0 +1 @@ +export const result = 'resource from path-restriction.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn-resource.js b/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn-resource.js new file mode 100644 index 0000000000..a4967d2285 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn-resource.js @@ -0,0 +1 @@ +export const result = 'resource from path-restriction.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn/resource.js b/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn/resource.js new file mode 100644 index 0000000000..a4967d2285 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn/resource.js @@ -0,0 +1 @@ +export const result = 'resource from path-restriction.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn/sub/resource.js b/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn/sub/resource.js new file mode 100644 index 0000000000..a4967d2285 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn/sub/resource.js @@ -0,0 +1 @@ +export const result = 'resource from path-restriction.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn1/resource.js b/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn1/resource.js new file mode 100644 index 0000000000..a4967d2285 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/path-restriction/wbn1/resource.js @@ -0,0 +1 @@ +export const result = 'resource from path-restriction.wbn'; diff --git a/testing/web-platform/tests/web-bundle/resources/relative-url.har b/testing/web-platform/tests/web-bundle/resources/relative-url.har new file mode 100644 index 0000000000..e42e85fd1f --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/relative-url.har @@ -0,0 +1,139 @@ +{ + "log": { + "entries": [ + { + "request": { + "method": "GET", + "url": "relative-url-file.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + } + ], + "content": { + "text": "scriptLoaded('relative-url-file.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "//web-platform.test:8444/web-bundle/resources/wbn/relative-url/start-with-double-slash.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + } + ], + "content": { + "text": "scriptLoaded('start-with-double-slash.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "//www1.web-platform.test:8444/web-bundle/resources/wbn/relative-url/start-with-double-slash-cors.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + } + ], + "content": { + "text": "scriptLoaded('start-with-double-slash-cors.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "/web-bundle/resources/wbn/relative-url/start-with-slash.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + } + ], + "content": { + "text": "scriptLoaded('start-with-slash.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "relative-url/subdirectory-path.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + } + ], + "content": { + "text": "scriptLoaded('subdirectory-path.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "../wbn/starts-with-two-dots.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + } + ], + "content": { + "text": "scriptLoaded('starts-with-two-dots.js');" + } + } + }, + { + "request": { + "method": "GET", + "url": "../starts-with-two-dots-out-of-scope.js", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/javascript" + } + ], + "content": { + "text": "scriptLoaded('starts-with-two-dots-out-of-scope.js');" + } + } + } + ] + } +} \ No newline at end of file diff --git a/testing/web-platform/tests/web-bundle/resources/simple-cross-origin.har b/testing/web-platform/tests/web-bundle/resources/simple-cross-origin.har new file mode 100644 index 0000000000..8566a6c6c2 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/simple-cross-origin.har @@ -0,0 +1,29 @@ +{ + "log": { + "entries": [ + { + "request": { + "method": "GET", + "url": "https://www1.web-platform.test:8444/web-bundle/resources/wbn/simple-cross-origin.txt", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/plain" + }, + { + "name": "Access-Control-Allow-Origin", + "value": "*" + } + ], + "content": { + "text": "hello from simple-cross-origin.txt" + } + } + } + ] + } +} diff --git a/testing/web-platform/tests/web-bundle/resources/static-element/out-of-scope/script.js b/testing/web-platform/tests/web-bundle/resources/static-element/out-of-scope/script.js new file mode 100644 index 0000000000..0f3e0d27c0 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/static-element/out-of-scope/script.js @@ -0,0 +1 @@ +const out_of_scope_script_result = 'loaded from webbundle'; diff --git a/testing/web-platform/tests/web-bundle/resources/static-element/resources/script.js b/testing/web-platform/tests/web-bundle/resources/static-element/resources/script.js new file mode 100644 index 0000000000..f5327df7ae --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/static-element/resources/script.js @@ -0,0 +1 @@ +const resources_script_result = 'loaded from webbundle'; diff --git a/testing/web-platform/tests/web-bundle/resources/static-element/resources/style-imported-from-file.css b/testing/web-platform/tests/web-bundle/resources/static-element/resources/style-imported-from-file.css new file mode 100644 index 0000000000..6b79f6dd8c --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/static-element/resources/style-imported-from-file.css @@ -0,0 +1,3 @@ +#resources_style_imported_from_file_target { + color: blue; +} diff --git a/testing/web-platform/tests/web-bundle/resources/static-element/resources/style-imported-from-tag.css b/testing/web-platform/tests/web-bundle/resources/static-element/resources/style-imported-from-tag.css new file mode 100644 index 0000000000..38e9fe3133 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/static-element/resources/style-imported-from-tag.css @@ -0,0 +1,3 @@ +#resources_style_imported_from_tag_target { + color: blue; +} diff --git a/testing/web-platform/tests/web-bundle/resources/static-element/resources/style.css b/testing/web-platform/tests/web-bundle/resources/static-element/resources/style.css new file mode 100644 index 0000000000..7f98b85eb6 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/static-element/resources/style.css @@ -0,0 +1,5 @@ +@import 'style-imported-from-file.css'; + +#resources_style_target { + color: blue; +} diff --git a/testing/web-platform/tests/web-bundle/resources/static-element/scopes/script.js b/testing/web-platform/tests/web-bundle/resources/static-element/scopes/script.js new file mode 100644 index 0000000000..140698cb5c --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/static-element/scopes/script.js @@ -0,0 +1 @@ +const scopes_script_result = 'loaded from webbundle'; diff --git a/testing/web-platform/tests/web-bundle/resources/static-element/scopes/style-imported-from-file.css b/testing/web-platform/tests/web-bundle/resources/static-element/scopes/style-imported-from-file.css new file mode 100644 index 0000000000..0162888644 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/static-element/scopes/style-imported-from-file.css @@ -0,0 +1,3 @@ +#scopes_style_imported_from_file_target { + color: blue; +} diff --git a/testing/web-platform/tests/web-bundle/resources/static-element/scopes/style-imported-from-tag.css b/testing/web-platform/tests/web-bundle/resources/static-element/scopes/style-imported-from-tag.css new file mode 100644 index 0000000000..7055c86ee9 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/static-element/scopes/style-imported-from-tag.css @@ -0,0 +1,3 @@ +#scopes_style_imported_from_tag_target { + color: blue; +} diff --git a/testing/web-platform/tests/web-bundle/resources/static-element/scopes/style.css b/testing/web-platform/tests/web-bundle/resources/static-element/scopes/style.css new file mode 100644 index 0000000000..f2af82dfd7 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/static-element/scopes/style.css @@ -0,0 +1,5 @@ +@import 'style-imported-from-file.css'; + +#scopes_style_target { + color: blue; +} diff --git a/testing/web-platform/tests/web-bundle/resources/subresource/fail.png b/testing/web-platform/tests/web-bundle/resources/subresource/fail.png new file mode 100644 index 0000000000..b593380333 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/subresource/fail.png differ diff --git a/testing/web-platform/tests/web-bundle/resources/subresource/pass.png b/testing/web-platform/tests/web-bundle/resources/subresource/pass.png new file mode 100644 index 0000000000..2fa1e0ac06 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/subresource/pass.png differ diff --git a/testing/web-platform/tests/web-bundle/resources/subresource/root.js b/testing/web-platform/tests/web-bundle/resources/subresource/root.js new file mode 100644 index 0000000000..2c2a465472 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/subresource/root.js @@ -0,0 +1 @@ +export * from './submodule.js'; diff --git a/testing/web-platform/tests/web-bundle/resources/subresource/submodule.js b/testing/web-platform/tests/web-bundle/resources/subresource/submodule.js new file mode 100644 index 0000000000..4561aaf014 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/subresource/submodule.js @@ -0,0 +1 @@ +export const result = 'OK'; diff --git a/testing/web-platform/tests/web-bundle/resources/test-helpers.js b/testing/web-platform/tests/web-bundle/resources/test-helpers.js new file mode 100644 index 0000000000..27dfb4c0ec --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/test-helpers.js @@ -0,0 +1,122 @@ +// Helper functions used in web-bundle tests. + +function addElementAndWaitForLoad(element) { + return new Promise((resolve, reject) => { + element.onload = () => resolve(element); + element.onerror = () => reject(element); + document.body.appendChild(element); + }); +} + +function addElementAndWaitForError(element) { + return new Promise((resolve, reject) => { + element.onload = () => reject(element); + element.onerror = () => resolve(element); + document.body.appendChild(element); + }); +} + +// Evaluates |code| in |iframe|. The following message event handler must be +// registered on the iframe page: +// window.addEventListener( +// 'message', +// (e) => { e.source.postMessage(eval(e.data), e.origin); }); +function evalInIframe(iframe, code) { + const message_promise = new Promise((resolve) => { + window.addEventListener( + 'message', + (e) => { resolve(e.data); }, + { once : true }); + }); + iframe.contentWindow.postMessage(code,'*'); + return message_promise; +} + +function fetchAndWaitForReject(url) { + return new Promise((resolve, reject) => { + fetch(url) + .then(() => { + reject(); + }) + .catch(() => { + resolve(); + }); + }); +} + +function isValidCrossOriginAttribute(crossorigin) { + if (crossorigin === undefined) + return true; + if ((typeof crossorigin) != 'string') + return false; + const lower_crossorigin = crossorigin.toLowerCase(); + return (lower_crossorigin === 'anonymous') || + (lower_crossorigin === 'use-credentials'); +} + +function addScriptAndWaitForError(url) { + return new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.src = url; + script.onload = reject; + script.onerror = resolve; + document.body.appendChild(script); + }); +} + +function addScriptAndWaitForExecution(url) { + return new Promise((resolve, reject) => { + window.scriptLoaded = (val) => { + window.scriptLoaded = undefined; + resolve(val); + }; + const script = document.createElement("script"); + script.src = url; + script.onerror = reject; + document.body.appendChild(script); + }); +} + +function createWebBundleElement(url, resources, options) { + const script = document.createElement("script"); + script.type = "webbundle"; + const json_rule = {"source": url, "resources": resources}; + if (options && options.scopes) { + json_rule.scopes = options.scopes; + } + if (options && options.credentials) { + json_rule.credentials = options.credentials; + } + script.textContent = JSON.stringify(json_rule); + return script; +} + +function addWebBundleElementAndWaitForLoad(url, resources, options) { + const element = createWebBundleElement(url, resources, options); + return addElementAndWaitForLoad(element); +} + +function addWebBundleElementAndWaitForError(url, resources, options) { + const element = createWebBundleElement(url, resources, options); + return addElementAndWaitForError(element); +} + +// This function creates a new WebBundle element that has a rule +// constructed in accordance with a JSON object |new_rule|: +// 1. Copy over WebBundle rules from an existing element that are +// not present in |new_rule|: source, resources, scopes and credentials. +// 2. Then create a new WebBundle element from |new_rule| (that now +// has full information required after 1.) and return it. +function createNewWebBundleElementWithUpdatedRule(element, new_rule) { + const rule = JSON.parse(element.textContent); + if (rule.resources && !new_rule.resources) + new_rule.resources = rule.resources; + if (rule.scopes && !new_rule.scopes) + new_rule.scopes = rule.scopes; + if (rule.credentials && !new_rule.credentials) + new_rule.credentials = rule.credentials; + if (!new_rule.url) + new_rule.url = rule.source; + + return createWebBundleElement(new_rule.url, new_rule.resources, new_rule); +} diff --git a/testing/web-platform/tests/web-bundle/resources/uuid-in-package.har b/testing/web-platform/tests/web-bundle/resources/uuid-in-package.har new file mode 100644 index 0000000000..8dedc951d5 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/uuid-in-package.har @@ -0,0 +1,44 @@ +{ + "log": { + "entries": [ + { + "request": { + "method": "GET", + "url": "uuid-in-package:020111b3-437a-4c5c-ae07-adb6bbffb720", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "application/javascript" + } + ], + "content": { + "text": "window.report_result('OK');" + } + } + }, + { + "request": { + "method": "GET", + "url": "uuid-in-package:429fcc4e-0696-4bad-b099-ee9175f023ae", + "headers": [] + }, + "response": { + "status": 200, + "headers": [ + { + "name": "Content-type", + "value": "text/html" + } + ], + "content": { + "text": "" + } + } + } + ] + } +} diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/__dir__.headers b/testing/web-platform/tests/web-bundle/resources/wbn/__dir__.headers new file mode 100644 index 0000000000..21e57b9cac --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/__dir__.headers @@ -0,0 +1,2 @@ +Content-Type: application/webbundle +X-Content-Type-Options: nosniff diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/cors/__dir__.sub.headers b/testing/web-platform/tests/web-bundle/resources/wbn/cors/__dir__.sub.headers new file mode 100644 index 0000000000..767da13cb2 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/cors/__dir__.sub.headers @@ -0,0 +1,4 @@ +Content-Type: application/webbundle +X-Content-Type-Options: nosniff +Access-Control-Allow-Origin: https://{{domains[]}}:{{ports[https][0]}} +Access-Control-Allow-Credentials: true diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/cors/corp.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/cors/corp.wbn new file mode 100644 index 0000000000..08ee4bc80a Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/cors/corp.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin-b2.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin-b2.wbn new file mode 100644 index 0000000000..03c31a8b5b Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin-b2.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin.wbn new file mode 100644 index 0000000000..03c31a8b5b Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/__dir__.headers b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/__dir__.headers new file mode 100644 index 0000000000..cb762eff80 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/__dir__.headers @@ -0,0 +1 @@ +Access-Control-Allow-Origin: * diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/classic_script.js b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/classic_script.js new file mode 100644 index 0000000000..db69b96188 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/classic_script.js @@ -0,0 +1 @@ +window.report_result('classic script from network'); diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource1.js b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource1.js new file mode 100644 index 0000000000..7bd437364a --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource1.js @@ -0,0 +1 @@ +export const result = 'resource1 from network'; diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource2.js b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource2.js new file mode 100644 index 0000000000..09a4ee7b70 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource2.js @@ -0,0 +1 @@ +export const result = 'resource2 from network'; diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource3.js b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource3.js new file mode 100644 index 0000000000..851168c9da --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource3.js @@ -0,0 +1 @@ +export const result = 'resource3 from network'; diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource4.js b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource4.js new file mode 100644 index 0000000000..ea456b8db0 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource4.js @@ -0,0 +1 @@ +export const result = 'resource4 from network'; diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/dynamic1-crossorigin.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic1-crossorigin.wbn new file mode 100644 index 0000000000..e003f39481 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic1-crossorigin.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/dynamic1.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic1.wbn new file mode 100644 index 0000000000..f9b8e01404 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic1.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/dynamic2.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic2.wbn new file mode 100644 index 0000000000..f23fb4fad4 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic2.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/location.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/location.wbn new file mode 100644 index 0000000000..54d8f40fce Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/location.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/nested-main.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/nested-main.wbn new file mode 100644 index 0000000000..9c21e73220 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/nested-main.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/__dir__.headers b/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/__dir__.headers new file mode 100644 index 0000000000..21e57b9cac --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/__dir__.headers @@ -0,0 +1,2 @@ +Content-Type: application/webbundle +X-Content-Type-Options: nosniff diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin-b2.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin-b2.wbn new file mode 100644 index 0000000000..f6d565a9c3 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin-b2.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin.wbn new file mode 100644 index 0000000000..f6d565a9c3 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/non-utf8-query-encoding.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/non-utf8-query-encoding.wbn new file mode 100644 index 0000000000..56f76b8f20 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/non-utf8-query-encoding.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/path-restriction.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/path-restriction.wbn new file mode 100644 index 0000000000..73a02a0829 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/path-restriction.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbn new file mode 100644 index 0000000000..13924fdb99 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbn.sub.headers b/testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbn.sub.headers new file mode 100644 index 0000000000..ce4780f454 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbn.sub.headers @@ -0,0 +1,3 @@ +Content-Type: application/webbundle +X-Content-Type-Options: nosniff +Access-Control-Allow-Origin: https://{{domains[]}}:{{ports[https][0]}} diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/simple-cross-origin.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/simple-cross-origin.wbn new file mode 100644 index 0000000000..a00cce00f0 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/simple-cross-origin.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/static-element.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/static-element.wbn new file mode 100644 index 0000000000..dd50ef320a Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/static-element.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/static-element/out-of-scope/script.js b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/out-of-scope/script.js new file mode 100644 index 0000000000..e761729483 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/out-of-scope/script.js @@ -0,0 +1 @@ +const out_of_scope_script_result = 'loaded from network'; diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/script.js b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/script.js new file mode 100644 index 0000000000..08c4d9a2ee --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/script.js @@ -0,0 +1 @@ +const resources_script_result = 'loaded from network'; diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style-imported-from-file.css b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style-imported-from-file.css new file mode 100644 index 0000000000..33f0f375da --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style-imported-from-file.css @@ -0,0 +1,3 @@ +#resources_style_imported_from_file_target { + color: red; +} diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style-imported-from-tag.css b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style-imported-from-tag.css new file mode 100644 index 0000000000..85dbf84db3 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style-imported-from-tag.css @@ -0,0 +1,3 @@ +#resources_style_imported_from_tag_target { + color: red; +} diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style.css b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style.css new file mode 100644 index 0000000000..41886f41d9 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style.css @@ -0,0 +1,5 @@ +@import 'style-imported-from-file.css'; + +#resources_style_target { + color: red; +} diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/script.js b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/script.js new file mode 100644 index 0000000000..060d8c50a8 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/script.js @@ -0,0 +1 @@ +const scopes_script_result = 'loaded from network'; diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style-imported-from-file.css b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style-imported-from-file.css new file mode 100644 index 0000000000..d865cebd12 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style-imported-from-file.css @@ -0,0 +1,3 @@ +#scopes_style_imported_from_file_target { + color: red; +} diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style-imported-from-tag.css b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style-imported-from-tag.css new file mode 100644 index 0000000000..ad70df9b39 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style-imported-from-tag.css @@ -0,0 +1,3 @@ +#scopes_style_imported_from_tag_target { + color: red; +} diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style.css b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style.css new file mode 100644 index 0000000000..233ecd7113 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style.css @@ -0,0 +1,5 @@ +@import 'style-imported-from-file.css'; + +#scopes_style_target { + color: red; +} diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/subresource.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/subresource.wbn new file mode 100644 index 0000000000..840773f8db Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/subresource.wbn differ diff --git a/testing/web-platform/tests/web-bundle/resources/wbn/uuid-in-package.wbn b/testing/web-platform/tests/web-bundle/resources/wbn/uuid-in-package.wbn new file mode 100644 index 0000000000..d4d100d121 Binary files /dev/null and b/testing/web-platform/tests/web-bundle/resources/wbn/uuid-in-package.wbn differ diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/accept-header.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/accept-header.https.tentative.html new file mode 100644 index 0000000000..68b13e53c6 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/accept-header.https.tentative.html @@ -0,0 +1,22 @@ + +Accept: request header in webbundle requests + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/coep.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/coep.https.tentative.html new file mode 100644 index 0000000000..4029fc6f81 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/coep.https.tentative.html @@ -0,0 +1,127 @@ + +COEP for WebBundle subresource loading + + + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/coep.https.tentative.html.headers b/testing/web-platform/tests/web-bundle/subresource-loading/coep.https.tentative.html.headers new file mode 100644 index 0000000000..4e798cd9f5 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/coep.https.tentative.html.headers @@ -0,0 +1,2 @@ +Cross-Origin-Embedder-Policy: require-corp +Cross-Origin-Resource-Policy: cross-origin diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/corp.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/corp.https.tentative.html new file mode 100644 index 0000000000..ce18544b0b --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/corp.https.tentative.html @@ -0,0 +1,73 @@ + +CORP for WebBundle subresource loading + + + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/credentials.https.tentative.sub.html b/testing/web-platform/tests/web-bundle/subresource-loading/credentials.https.tentative.sub.html new file mode 100644 index 0000000000..37efc37e6d --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/credentials.https.tentative.sub.html @@ -0,0 +1,173 @@ + +Credentials in WebBundle subresource loading + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/csp-allowed.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/csp-allowed.https.tentative.html new file mode 100644 index 0000000000..55498eaa4e --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/csp-allowed.https.tentative.html @@ -0,0 +1,89 @@ + +CSP for subresource WebBundle (allowed cases) + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/csp-blocked.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/csp-blocked.https.tentative.html new file mode 100644 index 0000000000..6700533b58 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/csp-blocked.https.tentative.html @@ -0,0 +1,162 @@ + +CSP for subresource WebBundle (blocked cases) + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/csp-blocked.https.tentative.html.sub.headers b/testing/web-platform/tests/web-bundle/subresource-loading/csp-blocked.https.tentative.html.sub.headers new file mode 100644 index 0000000000..ac826f8c48 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/csp-blocked.https.tentative.html.sub.headers @@ -0,0 +1,6 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Set-Cookie: csp-blocked-report-id={{$id:uuid()}}; Path=/web-bundle/subresource-loading/ +Report-To: { "group": "csp-group", "max_age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/reporting/resources/report.py?op=put&reportID={{$id}}" }] } diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/csp-blockes-bundle.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/csp-blockes-bundle.https.tentative.html new file mode 100644 index 0000000000..06cef8c118 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/csp-blockes-bundle.https.tentative.html @@ -0,0 +1,66 @@ + +CSP blocks WebBundle + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/element-removal.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/element-removal.https.tentative.html new file mode 100644 index 0000000000..87ab8a9f15 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/element-removal.https.tentative.html @@ -0,0 +1,32 @@ + + + On-going subresource loading should fail immediately when the web bundle + element is removed + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/invalid-json.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/invalid-json.https.tentative.html new file mode 100644 index 0000000000..f4f9405e2d --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/invalid-json.https.tentative.html @@ -0,0 +1,47 @@ + +WebBundle subresource loading with script API and invalid JSON + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/nested-bundle.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/nested-bundle.https.tentative.html new file mode 100644 index 0000000000..2e5b102e68 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/nested-bundle.https.tentative.html @@ -0,0 +1,36 @@ + +A nested bundle is not supported + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/network-error.https.tentative.sub.html b/testing/web-platform/tests/web-bundle/subresource-loading/network-error.https.tentative.sub.html new file mode 100644 index 0000000000..3ebab3fa90 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/network-error.https.tentative.sub.html @@ -0,0 +1,31 @@ + +Web Bundle fetching failed due to a network error + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/not-found.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/not-found.https.tentative.html new file mode 100644 index 0000000000..efcb6bc9fb --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/not-found.https.tentative.html @@ -0,0 +1,33 @@ + +Web Bundle fetching failed due to not found error + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/path-restriction.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/path-restriction.https.tentative.html new file mode 100644 index 0000000000..1d7b6f204b --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/path-restriction.https.tentative.html @@ -0,0 +1,52 @@ + +Path restriction on subresource loading with WebBundles + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-in-web-bundle-cors.https.tentative.sub.html b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-in-web-bundle-cors.https.tentative.sub.html new file mode 100644 index 0000000000..32f333b67e --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-in-web-bundle-cors.https.tentative.sub.html @@ -0,0 +1,60 @@ + +Relative Url in cross origin web bundle + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-in-web-bundle.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-in-web-bundle.https.tentative.html new file mode 100644 index 0000000000..0b7f63c21c --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-in-web-bundle.https.tentative.html @@ -0,0 +1,60 @@ + +Relative Url in web bundle + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-resources.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-resources.https.tentative.html new file mode 100644 index 0000000000..1b79b157c4 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-resources.https.tentative.html @@ -0,0 +1,80 @@ + +Subresource loading using relative URLs in the 'resources' + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-scopes.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-scopes.https.tentative.html new file mode 100644 index 0000000000..40a49d55d3 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-scopes.https.tentative.html @@ -0,0 +1,85 @@ + +Subresource loading using relative URLs in the 'scopes' + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-static-element.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-static-element.https.tentative.html new file mode 100644 index 0000000000..55030e234b --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-static-element.https.tentative.html @@ -0,0 +1,34 @@ + +WebBundle subresource loading with relative URLs for static elements + + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-with-base.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-with-base.https.tentative.html new file mode 100644 index 0000000000..3c7e1a380c --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/relative-url-with-base.https.tentative.html @@ -0,0 +1,67 @@ + + + Subresource loading using relative URLs in the 'resources' attribute with a + base element + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/request-destination.https.tentative.sub.html b/testing/web-platform/tests/web-bundle/subresource-loading/request-destination.https.tentative.sub.html new file mode 100644 index 0000000000..da12f3d042 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/request-destination.https.tentative.sub.html @@ -0,0 +1,49 @@ + + + Request's destination must be "webbundle" with the script-based API + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/resource-timing-attributes-consistent.https.tentative.sub.html b/testing/web-platform/tests/web-bundle/subresource-loading/resource-timing-attributes-consistent.https.tentative.sub.html new file mode 100644 index 0000000000..3231d69ae9 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/resource-timing-attributes-consistent.https.tentative.sub.html @@ -0,0 +1,88 @@ + + + + Resource timing attributes are consistent for the same-origin subresources. + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/resource-timing.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/resource-timing.https.tentative.html new file mode 100644 index 0000000000..a2fe38de0f --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/resource-timing.https.tentative.html @@ -0,0 +1,55 @@ + + +Resource timing entries present for uuid-in-package resources + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/resources/check-cookie-and-return-bundle.py b/testing/web-platform/tests/web-bundle/subresource-loading/resources/check-cookie-and-return-bundle.py new file mode 100644 index 0000000000..0d4f14ecb7 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/resources/check-cookie-and-return-bundle.py @@ -0,0 +1,25 @@ +import os + + +def main(request, response): + origin = request.headers.get(b"origin") + + if origin is not None: + response.headers.set(b"Access-Control-Allow-Origin", origin) + response.headers.set(b"Access-Control-Allow-Methods", b"GET") + response.headers.set(b"Access-Control-Allow-Credentials", b"true") + + headers = [ + (b"Content-Type", b"application/webbundle"), + (b"X-Content-Type-Options", b"nosniff"), + ] + + cookie = request.cookies.first(b"milk", None) + if (cookie is not None) and cookie.value == b"1": + with open( + os.path.join(os.path.dirname(__file__), "../../resources/wbn/subresource.wbn"), + "rb", + ) as f: + return (200, headers, f.read()) + else: + return (400, [], "") diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/resources/service-worker-controlled-iframe.html b/testing/web-platform/tests/web-bundle/subresource-loading/resources/service-worker-controlled-iframe.html new file mode 100644 index 0000000000..c8b7661f42 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/resources/service-worker-controlled-iframe.html @@ -0,0 +1 @@ + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/resources/service-worker-for-request-monitor.js b/testing/web-platform/tests/web-bundle/subresource-loading/resources/service-worker-for-request-monitor.js new file mode 100644 index 0000000000..f67ac70686 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/resources/service-worker-for-request-monitor.js @@ -0,0 +1,12 @@ + +let request_urls = []; + +self.addEventListener('fetch', e => { + request_urls.push(e.request.url); + e.respondWith(fetch(e.request)); +}); + +self.addEventListener('message', e => { + e.source.postMessage(request_urls); + request_urls = []; +}); diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/reuse-web-bundle-resource.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/reuse-web-bundle-resource.https.tentative.html new file mode 100644 index 0000000000..81d87bcbf0 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/reuse-web-bundle-resource.https.tentative.html @@ -0,0 +1,329 @@ + +script type="webbundle" reuses webbundle resources + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/service-worker-controlled.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/service-worker-controlled.https.tentative.html new file mode 100644 index 0000000000..d5c2a06837 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/service-worker-controlled.https.tentative.html @@ -0,0 +1,138 @@ + + + Web Bundle fetching and the inner resouirce fetching should skip service + worker + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/static-element-with-base.https.tentative.sub.html b/testing/web-platform/tests/web-bundle/subresource-loading/static-element-with-base.https.tentative.sub.html new file mode 100644 index 0000000000..886d9cb783 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/static-element-with-base.https.tentative.sub.html @@ -0,0 +1,65 @@ + + + WebBundle subresource loading for static elements with a base element + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/static-element.https.tentative.sub.html b/testing/web-platform/tests/web-bundle/subresource-loading/static-element.https.tentative.sub.html new file mode 100644 index 0000000000..198c8f8e5c --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/static-element.https.tentative.sub.html @@ -0,0 +1,68 @@ + +WebBundle subresource loading for static elements + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/subframe-from-web-bundle.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/subframe-from-web-bundle.https.tentative.html new file mode 100644 index 0000000000..9e08ccdd29 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/subframe-from-web-bundle.https.tentative.html @@ -0,0 +1,134 @@ + +Subframe loading from Web Bundles + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/subresource-load.https.tentative.sub.html b/testing/web-platform/tests/web-bundle/subresource-loading/subresource-load.https.tentative.sub.html new file mode 100644 index 0000000000..10c207020c --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/subresource-load.https.tentative.sub.html @@ -0,0 +1,294 @@ + +Subresource loading with script type="webbundle" + + + + + + + + diff --git a/testing/web-platform/tests/web-bundle/subresource-loading/supports-webbundle.https.tentative.html b/testing/web-platform/tests/web-bundle/subresource-loading/supports-webbundle.https.tentative.html new file mode 100644 index 0000000000..9beae287a0 --- /dev/null +++ b/testing/web-platform/tests/web-bundle/subresource-loading/supports-webbundle.https.tentative.html @@ -0,0 +1,15 @@ + +HTMLScriptElement.supports webbundle + + + -- cgit v1.2.3