Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/dom/events/Event-dispatch-throwing.html

Issue 2015623004: Import wpt@ed94c51f3dfaa5ff4c9c311add1a560408059c51 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/dom/events/Event-dispatch-throwing.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/dom/events/Event-dispatch-throwing.html b/third_party/WebKit/LayoutTests/imported/wpt/dom/events/Event-dispatch-throwing.html
new file mode 100644
index 0000000000000000000000000000000000000000..eed1cb28f84e3ffda26d62090909951204a37462
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/dom/events/Event-dispatch-throwing.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>Throwing in event listeners</title>
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+setup({allow_uncaught_exception:true})
+
+test(function() {
+ var errorEvents = 0;
+ window.onerror = this.step_func(function(e) {
+ assert_equals(typeof e, 'string');
+ ++errorEvents;
+ });
+
+ var element = document.createElement('div');
+
+ element.addEventListener('click', function() {
+ throw new Error('Error from only listener');
+ });
+
+ element.dispatchEvent(new Event('click'));
+
+ assert_equals(errorEvents, 1);
+}, "Throwing in event listener with a single listeners");
+
+test(function() {
+ var errorEvents = 0;
+ window.onerror = this.step_func(function(e) {
+ assert_equals(typeof e, 'string');
+ ++errorEvents;
+ });
+
+ var element = document.createElement('div');
+
+ var secondCalled = false;
+
+ element.addEventListener('click', function() {
+ throw new Error('Error from first listener');
+ });
+ element.addEventListener('click', this.step_func(function() {
+ secondCalled = true;
+ }), false);
+
+ element.dispatchEvent(new Event('click'));
+
+ assert_equals(errorEvents, 1);
+ assert_true(secondCalled);
+}, "Throwing in event listener with multiple listeners");
+</script>

Powered by Google App Engine
This is Rietveld 408576698