| Index: src/debug-debugger.js
|
| ===================================================================
|
| --- src/debug-debugger.js (revision 6904)
|
| +++ src/debug-debugger.js (working copy)
|
| @@ -858,6 +858,7 @@
|
| return debugger_flags;
|
| };
|
|
|
| +Debug.MakeMirror = MakeMirror;
|
|
|
| function MakeExecutionState(break_id) {
|
| return new ExecutionState(break_id);
|
| @@ -876,9 +877,11 @@
|
| 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 @@
|
| 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,30 @@
|
| 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 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 '" + mapping.name +
|
| + "' #" + mapping.handle + "# not found");
|
| + }
|
| + additional_context_object[mapping.name] = 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 +1899,12 @@
|
| }
|
| // 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;
|
| }
|
| };
|
|
|