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
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 12 Apr 2016 13:15:53 -0400
changeset 316631 d5486d4fde026515df62c90d759baab1105b3b2c
parent 316630 3e73fc0dfb01e190959b396525586096f68853fb
child 316632 fb125ff927eae1b7adb8d0e3db798c341d71d8ab
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersms2ger
bugs1259784
milestone48.0a1
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
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-1.html
testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html
testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html
testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -35116,17 +35116,44 @@
         "timeout": "long",
         "url": "/webstorage/storage_session_setitem_quotaexceedederr.html"
       }
     ],
     "wdspec": []
   },
   "local_changes": {
     "deleted": [],
-    "items": {},
+    "items": {
+      "testharness": {
+        "html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-1.html": [
+          {
+            "path": "html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-1.html",
+            "url": "/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-1.html"
+          }
+        ],
+        "html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html": [
+          {
+            "path": "html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html",
+            "url": "/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html"
+          }
+        ],
+        "html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html": [
+          {
+            "path": "html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html",
+            "url": "/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html"
+          }
+        ],
+        "html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html": [
+          {
+            "path": "html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html",
+            "url": "/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html"
+          }
+        ]
+      }
+    },
     "reftest_nodes": {}
   },
   "reftest_nodes": {
     "2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [
       {
         "path": "2dcontext/building-paths/canvas_complexshapes_arcto_001.htm",
         "references": [
           [
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-1.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>
+  When a listener from window A is added to an event target in window B via the
+  addEventListener function from window B, 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[0].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_true(frame0ErrorFired);
+  assert_false(frame1ErrorFired);
+  assert_false(ourErrorFired);
+}, "The error event from an event listener should fire on that listener's global");
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>
+  When a listener from window A is added to an event target in window B 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[0].Function("thereIsNoSuchCallable()");
+  frames[0].document.addEventListener.call(frames[1].document, "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_true(frame0ErrorFired);
+  assert_false(frame1ErrorFired);
+  assert_false(ourErrorFired);
+}, "The error event from an event listener should fire on that listener's global");
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html
@@ -0,0 +1,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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html
@@ -0,0 +1,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 B, 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[0].document.addEventListener.call(frames[1].document, "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>