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 11 matching lines...) Expand all Loading... |
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include "core/inspector/InspectorDebuggerAgent.h" | 31 #include "core/inspector/InspectorDebuggerAgent.h" |
32 #include "core/inspector/JavaScriptCallFrame.h" | |
33 | 32 |
| 33 #include "InspectorFrontend.h" |
| 34 #include "bindings/dart/DartScriptDebugServer.h" |
34 #include "bindings/v8/ScriptDebugServer.h" | 35 #include "bindings/v8/ScriptDebugServer.h" |
35 #include "bindings/v8/ScriptObject.h" | 36 #include "bindings/v8/ScriptObject.h" |
36 #include "bindings/v8/ScriptRegexp.h" | 37 #include "bindings/v8/ScriptRegexp.h" |
37 #include "bindings/v8/ScriptSourceCode.h" | 38 #include "bindings/v8/ScriptSourceCode.h" |
38 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
39 #include "core/fetch/Resource.h" | 40 #include "core/fetch/Resource.h" |
40 #include "core/inspector/ContentSearchUtils.h" | 41 #include "core/inspector/ContentSearchUtils.h" |
41 #include "core/inspector/InjectedScriptManager.h" | 42 #include "core/inspector/InjectedScriptManager.h" |
42 #include "core/inspector/InspectorPageAgent.h" | 43 #include "core/inspector/InspectorPageAgent.h" |
43 #include "core/inspector/InspectorState.h" | 44 #include "core/inspector/InspectorState.h" |
44 #include "core/inspector/InstrumentingAgents.h" | 45 #include "core/inspector/InstrumentingAgents.h" |
45 #include "core/inspector/ScriptArguments.h" | 46 #include "core/inspector/ScriptArguments.h" |
| 47 #include "core/inspector/ScriptCallFrame.h" |
46 #include "core/inspector/ScriptCallStack.h" | 48 #include "core/inspector/ScriptCallStack.h" |
47 #include "platform/JSONValues.h" | 49 #include "platform/JSONValues.h" |
48 #include "wtf/text/WTFString.h" | 50 #include "wtf/text/WTFString.h" |
49 | 51 |
50 using WebCore::TypeBuilder::Array; | 52 using WebCore::TypeBuilder::Array; |
51 using WebCore::TypeBuilder::Debugger::BreakpointId; | 53 using WebCore::TypeBuilder::Debugger::BreakpointId; |
52 using WebCore::TypeBuilder::Debugger::CallFrame; | 54 using WebCore::TypeBuilder::Debugger::CallFrame; |
53 using WebCore::TypeBuilder::Debugger::FunctionDetails; | 55 using WebCore::TypeBuilder::Debugger::FunctionDetails; |
54 using WebCore::TypeBuilder::Debugger::ScriptId; | 56 using WebCore::TypeBuilder::Debugger::ScriptId; |
55 using WebCore::TypeBuilder::Debugger::StackTrace; | 57 using WebCore::TypeBuilder::Debugger::StackTrace; |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 if (!parseLocation(errorString, location, &scriptId, &lineNumber, &columnNum
ber)) | 433 if (!parseLocation(errorString, location, &scriptId, &lineNumber, &columnNum
ber)) |
432 return; | 434 return; |
433 | 435 |
434 ScriptBreakpoint breakpoint(lineNumber, columnNumber, ""); | 436 ScriptBreakpoint breakpoint(lineNumber, columnNumber, ""); |
435 m_continueToLocationBreakpointId = scriptDebugServer().setBreakpoint(scriptI
d, breakpoint, &lineNumber, &columnNumber, interstateLocation); | 437 m_continueToLocationBreakpointId = scriptDebugServer().setBreakpoint(scriptI
d, breakpoint, &lineNumber, &columnNumber, interstateLocation); |
436 resume(errorString); | 438 resume(errorString); |
437 } | 439 } |
438 | 440 |
439 void InspectorDebuggerAgent::getStepInPositions(ErrorString* errorString, const
String& callFrameId, RefPtr<Array<TypeBuilder::Debugger::Location> >& positions) | 441 void InspectorDebuggerAgent::getStepInPositions(ErrorString* errorString, const
String& callFrameId, RefPtr<Array<TypeBuilder::Debugger::Location> >& positions) |
440 { | 442 { |
441 if (!isPaused() || m_currentCallStack.isEmpty()) { | 443 if (!isPaused() || m_currentCallStack.isNull()) { |
442 *errorString = "Attempt to access callframe when debugger is not on paus
e"; | 444 *errorString = "Attempt to access callframe when debugger is not on paus
e"; |
443 return; | 445 return; |
444 } | 446 } |
445 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(callFrameId); | 447 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptForO
bjectId(callFrameId); |
446 if (injectedScript.isEmpty()) { | 448 if (injectedScript.isEmpty()) { |
447 *errorString = "Inspected frame has gone"; | 449 *errorString = "Inspected frame has gone"; |
448 return; | 450 return; |
449 } | 451 } |
450 | 452 |
451 injectedScript.getStepInPositions(errorString, m_currentCallStack, callFrame
Id, positions); | 453 injectedScript.getStepInPositions(errorString, m_currentCallStack, callFrame
Id, positions); |
452 } | 454 } |
453 | 455 |
454 void InspectorDebuggerAgent::getBacktrace(ErrorString* errorString, RefPtr<Array
<CallFrame> >& callFrames, RefPtr<StackTrace>& asyncStackTrace) | 456 void InspectorDebuggerAgent::getBacktrace(ErrorString* errorString, RefPtr<Array
<CallFrame> >& callFrames, WTF::RefPtr<WebCore::TypeBuilder::Debugger::StackTrac
e>& asyncStackTrace) |
455 { | 457 { |
456 if (!assertPaused(errorString)) | 458 if (!assertPaused(errorString)) |
457 return; | 459 return; |
458 m_currentCallStack = scriptDebugServer().currentCallFrames(); | 460 m_currentCallStack = scriptDebugServer().currentCallFrames(); |
459 callFrames = currentCallFrames(); | 461 callFrames = currentCallFrames(); |
460 asyncStackTrace = currentAsyncStackTrace(); | 462 asyncStackTrace = currentAsyncStackTrace(); |
461 } | 463 } |
462 | 464 |
463 String InspectorDebuggerAgent::scriptURL(JavaScriptCallFrame* frame) | 465 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::shouldSkipExceptio
nPause(const ScriptCallFrame& topFrame) |
464 { | |
465 String scriptIdString = String::number(frame->sourceID()); | |
466 ScriptsMap::iterator it = m_scripts.find(scriptIdString); | |
467 if (it == m_scripts.end()) | |
468 return String(); | |
469 return it->value.url; | |
470 } | |
471 | |
472 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::shouldSkipExceptio
nPause(RefPtr<JavaScriptCallFrame>& topFrame) | |
473 { | 466 { |
474 if (m_skipAllPauses) | 467 if (m_skipAllPauses) |
475 return ScriptDebugListener::Continue; | 468 return ScriptDebugListener::Continue; |
476 if (!topFrame) | |
477 return ScriptDebugListener::NoSkip; | |
478 | 469 |
479 String topFrameScriptUrl = scriptURL(topFrame.get()); | 470 String topFrameScriptUrl = topFrame.sourceURL(); |
480 if (m_cachedSkipStackRegExp && !topFrameScriptUrl.isEmpty() && m_cachedSkipS
tackRegExp->match(topFrameScriptUrl) != -1) | 471 if (m_cachedSkipStackRegExp && !topFrameScriptUrl.isEmpty() && m_cachedSkipS
tackRegExp->match(topFrameScriptUrl) != -1) |
481 return ScriptDebugListener::Continue; | 472 return ScriptDebugListener::Continue; |
482 | 473 |
483 // Match against breakpoints. | 474 // Match against breakpoints. |
484 if (topFrameScriptUrl.isEmpty()) | 475 if (topFrameScriptUrl.isEmpty()) |
485 return ScriptDebugListener::NoSkip; | 476 return ScriptDebugListener::NoSkip; |
486 | 477 |
487 // Prepare top frame parameters. | 478 // Prepare top frame parameters. |
488 int topFrameLineNumber = topFrame->line(); | 479 int topFrameLineNumber = topFrame.lineNumber(); |
489 int topFrameColumnNumber = topFrame->column(); | 480 int topFrameColumnNumber = topFrame.columnNumber(); |
490 | 481 |
491 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState
::javaScriptBreakpoints); | 482 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState
::javaScriptBreakpoints); |
492 for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpoints
Cookie->end(); ++it) { | 483 for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpoints
Cookie->end(); ++it) { |
493 RefPtr<JSONObject> breakpointObject = it->value->asObject(); | 484 RefPtr<JSONObject> breakpointObject = it->value->asObject(); |
494 bool isAntibreakpoint; | 485 bool isAntibreakpoint; |
495 breakpointObject->getBoolean(DebuggerAgentState::isAnti, &isAntibreakpoi
nt); | 486 breakpointObject->getBoolean(DebuggerAgentState::isAnti, &isAntibreakpoi
nt); |
496 if (!isAntibreakpoint) | 487 if (!isAntibreakpoint) |
497 continue; | 488 continue; |
498 | 489 |
499 int breakLineNumber; | 490 int breakLineNumber; |
(...skipping 13 matching lines...) Expand all Loading... |
513 breakpointObject->getString(DebuggerAgentState::url, &url); | 504 breakpointObject->getString(DebuggerAgentState::url, &url); |
514 if (!matches(topFrameScriptUrl, url, isRegex)) | 505 if (!matches(topFrameScriptUrl, url, isRegex)) |
515 continue; | 506 continue; |
516 | 507 |
517 return ScriptDebugListener::Continue; | 508 return ScriptDebugListener::Continue; |
518 } | 509 } |
519 | 510 |
520 return ScriptDebugListener::NoSkip; | 511 return ScriptDebugListener::NoSkip; |
521 } | 512 } |
522 | 513 |
523 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::shouldSkipBreakpoi
ntPause(RefPtr<JavaScriptCallFrame>& topFrame) | 514 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::shouldSkipBreakpoi
ntPause(const ScriptCallFrame& topFrame) |
524 { | 515 { |
525 if (m_skipAllPauses) | 516 if (m_skipAllPauses) |
526 return ScriptDebugListener::Continue; | 517 return ScriptDebugListener::Continue; |
527 if (!topFrame) | |
528 return ScriptDebugListener::NoSkip; | |
529 return ScriptDebugListener::NoSkip; | 518 return ScriptDebugListener::NoSkip; |
530 } | 519 } |
531 | 520 |
532 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::shouldSkipStepPaus
e(RefPtr<JavaScriptCallFrame>& topFrame) | 521 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::shouldSkipStepPaus
e(const ScriptCallFrame& topFrame) |
533 { | 522 { |
534 if (m_skipAllPauses) | 523 if (m_skipAllPauses) |
535 return ScriptDebugListener::Continue; | 524 return ScriptDebugListener::Continue; |
536 if (!topFrame) | |
537 return ScriptDebugListener::NoSkip; | |
538 | 525 |
539 if (m_cachedSkipStackRegExp) { | 526 if (m_cachedSkipStackRegExp) { |
540 String scriptUrl = scriptURL(topFrame.get()); | 527 String scriptUrl = topFrame.sourceURL(); |
541 if (!scriptUrl.isEmpty() && m_cachedSkipStackRegExp->match(scriptUrl) !=
-1) { | 528 if (!scriptUrl.isEmpty() && m_cachedSkipStackRegExp->match(scriptUrl) !=
-1) { |
542 if (m_skipStepInCount > 0) { | 529 if (m_skipStepInCount > 0) { |
543 --m_skipStepInCount; | 530 --m_skipStepInCount; |
544 return ScriptDebugListener::StepInto; | 531 return ScriptDebugListener::StepInto; |
545 } | 532 } |
546 return ScriptDebugListener::StepOut; | 533 return ScriptDebugListener::StepOut; |
547 } | 534 } |
548 } | 535 } |
549 return ScriptDebugListener::NoSkip; | 536 return ScriptDebugListener::NoSkip; |
550 } | 537 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 bool isRegex = optionalIsRegex ? *optionalIsRegex : false; | 571 bool isRegex = optionalIsRegex ? *optionalIsRegex : false; |
585 bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false; | 572 bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false; |
586 | 573 |
587 ScriptsMap::iterator it = m_scripts.find(scriptId); | 574 ScriptsMap::iterator it = m_scripts.find(scriptId); |
588 if (it != m_scripts.end()) | 575 if (it != m_scripts.end()) |
589 results = ContentSearchUtils::searchInTextByLines(it->value.source, quer
y, caseSensitive, isRegex); | 576 results = ContentSearchUtils::searchInTextByLines(it->value.source, quer
y, caseSensitive, isRegex); |
590 else | 577 else |
591 *error = "No script for id: " + scriptId; | 578 *error = "No script for id: " + scriptId; |
592 } | 579 } |
593 | 580 |
594 void InspectorDebuggerAgent::setScriptSource(ErrorString* error, RefPtr<TypeBuil
der::Debugger::SetScriptSourceError>& errorData, const String& scriptId, const S
tring& newContent, const bool* const preview, RefPtr<Array<CallFrame> >& newCall
Frames, RefPtr<JSONObject>& result, RefPtr<StackTrace>& asyncStackTrace) | 581 void InspectorDebuggerAgent::setScriptSource(ErrorString* error, RefPtr<TypeBuil
der::Debugger::SetScriptSourceError>& errorData, const String& scriptId, const S
tring& newContent, const bool* const preview, RefPtr<Array<CallFrame> >& newCall
Frames, RefPtr<JSONObject>& result, WTF::RefPtr<WebCore::TypeBuilder::Debugger::
StackTrace>& asyncStackTrace) |
595 { | 582 { |
596 bool previewOnly = preview && *preview; | 583 bool previewOnly = preview && *preview; |
597 if (!scriptDebugServer().setScriptSource(scriptId, newContent, previewOnly,
error, errorData, &m_currentCallStack, &result)) | 584 if (!scriptDebugServer().setScriptSource(scriptId, newContent, previewOnly,
error, errorData, &m_currentCallStack, result)) |
598 return; | 585 return; |
599 newCallFrames = currentCallFrames(); | 586 newCallFrames = currentCallFrames(); |
600 asyncStackTrace = currentAsyncStackTrace(); | 587 asyncStackTrace = currentAsyncStackTrace(); |
601 } | 588 } |
602 | 589 |
603 void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String
& callFrameId, RefPtr<Array<CallFrame> >& newCallFrames, RefPtr<JSONObject>& res
ult, RefPtr<StackTrace>& asyncStackTrace) | 590 void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String
& callFrameId, RefPtr<Array<CallFrame> >& newCallFrames, RefPtr<JSONObject>& res
ult, WTF::RefPtr<WebCore::TypeBuilder::Debugger::StackTrace>& asyncStackTrace) |
604 { | 591 { |
605 if (!isPaused() || m_currentCallStack.isEmpty()) { | 592 if (!isPaused() || m_currentCallStack.isNull()) { |
606 *errorString = "Attempt to access callframe when debugger is not on paus
e"; | 593 *errorString = "Attempt to access callframe when debugger is not on paus
e"; |
607 return; | 594 return; |
608 } | 595 } |
609 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(callFrameId); | 596 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptForO
bjectId(callFrameId); |
610 if (injectedScript.isEmpty()) { | 597 if (injectedScript.isEmpty()) { |
611 *errorString = "Inspected frame has gone"; | 598 *errorString = "Inspected frame has gone"; |
612 return; | 599 return; |
613 } | 600 } |
614 | 601 |
615 injectedScript.restartFrame(errorString, m_currentCallStack, callFrameId, &r
esult); | 602 injectedScript.restartFrame(errorString, m_currentCallStack, callFrameId, &r
esult); |
616 m_currentCallStack = scriptDebugServer().currentCallFrames(); | 603 m_currentCallStack = scriptDebugServer().currentCallFrames(); |
617 newCallFrames = currentCallFrames(); | 604 newCallFrames = currentCallFrames(); |
618 asyncStackTrace = currentAsyncStackTrace(); | 605 asyncStackTrace = currentAsyncStackTrace(); |
619 } | 606 } |
620 | 607 |
621 void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& s
criptId, String* scriptSource) | 608 void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& s
criptId, String* scriptSource) |
622 { | 609 { |
623 ScriptsMap::iterator it = m_scripts.find(scriptId); | 610 ScriptsMap::iterator it = m_scripts.find(scriptId); |
624 if (it != m_scripts.end()) | 611 if (it != m_scripts.end()) |
625 *scriptSource = it->value.source; | 612 *scriptSource = it->value.source; |
626 else | 613 else |
627 *error = "No script for id: " + scriptId; | 614 *error = "No script for id: " + scriptId; |
628 } | 615 } |
629 | 616 |
630 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const
String& functionId, RefPtr<FunctionDetails>& details) | 617 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const
String& functionId, RefPtr<FunctionDetails>& details) |
631 { | 618 { |
632 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(functionId); | 619 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptForO
bjectId(functionId); |
633 if (injectedScript.isEmpty()) { | 620 if (injectedScript.isEmpty()) { |
634 *errorString = "Function object id is obsolete"; | 621 *errorString = "Function object id is obsolete"; |
635 return; | 622 return; |
636 } | 623 } |
637 injectedScript.getFunctionDetails(errorString, functionId, &details); | 624 injectedScript.getFunctionDetails(errorString, functionId, &details); |
638 } | 625 } |
639 | 626 |
640 void InspectorDebuggerAgent::schedulePauseOnNextStatement(InspectorFrontend::Deb
ugger::Reason::Enum breakReason, PassRefPtr<JSONObject> data) | 627 void InspectorDebuggerAgent::schedulePauseOnNextStatement(InspectorFrontend::Deb
ugger::Reason::Enum breakReason, PassRefPtr<JSONObject> data) |
641 { | 628 { |
642 if (m_javaScriptPauseScheduled) | 629 if (m_javaScriptPauseScheduled) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 } | 804 } |
818 | 805 |
819 void InspectorDebuggerAgent::resume(ErrorString* errorString) | 806 void InspectorDebuggerAgent::resume(ErrorString* errorString) |
820 { | 807 { |
821 if (!assertPaused(errorString)) | 808 if (!assertPaused(errorString)) |
822 return; | 809 return; |
823 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); | 810 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); |
824 scriptDebugServer().continueProgram(); | 811 scriptDebugServer().continueProgram(); |
825 } | 812 } |
826 | 813 |
827 ScriptValue InspectorDebuggerAgent::resolveCallFrame(ErrorString* errorString, c
onst String* callFrameId) | 814 ActivationFrame InspectorDebuggerAgent::resolveCallFrame(ErrorString* errorStrin
g, const String* callFrameId) |
828 { | 815 { |
829 if (!callFrameId) | 816 if (!callFrameId) |
830 return ScriptValue(); | 817 return ActivationFrame(); |
831 if (!isPaused() || m_currentCallStack.isEmpty()) { | 818 if (!isPaused() || m_currentCallStack.isNull()) { |
832 *errorString = "Attempt to access callframe when debugger is not on paus
e"; | 819 *errorString = "Attempt to access callframe when debugger is not on paus
e"; |
833 return ScriptValue(); | 820 return ActivationFrame(); |
834 } | 821 } |
835 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(*callFrameId); | 822 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptForO
bjectId(*callFrameId); |
836 if (injectedScript.isEmpty()) { | 823 if (injectedScript.isEmpty()) { |
837 *errorString = "Inspected frame has gone"; | 824 *errorString = "Inspected frame has gone"; |
838 return ScriptValue(); | 825 return ActivationFrame(); |
839 } | 826 } |
840 return injectedScript.findCallFrameById(errorString, m_currentCallStack, *ca
llFrameId); | 827 return injectedScript.findCallFrameById(errorString, m_currentCallStack, *ca
llFrameId); |
841 } | 828 } |
842 | 829 |
843 void InspectorDebuggerAgent::stepOver(ErrorString* errorString, const String* ca
llFrameId) | 830 void InspectorDebuggerAgent::stepOver(ErrorString* errorString, const String* ca
llFrameId) |
844 { | 831 { |
845 if (!assertPaused(errorString)) | 832 if (!assertPaused(errorString)) |
846 return; | 833 return; |
847 ScriptValue frame = resolveCallFrame(errorString, callFrameId); | 834 ActivationFrame frame = resolveCallFrame(errorString, callFrameId); |
848 if (!errorString->isEmpty()) | 835 if (!errorString->isEmpty()) |
849 return; | 836 return; |
850 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); | 837 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); |
851 scriptDebugServer().stepOverStatement(frame); | 838 scriptDebugServer().stepOverStatement(frame); |
852 } | 839 } |
853 | 840 |
854 void InspectorDebuggerAgent::stepInto(ErrorString* errorString) | 841 void InspectorDebuggerAgent::stepInto(ErrorString* errorString) |
855 { | 842 { |
856 if (!assertPaused(errorString)) | 843 if (!assertPaused(errorString)) |
857 return; | 844 return; |
858 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); | 845 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); |
859 scriptDebugServer().stepIntoStatement(); | 846 scriptDebugServer().stepIntoStatement(); |
860 if (m_listener) | 847 if (m_listener) |
861 m_listener->stepInto(); | 848 m_listener->stepInto(); |
862 } | 849 } |
863 | 850 |
864 void InspectorDebuggerAgent::stepOut(ErrorString* errorString, const String* cal
lFrameId) | 851 void InspectorDebuggerAgent::stepOut(ErrorString* errorString, const String* cal
lFrameId) |
865 { | 852 { |
866 if (!assertPaused(errorString)) | 853 if (!assertPaused(errorString)) |
867 return; | 854 return; |
868 ScriptValue frame = resolveCallFrame(errorString, callFrameId); | 855 ActivationFrame frame = resolveCallFrame(errorString, callFrameId); |
869 if (!errorString->isEmpty()) | 856 if (!errorString->isEmpty()) |
870 return; | 857 return; |
871 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); | 858 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); |
872 scriptDebugServer().stepOutOfFunction(frame); | 859 scriptDebugServer().stepOutOfFunction(frame); |
873 } | 860 } |
874 | 861 |
875 void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, cons
t String& stringPauseState) | 862 void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, cons
t String& stringPauseState) |
876 { | 863 { |
877 ScriptDebugServer::PauseOnExceptionsState pauseState; | 864 ScriptDebugServer::PauseOnExceptionsState pauseState; |
878 if (stringPauseState == "none") | 865 if (stringPauseState == "none") |
(...skipping 11 matching lines...) Expand all Loading... |
890 | 877 |
891 void InspectorDebuggerAgent::setPauseOnExceptionsImpl(ErrorString* errorString,
int pauseState) | 878 void InspectorDebuggerAgent::setPauseOnExceptionsImpl(ErrorString* errorString,
int pauseState) |
892 { | 879 { |
893 scriptDebugServer().setPauseOnExceptionsState(static_cast<ScriptDebugServer:
:PauseOnExceptionsState>(pauseState)); | 880 scriptDebugServer().setPauseOnExceptionsState(static_cast<ScriptDebugServer:
:PauseOnExceptionsState>(pauseState)); |
894 if (scriptDebugServer().pauseOnExceptionsState() != pauseState) | 881 if (scriptDebugServer().pauseOnExceptionsState() != pauseState) |
895 *errorString = "Internal error. Could not change pause on exceptions sta
te"; | 882 *errorString = "Internal error. Could not change pause on exceptions sta
te"; |
896 else | 883 else |
897 m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, pauseState)
; | 884 m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, pauseState)
; |
898 } | 885 } |
899 | 886 |
| 887 void InspectorDebuggerAgent::collectAsyncCallStacks(Vector<StackTrace>& asyncCal
lStacks) |
| 888 { |
| 889 const AsyncCallStackTracker::AsyncCallChain* asyncChain = m_asyncCallStackTr
acker.isEnabled() ? m_asyncCallStackTracker.currentAsyncCallChain() : 0; |
| 890 if (asyncChain) { |
| 891 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = asyncCha
in->callStacks(); |
| 892 asyncCallStacks.resize(callStacks.size()); |
| 893 AsyncCallStackTracker::AsyncCallStackVector::const_iterator it = callSta
cks.begin(); |
| 894 for (size_t i = 0; it != callStacks.end(); ++it, ++i) |
| 895 asyncCallStacks[i] = (*it)->callFrames(); |
| 896 } |
| 897 } |
| 898 |
900 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const
String& callFrameId, const String& expression, const String* const objectGroup,
const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptio
nsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview,
RefPtr<RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown) | 899 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const
String& callFrameId, const String& expression, const String* const objectGroup,
const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptio
nsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview,
RefPtr<RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown) |
901 { | 900 { |
902 if (!isPaused() || m_currentCallStack.isEmpty()) { | 901 if (!isPaused() || m_currentCallStack.isNull()) { |
903 *errorString = "Attempt to access callframe when debugger is not on paus
e"; | 902 *errorString = "Attempt to access callframe when debugger is not on paus
e"; |
904 return; | 903 return; |
905 } | 904 } |
906 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(callFrameId); | 905 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptForO
bjectId(callFrameId); |
907 if (injectedScript.isEmpty()) { | 906 if (injectedScript.isEmpty()) { |
908 *errorString = "Inspected frame has gone"; | 907 *errorString = "Inspected frame has gone"; |
909 return; | 908 return; |
910 } | 909 } |
911 | 910 |
912 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); | 911 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); |
913 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { | 912 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { |
914 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce
ptions) | 913 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce
ptions) |
915 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don
tPauseOnExceptions); | 914 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don
tPauseOnExceptions); |
916 muteConsole(); | 915 muteConsole(); |
917 } | 916 } |
918 | 917 |
919 Vector<ScriptValue> asyncCallStacks; | 918 Vector<StackTrace> asyncCallStacks; |
920 const AsyncCallStackTracker::AsyncCallChain* asyncChain = m_asyncCallStackTr
acker.isEnabled() ? m_asyncCallStackTracker.currentAsyncCallChain() : 0; | 919 collectAsyncCallStacks(asyncCallStacks); |
921 if (asyncChain) { | |
922 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = asyncCha
in->callStacks(); | |
923 asyncCallStacks.resize(callStacks.size()); | |
924 AsyncCallStackTracker::AsyncCallStackVector::const_iterator it = callSta
cks.begin(); | |
925 for (size_t i = 0; it != callStacks.end(); ++it, ++i) | |
926 asyncCallStacks[i] = (*it)->callFrames(); | |
927 } | |
928 | |
929 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCal
lStacks, callFrameId, expression, objectGroup ? *objectGroup : "", includeComman
dLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : fals
e, generatePreview ? *generatePreview : false, &result, wasThrown); | 920 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCal
lStacks, callFrameId, expression, objectGroup ? *objectGroup : "", includeComman
dLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : fals
e, generatePreview ? *generatePreview : false, &result, wasThrown); |
930 | 921 |
931 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { | 922 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { |
932 unmuteConsole(); | 923 unmuteConsole(); |
933 if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExcep
tionsState) | 924 if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExcep
tionsState) |
934 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExcepti
onsState); | 925 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExcepti
onsState); |
935 } | 926 } |
936 } | 927 } |
937 | 928 |
| 929 void InspectorDebuggerAgent::getCompletionsOnCallFrame(ErrorString* errorString,
const String& callFrameId, const String& expression, RefPtr<TypeBuilder::Array<
String> >& result) |
| 930 { |
| 931 if (!isPaused() || m_currentCallStack.isNull()) { |
| 932 *errorString = "Attempt to access callframe when debugger is not on paus
e"; |
| 933 return; |
| 934 } |
| 935 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptForO
bjectId(callFrameId); |
| 936 if (injectedScript.isEmpty()) { |
| 937 *errorString = "Inspected frame has gone"; |
| 938 return; |
| 939 } |
| 940 |
| 941 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); |
| 942 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExceptio
ns) |
| 943 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::DontPau
seOnExceptions); |
| 944 muteConsole(); |
| 945 |
| 946 Vector<StackTrace> asyncCallStacks; |
| 947 collectAsyncCallStacks(asyncCallStacks); |
| 948 injectedScript.getCompletionsOnCallFrame(errorString, m_currentCallStack, as
yncCallStacks, callFrameId, expression, &result); |
| 949 |
| 950 unmuteConsole(); |
| 951 if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnException
sState) |
| 952 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExceptionsS
tate); |
| 953 } |
| 954 |
938 void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
g& expression, const String& sourceURL, const int* executionContextId, TypeBuild
er::OptOutput<ScriptId>* scriptId, TypeBuilder::OptOutput<String>* syntaxErrorMe
ssage) | 955 void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
g& expression, const String& sourceURL, const int* executionContextId, TypeBuild
er::OptOutput<ScriptId>* scriptId, TypeBuilder::OptOutput<String>* syntaxErrorMe
ssage) |
939 { | 956 { |
940 InjectedScript injectedScript = injectedScriptForEval(errorString, execution
ContextId); | 957 InjectedScript& injectedScript = injectedScriptForEval(errorString, executio
nContextId); |
941 if (injectedScript.isEmpty()) { | 958 if (injectedScript.isEmpty()) { |
942 *errorString = "Inspected frame has gone"; | 959 *errorString = "Inspected frame has gone"; |
943 return; | 960 return; |
944 } | 961 } |
945 | 962 |
946 String scriptIdValue; | 963 String scriptIdValue; |
947 String exceptionMessage; | 964 String exceptionMessage; |
948 scriptDebugServer().compileScript(injectedScript.scriptState(), expression,
sourceURL, &scriptIdValue, &exceptionMessage); | 965 scriptDebugServer().compileScript(injectedScript.scriptState(), expression,
sourceURL, &scriptIdValue, &exceptionMessage); |
949 if (!scriptIdValue && !exceptionMessage) { | 966 if (!scriptIdValue && !exceptionMessage) { |
950 *errorString = "Script compilation failed"; | 967 *errorString = "Script compilation failed"; |
951 return; | 968 return; |
952 } | 969 } |
953 *syntaxErrorMessage = exceptionMessage; | 970 *syntaxErrorMessage = exceptionMessage; |
954 *scriptId = scriptIdValue; | 971 *scriptId = scriptIdValue; |
955 } | 972 } |
956 | 973 |
957 void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId&
scriptId, const int* executionContextId, const String* const objectGroup, const
bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result,
TypeBuilder::OptOutput<bool>* wasThrown) | 974 void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId&
scriptId, const int* executionContextId, const String* const objectGroup, const
bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result,
TypeBuilder::OptOutput<bool>* wasThrown) |
958 { | 975 { |
959 InjectedScript injectedScript = injectedScriptForEval(errorString, execution
ContextId); | 976 InjectedScript& injectedScript = injectedScriptForEval(errorString, executio
nContextId); |
960 if (injectedScript.isEmpty()) { | 977 if (injectedScript.isEmpty()) { |
961 *errorString = "Inspected frame has gone"; | 978 *errorString = "Inspected frame has gone"; |
962 return; | 979 return; |
963 } | 980 } |
964 | 981 |
965 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); | 982 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); |
966 if (doNotPauseOnExceptionsAndMuteConsole && *doNotPauseOnExceptionsAndMuteCo
nsole) { | 983 if (doNotPauseOnExceptionsAndMuteConsole && *doNotPauseOnExceptionsAndMuteCo
nsole) { |
967 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce
ptions) | 984 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce
ptions) |
968 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don
tPauseOnExceptions); | 985 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don
tPauseOnExceptions); |
969 muteConsole(); | 986 muteConsole(); |
(...skipping 18 matching lines...) Expand all Loading... |
988 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExcepti
onsState); | 1005 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExcepti
onsState); |
989 } | 1006 } |
990 } | 1007 } |
991 | 1008 |
992 void InspectorDebuggerAgent::setOverlayMessage(ErrorString*, const String*) | 1009 void InspectorDebuggerAgent::setOverlayMessage(ErrorString*, const String*) |
993 { | 1010 { |
994 } | 1011 } |
995 | 1012 |
996 void InspectorDebuggerAgent::setVariableValue(ErrorString* errorString, int scop
eNumber, const String& variableName, const RefPtr<JSONObject>& newValue, const S
tring* callFrameId, const String* functionObjectId) | 1013 void InspectorDebuggerAgent::setVariableValue(ErrorString* errorString, int scop
eNumber, const String& variableName, const RefPtr<JSONObject>& newValue, const S
tring* callFrameId, const String* functionObjectId) |
997 { | 1014 { |
998 InjectedScript injectedScript; | 1015 InjectedScript* injectedScript = 0; |
999 if (callFrameId) { | 1016 if (callFrameId) { |
1000 if (!isPaused() || m_currentCallStack.isEmpty()) { | 1017 if (!isPaused() || m_currentCallStack.isNull()) { |
1001 *errorString = "Attempt to access callframe when debugger is not on
pause"; | 1018 *errorString = "Attempt to access callframe when debugger is not on
pause"; |
1002 return; | 1019 return; |
1003 } | 1020 } |
1004 injectedScript = m_injectedScriptManager->injectedScriptForObjectId(*cal
lFrameId); | 1021 injectedScript = &m_injectedScriptManager->injectedScriptForObjectId(*ca
llFrameId); |
1005 if (injectedScript.isEmpty()) { | 1022 if (injectedScript->isEmpty()) { |
1006 *errorString = "Inspected frame has gone"; | 1023 *errorString = "Inspected frame has gone"; |
1007 return; | 1024 return; |
1008 } | 1025 } |
1009 } else if (functionObjectId) { | 1026 } else if (functionObjectId) { |
1010 injectedScript = m_injectedScriptManager->injectedScriptForObjectId(*fun
ctionObjectId); | 1027 injectedScript = &m_injectedScriptManager->injectedScriptForObjectId(*fu
nctionObjectId); |
1011 if (injectedScript.isEmpty()) { | 1028 if (injectedScript->isEmpty()) { |
1012 *errorString = "Function object id cannot be resolved"; | 1029 *errorString = "Function object id cannot be resolved"; |
1013 return; | 1030 return; |
1014 } | 1031 } |
1015 } else { | 1032 } else { |
1016 *errorString = "Either call frame or function object must be specified"; | 1033 *errorString = "Either call frame or function object must be specified"; |
1017 return; | 1034 return; |
1018 } | 1035 } |
1019 String newValueString = newValue->toJSONString(); | 1036 String newValueString = newValue->toJSONString(); |
1020 | 1037 ASSERT(injectedScript); |
1021 injectedScript.setVariableValue(errorString, m_currentCallStack, callFrameId
, functionObjectId, scopeNumber, variableName, newValueString); | 1038 injectedScript->setVariableValue(errorString, m_currentCallStack, callFrameI
d, functionObjectId, scopeNumber, variableName, newValueString); |
1022 } | 1039 } |
1023 | 1040 |
1024 void InspectorDebuggerAgent::skipStackFrames(ErrorString* errorString, const Str
ing* pattern) | 1041 void InspectorDebuggerAgent::skipStackFrames(ErrorString* errorString, const Str
ing* pattern) |
1025 { | 1042 { |
1026 OwnPtr<ScriptRegexp> compiled; | 1043 OwnPtr<ScriptRegexp> compiled; |
1027 String patternValue = pattern ? *pattern : ""; | 1044 String patternValue = pattern ? *pattern : ""; |
1028 if (!patternValue.isEmpty()) { | 1045 if (!patternValue.isEmpty()) { |
1029 compiled = compileSkipCallFramePattern(patternValue); | 1046 compiled = compileSkipCallFramePattern(patternValue); |
1030 if (!compiled) { | 1047 if (!compiled) { |
1031 *errorString = "Invalid regular expression"; | 1048 *errorString = "Invalid regular expression"; |
(...skipping 14 matching lines...) Expand all Loading... |
1046 { | 1063 { |
1047 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP
auseOnExceptions) { | 1064 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP
auseOnExceptions) { |
1048 RefPtr<JSONObject> directive = JSONObject::create(); | 1065 RefPtr<JSONObject> directive = JSONObject::create(); |
1049 directive->setString("directiveText", directiveText); | 1066 directive->setString("directiveText", directiveText); |
1050 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv
e.release()); | 1067 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv
e.release()); |
1051 } | 1068 } |
1052 } | 1069 } |
1053 | 1070 |
1054 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() | 1071 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() |
1055 { | 1072 { |
1056 if (!m_pausedScriptState || m_currentCallStack.isEmpty()) | 1073 if (!m_pausedScriptState || m_currentCallStack.isNull()) |
1057 return Array<CallFrame>::create(); | 1074 return Array<TypeBuilder::Debugger::CallFrame>::create(); |
1058 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState.get()); | 1075 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptFor(
m_pausedScriptState.get()); |
1059 if (injectedScript.isEmpty()) { | 1076 if (injectedScript.isEmpty()) { |
1060 ASSERT_NOT_REACHED(); | 1077 ASSERT_NOT_REACHED(); |
1061 return Array<CallFrame>::create(); | 1078 return Array<CallFrame>::create(); |
1062 } | 1079 } |
1063 return injectedScript.wrapCallFrames(m_currentCallStack, 0); | 1080 return injectedScript.wrapCallFrames(m_currentCallStack, 0); |
1064 } | 1081 } |
1065 | 1082 |
1066 PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace() | 1083 PassRefPtr<WebCore::TypeBuilder::Debugger::StackTrace> InspectorDebuggerAgent::c
urrentAsyncStackTrace() |
1067 { | 1084 { |
1068 if (!m_pausedScriptState || !m_asyncCallStackTracker.isEnabled()) | 1085 if (!m_pausedScriptState || !m_asyncCallStackTracker.isEnabled()) |
1069 return nullptr; | 1086 return nullptr; |
1070 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState.get()); | 1087 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptFor(
m_pausedScriptState.get()); |
1071 if (injectedScript.isEmpty()) { | 1088 if (injectedScript.isEmpty()) { |
1072 ASSERT_NOT_REACHED(); | 1089 ASSERT_NOT_REACHED(); |
1073 return nullptr; | 1090 return nullptr; |
1074 } | 1091 } |
1075 const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker
.currentAsyncCallChain(); | 1092 const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker
.currentAsyncCallChain(); |
1076 if (!chain) | 1093 if (!chain) |
1077 return nullptr; | 1094 return nullptr; |
1078 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); | 1095 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); |
1079 if (callStacks.isEmpty()) | 1096 if (callStacks.isEmpty()) |
1080 return nullptr; | 1097 return nullptr; |
1081 RefPtr<StackTrace> result; | 1098 RefPtr<WebCore::TypeBuilder::Debugger::StackTrace> result; |
1082 int asyncOrdinal = callStacks.size(); | 1099 int asyncOrdinal = callStacks.size(); |
1083 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it) { | 1100 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it) { |
1084 RefPtr<StackTrace> next = StackTrace::create() | 1101 RefPtr<WebCore::TypeBuilder::Debugger::StackTrace> next = WebCore::TypeB
uilder::Debugger::StackTrace::create() |
1085 .setCallFrames(injectedScript.wrapCallFrames((*it)->callFrames(), as
yncOrdinal--)) | 1102 .setCallFrames(injectedScript.wrapCallFrames((*it)->callFrames(), as
yncOrdinal--)) |
1086 .release(); | 1103 .release(); |
1087 next->setDescription((*it)->description()); | 1104 next->setDescription((*it)->description()); |
1088 if (result) | 1105 if (result) |
1089 next->setAsyncStackTrace(result.release()); | 1106 next->setAsyncStackTrace(result.release()); |
1090 result.swap(next); | 1107 result.swap(next); |
1091 } | 1108 } |
1092 return result.release(); | 1109 return result.release(); |
1093 } | 1110 } |
1094 | 1111 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 if (location) | 1174 if (location) |
1158 m_frontend->breakpointResolved(it->key, location); | 1175 m_frontend->breakpointResolved(it->key, location); |
1159 } | 1176 } |
1160 } | 1177 } |
1161 | 1178 |
1162 void InspectorDebuggerAgent::failedToParseSource(const String& url, const String
& data, int firstLine, int errorLine, const String& errorMessage) | 1179 void InspectorDebuggerAgent::failedToParseSource(const String& url, const String
& data, int firstLine, int errorLine, const String& errorMessage) |
1163 { | 1180 { |
1164 m_frontend->scriptFailedToParse(url, data, firstLine, errorLine, errorMessag
e); | 1181 m_frontend->scriptFailedToParse(url, data, firstLine, errorLine, errorMessag
e); |
1165 } | 1182 } |
1166 | 1183 |
1167 void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValu
e& callFrames, const ScriptValue& exception, const Vector<String>& hitBreakpoint
s) | 1184 void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const StackTrace
& callFrames, const ScriptValue& exception, const Vector<String>& hitBreakpoints
) |
1168 { | 1185 { |
1169 ASSERT(scriptState && !m_pausedScriptState); | 1186 ASSERT(scriptState && !m_pausedScriptState); |
1170 m_pausedScriptState = scriptState; | 1187 m_pausedScriptState = scriptState; |
1171 m_currentCallStack = callFrames; | 1188 m_currentCallStack = callFrames; |
1172 | 1189 |
1173 m_skipStepInCount = numberOfStepsBeforeStepOut; | 1190 m_skipStepInCount = numberOfStepsBeforeStepOut; |
1174 | 1191 |
1175 if (!exception.isEmpty()) { | 1192 if (!exception.isEmpty()) { |
1176 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF
or(scriptState); | 1193 InjectedScript& injectedScript = m_injectedScriptManager->injectedScript
For(scriptState); |
1177 if (!injectedScript.isEmpty()) { | 1194 if (!injectedScript.isEmpty()) { |
1178 m_breakReason = InspectorFrontend::Debugger::Reason::Exception; | 1195 m_breakReason = InspectorFrontend::Debugger::Reason::Exception; |
1179 m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebug
gerAgent::backtraceObjectGroup)->openAccessors(); | 1196 m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebug
gerAgent::backtraceObjectGroup)->openAccessors(); |
1180 // m_breakAuxData might be null after this. | 1197 // m_breakAuxData might be null after this. |
1181 } | 1198 } |
1182 } | 1199 } |
1183 | 1200 |
1184 RefPtr<Array<String> > hitBreakpointIds = Array<String>::create(); | 1201 RefPtr<Array<String> > hitBreakpointIds = Array<String>::create(); |
1185 | 1202 |
1186 for (Vector<String>::const_iterator i = hitBreakpoints.begin(); i != hitBrea
kpoints.end(); ++i) { | 1203 for (Vector<String>::const_iterator i = hitBreakpoints.begin(); i != hitBrea
kpoints.end(); ++i) { |
(...skipping 15 matching lines...) Expand all Loading... |
1202 scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); | 1219 scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); |
1203 m_continueToLocationBreakpointId = ""; | 1220 m_continueToLocationBreakpointId = ""; |
1204 } | 1221 } |
1205 if (m_listener) | 1222 if (m_listener) |
1206 m_listener->didPause(); | 1223 m_listener->didPause(); |
1207 } | 1224 } |
1208 | 1225 |
1209 void InspectorDebuggerAgent::didContinue() | 1226 void InspectorDebuggerAgent::didContinue() |
1210 { | 1227 { |
1211 m_pausedScriptState = nullptr; | 1228 m_pausedScriptState = nullptr; |
1212 m_currentCallStack = ScriptValue(); | 1229 m_currentCallStack = StackTrace(); |
1213 clearBreakDetails(); | 1230 clearBreakDetails(); |
1214 m_frontend->resumed(); | 1231 m_frontend->resumed(); |
1215 } | 1232 } |
1216 | 1233 |
1217 bool InspectorDebuggerAgent::canBreakProgram() | 1234 bool InspectorDebuggerAgent::canBreakProgram() |
1218 { | 1235 { |
1219 return scriptDebugServer().canBreakProgram(); | 1236 return scriptDebugServer().canBreakProgram(); |
1220 } | 1237 } |
1221 | 1238 |
1222 void InspectorDebuggerAgent::breakProgram(InspectorFrontend::Debugger::Reason::E
num breakReason, PassRefPtr<JSONObject> data) | 1239 void InspectorDebuggerAgent::breakProgram(InspectorFrontend::Debugger::Reason::E
num breakReason, PassRefPtr<JSONObject> data) |
1223 { | 1240 { |
1224 if (m_skipAllPauses) | 1241 if (m_skipAllPauses) |
1225 return; | 1242 return; |
1226 m_breakReason = breakReason; | 1243 m_breakReason = breakReason; |
1227 m_breakAuxData = data; | 1244 m_breakAuxData = data; |
1228 scriptDebugServer().breakProgram(); | 1245 scriptDebugServer().breakProgram(); |
1229 } | 1246 } |
1230 | 1247 |
1231 void InspectorDebuggerAgent::clear() | 1248 void InspectorDebuggerAgent::clear() |
1232 { | 1249 { |
1233 m_pausedScriptState = nullptr; | 1250 m_pausedScriptState = nullptr; |
1234 m_currentCallStack = ScriptValue(); | 1251 m_currentCallStack = StackTrace(); |
1235 m_scripts.clear(); | 1252 m_scripts.clear(); |
1236 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1253 m_breakpointIdToDebugServerBreakpointIds.clear(); |
1237 m_asyncCallStackTracker.clear(); | 1254 m_asyncCallStackTracker.clear(); |
1238 m_promiseTracker.clear(); | 1255 m_promiseTracker.clear(); |
1239 m_continueToLocationBreakpointId = String(); | 1256 m_continueToLocationBreakpointId = String(); |
1240 clearBreakDetails(); | 1257 clearBreakDetails(); |
1241 m_javaScriptPauseScheduled = false; | 1258 m_javaScriptPauseScheduled = false; |
1242 ErrorString error; | 1259 ErrorString error; |
1243 setOverlayMessage(&error, 0); | 1260 setOverlayMessage(&error, 0); |
1244 } | 1261 } |
(...skipping 30 matching lines...) Expand all Loading... |
1275 m_scripts.clear(); | 1292 m_scripts.clear(); |
1276 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1293 m_breakpointIdToDebugServerBreakpointIds.clear(); |
1277 m_asyncCallStackTracker.clear(); | 1294 m_asyncCallStackTracker.clear(); |
1278 m_promiseTracker.clear(); | 1295 m_promiseTracker.clear(); |
1279 if (m_frontend) | 1296 if (m_frontend) |
1280 m_frontend->globalObjectCleared(); | 1297 m_frontend->globalObjectCleared(); |
1281 } | 1298 } |
1282 | 1299 |
1283 } // namespace WebCore | 1300 } // namespace WebCore |
1284 | 1301 |
OLD | NEW |