summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/workers
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/workers')
-rw-r--r--testing/web-platform/tests/workers/Worker_cross_origin_security_err.htm12
-rw-r--r--testing/web-platform/tests/workers/constructors/SharedWorker/same-origin.html20
-rw-r--r--testing/web-platform/tests/workers/constructors/Worker/same-origin.html20
-rw-r--r--testing/web-platform/tests/workers/modules/dedicated-worker-import-failure.html9
4 files changed, 27 insertions, 34 deletions
diff --git a/testing/web-platform/tests/workers/Worker_cross_origin_security_err.htm b/testing/web-platform/tests/workers/Worker_cross_origin_security_err.htm
index 8417adbefd..a3e49df79a 100644
--- a/testing/web-platform/tests/workers/Worker_cross_origin_security_err.htm
+++ b/testing/web-platform/tests/workers/Worker_cross_origin_security_err.htm
@@ -6,26 +6,16 @@
<div id=log></div>
<script>
async_test(function(t) {
- try {
var w = new Worker("ftp://example.org/support/WorkerBasic.js");
w.onerror = t.step_func_done(function(e) {
assert_true(e instanceof Event);
});
- } catch (e) {
- assert_throws_dom("SecurityError", () => {throw e}, "DOMExceptions thrown on cross-origin Worker construction must be SecurityErrors");
- t.done();
- }
-}, "Cross-origin classic workers should fail to fetch");
+ }, "Cross-origin classic workers should fail to fetch");
async_test(function(t) {
- try {
var w = new Worker("ftp://example.org/support/WorkerBasic.js", {type: "module"});
w.onerror = t.step_func_done(function(e) {
assert_true(e instanceof Event);
});
- } catch (e) {
- assert_throws_dom("SecurityError", () => {throw e}, "DOMExceptions thrown on cross-origin module Worker construction must be SecurityErrors");
- t.done();
- }
}, "Cross-origin module workers should fail to fetch");
</script>
diff --git a/testing/web-platform/tests/workers/constructors/SharedWorker/same-origin.html b/testing/web-platform/tests/workers/constructors/SharedWorker/same-origin.html
index 0bfc503d06..4f1b62a660 100644
--- a/testing/web-platform/tests/workers/constructors/SharedWorker/same-origin.html
+++ b/testing/web-platform/tests/workers/constructors/SharedWorker/same-origin.html
@@ -10,19 +10,19 @@
setup({allow_uncaught_exception: true});
testSharedWorkerHelper = (t, script) => {
- try {
- const worker = new SharedWorker(script, '');
- worker.onerror = t.step_func_done(e => {
- assert_true(e instanceof Event);
- });
- } catch (e) {
- assert_throws_dom("SecurityError", () => {throw e}, "DOMExceptions thrown on cross-origin SharedWorker construction must be SecurityErrors");
- t.done();
- }
+ const worker = new SharedWorker(script, '');
+ worker.onerror = t.step_func_done(e => {
+ assert_true(e instanceof Event);
+ });
}
test(() => {
- assert_throws_dom("SecurityError", () => { new SharedWorker('unsupported:', ''); });
+ assert_throws_dom("SyntaxError", () => { new SharedWorker('https://test:test', ''); });
+}, "non-parsable URL");
+
+async_test(t => {
+ // Parses fine as a URL, fails to fetch according to Fetch
+ testSharedWorkerHelper(t, 'unsupported:');
}, "unsupported_scheme");
async_test(t => {
diff --git a/testing/web-platform/tests/workers/constructors/Worker/same-origin.html b/testing/web-platform/tests/workers/constructors/Worker/same-origin.html
index cdc36c1718..56dbfe3b3f 100644
--- a/testing/web-platform/tests/workers/constructors/Worker/same-origin.html
+++ b/testing/web-platform/tests/workers/constructors/Worker/same-origin.html
@@ -12,19 +12,19 @@
setup({allow_uncaught_exception: true});
function testWorkerHelper(t, script) {
- try {
- var worker = new Worker(script);
- worker.onerror = t.step_func_done(function(e) {
- assert_true(e instanceof Event);
- });
- } catch (e) {
- assert_throws_dom("SecurityError", () => {throw e}, "DOMExceptions thrown on cross-origin Worker construction must be SecurityErrors");
- t.done();
- }
+ var worker = new Worker(script);
+ worker.onerror = t.step_func_done(function(e) {
+ assert_true(e instanceof Event);
+ });
}
test(function() {
- assert_throws_dom("SecurityError", function() { new Worker('unsupported:'); });
+ assert_throws_dom("SyntaxError", function() { new Worker('https://test:test'); });
+}, "non-parsable URL");
+
+async_test(function(t) {
+ // Parses fine as a URL, fails to fetch according to Fetch
+ testWorkerHelper(t, 'unsupported:');
}, "unsupported_scheme");
async_test(function() {
diff --git a/testing/web-platform/tests/workers/modules/dedicated-worker-import-failure.html b/testing/web-platform/tests/workers/modules/dedicated-worker-import-failure.html
index 4c705e7325..d4e104760e 100644
--- a/testing/web-platform/tests/workers/modules/dedicated-worker-import-failure.html
+++ b/testing/web-platform/tests/workers/modules/dedicated-worker-import-failure.html
@@ -46,9 +46,12 @@ test(() => {
assert_throws_dom('SyntaxError', () => new Worker(scriptURL, { type: 'module' }));
}, 'Worker construction for an invalid URL should throw an exception.');
-test(() => {
+async_test((t) => {
const scriptURL = 'file:///static-import-worker.js';
- assert_throws_dom('SecurityError', () => new Worker(scriptURL, { type: 'module' }));
-}, 'Worker construction for a file URL should throw an exception.');
+ const worker = new Worker(scriptURL, { type: 'module' });
+ worker.onerror = t.step_func_done(function(e) {
+ assert_true(e instanceof Event);
+ });
+}, 'Worker construction for a file URL should fail');
</script>