| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #include "core/inspector/JavaScriptCallFrame.h" | 62 #include "core/inspector/JavaScriptCallFrame.h" |
| 63 #include "platform/JSONValues.h" | 63 #include "platform/JSONValues.h" |
| 64 | 64 |
| 65 namespace blink { | 65 namespace blink { |
| 66 | 66 |
| 67 Node* InjectedScriptHost::scriptValueAsNode(ScriptState* scriptState, ScriptValu
e value) | 67 Node* InjectedScriptHost::scriptValueAsNode(ScriptState* scriptState, ScriptValu
e value) |
| 68 { | 68 { |
| 69 ScriptState::Scope scope(scriptState); | 69 ScriptState::Scope scope(scriptState); |
| 70 if (!value.isObject() || value.isNull()) | 70 if (!value.isObject() || value.isNull()) |
| 71 return 0; | 71 return 0; |
| 72 return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8Value())); | 72 return V8Node::toImpl(v8::Handle<v8::Object>::Cast(value.v8Value())); |
| 73 } | 73 } |
| 74 | 74 |
| 75 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node
* node) | 75 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node
* node) |
| 76 { | 76 { |
| 77 ScriptState::Scope scope(scriptState); | 77 ScriptState::Scope scope(scriptState); |
| 78 v8::Isolate* isolate = scriptState->isolate(); | 78 v8::Isolate* isolate = scriptState->isolate(); |
| 79 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeAsScrip
tValue", "InjectedScriptHost", scriptState->context()->Global(), isolate); | 79 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeAsScrip
tValue", "InjectedScriptHost", scriptState->context()->Global(), isolate); |
| 80 if (!BindingSecurity::shouldAllowAccessToNode(isolate, node, exceptionState)
) | 80 if (!BindingSecurity::shouldAllowAccessToNode(isolate, node, exceptionState)
) |
| 81 return ScriptValue(scriptState, v8::Null(isolate)); | 81 return ScriptValue(scriptState, v8::Null(isolate)); |
| 82 return ScriptValue(scriptState, toV8(node, scriptState->context()->Global(),
isolate)); | 82 return ScriptValue(scriptState, toV8(node, scriptState->context()->Global(),
isolate)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 85 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 86 { | 86 { |
| 87 if (info.Length() < 1) | 87 if (info.Length() < 1) |
| 88 return; | 88 return; |
| 89 | 89 |
| 90 if (!info[0]->IsInt32()) { | 90 if (!info[0]->IsInt32()) { |
| 91 V8ThrowException::throwTypeError("argument has to be an integer", info.G
etIsolate()); | 91 V8ThrowException::throwTypeError("argument has to be an integer", info.G
etIsolate()); |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 | 94 |
| 95 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 95 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 96 InjectedScriptHost::InspectableObject* object = host->inspectedObject(info[0
]->ToInt32()->Value()); | 96 InjectedScriptHost::InspectableObject* object = host->inspectedObject(info[0
]->ToInt32()->Value()); |
| 97 v8SetReturnValue(info, object->get(ScriptState::current(info.GetIsolate())).
v8Value()); | 97 v8SetReturnValue(info, object->get(ScriptState::current(info.GetIsolate())).
v8Value()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 static v8::Handle<v8::String> functionDisplayName(v8::Handle<v8::Function> funct
ion) | 100 static v8::Handle<v8::String> functionDisplayName(v8::Handle<v8::Function> funct
ion) |
| 101 { | 101 { |
| 102 v8::Handle<v8::Value> value = function->GetDisplayName(); | 102 v8::Handle<v8::Value> value = function->GetDisplayName(); |
| 103 if (value->IsString() && v8::Handle<v8::String>::Cast(value)->Length()) | 103 if (value->IsString() && v8::Handle<v8::String>::Cast(value)->Length()) |
| 104 return v8::Handle<v8::String>::Cast(value); | 104 return v8::Handle<v8::String>::Cast(value); |
| 105 | 105 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 location->Set(v8AtomicString(isolate, "lineNumber"), v8::Integer::New(isolat
e, lineNumber)); | 205 location->Set(v8AtomicString(isolate, "lineNumber"), v8::Integer::New(isolat
e, lineNumber)); |
| 206 location->Set(v8AtomicString(isolate, "columnNumber"), v8::Integer::New(isol
ate, columnNumber)); | 206 location->Set(v8AtomicString(isolate, "columnNumber"), v8::Integer::New(isol
ate, columnNumber)); |
| 207 location->Set(v8AtomicString(isolate, "scriptId"), v8::Integer::New(isolate,
function->ScriptId())->ToString()); | 207 location->Set(v8AtomicString(isolate, "scriptId"), v8::Integer::New(isolate,
function->ScriptId())->ToString()); |
| 208 | 208 |
| 209 v8::Local<v8::Object> result = v8::Object::New(isolate); | 209 v8::Local<v8::Object> result = v8::Object::New(isolate); |
| 210 result->Set(v8AtomicString(isolate, "location"), location); | 210 result->Set(v8AtomicString(isolate, "location"), location); |
| 211 | 211 |
| 212 v8::Handle<v8::String> name = functionDisplayName(function); | 212 v8::Handle<v8::String> name = functionDisplayName(function); |
| 213 result->Set(v8AtomicString(isolate, "functionName"), name.IsEmpty() ? v8Atom
icString(isolate, "") : name); | 213 result->Set(v8AtomicString(isolate, "functionName"), name.IsEmpty() ? v8Atom
icString(isolate, "") : name); |
| 214 | 214 |
| 215 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 215 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 216 ScriptDebugServer& debugServer = host->scriptDebugServer(); | 216 ScriptDebugServer& debugServer = host->scriptDebugServer(); |
| 217 v8::Handle<v8::Value> scopes = debugServer.functionScopes(function); | 217 v8::Handle<v8::Value> scopes = debugServer.functionScopes(function); |
| 218 if (!scopes.IsEmpty() && scopes->IsArray()) | 218 if (!scopes.IsEmpty() && scopes->IsArray()) |
| 219 result->Set(v8AtomicString(isolate, "rawScopes"), scopes); | 219 result->Set(v8AtomicString(isolate, "rawScopes"), scopes); |
| 220 | 220 |
| 221 v8SetReturnValue(info, result); | 221 v8SetReturnValue(info, result); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void V8InjectedScriptHost::collectionEntriesMethodCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) | 224 void V8InjectedScriptHost::collectionEntriesMethodCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) |
| 225 { | 225 { |
| 226 if (info.Length() < 1 || !info[0]->IsObject()) | 226 if (info.Length() < 1 || !info[0]->IsObject()) |
| 227 return; | 227 return; |
| 228 | 228 |
| 229 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(info[0]); | 229 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(info[0]); |
| 230 | 230 |
| 231 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 231 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 232 ScriptDebugServer& debugServer = host->scriptDebugServer(); | 232 ScriptDebugServer& debugServer = host->scriptDebugServer(); |
| 233 v8SetReturnValue(info, debugServer.collectionEntries(object)); | 233 v8SetReturnValue(info, debugServer.collectionEntries(object)); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void V8InjectedScriptHost::getInternalPropertiesMethodCustom(const v8::FunctionC
allbackInfo<v8::Value>& info) | 236 void V8InjectedScriptHost::getInternalPropertiesMethodCustom(const v8::FunctionC
allbackInfo<v8::Value>& info) |
| 237 { | 237 { |
| 238 if (info.Length() < 1 || !info[0]->IsObject()) | 238 if (info.Length() < 1 || !info[0]->IsObject()) |
| 239 return; | 239 return; |
| 240 | 240 |
| 241 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(info[0]); | 241 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(info[0]); |
| 242 | 242 |
| 243 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 243 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 244 ScriptDebugServer& debugServer = host->scriptDebugServer(); | 244 ScriptDebugServer& debugServer = host->scriptDebugServer(); |
| 245 v8SetReturnValue(info, debugServer.getInternalProperties(object)); | 245 v8SetReturnValue(info, debugServer.getInternalProperties(object)); |
| 246 } | 246 } |
| 247 | 247 |
| 248 static v8::Handle<v8::Array> getJSListenerFunctions(ExecutionContext* executionC
ontext, const EventListenerInfo& listenerInfo, v8::Isolate* isolate) | 248 static v8::Handle<v8::Array> getJSListenerFunctions(ExecutionContext* executionC
ontext, const EventListenerInfo& listenerInfo, v8::Isolate* isolate) |
| 249 { | 249 { |
| 250 v8::Local<v8::Array> result = v8::Array::New(isolate); | 250 v8::Local<v8::Array> result = v8::Array::New(isolate); |
| 251 size_t handlersCount = listenerInfo.eventListenerVector.size(); | 251 size_t handlersCount = listenerInfo.eventListenerVector.size(); |
| 252 for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) { | 252 for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) { |
| 253 RefPtr<EventListener> listener = listenerInfo.eventListenerVector[i].lis
tener; | 253 RefPtr<EventListener> listener = listenerInfo.eventListenerVector[i].lis
tener; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 277 return result; | 277 return result; |
| 278 } | 278 } |
| 279 | 279 |
| 280 void V8InjectedScriptHost::getEventListenersMethodCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) | 280 void V8InjectedScriptHost::getEventListenersMethodCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) |
| 281 { | 281 { |
| 282 if (info.Length() < 1) | 282 if (info.Length() < 1) |
| 283 return; | 283 return; |
| 284 | 284 |
| 285 | 285 |
| 286 v8::Local<v8::Value> value = info[0]; | 286 v8::Local<v8::Value> value = info[0]; |
| 287 EventTarget* target = V8EventTarget::toNativeWithTypeCheck(info.GetIsolate()
, value); | 287 EventTarget* target = V8EventTarget::toImplWithTypeCheck(info.GetIsolate(),
value); |
| 288 | 288 |
| 289 // We need to handle a LocalDOMWindow specially, because a LocalDOMWindow wr
apper exists on a prototype chain. | 289 // We need to handle a LocalDOMWindow specially, because a LocalDOMWindow wr
apper exists on a prototype chain. |
| 290 if (!target) | 290 if (!target) |
| 291 target = toDOMWindow(value, info.GetIsolate()); | 291 target = toDOMWindow(value, info.GetIsolate()); |
| 292 | 292 |
| 293 if (!target || !target->executionContext()) | 293 if (!target || !target->executionContext()) |
| 294 return; | 294 return; |
| 295 | 295 |
| 296 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 296 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 297 Vector<EventListenerInfo> listenersArray; | 297 Vector<EventListenerInfo> listenersArray; |
| 298 host->getEventListenersImpl(target, listenersArray); | 298 host->getEventListenersImpl(target, listenersArray); |
| 299 | 299 |
| 300 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate()); | 300 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate()); |
| 301 for (size_t i = 0; i < listenersArray.size(); ++i) { | 301 for (size_t i = 0; i < listenersArray.size(); ++i) { |
| 302 v8::Handle<v8::Array> listeners = getJSListenerFunctions(target->executi
onContext(), listenersArray[i], info.GetIsolate()); | 302 v8::Handle<v8::Array> listeners = getJSListenerFunctions(target->executi
onContext(), listenersArray[i], info.GetIsolate()); |
| 303 if (!listeners->Length()) | 303 if (!listeners->Length()) |
| 304 continue; | 304 continue; |
| 305 AtomicString eventType = listenersArray[i].eventType; | 305 AtomicString eventType = listenersArray[i].eventType; |
| 306 result->Set(v8String(info.GetIsolate(), eventType), listeners); | 306 result->Set(v8String(info.GetIsolate(), eventType), listeners); |
| 307 } | 307 } |
| 308 | 308 |
| 309 v8SetReturnValue(info, result); | 309 v8SetReturnValue(info, result); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void V8InjectedScriptHost::inspectMethodCustom(const v8::FunctionCallbackInfo<v8
::Value>& info) | 312 void V8InjectedScriptHost::inspectMethodCustom(const v8::FunctionCallbackInfo<v8
::Value>& info) |
| 313 { | 313 { |
| 314 if (info.Length() < 2) | 314 if (info.Length() < 2) |
| 315 return; | 315 return; |
| 316 | 316 |
| 317 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 317 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 318 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 318 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| 319 ScriptValue object(scriptState, info[0]); | 319 ScriptValue object(scriptState, info[0]); |
| 320 ScriptValue hints(scriptState, info[1]); | 320 ScriptValue hints(scriptState, info[1]); |
| 321 host->inspectImpl(object.toJSONValue(scriptState), hints.toJSONValue(scriptS
tate)); | 321 host->inspectImpl(object.toJSONValue(scriptState), hints.toJSONValue(scriptS
tate)); |
| 322 } | 322 } |
| 323 | 323 |
| 324 void V8InjectedScriptHost::evalMethodCustom(const v8::FunctionCallbackInfo<v8::V
alue>& info) | 324 void V8InjectedScriptHost::evalMethodCustom(const v8::FunctionCallbackInfo<v8::V
alue>& info) |
| 325 { | 325 { |
| 326 v8::Isolate* isolate = info.GetIsolate(); | 326 v8::Isolate* isolate = info.GetIsolate(); |
| 327 if (info.Length() < 1) { | 327 if (info.Length() < 1) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 v8SetReturnValue(info, wrappedResult); | 374 v8SetReturnValue(info, wrappedResult); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void V8InjectedScriptHost::setFunctionVariableValueMethodCustom(const v8::Functi
onCallbackInfo<v8::Value>& info) | 377 void V8InjectedScriptHost::setFunctionVariableValueMethodCustom(const v8::Functi
onCallbackInfo<v8::Value>& info) |
| 378 { | 378 { |
| 379 v8::Handle<v8::Value> functionValue = info[0]; | 379 v8::Handle<v8::Value> functionValue = info[0]; |
| 380 int scopeIndex = info[1]->Int32Value(); | 380 int scopeIndex = info[1]->Int32Value(); |
| 381 String variableName = toCoreStringWithUndefinedOrNullCheck(info[2]); | 381 String variableName = toCoreStringWithUndefinedOrNullCheck(info[2]); |
| 382 v8::Handle<v8::Value> newValue = info[3]; | 382 v8::Handle<v8::Value> newValue = info[3]; |
| 383 | 383 |
| 384 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 384 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 385 ScriptDebugServer& debugServer = host->scriptDebugServer(); | 385 ScriptDebugServer& debugServer = host->scriptDebugServer(); |
| 386 v8SetReturnValue(info, debugServer.setFunctionVariableValue(functionValue, s
copeIndex, variableName, newValue)); | 386 v8SetReturnValue(info, debugServer.setFunctionVariableValue(functionValue, s
copeIndex, variableName, newValue)); |
| 387 } | 387 } |
| 388 | 388 |
| 389 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& info,
String* scriptId, int* lineNumber, int* columnNumber) | 389 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& info,
String* scriptId, int* lineNumber, int* columnNumber) |
| 390 { | 390 { |
| 391 if (info.Length() < 1) | 391 if (info.Length() < 1) |
| 392 return false; | 392 return false; |
| 393 v8::Handle<v8::Value> fn = info[0]; | 393 v8::Handle<v8::Value> fn = info[0]; |
| 394 if (!fn->IsFunction()) | 394 if (!fn->IsFunction()) |
| 395 return false; | 395 return false; |
| 396 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(fn); | 396 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(fn); |
| 397 *lineNumber = function->GetScriptLineNumber(); | 397 *lineNumber = function->GetScriptLineNumber(); |
| 398 *columnNumber = function->GetScriptColumnNumber(); | 398 *columnNumber = function->GetScriptColumnNumber(); |
| 399 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8:
:Function::kLineOffsetNotFound) | 399 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8:
:Function::kLineOffsetNotFound) |
| 400 return false; | 400 return false; |
| 401 *scriptId = String::number(function->ScriptId()); | 401 *scriptId = String::number(function->ScriptId()); |
| 402 return true; | 402 return true; |
| 403 } | 403 } |
| 404 | 404 |
| 405 void V8InjectedScriptHost::debugFunctionMethodCustom(const v8::FunctionCallbackI
nfo<v8::Value>& info) | 405 void V8InjectedScriptHost::debugFunctionMethodCustom(const v8::FunctionCallbackI
nfo<v8::Value>& info) |
| 406 { | 406 { |
| 407 String scriptId; | 407 String scriptId; |
| 408 int lineNumber; | 408 int lineNumber; |
| 409 int columnNumber; | 409 int columnNumber; |
| 410 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) | 410 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) |
| 411 return; | 411 return; |
| 412 | 412 |
| 413 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 413 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 414 host->debugFunction(scriptId, lineNumber, columnNumber); | 414 host->debugFunction(scriptId, lineNumber, columnNumber); |
| 415 } | 415 } |
| 416 | 416 |
| 417 void V8InjectedScriptHost::undebugFunctionMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 417 void V8InjectedScriptHost::undebugFunctionMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 418 { | 418 { |
| 419 String scriptId; | 419 String scriptId; |
| 420 int lineNumber; | 420 int lineNumber; |
| 421 int columnNumber; | 421 int columnNumber; |
| 422 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) | 422 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) |
| 423 return; | 423 return; |
| 424 | 424 |
| 425 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 425 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 426 host->undebugFunction(scriptId, lineNumber, columnNumber); | 426 host->undebugFunction(scriptId, lineNumber, columnNumber); |
| 427 } | 427 } |
| 428 | 428 |
| 429 void V8InjectedScriptHost::monitorFunctionMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 429 void V8InjectedScriptHost::monitorFunctionMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 430 { | 430 { |
| 431 String scriptId; | 431 String scriptId; |
| 432 int lineNumber; | 432 int lineNumber; |
| 433 int columnNumber; | 433 int columnNumber; |
| 434 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) | 434 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) |
| 435 return; | 435 return; |
| 436 | 436 |
| 437 v8::Handle<v8::Value> name; | 437 v8::Handle<v8::Value> name; |
| 438 if (info.Length() > 0 && info[0]->IsFunction()) { | 438 if (info.Length() > 0 && info[0]->IsFunction()) { |
| 439 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(info[
0]); | 439 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(info[
0]); |
| 440 name = function->GetName(); | 440 name = function->GetName(); |
| 441 if (!name->IsString() || !v8::Handle<v8::String>::Cast(name)->Length()) | 441 if (!name->IsString() || !v8::Handle<v8::String>::Cast(name)->Length()) |
| 442 name = function->GetInferredName(); | 442 name = function->GetInferredName(); |
| 443 } | 443 } |
| 444 | 444 |
| 445 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 445 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 446 host->monitorFunction(scriptId, lineNumber, columnNumber, toCoreStringWithUn
definedOrNullCheck(name)); | 446 host->monitorFunction(scriptId, lineNumber, columnNumber, toCoreStringWithUn
definedOrNullCheck(name)); |
| 447 } | 447 } |
| 448 | 448 |
| 449 void V8InjectedScriptHost::unmonitorFunctionMethodCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) | 449 void V8InjectedScriptHost::unmonitorFunctionMethodCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) |
| 450 { | 450 { |
| 451 String scriptId; | 451 String scriptId; |
| 452 int lineNumber; | 452 int lineNumber; |
| 453 int columnNumber; | 453 int columnNumber; |
| 454 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) | 454 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) |
| 455 return; | 455 return; |
| 456 | 456 |
| 457 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 457 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 458 host->unmonitorFunction(scriptId, lineNumber, columnNumber); | 458 host->unmonitorFunction(scriptId, lineNumber, columnNumber); |
| 459 } | 459 } |
| 460 | 460 |
| 461 void V8InjectedScriptHost::callFunctionMethodCustom(const v8::FunctionCallbackIn
fo<v8::Value>& info) | 461 void V8InjectedScriptHost::callFunctionMethodCustom(const v8::FunctionCallbackIn
fo<v8::Value>& info) |
| 462 { | 462 { |
| 463 if (info.Length() < 2 || info.Length() > 3 || !info[0]->IsFunction()) { | 463 if (info.Length() < 2 || info.Length() > 3 || !info[0]->IsFunction()) { |
| 464 ASSERT_NOT_REACHED(); | 464 ASSERT_NOT_REACHED(); |
| 465 return; | 465 return; |
| 466 } | 466 } |
| 467 | 467 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 484 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu
e>[argc]); | 484 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu
e>[argc]); |
| 485 for (size_t i = 0; i < argc; ++i) | 485 for (size_t i = 0; i < argc; ++i) |
| 486 argv[i] = arguments->Get(i); | 486 argv[i] = arguments->Get(i); |
| 487 | 487 |
| 488 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); | 488 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); |
| 489 v8SetReturnValue(info, result); | 489 v8SetReturnValue(info, result); |
| 490 } | 490 } |
| 491 | 491 |
| 492 void V8InjectedScriptHost::suppressWarningsAndCallFunctionMethodCustom(const v8:
:FunctionCallbackInfo<v8::Value>& info) | 492 void V8InjectedScriptHost::suppressWarningsAndCallFunctionMethodCustom(const v8:
:FunctionCallbackInfo<v8::Value>& info) |
| 493 { | 493 { |
| 494 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 494 InjectedScriptHost* host = V8InjectedScriptHost::toImpl(info.Holder()); |
| 495 ScriptDebugServer& debugServer = host->scriptDebugServer(); | 495 ScriptDebugServer& debugServer = host->scriptDebugServer(); |
| 496 debugServer.muteWarningsAndDeprecations(); | 496 debugServer.muteWarningsAndDeprecations(); |
| 497 | 497 |
| 498 callFunctionMethodCustom(info); | 498 callFunctionMethodCustom(info); |
| 499 | 499 |
| 500 debugServer.unmuteWarningsAndDeprecations(); | 500 debugServer.unmuteWarningsAndDeprecations(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace blink | 503 } // namespace blink |
| OLD | NEW |