summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/web-bundle/resources
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/web-bundle/resources')
-rw-r--r--testing/web-platform/tests/web-bundle/resources/check-accept-header-and-return-bundle.py21
-rw-r--r--testing/web-platform/tests/web-bundle/resources/check-cookie-and-return-bundle.py29
-rw-r--r--testing/web-platform/tests/web-bundle/resources/check-sec-fetch-dest-header-and-return-bundle.py21
-rw-r--r--testing/web-platform/tests/web-bundle/resources/corp.har140
-rw-r--r--testing/web-platform/tests/web-bundle/resources/cross-origin-no-cors.har48
-rw-r--r--testing/web-platform/tests/web-bundle/resources/cross-origin.har48
-rw-r--r--testing/web-platform/tests/web-bundle/resources/dynamic1/classic_script.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/dynamic1/resource1.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/dynamic1/resource2.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/dynamic1/resource3.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/dynamic1/resource4.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/dynamic2/classic_script.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/dynamic2/resource1.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/dynamic2/resource2.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/dynamic2/resource3.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/dynamic2/resource4.js1
-rwxr-xr-xtesting/web-platform/tests/web-bundle/resources/generate-test-wbns.sh105
-rw-r--r--testing/web-platform/tests/web-bundle/resources/location/location.html2
-rw-r--r--testing/web-platform/tests/web-bundle/resources/location/location.js2
-rw-r--r--testing/web-platform/tests/web-bundle/resources/nested/nested-sub.wbnbin0 -> 3395 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/nested/resource.js0
-rw-r--r--testing/web-platform/tests/web-bundle/resources/non-utf8-query-encoding.har25
-rw-r--r--testing/web-platform/tests/web-bundle/resources/path-restriction/other/resource.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/path-restriction/resource.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/path-restriction/wbn-resource.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/path-restriction/wbn/resource.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/path-restriction/wbn/sub/resource.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/path-restriction/wbn1/resource.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/relative-url.har139
-rw-r--r--testing/web-platform/tests/web-bundle/resources/simple-cross-origin.har29
-rw-r--r--testing/web-platform/tests/web-bundle/resources/static-element/out-of-scope/script.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/static-element/resources/script.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/static-element/resources/style-imported-from-file.css3
-rw-r--r--testing/web-platform/tests/web-bundle/resources/static-element/resources/style-imported-from-tag.css3
-rw-r--r--testing/web-platform/tests/web-bundle/resources/static-element/resources/style.css5
-rw-r--r--testing/web-platform/tests/web-bundle/resources/static-element/scopes/script.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/static-element/scopes/style-imported-from-file.css3
-rw-r--r--testing/web-platform/tests/web-bundle/resources/static-element/scopes/style-imported-from-tag.css3
-rw-r--r--testing/web-platform/tests/web-bundle/resources/static-element/scopes/style.css5
-rw-r--r--testing/web-platform/tests/web-bundle/resources/subresource/fail.pngbin0 -> 759 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/subresource/pass.pngbin0 -> 1689 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/subresource/root.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/subresource/submodule.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/test-helpers.js169
-rw-r--r--testing/web-platform/tests/web-bundle/resources/uuid-in-package.har44
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/__dir__.headers2
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/cors/__dir__.sub.headers4
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/cors/corp.wbnbin0 -> 1491 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin-b2.wbnbin0 -> 423 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin.wbnbin0 -> 423 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/dynamic/__dir__.headers1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/dynamic/classic_script.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource1.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource2.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource3.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/dynamic/resource4.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/dynamic1-crossorigin.wbnbin0 -> 1498 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/dynamic1.wbnbin0 -> 1473 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/dynamic2.wbnbin0 -> 1473 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/location.wbnbin0 -> 681 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/nested-main.wbnbin0 -> 3964 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/no-cors/__dir__.headers2
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin-b2.wbnbin0 -> 429 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin.wbnbin0 -> 429 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/non-utf8-query-encoding.wbnbin0 -> 376 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/path-restriction.wbnbin0 -> 1737 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbnbin0 -> 1093 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbn.sub.headers3
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/simple-cross-origin.wbnbin0 -> 246 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/static-element.wbnbin0 -> 2940 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/static-element/out-of-scope/script.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/script.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style-imported-from-file.css3
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style-imported-from-tag.css3
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/static-element/resources/style.css5
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/script.js1
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style-imported-from-file.css3
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style-imported-from-tag.css3
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/static-element/scopes/style.css5
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/subresource.wbnbin0 -> 3395 bytes
-rw-r--r--testing/web-platform/tests/web-bundle/resources/wbn/uuid-in-package.wbnbin0 -> 397 bytes
81 files changed, 907 insertions, 0 deletions
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": "<script>\nwindow.addEventListener('message', (e) =>{e.source.postMessage(eval(e.data), e.origin);});\n</script>"
+ }
+ }
+ },
+ {
+ "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": "<script>\nwindow.addEventListener('message', (e) =>{e.source.postMessage(eval(e.data), e.origin);});\n</script>"
+ }
+ }
+ },
+ {
+ "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": "<script>\nwindow.addEventListener('message', (e) =>{e.source.postMessage(eval(e.data), e.origin);});\n</script>"
+ }
+ }
+ }
+ ]
+ }
+}
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 @@
+<!DOCTYPE html>
+<script src="./location.js"></script>
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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/nested/nested-sub.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/nested/resource.js
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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/subresource/fail.png
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/subresource/pass.png
Binary files 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..5c380c88d8
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/test-helpers.js
@@ -0,0 +1,169 @@
+// 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);
+}
+
+function changeWebBundleUrlInPlace(element, new_url) {
+ if (window.TEST_WEB_BUNDLE_ELEMENT_TYPE != 'link') {
+ throw new Error(
+ 'Changing the URL of web bundle is not supported for : ' +
+ window.TEST_WEB_BUNDLE_ELEMENT_TYPE);
+ }
+ element.href= new_url;
+}
+
+function changeWebBundleScopesInPlace(element, scopes) {
+ if (window.TEST_WEB_BUNDLE_ELEMENT_TYPE != 'link') {
+ throw new Error(
+ 'Changing the scopes of web bundle is not supported for : ' +
+ window.TEST_WEB_BUNDLE_ELEMENT_TYPE);
+ }
+ element.scopes = '';
+ for (const scope of scopes) {
+ element.scopes.add(scope);
+ }
+}
+
+function changeWebBundleResourcesInPlace(element, resources) {
+ if (window.TEST_WEB_BUNDLE_ELEMENT_TYPE != 'link') {
+ throw new Error(
+ 'Changing the resources of web bundle is not supported for : ' +
+ window.TEST_WEB_BUNDLE_ELEMENT_TYPE);
+ }
+ element.resources = '';
+ for (const url of resources) {
+ element.resources.add(url);
+ }
+}
+
+// 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|, in case of <link> API it is all
+// relevant attributes: href, resources, scopes and crossOrigin;
+// in case of <script> API, it is: 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) {
+ if (window.TEST_WEB_BUNDLE_ELEMENT_TYPE == 'link') {
+ if (element.resources && !new_rule.resources)
+ new_rule.resources = Array.from(element.resources);
+ if (element.scopes && !new_rule.scopes)
+ new_rule.scopes = Array.from(element.scopes);
+ if (element.crossOrigin && !new_rule.crossOrigin)
+ new_rule.crossOrigin = element.crossOrigin;
+ if (!new_rule.url)
+ new_rule.url = element.href;
+ } else {
+ 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": "<script>\nwindow.addEventListener('message', (e) =>{e.source.postMessage(eval(e.data), e.origin);});\n</script>"
+ }
+ }
+ }
+ ]
+ }
+}
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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/cors/corp.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin-b2.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/cors/cross-origin.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic1-crossorigin.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic1.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/dynamic2.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/location.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/nested-main.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin-b2.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/no-cors/cross-origin.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/non-utf8-query-encoding.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/path-restriction.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/relative-url.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/simple-cross-origin.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/static-element.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/subresource.wbn
Binary files 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
--- /dev/null
+++ b/testing/web-platform/tests/web-bundle/resources/wbn/uuid-in-package.wbn
Binary files differ