| 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/V8DebuggerAgentImpl.h" | 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
| 8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
| 9 #include "platform/v8_inspector/IgnoreExceptionsScope.h" | 9 #include "platform/v8_inspector/IgnoreExceptionsScope.h" |
| 10 #include "platform/v8_inspector/InjectedScript.h" | 10 #include "platform/v8_inspector/InjectedScript.h" |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 467 |
| 468 ScriptBreakpoint breakpoint(lineNumber, columnNumber, ""); | 468 ScriptBreakpoint breakpoint(lineNumber, columnNumber, ""); |
| 469 m_continueToLocationBreakpointId = debugger().setBreakpoint(scriptId, breakp
oint, &lineNumber, &columnNumber, interstateLocationOpt.fromMaybe(false)); | 469 m_continueToLocationBreakpointId = debugger().setBreakpoint(scriptId, breakp
oint, &lineNumber, &columnNumber, interstateLocationOpt.fromMaybe(false)); |
| 470 resume(errorString); | 470 resume(errorString); |
| 471 } | 471 } |
| 472 | 472 |
| 473 void V8DebuggerAgentImpl::getBacktrace(ErrorString* errorString, OwnPtr<Array<Ca
llFrame>>* callFrames, Maybe<StackTrace>* asyncStackTrace) | 473 void V8DebuggerAgentImpl::getBacktrace(ErrorString* errorString, OwnPtr<Array<Ca
llFrame>>* callFrames, Maybe<StackTrace>* asyncStackTrace) |
| 474 { | 474 { |
| 475 if (!assertPaused(errorString)) | 475 if (!assertPaused(errorString)) |
| 476 return; | 476 return; |
| 477 m_pausedCallFrames = debugger().currentCallFrames(); | 477 m_pausedCallFrames.swap(debugger().currentCallFrames()); |
| 478 *callFrames = currentCallFrames(errorString); | 478 *callFrames = currentCallFrames(errorString); |
| 479 if (!*callFrames) | 479 if (!*callFrames) |
| 480 return; | 480 return; |
| 481 *asyncStackTrace = currentAsyncStackTrace(); | 481 *asyncStackTrace = currentAsyncStackTrace(); |
| 482 } | 482 } |
| 483 | 483 |
| 484 bool V8DebuggerAgentImpl::isCurrentCallStackEmptyOrBlackboxed() | 484 bool V8DebuggerAgentImpl::isCurrentCallStackEmptyOrBlackboxed() |
| 485 { | 485 { |
| 486 ASSERT(enabled()); | 486 ASSERT(enabled()); |
| 487 JavaScriptCallFrames callFrames = debugger().currentCallFrames(); | 487 JavaScriptCallFrames callFrames = debugger().currentCallFrames(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 if (frameOrdinal >= m_pausedCallFrames.size()) { | 642 if (frameOrdinal >= m_pausedCallFrames.size()) { |
| 643 *errorString = "Could not find call frame with given id"; | 643 *errorString = "Could not find call frame with given id"; |
| 644 return; | 644 return; |
| 645 } | 645 } |
| 646 v8::Local<v8::Value> resultValue; | 646 v8::Local<v8::Value> resultValue; |
| 647 v8::Local<v8::Boolean> result; | 647 v8::Local<v8::Boolean> result; |
| 648 if (!m_pausedCallFrames[frameOrdinal].get()->restart().ToLocal(&resultValue)
|| tryCatch.HasCaught() || !resultValue->ToBoolean(localContext).ToLocal(&resul
t) || !result->Value()) { | 648 if (!m_pausedCallFrames[frameOrdinal].get()->restart().ToLocal(&resultValue)
|| tryCatch.HasCaught() || !resultValue->ToBoolean(localContext).ToLocal(&resul
t) || !result->Value()) { |
| 649 *errorString = "Internal error"; | 649 *errorString = "Internal error"; |
| 650 return; | 650 return; |
| 651 } | 651 } |
| 652 | 652 m_pausedCallFrames.swap(debugger().currentCallFrames()); |
| 653 m_pausedCallFrames = debugger().currentCallFrames(); | |
| 654 | 653 |
| 655 *newCallFrames = currentCallFrames(errorString); | 654 *newCallFrames = currentCallFrames(errorString); |
| 656 if (!*newCallFrames) | 655 if (!*newCallFrames) |
| 657 return; | 656 return; |
| 658 *asyncStackTrace = currentAsyncStackTrace(); | 657 *asyncStackTrace = currentAsyncStackTrace(); |
| 659 } | 658 } |
| 660 | 659 |
| 661 void V8DebuggerAgentImpl::getScriptSource(ErrorString* error, const String16& sc
riptId, String16* scriptSource) | 660 void V8DebuggerAgentImpl::getScriptSource(ErrorString* error, const String16& sc
riptId, String16* scriptSource) |
| 662 { | 661 { |
| 663 if (!checkEnabled(error)) | 662 if (!checkEnabled(error)) |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 result = RequestNoSkip; | 1368 result = RequestNoSkip; |
| 1370 | 1369 |
| 1371 m_skipNextDebuggerStepOut = false; | 1370 m_skipNextDebuggerStepOut = false; |
| 1372 if (result != RequestNoSkip) | 1371 if (result != RequestNoSkip) |
| 1373 return result; | 1372 return result; |
| 1374 // Skip pauses inside V8 internal scripts and on syntax errors. | 1373 // Skip pauses inside V8 internal scripts and on syntax errors. |
| 1375 if (!topCallFrame) | 1374 if (!topCallFrame) |
| 1376 return RequestContinue; | 1375 return RequestContinue; |
| 1377 | 1376 |
| 1378 ASSERT(m_pausedContext.IsEmpty()); | 1377 ASSERT(m_pausedContext.IsEmpty()); |
| 1379 callFrames = debugger().currentCallFrames(); | 1378 m_pausedCallFrames.swap(debugger().currentCallFrames()); |
| 1380 m_pausedCallFrames.swap(callFrames); | |
| 1381 m_pausedContext.Reset(m_isolate, context); | 1379 m_pausedContext.Reset(m_isolate, context); |
| 1382 v8::HandleScope handles(m_isolate); | 1380 v8::HandleScope handles(m_isolate); |
| 1383 | 1381 |
| 1384 if (!exception.IsEmpty()) { | 1382 if (!exception.IsEmpty()) { |
| 1385 ErrorString ignored; | 1383 ErrorString ignored; |
| 1386 InjectedScript* injectedScript = m_session->findInjectedScript(&ignored,
V8Debugger::contextId(context)); | 1384 InjectedScript* injectedScript = m_session->findInjectedScript(&ignored,
V8Debugger::contextId(context)); |
| 1387 if (injectedScript) { | 1385 if (injectedScript) { |
| 1388 m_breakReason = isPromiseRejection ? protocol::Debugger::Paused::Rea
sonEnum::PromiseRejection : protocol::Debugger::Paused::ReasonEnum::Exception; | 1386 m_breakReason = isPromiseRejection ? protocol::Debugger::Paused::Rea
sonEnum::PromiseRejection : protocol::Debugger::Paused::ReasonEnum::Exception; |
| 1389 ErrorString errorString; | 1387 ErrorString errorString; |
| 1390 auto obj = injectedScript->wrapObject(&errorString, exception, V8Deb
uggerAgentImpl::backtraceObjectGroup); | 1388 auto obj = injectedScript->wrapObject(&errorString, exception, V8Deb
uggerAgentImpl::backtraceObjectGroup); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1489 if (!enabled()) | 1487 if (!enabled()) |
| 1490 return; | 1488 return; |
| 1491 m_scheduledDebuggerStep = NoStep; | 1489 m_scheduledDebuggerStep = NoStep; |
| 1492 m_scripts.clear(); | 1490 m_scripts.clear(); |
| 1493 m_blackboxedPositions.clear(); | 1491 m_blackboxedPositions.clear(); |
| 1494 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1492 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1495 allAsyncTasksCanceled(); | 1493 allAsyncTasksCanceled(); |
| 1496 } | 1494 } |
| 1497 | 1495 |
| 1498 } // namespace blink | 1496 } // namespace blink |
| OLD | NEW |