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 skipContentScripts[] = "skipContentScripts"; | 91 static const char skipContentScripts[] = "skipContentScripts"; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 m_listener->debuggerWasEnabled(); | 159 m_listener->debuggerWasEnabled(); |
158 } | 160 } |
159 | 161 |
160 void InspectorDebuggerAgent::disable() | 162 void InspectorDebuggerAgent::disable() |
161 { | 163 { |
162 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, JSONObject::cr
eate()); | 164 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, JSONObject::cr
eate()); |
163 m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, ScriptDebugServ
er::DontPauseOnExceptions); | 165 m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, ScriptDebugServ
er::DontPauseOnExceptions); |
164 m_state->setString(DebuggerAgentState::skipStackPattern, ""); | 166 m_state->setString(DebuggerAgentState::skipStackPattern, ""); |
165 m_state->setBoolean(DebuggerAgentState::skipContentScripts, false); | 167 m_state->setBoolean(DebuggerAgentState::skipContentScripts, false); |
166 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, 0); | 168 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, 0); |
| 169 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); |
167 m_instrumentingAgents->setInspectorDebuggerAgent(0); | 170 m_instrumentingAgents->setInspectorDebuggerAgent(0); |
168 | 171 |
169 scriptDebugServer().clearBreakpoints(); | 172 scriptDebugServer().clearBreakpoints(); |
170 scriptDebugServer().clearCompiledScripts(); | 173 scriptDebugServer().clearCompiledScripts(); |
171 scriptDebugServer().clearPreprocessor(); | 174 scriptDebugServer().clearPreprocessor(); |
172 stopListeningScriptDebugServer(); | 175 stopListeningScriptDebugServer(); |
173 clear(); | 176 clear(); |
174 | 177 |
175 if (m_listener) | 178 if (m_listener) |
176 m_listener->debuggerWasDisabled(); | 179 m_listener->debuggerWasDisabled(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 String error; | 225 String error; |
223 setPauseOnExceptionsImpl(&error, pauseState); | 226 setPauseOnExceptionsImpl(&error, pauseState); |
224 m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString
(DebuggerAgentState::skipStackPattern)); | 227 m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString
(DebuggerAgentState::skipStackPattern)); |
225 m_skipContentScripts = m_state->getBoolean(DebuggerAgentState::skipConte
ntScripts); | 228 m_skipContentScripts = m_state->getBoolean(DebuggerAgentState::skipConte
ntScripts); |
226 m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses)
; | 229 m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses)
; |
227 if (m_skipAllPauses && m_state->getBoolean(DebuggerAgentState::skipAllPa
usesExpiresOnReload)) { | 230 if (m_skipAllPauses && m_state->getBoolean(DebuggerAgentState::skipAllPa
usesExpiresOnReload)) { |
228 m_skipAllPauses = false; | 231 m_skipAllPauses = false; |
229 m_state->setBoolean(DebuggerAgentState::skipAllPauses, false); | 232 m_state->setBoolean(DebuggerAgentState::skipAllPauses, false); |
230 } | 233 } |
231 asyncCallStackTracker().setAsyncCallStackDepth(m_state->getLong(Debugger
AgentState::asyncCallStackDepth)); | 234 asyncCallStackTracker().setAsyncCallStackDepth(m_state->getLong(Debugger
AgentState::asyncCallStackDepth)); |
| 235 m_promiseTracker.setEnabled(m_state->getBoolean(DebuggerAgentState::prom
iseTrackerEnabled)); |
232 } | 236 } |
233 } | 237 } |
234 | 238 |
235 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) | 239 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) |
236 { | 240 { |
237 m_frontend = frontend->debugger(); | 241 m_frontend = frontend->debugger(); |
238 } | 242 } |
239 | 243 |
240 void InspectorDebuggerAgent::clearFrontend() | 244 void InspectorDebuggerAgent::clearFrontend() |
241 { | 245 { |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 m_skipContentScripts = asBool(skipContentScripts); | 1163 m_skipContentScripts = asBool(skipContentScripts); |
1160 m_state->setBoolean(DebuggerAgentState::skipContentScripts, m_skipContentScr
ipts); | 1164 m_state->setBoolean(DebuggerAgentState::skipContentScripts, m_skipContentScr
ipts); |
1161 } | 1165 } |
1162 | 1166 |
1163 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) | 1167 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) |
1164 { | 1168 { |
1165 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); | 1169 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); |
1166 asyncCallStackTracker().setAsyncCallStackDepth(depth); | 1170 asyncCallStackTracker().setAsyncCallStackDepth(depth); |
1167 } | 1171 } |
1168 | 1172 |
| 1173 void InspectorDebuggerAgent::enablePromiseTracker(ErrorString*) |
| 1174 { |
| 1175 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, true); |
| 1176 m_promiseTracker.setEnabled(true); |
| 1177 } |
| 1178 |
| 1179 void InspectorDebuggerAgent::disablePromiseTracker(ErrorString*) |
| 1180 { |
| 1181 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); |
| 1182 m_promiseTracker.setEnabled(false); |
| 1183 } |
| 1184 |
| 1185 void InspectorDebuggerAgent::getPromises(ErrorString*, RefPtr<Array<PromiseDetai
ls> >& promises) |
| 1186 { |
| 1187 if (!m_promiseTracker.isEnabled()) |
| 1188 return; |
| 1189 promises = m_promiseTracker.promises(); |
| 1190 } |
| 1191 |
1169 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive
Text) | 1192 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive
Text) |
1170 { | 1193 { |
1171 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP
auseOnExceptions) { | 1194 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP
auseOnExceptions) { |
1172 RefPtr<JSONObject> directive = JSONObject::create(); | 1195 RefPtr<JSONObject> directive = JSONObject::create(); |
1173 directive->setString("directiveText", directiveText); | 1196 directive->setString("directiveText", directiveText); |
1174 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv
e.release()); | 1197 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv
e.release()); |
1175 } | 1198 } |
1176 } | 1199 } |
1177 | 1200 |
1178 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() | 1201 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 void InspectorDebuggerAgent::trace(Visitor* visitor) | 1502 void InspectorDebuggerAgent::trace(Visitor* visitor) |
1480 { | 1503 { |
1481 visitor->trace(m_injectedScriptManager); | 1504 visitor->trace(m_injectedScriptManager); |
1482 visitor->trace(m_listener); | 1505 visitor->trace(m_listener); |
1483 visitor->trace(m_asyncCallStackTracker); | 1506 visitor->trace(m_asyncCallStackTracker); |
1484 InspectorBaseAgent::trace(visitor); | 1507 InspectorBaseAgent::trace(visitor); |
1485 } | 1508 } |
1486 | 1509 |
1487 } // namespace blink | 1510 } // namespace blink |
1488 | 1511 |
OLD | NEW |