| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 %PromiseRevokeReject(resolution); | 271 %PromiseRevokeReject(resolution); |
| 272 } | 272 } |
| 273 RejectPromise(promise, thenableValue); | 273 RejectPromise(promise, thenableValue); |
| 274 SET_PRIVATE(resolution, promiseHasHandlerSymbol, true); | 274 SET_PRIVATE(resolution, promiseHasHandlerSymbol, true); |
| 275 return; | 275 return; |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 | 278 |
| 279 if (IS_CALLABLE(then)) { | 279 if (IS_CALLABLE(then)) { |
| 280 // PromiseResolveThenableJob | 280 // PromiseResolveThenableJob |
| 281 var id, name, instrumenting = DEBUG_IS_ACTIVE; | 281 var id; |
| 282 var name = "PromiseResolveThenableJob"; |
| 283 var instrumenting = DEBUG_IS_ACTIVE; |
| 282 %EnqueueMicrotask(function() { | 284 %EnqueueMicrotask(function() { |
| 283 if (instrumenting) { | 285 if (instrumenting) { |
| 284 %DebugAsyncTaskEvent({ type: "willHandle", id: id, name: name }); | 286 %DebugAsyncTaskEvent({ type: "willHandle", id: id, name: name }); |
| 285 } | 287 } |
| 286 var callbacks = CreateResolvingFunctions(promise); | 288 var callbacks = CreateResolvingFunctions(promise); |
| 287 try { | 289 try { |
| 288 %_Call(then, resolution, callbacks.resolve, callbacks.reject); | 290 %_Call(then, resolution, callbacks.resolve, callbacks.reject); |
| 289 } catch (e) { | 291 } catch (e) { |
| 290 %_Call(callbacks.reject, UNDEFINED, e); | 292 %_Call(callbacks.reject, UNDEFINED, e); |
| 291 } | 293 } |
| 292 if (instrumenting) { | 294 if (instrumenting) { |
| 293 %DebugAsyncTaskEvent({ type: "didHandle", id: id, name: name }); | 295 %DebugAsyncTaskEvent({ type: "didHandle", id: id, name: name }); |
| 294 } | 296 } |
| 295 }); | 297 }); |
| 296 if (instrumenting) { | 298 if (instrumenting) { |
| 297 id = ++lastMicrotaskId; | 299 id = ++lastMicrotaskId; |
| 298 name = "PromseResolveThenableJob"; | |
| 299 %DebugAsyncTaskEvent({ type: "enqueue", id: id, name: name }); | 300 %DebugAsyncTaskEvent({ type: "enqueue", id: id, name: name }); |
| 300 } | 301 } |
| 301 return; | 302 return; |
| 302 } | 303 } |
| 303 } | 304 } |
| 304 FulfillPromise(promise, kFulfilled, resolution, promiseFulfillReactionsSymbol)
; | 305 FulfillPromise(promise, kFulfilled, resolution, promiseFulfillReactionsSymbol)
; |
| 305 } | 306 } |
| 306 | 307 |
| 307 // ES#sec-rejectpromise | 308 // ES#sec-rejectpromise |
| 308 // RejectPromise ( promise, reason ) | 309 // RejectPromise ( promise, reason ) |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 to.PromiseChain = PromiseChain; | 611 to.PromiseChain = PromiseChain; |
| 611 to.PromiseDefer = PromiseDefer; | 612 to.PromiseDefer = PromiseDefer; |
| 612 to.PromiseAccept = PromiseAccept; | 613 to.PromiseAccept = PromiseAccept; |
| 613 | 614 |
| 614 to.PromiseCreateRejected = PromiseCreateRejected; | 615 to.PromiseCreateRejected = PromiseCreateRejected; |
| 615 to.PromiseCreateResolved = PromiseCreateResolved; | 616 to.PromiseCreateResolved = PromiseCreateResolved; |
| 616 to.PromiseThen = PromiseThen; | 617 to.PromiseThen = PromiseThen; |
| 617 }); | 618 }); |
| 618 | 619 |
| 619 }) | 620 }) |
| OLD | NEW |