Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Unified Diff: src/mirror-debugger.js

Issue 10091022: Issue 2089 Expose value wrapper's inner values (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/runtime.h » ('j') | src/runtime.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mirror-debugger.js
diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js
index c43dd228ec9d12c73a0d66a4102477649f85862f..e39dc5de8760eba4e14798fc378badb9022ab023 100644
--- a/src/mirror-debugger.js
+++ b/src/mirror-debugger.js
@@ -596,6 +596,22 @@ ObjectMirror.prototype.protoObject = function() {
};
+/**
+ * Return the primitive value if this is object of Boolean, Number or String type (but not Date).
Yang 2012/04/17 12:48:44 Please keep the 80 character limit.
Peter Rybin 2012/04/18 12:36:09 Sorry, too much programming in WebKit :)
+ * Otherwise return undefined.
+ */
+ObjectMirror.prototype.primitiveValue = function() {
+ if (!IS_STRING_WRAPPER(this.value_) && !IS_NUMBER_WRAPPER(this.value_) && !IS_BOOLEAN_WRAPPER(this.value_)) {
Yang 2012/04/17 12:48:44 Ditto.
Peter Rybin 2012/04/18 12:36:09 Done.
+ return void 0;
+ }
+ var primitiveValue = %DebugGetPrimitiveValue(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_);
@@ -2233,6 +2249,11 @@ JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content,
this.serializeReference(mirror.constructorFunction());
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()) {
« no previous file with comments | « no previous file | src/runtime.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698