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

Unified Diff: LayoutTests/fast/dom/promise-rejection-events-onerror.html

Issue 1179113007: Implement onunhandledrejection / onrejectionhandled events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: updates Created 5 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/dom/promise-rejection-events-onerror.html
diff --git a/LayoutTests/fast/dom/promise-rejection-events-onerror.html b/LayoutTests/fast/dom/promise-rejection-events-onerror.html
new file mode 100644
index 0000000000000000000000000000000000000000..43c17e5ef511a1ad867b94c9bf0d6e78cd9f6416
--- /dev/null
+++ b/LayoutTests/fast/dom/promise-rejection-events-onerror.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+'use strict';
+setup({
+ allow_uncaught_exception: true
+});
+async_test(function(t) {
+ var e = new Error('e');
+ var e2 = new Error('e2');
+ window.onerror = function (msg, url, line, col, error) {
+ t.step(function() {
+ assert_equals(msg, 'Uncaught Error: e2');
+ assert_equals(error, e2);
+ });
+ t.done();
+ };
+ window.onrejectionhandled = function() {
+ throw e2;
+ };
+ var p = Promise.reject(e);
+ setTimeout(function() {
+ try {
+ p.catch(function() {});
+ } catch (e) {
+ assert_unreached('attaching a handler should not throw an error');
+ }
+ }, 1);
+}, 'Throwing inside an unhandledrejection handler invokes the error handler.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698