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)
try {
try {
// Convert the JSON string to an object.
request = %CompileString('(' + json_request + ')')();
request = JSON.parse(json_request);
// Create an initial response.
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
// modification, are permitted provided that the following conditions are
// met:
......@@ -6313,8 +6313,7 @@ static void ExecuteScriptForContextCheck() {
v8::Persistent<v8::Context> context_1;
v8::Handle<v8::ObjectTemplate> global_template =
v8::Handle<v8::ObjectTemplate>();
v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>();
context_1 = v8::Context::New(NULL, global_template, global_object);
context_1 = v8::Context::New(NULL, global_template);
// Default data value is undefined.
CHECK(context_1->GetData()->IsUndefined());
......@@ -6379,11 +6378,11 @@ static void DebugEvalContextCheckMessageHandler(
const int kBufferSize = 1000;
uint16_t buffer[kBufferSize];
const char* eval_command =
"{\"seq\":0,"
"\"type\":\"request\","
"\"command\":\"evaluate\","
"arguments:{\"expression\":\"debugger;\","
"\"global\":true,\"disable_break\":false}}";
"{\"seq\":0,"
"\"type\":\"request\","
"\"command\":\"evaluate\","
"\"arguments\":{\"expression\":\"debugger;\","
"\"global\":true,\"disable_break\":false}}";
// Send evaluate command.
v8::Debug::SendCommand(buffer, AsciiToUtf16(eval_command, buffer));
......
......@@ -91,24 +91,24 @@ function listener(event, exec_state, event_data, data) {
// parameter is passed.
testRequest(
dcp,
'{"expression":"this.longString","global":true,maxStringLength:-1}',
'{"expression":"this.longString","global":true,"maxStringLength":-1}',
true,
longString);
testRequest(
dcp,
'{"expression":"this.longString","global":true,maxStringLength:' +
'{"expression":"this.longString","global":true,"maxStringLength":' +
longString.length + '}',
true,
longString);
var truncatedStringSuffix = '... (length: ' + longString.length + ')';
testRequest(
dcp,
'{"expression":"this.longString","global":true,maxStringLength:0}',
'{"expression":"this.longString","global":true,"maxStringLength":0}',
true,
truncatedStringSuffix);
testRequest(
dcp,
'{"expression":"this.longString","global":true,maxStringLength:1}',
'{"expression":"this.longString","global":true,"maxStringLength":1}',
true,
longString.charAt(0) + truncatedStringSuffix);
// Test that by default string is truncated to first 80 chars.
......
......@@ -71,7 +71,7 @@ function listener(event, exec_state, event_data, data) {
testArguments(dcp, '{"types":2}', true);
testArguments(dcp, '{"types":4}', true);
testArguments(dcp, '{"types":7}', true);
testArguments(dcp, '{"types":0xFF}', true);
testArguments(dcp, '{"types":255}', true);
// Test request for all scripts.
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