author Boris Zbarsky <bzbarsky@mit.edu>
Tue, 12 Apr 2016 13:15:53 -0400
changeset 316631 d5486d4fde026515df62c90d759baab1105b3b2c
permissions -rw-r--r--
Bug 1259784. Add some web platform tests that ensure that error events are fired on the window an event listener comes from, even if it's attached to an event target in a different window, and no matter how it got there. r=ms2ger

<!doctype html>
<meta charset=utf-8>
  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.
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></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"));
}, "The error event from an event listener should fire on that listener's global");