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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 if (m_listener) | 156 if (m_listener) |
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); |
| 166 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); |
164 m_instrumentingAgents->setInspectorDebuggerAgent(0); | 167 m_instrumentingAgents->setInspectorDebuggerAgent(0); |
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(); |
(...skipping 44 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 m_promiseTracker.setEnabled(m_state->getBoolean(DebuggerAgentState::prom
iseTrackerEnabled)); |
228 } | 232 } |
229 } | 233 } |
230 | 234 |
231 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) | 235 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) |
232 { | 236 { |
233 m_frontend = frontend->debugger(); | 237 m_frontend = frontend->debugger(); |
234 } | 238 } |
235 | 239 |
236 void InspectorDebuggerAgent::clearFrontend() | 240 void InspectorDebuggerAgent::clearFrontend() |
237 { | 241 { |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 m_state->setString(DebuggerAgentState::skipStackPattern, patternValue); | 1160 m_state->setString(DebuggerAgentState::skipStackPattern, patternValue); |
1157 m_cachedSkipStackRegExp = compiled.release(); | 1161 m_cachedSkipStackRegExp = compiled.release(); |
1158 } | 1162 } |
1159 | 1163 |
1160 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) | 1164 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) |
1161 { | 1165 { |
1162 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); | 1166 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); |
1163 asyncCallStackTracker().setAsyncCallStackDepth(depth); | 1167 asyncCallStackTracker().setAsyncCallStackDepth(depth); |
1164 } | 1168 } |
1165 | 1169 |
| 1170 void InspectorDebuggerAgent::enablePromiseTracker(ErrorString*) |
| 1171 { |
| 1172 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, true); |
| 1173 m_promiseTracker.setEnabled(true); |
| 1174 } |
| 1175 |
| 1176 void InspectorDebuggerAgent::disablePromiseTracker(ErrorString*) |
| 1177 { |
| 1178 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); |
| 1179 m_promiseTracker.setEnabled(false); |
| 1180 } |
| 1181 |
| 1182 void InspectorDebuggerAgent::getPromises(ErrorString*, RefPtr<Array<PromiseDetai
ls> >& promises) |
| 1183 { |
| 1184 if (!m_promiseTracker.isEnabled()) |
| 1185 return; |
| 1186 promises = m_promiseTracker.promises(); |
| 1187 } |
| 1188 |
1166 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive
Text) | 1189 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive
Text) |
1167 { | 1190 { |
1168 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP
auseOnExceptions) { | 1191 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP
auseOnExceptions) { |
1169 RefPtr<JSONObject> directive = JSONObject::create(); | 1192 RefPtr<JSONObject> directive = JSONObject::create(); |
1170 directive->setString("directiveText", directiveText); | 1193 directive->setString("directiveText", directiveText); |
1171 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv
e.release()); | 1194 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv
e.release()); |
1172 } | 1195 } |
1173 } | 1196 } |
1174 | 1197 |
1175 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() | 1198 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 void InspectorDebuggerAgent::trace(Visitor* visitor) | 1499 void InspectorDebuggerAgent::trace(Visitor* visitor) |
1477 { | 1500 { |
1478 visitor->trace(m_injectedScriptManager); | 1501 visitor->trace(m_injectedScriptManager); |
1479 visitor->trace(m_listener); | 1502 visitor->trace(m_listener); |
1480 visitor->trace(m_asyncCallStackTracker); | 1503 visitor->trace(m_asyncCallStackTracker); |
1481 InspectorBaseAgent::trace(visitor); | 1504 InspectorBaseAgent::trace(visitor); |
1482 } | 1505 } |
1483 | 1506 |
1484 } // namespace blink | 1507 } // namespace blink |
1485 | 1508 |
OLD | NEW |