| 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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 return; | 895 return; |
| 896 } | 896 } |
| 897 | 897 |
| 898 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); | 898 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); |
| 899 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { | 899 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { |
| 900 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce
ptions) | 900 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce
ptions) |
| 901 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don
tPauseOnExceptions); | 901 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don
tPauseOnExceptions); |
| 902 muteConsole(); | 902 muteConsole(); |
| 903 } | 903 } |
| 904 | 904 |
| 905 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFram
eId, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *inclu
deCommandLineAPI : false, returnByValue ? *returnByValue : false, generatePrevie
w ? *generatePreview : false, &result, wasThrown); | 905 Vector<ScriptValue> asyncCallStacks; |
| 906 const AsyncCallStackTracker::AsyncCallChain* asyncChain = m_asyncCallStackTr
acker.isEnabled() ? m_asyncCallStackTracker.currentAsyncCallChain() : 0; |
| 907 if (asyncChain) { |
| 908 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = asyncCha
in->callStacks(); |
| 909 asyncCallStacks.resize(callStacks.size()); |
| 910 AsyncCallStackTracker::AsyncCallStackVector::const_iterator it = callSta
cks.begin(); |
| 911 for (size_t i = 0; it != callStacks.end(); ++it, ++i) |
| 912 asyncCallStacks[i] = (*it)->callFrames(); |
| 913 } |
| 914 |
| 915 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCal
lStacks, callFrameId, expression, objectGroup ? *objectGroup : "", includeComman
dLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : fals
e, generatePreview ? *generatePreview : false, &result, wasThrown); |
| 906 | 916 |
| 907 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { | 917 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon
sole : false) { |
| 908 unmuteConsole(); | 918 unmuteConsole(); |
| 909 if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExcep
tionsState) | 919 if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExcep
tionsState) |
| 910 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExcepti
onsState); | 920 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExcepti
onsState); |
| 911 } | 921 } |
| 912 } | 922 } |
| 913 | 923 |
| 914 void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
g& expression, const String& sourceURL, TypeBuilder::OptOutput<ScriptId>* script
Id, TypeBuilder::OptOutput<String>* syntaxErrorMessage) | 924 void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
g& expression, const String& sourceURL, TypeBuilder::OptOutput<ScriptId>* script
Id, TypeBuilder::OptOutput<String>* syntaxErrorMessage) |
| 915 { | 925 { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 | 1039 |
| 1030 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() | 1040 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() |
| 1031 { | 1041 { |
| 1032 if (!m_pausedScriptState || m_currentCallStack.hasNoValue()) | 1042 if (!m_pausedScriptState || m_currentCallStack.hasNoValue()) |
| 1033 return Array<CallFrame>::create(); | 1043 return Array<CallFrame>::create(); |
| 1034 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState); | 1044 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState); |
| 1035 if (injectedScript.hasNoValue()) { | 1045 if (injectedScript.hasNoValue()) { |
| 1036 ASSERT_NOT_REACHED(); | 1046 ASSERT_NOT_REACHED(); |
| 1037 return Array<CallFrame>::create(); | 1047 return Array<CallFrame>::create(); |
| 1038 } | 1048 } |
| 1039 return injectedScript.wrapCallFrames(m_currentCallStack); | 1049 return injectedScript.wrapCallFrames(m_currentCallStack, 0); |
| 1040 } | 1050 } |
| 1041 | 1051 |
| 1042 PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace() | 1052 PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace() |
| 1043 { | 1053 { |
| 1044 if (!m_pausedScriptState || !m_asyncCallStackTracker.isEnabled()) | 1054 if (!m_pausedScriptState || !m_asyncCallStackTracker.isEnabled()) |
| 1045 return 0; | 1055 return 0; |
| 1046 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState); | 1056 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState); |
| 1047 if (injectedScript.hasNoValue()) { | 1057 if (injectedScript.hasNoValue()) { |
| 1048 ASSERT_NOT_REACHED(); | 1058 ASSERT_NOT_REACHED(); |
| 1049 return 0; | 1059 return 0; |
| 1050 } | 1060 } |
| 1051 const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker
.currentAsyncCallChain(); | 1061 const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker
.currentAsyncCallChain(); |
| 1052 if (!chain) | 1062 if (!chain) |
| 1053 return 0; | 1063 return 0; |
| 1054 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); | 1064 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); |
| 1055 if (callStacks.isEmpty()) | 1065 if (callStacks.isEmpty()) |
| 1056 return 0; | 1066 return 0; |
| 1057 RefPtr<StackTrace> result; | 1067 RefPtr<StackTrace> result; |
| 1068 int asyncOrdinal = callStacks.size(); |
| 1058 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it) { | 1069 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it) { |
| 1059 RefPtr<StackTrace> next = StackTrace::create() | 1070 RefPtr<StackTrace> next = StackTrace::create() |
| 1060 .setCallFrames(injectedScript.wrapCallFrames((*it)->callFrames())) | 1071 .setCallFrames(injectedScript.wrapCallFrames((*it)->callFrames(), as
yncOrdinal--)) |
| 1061 .release(); | 1072 .release(); |
| 1062 next->setDescription((*it)->description()); | 1073 next->setDescription((*it)->description()); |
| 1063 if (result) | 1074 if (result) |
| 1064 next->setAsyncStackTrace(result.release()); | 1075 next->setAsyncStackTrace(result.release()); |
| 1065 result.swap(next); | 1076 result.swap(next); |
| 1066 } | 1077 } |
| 1067 return result.release(); | 1078 return result.release(); |
| 1068 } | 1079 } |
| 1069 | 1080 |
| 1070 String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script) | 1081 String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script) |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 { | 1257 { |
| 1247 m_scripts.clear(); | 1258 m_scripts.clear(); |
| 1248 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1259 m_breakpointIdToDebugServerBreakpointIds.clear(); |
| 1249 m_asyncCallStackTracker.clear(); | 1260 m_asyncCallStackTracker.clear(); |
| 1250 if (m_frontend) | 1261 if (m_frontend) |
| 1251 m_frontend->globalObjectCleared(); | 1262 m_frontend->globalObjectCleared(); |
| 1252 } | 1263 } |
| 1253 | 1264 |
| 1254 } // namespace WebCore | 1265 } // namespace WebCore |
| 1255 | 1266 |
| OLD | NEW |