Introduce non-user-observable Promise functions to use Promises internally
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Aug 2015 22:32:13 +0000 (22:32 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Aug 2015 22:32:13 +0000 (22:32 +0000)
commit25cd74985dba9f95389961b073262f6b4025a1bd
tree3adc29ab29f092491a698755701d2b857c0f95f5
parentd8d2fc2541019453751b52a1c3f1674ff62c21da
Introduce non-user-observable Promise functions to use Promises internally
https://bugs.webkit.org/show_bug.cgi?id=148118

Reviewed by Saam Barati.

To leverage the Promises internally (like ES6 Module Loaders), we add
the several non-user-observable private methods, like @then, @all. And
refactor the existing Promises implementation to make it easy to use
internally.

But still the trappable part remains. When resolving the promise with
the returned value, we look up the "then" function. So users can trap
by replacing "then" function of the Promise's prototype.
To avoid this situation, we'll introduce completely differnt promise
instances called InternalPromise in the subsequent patch[1].

No behavior change.

[1]: https://bugs.webkit.org/show_bug.cgi?id=148136

* builtins/PromiseConstructor.js:
(privateAll.newResolveElement):
(privateAll):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren): Deleted.
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::promiseConstructor): Deleted.
(JSC::JSGlobalObject::promisePrototype): Deleted.
(JSC::JSGlobalObject::promiseStructure): Deleted.
* runtime/JSPromiseConstructor.cpp:
(JSC::JSPromiseConstructor::finishCreation):
* runtime/JSPromiseDeferred.cpp:
(JSC::callFunction):
(JSC::JSPromiseDeferred::resolve):
(JSC::JSPromiseDeferred::reject):
* runtime/JSPromiseDeferred.h:
* runtime/JSPromisePrototype.cpp:
(JSC::JSPromisePrototype::create):
(JSC::JSPromisePrototype::JSPromisePrototype):
* runtime/JSPromisePrototype.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188603 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/builtins/PromiseConstructor.js
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
Source/JavaScriptCore/runtime/JSPromiseDeferred.cpp
Source/JavaScriptCore/runtime/JSPromiseDeferred.h
Source/JavaScriptCore/runtime/JSPromisePrototype.cpp
Source/JavaScriptCore/runtime/JSPromisePrototype.h