Commit e9c989b8 authored by peter.rybin@gmail.com's avatar peter.rybin@gmail.com

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
parent ed59e772
...@@ -1858,15 +1858,18 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { ...@@ -1858,15 +1858,18 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
var additional_context_object; var additional_context_object;
if (additional_context) { if (additional_context) {
additional_context_object = {}; additional_context_object = {};
for (var key in additional_context) { for (var i = 0; i < additional_context.length; i++) {
var context_value_handle = additional_context[key]; var mapping = additional_context[i];
var context_value_mirror = LookupMirror(context_value_handle); 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) { if (!context_value_mirror) {
return response.failed( return response.failed("Context object '" + mapping.name +
"Context object '" + key + "' #" + context_value_handle + "' #" + mapping.handle + "# not found");
"# not found");
} }
additional_context_object[key] = context_value_mirror.value(); additional_context_object[mapping.name] = context_value_mirror.value();
} }
} }
......
...@@ -117,9 +117,9 @@ function evaluateViaProtocol(exec_state, expression, additional_context, frame_a ...@@ -117,9 +117,9 @@ function evaluateViaProtocol(exec_state, expression, additional_context, frame_a
request_json = {"seq":17,"type":"request","command":"evaluate", arguments: { "expression": expression } }; request_json = {"seq":17,"type":"request","command":"evaluate", arguments: { "expression": expression } };
frame_argument_adder(request_json.arguments); frame_argument_adder(request_json.arguments);
if (additional_context) { if (additional_context) {
var context_json = {} var context_json = [];
for (var key in additional_context) { 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; request_json.arguments.additional_context = context_json;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment