From: peter.rybin@gmail.com Date: Fri, 20 Apr 2012 17:08:01 +0000 (+0000) Subject: Issue 2089 Expose value wrapper's inner values X-Git-Tag: upstream/4.7.83~16825 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3d45d48fb292a7ab798e5dec83f5b07a8cc93208;p=platform%2Fupstream%2Fv8.git Issue 2089 Expose value wrapper's inner values Review URL: https://chromiumcodereview.appspot.com/10162006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11407 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js index c43dd228e..82e6fd261 100644 --- a/src/mirror-debugger.js +++ b/src/mirror-debugger.js @@ -596,6 +596,23 @@ ObjectMirror.prototype.protoObject = function() { }; +/** + * Return the primitive value if this is object of Boolean, Number or String + * type (but not Date). Otherwise return undefined. + */ +ObjectMirror.prototype.primitiveValue = function() { + if (!IS_STRING_WRAPPER(this.value_) && !IS_NUMBER_WRAPPER(this.value_) && + !IS_BOOLEAN_WRAPPER(this.value_)) { + return void 0; + } + var primitiveValue = %_ValueOf(this.value_); + if (IS_UNDEFINED(primitiveValue)) { + return void 0; + } + return MakeMirror(primitiveValue); +}; + + ObjectMirror.prototype.hasNamedInterceptor = function() { // Get information on interceptors for this object. var x = %GetInterceptorInfo(this.value_); @@ -2234,6 +2251,11 @@ JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content, content.protoObject = this.serializeReference(mirror.protoObject()); content.prototypeObject = this.serializeReference(mirror.prototypeObject()); + var primitiveValue = mirror.primitiveValue(); + if (!IS_UNDEFINED(primitiveValue)) { + content.primitiveValue = this.serializeReference(primitiveValue); + } + // Add flags to indicate whether there are interceptors. if (mirror.hasNamedInterceptor()) { content.namedInterceptor = true;