Revision: 21266
Author: [email protected]
Date: Mon May 12 12:42:35 2014 UTC
Log: Read internal properties [[PromiseStatus]] and [[PromiseValue]]
of the promise.
BUG=v8:3093
LOG=N
[email protected], [email protected]
Review URL: https://codereview.chromium.org/273653007
Patch from Alexandra Mikhaylova <[email protected]>.
http://code.google.com/p/v8/source/detail?r=21266
Modified:
/branches/bleeding_edge/src/mirror-debugger.js
/branches/bleeding_edge/test/mjsunit/es6/mirror-promises.js
=======================================
--- /branches/bleeding_edge/src/mirror-debugger.js Wed Apr 30 15:17:51 2014
UTC
+++ /branches/bleeding_edge/src/mirror-debugger.js Mon May 12 12:42:35 2014
UTC
@@ -798,7 +798,8 @@
/**
* Return the internal properties of the value, such as [[PrimitiveValue]]
of
- * scalar wrapper objects and properties of the bound function.
+ * scalar wrapper objects, properties of the bound function and properties
of
+ * the promise.
* This method is done static to be accessible from Debug API with the bare
* values without mirrors.
* @return {Array} array (possibly empty) of InternalProperty instances
@@ -821,6 +822,14 @@
}
result.push(new InternalPropertyMirror("[[BoundArgs]]", boundArgs));
}
+ return result;
+ } else if (ObjectIsPromise(value)) {
+ var mirror = new PromiseMirror(value);
+ var result = [];
+ result.push(new InternalPropertyMirror("[[PromiseStatus]]",
+ mirror.status()));
+ result.push(new InternalPropertyMirror("[[PromiseValue]]",
+ mirror.promiseValue()));
return result;
}
return [];
=======================================
--- /branches/bleeding_edge/test/mjsunit/es6/mirror-promises.js Mon Apr 28
08:33:23 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/es6/mirror-promises.js Mon May 12
12:42:35 2014 UTC
@@ -67,3 +67,23 @@
testPromiseMirror(resolvedv, "resolved", 'resolve');
testPromiseMirror(rejectedv, "rejected", 'reject');
testPromiseMirror(thrownv, "rejected", 'throw');
+
+// Test internal properties of different promises.
+var m1 = debug.MakeMirror(new Promise(
+ function(resolve, reject) { resolve(1) }));
+var ip = m1.internalProperties();
+assertEquals(2, ip.length);
+assertEquals("[[PromiseStatus]]", ip[0].name());
+assertEquals("[[PromiseValue]]", ip[1].name());
+assertEquals("resolved", ip[0].value().value());
+assertEquals(1, ip[1].value().value());
+
+var m2 = debug.MakeMirror(new Promise(function(resolve, reject) {
reject(2) }));
+ip = m2.internalProperties();
+assertEquals("rejected", ip[0].value().value());
+assertEquals(2, ip[1].value().value());
+
+var m3 = debug.MakeMirror(new Promise(function(resolve, reject) { }));
+ip = m3.internalProperties();
+assertEquals("pending", ip[0].value().value());
+assertEquals("undefined", typeof(ip[1].value().value()));
--
--
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.