Chromium Code Reviews| 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 (function(global, utils, extrasUtils) { | 5 (function(global, utils, extrasUtils) { |
| 6 | 6 |
| 7 "use strict"; | 7 "use strict"; |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 %PromiseFulfill(promise, kFulfilled, resolution, | 297 %PromiseFulfill(promise, kFulfilled, resolution, |
| 298 promiseFulfillReactionsSymbol); | 298 promiseFulfillReactionsSymbol); |
| 299 PromiseSet(promise, kFulfilled, resolution); | 299 PromiseSet(promise, kFulfilled, resolution); |
| 300 } | 300 } |
| 301 | 301 |
| 302 // ES#sec-rejectpromise | 302 // ES#sec-rejectpromise |
| 303 // RejectPromise ( promise, reason ) | 303 // RejectPromise ( promise, reason ) |
| 304 function RejectPromise(promise, reason, debugEvent) { | 304 function RejectPromise(promise, reason, debugEvent) { |
| 305 // Check promise status to confirm that this reject has an effect. | |
| 306 // Call runtime for callbacks to the debugger or for unhandled reject. | 305 // Call runtime for callbacks to the debugger or for unhandled reject. |
| 307 // The debugEvent parameter sets whether a debug ExceptionEvent should | 306 // The debugEvent parameter sets whether a debug ExceptionEvent should |
| 308 // be triggered. It should be set to false when forwarding a rejection | 307 // be triggered. It should be set to false when forwarding a rejection |
| 309 // rather than creating a new one. | 308 // rather than creating a new one. |
| 310 if (GET_PRIVATE(promise, promiseStateSymbol) === kPending) { | 309 // This check is redundant with checks in the runtime, but it may help |
| 311 // This check is redundant with checks in the runtime, but it may help | 310 // avoid unnecessary runtime calls. |
| 312 // avoid unnecessary runtime calls. | 311 if ((debugEvent && DEBUG_IS_ACTIVE) || |
| 313 if ((debugEvent && DEBUG_IS_ACTIVE) || | 312 !HAS_DEFINED_PRIVATE(promise, promiseHasHandlerSymbol)) { |
| 314 !HAS_DEFINED_PRIVATE(promise, promiseHasHandlerSymbol)) { | |
| 315 %PromiseRejectEvent(promise, reason, debugEvent); | 313 %PromiseRejectEvent(promise, reason, debugEvent); |
|
adamk
2016/10/26 12:05:00
Nit: indentation is off.
| |
| 316 } | |
| 317 } | 314 } |
| 318 %PromiseFulfill(promise, kRejected, reason, promiseRejectReactionsSymbol) | 315 %PromiseFulfill(promise, kRejected, reason, promiseRejectReactionsSymbol) |
| 319 PromiseSet(promise, kRejected, reason); | 316 PromiseSet(promise, kRejected, reason); |
| 320 } | 317 } |
| 321 | 318 |
| 322 // Export to bindings | 319 // Export to bindings |
| 323 function DoRejectPromise(promise, reason) { | 320 function DoRejectPromise(promise, reason) { |
| 324 return RejectPromise(promise, reason, true); | 321 return RejectPromise(promise, reason, true); |
| 325 } | 322 } |
| 326 | 323 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 to.PromiseThen = PromiseThen; | 667 to.PromiseThen = PromiseThen; |
| 671 | 668 |
| 672 to.GlobalPromise = GlobalPromise; | 669 to.GlobalPromise = GlobalPromise; |
| 673 to.NewPromiseCapability = NewPromiseCapability; | 670 to.NewPromiseCapability = NewPromiseCapability; |
| 674 to.PerformPromiseThen = PerformPromiseThen; | 671 to.PerformPromiseThen = PerformPromiseThen; |
| 675 to.ResolvePromise = ResolvePromise; | 672 to.ResolvePromise = ResolvePromise; |
| 676 to.RejectPromise = RejectPromise; | 673 to.RejectPromise = RejectPromise; |
| 677 }); | 674 }); |
| 678 | 675 |
| 679 }) | 676 }) |
| OLD | NEW |