<!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>
