| 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 12 matching lines...) Expand all Loading... |
| 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "core/inspector/InspectorDebuggerAgent.h" | 31 #include "core/inspector/InspectorDebuggerAgent.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/V8Binding.h" |
| 34 #include "core/inspector/ScriptAsyncCallStack.h" |
| 35 #include "core/inspector/v8/V8Debugger.h" |
| 36 |
| 33 namespace blink { | 37 namespace blink { |
| 34 | 38 |
| 35 InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedSc
riptManager, V8Debugger* debugger, int contextGroupId) | 39 InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedSc
riptManager, V8Debugger* debugger, int contextGroupId) |
| 36 : V8DebuggerAgent(injectedScriptManager, debugger, this, contextGroupId) | 40 : InspectorBaseAgent<InspectorDebuggerAgent, InspectorFrontend::Debugger>("D
ebugger") |
| 41 , m_debuggerAgent(adoptPtr(new V8DebuggerAgent(injectedScriptManager, debugg
er, this, contextGroupId))) |
| 37 { | 42 { |
| 38 } | 43 } |
| 39 | 44 |
| 40 InspectorDebuggerAgent::~InspectorDebuggerAgent() | 45 InspectorDebuggerAgent::~InspectorDebuggerAgent() |
| 41 { | 46 { |
| 42 #if !ENABLE(OILPAN) | 47 #if !ENABLE(OILPAN) |
| 43 ASSERT(!m_instrumentingAgents->inspectorDebuggerAgent()); | 48 ASSERT(!m_instrumentingAgents->inspectorDebuggerAgent()); |
| 44 #endif | 49 #endif |
| 45 } | 50 } |
| 46 | 51 |
| 52 // Protocol implementation. |
| 47 void InspectorDebuggerAgent::enable(ErrorString* errorString) | 53 void InspectorDebuggerAgent::enable(ErrorString* errorString) |
| 48 { | 54 { |
| 49 V8DebuggerAgent::enable(errorString); | 55 m_debuggerAgent->enable(errorString); |
| 50 } | 56 } |
| 51 | 57 |
| 58 void InspectorDebuggerAgent::disable(ErrorString* errorString) |
| 59 { |
| 60 m_debuggerAgent->disable(errorString); |
| 61 } |
| 62 |
| 63 void InspectorDebuggerAgent::setBreakpointsActive(ErrorString* errorString, bool
in_active) |
| 64 { |
| 65 m_debuggerAgent->setBreakpointsActive(errorString, in_active); |
| 66 } |
| 67 |
| 68 void InspectorDebuggerAgent::setSkipAllPauses(ErrorString* errorString, bool in_
skipped) |
| 69 { |
| 70 m_debuggerAgent->setSkipAllPauses(errorString, in_skipped); |
| 71 } |
| 72 |
| 73 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int in
_lineNumber, const String* in_url, const String* in_urlRegex, const int* in_colu
mnNumber, const String* in_condition, TypeBuilder::Debugger::BreakpointId* out_b
reakpointId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location>>& out_lo
cations) |
| 74 { |
| 75 m_debuggerAgent->setBreakpointByUrl(errorString, in_lineNumber, in_url, in_u
rlRegex, in_columnNumber, in_condition, out_breakpointId, out_locations); |
| 76 } |
| 77 |
| 78 void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const RefPt
r<JSONObject>& in_location, const String* in_condition, TypeBuilder::Debugger::B
reakpointId* out_breakpointId, RefPtr<TypeBuilder::Debugger::Location>& out_actu
alLocation) |
| 79 { |
| 80 m_debuggerAgent->setBreakpoint(errorString, in_location, in_condition, out_b
reakpointId, out_actualLocation); |
| 81 } |
| 82 |
| 83 void InspectorDebuggerAgent::removeBreakpoint(ErrorString* errorString, const St
ring& in_breakpointId) |
| 84 { |
| 85 m_debuggerAgent->removeBreakpoint(errorString, in_breakpointId); |
| 86 } |
| 87 |
| 88 void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const
RefPtr<JSONObject>& in_location, const bool* in_interstatementLocation) |
| 89 { |
| 90 m_debuggerAgent->continueToLocation(errorString, in_location, in_interstatem
entLocation); |
| 91 } |
| 92 |
| 93 void InspectorDebuggerAgent::stepOver(ErrorString* errorString) |
| 94 { |
| 95 m_debuggerAgent->stepOver(errorString); |
| 96 } |
| 97 |
| 98 void InspectorDebuggerAgent::stepInto(ErrorString* errorString) |
| 99 { |
| 100 m_debuggerAgent->stepInto(errorString); |
| 101 } |
| 102 |
| 103 void InspectorDebuggerAgent::stepOut(ErrorString* errorString) |
| 104 { |
| 105 m_debuggerAgent->stepOut(errorString); |
| 106 } |
| 107 |
| 108 void InspectorDebuggerAgent::pause(ErrorString* errorString) |
| 109 { |
| 110 m_debuggerAgent->pause(errorString); |
| 111 } |
| 112 |
| 113 void InspectorDebuggerAgent::resume(ErrorString* errorString) |
| 114 { |
| 115 m_debuggerAgent->resume(errorString); |
| 116 } |
| 117 |
| 118 void InspectorDebuggerAgent::stepIntoAsync(ErrorString* errorString) |
| 119 { |
| 120 m_debuggerAgent->stepIntoAsync(errorString); |
| 121 } |
| 122 |
| 123 void InspectorDebuggerAgent::searchInContent(ErrorString* errorString, const Str
ing& in_scriptId, const String& in_query, const bool* in_caseSensitive, const bo
ol* in_isRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::SearchMatch>>&
out_result) |
| 124 { |
| 125 m_debuggerAgent->searchInContent(errorString, in_scriptId, in_query, in_case
Sensitive, in_isRegex, out_result); |
| 126 } |
| 127 |
| 128 void InspectorDebuggerAgent::canSetScriptSource(ErrorString* errorString, bool*
out_result) |
| 129 { |
| 130 m_debuggerAgent->canSetScriptSource(errorString, out_result); |
| 131 } |
| 132 |
| 133 void InspectorDebuggerAgent::setScriptSource(ErrorString* errorString, RefPtr<Ty
peBuilder::Debugger::SetScriptSourceError>& errorData, const String& in_scriptId
, const String& in_scriptSource, const bool* in_preview, RefPtr<TypeBuilder::Arr
ay<TypeBuilder::Debugger::CallFrame>>& opt_out_callFrames, TypeBuilder::OptOutpu
t<bool>* opt_out_stackChanged, RefPtr<TypeBuilder::Debugger::StackTrace>& opt_ou
t_asyncStackTrace) |
| 134 { |
| 135 m_debuggerAgent->setScriptSource(errorString, errorData, in_scriptId, in_scr
iptSource, in_preview, opt_out_callFrames, opt_out_stackChanged, opt_out_asyncSt
ackTrace); |
| 136 } |
| 137 |
| 138 void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String
& in_callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame>>&
out_callFrames, RefPtr<TypeBuilder::Debugger::StackTrace>& opt_out_asyncStackTra
ce) |
| 139 { |
| 140 m_debuggerAgent->restartFrame(errorString, in_callFrameId, out_callFrames, o
pt_out_asyncStackTrace); |
| 141 } |
| 142 |
| 143 void InspectorDebuggerAgent::getScriptSource(ErrorString* errorString, const Str
ing& in_scriptId, String* out_scriptSource) |
| 144 { |
| 145 m_debuggerAgent->getScriptSource(errorString, in_scriptId, out_scriptSource)
; |
| 146 } |
| 147 |
| 148 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const
String& in_functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>& out_detai
ls) |
| 149 { |
| 150 m_debuggerAgent->getFunctionDetails(errorString, in_functionId, out_details)
; |
| 151 } |
| 152 |
| 153 void InspectorDebuggerAgent::getGeneratorObjectDetails(ErrorString* errorString,
const String& in_objectId, RefPtr<TypeBuilder::Debugger::GeneratorObjectDetails
>& out_details) |
| 154 { |
| 155 m_debuggerAgent->getGeneratorObjectDetails(errorString, in_objectId, out_det
ails); |
| 156 } |
| 157 |
| 158 void InspectorDebuggerAgent::getCollectionEntries(ErrorString* errorString, cons
t String& in_objectId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Collecti
onEntry>>& out_entries) |
| 159 { |
| 160 m_debuggerAgent->getCollectionEntries(errorString, in_objectId, out_entries)
; |
| 161 } |
| 162 |
| 163 void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, cons
t String& in_state) |
| 164 { |
| 165 m_debuggerAgent->setPauseOnExceptions(errorString, in_state); |
| 166 } |
| 167 |
| 168 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const
String& in_callFrameId, const String& in_expression, const String* in_objectGro
up, const bool* in_includeCommandLineAPI, const bool* in_doNotPauseOnExceptionsA
ndMuteConsole, const bool* in_returnByValue, const bool* in_generatePreview, Ref
Ptr<TypeBuilder::Runtime::RemoteObject>& out_result, TypeBuilder::OptOutput<bool
>* opt_out_wasThrown, RefPtr<TypeBuilder::Debugger::ExceptionDetails>& opt_out_e
xceptionDetails) |
| 169 { |
| 170 m_debuggerAgent->evaluateOnCallFrame(errorString, in_callFrameId, in_express
ion, in_objectGroup, in_includeCommandLineAPI, in_doNotPauseOnExceptionsAndMuteC
onsole, in_returnByValue, in_generatePreview, out_result, opt_out_wasThrown, opt
_out_exceptionDetails); |
| 171 } |
| 172 |
| 173 void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
g& in_expression, const String& in_sourceURL, bool in_persistScript, const int*
in_executionContextId, TypeBuilder::OptOutput<TypeBuilder::Debugger::ScriptId>*
opt_out_scriptId, RefPtr<TypeBuilder::Debugger::ExceptionDetails>& opt_out_excep
tionDetails) |
| 174 { |
| 175 m_debuggerAgent->compileScript(errorString, in_expression, in_sourceURL, in_
persistScript, in_executionContextId, opt_out_scriptId, opt_out_exceptionDetails
); |
| 176 } |
| 177 |
| 178 void InspectorDebuggerAgent::runScript(ErrorString* errorString, const String& i
n_scriptId, const int* in_executionContextId, const String* in_objectGroup, cons
t bool* in_doNotPauseOnExceptionsAndMuteConsole, RefPtr<TypeBuilder::Runtime::Re
moteObject>& out_result, RefPtr<TypeBuilder::Debugger::ExceptionDetails>& opt_ou
t_exceptionDetails) |
| 179 { |
| 180 m_debuggerAgent->runScript(errorString, in_scriptId, in_executionContextId,
in_objectGroup, in_doNotPauseOnExceptionsAndMuteConsole, out_result, opt_out_exc
eptionDetails); |
| 181 } |
| 182 |
| 183 void InspectorDebuggerAgent::setVariableValue(ErrorString* errorString, int in_s
copeNumber, const String& in_variableName, const RefPtr<JSONObject>& in_newValue
, const String* in_callFrameId, const String* in_functionObjectId) |
| 184 { |
| 185 m_debuggerAgent->setVariableValue(errorString, in_scopeNumber, in_variableNa
me, in_newValue, in_callFrameId, in_functionObjectId); |
| 186 } |
| 187 |
| 188 void InspectorDebuggerAgent::getStepInPositions(ErrorString* errorString, const
String& in_callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Locatio
n>>& opt_out_stepInPositions) |
| 189 { |
| 190 m_debuggerAgent->getStepInPositions(errorString, in_callFrameId, opt_out_ste
pInPositions); |
| 191 } |
| 192 |
| 193 void InspectorDebuggerAgent::getBacktrace(ErrorString* errorString, RefPtr<TypeB
uilder::Array<TypeBuilder::Debugger::CallFrame>>& out_callFrames, RefPtr<TypeBui
lder::Debugger::StackTrace>& opt_out_asyncStackTrace) |
| 194 { |
| 195 m_debuggerAgent->getBacktrace(errorString, out_callFrames, opt_out_asyncStac
kTrace); |
| 196 } |
| 197 |
| 198 void InspectorDebuggerAgent::skipStackFrames(ErrorString* errorString, const Str
ing* in_script, const bool* in_skipContentScripts) |
| 199 { |
| 200 m_debuggerAgent->skipStackFrames(errorString, in_script, in_skipContentScrip
ts); |
| 201 } |
| 202 |
| 203 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString* errorString, in
t in_maxDepth) |
| 204 { |
| 205 m_debuggerAgent->setAsyncCallStackDepth(errorString, in_maxDepth); |
| 206 } |
| 207 |
| 208 void InspectorDebuggerAgent::enablePromiseTracker(ErrorString* errorString, cons
t bool* in_captureStacks) |
| 209 { |
| 210 m_debuggerAgent->enablePromiseTracker(errorString, in_captureStacks); |
| 211 } |
| 212 |
| 213 void InspectorDebuggerAgent::disablePromiseTracker(ErrorString* errorString) |
| 214 { |
| 215 m_debuggerAgent->disablePromiseTracker(errorString); |
| 216 } |
| 217 |
| 218 void InspectorDebuggerAgent::getPromiseById(ErrorString* errorString, int in_pro
miseId, const String* in_objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>
& out_promise) |
| 219 { |
| 220 m_debuggerAgent->getPromiseById(errorString, in_promiseId, in_objectGroup, o
ut_promise); |
| 221 } |
| 222 |
| 223 void InspectorDebuggerAgent::flushAsyncOperationEvents(ErrorString* errorString) |
| 224 { |
| 225 m_debuggerAgent->flushAsyncOperationEvents(errorString); |
| 226 } |
| 227 |
| 228 void InspectorDebuggerAgent::setAsyncOperationBreakpoint(ErrorString* errorStrin
g, int in_operationId) |
| 229 { |
| 230 m_debuggerAgent->setAsyncOperationBreakpoint(errorString, in_operationId); |
| 231 } |
| 232 |
| 233 void InspectorDebuggerAgent::removeAsyncOperationBreakpoint(ErrorString* errorSt
ring, int in_operationId) |
| 234 { |
| 235 m_debuggerAgent->removeAsyncOperationBreakpoint(errorString, in_operationId)
; |
| 236 } |
| 237 |
| 238 // V8DebuggerAgent::Client implementation. |
| 52 void InspectorDebuggerAgent::debuggerAgentEnabled() | 239 void InspectorDebuggerAgent::debuggerAgentEnabled() |
| 53 { | 240 { |
| 54 m_instrumentingAgents->setInspectorDebuggerAgent(this); | 241 m_instrumentingAgents->setInspectorDebuggerAgent(this); |
| 55 } | 242 } |
| 56 | 243 |
| 57 void InspectorDebuggerAgent::debuggerAgentDisabled() | 244 void InspectorDebuggerAgent::debuggerAgentDisabled() |
| 58 { | 245 { |
| 59 m_instrumentingAgents->setInspectorDebuggerAgent(nullptr); | 246 m_instrumentingAgents->setInspectorDebuggerAgent(nullptr); |
| 60 } | 247 } |
| 61 | 248 |
| 249 bool InspectorDebuggerAgent::isPaused() |
| 250 { |
| 251 return m_debuggerAgent->isPaused(); |
| 252 } |
| 253 |
| 254 PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> InspectorDebuggerAgent::currentAsyn
cStackTraceForConsole() |
| 255 { |
| 256 return m_debuggerAgent->currentAsyncStackTraceForConsole(); |
| 257 } |
| 258 |
| 259 void InspectorDebuggerAgent::didFireTimer() |
| 260 { |
| 261 m_debuggerAgent->cancelPauseOnNextStatement(); |
| 262 } |
| 263 |
| 264 void InspectorDebuggerAgent::didHandleEvent() |
| 265 { |
| 266 m_debuggerAgent->cancelPauseOnNextStatement(); |
| 267 } |
| 268 |
| 269 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive
Text) |
| 270 { |
| 271 if (m_debuggerAgent->debugger().pauseOnExceptionsState() == V8Debugger::Dont
PauseOnExceptions) |
| 272 return; |
| 273 RefPtr<JSONObject> directive = JSONObject::create(); |
| 274 directive->setString("directiveText", directiveText); |
| 275 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::CSPViolat
ion, directive.release()); |
| 276 } |
| 277 |
| 278 void InspectorDebuggerAgent::willCallFunction(const DevToolsFunctionInfo& info) |
| 279 { |
| 280 m_debuggerAgent->willCallFunction(info.scriptId()); |
| 281 } |
| 282 |
| 283 void InspectorDebuggerAgent::didCallFunction() |
| 284 { |
| 285 m_debuggerAgent->didCallFunction(); |
| 286 } |
| 287 |
| 288 void InspectorDebuggerAgent::willEvaluateScript() |
| 289 { |
| 290 m_debuggerAgent->willEvaluateScript(); |
| 291 } |
| 292 |
| 293 void InspectorDebuggerAgent::didEvaluateScript() |
| 294 { |
| 295 m_debuggerAgent->didEvaluateScript(); |
| 296 } |
| 297 |
| 298 bool InspectorDebuggerAgent::getEditedScript(const String& url, String* content) |
| 299 { |
| 300 return m_debuggerAgent->getEditedScript(url, content); |
| 301 } |
| 302 |
| 303 // InspectorBaseAgent overrides. |
| 304 void InspectorDebuggerAgent::init() |
| 305 { |
| 306 m_debuggerAgent->setInspectorState(m_state); |
| 307 } |
| 308 |
| 309 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) |
| 310 { |
| 311 m_debuggerAgent->setFrontend(InspectorFrontend::Debugger::from(frontend)); |
| 312 } |
| 313 |
| 314 void InspectorDebuggerAgent::clearFrontend() |
| 315 { |
| 316 m_debuggerAgent->clearFrontend(); |
| 317 } |
| 318 |
| 319 void InspectorDebuggerAgent::restore() |
| 320 { |
| 321 m_debuggerAgent->restore(); |
| 322 } |
| 323 |
| 62 } // namespace blink | 324 } // namespace blink |
| OLD | NEW |