| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 v8::Handle<v8::Value> V8InjectedScriptHost::evaluateMethodCustom(const v8::Argum
ents& args) | 300 v8::Handle<v8::Value> V8InjectedScriptHost::evaluateMethodCustom(const v8::Argum
ents& args) |
| 301 { | 301 { |
| 302 if (args.Length() < 1) | 302 if (args.Length() < 1) |
| 303 return v8::ThrowException(v8::Exception::Error(v8::String::New("One argu
ment expected."))); | 303 return v8::ThrowException(v8::Exception::Error(v8::String::New("One argu
ment expected."))); |
| 304 | 304 |
| 305 v8::Handle<v8::String> expression = args[0]->ToString(); | 305 v8::Handle<v8::String> expression = args[0]->ToString(); |
| 306 if (expression.IsEmpty()) | 306 if (expression.IsEmpty()) |
| 307 return v8::ThrowException(v8::Exception::Error(v8::String::New("The argu
ment must be a string."))); | 307 return v8::ThrowException(v8::Exception::Error(v8::String::New("The argu
ment must be a string."))); |
| 308 | 308 |
| 309 // Mark the context as temporarily used by debugger. |
| 310 V8PerContextDebugData::SystemScope systemScope(v8::Context::GetCurrent()); |
| 311 |
| 309 v8::Handle<v8::Script> script = v8::Script::Compile(expression); | 312 v8::Handle<v8::Script> script = v8::Script::Compile(expression); |
| 310 if (script.IsEmpty()) // Return immediately in case of exception to let the
caller handle it. | 313 if (script.IsEmpty()) // Return immediately in case of exception to let the
caller handle it. |
| 311 return v8::Handle<v8::Value>(); | 314 return v8::Handle<v8::Value>(); |
| 312 return script->Run(); | 315 return script->Run(); |
| 313 } | 316 } |
| 314 | 317 |
| 315 v8::Handle<v8::Value> V8InjectedScriptHost::setFunctionVariableValueMethodCustom
(const v8::Arguments& args) | 318 v8::Handle<v8::Value> V8InjectedScriptHost::setFunctionVariableValueMethodCustom
(const v8::Arguments& args) |
| 316 { | 319 { |
| 317 v8::Handle<v8::Value> functionValue = args[0]; | 320 v8::Handle<v8::Value> functionValue = args[0]; |
| 318 int scopeIndex = args[1]->Int32Value(); | 321 int scopeIndex = args[1]->Int32Value(); |
| 319 String variableName = toWebCoreStringWithUndefinedOrNullCheck(args[2]); | 322 String variableName = toWebCoreStringWithUndefinedOrNullCheck(args[2]); |
| 320 v8::Handle<v8::Value> newValue = args[3]; | 323 v8::Handle<v8::Value> newValue = args[3]; |
| 321 | 324 |
| 322 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); | 325 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| 323 ScriptDebugServer& debugServer = host->scriptDebugServer(); | 326 ScriptDebugServer& debugServer = host->scriptDebugServer(); |
| 324 return debugServer.setFunctionVariableValue(functionValue, scopeIndex, varia
bleName, newValue); | 327 return debugServer.setFunctionVariableValue(functionValue, scopeIndex, varia
bleName, newValue); |
| 325 } | 328 } |
| 326 | 329 |
| 327 | 330 |
| 328 } // namespace WebCore | 331 } // namespace WebCore |
| 329 | 332 |
| OLD | NEW |