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

Unified Diff: test/mjsunit/mirror-unresolved-function.js

Issue 18092: Added handles to the mirror objects. When a mirror for an object is created... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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 | « test/mjsunit/mirror-undefined.js ('k') | test/mjsunit/regress/regress-1081309.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/mirror-unresolved-function.js
===================================================================
--- test/mjsunit/mirror-unresolved-function.js (revision 1079)
+++ test/mjsunit/mirror-unresolved-function.js (working copy)
@@ -28,8 +28,22 @@
// Flags: --expose-debug-as debug
// Test the mirror object for unresolved functions.
+function MirrorRefCache(json_refs) {
+ var tmp = eval('(' + json_refs + ')');
+ this.refs_ = [];
+ for (var i = 0; i < tmp.length; i++) {
+ this.refs_[tmp[i].handle] = tmp[i];
+ }
+}
+
+MirrorRefCache.prototype.lookup = function(handle) {
+ return this.refs_[handle];
+}
+
var mirror = new debug.UnresolvedFunctionMirror("f");
-var json = mirror.toJSONProtocol(true);
+var serializer = debug.MakeMirrorSerializer();
+var json = serializer.serializeValue(mirror);
+var refs = new MirrorRefCache(serializer.serializeReferencedObjects());
// Check the mirror hierachy for unresolved functions.
assertTrue(mirror instanceof debug.Mirror);
@@ -50,12 +64,15 @@
assertEquals('undefined', mirror.prototypeObject().type());
// Parse JSON representation of unresolved functions and check.
-/*var fromJSON = eval('(' + json + ')');
-assertEquals('function', fromJSON.type);
-assertEquals('Function', fromJSON.className);
-assertEquals('undefined', fromJSON.constructorFunction.type);
-assertEquals('undefined', fromJSON.protoObject.type);
-assertEquals('undefined', fromJSON.prototypeObject.type);
+var fromJSON = eval('(' + json + ')');
+assertEquals('function', fromJSON.type, 'Unexpected mirror type in JSON');
+assertEquals('Function', fromJSON.className, 'Unexpected mirror class name in JSON');
+assertEquals(mirror.constructorFunction().handle(), fromJSON.constructorFunction.ref, 'Unexpected constructor function handle in JSON');
+assertEquals('undefined', refs.lookup(fromJSON.constructorFunction.ref).type, 'Unexpected constructor function type in JSON');
+assertEquals(mirror.protoObject().handle(), fromJSON.protoObject.ref, 'Unexpected proto object handle in JSON');
+assertEquals('undefined', refs.lookup(fromJSON.protoObject.ref).type, 'Unexpected proto object type in JSON');
+assertEquals(mirror.prototypeObject().handle(), fromJSON.prototypeObject.ref, 'Unexpected prototype object handle in JSON');
+assertEquals('undefined', refs.lookup(fromJSON.prototypeObject.ref).type, 'Unexpected prototype object type in JSON');
assertFalse(fromJSON.resolved);
assertEquals("f", fromJSON.name);
-assertEquals(void 0, fromJSON.source);*/
+assertEquals(void 0, fromJSON.source);
« no previous file with comments | « test/mjsunit/mirror-undefined.js ('k') | test/mjsunit/regress/regress-1081309.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698