Chromium Code Reviews| Index: Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp |
| diff --git a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp |
| index fb7ce20fd550142279eed75d4f3377c4ed05d34c..d574ae41502ece6972cc235ef442c7dcb7673bf9 100644 |
| --- a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp |
| +++ b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp |
| @@ -324,6 +324,45 @@ v8::Handle<v8::Value> V8InjectedScriptHost::setFunctionVariableValueMethodCustom |
| return debugServer.setFunctionVariableValue(functionValue, scopeIndex, variableName, newValue); |
| } |
| +static bool getFunctionLocation(const v8::Arguments& args, String* scriptId, int* lineNumber, int* columnNumber) |
| +{ |
| + v8::Handle<v8::Value> fn = args[0]; |
|
vsevik
2013/05/06 11:52:13
if (args.Length() < 1)
return v8::Undefine
SeRya
2013/05/30 09:56:27
Done.
|
| + if (!fn->IsFunction()) |
| + return false; |
| + v8::HandleScope handleScope; |
| + v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(fn); |
| + *lineNumber = function->GetScriptLineNumber(); |
| + *columnNumber = function->GetScriptColumnNumber(); |
| + if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8::Function::kLineOffsetNotFound) |
| + return false; |
| + *scriptId = v8StringToWebCoreString<String>(function->GetScriptId()->ToString(), Externalize); |
|
vsevik
2013/05/06 11:52:13
*scriptId = toWebCoreStringWithUndefinedOrNullChec
SeRya
2013/05/30 09:56:27
Done.
|
| + return true; |
| +} |
| + |
| +v8::Handle<v8::Value> V8InjectedScriptHost::setBreakpointMethodCustom(const v8::Arguments& args) |
| +{ |
| + String scriptId; |
| + int lineNumber, columnNumber; |
| + if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| + return v8::Undefined(); |
| + |
| + InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| + host->setBreakpoint(scriptId, lineNumber, columnNumber); |
| + return v8::Undefined(); |
| +} |
| + |
| +v8::Handle<v8::Value> V8InjectedScriptHost::removeBreakpointMethodCustom(const v8::Arguments& args) |
| +{ |
| + String scriptId; |
| + int lineNumber, columnNumber; |
| + if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| + return v8::Undefined(); |
| + |
| + InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| + host->removeBreakpoint(scriptId, lineNumber, columnNumber); |
| + return v8::Undefined(); |
| +} |
| + |
| } // namespace WebCore |