Commit 70aa8584 authored by yhirano@chromium.org's avatar yhirano@chromium.org

Use v8::Promise::Then in ScriptPromise::then.

ScriptPromise::then should use v8::Promise::Then in order to handle
multiply-wrapped Promises correctly.

BUG=371288

Review URL: https://codereview.chromium.org/316453002

git-svn-id: svn://svn.chromium.org/blink/trunk@176194 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 73639dc8
...@@ -28,7 +28,7 @@ newPromise.then(function(result) { ...@@ -28,7 +28,7 @@ newPromise.then(function(result) {
testFailed("rejected"); testFailed("rejected");
}).then(finishJSTest, finishJSTest); }).then(finishJSTest, finishJSTest);
resolve(10); resolve(new Promise(function(resolve) { resolve(10); }));
</script> </script>
</body> </body>
......
...@@ -79,11 +79,10 @@ ScriptPromise ScriptPromise::then(PassOwnPtr<ScriptFunction> onFulfilled, PassOw ...@@ -79,11 +79,10 @@ ScriptPromise ScriptPromise::then(PassOwnPtr<ScriptFunction> onFulfilled, PassOw
// In fact it is not the exact bahavior of Promise.prototype.then // In fact it is not the exact bahavior of Promise.prototype.then
// but that is not a problem in this case. // but that is not a problem in this case.
v8::Local<v8::Promise> resultPromise = promise.As<v8::Promise>(); v8::Local<v8::Promise> resultPromise = promise.As<v8::Promise>();
// FIXME: Use Then once it is introduced.
if (!v8OnFulfilled.IsEmpty()) { if (!v8OnFulfilled.IsEmpty()) {
resultPromise = resultPromise->Chain(v8OnFulfilled); resultPromise = resultPromise->Then(v8OnFulfilled);
if (resultPromise.IsEmpty()) { if (resultPromise.IsEmpty()) {
// v8::Promise::Chain may return an empty value, for example when // v8::Promise::Then may return an empty value, for example when
// the stack is exhausted. // the stack is exhausted.
return ScriptPromise(); return ScriptPromise();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment