Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: test/mjsunit/debug-evaluate-with-context.js

Issue 5866002: Fix evaluate with context debug protocol (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: small fix Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/debug-debugger.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 runF(); 111 runF();
112 112
113 // Now try all the same, but via debug protocol. 113 // Now try all the same, but via debug protocol.
114 114
115 function evaluateViaProtocol(exec_state, expression, additional_context, frame_a rgument_adder) { 115 function evaluateViaProtocol(exec_state, expression, additional_context, frame_a rgument_adder) {
116 var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); 116 var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
117 request_json = {"seq":17,"type":"request","command":"evaluate", arguments: { " expression": expression } }; 117 request_json = {"seq":17,"type":"request","command":"evaluate", arguments: { " expression": expression } };
118 frame_argument_adder(request_json.arguments); 118 frame_argument_adder(request_json.arguments);
119 if (additional_context) { 119 if (additional_context) {
120 var context_json = {} 120 var context_json = [];
121 for (var key in additional_context) { 121 for (var key in additional_context) {
122 context_json[key] = Debug.MakeMirror(additional_context[key]).handle(); 122 context_json.push({ name: key, handle: Debug.MakeMirror(additional_context [key]).handle() });
123 } 123 }
124 request_json.arguments.additional_context = context_json; 124 request_json.arguments.additional_context = context_json;
125 } 125 }
126 var request = JSON.stringify(request_json); 126 var request = JSON.stringify(request_json);
127 var response_json = dcp.processDebugJSONRequest(request); 127 var response_json = dcp.processDebugJSONRequest(request);
128 var response = JSON.parse(response_json); 128 var response = JSON.parse(response_json);
129 129
130 assertTrue(response.success); 130 assertTrue(response.success);
131 var str_result = response.body.value; 131 var str_result = response.body.value;
132 return str_result; 132 return str_result;
133 } 133 }
134 134
135 evaluate_callback = { 135 evaluate_callback = {
136 in_top_frame: function(exec_state, expression, additional_context) { 136 in_top_frame: function(exec_state, expression, additional_context) {
137 return evaluateViaProtocol(exec_state, expression, additional_context, funct ion(args) { args.frame = 0; }); 137 return evaluateViaProtocol(exec_state, expression, additional_context, funct ion(args) { args.frame = 0; });
138 }, 138 },
139 globally: function(exec_state, expression, additional_context) { 139 globally: function(exec_state, expression, additional_context) {
140 return evaluateViaProtocol(exec_state, expression, additional_context, funct ion(args) { args.global = true; }); 140 return evaluateViaProtocol(exec_state, expression, additional_context, funct ion(args) { args.global = true; });
141 }, 141 },
142 }; 142 };
143 143
144 runF(); 144 runF();
OLDNEW
« no previous file with comments | « src/debug-debugger.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698