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

Side by Side Diff: src/js/promise.js

Issue 2419713002: [promises] don't store undefined resulting from ResolvePromise (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | 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 (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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 // Promise.resolve ( x ) 482 // Promise.resolve ( x )
483 function PromiseResolve(x) { 483 function PromiseResolve(x) {
484 if (!IS_RECEIVER(this)) { 484 if (!IS_RECEIVER(this)) {
485 throw %make_type_error(kCalledOnNonObject, PromiseResolve); 485 throw %make_type_error(kCalledOnNonObject, PromiseResolve);
486 } 486 }
487 if (IsPromise(x) && x.constructor === this) return x; 487 if (IsPromise(x) && x.constructor === this) return x;
488 488
489 // Avoid creating resolving functions. 489 // Avoid creating resolving functions.
490 if (this === GlobalPromise) { 490 if (this === GlobalPromise) {
491 var promise = PromiseCreate(); 491 var promise = PromiseCreate();
492 var resolveResult = ResolvePromise(promise, x); 492 ResolvePromise(promise, x);
493 return promise; 493 return promise;
494 } 494 }
495 495
496 // debugEvent is not so meaningful here as it will be resolved 496 // debugEvent is not so meaningful here as it will be resolved
497 var promiseCapability = NewPromiseCapability(this, true); 497 var promiseCapability = NewPromiseCapability(this, true);
498 var resolveResult = %_Call(promiseCapability.resolve, UNDEFINED, x); 498 %_Call(promiseCapability.resolve, UNDEFINED, x);
499 return promiseCapability.promise; 499 return promiseCapability.promise;
500 } 500 }
501 501
502 // ES#sec-promise.all 502 // ES#sec-promise.all
503 // Promise.all ( iterable ) 503 // Promise.all ( iterable )
504 function PromiseAll(iterable) { 504 function PromiseAll(iterable) {
505 if (!IS_RECEIVER(this)) { 505 if (!IS_RECEIVER(this)) {
506 throw %make_type_error(kCalledOnNonObject, "Promise.all"); 506 throw %make_type_error(kCalledOnNonObject, "Promise.all");
507 } 507 }
508 508
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 to.PromiseNextMicrotaskID = PromiseNextMicrotaskID; 709 to.PromiseNextMicrotaskID = PromiseNextMicrotaskID;
710 710
711 to.GlobalPromise = GlobalPromise; 711 to.GlobalPromise = GlobalPromise;
712 to.NewPromiseCapability = NewPromiseCapability; 712 to.NewPromiseCapability = NewPromiseCapability;
713 to.PerformPromiseThen = PerformPromiseThen; 713 to.PerformPromiseThen = PerformPromiseThen;
714 to.ResolvePromise = ResolvePromise; 714 to.ResolvePromise = ResolvePromise;
715 to.RejectPromise = RejectPromise; 715 to.RejectPromise = RejectPromise;
716 }); 716 });
717 717
718 }) 718 })
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698