From e9c989b8fa467dd74ac71325bf4b84ca3d466938 Mon Sep 17 00:00:00 2001 From: "peter.rybin@gmail.com" Date: Wed, 15 Dec 2010 19:55:51 +0000 Subject: [PATCH] Fix evaluate with context debug protocol Review URL: http://codereview.chromium.org/5866002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6039 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/debug-debugger.js | 17 ++++++++++------- test/mjsunit/debug-evaluate-with-context.js | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/debug-debugger.js b/src/debug-debugger.js index bf80735..090c661 100644 --- a/src/debug-debugger.js +++ b/src/debug-debugger.js @@ -1858,15 +1858,18 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { var additional_context_object; if (additional_context) { additional_context_object = {}; - for (var key in additional_context) { - var context_value_handle = additional_context[key]; - var context_value_mirror = LookupMirror(context_value_handle); + for (var i = 0; i < additional_context.length; i++) { + var mapping = additional_context[i]; + if (!IS_STRING(mapping.name) || !IS_NUMBER(mapping.handle)) { + return response.failed("Context element #" + i + + " must contain name:string and handle:number"); + } + var context_value_mirror = LookupMirror(mapping.handle); if (!context_value_mirror) { - return response.failed( - "Context object '" + key + "' #" + context_value_handle + - "# not found"); + return response.failed("Context object '" + mapping.name + + "' #" + mapping.handle + "# not found"); } - additional_context_object[key] = context_value_mirror.value(); + additional_context_object[mapping.name] = context_value_mirror.value(); } } diff --git a/test/mjsunit/debug-evaluate-with-context.js b/test/mjsunit/debug-evaluate-with-context.js index 2d75e00..5e1c83c 100644 --- a/test/mjsunit/debug-evaluate-with-context.js +++ b/test/mjsunit/debug-evaluate-with-context.js @@ -117,9 +117,9 @@ function evaluateViaProtocol(exec_state, expression, additional_context, frame_a request_json = {"seq":17,"type":"request","command":"evaluate", arguments: { "expression": expression } }; frame_argument_adder(request_json.arguments); if (additional_context) { - var context_json = {} + var context_json = []; for (var key in additional_context) { - context_json[key] = Debug.MakeMirror(additional_context[key]).handle(); + context_json.push({ name: key, handle: Debug.MakeMirror(additional_context[key]).handle() }); } request_json.arguments.additional_context = context_json; } -- 2.7.4