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

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

Issue 1513873002: Unstage non-standard Promise functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 }; 437 };
438 438
439 // ------------------------------------------------------------------- 439 // -------------------------------------------------------------------
440 // Install exported functions. 440 // Install exported functions.
441 441
442 %AddNamedProperty(global, 'Promise', GlobalPromise, DONT_ENUM); 442 %AddNamedProperty(global, 'Promise', GlobalPromise, DONT_ENUM);
443 %AddNamedProperty(GlobalPromise.prototype, toStringTagSymbol, "Promise", 443 %AddNamedProperty(GlobalPromise.prototype, toStringTagSymbol, "Promise",
444 DONT_ENUM | READ_ONLY); 444 DONT_ENUM | READ_ONLY);
445 445
446 utils.InstallFunctions(GlobalPromise, DONT_ENUM, [ 446 utils.InstallFunctions(GlobalPromise, DONT_ENUM, [
447 "defer", PromiseDeferred,
448 "accept", PromiseResolved,
449 "reject", PromiseRejected, 447 "reject", PromiseRejected,
450 "all", PromiseAll, 448 "all", PromiseAll,
451 "race", PromiseRace, 449 "race", PromiseRace,
452 "resolve", PromiseCast 450 "resolve", PromiseCast
453 ]); 451 ]);
454 452
455 utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [ 453 utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [
456 "chain", PromiseChain,
457 "then", PromiseThen, 454 "then", PromiseThen,
458 "catch", PromiseCatch 455 "catch", PromiseCatch
459 ]); 456 ]);
460 457
461 %InstallToContext([ 458 %InstallToContext([
462 "promise_catch", PromiseCatch, 459 "promise_catch", PromiseCatch,
463 "promise_chain", PromiseChain, 460 "promise_chain", PromiseChain,
464 "promise_create", PromiseCreate, 461 "promise_create", PromiseCreate,
465 "promise_has_user_defined_reject_handler", PromiseHasUserDefinedRejectHandler, 462 "promise_has_user_defined_reject_handler", PromiseHasUserDefinedRejectHandler,
466 "promise_reject", PromiseReject, 463 "promise_reject", PromiseReject,
467 "promise_resolve", PromiseResolve, 464 "promise_resolve", PromiseResolve,
468 "promise_then", PromiseThen, 465 "promise_then", PromiseThen,
469 ]); 466 ]);
470 467
471 // This allows extras to create promises quickly without building extra 468 // This allows extras to create promises quickly without building extra
472 // resolve/reject closures, and allows them to later resolve and reject any 469 // resolve/reject closures, and allows them to later resolve and reject any
473 // promise without having to hold on to those closures forever. 470 // promise without having to hold on to those closures forever.
474 utils.InstallFunctions(extrasUtils, 0, [ 471 utils.InstallFunctions(extrasUtils, 0, [
475 "createPromise", PromiseCreate, 472 "createPromise", PromiseCreate,
476 "resolvePromise", PromiseResolve, 473 "resolvePromise", PromiseResolve,
477 "rejectPromise", PromiseReject 474 "rejectPromise", PromiseReject
478 ]); 475 ]);
479 476
477 // TODO(v8:4567): Allow experimental natives to remove function prototype
478 [PromiseChain, PromiseDeferred, PromiseResolved].forEach(
479 fn => %FunctionRemovePrototype(fn));
480
481 utils.Export(function(to) {
482 to.PromiseChain = PromiseChain;
483 to.PromiseDeferred = PromiseDeferred;
484 to.PromiseResolved = PromiseResolved;
485 });
486
480 }) 487 })
OLDNEW
« src/flag-definitions.h ('K') | « src/js/prologue.js ('k') | src/js/promise-extra.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698