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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 | 921 |
922 void InspectorDebuggerAgent::setPauseOnExceptionsImpl(ErrorString* errorString,
int pauseState) | 922 void InspectorDebuggerAgent::setPauseOnExceptionsImpl(ErrorString* errorString,
int pauseState) |
923 { | 923 { |
924 scriptDebugServer().setPauseOnExceptionsState(static_cast<ScriptDebugServer:
:PauseOnExceptionsState>(pauseState)); | 924 scriptDebugServer().setPauseOnExceptionsState(static_cast<ScriptDebugServer:
:PauseOnExceptionsState>(pauseState)); |
925 if (scriptDebugServer().pauseOnExceptionsState() != pauseState) | 925 if (scriptDebugServer().pauseOnExceptionsState() != pauseState) |
926 *errorString = "Internal error. Could not change pause on exceptions sta
te"; | 926 *errorString = "Internal error. Could not change pause on exceptions sta
te"; |
927 else | 927 else |
928 m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, pauseState)
; | 928 m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, pauseState)
; |
929 } | 929 } |
930 | 930 |
931 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) | 931 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, RefPtr<Ty
peBuilder::Debugger::ExceptionDetails>& exceptionDetails) |
932 { | 932 { |
933 if (!isPaused() || m_currentCallStack.isEmpty()) { | 933 if (!isPaused() || m_currentCallStack.isEmpty()) { |
934 *errorString = "Attempt to access callframe when debugger is not on paus
e"; | 934 *errorString = "Attempt to access callframe when debugger is not on paus
e"; |
935 return; | 935 return; |
936 } | 936 } |
937 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(callFrameId); | 937 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(callFrameId); |
938 if (injectedScript.isEmpty()) { | 938 if (injectedScript.isEmpty()) { |
939 *errorString = "Inspected frame has gone"; | 939 *errorString = "Inspected frame has gone"; |
940 return; | 940 return; |
941 } | 941 } |
942 | 942 |
943 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); | 943 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); |
944 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { | 944 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { |
945 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce
ptions) | 945 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce
ptions) |
946 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don
tPauseOnExceptions); | 946 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don
tPauseOnExceptions); |
947 muteConsole(); | 947 muteConsole(); |
948 } | 948 } |
949 | 949 |
950 Vector<ScriptValue> asyncCallStacks; | 950 Vector<ScriptValue> asyncCallStacks; |
951 const AsyncCallStackTracker::AsyncCallChain* asyncChain = m_asyncCallStackTr
acker.isEnabled() ? m_asyncCallStackTracker.currentAsyncCallChain() : 0; | 951 const AsyncCallStackTracker::AsyncCallChain* asyncChain = m_asyncCallStackTr
acker.isEnabled() ? m_asyncCallStackTracker.currentAsyncCallChain() : 0; |
952 if (asyncChain) { | 952 if (asyncChain) { |
953 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = asyncCha
in->callStacks(); | 953 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = asyncCha
in->callStacks(); |
954 asyncCallStacks.resize(callStacks.size()); | 954 asyncCallStacks.resize(callStacks.size()); |
955 AsyncCallStackTracker::AsyncCallStackVector::const_iterator it = callSta
cks.begin(); | 955 AsyncCallStackTracker::AsyncCallStackVector::const_iterator it = callSta
cks.begin(); |
956 for (size_t i = 0; it != callStacks.end(); ++it, ++i) | 956 for (size_t i = 0; it != callStacks.end(); ++it, ++i) |
957 asyncCallStacks[i] = (*it)->callFrames(); | 957 asyncCallStacks[i] = (*it)->callFrames(); |
958 } | 958 } |
959 | 959 |
960 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCal
lStacks, callFrameId, expression, objectGroup ? *objectGroup : "", includeComman
dLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : fals
e, generatePreview ? *generatePreview : false, &result, wasThrown); | 960 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCal
lStacks, callFrameId, expression, objectGroup ? *objectGroup : "", includeComman
dLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : fals
e, generatePreview ? *generatePreview : false, &result, wasThrown, &exceptionDet
ails); |
961 | 961 // V8 doesn't generate afterCompile event when it's in debugger therefore th
ere is no content of evaluated scripts on frontend |
| 962 // therefore contents of the stack does not provide necessary information |
| 963 if (exceptionDetails) |
| 964 exceptionDetails->setStackTrace(TypeBuilder::Array<TypeBuilder::Console:
:CallFrame>::create()); |
962 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { | 965 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { |
963 unmuteConsole(); | 966 unmuteConsole(); |
964 if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExcep
tionsState) | 967 if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExcep
tionsState) |
965 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExcepti
onsState); | 968 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExcepti
onsState); |
966 } | 969 } |
967 } | 970 } |
968 | 971 |
969 void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
g& expression, const String& sourceURL, const int* executionContextId, TypeBuild
er::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exceptionDetails) | 972 void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
g& expression, const String& sourceURL, const int* executionContextId, TypeBuild
er::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exceptionDetails) |
970 { | 973 { |
971 InjectedScript injectedScript = injectedScriptForEval(errorString, execution
ContextId); | 974 InjectedScript injectedScript = injectedScriptForEval(errorString, execution
ContextId); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 { | 1392 { |
1390 m_scripts.clear(); | 1393 m_scripts.clear(); |
1391 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1394 m_breakpointIdToDebugServerBreakpointIds.clear(); |
1392 m_asyncCallStackTracker.clear(); | 1395 m_asyncCallStackTracker.clear(); |
1393 if (m_frontend) | 1396 if (m_frontend) |
1394 m_frontend->globalObjectCleared(); | 1397 m_frontend->globalObjectCleared(); |
1395 } | 1398 } |
1396 | 1399 |
1397 } // namespace WebCore | 1400 } // namespace WebCore |
1398 | 1401 |
OLD | NEW |