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

Side by Side Diff: src/promise.js

Issue 473803003: Fix PromiseHasRejectHandler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updated comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 "use strict"; 5 "use strict";
6 6
7 // This file relies on the fact that the following declaration has been made 7 // This file relies on the fact that the following declaration has been made
8 // in runtime.js: 8 // in runtime.js:
9 // var $Object = global.Object 9 // var $Object = global.Object
10 // var $WeakMap = global.WeakMap 10 // var $WeakMap = global.WeakMap
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 // Utility for debugger 326 // Utility for debugger
327 327
328 function PromiseHasRejectHandlerRecursive(promise) { 328 function PromiseHasRejectHandlerRecursive(promise) {
329 var queue = GET_PRIVATE(promise, promiseOnReject); 329 var queue = GET_PRIVATE(promise, promiseOnReject);
330 if (IS_UNDEFINED(queue)) return false; 330 if (IS_UNDEFINED(queue)) return false;
331 // Do a depth first search for a reject handler that's not 331 // Do a depth first search for a reject handler that's not
332 // the default PromiseIdRejectHandler. 332 // the default PromiseIdRejectHandler.
333 for (var i = 0; i < queue.length; i += 2) { 333 for (var i = 0; i < queue.length; i += 2) {
334 if (queue[i] != PromiseIdRejectHandler) return true; 334 if (queue[i] != PromiseIdRejectHandler) return true;
335 if (PromiseHasRejectHandlerRecursive(queue[i + 1])) return true; 335 if (PromiseHasRejectHandlerRecursive(queue[i + 1].promise)) return true;
336 } 336 }
337 return false; 337 return false;
338 } 338 }
339 339
340 PromiseHasRejectHandler = function PromiseHasRejectHandler() { 340 PromiseHasRejectHandler = function PromiseHasRejectHandler() {
341 // Mark promise as already having triggered a reject event. 341 // Mark promise as already having triggered a reject event.
342 SET_PRIVATE(this, promiseDebug, true); 342 SET_PRIVATE(this, promiseDebug, true);
343 return PromiseHasRejectHandlerRecursive(this); 343 return PromiseHasRejectHandlerRecursive(this);
344 }; 344 };
345 345
(...skipping 10 matching lines...) Expand all
356 "race", PromiseOne, 356 "race", PromiseOne,
357 "resolve", PromiseCast 357 "resolve", PromiseCast
358 ]); 358 ]);
359 InstallFunctions($Promise.prototype, DONT_ENUM, [ 359 InstallFunctions($Promise.prototype, DONT_ENUM, [
360 "chain", PromiseChain, 360 "chain", PromiseChain,
361 "then", PromiseThen, 361 "then", PromiseThen,
362 "catch", PromiseCatch 362 "catch", PromiseCatch
363 ]); 363 ]);
364 364
365 })(); 365 })();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698