summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/workers/semantics/xhr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/workers/semantics/xhr
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/workers/semantics/xhr')
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/001-1.xml1
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/001.html16
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/001.js13
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/002.html16
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/002.js9
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/003.html16
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/003.js17
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/004.html16
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/004.js11
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/005.html21
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/006.html21
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/support/001-1.xml1
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/support/005-1.js5
-rw-r--r--testing/web-platform/tests/workers/semantics/xhr/support/006-1.js7
14 files changed, 170 insertions, 0 deletions
diff --git a/testing/web-platform/tests/workers/semantics/xhr/001-1.xml b/testing/web-platform/tests/workers/semantics/xhr/001-1.xml
new file mode 100644
index 0000000000..5d735bdf61
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/001-1.xml
@@ -0,0 +1 @@
+<x>foo</x> \ No newline at end of file
diff --git a/testing/web-platform/tests/workers/semantics/xhr/001.html b/testing/web-platform/tests/workers/semantics/xhr/001.html
new file mode 100644
index 0000000000..da59f5ac2d
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/001.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>async XMLHttpRequest in dedicated worker</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+var t = async_test();
+function runtest() {
+ var worker = new Worker('001.js');
+ worker.onmessage = this.step_func(function(e) {
+ assert_equals(e.data, '');
+ this.done();
+ });
+}
+</script>
+<iframe src=001-1.xml onload="t.step(runtest);"></iframe> \ No newline at end of file
diff --git a/testing/web-platform/tests/workers/semantics/xhr/001.js b/testing/web-platform/tests/workers/semantics/xhr/001.js
new file mode 100644
index 0000000000..1cbe98ba47
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/001.js
@@ -0,0 +1,13 @@
+var xhr = new XMLHttpRequest();
+var log = '';
+xhr.onreadystatechange = function(e) {
+ if (this.readyState == 4) {
+ if (this.responseXML != null)
+ log += 'responseXML was not null. ';
+ if (this.responseText != '<x>foo</x>')
+ log += 'responseText was ' + this.responseText + ', expected <x>foo</x>. ';
+ postMessage(log);
+ }
+}
+xhr.open('GET', '001-1.xml', true);
+xhr.send(); \ No newline at end of file
diff --git a/testing/web-platform/tests/workers/semantics/xhr/002.html b/testing/web-platform/tests/workers/semantics/xhr/002.html
new file mode 100644
index 0000000000..60c0e161cc
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/002.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>sync XMLHttpRequest in dedicated worker</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+var t = async_test();
+function runtest() {
+ var worker = new Worker('002.js');
+ worker.onmessage = this.step_func(function(e) {
+ assert_equals(e.data, '');
+ this.done();
+ });
+}
+</script>
+<iframe src=001-1.xml onload="t.step(runtest);"></iframe> \ No newline at end of file
diff --git a/testing/web-platform/tests/workers/semantics/xhr/002.js b/testing/web-platform/tests/workers/semantics/xhr/002.js
new file mode 100644
index 0000000000..68d7e91d45
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/002.js
@@ -0,0 +1,9 @@
+var xhr = new XMLHttpRequest();
+var log = '';
+xhr.open('GET', '001-1.xml', false);
+xhr.send();
+if (xhr.responseXML != null)
+ log += 'responseXML was not null. ';
+if (xhr.responseText != '<x>foo</x>')
+ log += 'responseText was ' + this.responseText + ', expected <x>foo</x>. ';
+postMessage(log); \ No newline at end of file
diff --git a/testing/web-platform/tests/workers/semantics/xhr/003.html b/testing/web-platform/tests/workers/semantics/xhr/003.html
new file mode 100644
index 0000000000..e3ce36b82c
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/003.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>async XMLHttpRequest in shared worker</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+var t = async_test();
+function runtest() {
+ var worker = new SharedWorker('003.js', '');
+ worker.port.onmessage = this.step_func(function(e) {
+ assert_equals(e.data, '');
+ this.done();
+ });
+}
+</script>
+<iframe src=001-1.xml onload="t.step(runtest);"></iframe>
diff --git a/testing/web-platform/tests/workers/semantics/xhr/003.js b/testing/web-platform/tests/workers/semantics/xhr/003.js
new file mode 100644
index 0000000000..1a9c5a7ee8
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/003.js
@@ -0,0 +1,17 @@
+onconnect = function(e) {
+ var xhr = new XMLHttpRequest();
+ var log = '';
+ var port = e.ports[0];
+ var postMessage = port.postMessage;
+ xhr.onreadystatechange = function(e) {
+ if (this.readyState == 4) {
+ if (this.responseXML != null)
+ log += 'responseXML was not null. ';
+ if (this.responseText && this.responseText != '<x>foo</x>')
+ log += 'responseText was ' + this.responseText + ', expected <x>foo</x>. ';
+ postMessage.call(port, log);
+ }
+ }
+ xhr.open('GET', '001-1.xml', true);
+ xhr.send();
+}
diff --git a/testing/web-platform/tests/workers/semantics/xhr/004.html b/testing/web-platform/tests/workers/semantics/xhr/004.html
new file mode 100644
index 0000000000..d11e3dbc1b
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/004.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>sync XMLHttpRequest in shared worker</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+var t = async_test();
+function runtest() {
+ var worker = new SharedWorker('004.js', '');
+ worker.port.onmessage = this.step_func(function(e) {
+ assert_equals(e.data, '');
+ this.done();
+ });
+}
+</script>
+<iframe src=001-1.xml onload="t.step(runtest);"></iframe>
diff --git a/testing/web-platform/tests/workers/semantics/xhr/004.js b/testing/web-platform/tests/workers/semantics/xhr/004.js
new file mode 100644
index 0000000000..1741c8d36a
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/004.js
@@ -0,0 +1,11 @@
+onconnect = function(e) {
+ var xhr = new XMLHttpRequest();
+ var log = '';
+ xhr.open('GET', '001-1.xml', false);
+ xhr.send();
+ if (xhr.responseXML != null)
+ log += 'responseXML was not null. ';
+ if (xhr.responseText != '<x>foo</x>')
+ log += 'responseText was ' + xhr.responseText + ', expected <x>foo</x>. ';
+ e.ports[0].postMessage(log);
+}
diff --git a/testing/web-platform/tests/workers/semantics/xhr/005.html b/testing/web-platform/tests/workers/semantics/xhr/005.html
new file mode 100644
index 0000000000..84abdb0c42
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/005.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<title>base url, dedicated worker</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+var t = async_test();
+var i = 0;
+function runtest() {
+ i++;
+ if (i != 2)
+ return;
+ var worker = new Worker('support/005-1.js');
+ worker.onmessage = this.step_func(function(e) {
+ assert_true(e.data);
+ this.done();
+ });
+}
+</script>
+<iframe src=001-1.xml onload="t.step(runtest);"></iframe>
+<iframe src=support/001-1.xml onload="t.step(runtest);"></iframe>
diff --git a/testing/web-platform/tests/workers/semantics/xhr/006.html b/testing/web-platform/tests/workers/semantics/xhr/006.html
new file mode 100644
index 0000000000..7411b4baef
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/006.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<title>base url, shared worker</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+var t = async_test();
+var i = 0;
+function runtest() {
+ i++;
+ if (i != 2)
+ return;
+ var worker = new SharedWorker('support/006-1.js','');
+ worker.port.onmessage = this.step_func(function(e) {
+ assert_true(e.data);
+ this.done();
+ });
+}
+</script>
+<iframe src=001-1.xml onload="t.step(runtest);"></iframe>
+<iframe src=support/001-1.xml onload="t.step(runtest);"></iframe>
diff --git a/testing/web-platform/tests/workers/semantics/xhr/support/001-1.xml b/testing/web-platform/tests/workers/semantics/xhr/support/001-1.xml
new file mode 100644
index 0000000000..ecea58a935
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/support/001-1.xml
@@ -0,0 +1 @@
+<x>bar</x> \ No newline at end of file
diff --git a/testing/web-platform/tests/workers/semantics/xhr/support/005-1.js b/testing/web-platform/tests/workers/semantics/xhr/support/005-1.js
new file mode 100644
index 0000000000..45f6519a21
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/support/005-1.js
@@ -0,0 +1,5 @@
+var xhr = new XMLHttpRequest();
+xhr.open('GET', '001-1.xml', false);
+xhr.send();
+var passed = xhr.responseText == '<x>bar</x>';
+postMessage(passed); \ No newline at end of file
diff --git a/testing/web-platform/tests/workers/semantics/xhr/support/006-1.js b/testing/web-platform/tests/workers/semantics/xhr/support/006-1.js
new file mode 100644
index 0000000000..d446781eb7
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/xhr/support/006-1.js
@@ -0,0 +1,7 @@
+onconnect = function(e) {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', '001-1.xml', false);
+ xhr.send();
+ var passed = xhr.responseText == '<x>bar</x>';
+ e.ports[0].postMessage(passed);
+} \ No newline at end of file