Commit ccafbca6 authored by ager@chromium.org's avatar ager@chromium.org

Use JSON.parse instead of eval for the debugger JSON protocol.

R=sgjesse@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/6903172

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7748 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5b0f7394
...@@ -1335,7 +1335,7 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request) ...@@ -1335,7 +1335,7 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request)
try { try {
try { try {
// Convert the JSON string to an object. // Convert the JSON string to an object.
request = %CompileString('(' + json_request + ')')(); request = JSON.parse(json_request);
// Create an initial response. // Create an initial response.
response = this.createResponse(request); response = this.createResponse(request);
......
// Copyright 2010 the V8 project authors. All rights reserved. // Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -6313,8 +6313,7 @@ static void ExecuteScriptForContextCheck() { ...@@ -6313,8 +6313,7 @@ static void ExecuteScriptForContextCheck() {
v8::Persistent<v8::Context> context_1; v8::Persistent<v8::Context> context_1;
v8::Handle<v8::ObjectTemplate> global_template = v8::Handle<v8::ObjectTemplate> global_template =
v8::Handle<v8::ObjectTemplate>(); v8::Handle<v8::ObjectTemplate>();
v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>(); context_1 = v8::Context::New(NULL, global_template);
context_1 = v8::Context::New(NULL, global_template, global_object);
// Default data value is undefined. // Default data value is undefined.
CHECK(context_1->GetData()->IsUndefined()); CHECK(context_1->GetData()->IsUndefined());
...@@ -6379,11 +6378,11 @@ static void DebugEvalContextCheckMessageHandler( ...@@ -6379,11 +6378,11 @@ static void DebugEvalContextCheckMessageHandler(
const int kBufferSize = 1000; const int kBufferSize = 1000;
uint16_t buffer[kBufferSize]; uint16_t buffer[kBufferSize];
const char* eval_command = const char* eval_command =
"{\"seq\":0," "{\"seq\":0,"
"\"type\":\"request\"," "\"type\":\"request\","
"\"command\":\"evaluate\"," "\"command\":\"evaluate\","
"arguments:{\"expression\":\"debugger;\"," "\"arguments\":{\"expression\":\"debugger;\","
"\"global\":true,\"disable_break\":false}}"; "\"global\":true,\"disable_break\":false}}";
// Send evaluate command. // Send evaluate command.
v8::Debug::SendCommand(buffer, AsciiToUtf16(eval_command, buffer)); v8::Debug::SendCommand(buffer, AsciiToUtf16(eval_command, buffer));
......
...@@ -91,24 +91,24 @@ function listener(event, exec_state, event_data, data) { ...@@ -91,24 +91,24 @@ function listener(event, exec_state, event_data, data) {
// parameter is passed. // parameter is passed.
testRequest( testRequest(
dcp, dcp,
'{"expression":"this.longString","global":true,maxStringLength:-1}', '{"expression":"this.longString","global":true,"maxStringLength":-1}',
true, true,
longString); longString);
testRequest( testRequest(
dcp, dcp,
'{"expression":"this.longString","global":true,maxStringLength:' + '{"expression":"this.longString","global":true,"maxStringLength":' +
longString.length + '}', longString.length + '}',
true, true,
longString); longString);
var truncatedStringSuffix = '... (length: ' + longString.length + ')'; var truncatedStringSuffix = '... (length: ' + longString.length + ')';
testRequest( testRequest(
dcp, dcp,
'{"expression":"this.longString","global":true,maxStringLength:0}', '{"expression":"this.longString","global":true,"maxStringLength":0}',
true, true,
truncatedStringSuffix); truncatedStringSuffix);
testRequest( testRequest(
dcp, dcp,
'{"expression":"this.longString","global":true,maxStringLength:1}', '{"expression":"this.longString","global":true,"maxStringLength":1}',
true, true,
longString.charAt(0) + truncatedStringSuffix); longString.charAt(0) + truncatedStringSuffix);
// Test that by default string is truncated to first 80 chars. // Test that by default string is truncated to first 80 chars.
......
...@@ -71,7 +71,7 @@ function listener(event, exec_state, event_data, data) { ...@@ -71,7 +71,7 @@ function listener(event, exec_state, event_data, data) {
testArguments(dcp, '{"types":2}', true); testArguments(dcp, '{"types":2}', true);
testArguments(dcp, '{"types":4}', true); testArguments(dcp, '{"types":4}', true);
testArguments(dcp, '{"types":7}', true); testArguments(dcp, '{"types":7}', true);
testArguments(dcp, '{"types":0xFF}', true); testArguments(dcp, '{"types":255}', true);
// Test request for all scripts. // Test request for all scripts.
var request = '{' + base_request + '}' var request = '{' + base_request + '}'
......
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