Revision: 6039
Author: [email protected]
Date: Wed Dec 15 11:55:51 2010
Log: Fix evaluate with context debug protocol

Review URL: http://codereview.chromium.org/5866002
http://code.google.com/p/v8/source/detail?r=6039

Modified:
 /branches/bleeding_edge/src/debug-debugger.js
 /branches/bleeding_edge/test/mjsunit/debug-evaluate-with-context.js

=======================================
--- /branches/bleeding_edge/src/debug-debugger.js       Mon Dec 13 16:07:44 2010
+++ /branches/bleeding_edge/src/debug-debugger.js       Wed Dec 15 11:55:51 2010
@@ -1858,15 +1858,18 @@
   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");
-      }
-      additional_context_object[key] = context_value_mirror.value();
+        return response.failed("Context object '" + mapping.name +
+            "' #" + mapping.handle + "# not found");
+      }
+ additional_context_object[mapping.name] = context_value_mirror.value();
     }
   }

=======================================
--- /branches/bleeding_edge/test/mjsunit/debug-evaluate-with-context.js Mon Dec 13 16:07:44 2010 +++ /branches/bleeding_edge/test/mjsunit/debug-evaluate-with-context.js Wed Dec 15 11:55:51 2010
@@ -117,9 +117,9 @@
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;
   }

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to