| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 "src/inspector/v8-debugger.h" | 5 #include "src/inspector/v8-debugger.h" |
| 6 | 6 |
| 7 #include "src/inspector/debugger-script.h" | 7 #include "src/inspector/debugger-script.h" |
| 8 #include "src/inspector/protocol/Protocol.h" | 8 #include "src/inspector/protocol/Protocol.h" |
| 9 #include "src/inspector/script-breakpoint.h" | 9 #include "src/inspector/script-breakpoint.h" |
| 10 #include "src/inspector/string-util.h" | 10 #include "src/inspector/string-util.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 m_runningNestedMessageLoop(false), | 56 m_runningNestedMessageLoop(false), |
| 57 m_ignoreScriptParsedEventsCounter(0), | 57 m_ignoreScriptParsedEventsCounter(0), |
| 58 m_maxAsyncCallStackDepth(0) {} | 58 m_maxAsyncCallStackDepth(0) {} |
| 59 | 59 |
| 60 V8Debugger::~V8Debugger() {} | 60 V8Debugger::~V8Debugger() {} |
| 61 | 61 |
| 62 void V8Debugger::enable() { | 62 void V8Debugger::enable() { |
| 63 if (m_enableCount++) return; | 63 if (m_enableCount++) return; |
| 64 DCHECK(!enabled()); | 64 DCHECK(!enabled()); |
| 65 v8::HandleScope scope(m_isolate); | 65 v8::HandleScope scope(m_isolate); |
| 66 v8::Debug::SetDebugEventListener(m_isolate, &V8Debugger::v8DebugEventCallback, | 66 v8::DebugInterface::SetDebugEventListener(m_isolate, |
| 67 v8::External::New(m_isolate, this)); | 67 &V8Debugger::v8DebugEventCallback, |
| 68 m_debuggerContext.Reset(m_isolate, v8::Debug::GetDebugContext(m_isolate)); | 68 v8::External::New(m_isolate, this)); |
| 69 m_debuggerContext.Reset(m_isolate, |
| 70 v8::DebugInterface::GetDebugContext(m_isolate)); |
| 69 compileDebuggerScript(); | 71 compileDebuggerScript(); |
| 70 } | 72 } |
| 71 | 73 |
| 72 void V8Debugger::disable() { | 74 void V8Debugger::disable() { |
| 73 if (--m_enableCount) return; | 75 if (--m_enableCount) return; |
| 74 DCHECK(enabled()); | 76 DCHECK(enabled()); |
| 75 clearBreakpoints(); | 77 clearBreakpoints(); |
| 76 m_debuggerScript.Reset(); | 78 m_debuggerScript.Reset(); |
| 77 m_debuggerContext.Reset(); | 79 m_debuggerContext.Reset(); |
| 78 allAsyncTasksCanceled(); | 80 allAsyncTasksCanceled(); |
| 79 v8::Debug::SetDebugEventListener(m_isolate, nullptr); | 81 v8::DebugInterface::SetDebugEventListener(m_isolate, nullptr); |
| 80 } | 82 } |
| 81 | 83 |
| 82 bool V8Debugger::enabled() const { return !m_debuggerScript.IsEmpty(); } | 84 bool V8Debugger::enabled() const { return !m_debuggerScript.IsEmpty(); } |
| 83 | 85 |
| 84 // static | 86 // static |
| 85 int V8Debugger::contextId(v8::Local<v8::Context> context) { | 87 int V8Debugger::contextId(v8::Local<v8::Context> context) { |
| 86 v8::Local<v8::Value> data = | 88 v8::Local<v8::Value> data = |
| 87 context->GetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex)); | 89 context->GetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex)); |
| 88 if (data.IsEmpty() || !data->IsString()) return 0; | 90 if (data.IsEmpty() || !data->IsString()) return 0; |
| 89 String16 dataString = toProtocolString(data.As<v8::String>()); | 91 String16 dataString = toProtocolString(data.As<v8::String>()); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 success = info->Set(context, toV8StringInternalized(m_isolate, "condition"), | 166 success = info->Set(context, toV8StringInternalized(m_isolate, "condition"), |
| 165 toV8String(m_isolate, scriptBreakpoint.condition)) | 167 toV8String(m_isolate, scriptBreakpoint.condition)) |
| 166 .FromMaybe(false); | 168 .FromMaybe(false); |
| 167 DCHECK(success); | 169 DCHECK(success); |
| 168 | 170 |
| 169 v8::Local<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cast( | 171 v8::Local<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cast( |
| 170 m_debuggerScript.Get(m_isolate) | 172 m_debuggerScript.Get(m_isolate) |
| 171 ->Get(context, toV8StringInternalized(m_isolate, "setBreakpoint")) | 173 ->Get(context, toV8StringInternalized(m_isolate, "setBreakpoint")) |
| 172 .ToLocalChecked()); | 174 .ToLocalChecked()); |
| 173 v8::Local<v8::Value> breakpointId = | 175 v8::Local<v8::Value> breakpointId = |
| 174 v8::Debug::Call(debuggerContext(), setBreakpointFunction, info) | 176 v8::DebugInterface::Call(debuggerContext(), setBreakpointFunction, info) |
| 175 .ToLocalChecked(); | 177 .ToLocalChecked(); |
| 176 if (!breakpointId->IsString()) return ""; | 178 if (!breakpointId->IsString()) return ""; |
| 177 *actualLineNumber = | 179 *actualLineNumber = |
| 178 info->Get(context, toV8StringInternalized(m_isolate, "lineNumber")) | 180 info->Get(context, toV8StringInternalized(m_isolate, "lineNumber")) |
| 179 .ToLocalChecked() | 181 .ToLocalChecked() |
| 180 ->Int32Value(context) | 182 ->Int32Value(context) |
| 181 .FromJust(); | 183 .FromJust(); |
| 182 *actualColumnNumber = | 184 *actualColumnNumber = |
| 183 info->Get(context, toV8StringInternalized(m_isolate, "columnNumber")) | 185 info->Get(context, toV8StringInternalized(m_isolate, "columnNumber")) |
| 184 .ToLocalChecked() | 186 .ToLocalChecked() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 199 toV8String(m_isolate, breakpointId)) | 201 toV8String(m_isolate, breakpointId)) |
| 200 .FromMaybe(false); | 202 .FromMaybe(false); |
| 201 DCHECK(success); | 203 DCHECK(success); |
| 202 | 204 |
| 203 v8::Local<v8::Function> removeBreakpointFunction = | 205 v8::Local<v8::Function> removeBreakpointFunction = |
| 204 v8::Local<v8::Function>::Cast( | 206 v8::Local<v8::Function>::Cast( |
| 205 m_debuggerScript.Get(m_isolate) | 207 m_debuggerScript.Get(m_isolate) |
| 206 ->Get(context, | 208 ->Get(context, |
| 207 toV8StringInternalized(m_isolate, "removeBreakpoint")) | 209 toV8StringInternalized(m_isolate, "removeBreakpoint")) |
| 208 .ToLocalChecked()); | 210 .ToLocalChecked()); |
| 209 v8::Debug::Call(debuggerContext(), removeBreakpointFunction, info) | 211 v8::DebugInterface::Call(debuggerContext(), removeBreakpointFunction, info) |
| 210 .ToLocalChecked(); | 212 .ToLocalChecked(); |
| 211 } | 213 } |
| 212 | 214 |
| 213 void V8Debugger::clearBreakpoints() { | 215 void V8Debugger::clearBreakpoints() { |
| 214 v8::HandleScope scope(m_isolate); | 216 v8::HandleScope scope(m_isolate); |
| 215 v8::Local<v8::Context> context = debuggerContext(); | 217 v8::Local<v8::Context> context = debuggerContext(); |
| 216 v8::Context::Scope contextScope(context); | 218 v8::Context::Scope contextScope(context); |
| 217 | 219 |
| 218 v8::Local<v8::Function> clearBreakpoints = v8::Local<v8::Function>::Cast( | 220 v8::Local<v8::Function> clearBreakpoints = v8::Local<v8::Function>::Cast( |
| 219 m_debuggerScript.Get(m_isolate) | 221 m_debuggerScript.Get(m_isolate) |
| 220 ->Get(context, toV8StringInternalized(m_isolate, "clearBreakpoints")) | 222 ->Get(context, toV8StringInternalized(m_isolate, "clearBreakpoints")) |
| 221 .ToLocalChecked()); | 223 .ToLocalChecked()); |
| 222 v8::Debug::Call(debuggerContext(), clearBreakpoints).ToLocalChecked(); | 224 v8::DebugInterface::Call(debuggerContext(), clearBreakpoints) |
| 225 .ToLocalChecked(); |
| 223 } | 226 } |
| 224 | 227 |
| 225 void V8Debugger::setBreakpointsActivated(bool activated) { | 228 void V8Debugger::setBreakpointsActivated(bool activated) { |
| 226 if (!enabled()) { | 229 if (!enabled()) { |
| 227 UNREACHABLE(); | 230 UNREACHABLE(); |
| 228 return; | 231 return; |
| 229 } | 232 } |
| 230 v8::HandleScope scope(m_isolate); | 233 v8::HandleScope scope(m_isolate); |
| 231 v8::Local<v8::Context> context = debuggerContext(); | 234 v8::Local<v8::Context> context = debuggerContext(); |
| 232 v8::Context::Scope contextScope(context); | 235 v8::Context::Scope contextScope(context); |
| 233 | 236 |
| 234 v8::Local<v8::Object> info = v8::Object::New(m_isolate); | 237 v8::Local<v8::Object> info = v8::Object::New(m_isolate); |
| 235 bool success = false; | 238 bool success = false; |
| 236 success = info->Set(context, toV8StringInternalized(m_isolate, "enabled"), | 239 success = info->Set(context, toV8StringInternalized(m_isolate, "enabled"), |
| 237 v8::Boolean::New(m_isolate, activated)) | 240 v8::Boolean::New(m_isolate, activated)) |
| 238 .FromMaybe(false); | 241 .FromMaybe(false); |
| 239 DCHECK(success); | 242 DCHECK(success); |
| 240 v8::Local<v8::Function> setBreakpointsActivated = | 243 v8::Local<v8::Function> setBreakpointsActivated = |
| 241 v8::Local<v8::Function>::Cast( | 244 v8::Local<v8::Function>::Cast( |
| 242 m_debuggerScript.Get(m_isolate) | 245 m_debuggerScript.Get(m_isolate) |
| 243 ->Get(context, toV8StringInternalized(m_isolate, | 246 ->Get(context, toV8StringInternalized(m_isolate, |
| 244 "setBreakpointsActivated")) | 247 "setBreakpointsActivated")) |
| 245 .ToLocalChecked()); | 248 .ToLocalChecked()); |
| 246 v8::Debug::Call(debuggerContext(), setBreakpointsActivated, info) | 249 v8::DebugInterface::Call(debuggerContext(), setBreakpointsActivated, info) |
| 247 .ToLocalChecked(); | 250 .ToLocalChecked(); |
| 248 | 251 |
| 249 m_breakpointsActivated = activated; | 252 m_breakpointsActivated = activated; |
| 250 } | 253 } |
| 251 | 254 |
| 252 V8Debugger::PauseOnExceptionsState V8Debugger::getPauseOnExceptionsState() { | 255 V8Debugger::PauseOnExceptionsState V8Debugger::getPauseOnExceptionsState() { |
| 253 DCHECK(enabled()); | 256 DCHECK(enabled()); |
| 254 v8::HandleScope scope(m_isolate); | 257 v8::HandleScope scope(m_isolate); |
| 255 v8::Local<v8::Context> context = debuggerContext(); | 258 v8::Local<v8::Context> context = debuggerContext(); |
| 256 v8::Context::Scope contextScope(context); | 259 v8::Context::Scope contextScope(context); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 269 v8::Context::Scope contextScope(debuggerContext()); | 272 v8::Context::Scope contextScope(debuggerContext()); |
| 270 | 273 |
| 271 v8::Local<v8::Value> argv[] = { | 274 v8::Local<v8::Value> argv[] = { |
| 272 v8::Int32::New(m_isolate, pauseOnExceptionsState)}; | 275 v8::Int32::New(m_isolate, pauseOnExceptionsState)}; |
| 273 callDebuggerMethod("setPauseOnExceptionsState", 1, argv); | 276 callDebuggerMethod("setPauseOnExceptionsState", 1, argv); |
| 274 } | 277 } |
| 275 | 278 |
| 276 void V8Debugger::setPauseOnNextStatement(bool pause) { | 279 void V8Debugger::setPauseOnNextStatement(bool pause) { |
| 277 if (m_runningNestedMessageLoop) return; | 280 if (m_runningNestedMessageLoop) return; |
| 278 if (pause) | 281 if (pause) |
| 279 v8::Debug::DebugBreak(m_isolate); | 282 v8::DebugInterface::DebugBreak(m_isolate); |
| 280 else | 283 else |
| 281 v8::Debug::CancelDebugBreak(m_isolate); | 284 v8::DebugInterface::CancelDebugBreak(m_isolate); |
| 282 } | 285 } |
| 283 | 286 |
| 284 bool V8Debugger::canBreakProgram() { | 287 bool V8Debugger::canBreakProgram() { |
| 285 if (!m_breakpointsActivated) return false; | 288 if (!m_breakpointsActivated) return false; |
| 286 return m_isolate->InContext(); | 289 return m_isolate->InContext(); |
| 287 } | 290 } |
| 288 | 291 |
| 289 void V8Debugger::breakProgram() { | 292 void V8Debugger::breakProgram() { |
| 290 if (isPaused()) { | 293 if (isPaused()) { |
| 291 DCHECK(!m_runningNestedMessageLoop); | 294 DCHECK(!m_runningNestedMessageLoop); |
| 292 v8::Local<v8::Value> exception; | 295 v8::Local<v8::Value> exception; |
| 293 v8::Local<v8::Array> hitBreakpoints; | 296 v8::Local<v8::Array> hitBreakpoints; |
| 294 handleProgramBreak(m_pausedContext, m_executionState, exception, | 297 handleProgramBreak(m_pausedContext, m_executionState, exception, |
| 295 hitBreakpoints); | 298 hitBreakpoints); |
| 296 return; | 299 return; |
| 297 } | 300 } |
| 298 | 301 |
| 299 if (!canBreakProgram()) return; | 302 if (!canBreakProgram()) return; |
| 300 | 303 |
| 301 v8::HandleScope scope(m_isolate); | 304 v8::HandleScope scope(m_isolate); |
| 302 v8::Local<v8::Function> breakFunction; | 305 v8::Local<v8::Function> breakFunction; |
| 303 if (!v8::Function::New(m_isolate->GetCurrentContext(), | 306 if (!v8::Function::New(m_isolate->GetCurrentContext(), |
| 304 &V8Debugger::breakProgramCallback, | 307 &V8Debugger::breakProgramCallback, |
| 305 v8::External::New(m_isolate, this), 0, | 308 v8::External::New(m_isolate, this), 0, |
| 306 v8::ConstructorBehavior::kThrow) | 309 v8::ConstructorBehavior::kThrow) |
| 307 .ToLocal(&breakFunction)) | 310 .ToLocal(&breakFunction)) |
| 308 return; | 311 return; |
| 309 v8::Debug::Call(debuggerContext(), breakFunction).ToLocalChecked(); | 312 v8::DebugInterface::Call(debuggerContext(), breakFunction).ToLocalChecked(); |
| 310 } | 313 } |
| 311 | 314 |
| 312 void V8Debugger::continueProgram() { | 315 void V8Debugger::continueProgram() { |
| 313 if (isPaused()) m_inspector->client()->quitMessageLoopOnPause(); | 316 if (isPaused()) m_inspector->client()->quitMessageLoopOnPause(); |
| 314 m_pausedContext.Clear(); | 317 m_pausedContext.Clear(); |
| 315 m_executionState.Clear(); | 318 m_executionState.Clear(); |
| 316 } | 319 } |
| 317 | 320 |
| 318 void V8Debugger::stepIntoStatement() { | 321 void V8Debugger::stepIntoStatement() { |
| 319 DCHECK(isPaused()); | 322 DCHECK(isPaused()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 355 } |
| 353 | 356 |
| 354 bool V8Debugger::setScriptSource( | 357 bool V8Debugger::setScriptSource( |
| 355 const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun, | 358 const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun, |
| 356 ErrorString* error, | 359 ErrorString* error, |
| 357 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails, | 360 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails, |
| 358 JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged) { | 361 JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged) { |
| 359 class EnableLiveEditScope { | 362 class EnableLiveEditScope { |
| 360 public: | 363 public: |
| 361 explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate) { | 364 explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate) { |
| 362 v8::Debug::SetLiveEditEnabled(m_isolate, true); | 365 v8::DebugInterface::SetLiveEditEnabled(m_isolate, true); |
| 363 inLiveEditScope = true; | 366 inLiveEditScope = true; |
| 364 } | 367 } |
| 365 ~EnableLiveEditScope() { | 368 ~EnableLiveEditScope() { |
| 366 v8::Debug::SetLiveEditEnabled(m_isolate, false); | 369 v8::DebugInterface::SetLiveEditEnabled(m_isolate, false); |
| 367 inLiveEditScope = false; | 370 inLiveEditScope = false; |
| 368 } | 371 } |
| 369 | 372 |
| 370 private: | 373 private: |
| 371 v8::Isolate* m_isolate; | 374 v8::Isolate* m_isolate; |
| 372 }; | 375 }; |
| 373 | 376 |
| 374 DCHECK(enabled()); | 377 DCHECK(enabled()); |
| 375 v8::HandleScope scope(m_isolate); | 378 v8::HandleScope scope(m_isolate); |
| 376 | 379 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 if (!m_isolate->InContext()) return JavaScriptCallFrames(); | 455 if (!m_isolate->InContext()) return JavaScriptCallFrames(); |
| 453 v8::Local<v8::Value> currentCallFramesV8; | 456 v8::Local<v8::Value> currentCallFramesV8; |
| 454 if (m_executionState.IsEmpty()) { | 457 if (m_executionState.IsEmpty()) { |
| 455 v8::Local<v8::Function> currentCallFramesFunction = | 458 v8::Local<v8::Function> currentCallFramesFunction = |
| 456 v8::Local<v8::Function>::Cast( | 459 v8::Local<v8::Function>::Cast( |
| 457 m_debuggerScript.Get(m_isolate) | 460 m_debuggerScript.Get(m_isolate) |
| 458 ->Get(debuggerContext(), | 461 ->Get(debuggerContext(), |
| 459 toV8StringInternalized(m_isolate, "currentCallFrames")) | 462 toV8StringInternalized(m_isolate, "currentCallFrames")) |
| 460 .ToLocalChecked()); | 463 .ToLocalChecked()); |
| 461 currentCallFramesV8 = | 464 currentCallFramesV8 = |
| 462 v8::Debug::Call(debuggerContext(), currentCallFramesFunction, | 465 v8::DebugInterface::Call(debuggerContext(), currentCallFramesFunction, |
| 463 v8::Integer::New(m_isolate, limit)) | 466 v8::Integer::New(m_isolate, limit)) |
| 464 .ToLocalChecked(); | 467 .ToLocalChecked(); |
| 465 } else { | 468 } else { |
| 466 v8::Local<v8::Value> argv[] = {m_executionState, | 469 v8::Local<v8::Value> argv[] = {m_executionState, |
| 467 v8::Integer::New(m_isolate, limit)}; | 470 v8::Integer::New(m_isolate, limit)}; |
| 468 currentCallFramesV8 = | 471 currentCallFramesV8 = |
| 469 callDebuggerMethod("currentCallFrames", arraysize(argv), argv) | 472 callDebuggerMethod("currentCallFrames", arraysize(argv), argv) |
| 470 .ToLocalChecked(); | 473 .ToLocalChecked(); |
| 471 } | 474 } |
| 472 DCHECK(!currentCallFramesV8.IsEmpty()); | 475 DCHECK(!currentCallFramesV8.IsEmpty()); |
| 473 if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames(); | 476 if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 } else if (result == V8DebuggerAgentImpl::RequestStepInto) { | 555 } else if (result == V8DebuggerAgentImpl::RequestStepInto) { |
| 553 v8::Local<v8::Value> argv[] = {executionState}; | 556 v8::Local<v8::Value> argv[] = {executionState}; |
| 554 callDebuggerMethod(stepIntoV8MethodName, 1, argv); | 557 callDebuggerMethod(stepIntoV8MethodName, 1, argv); |
| 555 } else if (result == V8DebuggerAgentImpl::RequestStepOut) { | 558 } else if (result == V8DebuggerAgentImpl::RequestStepOut) { |
| 556 v8::Local<v8::Value> argv[] = {executionState}; | 559 v8::Local<v8::Value> argv[] = {executionState}; |
| 557 callDebuggerMethod(stepOutV8MethodName, 1, argv); | 560 callDebuggerMethod(stepOutV8MethodName, 1, argv); |
| 558 } | 561 } |
| 559 } | 562 } |
| 560 | 563 |
| 561 void V8Debugger::v8DebugEventCallback( | 564 void V8Debugger::v8DebugEventCallback( |
| 562 const v8::Debug::EventDetails& eventDetails) { | 565 const v8::DebugInterface::EventDetails& eventDetails) { |
| 563 V8Debugger* thisPtr = toV8Debugger(eventDetails.GetCallbackData()); | 566 V8Debugger* thisPtr = toV8Debugger(eventDetails.GetCallbackData()); |
| 564 thisPtr->handleV8DebugEvent(eventDetails); | 567 thisPtr->handleV8DebugEvent(eventDetails); |
| 565 } | 568 } |
| 566 | 569 |
| 567 v8::Local<v8::Value> V8Debugger::callInternalGetterFunction( | 570 v8::Local<v8::Value> V8Debugger::callInternalGetterFunction( |
| 568 v8::Local<v8::Object> object, const char* functionName) { | 571 v8::Local<v8::Object> object, const char* functionName) { |
| 569 v8::MicrotasksScope microtasks(m_isolate, | 572 v8::MicrotasksScope microtasks(m_isolate, |
| 570 v8::MicrotasksScope::kDoNotRunMicrotasks); | 573 v8::MicrotasksScope::kDoNotRunMicrotasks); |
| 571 v8::Local<v8::Value> getterValue = | 574 v8::Local<v8::Value> getterValue = |
| 572 object | 575 object |
| 573 ->Get(m_isolate->GetCurrentContext(), | 576 ->Get(m_isolate->GetCurrentContext(), |
| 574 toV8StringInternalized(m_isolate, functionName)) | 577 toV8StringInternalized(m_isolate, functionName)) |
| 575 .ToLocalChecked(); | 578 .ToLocalChecked(); |
| 576 DCHECK(!getterValue.IsEmpty() && getterValue->IsFunction()); | 579 DCHECK(!getterValue.IsEmpty() && getterValue->IsFunction()); |
| 577 return v8::Local<v8::Function>::Cast(getterValue) | 580 return v8::Local<v8::Function>::Cast(getterValue) |
| 578 ->Call(m_isolate->GetCurrentContext(), object, 0, 0) | 581 ->Call(m_isolate->GetCurrentContext(), object, 0, 0) |
| 579 .ToLocalChecked(); | 582 .ToLocalChecked(); |
| 580 } | 583 } |
| 581 | 584 |
| 582 void V8Debugger::handleV8DebugEvent( | 585 void V8Debugger::handleV8DebugEvent( |
| 583 const v8::Debug::EventDetails& eventDetails) { | 586 const v8::DebugInterface::EventDetails& eventDetails) { |
| 584 if (!enabled()) return; | 587 if (!enabled()) return; |
| 585 v8::DebugEvent event = eventDetails.GetEvent(); | 588 v8::DebugEvent event = eventDetails.GetEvent(); |
| 586 if (event != v8::AsyncTaskEvent && event != v8::Break && | 589 if (event != v8::AsyncTaskEvent && event != v8::Break && |
| 587 event != v8::Exception && event != v8::AfterCompile && | 590 event != v8::Exception && event != v8::AfterCompile && |
| 588 event != v8::BeforeCompile && event != v8::CompileError) | 591 event != v8::BeforeCompile && event != v8::CompileError) |
| 589 return; | 592 return; |
| 590 | 593 |
| 591 v8::Local<v8::Context> eventContext = eventDetails.GetEventContext(); | 594 v8::Local<v8::Context> eventContext = eventDetails.GetEventContext(); |
| 592 DCHECK(!eventContext.IsEmpty()); | 595 DCHECK(!eventContext.IsEmpty()); |
| 593 | 596 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 return v8::MaybeLocal<v8::Value>(); | 725 return v8::MaybeLocal<v8::Value>(); |
| 723 if (!markArrayEntriesAsInternal(context, v8::Local<v8::Array>::Cast(copied), | 726 if (!markArrayEntriesAsInternal(context, v8::Local<v8::Array>::Cast(copied), |
| 724 V8InternalValueType::kScope)) | 727 V8InternalValueType::kScope)) |
| 725 return v8::MaybeLocal<v8::Value>(); | 728 return v8::MaybeLocal<v8::Value>(); |
| 726 return copied; | 729 return copied; |
| 727 } | 730 } |
| 728 | 731 |
| 729 v8::MaybeLocal<v8::Array> V8Debugger::internalProperties( | 732 v8::MaybeLocal<v8::Array> V8Debugger::internalProperties( |
| 730 v8::Local<v8::Context> context, v8::Local<v8::Value> value) { | 733 v8::Local<v8::Context> context, v8::Local<v8::Value> value) { |
| 731 v8::Local<v8::Array> properties; | 734 v8::Local<v8::Array> properties; |
| 732 if (!v8::Debug::GetInternalProperties(m_isolate, value).ToLocal(&properties)) | 735 if (!v8::DebugInterface::GetInternalProperties(m_isolate, value) |
| 736 .ToLocal(&properties)) |
| 733 return v8::MaybeLocal<v8::Array>(); | 737 return v8::MaybeLocal<v8::Array>(); |
| 734 if (value->IsFunction()) { | 738 if (value->IsFunction()) { |
| 735 v8::Local<v8::Function> function = value.As<v8::Function>(); | 739 v8::Local<v8::Function> function = value.As<v8::Function>(); |
| 736 v8::Local<v8::Value> location = functionLocation(context, function); | 740 v8::Local<v8::Value> location = functionLocation(context, function); |
| 737 if (location->IsObject()) { | 741 if (location->IsObject()) { |
| 738 createDataProperty( | 742 createDataProperty( |
| 739 context, properties, properties->Length(), | 743 context, properties, properties->Length(), |
| 740 toV8StringInternalized(m_isolate, "[[FunctionLocation]]")); | 744 toV8StringInternalized(m_isolate, "[[FunctionLocation]]")); |
| 741 createDataProperty(context, properties, properties->Length(), location); | 745 createDataProperty(context, properties, properties->Length(), location); |
| 742 } | 746 } |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 | 997 |
| 994 size_t stackSize = | 998 size_t stackSize = |
| 995 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 999 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
| 996 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 1000 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
| 997 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 1001 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 998 | 1002 |
| 999 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 1003 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 1000 } | 1004 } |
| 1001 | 1005 |
| 1002 } // namespace v8_inspector | 1006 } // namespace v8_inspector |
| OLD | NEW |