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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 #include "platform/JSONValues.h" | 51 #include "platform/JSONValues.h" |
52 #include "wtf/text/StringBuilder.h" | 52 #include "wtf/text/StringBuilder.h" |
53 #include "wtf/text/WTFString.h" | 53 #include "wtf/text/WTFString.h" |
54 | 54 |
55 using blink::TypeBuilder::Array; | 55 using blink::TypeBuilder::Array; |
56 using blink::TypeBuilder::Debugger::BreakpointId; | 56 using blink::TypeBuilder::Debugger::BreakpointId; |
57 using blink::TypeBuilder::Debugger::CallFrame; | 57 using blink::TypeBuilder::Debugger::CallFrame; |
58 using blink::TypeBuilder::Debugger::CollectionEntry; | 58 using blink::TypeBuilder::Debugger::CollectionEntry; |
59 using blink::TypeBuilder::Debugger::ExceptionDetails; | 59 using blink::TypeBuilder::Debugger::ExceptionDetails; |
60 using blink::TypeBuilder::Debugger::FunctionDetails; | 60 using blink::TypeBuilder::Debugger::FunctionDetails; |
61 using blink::TypeBuilder::Debugger::PromiseDetails; | |
61 using blink::TypeBuilder::Debugger::ScriptId; | 62 using blink::TypeBuilder::Debugger::ScriptId; |
62 using blink::TypeBuilder::Debugger::StackTrace; | 63 using blink::TypeBuilder::Debugger::StackTrace; |
63 using blink::TypeBuilder::Runtime::RemoteObject; | 64 using blink::TypeBuilder::Runtime::RemoteObject; |
64 | 65 |
65 namespace { | 66 namespace { |
66 | 67 |
67 static const char v8AsyncTaskEventEnqueue[] = "enqueue"; | 68 static const char v8AsyncTaskEventEnqueue[] = "enqueue"; |
68 static const char v8AsyncTaskEventWillHandle[] = "willHandle"; | 69 static const char v8AsyncTaskEventWillHandle[] = "willHandle"; |
69 static const char v8AsyncTaskEventDidHandle[] = "didHandle"; | 70 static const char v8AsyncTaskEventDidHandle[] = "didHandle"; |
70 | 71 |
71 } | 72 } |
72 | 73 |
73 namespace blink { | 74 namespace blink { |
74 | 75 |
75 namespace DebuggerAgentState { | 76 namespace DebuggerAgentState { |
76 static const char debuggerEnabled[] = "debuggerEnabled"; | 77 static const char debuggerEnabled[] = "debuggerEnabled"; |
77 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; | 78 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; |
78 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; | 79 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; |
79 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; | 80 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; |
81 static const char promiseTrackerEnabled[] = "promiseTrackerEnabled"; | |
80 | 82 |
81 // Breakpoint properties. | 83 // Breakpoint properties. |
82 static const char url[] = "url"; | 84 static const char url[] = "url"; |
83 static const char isRegex[] = "isRegex"; | 85 static const char isRegex[] = "isRegex"; |
84 static const char lineNumber[] = "lineNumber"; | 86 static const char lineNumber[] = "lineNumber"; |
85 static const char columnNumber[] = "columnNumber"; | 87 static const char columnNumber[] = "columnNumber"; |
86 static const char condition[] = "condition"; | 88 static const char condition[] = "condition"; |
87 static const char isAnti[] = "isAnti"; | 89 static const char isAnti[] = "isAnti"; |
88 static const char skipStackPattern[] = "skipStackPattern"; | 90 static const char skipStackPattern[] = "skipStackPattern"; |
89 static const char skipAllPauses[] = "skipAllPauses"; | 91 static const char skipAllPauses[] = "skipAllPauses"; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 m_listener->debuggerWasEnabled(); | 157 m_listener->debuggerWasEnabled(); |
156 } | 158 } |
157 | 159 |
158 void InspectorDebuggerAgent::disable() | 160 void InspectorDebuggerAgent::disable() |
159 { | 161 { |
160 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, JSONObject::cr eate()); | 162 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, JSONObject::cr eate()); |
161 m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, ScriptDebugServ er::DontPauseOnExceptions); | 163 m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, ScriptDebugServ er::DontPauseOnExceptions); |
162 m_state->setString(DebuggerAgentState::skipStackPattern, ""); | 164 m_state->setString(DebuggerAgentState::skipStackPattern, ""); |
163 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, 0); | 165 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, 0); |
164 m_instrumentingAgents->setInspectorDebuggerAgent(0); | 166 m_instrumentingAgents->setInspectorDebuggerAgent(0); |
167 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); | |
aandrey
2014/09/01 13:39:27
move 1 line above
Alexandra Mikhaylova
2014/09/02 11:39:29
Done.
| |
165 | 168 |
166 scriptDebugServer().clearBreakpoints(); | 169 scriptDebugServer().clearBreakpoints(); |
167 scriptDebugServer().clearCompiledScripts(); | 170 scriptDebugServer().clearCompiledScripts(); |
168 scriptDebugServer().clearPreprocessor(); | 171 scriptDebugServer().clearPreprocessor(); |
169 stopListeningScriptDebugServer(); | 172 stopListeningScriptDebugServer(); |
170 clear(); | 173 clear(); |
171 | 174 |
172 if (m_listener) | 175 if (m_listener) |
173 m_listener->debuggerWasDisabled(); | 176 m_listener->debuggerWasDisabled(); |
174 | 177 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 long pauseState = m_state->getLong(DebuggerAgentState::pauseOnExceptions State); | 221 long pauseState = m_state->getLong(DebuggerAgentState::pauseOnExceptions State); |
219 String error; | 222 String error; |
220 setPauseOnExceptionsImpl(&error, pauseState); | 223 setPauseOnExceptionsImpl(&error, pauseState); |
221 m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString (DebuggerAgentState::skipStackPattern)); | 224 m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString (DebuggerAgentState::skipStackPattern)); |
222 m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses) ; | 225 m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses) ; |
223 if (m_skipAllPauses && m_state->getBoolean(DebuggerAgentState::skipAllPa usesExpiresOnReload)) { | 226 if (m_skipAllPauses && m_state->getBoolean(DebuggerAgentState::skipAllPa usesExpiresOnReload)) { |
224 m_skipAllPauses = false; | 227 m_skipAllPauses = false; |
225 m_state->setBoolean(DebuggerAgentState::skipAllPauses, false); | 228 m_state->setBoolean(DebuggerAgentState::skipAllPauses, false); |
226 } | 229 } |
227 asyncCallStackTracker().setAsyncCallStackDepth(m_state->getLong(Debugger AgentState::asyncCallStackDepth)); | 230 asyncCallStackTracker().setAsyncCallStackDepth(m_state->getLong(Debugger AgentState::asyncCallStackDepth)); |
231 if (m_state->getBoolean(DebuggerAgentState::promiseTrackerEnabled)) | |
232 m_promiseTracker.enable(); | |
aandrey
2014/09/01 13:39:27
setEnabled()?
Alexandra Mikhaylova
2014/09/02 11:39:29
Done, should we also change InspectorDebuggerAgent
| |
233 else | |
234 m_promiseTracker.disable(); | |
228 } | 235 } |
229 } | 236 } |
230 | 237 |
231 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) | 238 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) |
232 { | 239 { |
233 m_frontend = frontend->debugger(); | 240 m_frontend = frontend->debugger(); |
234 } | 241 } |
235 | 242 |
236 void InspectorDebuggerAgent::clearFrontend() | 243 void InspectorDebuggerAgent::clearFrontend() |
237 { | 244 { |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1156 m_state->setString(DebuggerAgentState::skipStackPattern, patternValue); | 1163 m_state->setString(DebuggerAgentState::skipStackPattern, patternValue); |
1157 m_cachedSkipStackRegExp = compiled.release(); | 1164 m_cachedSkipStackRegExp = compiled.release(); |
1158 } | 1165 } |
1159 | 1166 |
1160 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) | 1167 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) |
1161 { | 1168 { |
1162 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); | 1169 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); |
1163 asyncCallStackTracker().setAsyncCallStackDepth(depth); | 1170 asyncCallStackTracker().setAsyncCallStackDepth(depth); |
1164 } | 1171 } |
1165 | 1172 |
1173 void InspectorDebuggerAgent::enablePromiseTracker(ErrorString*) | |
1174 { | |
1175 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, true); | |
1176 m_promiseTracker.enable(); | |
1177 } | |
1178 | |
1179 void InspectorDebuggerAgent::disablePromiseTracker(ErrorString*) | |
1180 { | |
1181 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); | |
1182 m_promiseTracker.disable(); | |
1183 } | |
1184 | |
1185 void InspectorDebuggerAgent::getPromises(ErrorString*, RefPtr<Array<PromiseDetai ls> >& promises) | |
1186 { | |
1187 if (!m_promiseTracker.isEnabled()) | |
1188 return; | |
1189 promises = m_promiseTracker.getPromises(); | |
1190 } | |
1191 | |
1166 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive Text) | 1192 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive Text) |
1167 { | 1193 { |
1168 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP auseOnExceptions) { | 1194 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP auseOnExceptions) { |
1169 RefPtr<JSONObject> directive = JSONObject::create(); | 1195 RefPtr<JSONObject> directive = JSONObject::create(); |
1170 directive->setString("directiveText", directiveText); | 1196 directive->setString("directiveText", directiveText); |
1171 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv e.release()); | 1197 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv e.release()); |
1172 } | 1198 } |
1173 } | 1199 } |
1174 | 1200 |
1175 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() | 1201 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1476 void InspectorDebuggerAgent::trace(Visitor* visitor) | 1502 void InspectorDebuggerAgent::trace(Visitor* visitor) |
1477 { | 1503 { |
1478 visitor->trace(m_injectedScriptManager); | 1504 visitor->trace(m_injectedScriptManager); |
1479 visitor->trace(m_listener); | 1505 visitor->trace(m_listener); |
1480 visitor->trace(m_asyncCallStackTracker); | 1506 visitor->trace(m_asyncCallStackTracker); |
1481 InspectorBaseAgent::trace(visitor); | 1507 InspectorBaseAgent::trace(visitor); |
1482 } | 1508 } |
1483 | 1509 |
1484 } // namespace blink | 1510 } // namespace blink |
1485 | 1511 |
OLD | NEW |