1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<!doctype html>
<title>setting members of worker.port</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup(() => {
window.worker = new SharedWorker('#', '');
});
test(() => {
worker.port.postMessage = 1;
assert_equals(worker.port.postMessage, 1);
}, 'postMessage');
test(() => {
worker.port.start = 1;
assert_equals(worker.port.start, 1);
}, 'start');
test(() => {
worker.port.close = 1;
assert_equals(worker.port.close, 1);
}, 'close');
test(() => {
const f = () => {};
worker.port.onmessage = f;
assert_equals(worker.port.onmessage, f, '() => {}');
worker.port.onmessage = 1;
assert_equals(worker.port.onmessage, null, '1');
worker.port.onmessage = f;
worker.port.onmessage = ';';
assert_equals(worker.port.onmessage, null, '";"');
worker.port.onmessage = f;
const handler = {handleEvent:() => {}};
worker.port.onmessage = handler;
assert_equals(worker.port.onmessage, handler, '{handleEvent:() => {}}');
worker.port.onmessage = f;
worker.port.onmessage = null;
assert_equals(worker.port.onmessage, null, 'null');
worker.port.onmessage = f;
worker.port.onmessage = undefined;
assert_equals(worker.port.onmessage, null, 'undefined');
}, 'onmessage');
test(() => {
worker.port.addEventListener = 1;
assert_equals(worker.port.addEventListener, 1);
}, 'addEventListener');
test(() => {
worker.port.removeEventListener = 1;
assert_equals(worker.port.removeEventListener, 1);
}, 'removeEventListener');
test(() => {
worker.port.despatchEvent = 1;
assert_equals(worker.port.despatchEvent, 1);
}, 'despatchEvent');
</script>
|