| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 static PassRefPtrWillBeRawPtr<ScriptCallStack> toScriptCallStack(JavaScriptCallF
rame* callFrame) | 126 static PassRefPtrWillBeRawPtr<ScriptCallStack> toScriptCallStack(JavaScriptCallF
rame* callFrame) |
| 127 { | 127 { |
| 128 Vector<ScriptCallFrame> frames; | 128 Vector<ScriptCallFrame> frames; |
| 129 for (; callFrame; callFrame = callFrame->caller()) | 129 for (; callFrame; callFrame = callFrame->caller()) |
| 130 frames.append(toScriptCallFrame(callFrame)); | 130 frames.append(toScriptCallFrame(callFrame)); |
| 131 return ScriptCallStack::create(frames); | 131 return ScriptCallStack::create(frames); |
| 132 } | 132 } |
| 133 | 133 |
| 134 static PassRefPtrWillBeRawPtr<ScriptCallStack> toScriptCallStack(const ScriptVal
ue& callFrames) | 134 static PassRefPtrWillBeRawPtr<ScriptCallStack> toScriptCallStack(const ScriptVal
ue& callFrames) |
| 135 { | 135 { |
| 136 RefPtrWillBeRawPtr<JavaScriptCallFrame> jsCallFrame = V8Debugger::toJavaScri
ptCallFrameUnsafe(callFrames); | 136 RefPtr<JavaScriptCallFrame> jsCallFrame = V8Debugger::toJavaScriptCallFrameU
nsafe(callFrames); |
| 137 return jsCallFrame ? toScriptCallStack(jsCallFrame.get()) : nullptr; | 137 return jsCallFrame ? toScriptCallStack(jsCallFrame.get()) : nullptr; |
| 138 } | 138 } |
| 139 | 139 |
| 140 InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedSc
riptManager, v8::Isolate* isolate) | 140 InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedSc
riptManager, v8::Isolate* isolate) |
| 141 : InspectorBaseAgent<InspectorDebuggerAgent, InspectorFrontend::Debugger>("D
ebugger") | 141 : InspectorBaseAgent<InspectorDebuggerAgent, InspectorFrontend::Debugger>("D
ebugger") |
| 142 , m_injectedScriptManager(injectedScriptManager) | 142 , m_injectedScriptManager(injectedScriptManager) |
| 143 , m_pausedScriptState(nullptr) | 143 , m_pausedScriptState(nullptr) |
| 144 , m_breakReason(InspectorFrontend::Debugger::Reason::Other) | 144 , m_breakReason(InspectorFrontend::Debugger::Reason::Other) |
| 145 , m_scheduledDebuggerStep(NoStep) | 145 , m_scheduledDebuggerStep(NoStep) |
| 146 , m_skipNextDebuggerStepOut(false) | 146 , m_skipNextDebuggerStepOut(false) |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 return; | 481 return; |
| 482 m_currentCallStack = debugger().currentCallFrames(); | 482 m_currentCallStack = debugger().currentCallFrames(); |
| 483 callFrames = currentCallFrames(); | 483 callFrames = currentCallFrames(); |
| 484 asyncStackTrace = currentAsyncStackTrace(); | 484 asyncStackTrace = currentAsyncStackTrace(); |
| 485 } | 485 } |
| 486 | 486 |
| 487 bool InspectorDebuggerAgent::isCallStackEmptyOrBlackboxed() | 487 bool InspectorDebuggerAgent::isCallStackEmptyOrBlackboxed() |
| 488 { | 488 { |
| 489 ASSERT(enabled()); | 489 ASSERT(enabled()); |
| 490 for (int index = 0; ; ++index) { | 490 for (int index = 0; ; ++index) { |
| 491 RefPtrWillBeRawPtr<JavaScriptCallFrame> frame = debugger().callFrameNoSc
opes(index); | 491 RefPtr<JavaScriptCallFrame> frame = debugger().callFrameNoScopes(index); |
| 492 if (!frame) | 492 if (!frame) |
| 493 break; | 493 break; |
| 494 if (!isCallFrameWithUnknownScriptOrBlackboxed(frame.release())) | 494 if (!isCallFrameWithUnknownScriptOrBlackboxed(frame.release())) |
| 495 return false; | 495 return false; |
| 496 } | 496 } |
| 497 return true; | 497 return true; |
| 498 } | 498 } |
| 499 | 499 |
| 500 bool InspectorDebuggerAgent::isTopCallFrameBlackboxed() | 500 bool InspectorDebuggerAgent::isTopCallFrameBlackboxed() |
| 501 { | 501 { |
| 502 ASSERT(enabled()); | 502 ASSERT(enabled()); |
| 503 return isCallFrameWithUnknownScriptOrBlackboxed(debugger().callFrameNoScopes
(0)); | 503 return isCallFrameWithUnknownScriptOrBlackboxed(debugger().callFrameNoScopes
(0)); |
| 504 } | 504 } |
| 505 | 505 |
| 506 bool InspectorDebuggerAgent::isCallFrameWithUnknownScriptOrBlackboxed(PassRefPtr
WillBeRawPtr<JavaScriptCallFrame> pFrame) | 506 bool InspectorDebuggerAgent::isCallFrameWithUnknownScriptOrBlackboxed(PassRefPtr
<JavaScriptCallFrame> pFrame) |
| 507 { | 507 { |
| 508 RefPtrWillBeRawPtr<JavaScriptCallFrame> frame = pFrame; | 508 RefPtr<JavaScriptCallFrame> frame = pFrame; |
| 509 if (!frame) | 509 if (!frame) |
| 510 return true; | 510 return true; |
| 511 ScriptsMap::iterator it = m_scripts.find(String::number(frame->sourceID())); | 511 ScriptsMap::iterator it = m_scripts.find(String::number(frame->sourceID())); |
| 512 if (it == m_scripts.end()) { | 512 if (it == m_scripts.end()) { |
| 513 // Unknown scripts are blackboxed. | 513 // Unknown scripts are blackboxed. |
| 514 return true; | 514 return true; |
| 515 } | 515 } |
| 516 if (m_skipContentScripts && it->value.isContentScript()) | 516 if (m_skipContentScripts && it->value.isContentScript()) |
| 517 return true; | 517 return true; |
| 518 bool isBlackboxed = false; | 518 bool isBlackboxed = false; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 m_steppingFromFramework = false; | 790 m_steppingFromFramework = false; |
| 791 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); | 791 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); |
| 792 debugger().continueProgram(); | 792 debugger().continueProgram(); |
| 793 } | 793 } |
| 794 | 794 |
| 795 void InspectorDebuggerAgent::stepOver(ErrorString* errorString) | 795 void InspectorDebuggerAgent::stepOver(ErrorString* errorString) |
| 796 { | 796 { |
| 797 if (!assertPaused(errorString)) | 797 if (!assertPaused(errorString)) |
| 798 return; | 798 return; |
| 799 // StepOver at function return point should fallback to StepInto. | 799 // StepOver at function return point should fallback to StepInto. |
| 800 RefPtrWillBeRawPtr<JavaScriptCallFrame> frame = debugger().callFrameNoScopes
(0); | 800 RefPtr<JavaScriptCallFrame> frame = debugger().callFrameNoScopes(0); |
| 801 if (frame && frame->isAtReturn()) { | 801 if (frame && frame->isAtReturn()) { |
| 802 stepInto(errorString); | 802 stepInto(errorString); |
| 803 return; | 803 return; |
| 804 } | 804 } |
| 805 m_scheduledDebuggerStep = StepOver; | 805 m_scheduledDebuggerStep = StepOver; |
| 806 m_steppingFromFramework = isTopCallFrameBlackboxed(); | 806 m_steppingFromFramework = isTopCallFrameBlackboxed(); |
| 807 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); | 807 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); |
| 808 debugger().stepOverStatement(); | 808 debugger().stepOverStatement(); |
| 809 } | 809 } |
| 810 | 810 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 if (!trackingAsyncCalls()) | 1449 if (!trackingAsyncCalls()) |
| 1450 return nullptr; | 1450 return nullptr; |
| 1451 const AsyncCallChain* chain = m_currentAsyncCallChain.get(); | 1451 const AsyncCallChain* chain = m_currentAsyncCallChain.get(); |
| 1452 if (!chain) | 1452 if (!chain) |
| 1453 return nullptr; | 1453 return nullptr; |
| 1454 const AsyncCallStackVector& callStacks = chain->callStacks(); | 1454 const AsyncCallStackVector& callStacks = chain->callStacks(); |
| 1455 if (callStacks.isEmpty()) | 1455 if (callStacks.isEmpty()) |
| 1456 return nullptr; | 1456 return nullptr; |
| 1457 RefPtrWillBeRawPtr<ScriptAsyncCallStack> result = nullptr; | 1457 RefPtrWillBeRawPtr<ScriptAsyncCallStack> result = nullptr; |
| 1458 for (AsyncCallStackVector::const_reverse_iterator it = callStacks.rbegin();
it != callStacks.rend(); ++it) { | 1458 for (AsyncCallStackVector::const_reverse_iterator it = callStacks.rbegin();
it != callStacks.rend(); ++it) { |
| 1459 RefPtrWillBeRawPtr<JavaScriptCallFrame> callFrame = V8Debugger::toJavaSc
riptCallFrameUnsafe((*it)->callFrames()); | 1459 RefPtr<JavaScriptCallFrame> callFrame = V8Debugger::toJavaScriptCallFram
eUnsafe((*it)->callFrames()); |
| 1460 if (!callFrame) | 1460 if (!callFrame) |
| 1461 break; | 1461 break; |
| 1462 result = ScriptAsyncCallStack::create((*it)->description(), toScriptCall
Stack(callFrame.get()), result.release()); | 1462 result = ScriptAsyncCallStack::create((*it)->description(), toScriptCall
Stack(callFrame.get()), result.release()); |
| 1463 } | 1463 } |
| 1464 return result.release(); | 1464 return result.release(); |
| 1465 } | 1465 } |
| 1466 | 1466 |
| 1467 String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script, Compi
leResult compileResult) | 1467 String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script, Compi
leResult compileResult) |
| 1468 { | 1468 { |
| 1469 bool hasSyntaxError = compileResult != CompileSuccess; | 1469 bool hasSyntaxError = compileResult != CompileSuccess; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe
xt(toCoreStringWithUndefinedOrNullCheck(message->Get())); | 1712 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe
xt(toCoreStringWithUndefinedOrNullCheck(message->Get())); |
| 1713 exceptionDetails->setLine(message->GetLineNumber()); | 1713 exceptionDetails->setLine(message->GetLineNumber()); |
| 1714 exceptionDetails->setColumn(message->GetStartColumn()); | 1714 exceptionDetails->setColumn(message->GetStartColumn()); |
| 1715 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); | 1715 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); |
| 1716 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) | 1716 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) |
| 1717 exceptionDetails->setStackTrace(createScriptCallStack(isolate, messageSt
ackTrace, messageStackTrace->GetFrameCount())->buildInspectorArray()); | 1717 exceptionDetails->setStackTrace(createScriptCallStack(isolate, messageSt
ackTrace, messageStackTrace->GetFrameCount())->buildInspectorArray()); |
| 1718 return exceptionDetails.release(); | 1718 return exceptionDetails.release(); |
| 1719 } | 1719 } |
| 1720 | 1720 |
| 1721 } // namespace blink | 1721 } // namespace blink |
| OLD | NEW |