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

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

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