| Index: src/mirror-debugger.js
|
| diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js
|
| index b140343f4858086237783e96755c955d1daecfc5..124347b7bd5b72cd7a977750b91a2d608aa951e2 100644
|
| --- a/src/mirror-debugger.js
|
| +++ b/src/mirror-debugger.js
|
| @@ -21,10 +21,11 @@ function ClearMirrorCache() {
|
|
|
| // Wrapper to check whether an object is a Promise. The call may not work
|
| // if promises are not enabled.
|
| -// TODO(yangguo): remove this wrapper once promises are enabled by default.
|
| +// TODO(yangguo): remove try-catch once promises are enabled by default.
|
| function ObjectIsPromise(value) {
|
| try {
|
| - return %IsPromise(value);
|
| + return IS_SPEC_OBJECT(value) &&
|
| + !IS_UNDEFINED(%DebugGetProperty(value, builtins.promiseStatus));
|
| } catch (e) {
|
| return false;
|
| }
|
| @@ -824,13 +825,12 @@ ObjectMirror.GetInternalProperties = function(value) {
|
| }
|
| 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;
|
| + var result = [];
|
| + result.push(new InternalPropertyMirror("[[PromiseStatus]]",
|
| + PromiseGetStatus_(value)));
|
| + result.push(new InternalPropertyMirror("[[PromiseValue]]",
|
| + PromiseGetValue_(value)));
|
| + return result;
|
| }
|
| return [];
|
| }
|
| @@ -1194,16 +1194,26 @@ function PromiseMirror(value) {
|
| inherits(PromiseMirror, ObjectMirror);
|
|
|
|
|
| -PromiseMirror.prototype.status = function() {
|
| - var status = builtins.GetPromiseStatus(this.value_);
|
| +function PromiseGetStatus_(value) {
|
| + var status = %DebugGetProperty(value, builtins.promiseStatus);
|
| if (status == 0) return "pending";
|
| if (status == 1) return "resolved";
|
| return "rejected";
|
| +}
|
| +
|
| +
|
| +function PromiseGetValue_(value) {
|
| + return %DebugGetProperty(value, builtins.promiseValue);
|
| +}
|
| +
|
| +
|
| +PromiseMirror.prototype.status = function() {
|
| + return PromiseGetStatus_(this.value_);
|
| };
|
|
|
|
|
| PromiseMirror.prototype.promiseValue = function() {
|
| - return builtins.GetPromiseValue(this.value_);
|
| + return MakeMirror(PromiseGetValue_(this.value_));
|
| };
|
|
|
|
|
| @@ -2524,7 +2534,7 @@ JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content,
|
| if (mirror.isPromise()) {
|
| // Add promise specific properties.
|
| content.status = mirror.status();
|
| - content.promiseValue = mirror.promiseValue();
|
| + content.promiseValue = this.serializeReference(mirror.promiseValue());
|
| }
|
|
|
| // Add actual properties - named properties followed by indexed properties.
|
|
|