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

Unified Diff: src/promise.js

Issue 461023002: Ignore default reject handler when looking for reject handlers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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: src/promise.js
diff --git a/src/promise.js b/src/promise.js
index 2d8314a42fa5d8d5b0ec05638efec2d9a5ccbf03..bbc832d0f446cc62372e1ba3b883b3786bb70058 100644
--- a/src/promise.js
+++ b/src/promise.js
@@ -324,12 +324,23 @@ var lastMicrotaskId = 0;
// Utility for debugger
+
+ function PromiseHasRejectHandlerRecursive(promise) {
+ var queue = GET_PRIVATE(promise, promiseOnReject);
+ if (IS_UNDEFINED(queue)) return false;
+ // Do a depth first search for a reject handler that's not
+ // the default PromiseIdRejectHandler.
+ for (var i = 0; i < queue.length; i += 2) {
+ if (queue[i] != PromiseIdRejectHandler) return true;
+ if (PromiseHasRejectHandlerRecursive(queue[i + 1])) return true;
+ }
+ return false;
+ }
PromiseHasRejectHandler = function PromiseHasRejectHandler() {
// Mark promise as already having triggered a reject event.
SET_PRIVATE(this, promiseDebug, true);
- var queue = GET_PRIVATE(this, promiseOnReject);
- return !IS_UNDEFINED(queue) && queue.length > 0;
+ return PromiseHasRejectHandlerRecursive(this);
};
// -------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698