summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-event.html
blob: 2fdca3ad8601b1113b3d483415446ebdf860a9ef (plain)
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
<!DOCTYPE html>
<meta charset="utf-8">
<title>Event handlers processing algorithm: error events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">

<iframe name="framesetWindow" src="resources/frameset-frame.html"></iframe>
<div id="log"></div>

<script>
"use strict";
setup({ allow_uncaught_exception: true });

window.onload = () => {

const frameset = framesetWindow.document.querySelector("frameset");

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

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

  frameset.dispatchEvent(new Event("error", { bubbles: true, cancelable: true }));

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

};
</script>