Chromium Code Reviews| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 { | 236 { |
| 237 if (!enabled()) | 237 if (!enabled()) |
| 238 return; | 238 return; |
| 239 | 239 |
| 240 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::Dict ionaryValue::create()); | 240 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::Dict ionaryValue::create()); |
| 241 m_state->setNumber(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImp l::DontPauseOnExceptions); | 241 m_state->setNumber(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImp l::DontPauseOnExceptions); |
| 242 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, 0); | 242 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, 0); |
| 243 | 243 |
| 244 debugger().removeDebuggerAgent(m_contextGroupId); | 244 debugger().removeDebuggerAgent(m_contextGroupId); |
| 245 m_pausedContext.Reset(); | 245 m_pausedContext.Reset(); |
| 246 m_currentCallStack.clear(); | 246 Vector<OwnPtr<JavaScriptCallFrame>> emptyCallFrames; |
| 247 m_pausedCallFrames.swap(emptyCallFrames); | |
| 247 m_scripts.clear(); | 248 m_scripts.clear(); |
| 248 m_blackboxedPositions.clear(); | 249 m_blackboxedPositions.clear(); |
| 249 m_breakpointIdToDebuggerBreakpointIds.clear(); | 250 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 250 internalSetAsyncCallStackDepth(0); | 251 internalSetAsyncCallStackDepth(0); |
| 251 m_continueToLocationBreakpointId = String16(); | 252 m_continueToLocationBreakpointId = String16(); |
| 252 clearBreakDetails(); | 253 clearBreakDetails(); |
| 253 m_scheduledDebuggerStep = NoStep; | 254 m_scheduledDebuggerStep = NoStep; |
| 254 m_skipNextDebuggerStepOut = false; | 255 m_skipNextDebuggerStepOut = false; |
| 255 m_javaScriptPauseScheduled = false; | 256 m_javaScriptPauseScheduled = false; |
| 256 m_steppingFromFramework = false; | 257 m_steppingFromFramework = false; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 | 478 |
| 478 ScriptBreakpoint breakpoint(lineNumber, columnNumber, ""); | 479 ScriptBreakpoint breakpoint(lineNumber, columnNumber, ""); |
| 479 m_continueToLocationBreakpointId = debugger().setBreakpoint(scriptId, breakp oint, &lineNumber, &columnNumber, interstateLocationOpt.fromMaybe(false)); | 480 m_continueToLocationBreakpointId = debugger().setBreakpoint(scriptId, breakp oint, &lineNumber, &columnNumber, interstateLocationOpt.fromMaybe(false)); |
| 480 resume(errorString); | 481 resume(errorString); |
| 481 } | 482 } |
| 482 | 483 |
| 483 void V8DebuggerAgentImpl::getBacktrace(ErrorString* errorString, OwnPtr<Array<Ca llFrame>>* callFrames, Maybe<StackTrace>* asyncStackTrace) | 484 void V8DebuggerAgentImpl::getBacktrace(ErrorString* errorString, OwnPtr<Array<Ca llFrame>>* callFrames, Maybe<StackTrace>* asyncStackTrace) |
| 484 { | 485 { |
| 485 if (!assertPaused(errorString)) | 486 if (!assertPaused(errorString)) |
| 486 return; | 487 return; |
| 487 m_currentCallStack = debugger().currentCallFrames(); | 488 m_pausedCallFrames = debugger().currentCallFrames(); |
| 488 *callFrames = currentCallFrames(errorString); | 489 *callFrames = currentCallFrames(errorString); |
| 489 if (!*callFrames) | 490 if (!*callFrames) |
| 490 return; | 491 return; |
| 491 *asyncStackTrace = currentAsyncStackTrace(); | 492 *asyncStackTrace = currentAsyncStackTrace(); |
| 492 } | 493 } |
| 493 | 494 |
| 494 bool V8DebuggerAgentImpl::isCallStackEmptyOrBlackboxed() | 495 bool V8DebuggerAgentImpl::isCurrentCallStackEmptyOrBlackboxed() |
| 495 { | 496 { |
| 496 ASSERT(enabled()); | 497 ASSERT(enabled()); |
| 497 for (int index = 0; ; ++index) { | 498 Vector<OwnPtr<JavaScriptCallFrame>> callFrames = debugger().currentCallFrame s(); |
| 498 OwnPtr<JavaScriptCallFrame> frame = debugger().callFrame(index); | 499 for (size_t index = 0; index < callFrames.size(); ++index) { |
| 499 if (!frame) | 500 if (!isCallFrameWithUnknownScriptOrBlackboxed(callFrames[index].get())) |
| 500 break; | |
| 501 if (!isCallFrameWithUnknownScriptOrBlackboxed(frame.get())) | |
| 502 return false; | 501 return false; |
| 503 } | 502 } |
| 504 return true; | 503 return true; |
| 505 } | 504 } |
| 506 | 505 |
| 507 bool V8DebuggerAgentImpl::isTopCallFrameBlackboxed() | 506 bool V8DebuggerAgentImpl::isTopPausedCallFrameBlackboxed() |
| 508 { | 507 { |
| 509 ASSERT(enabled()); | 508 ASSERT(enabled()); |
| 510 return isCallFrameWithUnknownScriptOrBlackboxed(debugger().callFrame(0).get( )); | 509 return isCallFrameBlackboxed(m_pausedCallFrames.size() ? m_pausedCallFrames[ 0].get() : nullptr); |
| 510 } | |
| 511 | |
| 512 bool V8DebuggerAgentImpl::isCallFrameBlackboxed(JavaScriptCallFrame* callFrame) | |
|
dgozman
2016/03/26 01:48:24
This is redundant.
kozy
2016/03/26 02:00:42
Removed.
| |
| 513 { | |
| 514 ASSERT(enabled()); | |
| 515 return isCallFrameWithUnknownScriptOrBlackboxed(callFrame); | |
| 511 } | 516 } |
| 512 | 517 |
| 513 bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCal lFrame* frame) | 518 bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCal lFrame* frame) |
| 514 { | 519 { |
| 515 if (!frame) | 520 if (!frame) |
| 516 return true; | 521 return true; |
| 517 ScriptsMap::iterator it = m_scripts.find(String16::number(frame->sourceID()) ); | 522 ScriptsMap::iterator it = m_scripts.find(String16::number(frame->sourceID()) ); |
| 518 if (it == m_scripts.end()) { | 523 if (it == m_scripts.end()) { |
| 519 // Unknown scripts are blackboxed. | 524 // Unknown scripts are blackboxed. |
| 520 return true; | 525 return true; |
| 521 } | 526 } |
| 522 auto itBlackboxedPositions = m_blackboxedPositions.find(String16::number(fra me->sourceID())); | 527 auto itBlackboxedPositions = m_blackboxedPositions.find(String16::number(fra me->sourceID())); |
| 523 if (itBlackboxedPositions == m_blackboxedPositions.end()) | 528 if (itBlackboxedPositions == m_blackboxedPositions.end()) |
| 524 return false; | 529 return false; |
| 525 | 530 |
| 526 protocol::Vector<std::pair<int, int>>* ranges = itBlackboxedPositions->secon d; | 531 protocol::Vector<std::pair<int, int>>* ranges = itBlackboxedPositions->secon d; |
| 527 auto itRange = std::lower_bound(ranges->begin(), ranges->end(), std::make_pa ir(frame->line(), frame->column()), positionComparator); | 532 auto itRange = std::lower_bound(ranges->begin(), ranges->end(), std::make_pa ir(frame->line(), frame->column()), positionComparator); |
| 528 // Ranges array contains positions in script where blackbox state is changed . | 533 // Ranges array contains positions in script where blackbox state is changed . |
| 529 // [(0,0) ... ranges[0]) isn't blackboxed, [ranges[0] ... ranges[1]) is blac kboxed... | 534 // [(0,0) ... ranges[0]) isn't blackboxed, [ranges[0] ... ranges[1]) is blac kboxed... |
| 530 return std::distance(ranges->begin(), itRange) % 2; | 535 return std::distance(ranges->begin(), itRange) % 2; |
| 531 } | 536 } |
| 532 | 537 |
| 533 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipExceptionPa use() | 538 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipExceptionPa use(JavaScriptCallFrame* topCallFrame) |
| 534 { | 539 { |
| 535 if (m_steppingFromFramework) | 540 if (m_steppingFromFramework) |
| 536 return RequestNoSkip; | 541 return RequestNoSkip; |
| 537 if (isTopCallFrameBlackboxed()) | 542 if (isCallFrameBlackboxed(topCallFrame)) |
| 538 return RequestContinue; | 543 return RequestContinue; |
| 539 return RequestNoSkip; | 544 return RequestNoSkip; |
| 540 } | 545 } |
| 541 | 546 |
| 542 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipStepPause() | 547 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipStepPause(J avaScriptCallFrame* topCallFrame) |
| 543 { | 548 { |
| 544 if (m_steppingFromFramework) | 549 if (m_steppingFromFramework) |
| 545 return RequestNoSkip; | 550 return RequestNoSkip; |
| 546 | 551 |
| 547 if (m_skipNextDebuggerStepOut) { | 552 if (m_skipNextDebuggerStepOut) { |
| 548 m_skipNextDebuggerStepOut = false; | 553 m_skipNextDebuggerStepOut = false; |
| 549 if (m_scheduledDebuggerStep == StepOut) | 554 if (m_scheduledDebuggerStep == StepOut) |
| 550 return RequestStepOut; | 555 return RequestStepOut; |
| 551 } | 556 } |
| 552 | 557 |
| 553 if (!isTopCallFrameBlackboxed()) | 558 if (!isCallFrameBlackboxed(topCallFrame)) |
| 554 return RequestNoSkip; | 559 return RequestNoSkip; |
| 555 | 560 |
| 556 if (m_skippedStepFrameCount >= maxSkipStepFrameCount) | 561 if (m_skippedStepFrameCount >= maxSkipStepFrameCount) |
| 557 return RequestStepOut; | 562 return RequestStepOut; |
| 558 | 563 |
| 559 if (!m_skippedStepFrameCount) | 564 if (!m_skippedStepFrameCount) |
| 560 m_recursionLevelForStepFrame = 1; | 565 m_recursionLevelForStepFrame = 1; |
| 561 | 566 |
| 562 ++m_skippedStepFrameCount; | 567 ++m_skippedStepFrameCount; |
| 563 return RequestStepFrame; | 568 return RequestStepFrame; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 const String16& scriptId, | 614 const String16& scriptId, |
| 610 const String16& newContent, | 615 const String16& newContent, |
| 611 const Maybe<bool>& preview, | 616 const Maybe<bool>& preview, |
| 612 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* newCallFrames, | 617 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* newCallFrames, |
| 613 Maybe<bool>* stackChanged, | 618 Maybe<bool>* stackChanged, |
| 614 Maybe<StackTrace>* asyncStackTrace, | 619 Maybe<StackTrace>* asyncStackTrace, |
| 615 Maybe<protocol::Debugger::SetScriptSourceError>* optOutCompileError) | 620 Maybe<protocol::Debugger::SetScriptSourceError>* optOutCompileError) |
| 616 { | 621 { |
| 617 if (!checkEnabled(errorString)) | 622 if (!checkEnabled(errorString)) |
| 618 return; | 623 return; |
| 619 if (!debugger().setScriptSource(scriptId, newContent, preview.fromMaybe(fals e), errorString, optOutCompileError, &m_currentCallStack, stackChanged)) | 624 if (!debugger().setScriptSource(scriptId, newContent, preview.fromMaybe(fals e), errorString, optOutCompileError, &m_pausedCallFrames, stackChanged)) |
| 620 return; | 625 return; |
| 621 | 626 |
| 622 OwnPtr<Array<CallFrame>> callFrames = currentCallFrames(errorString); | 627 OwnPtr<Array<CallFrame>> callFrames = currentCallFrames(errorString); |
| 623 if (!callFrames) | 628 if (!callFrames) |
| 624 return; | 629 return; |
| 625 *newCallFrames = callFrames.release(); | 630 *newCallFrames = callFrames.release(); |
| 626 *asyncStackTrace = currentAsyncStackTrace(); | 631 *asyncStackTrace = currentAsyncStackTrace(); |
| 627 | 632 |
| 628 ScriptsMap::iterator it = m_scripts.find(scriptId); | 633 ScriptsMap::iterator it = m_scripts.find(scriptId); |
| 629 if (it == m_scripts.end()) | 634 if (it == m_scripts.end()) |
| 630 return; | 635 return; |
| 631 it->second->setSource(newContent); | 636 it->second->setSource(newContent); |
| 632 } | 637 } |
| 633 | 638 |
| 634 void V8DebuggerAgentImpl::restartFrame(ErrorString* errorString, | 639 void V8DebuggerAgentImpl::restartFrame(ErrorString* errorString, |
| 635 const String16& callFrameId, | 640 const String16& callFrameId, |
| 636 OwnPtr<Array<CallFrame>>* newCallFrames, | 641 OwnPtr<Array<CallFrame>>* newCallFrames, |
| 637 Maybe<StackTrace>* asyncStackTrace) | 642 Maybe<StackTrace>* asyncStackTrace) |
| 638 { | 643 { |
| 639 if (!isPaused() || !m_currentCallStack) { | 644 if (!assertPaused(errorString)) |
| 640 *errorString = "Attempt to access call frame when debugger is not on pau se"; | |
| 641 return; | 645 return; |
| 642 } | |
| 643 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(errorString, c allFrameId); | 646 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(errorString, c allFrameId); |
| 644 if (!remoteId) | 647 if (!remoteId) |
| 645 return; | 648 return; |
| 646 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (errorString, remoteId.get()); | 649 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (errorString, remoteId.get()); |
| 647 if (!injectedScript) | 650 if (!injectedScript) |
| 648 return; | 651 return; |
| 649 | 652 |
| 650 v8::HandleScope scope(m_isolate); | 653 v8::HandleScope scope(m_isolate); |
| 651 v8::Local<v8::Context> localContext = injectedScript->context(); | 654 v8::Local<v8::Context> localContext = injectedScript->context(); |
| 652 | 655 |
| 653 v8::TryCatch tryCatch(m_isolate); | 656 v8::TryCatch tryCatch(m_isolate); |
| 654 | 657 |
| 655 OwnPtr<JavaScriptCallFrame> javaScriptCallFrame = debugger().callFrame(remot eId->frameOrdinal()); | 658 size_t frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 656 if (!javaScriptCallFrame) { | 659 if (frameOrdinal >= m_pausedCallFrames.size()) { |
| 657 *errorString = "Could not find call frame with given id"; | 660 *errorString = "Could not find call frame with given id"; |
| 658 return; | 661 return; |
| 659 } | 662 } |
| 660 v8::Local<v8::Value> resultValue; | 663 v8::Local<v8::Value> resultValue; |
| 661 v8::Local<v8::Boolean> result; | 664 v8::Local<v8::Boolean> result; |
| 662 if (!javaScriptCallFrame->restart().ToLocal(&resultValue) || tryCatch.HasCau ght() || !resultValue->ToBoolean(localContext).ToLocal(&result) || !result->Valu e()) { | 665 if (!m_pausedCallFrames[frameOrdinal].get()->restart().ToLocal(&resultValue) || tryCatch.HasCaught() || !resultValue->ToBoolean(localContext).ToLocal(&resul t) || !result->Value()) { |
| 663 *errorString = "Internal error"; | 666 *errorString = "Internal error"; |
| 664 return; | 667 return; |
| 665 } | 668 } |
| 666 | 669 |
| 667 m_currentCallStack = debugger().currentCallFrames(); | 670 m_pausedCallFrames = debugger().currentCallFrames(); |
| 668 | 671 |
| 669 *newCallFrames = currentCallFrames(errorString); | 672 *newCallFrames = currentCallFrames(errorString); |
| 670 if (!*newCallFrames) | 673 if (!*newCallFrames) |
| 671 return; | 674 return; |
| 672 *asyncStackTrace = currentAsyncStackTrace(); | 675 *asyncStackTrace = currentAsyncStackTrace(); |
| 673 } | 676 } |
| 674 | 677 |
| 675 void V8DebuggerAgentImpl::getScriptSource(ErrorString* error, const String16& sc riptId, String16* scriptSource) | 678 void V8DebuggerAgentImpl::getScriptSource(ErrorString* error, const String16& sc riptId, String16* scriptSource) |
| 676 { | 679 { |
| 677 if (!checkEnabled(error)) | 680 if (!checkEnabled(error)) |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 885 m_steppingFromFramework = false; | 888 m_steppingFromFramework = false; |
| 886 m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceOb jectGroup); | 889 m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceOb jectGroup); |
| 887 debugger().continueProgram(); | 890 debugger().continueProgram(); |
| 888 } | 891 } |
| 889 | 892 |
| 890 void V8DebuggerAgentImpl::stepOver(ErrorString* errorString) | 893 void V8DebuggerAgentImpl::stepOver(ErrorString* errorString) |
| 891 { | 894 { |
| 892 if (!assertPaused(errorString)) | 895 if (!assertPaused(errorString)) |
| 893 return; | 896 return; |
| 894 // StepOver at function return point should fallback to StepInto. | 897 // StepOver at function return point should fallback to StepInto. |
| 895 OwnPtr<JavaScriptCallFrame> frame = debugger().callFrame(0); | 898 JavaScriptCallFrame* frame = m_pausedCallFrames.size() ? m_pausedCallFrames[ 0].get() : nullptr; |
| 896 if (frame && frame->isAtReturn()) { | 899 if (frame && frame->isAtReturn()) { |
| 897 stepInto(errorString); | 900 stepInto(errorString); |
| 898 return; | 901 return; |
| 899 } | 902 } |
| 900 m_scheduledDebuggerStep = StepOver; | 903 m_scheduledDebuggerStep = StepOver; |
| 901 m_steppingFromFramework = isTopCallFrameBlackboxed(); | 904 m_steppingFromFramework = isTopPausedCallFrameBlackboxed(); |
| 902 m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceOb jectGroup); | 905 m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceOb jectGroup); |
| 903 debugger().stepOverStatement(); | 906 debugger().stepOverStatement(); |
| 904 } | 907 } |
| 905 | 908 |
| 906 void V8DebuggerAgentImpl::stepInto(ErrorString* errorString) | 909 void V8DebuggerAgentImpl::stepInto(ErrorString* errorString) |
| 907 { | 910 { |
| 908 if (!assertPaused(errorString)) | 911 if (!assertPaused(errorString)) |
| 909 return; | 912 return; |
| 910 m_scheduledDebuggerStep = StepInto; | 913 m_scheduledDebuggerStep = StepInto; |
| 911 m_steppingFromFramework = isTopCallFrameBlackboxed(); | 914 m_steppingFromFramework = isTopPausedCallFrameBlackboxed(); |
| 912 m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceOb jectGroup); | 915 m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceOb jectGroup); |
| 913 debugger().stepIntoStatement(); | 916 debugger().stepIntoStatement(); |
| 914 } | 917 } |
| 915 | 918 |
| 916 void V8DebuggerAgentImpl::stepOut(ErrorString* errorString) | 919 void V8DebuggerAgentImpl::stepOut(ErrorString* errorString) |
| 917 { | 920 { |
| 918 if (!assertPaused(errorString)) | 921 if (!assertPaused(errorString)) |
| 919 return; | 922 return; |
| 920 m_scheduledDebuggerStep = StepOut; | 923 m_scheduledDebuggerStep = StepOut; |
| 921 m_skipNextDebuggerStepOut = false; | 924 m_skipNextDebuggerStepOut = false; |
| 922 m_recursionLevelForStepOut = 1; | 925 m_recursionLevelForStepOut = 1; |
| 923 m_steppingFromFramework = isTopCallFrameBlackboxed(); | 926 m_steppingFromFramework = isTopPausedCallFrameBlackboxed(); |
| 924 m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceOb jectGroup); | 927 m_injectedScriptManager->releaseObjectGroup(V8DebuggerAgentImpl::backtraceOb jectGroup); |
| 925 debugger().stepOutOfFunction(); | 928 debugger().stepOutOfFunction(); |
| 926 } | 929 } |
| 927 | 930 |
| 928 void V8DebuggerAgentImpl::stepIntoAsync(ErrorString* errorString) | 931 void V8DebuggerAgentImpl::stepIntoAsync(ErrorString* errorString) |
| 929 { | 932 { |
| 930 if (!assertPaused(errorString)) | 933 if (!assertPaused(errorString)) |
| 931 return; | 934 return; |
| 932 if (!trackingAsyncCalls()) { | 935 if (!trackingAsyncCalls()) { |
| 933 *errorString = "Can only perform operation if async call stacks are enab led."; | 936 *errorString = "Can only perform operation if async call stacks are enab led."; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 970 const String16& expression, | 973 const String16& expression, |
| 971 const Maybe<String16>& objectGroup, | 974 const Maybe<String16>& objectGroup, |
| 972 const Maybe<bool>& includeCommandLineAPI, | 975 const Maybe<bool>& includeCommandLineAPI, |
| 973 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, | 976 const Maybe<bool>& doNotPauseOnExceptionsAndMuteConsole, |
| 974 const Maybe<bool>& returnByValue, | 977 const Maybe<bool>& returnByValue, |
| 975 const Maybe<bool>& generatePreview, | 978 const Maybe<bool>& generatePreview, |
| 976 OwnPtr<RemoteObject>* result, | 979 OwnPtr<RemoteObject>* result, |
| 977 Maybe<bool>* wasThrown, | 980 Maybe<bool>* wasThrown, |
| 978 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) | 981 Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) |
| 979 { | 982 { |
| 980 if (!isPaused() || !m_currentCallStack) { | 983 if (!assertPaused(errorString)) |
| 981 *errorString = "Attempt to access callframe when debugger is not on paus e"; | |
| 982 return; | 984 return; |
| 983 } | |
| 984 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(errorString, c allFrameId); | 985 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(errorString, c allFrameId); |
| 985 if (!remoteId) | 986 if (!remoteId) |
| 986 return; | 987 return; |
| 987 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (errorString, remoteId.get()); | 988 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (errorString, remoteId.get()); |
| 988 if (!injectedScript) | 989 if (!injectedScript) |
| 989 return; | 990 return; |
| 990 | 991 |
| 991 v8::HandleScope scope(injectedScript->isolate()); | 992 v8::HandleScope scope(injectedScript->isolate()); |
| 992 | 993 |
| 993 if (!injectedScript->canAccessInspectedWindow()) { | 994 if (!injectedScript->canAccessInspectedWindow()) { |
| 994 *errorString = "Can not access given context"; | 995 *errorString = "Can not access given context"; |
| 995 return; | 996 return; |
| 996 } | 997 } |
| 997 | 998 |
| 998 OwnPtr<JavaScriptCallFrame> javaScriptCallFrame = debugger().callFrame(remot eId->frameOrdinal()); | 999 size_t frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 999 if (!javaScriptCallFrame) { | 1000 if (frameOrdinal >= m_pausedCallFrames.size()) { |
| 1000 *errorString = "Could not find call frame with given id"; | 1001 *errorString = "Could not find call frame with given id"; |
| 1001 return; | 1002 return; |
| 1002 } | 1003 } |
| 1003 | 1004 |
| 1004 v8::MaybeLocal<v8::Object> commandLineAPI = includeCommandLineAPI.fromMaybe( false) ? injectedScript->commandLineAPI(errorString) : v8::MaybeLocal<v8::Object >(); | 1005 v8::MaybeLocal<v8::Object> commandLineAPI = includeCommandLineAPI.fromMaybe( false) ? injectedScript->commandLineAPI(errorString) : v8::MaybeLocal<v8::Object >(); |
| 1005 if (includeCommandLineAPI.fromMaybe(false) && commandLineAPI.IsEmpty()) | 1006 if (includeCommandLineAPI.fromMaybe(false) && commandLineAPI.IsEmpty()) |
| 1006 return; | 1007 return; |
| 1007 | 1008 |
| 1008 InjectedScript::ScopedGlobalObjectExtension scopeExtension(injectedScript, c ommandLineAPI); | 1009 InjectedScript::ScopedGlobalObjectExtension scopeExtension(injectedScript, c ommandLineAPI); |
| 1009 | 1010 |
| 1010 v8::TryCatch tryCatch(injectedScript->isolate()); | 1011 v8::TryCatch tryCatch(injectedScript->isolate()); |
| 1011 | 1012 |
| 1012 v8::MaybeLocal<v8::Value> maybeResultValue = javaScriptCallFrame->evaluate(t oV8String(injectedScript->isolate(), expression)); | 1013 v8::MaybeLocal<v8::Value> maybeResultValue = m_pausedCallFrames[frameOrdinal ].get()->evaluate(toV8String(injectedScript->isolate(), expression)); |
| 1013 | 1014 |
| 1014 // InjectedScript may be gone after any evaluate call - find it again. | 1015 // InjectedScript may be gone after any evaluate call - find it again. |
| 1015 injectedScript = m_injectedScriptManager->findInjectedScript(errorString, re moteId.get()); | 1016 injectedScript = m_injectedScriptManager->findInjectedScript(errorString, re moteId.get()); |
| 1016 if (!injectedScript) | 1017 if (!injectedScript) |
| 1017 return; | 1018 return; |
| 1018 | 1019 |
| 1019 injectedScript->wrapEvaluateResult(errorString, | 1020 injectedScript->wrapEvaluateResult(errorString, |
| 1020 maybeResultValue, | 1021 maybeResultValue, |
| 1021 tryCatch, | 1022 tryCatch, |
| 1022 objectGroup.fromMaybe(""), | 1023 objectGroup.fromMaybe(""), |
| 1023 returnByValue.fromMaybe(false), | 1024 returnByValue.fromMaybe(false), |
| 1024 generatePreview.fromMaybe(false), | 1025 generatePreview.fromMaybe(false), |
| 1025 result, | 1026 result, |
| 1026 wasThrown, | 1027 wasThrown, |
| 1027 exceptionDetails); | 1028 exceptionDetails); |
| 1028 } | 1029 } |
| 1029 | 1030 |
| 1030 void V8DebuggerAgentImpl::setVariableValue(ErrorString* errorString, | 1031 void V8DebuggerAgentImpl::setVariableValue(ErrorString* errorString, |
| 1031 int scopeNumber, | 1032 int scopeNumber, |
| 1032 const String16& variableName, | 1033 const String16& variableName, |
| 1033 PassOwnPtr<protocol::Runtime::CallArgument> newValueArgument, | 1034 PassOwnPtr<protocol::Runtime::CallArgument> newValueArgument, |
| 1034 const String16& callFrameId) | 1035 const String16& callFrameId) |
| 1035 { | 1036 { |
| 1036 if (!checkEnabled(errorString)) | 1037 if (!checkEnabled(errorString)) |
| 1037 return; | 1038 return; |
| 1038 if (!isPaused() || !m_currentCallStack) { | 1039 if (!assertPaused(errorString)) |
| 1039 *errorString = "Attempt to access callframe when debugger is not on paus e"; | |
| 1040 return; | 1040 return; |
| 1041 } | |
| 1042 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(errorString, c allFrameId); | 1041 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(errorString, c allFrameId); |
| 1043 if (!remoteId) | 1042 if (!remoteId) |
| 1044 return; | 1043 return; |
| 1045 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (errorString, remoteId.get()); | 1044 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (errorString, remoteId.get()); |
| 1046 if (!injectedScript) | 1045 if (!injectedScript) |
| 1047 return; | 1046 return; |
| 1048 | 1047 |
| 1049 v8::HandleScope scope(m_isolate); | 1048 v8::HandleScope scope(m_isolate); |
| 1050 v8::TryCatch tryCatch(m_isolate); | 1049 v8::TryCatch tryCatch(m_isolate); |
| 1051 | 1050 |
| 1052 v8::Local<v8::Value> newValue; | 1051 v8::Local<v8::Value> newValue; |
| 1053 if (!injectedScript->resolveCallArgument(errorString, newValueArgument.get() ).ToLocal(&newValue)) | 1052 if (!injectedScript->resolveCallArgument(errorString, newValueArgument.get() ).ToLocal(&newValue)) |
| 1054 return; | 1053 return; |
| 1055 | 1054 |
| 1056 OwnPtr<JavaScriptCallFrame> javaScriptCallFrame = debugger().callFrame(remot eId->frameOrdinal()); | 1055 size_t frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 1057 if (!javaScriptCallFrame) { | 1056 if (frameOrdinal >= m_pausedCallFrames.size()) { |
| 1058 *errorString = "Could not find call frame with given id"; | 1057 *errorString = "Could not find call frame with given id"; |
| 1059 return; | 1058 return; |
| 1060 } | 1059 } |
| 1061 v8::MaybeLocal<v8::Value> result = javaScriptCallFrame->setVariableValue(sco peNumber, toV8String(m_isolate, variableName), newValue); | 1060 v8::MaybeLocal<v8::Value> result = m_pausedCallFrames[frameOrdinal].get()->s etVariableValue(scopeNumber, toV8String(m_isolate, variableName), newValue); |
| 1062 if (tryCatch.HasCaught() || result.IsEmpty()) { | 1061 if (tryCatch.HasCaught() || result.IsEmpty()) { |
| 1063 *errorString = "Internal error"; | 1062 *errorString = "Internal error"; |
| 1064 return; | 1063 return; |
| 1065 } | 1064 } |
| 1066 } | 1065 } |
| 1067 | 1066 |
| 1068 void V8DebuggerAgentImpl::setAsyncCallStackDepth(ErrorString* errorString, int d epth) | 1067 void V8DebuggerAgentImpl::setAsyncCallStackDepth(ErrorString* errorString, int d epth) |
| 1069 { | 1068 { |
| 1070 if (!checkEnabled(errorString)) | 1069 if (!checkEnabled(errorString)) |
| 1071 return; | 1070 return; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1344 if (m_scheduledDebuggerStep == NoStep) | 1343 if (m_scheduledDebuggerStep == NoStep) |
| 1345 debugger().clearStepping(); | 1344 debugger().clearStepping(); |
| 1346 else if (m_scheduledDebuggerStep == StepOut) | 1345 else if (m_scheduledDebuggerStep == StepOut) |
| 1347 m_skipNextDebuggerStepOut = true; | 1346 m_skipNextDebuggerStepOut = true; |
| 1348 } | 1347 } |
| 1349 } | 1348 } |
| 1350 } | 1349 } |
| 1351 | 1350 |
| 1352 PassOwnPtr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorString* errorString) | 1351 PassOwnPtr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorString* errorString) |
| 1353 { | 1352 { |
| 1354 if (m_pausedContext.IsEmpty() || !m_currentCallStack) | 1353 if (m_pausedContext.IsEmpty() || !m_pausedCallFrames.size()) |
| 1355 return Array<CallFrame>::create(); | 1354 return Array<CallFrame>::create(); |
| 1356 InjectedScript* topFrameInjectedScript = m_injectedScriptManager->injectedSc riptFor(m_pausedContext.Get(m_isolate)); | 1355 InjectedScript* topFrameInjectedScript = m_injectedScriptManager->injectedSc riptFor(m_pausedContext.Get(m_isolate)); |
| 1357 if (!topFrameInjectedScript) { | 1356 if (!topFrameInjectedScript) { |
| 1358 // Context has been reported as removed while on pause. | 1357 // Context has been reported as removed while on pause. |
| 1359 return Array<CallFrame>::create(); | 1358 return Array<CallFrame>::create(); |
| 1360 } | 1359 } |
| 1361 | 1360 |
| 1362 v8::Isolate* isolate = topFrameInjectedScript->isolate(); | 1361 v8::Isolate* isolate = topFrameInjectedScript->isolate(); |
| 1363 v8::HandleScope handles(isolate); | 1362 v8::HandleScope handles(isolate); |
| 1364 v8::Local<v8::Context> context = topFrameInjectedScript->context(); | 1363 v8::Local<v8::Context> context = topFrameInjectedScript->context(); |
| 1365 v8::Context::Scope contextScope(context); | 1364 v8::Context::Scope contextScope(context); |
| 1366 | 1365 |
| 1367 JavaScriptCallFrame* currentCallFrame = m_currentCallStack.get(); | |
| 1368 int callFrameIndex = 0; | |
| 1369 OwnPtr<JavaScriptCallFrame> currentCallFrameOwner; | |
| 1370 v8::Local<v8::Array> objects = v8::Array::New(isolate); | 1366 v8::Local<v8::Array> objects = v8::Array::New(isolate); |
| 1371 while (currentCallFrame) { | 1367 for (size_t i = 0; i < m_pausedCallFrames.size(); ++i) { |
|
dgozman
2016/03/26 01:48:24
i -> frameOrdinal
kozy
2016/03/26 02:00:42
Done.
| |
| 1368 JavaScriptCallFrame* currentCallFrame = m_pausedCallFrames[i].get(); | |
| 1369 | |
| 1372 v8::Local<v8::Object> details = currentCallFrame->details(); | 1370 v8::Local<v8::Object> details = currentCallFrame->details(); |
| 1373 if (hasInternalError(errorString, details.IsEmpty())) | 1371 if (hasInternalError(errorString, details.IsEmpty())) |
| 1374 return Array<CallFrame>::create(); | 1372 return Array<CallFrame>::create(); |
| 1375 | 1373 |
| 1376 int contextId = currentCallFrame->contextId(); | 1374 int contextId = currentCallFrame->contextId(); |
| 1377 InjectedScript* injectedScript = contextId ? m_injectedScriptManager->fi ndInjectedScript(errorString, contextId) : nullptr; | 1375 InjectedScript* injectedScript = contextId ? m_injectedScriptManager->fi ndInjectedScript(errorString, contextId) : nullptr; |
| 1378 if (!injectedScript) { | 1376 if (!injectedScript) { |
| 1379 *errorString = ""; | 1377 *errorString = ""; |
| 1380 injectedScript = topFrameInjectedScript; | 1378 injectedScript = topFrameInjectedScript; |
| 1381 } | 1379 } |
| 1382 | 1380 |
| 1383 String16 callFrameId = RemoteCallFrameId::serialize(injectedScript->cont extId(), callFrameIndex); | 1381 String16 callFrameId = RemoteCallFrameId::serialize(injectedScript->cont extId(), i); |
| 1384 if (hasInternalError(errorString, !details->Set(context, toV8StringInter nalized(isolate, "callFrameId"), toV8String(isolate, callFrameId)).FromMaybe(fal se))) | 1382 if (hasInternalError(errorString, !details->Set(context, toV8StringInter nalized(isolate, "callFrameId"), toV8String(isolate, callFrameId)).FromMaybe(fal se))) |
| 1385 return Array<CallFrame>::create(); | 1383 return Array<CallFrame>::create(); |
| 1386 | 1384 |
| 1387 v8::Local<v8::Value> scopeChain; | 1385 v8::Local<v8::Value> scopeChain; |
| 1388 if (hasInternalError(errorString, !details->Get(context, toV8StringInter nalized(isolate, "scopeChain")).ToLocal(&scopeChain) || !scopeChain->IsArray())) | 1386 if (hasInternalError(errorString, !details->Get(context, toV8StringInter nalized(isolate, "scopeChain")).ToLocal(&scopeChain) || !scopeChain->IsArray())) |
| 1389 return Array<CallFrame>::create(); | 1387 return Array<CallFrame>::create(); |
| 1390 v8::Local<v8::Array> scopeChainArray = scopeChain.As<v8::Array>(); | 1388 v8::Local<v8::Array> scopeChainArray = scopeChain.As<v8::Array>(); |
| 1391 if (!injectedScript->wrapPropertyInArray(errorString, scopeChainArray, t oV8StringInternalized(isolate, "object"), V8DebuggerAgentImpl::backtraceObjectGr oup)) | 1389 if (!injectedScript->wrapPropertyInArray(errorString, scopeChainArray, t oV8StringInternalized(isolate, "object"), V8DebuggerAgentImpl::backtraceObjectGr oup)) |
| 1392 return Array<CallFrame>::create(); | 1390 return Array<CallFrame>::create(); |
| 1393 | 1391 |
| 1394 if (!injectedScript->wrapObjectProperty(errorString, details, toV8String Internalized(isolate, "this"), V8DebuggerAgentImpl::backtraceObjectGroup)) | 1392 if (!injectedScript->wrapObjectProperty(errorString, details, toV8String Internalized(isolate, "this"), V8DebuggerAgentImpl::backtraceObjectGroup)) |
| 1395 return Array<CallFrame>::create(); | 1393 return Array<CallFrame>::create(); |
| 1396 | 1394 |
| 1397 if (details->Has(context, toV8StringInternalized(isolate, "returnValue") ).FromMaybe(false)) { | 1395 if (details->Has(context, toV8StringInternalized(isolate, "returnValue") ).FromMaybe(false)) { |
| 1398 if (!injectedScript->wrapObjectProperty(errorString, details, toV8St ringInternalized(isolate, "returnValue"), V8DebuggerAgentImpl::backtraceObjectGr oup)) | 1396 if (!injectedScript->wrapObjectProperty(errorString, details, toV8St ringInternalized(isolate, "returnValue"), V8DebuggerAgentImpl::backtraceObjectGr oup)) |
| 1399 return Array<CallFrame>::create(); | 1397 return Array<CallFrame>::create(); |
| 1400 } | 1398 } |
| 1401 | 1399 |
| 1402 if (hasInternalError(errorString, !objects->Set(context, callFrameIndex, details).FromMaybe(false))) | 1400 if (hasInternalError(errorString, !objects->Set(context, i, details).Fro mMaybe(false))) |
| 1403 return Array<CallFrame>::create(); | 1401 return Array<CallFrame>::create(); |
| 1404 | |
| 1405 currentCallFrameOwner = currentCallFrame->caller(); | |
| 1406 currentCallFrame = currentCallFrameOwner.get(); | |
| 1407 ++callFrameIndex; | |
| 1408 } | 1402 } |
| 1409 | 1403 |
| 1410 protocol::ErrorSupport errorSupport; | 1404 protocol::ErrorSupport errorSupport; |
| 1411 OwnPtr<Array<CallFrame>> callFrames = Array<CallFrame>::parse(toProtocolValu e(context, objects).get(), &errorSupport); | 1405 OwnPtr<Array<CallFrame>> callFrames = Array<CallFrame>::parse(toProtocolValu e(context, objects).get(), &errorSupport); |
| 1412 if (hasInternalError(errorString, !callFrames)) | 1406 if (hasInternalError(errorString, !callFrames)) |
| 1413 return Array<CallFrame>::create(); | 1407 return Array<CallFrame>::create(); |
| 1414 return callFrames.release(); | 1408 return callFrames.release(); |
| 1415 } | 1409 } |
| 1416 | 1410 |
| 1417 PassOwnPtr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() | 1411 PassOwnPtr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace() |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1486 ScriptBreakpoint breakpoint; | 1480 ScriptBreakpoint breakpoint; |
| 1487 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint. lineNumber); | 1481 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint. lineNumber); |
| 1488 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin t.columnNumber); | 1482 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin t.columnNumber); |
| 1489 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c ondition); | 1483 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c ondition); |
| 1490 OwnPtr<protocol::Debugger::Location> location = resolveBreakpoint(cookie .first, parsedScript.scriptId, breakpoint, UserBreakpointSource); | 1484 OwnPtr<protocol::Debugger::Location> location = resolveBreakpoint(cookie .first, parsedScript.scriptId, breakpoint, UserBreakpointSource); |
| 1491 if (location) | 1485 if (location) |
| 1492 m_frontend->breakpointResolved(cookie.first, location.release()); | 1486 m_frontend->breakpointResolved(cookie.first, location.release()); |
| 1493 } | 1487 } |
| 1494 } | 1488 } |
| 1495 | 1489 |
| 1496 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8 ::Context> context, PassOwnPtr<JavaScriptCallFrame> callFrames, v8::Local<v8::Va lue> exception, const protocol::Vector<String16>& hitBreakpoints, bool isPromise Rejection) | 1490 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8 ::Context> context, v8::Local<v8::Value> exception, const protocol::Vector<Strin g16>& hitBreakpoints, bool isPromiseRejection) |
| 1497 { | 1491 { |
| 1492 Vector<OwnPtr<JavaScriptCallFrame>> callFrames = debugger().currentCallFrame s(1); | |
| 1493 JavaScriptCallFrame* topCallFrame = callFrames.size() > 0 ? callFrames[0].ge t() : nullptr; | |
| 1494 | |
| 1498 V8DebuggerAgentImpl::SkipPauseRequest result; | 1495 V8DebuggerAgentImpl::SkipPauseRequest result; |
| 1499 if (m_skipAllPauses) | 1496 if (m_skipAllPauses) |
| 1500 result = RequestContinue; | 1497 result = RequestContinue; |
| 1501 else if (!hitBreakpoints.isEmpty()) | 1498 else if (!hitBreakpoints.isEmpty()) |
| 1502 result = RequestNoSkip; // Don't skip explicit breakpoints even if set i n frameworks. | 1499 result = RequestNoSkip; // Don't skip explicit breakpoints even if set i n frameworks. |
| 1503 else if (!exception.IsEmpty()) | 1500 else if (!exception.IsEmpty()) |
| 1504 result = shouldSkipExceptionPause(); | 1501 result = shouldSkipExceptionPause(topCallFrame); |
| 1505 else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled || m_pausingOnNativeEvent) | 1502 else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled || m_pausingOnNativeEvent) |
| 1506 result = shouldSkipStepPause(); | 1503 result = shouldSkipStepPause(topCallFrame); |
| 1507 else | 1504 else |
| 1508 result = RequestNoSkip; | 1505 result = RequestNoSkip; |
| 1509 | 1506 |
| 1507 // Skip pauses inside V8 internal scripts and on syntax errors. | |
| 1508 if (!topCallFrame) | |
|
dgozman
2016/03/26 01:48:24
Move this back.
kozy
2016/03/26 02:00:42
Done.
| |
| 1509 return RequestContinue; | |
| 1510 callFrames = debugger().currentCallFrames(); | |
| 1511 m_pausedCallFrames.swap(callFrames); | |
| 1510 m_skipNextDebuggerStepOut = false; | 1512 m_skipNextDebuggerStepOut = false; |
| 1511 if (result != RequestNoSkip) | 1513 if (result != RequestNoSkip) { |
| 1514 Vector<OwnPtr<JavaScriptCallFrame>> callFrames; | |
| 1515 m_pausedCallFrames.swap(callFrames); | |
| 1512 return result; | 1516 return result; |
| 1513 | 1517 } |
| 1514 // Skip pauses inside V8 internal scripts and on syntax errors. | |
| 1515 if (!callFrames) | |
| 1516 return RequestContinue; | |
| 1517 | 1518 |
| 1518 ASSERT(m_pausedContext.IsEmpty()); | 1519 ASSERT(m_pausedContext.IsEmpty()); |
| 1519 m_pausedContext.Reset(m_isolate, context); | 1520 m_pausedContext.Reset(m_isolate, context); |
| 1520 m_currentCallStack = callFrames; | |
| 1521 v8::HandleScope handles(m_isolate); | 1521 v8::HandleScope handles(m_isolate); |
| 1522 | 1522 |
| 1523 if (!exception.IsEmpty()) { | 1523 if (!exception.IsEmpty()) { |
| 1524 InjectedScript* injectedScript = m_injectedScriptManager->injectedScript For(context); | 1524 InjectedScript* injectedScript = m_injectedScriptManager->injectedScript For(context); |
| 1525 if (injectedScript) { | 1525 if (injectedScript) { |
| 1526 m_breakReason = isPromiseRejection ? protocol::Debugger::Paused::Rea sonEnum::PromiseRejection : protocol::Debugger::Paused::ReasonEnum::Exception; | 1526 m_breakReason = isPromiseRejection ? protocol::Debugger::Paused::Rea sonEnum::PromiseRejection : protocol::Debugger::Paused::ReasonEnum::Exception; |
| 1527 ErrorString errorString; | 1527 ErrorString errorString; |
| 1528 auto obj = injectedScript->wrapObject(&errorString, exception, V8Deb uggerAgentImpl::backtraceObjectGroup); | 1528 auto obj = injectedScript->wrapObject(&errorString, exception, V8Deb uggerAgentImpl::backtraceObjectGroup); |
| 1529 m_breakAuxData = obj ? obj->serialize() : nullptr; | 1529 m_breakAuxData = obj ? obj->serialize() : nullptr; |
| 1530 // m_breakAuxData might be null after this. | 1530 // m_breakAuxData might be null after this. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1565 if (!m_continueToLocationBreakpointId.isEmpty()) { | 1565 if (!m_continueToLocationBreakpointId.isEmpty()) { |
| 1566 debugger().removeBreakpoint(m_continueToLocationBreakpointId); | 1566 debugger().removeBreakpoint(m_continueToLocationBreakpointId); |
| 1567 m_continueToLocationBreakpointId = ""; | 1567 m_continueToLocationBreakpointId = ""; |
| 1568 } | 1568 } |
| 1569 return result; | 1569 return result; |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 void V8DebuggerAgentImpl::didContinue() | 1572 void V8DebuggerAgentImpl::didContinue() |
| 1573 { | 1573 { |
| 1574 m_pausedContext.Reset(); | 1574 m_pausedContext.Reset(); |
| 1575 m_currentCallStack.clear(); | 1575 Vector<OwnPtr<JavaScriptCallFrame>> emptyCallFrames; |
| 1576 m_pausedCallFrames.swap(emptyCallFrames); | |
| 1576 clearBreakDetails(); | 1577 clearBreakDetails(); |
| 1577 m_frontend->resumed(); | 1578 m_frontend->resumed(); |
| 1578 } | 1579 } |
| 1579 | 1580 |
| 1580 bool V8DebuggerAgentImpl::canBreakProgram() | 1581 bool V8DebuggerAgentImpl::canBreakProgram() |
| 1581 { | 1582 { |
| 1582 return debugger().canBreakProgram(); | 1583 return debugger().canBreakProgram(); |
| 1583 } | 1584 } |
| 1584 | 1585 |
| 1585 void V8DebuggerAgentImpl::breakProgram(const String16& breakReason, PassOwnPtr<p rotocol::DictionaryValue> data) | 1586 void V8DebuggerAgentImpl::breakProgram(const String16& breakReason, PassOwnPtr<p rotocol::DictionaryValue> data) |
| 1586 { | 1587 { |
| 1587 ASSERT(enabled()); | 1588 ASSERT(enabled()); |
| 1588 if (m_skipAllPauses || !m_pausedContext.IsEmpty() || isCallStackEmptyOrBlack boxed() || !debugger().breakpointsActivated()) | 1589 if (m_skipAllPauses || !m_pausedContext.IsEmpty() || isCurrentCallStackEmpty OrBlackboxed() || !debugger().breakpointsActivated()) |
| 1589 return; | 1590 return; |
| 1590 m_breakReason = breakReason; | 1591 m_breakReason = breakReason; |
| 1591 m_breakAuxData = data; | 1592 m_breakAuxData = data; |
| 1592 m_scheduledDebuggerStep = NoStep; | 1593 m_scheduledDebuggerStep = NoStep; |
| 1593 m_steppingFromFramework = false; | 1594 m_steppingFromFramework = false; |
| 1594 m_pausingOnNativeEvent = false; | 1595 m_pausingOnNativeEvent = false; |
| 1595 clearStepIntoAsync(); | 1596 clearStepIntoAsync(); |
| 1596 debugger().breakProgram(); | 1597 debugger().breakProgram(); |
| 1597 } | 1598 } |
| 1598 | 1599 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1642 if (!enabled()) | 1643 if (!enabled()) |
| 1643 return; | 1644 return; |
| 1644 m_scheduledDebuggerStep = NoStep; | 1645 m_scheduledDebuggerStep = NoStep; |
| 1645 m_scripts.clear(); | 1646 m_scripts.clear(); |
| 1646 m_blackboxedPositions.clear(); | 1647 m_blackboxedPositions.clear(); |
| 1647 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1648 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1648 resetAsyncCallTracker(); | 1649 resetAsyncCallTracker(); |
| 1649 } | 1650 } |
| 1650 | 1651 |
| 1651 } // namespace blink | 1652 } // namespace blink |
| OLD | NEW |