summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html
blob: 5e78baa8de066e4cf6055ac147ed8b264000a1f3 (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
<!doctype html>
<meta charset=utf-8>
<title>
  When a listener from window A is added to an event target in window A via the
  addEventListener function from window A, errors in that listener should be
  reported to window A.
</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe></iframe>
<iframe></iframe>
<script>
test(function() {
  var f = new frames[1].Function("thereIsNoSuchCallable()");
  frames[1].document.addEventListener("myevent", f);
  var frame0ErrorFired = false;
  var frame1ErrorFired = false;
  var ourErrorFired = false;
  frames[0].addEventListener("error", function() {
    frame0ErrorFired = true;
  });
  frames[1].addEventListener("error", function() {
    frame1ErrorFired = true;
  });
  addEventListener("error", function() {
    ourErrorFired = true;
  });
  frames[1].document.dispatchEvent(new Event("myevent"));
  assert_false(frame0ErrorFired);
  assert_true(frame1ErrorFired);
  assert_false(ourErrorFired);
}, "The error event from an event listener should fire on that listener's global");
</script>