| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 26 matching lines...) Expand all Loading... |
| 37 #include "bindings/v8/PageScriptDebugServer.h" | 37 #include "bindings/v8/PageScriptDebugServer.h" |
| 38 #include "bindings/v8/ScriptController.h" | 38 #include "bindings/v8/ScriptController.h" |
| 39 #include "bindings/v8/ScriptState.h" | 39 #include "bindings/v8/ScriptState.h" |
| 40 #include "bindings/v8/V8Binding.h" | 40 #include "bindings/v8/V8Binding.h" |
| 41 #include "core/dom/Document.h" | 41 #include "core/dom/Document.h" |
| 42 #include "core/inspector/InspectorController.h" | 42 #include "core/inspector/InspectorController.h" |
| 43 #include "core/inspector/InspectorDebuggerAgent.h" | 43 #include "core/inspector/InspectorDebuggerAgent.h" |
| 44 #include "core/inspector/InstrumentingAgents.h" | 44 #include "core/inspector/InstrumentingAgents.h" |
| 45 #include "core/page/DOMWindow.h" | 45 #include "core/page/DOMWindow.h" |
| 46 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
| 47 #include "core/platform/Logging.h" |
| 47 | 48 |
| 48 #include <v8-debug.h> | 49 #include <v8-debug.h> |
| 49 #include <wtf/HashMap.h> | 50 #include <wtf/HashMap.h> |
| 50 #include <wtf/Vector.h> | 51 #include <wtf/Vector.h> |
| 51 | 52 |
| 53 |
| 52 namespace WebCore { | 54 namespace WebCore { |
| 53 | 55 |
| 54 class V8EventDetails : public v8::Debug::EventDetails { | 56 class V8EventDetails : public v8::Debug::EventDetails { |
| 55 public: | 57 public: |
| 56 V8EventDetails(v8::DebugEvent event, v8::Handle<v8::Object> executionState, v8
::Handle<v8::Object> eventData) | 58 V8EventDetails(v8::DebugEvent event, v8::Handle<v8::Object> executionState, v8
::Handle<v8::Object> eventData) |
| 57 : m_event(event) | 59 : m_event(event) |
| 58 , m_executionState(executionState) | 60 , m_executionState(executionState) |
| 59 , m_eventData(eventData) | 61 , m_eventData(eventData) |
| 60 { | 62 { |
| 61 Frame* frame = DartUtilities::domWindowForCurrentIsolate()->frame(); | 63 Frame* frame = DartUtilities::domWindowForCurrentIsolate()->frame(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 isolateLoaded->Call(m_dartDebugObject.get(), 1, args); | 185 isolateLoaded->Call(m_dartDebugObject.get(), 1, args); |
| 184 } | 186 } |
| 185 | 187 |
| 186 void DartDebugServer::disable() | 188 void DartDebugServer::disable() |
| 187 { | 189 { |
| 188 V8Scope v8Scope(v8::Debug::GetDebugContext()); | 190 V8Scope v8Scope(v8::Debug::GetDebugContext()); |
| 189 v8::Local<v8::Function> disable = v8::Local<v8::Function>::Cast(m_dartDebugO
bject.get()->Get(v8::String::New("disable"))); | 191 v8::Local<v8::Function> disable = v8::Local<v8::Function>::Cast(m_dartDebugO
bject.get()->Get(v8::String::New("disable"))); |
| 190 disable->Call(m_dartDebugObject.get(), 0, 0); | 192 disable->Call(m_dartDebugObject.get(), 0, 0); |
| 191 } | 193 } |
| 192 | 194 |
| 193 v8::Handle<v8::Value> DartDebugServer::convertInspectedValue(Dart_Handle object) | |
| 194 { | |
| 195 v8::Handle<v8::Function> wrapValue = v8::Handle<v8::Function>::Cast(shared()
.m_dartDebugObject.get()->Get(v8::String::New("wrapValue"))); | |
| 196 v8::Handle<v8::Value> args[] = { DartHandleProxy::create(object) }; | |
| 197 return wrapValue->Call(shared().m_dartDebugObject.get(), 1, args); | |
| 198 } | |
| 199 | |
| 200 v8::Handle<v8::Object> DartDebugServer::createExecutionState(Dart_StackTrace tra
ce) | 195 v8::Handle<v8::Object> DartDebugServer::createExecutionState(Dart_StackTrace tra
ce) |
| 201 { | 196 { |
| 202 intptr_t length = 0; | 197 intptr_t length = 0; |
| 203 Dart_Handle result = Dart_StackTraceLength(trace, &length); | 198 Dart_Handle result = Dart_StackTraceLength(trace, &length); |
| 204 ASSERT(!Dart_IsError(result)); | 199 ASSERT(!Dart_IsError(result)); |
| 205 UNUSED_PARAM(result); | 200 UNUSED_PARAM(result); |
| 206 ASSERT(length); | 201 ASSERT(length); |
| 202 ASSERT(Dart_CurrentIsolate()); |
| 203 int isolateHandle = isolateMap().getByValue(Dart_CurrentIsolate()); |
| 204 |
| 207 v8::Local<v8::Array> callFrames = v8::Array::New(length); | 205 v8::Local<v8::Array> callFrames = v8::Array::New(length); |
| 208 for (int i = length - 1; i >=0; --i) { | 206 for (int i = length - 1; i >=0; --i) { |
| 209 Dart_ActivationFrame frame = 0; | 207 Dart_ActivationFrame frame = 0; |
| 210 result = Dart_GetActivationFrame(trace, i, &frame); | 208 result = Dart_GetActivationFrame(trace, i, &frame); |
| 211 ASSERT(!Dart_IsError(result)); | 209 ASSERT(!Dart_IsError(result)); |
| 212 Dart_Handle functionName = 0; | 210 Dart_Handle functionName = 0; |
| 213 Dart_Handle scriptURL = 0; | 211 Dart_Handle scriptURL = 0; |
| 214 intptr_t lineNumber = 0; | 212 intptr_t lineNumber = 0; |
| 215 intptr_t libraryId = 0; | 213 intptr_t libraryId = 0; |
| 214 |
| 216 result = Dart_ActivationFrameInfo(frame, &functionName, &scriptURL, &lin
eNumber, &libraryId); | 215 result = Dart_ActivationFrameInfo(frame, &functionName, &scriptURL, &lin
eNumber, &libraryId); |
| 217 ASSERT(!Dart_IsError(result)); | 216 ASSERT(!Dart_IsError(result)); |
| 217 Dart_Handle libraryURL = Dart_GetLibraryURL(libraryId); |
| 218 ASSERT(!Dart_IsError(libraryURL)); |
| 219 Dart_Handle library = Dart_LookupLibrary(libraryURL); |
| 218 | 220 |
| 219 v8::Local<v8::Object> callFrame = v8::Object::New(); | 221 v8::Local<v8::Object> callFrame = v8::Object::New(); |
| 220 callFrame->Set(v8::String::New("functionName"), V8Converter::stringToV8(
functionName)); | 222 callFrame->Set(v8::String::New("functionName"), V8Converter::stringToV8(
functionName)); |
| 221 callFrame->Set(v8::String::New("scriptURL"), V8Converter::stringToV8(scr
iptURL)); | 223 callFrame->Set(v8::String::New("scriptURL"), V8Converter::stringToV8(scr
iptURL)); |
| 222 callFrame->Set(v8::String::New("lineNumber"), v8::Number::New(lineNumber
- 1)); | 224 callFrame->Set(v8::String::New("lineNumber"), v8::Number::New(lineNumber
- 1)); |
| 223 callFrame->Set(v8::String::New("libraryProxy"), DartHandleProxy::createF
orLibrary(libraryId)); | 225 callFrame->Set(v8::String::New("libraryProxy"), DartHandleProxy::createL
ibraryProxy(library, libraryId, Dart_Null())); |
| 224 callFrame->Set(v8::String::New("localVariables"), convertInspectedValue(
Dart_GetLocalVariables(frame))); | 226 callFrame->Set(v8::String::New("localScopeProxy"), DartHandleProxy::crea
teLocalScopeProxy( |
| 227 Dart_GetLocalVariables(frame))); |
| 228 callFrame->Set(v8::String::New("isolateHandle"), v8::Number::New(isolate
Handle)); |
| 225 callFrames->Set(i, callFrame); | 229 callFrames->Set(i, callFrame); |
| 226 } | 230 } |
| 227 | 231 |
| 228 v8::Handle<v8::Function> executionStateConstructor = v8::Local<v8::Function>
::Cast(m_dartDebugObject.get()->Get(v8::String::New("ExecutionState"))); | 232 v8::Handle<v8::Function> executionStateConstructor = v8::Local<v8::Function>
::Cast(m_dartDebugObject.get()->Get(v8::String::New("ExecutionState"))); |
| 229 v8::Handle<v8::Value> args[] = { callFrames }; | 233 v8::Handle<v8::Value> args[] = { callFrames }; |
| 230 return v8::Local<v8::Object>::Cast(executionStateConstructor->CallAsConstruc
tor(1, args)); | 234 return v8::Local<v8::Object>::Cast(executionStateConstructor->CallAsConstruc
tor(1, args)); |
| 231 } | 235 } |
| 232 | 236 |
| 233 void DartDebugServer::breakpointHandler(Dart_IsolateId isolate_id, Dart_Breakpoi
nt breakpoint, Dart_StackTrace trace) | 237 void DartDebugServer::breakpointHandler(Dart_IsolateId isolate_id, Dart_Breakpoi
nt breakpoint, Dart_StackTrace trace) |
| 234 { | 238 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 246 void DartDebugServer::exceptionHandler(Dart_IsolateId isolate_id, Dart_Handle ex
ception, Dart_StackTrace trace) | 250 void DartDebugServer::exceptionHandler(Dart_IsolateId isolate_id, Dart_Handle ex
ception, Dart_StackTrace trace) |
| 247 { | 251 { |
| 248 DartDebugServer::shared().handleException(exception, trace); | 252 DartDebugServer::shared().handleException(exception, trace); |
| 249 } | 253 } |
| 250 | 254 |
| 251 void DartDebugServer::handleException(Dart_Handle exception, Dart_StackTrace tra
ce) | 255 void DartDebugServer::handleException(Dart_Handle exception, Dart_StackTrace tra
ce) |
| 252 { | 256 { |
| 253 V8Scope v8Scope(v8::Debug::GetDebugContext()); | 257 V8Scope v8Scope(v8::Debug::GetDebugContext()); |
| 254 V8Scope v8WorldScope(DartUtilities::currentV8Context()); | 258 V8Scope v8WorldScope(DartUtilities::currentV8Context()); |
| 255 v8::Handle<v8::Function> eventDataConstructor = v8::Local<v8::Function>::Cas
t(m_dartDebugObject.get()->Get(v8::String::New("EventData"))); | 259 v8::Handle<v8::Function> eventDataConstructor = v8::Local<v8::Function>::Cas
t(m_dartDebugObject.get()->Get(v8::String::New("EventData"))); |
| 256 v8::Handle<v8::Value> args[] = { convertInspectedValue(exception) }; | 260 v8::Handle<v8::Value> args[] = { DartHandleProxy::create(exception) }; |
| 257 v8::Handle<v8::Object> eventData = v8::Local<v8::Object>::Cast(eventDataCons
tructor->CallAsConstructor(1, args)); | 261 v8::Handle<v8::Object> eventData = v8::Local<v8::Object>::Cast(eventDataCons
tructor->CallAsConstructor(1, args)); |
| 258 V8EventDetails eventDetails(v8::Exception, createExecutionState(trace), even
tData); | 262 V8EventDetails eventDetails(v8::Exception, createExecutionState(trace), even
tData); |
| 259 PageScriptDebugServer::shared().handleV8DebugEvent(eventDetails); | 263 PageScriptDebugServer::shared().handleV8DebugEvent(eventDetails); |
| 260 } | 264 } |
| 261 | 265 |
| 262 static v8::Handle<v8::Value> handleDebugEvent(const v8::Arguments& args) | 266 static v8::Handle<v8::Value> handleDebugEvent(const v8::Arguments& args) |
| 263 { | 267 { |
| 264 v8::DebugEvent event = static_cast<v8::DebugEvent>(args[0]->Int32Value()); | 268 v8::DebugEvent event = static_cast<v8::DebugEvent>(args[0]->Int32Value()); |
| 265 v8::Local<v8::Object> executionState = v8::Local<v8::Object>::Cast(args[1]); | 269 v8::Local<v8::Object> executionState = v8::Local<v8::Object>::Cast(args[1]); |
| 266 v8::Local<v8::Object> eventData = v8::Local<v8::Object>::Cast(args[2]); | 270 v8::Local<v8::Object> eventData = v8::Local<v8::Object>::Cast(args[2]); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 static v8::Handle<v8::Value> stepOut(const v8::Arguments& args) | 405 static v8::Handle<v8::Value> stepOut(const v8::Arguments& args) |
| 402 { | 406 { |
| 403 Dart_SetStepOut(); | 407 Dart_SetStepOut(); |
| 404 return v8::Undefined(); | 408 return v8::Undefined(); |
| 405 } | 409 } |
| 406 | 410 |
| 407 static v8::Handle<v8::Value> evaluateInScope(const v8::Arguments& args) | 411 static v8::Handle<v8::Value> evaluateInScope(const v8::Arguments& args) |
| 408 { | 412 { |
| 409 v8::Handle<v8::String> expression = args[0]->ToString(); | 413 v8::Handle<v8::String> expression = args[0]->ToString(); |
| 410 v8::Handle<v8::Object> receiver = args[1].As<v8::Object>(); | 414 v8::Handle<v8::Object> receiver = args[1].As<v8::Object>(); |
| 411 v8::Handle<v8::Value> scopeObject = args[2]; | 415 v8::Handle<v8::Value> scopeObjectGlobal = args[2]; |
| 416 v8::Handle<v8::Value> scopeObjectLocal = args[3]; |
| 417 v8::Handle<v8::Value> scopes[] = { scopeObjectGlobal, scopeObjectLocal }; |
| 412 | 418 |
| 413 expression = v8::String::Concat(v8::String::New("(function(scopeObject) { wi
th(scopeObject) { return "), expression); | 419 expression = v8::String::Concat(v8::String::New( |
| 420 "(function($$scopeObjectGlobal, $$scopeObjectLocal) { " |
| 421 "var $$scopeObjectLocalThis = $$scopeObjectLocal.this;" |
| 422 "with ($$scopeObjectGlobal) with ($$scopeObjectLocalThis || {}) with($$s
copeObjectLocal) { " |
| 423 "return "), |
| 424 expression); |
| 414 expression = v8::String::Concat(expression, v8::String::New("} })")); | 425 expression = v8::String::Concat(expression, v8::String::New("} })")); |
| 415 | 426 |
| 416 v8::Handle<v8::Script> script = v8::Script::Compile(expression); | 427 v8::Handle<v8::Script> script = v8::Script::Compile(expression); |
| 417 if (script.IsEmpty()) // Return immediately in case of exception to let the
caller handle it. | 428 if (script.IsEmpty()) // Return immediately in case of exception to let the
caller handle it. |
| 418 return v8::Handle<v8::Value>(); | 429 return v8::Handle<v8::Value>(); |
| 419 v8::Handle<v8::Function> function = script->Run().As<v8::Function>(); | 430 v8::Handle<v8::Function> function = script->Run().As<v8::Function>(); |
| 420 return function->Call(receiver, 1, &scopeObject); | 431 return function->Call(receiver, 2, scopes); |
| 421 } | |
| 422 | |
| 423 static v8::Handle<v8::Value> accessorGetter(v8::Local<v8::String> property, cons
t v8::AccessorInfo& info) | |
| 424 { | |
| 425 v8::Handle<v8::Value> getter = info.Data()->ToObject()->Get(v8::String::New(
"getter")); | |
| 426 return v8::Handle<v8::Function>::Cast(getter)->Call(v8::Object::New(), 0, 0)
; | |
| 427 } | |
| 428 | |
| 429 static void accessorSetter(v8::Local<v8::String> property, v8::Local<v8::Value>
value, const v8::AccessorInfo& info) | |
| 430 { | |
| 431 v8::Handle<v8::Value> setter = info.Data()->ToObject()->Get(v8::String::New(
"setter")); | |
| 432 if (!setter->IsUndefined()) | |
| 433 v8::Handle<v8::Function>::Cast(setter)->Call(v8::Object::New(), 1, &valu
e); | |
| 434 } | |
| 435 | |
| 436 static v8::Handle<v8::Value> setAccessor(const v8::Arguments& args) | |
| 437 { | |
| 438 v8::Handle<v8::Object> descriptor = v8::Object::New(); | |
| 439 descriptor->Set(v8::String::New("getter"), args[2]); | |
| 440 descriptor->Set(v8::String::New("setter"), args[3]); | |
| 441 args[0]->ToObject()->SetAccessor(args[1]->ToString(), accessorGetter, access
orSetter, descriptor); | |
| 442 return v8::Undefined(); | |
| 443 } | |
| 444 | |
| 445 static v8::Handle<v8::Value> indexedGetter(uint32_t index, const v8::AccessorInf
o& info) | |
| 446 { | |
| 447 v8::Handle<v8::Function> getter = v8::Handle<v8::Function>::Cast(info.Holder
()->GetHiddenValue(v8::String::New("getter"))); | |
| 448 v8::Handle<v8::Value> args[] = { v8::Integer::New(index) }; | |
| 449 return getter->Call(info.Holder(), 1, args); | |
| 450 } | |
| 451 | |
| 452 static v8::Handle<v8::Value> indexedSetter(uint32_t index, v8::Local<v8::Value>
value, const v8::AccessorInfo& info) | |
| 453 { | |
| 454 v8::Handle<v8::Function> setter = v8::Handle<v8::Function>::Cast(info.Holder
()->GetHiddenValue(v8::String::New("setter"))); | |
| 455 v8::Handle<v8::Value> args[] = { v8::Integer::New(index), value }; | |
| 456 return setter->Call(info.Holder(), 2, args); | |
| 457 } | |
| 458 | |
| 459 static v8::Handle<v8::Array> indexedEnumerator(const v8::AccessorInfo& info) | |
| 460 { | |
| 461 v8::Handle<v8::Function> enumerator = v8::Handle<v8::Function>::Cast(info.Ho
lder()->GetHiddenValue(v8::String::New("enumerator"))); | |
| 462 return enumerator->Call(info.Holder(), 0, 0).As<v8::Array>(); | |
| 463 } | |
| 464 | |
| 465 static v8::Handle<v8::Value> createArrayWithIndexedPropertyHandler(const v8::Arg
uments& args) | |
| 466 { | |
| 467 static v8::Persistent<v8::FunctionTemplate> arrayTemplate; | |
| 468 if (arrayTemplate.IsEmpty()) { | |
| 469 arrayTemplate = v8::Persistent<v8::FunctionTemplate>::New(args.GetIsolat
e(), v8::FunctionTemplate::New()); | |
| 470 v8::Local<v8::ObjectTemplate> instanceTemplate = arrayTemplate->Instance
Template(); | |
| 471 instanceTemplate->SetIndexedPropertyHandler(&indexedGetter, &indexedSett
er, 0, 0, &indexedEnumerator); | |
| 472 } | |
| 473 | |
| 474 v8::Local<v8::Object> array = arrayTemplate->InstanceTemplate()->NewInstance
(); | |
| 475 v8::Handle<v8::Value> arrayConstructor = v8::Context::GetCurrent()->Global()
->Get(v8::String::New("Array")); | |
| 476 v8::Handle<v8::Value> arrayPrototype = arrayConstructor.As<v8::Object>()->Ge
t(v8::String::New("prototype")); | |
| 477 array->Set(v8::String::New("__proto__"), arrayPrototype); | |
| 478 array->SetHiddenValue(v8::String::New("getter"), args[0]); | |
| 479 array->SetHiddenValue(v8::String::New("setter"), args[1]); | |
| 480 array->SetHiddenValue(v8::String::New("enumerator"), args[2]); | |
| 481 return array; | |
| 482 } | |
| 483 | |
| 484 static v8::Handle<v8::Value> setHiddenValue(const v8::Arguments& args) | |
| 485 { | |
| 486 return v8::Boolean::New(args[0]->ToObject()->SetHiddenValue(args[1]->ToStrin
g(), args[2])); | |
| 487 } | |
| 488 | |
| 489 static v8::Handle<v8::Value> getHiddenValue(const v8::Arguments& args) | |
| 490 { | |
| 491 return args[0]->ToObject()->GetHiddenValue(args[1]->ToString()); | |
| 492 } | 432 } |
| 493 | 433 |
| 494 void DartDebugServer::ensureHooksInstalled() | 434 void DartDebugServer::ensureHooksInstalled() |
| 495 { | 435 { |
| 496 DEFINE_STATIC_LOCAL(bool, hooksInstalled, (false)); | 436 DEFINE_STATIC_LOCAL(bool, hooksInstalled, (false)); |
| 497 | 437 |
| 498 if (hooksInstalled) | 438 if (hooksInstalled) |
| 499 return; | 439 return; |
| 500 | 440 |
| 501 hooksInstalled = true; | 441 hooksInstalled = true; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 512 nativeCallbacks->Set(v8::String::New("handleDebugEvent"), v8::FunctionTempla
te::New(&handleDebugEvent)->GetFunction()); | 452 nativeCallbacks->Set(v8::String::New("handleDebugEvent"), v8::FunctionTempla
te::New(&handleDebugEvent)->GetFunction()); |
| 513 nativeCallbacks->Set(v8::String::New("scriptsForIsolate"), v8::FunctionTempl
ate::New(&scriptsForIsolate)->GetFunction()); | 453 nativeCallbacks->Set(v8::String::New("scriptsForIsolate"), v8::FunctionTempl
ate::New(&scriptsForIsolate)->GetFunction()); |
| 514 nativeCallbacks->Set(v8::String::New("setBreakpoint"), v8::FunctionTemplate:
:New(&setBreakpoint)->GetFunction()); | 454 nativeCallbacks->Set(v8::String::New("setBreakpoint"), v8::FunctionTemplate:
:New(&setBreakpoint)->GetFunction()); |
| 515 nativeCallbacks->Set(v8::String::New("removeBreakpoint"), v8::FunctionTempla
te::New(&removeBreakpoint)->GetFunction()); | 455 nativeCallbacks->Set(v8::String::New("removeBreakpoint"), v8::FunctionTempla
te::New(&removeBreakpoint)->GetFunction()); |
| 516 nativeCallbacks->Set(v8::String::New("getBreakpointLine"), v8::FunctionTempl
ate::New(&getBreakpointLine)->GetFunction()); | 456 nativeCallbacks->Set(v8::String::New("getBreakpointLine"), v8::FunctionTempl
ate::New(&getBreakpointLine)->GetFunction()); |
| 517 nativeCallbacks->Set(v8::String::New("setExceptionPauseInfo"), v8::FunctionT
emplate::New(&setExceptionPauseInfo)->GetFunction()); | 457 nativeCallbacks->Set(v8::String::New("setExceptionPauseInfo"), v8::FunctionT
emplate::New(&setExceptionPauseInfo)->GetFunction()); |
| 518 nativeCallbacks->Set(v8::String::New("stepInto"), v8::FunctionTemplate::New(
&stepInto)->GetFunction()); | 458 nativeCallbacks->Set(v8::String::New("stepInto"), v8::FunctionTemplate::New(
&stepInto)->GetFunction()); |
| 519 nativeCallbacks->Set(v8::String::New("stepOver"), v8::FunctionTemplate::New(
&stepOver)->GetFunction()); | 459 nativeCallbacks->Set(v8::String::New("stepOver"), v8::FunctionTemplate::New(
&stepOver)->GetFunction()); |
| 520 nativeCallbacks->Set(v8::String::New("stepOut"), v8::FunctionTemplate::New(&
stepOut)->GetFunction()); | 460 nativeCallbacks->Set(v8::String::New("stepOut"), v8::FunctionTemplate::New(&
stepOut)->GetFunction()); |
| 521 nativeCallbacks->Set(v8::String::New("evaluateInScope"), v8::FunctionTemplat
e::New(&evaluateInScope)->GetFunction()); | 461 nativeCallbacks->Set(v8::String::New("evaluateInScope"), v8::FunctionTemplat
e::New(&evaluateInScope)->GetFunction()); |
| 522 nativeCallbacks->Set(v8::String::New("createArrayWithIndexedPropertyHandler"
), v8::FunctionTemplate::New(&createArrayWithIndexedPropertyHandler)->GetFunctio
n()); | |
| 523 nativeCallbacks->Set(v8::String::New("setAccessor"), v8::FunctionTemplate::N
ew(&setAccessor)->GetFunction()); | |
| 524 nativeCallbacks->Set(v8::String::New("setHiddenValue"), v8::FunctionTemplate
::New(&setHiddenValue)->GetFunction()); | |
| 525 nativeCallbacks->Set(v8::String::New("getHiddenValue"), v8::FunctionTemplate
::New(&getHiddenValue)->GetFunction()); | |
| 526 { | |
| 527 // Trampoline script is required to properly set calling context before | |
| 528 // invoking Dart code because of security checks in console.log | |
| 529 // implementation (see InjectedScriptManager::canAccessInspectedWindow). | |
| 530 V8Scope v8scope; | |
| 531 v8::Handle<v8::String> trampolineScript = v8::String::New("(function (fu
nc, args) { return func.apply(this, args); })"); | |
| 532 v8::Local<v8::Function> trampoline = v8::Local<v8::Function>::Cast(v8::S
cript::Compile(trampolineScript)->Run()); | |
| 533 nativeCallbacks->Set(v8::String::New("invocationTrampoline"), trampoline
); | |
| 534 } | |
| 535 m_dartDebugObject.get()->Set(v8::String::New("nativeCallbacks"), nativeCallb
acks); | 462 m_dartDebugObject.get()->Set(v8::String::New("nativeCallbacks"), nativeCallb
acks); |
| 536 | |
| 537 v8::Local<v8::Object> mirrorAPI = v8::Object::New(); | |
| 538 DartHandleProxy::getMirrorAPI(mirrorAPI); | |
| 539 m_dartDebugObject.get()->Set(v8::String::New("mirrorAPI"), mirrorAPI); | |
| 540 | |
| 541 } | 463 } |
| 542 | 464 |
| 543 } | 465 } |
| OLD | NEW |