Revision: 19928
Author: [email protected]
Date: Fri Mar 14 10:35:01 2014 UTC
Log: PromiseCoerce should deal with an error during accessing "then".
PromiseCource(x) should return a rejected promise when accessing x.then
leads to an error.
BUG=347095
LOG=Y
[email protected]
Review URL: https://codereview.chromium.org/194483002
Patch from Yutaka Hirano <[email protected]>.
http://code.google.com/p/v8/source/detail?r=19928
Modified:
/branches/bleeding_edge/src/promise.js
=======================================
--- /branches/bleeding_edge/src/promise.js Tue Mar 11 16:17:20 2014 UTC
+++ /branches/bleeding_edge/src/promise.js Fri Mar 14 10:35:01 2014 UTC
@@ -227,7 +227,15 @@
function PromiseCoerce(constructor, x) {
if (!IsPromise(x) && IS_SPEC_OBJECT(x)) {
- var then = x.then;
+ var then;
+ try {
+ then = x.then;
+ } catch(e) {
+ var deferred = %_CallFunction(constructor, PromiseDeferred);
+ PromiseCoerce.table.set(x, deferred.promise);
+ deferred.reject(e);
+ return deferred.promise;
+ }
if (typeof then === 'function') {
if (PromiseCoerce.table.has(x)) {
return PromiseCoerce.table.get(x);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.