summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/synthetic-errorevent-click.worker.js
blob: 177a99e2ce1d7f61c1fca5e2e87a9bc3dc6a1c9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"use strict";
importScripts("/resources/testharness.js");

setup({ allow_uncaught_exception: true });

promise_test(t => {
  self.onerror = t.step_func((...args) => {
    assert_equals(args.length, 1);
    return true;
  });

  const eventWatcher = new EventWatcher(t, self, "click");
  const promise = eventWatcher.wait_for("click").then(e => {
    assert_equals(e.defaultPrevented, false);
  });

  self.dispatchEvent(new ErrorEvent("click", { cancelable: true }));

  return promise;
}, "error event is normal (return true does not cancel; one arg) on WorkerGlobalScope, with a synthetic ErrorEvent");

done();