| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/v8_inspector/V8InjectedScriptHost.h" | 5 #include "platform/v8_inspector/V8InjectedScriptHost.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/String16.h" |
| 7 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
| 8 #include "platform/v8_inspector/InjectedScript.h" | 9 #include "platform/v8_inspector/InjectedScript.h" |
| 9 #include "platform/v8_inspector/InjectedScriptHost.h" | 10 #include "platform/v8_inspector/InjectedScriptHost.h" |
| 10 #include "platform/v8_inspector/InspectorWrapper.h" | 11 #include "platform/v8_inspector/InspectorWrapper.h" |
| 11 #include "platform/v8_inspector/JavaScriptCallFrame.h" | 12 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
| 12 #include "platform/v8_inspector/V8DebuggerImpl.h" | 13 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 13 #include "platform/v8_inspector/V8StringUtil.h" | 14 #include "platform/v8_inspector/V8StringUtil.h" |
| 14 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 15 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
| 15 #include "platform/v8_inspector/public/V8EventListenerInfo.h" | 16 #include "platform/v8_inspector/public/V8EventListenerInfo.h" |
| 16 #include "platform/v8_inspector/public/V8ToProtocolValue.h" | 17 #include "platform/v8_inspector/public/V8ToProtocolValue.h" |
| 17 #include "wtf/text/WTFString.h" | |
| 18 #include <algorithm> | 18 #include <algorithm> |
| 19 | 19 |
| 20 namespace blink { | 20 namespace blink { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 template<typename CallbackInfo, typename S> | 24 template<typename CallbackInfo, typename S> |
| 25 inline void v8SetReturnValue(const CallbackInfo& info, const v8::Local<S> handle
) | 25 inline void v8SetReturnValue(const CallbackInfo& info, const v8::Local<S> handle
) |
| 26 { | 26 { |
| 27 info.GetReturnValue().Set(handle); | 27 info.GetReturnValue().Set(handle); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 if (value->IsNativeError()) { | 141 if (value->IsNativeError()) { |
| 142 v8SetReturnValue(info, toV8StringInternalized(isolate, "error")); | 142 v8SetReturnValue(info, toV8StringInternalized(isolate, "error")); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 | 145 |
| 146 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); | 146 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); |
| 147 if (!host->debugger()) | 147 if (!host->debugger()) |
| 148 return; | 148 return; |
| 149 String subtype = host->debugger()->client()->valueSubtype(value); | 149 String16 subtype = host->debugger()->client()->valueSubtype(value); |
| 150 if (!subtype.isEmpty()) { | 150 if (!subtype.isEmpty()) { |
| 151 v8SetReturnValue(info, toV8String(isolate, subtype)); | 151 v8SetReturnValue(info, toV8String(isolate, subtype)); |
| 152 return; | 152 return; |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 void V8InjectedScriptHost::functionDetailsCallback(const v8::FunctionCallbackInf
o<v8::Value>& info) | 156 void V8InjectedScriptHost::functionDetailsCallback(const v8::FunctionCallbackInf
o<v8::Value>& info) |
| 157 { | 157 { |
| 158 if (info.Length() < 1 || !info[0]->IsFunction()) | 158 if (info.Length() < 1 || !info[0]->IsFunction()) |
| 159 return; | 159 return; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 return; | 241 return; |
| 242 | 242 |
| 243 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); | 243 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); |
| 244 if (!host->debugger()) | 244 if (!host->debugger()) |
| 245 return; | 245 return; |
| 246 V8DebuggerClient* client = host->debugger()->client(); | 246 V8DebuggerClient* client = host->debugger()->client(); |
| 247 V8EventListenerInfoMap listenerInfo; | 247 V8EventListenerInfoMap listenerInfo; |
| 248 client->eventListeners(info[0], listenerInfo); | 248 client->eventListeners(info[0], listenerInfo); |
| 249 | 249 |
| 250 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate()); | 250 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate()); |
| 251 protocol::Vector<String> types; | 251 protocol::Vector<String16> types; |
| 252 for (auto& it : listenerInfo) | 252 for (auto& it : listenerInfo) |
| 253 types.append(it.first); | 253 types.append(it.first); |
| 254 std::sort(types.begin(), types.end(), WTF::codePointCompareLessThan); | 254 std::sort(types.begin(), types.end(), String16::codePointCompareLessThan); |
| 255 for (const String& type : types) { | 255 for (const String16& type : types) { |
| 256 v8::Local<v8::Array> listeners = wrapListenerFunctions(info.GetIsolate()
, *listenerInfo.get(type)); | 256 v8::Local<v8::Array> listeners = wrapListenerFunctions(info.GetIsolate()
, *listenerInfo.get(type)); |
| 257 if (!listeners->Length()) | 257 if (!listeners->Length()) |
| 258 continue; | 258 continue; |
| 259 result->Set(toV8String(info.GetIsolate(), type), listeners); | 259 result->Set(toV8String(info.GetIsolate(), type), listeners); |
| 260 } | 260 } |
| 261 | 261 |
| 262 v8SetReturnValue(info, result); | 262 v8SetReturnValue(info, result); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void V8InjectedScriptHost::inspectCallback(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 265 void V8InjectedScriptHost::inspectCallback(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 v8::Local<v8::Object> wrappedResult = v8::Object::New(isolate); | 325 v8::Local<v8::Object> wrappedResult = v8::Object::New(isolate); |
| 326 if (wrappedResult.IsEmpty()) | 326 if (wrappedResult.IsEmpty()) |
| 327 return; | 327 return; |
| 328 | 328 |
| 329 v8::TryCatch tryCatch(isolate); | 329 v8::TryCatch tryCatch(isolate); |
| 330 v8::Local<v8::Context> context = isolate->GetCurrentContext(); | 330 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
| 331 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(context, info.Holder
()); | 331 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(context, info.Holder
()); |
| 332 if (!host->debugger()) | 332 if (!host->debugger()) |
| 333 return; | 333 return; |
| 334 | 334 |
| 335 v8::Local<v8::Script> script = host->debugger()->compileInternalScript(conte
xt, expression, String()); | 335 v8::Local<v8::Script> script = host->debugger()->compileInternalScript(conte
xt, expression, String16()); |
| 336 if (script.IsEmpty()) { | 336 if (script.IsEmpty()) { |
| 337 setExceptionAsReturnValue(info, wrappedResult, tryCatch); | 337 setExceptionAsReturnValue(info, wrappedResult, tryCatch); |
| 338 return; | 338 return; |
| 339 } | 339 } |
| 340 | 340 |
| 341 v8::Local<v8::Symbol> commandLineAPISymbolValue = V8Debugger::commandLineAPI
Symbol(isolate); | 341 v8::Local<v8::Symbol> commandLineAPISymbolValue = V8Debugger::commandLineAPI
Symbol(isolate); |
| 342 v8::Local<v8::Object> global = context->Global(); | 342 v8::Local<v8::Object> global = context->Global(); |
| 343 if (info.Length() >= 2 && info[1]->IsObject()) { | 343 if (info.Length() >= 2 && info[1]->IsObject()) { |
| 344 v8::Local<v8::Object> commandLineAPI = info[1]->ToObject(isolate); | 344 v8::Local<v8::Object> commandLineAPI = info[1]->ToObject(isolate); |
| 345 global->Set(commandLineAPISymbolValue, commandLineAPI); | 345 global->Set(commandLineAPISymbolValue, commandLineAPI); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 358 v8SetReturnValue(info, wrappedResult); | 358 v8SetReturnValue(info, wrappedResult); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void V8InjectedScriptHost::setFunctionVariableValueCallback(const v8::FunctionCa
llbackInfo<v8::Value>& info) | 361 void V8InjectedScriptHost::setFunctionVariableValueCallback(const v8::FunctionCa
llbackInfo<v8::Value>& info) |
| 362 { | 362 { |
| 363 if (info.Length() < 4 || !info[0]->IsFunction() || !info[1]->IsInt32() || !i
nfo[2]->IsString()) | 363 if (info.Length() < 4 || !info[0]->IsFunction() || !info[1]->IsInt32() || !i
nfo[2]->IsString()) |
| 364 return; | 364 return; |
| 365 | 365 |
| 366 v8::Local<v8::Value> functionValue = info[0]; | 366 v8::Local<v8::Value> functionValue = info[0]; |
| 367 int scopeIndex = info[1].As<v8::Int32>()->Value(); | 367 int scopeIndex = info[1].As<v8::Int32>()->Value(); |
| 368 String variableName = toWTFStringWithTypeCheck(info[2]); | 368 String16 variableName = toProtocolStringWithTypeCheck(info[2]); |
| 369 v8::Local<v8::Value> newValue = info[3]; | 369 v8::Local<v8::Value> newValue = info[3]; |
| 370 | 370 |
| 371 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); | 371 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); |
| 372 if (!host->debugger()) | 372 if (!host->debugger()) |
| 373 return; | 373 return; |
| 374 v8SetReturnValue(info, host->debugger()->setFunctionVariableValue(functionVa
lue, scopeIndex, variableName, newValue)); | 374 v8SetReturnValue(info, host->debugger()->setFunctionVariableValue(functionVa
lue, scopeIndex, variableName, newValue)); |
| 375 } | 375 } |
| 376 | 376 |
| 377 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& info,
String* scriptId, int* lineNumber, int* columnNumber) | 377 static bool getFunctionLocation(const v8::FunctionCallbackInfo<v8::Value>& info,
String16* scriptId, int* lineNumber, int* columnNumber) |
| 378 { | 378 { |
| 379 if (info.Length() < 1 || !info[0]->IsFunction()) | 379 if (info.Length() < 1 || !info[0]->IsFunction()) |
| 380 return false; | 380 return false; |
| 381 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(info[0]); | 381 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(info[0]); |
| 382 *lineNumber = function->GetScriptLineNumber(); | 382 *lineNumber = function->GetScriptLineNumber(); |
| 383 *columnNumber = function->GetScriptColumnNumber(); | 383 *columnNumber = function->GetScriptColumnNumber(); |
| 384 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8:
:Function::kLineOffsetNotFound) | 384 if (*lineNumber == v8::Function::kLineOffsetNotFound || *columnNumber == v8:
:Function::kLineOffsetNotFound) |
| 385 return false; | 385 return false; |
| 386 *scriptId = String::number(function->ScriptId()); | 386 *scriptId = String16::number(function->ScriptId()); |
| 387 return true; | 387 return true; |
| 388 } | 388 } |
| 389 | 389 |
| 390 void V8InjectedScriptHost::debugFunctionCallback(const v8::FunctionCallbackInfo<
v8::Value>& info) | 390 void V8InjectedScriptHost::debugFunctionCallback(const v8::FunctionCallbackInfo<
v8::Value>& info) |
| 391 { | 391 { |
| 392 String scriptId; | 392 String16 scriptId; |
| 393 int lineNumber; | 393 int lineNumber; |
| 394 int columnNumber; | 394 int columnNumber; |
| 395 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) | 395 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) |
| 396 return; | 396 return; |
| 397 | 397 |
| 398 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); | 398 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); |
| 399 host->debugFunction(scriptId, lineNumber, columnNumber); | 399 host->debugFunction(scriptId, lineNumber, columnNumber); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void V8InjectedScriptHost::undebugFunctionCallback(const v8::FunctionCallbackInf
o<v8::Value>& info) | 402 void V8InjectedScriptHost::undebugFunctionCallback(const v8::FunctionCallbackInf
o<v8::Value>& info) |
| 403 { | 403 { |
| 404 String scriptId; | 404 String16 scriptId; |
| 405 int lineNumber; | 405 int lineNumber; |
| 406 int columnNumber; | 406 int columnNumber; |
| 407 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) | 407 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) |
| 408 return; | 408 return; |
| 409 | 409 |
| 410 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); | 410 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); |
| 411 host->undebugFunction(scriptId, lineNumber, columnNumber); | 411 host->undebugFunction(scriptId, lineNumber, columnNumber); |
| 412 } | 412 } |
| 413 | 413 |
| 414 void V8InjectedScriptHost::monitorFunctionCallback(const v8::FunctionCallbackInf
o<v8::Value>& info) | 414 void V8InjectedScriptHost::monitorFunctionCallback(const v8::FunctionCallbackInf
o<v8::Value>& info) |
| 415 { | 415 { |
| 416 String scriptId; | 416 String16 scriptId; |
| 417 int lineNumber; | 417 int lineNumber; |
| 418 int columnNumber; | 418 int columnNumber; |
| 419 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) | 419 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) |
| 420 return; | 420 return; |
| 421 | 421 |
| 422 v8::Local<v8::Value> name; | 422 v8::Local<v8::Value> name; |
| 423 if (info.Length() > 0 && info[0]->IsFunction()) { | 423 if (info.Length() > 0 && info[0]->IsFunction()) { |
| 424 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(info[0]
); | 424 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(info[0]
); |
| 425 name = function->GetName(); | 425 name = function->GetName(); |
| 426 if (!name->IsString() || !v8::Local<v8::String>::Cast(name)->Length()) | 426 if (!name->IsString() || !v8::Local<v8::String>::Cast(name)->Length()) |
| 427 name = function->GetInferredName(); | 427 name = function->GetInferredName(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); | 430 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); |
| 431 host->monitorFunction(scriptId, lineNumber, columnNumber, toWTFStringWithTyp
eCheck(name)); | 431 host->monitorFunction(scriptId, lineNumber, columnNumber, toProtocolStringWi
thTypeCheck(name)); |
| 432 } | 432 } |
| 433 | 433 |
| 434 void V8InjectedScriptHost::unmonitorFunctionCallback(const v8::FunctionCallbackI
nfo<v8::Value>& info) | 434 void V8InjectedScriptHost::unmonitorFunctionCallback(const v8::FunctionCallbackI
nfo<v8::Value>& info) |
| 435 { | 435 { |
| 436 String scriptId; | 436 String16 scriptId; |
| 437 int lineNumber; | 437 int lineNumber; |
| 438 int columnNumber; | 438 int columnNumber; |
| 439 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) | 439 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) |
| 440 return; | 440 return; |
| 441 | 441 |
| 442 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); | 442 InjectedScriptHost* host = V8InjectedScriptHost::unwrap(info.GetIsolate()->G
etCurrentContext(), info.Holder()); |
| 443 host->unmonitorFunction(scriptId, lineNumber, columnNumber); | 443 host->unmonitorFunction(scriptId, lineNumber, columnNumber); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void V8InjectedScriptHost::callFunctionCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) | 446 void V8InjectedScriptHost::callFunctionCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 | 498 |
| 499 void V8InjectedScriptHost::bindCallback(const v8::FunctionCallbackInfo<v8::Value
>& info) | 499 void V8InjectedScriptHost::bindCallback(const v8::FunctionCallbackInfo<v8::Value
>& info) |
| 500 { | 500 { |
| 501 if (info.Length() < 2 || !info[1]->IsString()) | 501 if (info.Length() < 2 || !info[1]->IsString()) |
| 502 return; | 502 return; |
| 503 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec
tedScriptHost(info.Holder()); | 503 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec
tedScriptHost(info.Holder()); |
| 504 if (!injectedScriptNative) | 504 if (!injectedScriptNative) |
| 505 return; | 505 return; |
| 506 | 506 |
| 507 v8::Local<v8::String> v8groupName = info[1]->ToString(info.GetIsolate()); | 507 v8::Local<v8::String> v8groupName = info[1]->ToString(info.GetIsolate()); |
| 508 String groupName = toWTFStringWithTypeCheck(v8groupName); | 508 String16 groupName = toProtocolStringWithTypeCheck(v8groupName); |
| 509 int id = injectedScriptNative->bind(info[0], groupName); | 509 int id = injectedScriptNative->bind(info[0], groupName); |
| 510 info.GetReturnValue().Set(id); | 510 info.GetReturnValue().Set(id); |
| 511 } | 511 } |
| 512 | 512 |
| 513 void V8InjectedScriptHost::objectForIdCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) | 513 void V8InjectedScriptHost::objectForIdCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) |
| 514 { | 514 { |
| 515 if (info.Length() < 1 || !info[0]->IsInt32()) | 515 if (info.Length() < 1 || !info[0]->IsInt32()) |
| 516 return; | 516 return; |
| 517 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec
tedScriptHost(info.Holder()); | 517 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec
tedScriptHost(info.Holder()); |
| 518 if (!injectedScriptNative) | 518 if (!injectedScriptNative) |
| 519 return; | 519 return; |
| 520 int id = info[0].As<v8::Int32>()->Value(); | 520 int id = info[0].As<v8::Int32>()->Value(); |
| 521 v8::Local<v8::Value> value = injectedScriptNative->objectForId(id); | 521 v8::Local<v8::Value> value = injectedScriptNative->objectForId(id); |
| 522 if (!value.IsEmpty()) | 522 if (!value.IsEmpty()) |
| 523 info.GetReturnValue().Set(value); | 523 info.GetReturnValue().Set(value); |
| 524 } | 524 } |
| 525 | 525 |
| 526 void V8InjectedScriptHost::idToObjectGroupNameCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 526 void V8InjectedScriptHost::idToObjectGroupNameCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 527 { | 527 { |
| 528 if (info.Length() < 1 || !info[0]->IsInt32()) | 528 if (info.Length() < 1 || !info[0]->IsInt32()) |
| 529 return; | 529 return; |
| 530 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec
tedScriptHost(info.Holder()); | 530 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec
tedScriptHost(info.Holder()); |
| 531 if (!injectedScriptNative) | 531 if (!injectedScriptNative) |
| 532 return; | 532 return; |
| 533 int id = info[0].As<v8::Int32>()->Value(); | 533 int id = info[0].As<v8::Int32>()->Value(); |
| 534 String groupName = injectedScriptNative->groupName(id); | 534 String16 groupName = injectedScriptNative->groupName(id); |
| 535 if (!groupName.isEmpty()) | 535 if (!groupName.isEmpty()) |
| 536 info.GetReturnValue().Set(toV8String(info.GetIsolate(), groupName)); | 536 info.GetReturnValue().Set(toV8String(info.GetIsolate(), groupName)); |
| 537 } | 537 } |
| 538 | 538 |
| 539 v8::Local<v8::Symbol> V8Debugger::commandLineAPISymbol(v8::Isolate* isolate) | 539 v8::Local<v8::Symbol> V8Debugger::commandLineAPISymbol(v8::Isolate* isolate) |
| 540 { | 540 { |
| 541 return v8::Symbol::ForApi(isolate, toV8StringInternalized(isolate, "commandL
ineAPI")); | 541 return v8::Symbol::ForApi(isolate, toV8StringInternalized(isolate, "commandL
ineAPI")); |
| 542 } | 542 } |
| 543 | 543 |
| 544 bool V8Debugger::isCommandLineAPIMethod(const AtomicString& name) | 544 bool V8Debugger::isCommandLineAPIMethod(const String16& name) |
| 545 { | 545 { |
| 546 DEFINE_STATIC_LOCAL(protocol::HashSet<String>, methods, ()); | 546 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, methods, ()); |
| 547 if (methods.size() == 0) { | 547 if (methods.size() == 0) { |
| 548 const char* members[] = { "$", "$$", "$x", "dir", "dirxml", "keys", "val
ues", "profile", "profileEnd", | 548 const char* members[] = { "$", "$$", "$x", "dir", "dirxml", "keys", "val
ues", "profile", "profileEnd", |
| 549 "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "get
EventListeners", | 549 "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "get
EventListeners", |
| 550 "debug", "undebug", "monitor", "unmonitor", "table", "$_", "$0", "$1
", "$2", "$3", "$4" }; | 550 "debug", "undebug", "monitor", "unmonitor", "table", "$_", "$0", "$1
", "$2", "$3", "$4" }; |
| 551 for (size_t i = 0; i < sizeof(members) / sizeof(const char*); ++i) | 551 for (size_t i = 0; i < sizeof(members) / sizeof(const char*); ++i) |
| 552 methods.add(members[i]); | 552 methods.add(members[i]); |
| 553 } | 553 } |
| 554 return methods.find(name) != methods.end(); | 554 return methods.find(name) != methods.end(); |
| 555 } | 555 } |
| 556 | 556 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 { | 602 { |
| 603 return InjectedScriptHostWrapper::wrap(client, constructorTemplate, context,
host); | 603 return InjectedScriptHostWrapper::wrap(client, constructorTemplate, context,
host); |
| 604 } | 604 } |
| 605 | 605 |
| 606 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) | 606 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) |
| 607 { | 607 { |
| 608 return InjectedScriptHostWrapper::unwrap(context, object); | 608 return InjectedScriptHostWrapper::unwrap(context, object); |
| 609 } | 609 } |
| 610 | 610 |
| 611 } // namespace blink | 611 } // namespace blink |
| OLD | NEW |