summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/workers/baseurl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/workers/baseurl
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/workers/baseurl')
-rw-r--r--testing/web-platform/tests/workers/baseurl/alpha/import-in-moduleworker.html14
-rw-r--r--testing/web-platform/tests/workers/baseurl/alpha/importScripts-in-sharedworker.html8
-rw-r--r--testing/web-platform/tests/workers/baseurl/alpha/importScripts-in-worker.html8
-rw-r--r--testing/web-platform/tests/workers/baseurl/alpha/sharedworker-in-worker.html14
-rw-r--r--testing/web-platform/tests/workers/baseurl/alpha/worker-in-worker.html14
-rw-r--r--testing/web-platform/tests/workers/baseurl/alpha/xhr-in-moduleworker.html14
-rw-r--r--testing/web-platform/tests/workers/baseurl/alpha/xhr-in-sharedworker.html8
-rw-r--r--testing/web-platform/tests/workers/baseurl/alpha/xhr-in-worker.html8
-rw-r--r--testing/web-platform/tests/workers/baseurl/beta/import.py3
-rw-r--r--testing/web-platform/tests/workers/baseurl/beta/importScripts.py3
-rw-r--r--testing/web-platform/tests/workers/baseurl/beta/script.js1
-rw-r--r--testing/web-platform/tests/workers/baseurl/beta/sharedworker.py3
-rw-r--r--testing/web-platform/tests/workers/baseurl/beta/subsharedworker.js3
-rw-r--r--testing/web-platform/tests/workers/baseurl/beta/subworker.js1
-rw-r--r--testing/web-platform/tests/workers/baseurl/beta/test.txt1
-rw-r--r--testing/web-platform/tests/workers/baseurl/beta/worker.py3
-rw-r--r--testing/web-platform/tests/workers/baseurl/beta/xhr-worker.py2
-rw-r--r--testing/web-platform/tests/workers/baseurl/beta/xhr.py3
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/import.js2
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/importScripts.js6
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/script-module.js1
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/script.js1
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/sharedworker.js4
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/subsharedworker.js3
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/subworker.js1
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/test.txt1
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/worker.js4
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/xhr-worker.js8
-rw-r--r--testing/web-platform/tests/workers/baseurl/gamma/xhr.js4
29 files changed, 146 insertions, 0 deletions
diff --git a/testing/web-platform/tests/workers/baseurl/alpha/import-in-moduleworker.html b/testing/web-platform/tests/workers/baseurl/alpha/import-in-moduleworker.html
new file mode 100644
index 0000000000..2c75dec9ce
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/alpha/import-in-moduleworker.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Base URL in module dedicated workers: import</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+async_test(function() {
+ var worker = new Worker("../beta/import.py", {type: "module"});
+ worker.onmessage = this.step_func_done(function(e) {
+ assert_equals(e.data, "gamma/script-module.js");
+ });
+ worker.onerror = this.unreached_func("Got error event");
+});
+</script>
diff --git a/testing/web-platform/tests/workers/baseurl/alpha/importScripts-in-sharedworker.html b/testing/web-platform/tests/workers/baseurl/alpha/importScripts-in-sharedworker.html
new file mode 100644
index 0000000000..6a4111c6c0
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/alpha/importScripts-in-sharedworker.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Base URL in classic shared workers: importScripts</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+fetch_tests_from_worker(new SharedWorker("../beta/importScripts.py"));
+</script>
diff --git a/testing/web-platform/tests/workers/baseurl/alpha/importScripts-in-worker.html b/testing/web-platform/tests/workers/baseurl/alpha/importScripts-in-worker.html
new file mode 100644
index 0000000000..55907bf423
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/alpha/importScripts-in-worker.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Base URL in classic dedicated workers: importScripts</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+fetch_tests_from_worker(new Worker("../beta/importScripts.py"));
+</script>
diff --git a/testing/web-platform/tests/workers/baseurl/alpha/sharedworker-in-worker.html b/testing/web-platform/tests/workers/baseurl/alpha/sharedworker-in-worker.html
new file mode 100644
index 0000000000..25d2582366
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/alpha/sharedworker-in-worker.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Base URL in workers: new SharedWorker()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+async_test(function() {
+ var worker = new Worker("../beta/sharedworker.py");
+ worker.onmessage = this.step_func_done(function(e) {
+ assert_equals(e.data, "gamma");
+ });
+ worker.onerror = this.unreached_func("Got error event");
+});
+</script>
diff --git a/testing/web-platform/tests/workers/baseurl/alpha/worker-in-worker.html b/testing/web-platform/tests/workers/baseurl/alpha/worker-in-worker.html
new file mode 100644
index 0000000000..284425ed34
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/alpha/worker-in-worker.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Base URL in workers: new Worker()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+async_test(function() {
+ var worker = new Worker("../beta/worker.py");
+ worker.onmessage = this.step_func_done(function(e) {
+ assert_equals(e.data, "gamma");
+ });
+ worker.onerror = this.unreached_func("Got error event");
+});
+</script>
diff --git a/testing/web-platform/tests/workers/baseurl/alpha/xhr-in-moduleworker.html b/testing/web-platform/tests/workers/baseurl/alpha/xhr-in-moduleworker.html
new file mode 100644
index 0000000000..7597a1357d
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/alpha/xhr-in-moduleworker.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Base URL in module dedicated workers: XHR</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+async_test(function() {
+ var worker = new Worker("../beta/xhr.py", {type: "module"});
+ worker.onmessage = this.step_func_done(function(e) {
+ assert_equals(e.data, "gamma\n");
+ });
+ worker.onerror = this.unreached_func("Got error event");
+});
+</script>
diff --git a/testing/web-platform/tests/workers/baseurl/alpha/xhr-in-sharedworker.html b/testing/web-platform/tests/workers/baseurl/alpha/xhr-in-sharedworker.html
new file mode 100644
index 0000000000..43921b898d
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/alpha/xhr-in-sharedworker.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Base URL in classic shared workers: XHR</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+fetch_tests_from_worker(new SharedWorker("../beta/xhr-worker.py"));
+</script>
diff --git a/testing/web-platform/tests/workers/baseurl/alpha/xhr-in-worker.html b/testing/web-platform/tests/workers/baseurl/alpha/xhr-in-worker.html
new file mode 100644
index 0000000000..bc58b9b2dd
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/alpha/xhr-in-worker.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Base URL in classic dedicated workers: XHR</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+fetch_tests_from_worker(new Worker("../beta/xhr-worker.py"));
+</script>
diff --git a/testing/web-platform/tests/workers/baseurl/beta/import.py b/testing/web-platform/tests/workers/baseurl/beta/import.py
new file mode 100644
index 0000000000..cea229dbf3
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/beta/import.py
@@ -0,0 +1,3 @@
+def main(request, response):
+ return (302, b"Moved"), [(b"Location", b"../gamma/import.js")], u"postMessage('executed redirecting script');"
+
diff --git a/testing/web-platform/tests/workers/baseurl/beta/importScripts.py b/testing/web-platform/tests/workers/baseurl/beta/importScripts.py
new file mode 100644
index 0000000000..688427d59d
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/beta/importScripts.py
@@ -0,0 +1,3 @@
+def main(request, response):
+ return (302, b"Moved"), [(b"Location", b"../gamma/importScripts.js")], u"postMessage('executed redirecting script');"
+
diff --git a/testing/web-platform/tests/workers/baseurl/beta/script.js b/testing/web-platform/tests/workers/baseurl/beta/script.js
new file mode 100644
index 0000000000..bef771ff9e
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/beta/script.js
@@ -0,0 +1 @@
+var result = 'beta/script.js';
diff --git a/testing/web-platform/tests/workers/baseurl/beta/sharedworker.py b/testing/web-platform/tests/workers/baseurl/beta/sharedworker.py
new file mode 100644
index 0000000000..bd6f70e7d9
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/beta/sharedworker.py
@@ -0,0 +1,3 @@
+def main(request, response):
+ return (302, b"Moved"), [(b"Location", b"../gamma/sharedworker.js")], u"postMessage('executed redirecting script');"
+
diff --git a/testing/web-platform/tests/workers/baseurl/beta/subsharedworker.js b/testing/web-platform/tests/workers/baseurl/beta/subsharedworker.js
new file mode 100644
index 0000000000..de6a8cacaf
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/beta/subsharedworker.js
@@ -0,0 +1,3 @@
+onconnect = function(e) {
+ e.source.postMessage('beta');
+}
diff --git a/testing/web-platform/tests/workers/baseurl/beta/subworker.js b/testing/web-platform/tests/workers/baseurl/beta/subworker.js
new file mode 100644
index 0000000000..997cecd6ce
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/beta/subworker.js
@@ -0,0 +1 @@
+postMessage("beta");
diff --git a/testing/web-platform/tests/workers/baseurl/beta/test.txt b/testing/web-platform/tests/workers/baseurl/beta/test.txt
new file mode 100644
index 0000000000..65b2df87f7
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/beta/test.txt
@@ -0,0 +1 @@
+beta
diff --git a/testing/web-platform/tests/workers/baseurl/beta/worker.py b/testing/web-platform/tests/workers/baseurl/beta/worker.py
new file mode 100644
index 0000000000..46db05efe5
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/beta/worker.py
@@ -0,0 +1,3 @@
+def main(request, response):
+ return (302, b"Moved"), [(b"Location", b"../gamma/worker.js")], u"postMessage('executed redirecting script');"
+
diff --git a/testing/web-platform/tests/workers/baseurl/beta/xhr-worker.py b/testing/web-platform/tests/workers/baseurl/beta/xhr-worker.py
new file mode 100644
index 0000000000..86c033b985
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/beta/xhr-worker.py
@@ -0,0 +1,2 @@
+def main(request, response):
+ return (302, b"Moved"), [(b"Location", b"../gamma/xhr-worker.js")], u"postMessage('executed redirecting script');"
diff --git a/testing/web-platform/tests/workers/baseurl/beta/xhr.py b/testing/web-platform/tests/workers/baseurl/beta/xhr.py
new file mode 100644
index 0000000000..11d6eb776a
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/beta/xhr.py
@@ -0,0 +1,3 @@
+def main(request, response):
+ return (302, b"Moved"), [(b"Location", b"../gamma/xhr.js")], u"postMessage('executed redirecting script');"
+
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/import.js b/testing/web-platform/tests/workers/baseurl/gamma/import.js
new file mode 100644
index 0000000000..1246913a84
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/import.js
@@ -0,0 +1,2 @@
+import r from "./script-module.js";
+postMessage(r);
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/importScripts.js b/testing/web-platform/tests/workers/baseurl/gamma/importScripts.js
new file mode 100644
index 0000000000..13820380a8
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/importScripts.js
@@ -0,0 +1,6 @@
+importScripts('/resources/testharness.js');
+importScripts("script.js");
+test(() => {
+ assert_equals(result, "gamma/script.js");
+});
+done();
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/script-module.js b/testing/web-platform/tests/workers/baseurl/gamma/script-module.js
new file mode 100644
index 0000000000..88d5f82db3
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/script-module.js
@@ -0,0 +1 @@
+export default 'gamma/script-module.js';
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/script.js b/testing/web-platform/tests/workers/baseurl/gamma/script.js
new file mode 100644
index 0000000000..0f9ce8eacf
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/script.js
@@ -0,0 +1 @@
+var result = 'gamma/script.js';
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/sharedworker.js b/testing/web-platform/tests/workers/baseurl/gamma/sharedworker.js
new file mode 100644
index 0000000000..d0718cfdef
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/sharedworker.js
@@ -0,0 +1,4 @@
+var worker = new SharedWorker("subsharedworker.js");
+worker.port.onmessage = function(e) {
+ postMessage(e.data);
+}
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/subsharedworker.js b/testing/web-platform/tests/workers/baseurl/gamma/subsharedworker.js
new file mode 100644
index 0000000000..e23602ff9c
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/subsharedworker.js
@@ -0,0 +1,3 @@
+onconnect = function(e) {
+ e.source.postMessage('gamma');
+}
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/subworker.js b/testing/web-platform/tests/workers/baseurl/gamma/subworker.js
new file mode 100644
index 0000000000..44407358e6
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/subworker.js
@@ -0,0 +1 @@
+postMessage("gamma");
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/test.txt b/testing/web-platform/tests/workers/baseurl/gamma/test.txt
new file mode 100644
index 0000000000..af17f6cc87
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/test.txt
@@ -0,0 +1 @@
+gamma
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/worker.js b/testing/web-platform/tests/workers/baseurl/gamma/worker.js
new file mode 100644
index 0000000000..8cfbcaef31
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/worker.js
@@ -0,0 +1,4 @@
+var worker = new Worker("subworker.js");
+worker.onmessage = function(e) {
+ postMessage(e.data);
+}
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/xhr-worker.js b/testing/web-platform/tests/workers/baseurl/gamma/xhr-worker.js
new file mode 100644
index 0000000000..a9d77827d9
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/xhr-worker.js
@@ -0,0 +1,8 @@
+importScripts('/resources/testharness.js');
+test(t => {
+ var x = new XMLHttpRequest();
+ x.open("GET", "test.txt", false);
+ x.send();
+ assert_equals(x.response, "gamma\n");
+});
+done();
diff --git a/testing/web-platform/tests/workers/baseurl/gamma/xhr.js b/testing/web-platform/tests/workers/baseurl/gamma/xhr.js
new file mode 100644
index 0000000000..70f331565a
--- /dev/null
+++ b/testing/web-platform/tests/workers/baseurl/gamma/xhr.js
@@ -0,0 +1,4 @@
+var x = new XMLHttpRequest();
+x.open("GET", "test.txt", false);
+x.send();
+postMessage(x.response);