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

Unified Diff: test/mjsunit/regress/regress-1081309.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-unresolved-function.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-1081309.js
===================================================================
--- test/mjsunit/regress/regress-1081309.js (revision 1079)
+++ test/mjsunit/regress/regress-1081309.js (working copy)
@@ -34,14 +34,32 @@
listenerCalled = false;
exception = false;
-function safeEval(code) {
- try {
- return eval('(' + code + ')');
- } catch (e) {
- return undefined;
+function ParsedResponse(json) {
+ this.response_ = eval('(' + json + ')');
+ this.refs_ = [];
+ if (this.response_.refs) {
+ for (var i = 0; i < this.response_.refs.length; i++) {
+ this.refs_[this.response_.refs[i].handle] = this.response_.refs[i];
+ }
}
}
+
+ParsedResponse.prototype.response = function() {
+ return this.response_;
+}
+
+
+ParsedResponse.prototype.body = function() {
+ return this.response_.body;
+}
+
+
+ParsedResponse.prototype.lookup = function(handle) {
+ return this.refs_[handle];
+}
+
+
function listener(event, exec_state, event_data, data) {
try {
if (event == Debug.DebugEvent.Exception)
@@ -56,12 +74,13 @@
// Get the backtrace.
var json;
json = '{"seq":0,"type":"request","command":"backtrace"}'
- var backtrace = safeEval(dcp.processDebugJSONRequest(json)).body;
+ var response = new ParsedResponse(dcp.processDebugJSONRequest(json));
+ var backtrace = response.body();
assertEquals(2, backtrace.totalFrames);
assertEquals(2, backtrace.frames.length);
- assertEquals("g", backtrace.frames[0].func.name);
- assertEquals("", backtrace.frames[1].func.name);
+ assertEquals("g", response.lookup(backtrace.frames[0].func.ref).name);
+ assertEquals("", response.lookup(backtrace.frames[1].func.ref).name);
listenerCalled = true;
}
« no previous file with comments | « test/mjsunit/mirror-unresolved-function.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698