OLD | NEW |
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 Loading... |
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 Loading... |
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 })(); |
OLD | NEW |