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 b9e1381af474f559b1b9cfc42bae1c72713e85a1..684b40c8d62c3aecaa4487cc72d5c011e8e8d68a 100644 |
| --- a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp |
| +++ b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp |
| @@ -363,47 +363,42 @@ void V8InjectedScriptHost::setFunctionVariableValueMethodCustom(const v8::Functi |
| v8SetReturnValue(args, debugServer.setFunctionVariableValue(functionValue, scopeIndex, variableName, newValue)); |
| } |
| -static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& args, String* scriptId, int* lineNumber, int* columnNumber) |
| -{ |
| - if (args.Length() < 1) |
| - return false; |
| - v8::Handle<v8::Value> fn = args[0]; |
| - 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 = toWebCoreStringWithUndefinedOrNullCheck(function->GetScriptId()); |
| - return true; |
| -} |
| - |
| void V8InjectedScriptHost::setBreakpointMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) |
| { |
| - String scriptId; |
| - int lineNumber; |
| - int columnNumber; |
| - if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| + if (args.Length() < 5) { |
|
vsevik
2013/06/11 09:18:32
Can we avoid having custom bindings at all?
|
| + v8::ThrowException(v8::Exception::Error(v8::String::New("5 argument expected."))); |
| + return; |
| + } |
| + if (!args[0]->IsString()) { |
| + v8::ThrowException(v8::Exception::Error(v8::String::New("scriptId must be a string."))); |
| return; |
| + } |
| + |
| + String scriptId = toWebCoreStringWithUndefinedOrNullCheck(args[0]->ToString()); |
| + int lineNumber = args[1]->Int32Value(); |
| + int columnNumber = args[2]->Int32Value(); |
| + String source = toWebCoreStringWithUndefinedOrNullCheck(args[3]->ToString()); |
| + String condition = toWebCoreStringWithUndefinedOrNullCheck(args[4]->ToString()); |
| InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| - host->setBreakpoint(scriptId, lineNumber, columnNumber); |
| + host->setBreakpoint(scriptId, lineNumber, columnNumber, source, condition); |
| } |
| void V8InjectedScriptHost::removeBreakpointMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) |
| { |
| - String scriptId; |
| - int lineNumber; |
| - int columnNumber; |
| - if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) |
| + if (args.Length() < 4) { |
| + v8::ThrowException(v8::Exception::Error(v8::String::New("4 argument expected."))); |
| return; |
| + } |
| + |
| + String scriptId = toWebCoreStringWithUndefinedOrNullCheck(args[0]->ToString()); |
| + int lineNumber = args[1]->Int32Value(); |
| + int columnNumber = args[2]->Int32Value(); |
| + String source = toWebCoreStringWithUndefinedOrNullCheck(args[3]->ToString()); |
| InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); |
| - host->removeBreakpoint(scriptId, lineNumber, columnNumber); |
| + host->removeBreakpoint(scriptId, lineNumber, columnNumber, source); |
| } |
| - |
| } // namespace WebCore |