Index: src/debug-debugger.js |
diff --git a/src/debug-debugger.js b/src/debug-debugger.js |
index d091991a1199eff1ebacd84894563657dd7e97db..bf80735ef8cd6ad11920a46abcebcc85b82e0dc3 100644 |
--- a/src/debug-debugger.js |
+++ b/src/debug-debugger.js |
@@ -858,6 +858,7 @@ Debug.debuggerFlags = function() { |
return debugger_flags; |
}; |
+Debug.MakeMirror = MakeMirror; |
function MakeExecutionState(break_id) { |
return new ExecutionState(break_id); |
@@ -876,9 +877,11 @@ ExecutionState.prototype.prepareStep = function(opt_action, opt_count) { |
return %PrepareStep(this.break_id, action, count); |
} |
-ExecutionState.prototype.evaluateGlobal = function(source, disable_break) { |
- return MakeMirror( |
- %DebugEvaluateGlobal(this.break_id, source, Boolean(disable_break))); |
+ExecutionState.prototype.evaluateGlobal = function(source, disable_break, |
+ opt_additional_context) { |
+ return MakeMirror(%DebugEvaluateGlobal(this.break_id, source, |
+ Boolean(disable_break), |
+ opt_additional_context)); |
}; |
ExecutionState.prototype.frameCount = function() { |
@@ -1837,6 +1840,7 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { |
var frame = request.arguments.frame; |
var global = request.arguments.global; |
var disable_break = request.arguments.disable_break; |
+ var additional_context = request.arguments.additional_context; |
// The expression argument could be an integer so we convert it to a |
// string. |
@@ -1850,12 +1854,27 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { |
if (!IS_UNDEFINED(frame) && global) { |
return response.failed('Arguments "frame" and "global" are exclusive'); |
} |
+ |
+ 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); |
+ if (!context_value_mirror) { |
+ return response.failed( |
+ "Context object '" + key + "' #" + context_value_handle + |
+ "# not found"); |
+ } |
+ additional_context_object[key] = context_value_mirror.value(); |
+ } |
+ } |
// Global evaluate. |
if (global) { |
// Evaluate in the global context. |
- response.body = |
- this.exec_state_.evaluateGlobal(expression, Boolean(disable_break)); |
+ response.body = this.exec_state_.evaluateGlobal( |
+ expression, Boolean(disable_break), additional_context_object); |
return; |
} |
@@ -1877,12 +1896,12 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { |
} |
// Evaluate in the specified frame. |
response.body = this.exec_state_.frame(frame_number).evaluate( |
- expression, Boolean(disable_break)); |
+ expression, Boolean(disable_break), additional_context_object); |
return; |
} else { |
// Evaluate in the selected frame. |
response.body = this.exec_state_.frame().evaluate( |
- expression, Boolean(disable_break)); |
+ expression, Boolean(disable_break), additional_context_object); |
return; |
} |
}; |