Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 | 211 |
| 212 // We pass true to trigger the debugger's on exception handler. | 212 // We pass true to trigger the debugger's on exception handler. |
| 213 extrasUtils.rejectPromise = function rejectPromise(promise, reason) { | 213 extrasUtils.rejectPromise = function rejectPromise(promise, reason) { |
| 214 %promise_internal_reject(promise, reason, true); | 214 %promise_internal_reject(promise, reason, true); |
| 215 } | 215 } |
| 216 | 216 |
| 217 extrasUtils.markPromiseAsHandled = function markPromiseAsHandled(promise) { | 217 extrasUtils.markPromiseAsHandled = function markPromiseAsHandled(promise) { |
| 218 %PromiseMarkAsHandled(promise); | 218 %PromiseMarkAsHandled(promise); |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 extrasUtils.promiseState = function promiseState(promise) { | |
| 222 return %PromiseStatus(promise); | |
|
Dan Ehrenberg
2017/03/30 12:05:53
Is it OK for V8 extras to crash when not-a-promise
| |
| 223 }; | |
| 224 | |
| 225 // [[PromiseState]] values (for extrasUtils.promiseState()) | |
| 226 // These values should be kept in sync with PromiseStatus in globals.h | |
| 227 extrasUtils.kPROMISE_PENDING = 0; | |
| 228 extrasUtils.kPROMISE_FULFILLED = 1; | |
| 229 extrasUtils.kPROMISE_REJECTED = 2; | |
| 230 | |
| 221 %ToFastProperties(extrasUtils); | 231 %ToFastProperties(extrasUtils); |
| 222 | 232 |
| 223 }) | 233 }) |
| OLD | NEW |