Skip to content

Commit 056a413

Browse files
authored
Add tests for SharedWorker constructor which error
1 parent 7ed6d48 commit 056a413

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<title>Test SharedWorker constructor functionality.</title>
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
<script>
6+
test(() => {
7+
assert_throws_js(Error,
8+
function() {
9+
new SharedWorker({toString:function(){throw new Error()}})},
10+
'toString exception should be propagated');
11+
}, 'Test toString propagation exception.');
12+
13+
test(() => {
14+
assert_throws_js(TypeError,
15+
function() { new SharedWorker(); },
16+
'invoking SharedWorker constructor without arguments should result ' +
17+
'in an exception.')
18+
}, 'Test Sharedworker creation with no arguments');
19+
20+
21+
test(() => {
22+
assert_throws_dom("SyntaxError",
23+
function() { var Sharedworker = new SharedWorker('http://invalid:123$'); },
24+
'Invoking SharedWorker constructor with invalid script URL should ' +
25+
'result in an exception.');
26+
}, 'Test invalid script URL.');
27+
28+
</script>

0 commit comments

Comments
 (0)