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

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

Issue 1999243002: Import wpt@5df9b57edb3307a87d5187804b29c8ddd2aa14e1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add expectations files (using run-webkit-tests --new-baseline) Created 4 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset="UTF-8">
3 <title>Throwing in event listeners</title>
4 <script src="../../../../resources/testharness.js"></script>
5 <script src="../../../../resources/testharnessreport.js"></script>
6 <div id="log"></div>
7 <script>
8 setup({allow_uncaught_exception:true})
9
10 test(function() {
11 var errorEvents = 0;
12 window.onerror = this.step_func(function(e) {
13 assert_equals(typeof e, 'string');
14 ++errorEvents;
15 });
16
17 var element = document.createElement('div');
18
19 element.addEventListener('click', function() {
20 throw new Error('Error from only listener');
21 });
22
23 element.dispatchEvent(new Event('click'));
24
25 assert_equals(errorEvents, 1);
26 }, "Throwing in event listener with a single listeners");
27
28 test(function() {
29 var errorEvents = 0;
30 window.onerror = this.step_func(function(e) {
31 assert_equals(typeof e, 'string');
32 ++errorEvents;
33 });
34
35 var element = document.createElement('div');
36
37 var secondCalled = false;
38
39 element.addEventListener('click', function() {
40 throw new Error('Error from first listener');
41 });
42 element.addEventListener('click', this.step_func(function() {
43 secondCalled = true;
44 }), false);
45
46 element.dispatchEvent(new Event('click'));
47
48 assert_equals(errorEvents, 1);
49 assert_true(secondCalled);
50 }, "Throwing in event listener with multiple listeners");
51 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698