| Index: Source/core/inspector/InspectorDebuggerAgent.cpp
|
| diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp
|
| index adf92f72854e066d2fe36f075bcc67cafcfb982e..eaead68db7c6ff416a0fc0405b97d84c8e6a756e 100644
|
| --- a/Source/core/inspector/InspectorDebuggerAgent.cpp
|
| +++ b/Source/core/inspector/InspectorDebuggerAgent.cpp
|
| @@ -180,14 +180,6 @@
|
| m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, ScriptDebugServer::DontPauseOnExceptions);
|
| }
|
|
|
| -bool InspectorDebuggerAgent::checkEnabled(ErrorString* errorString)
|
| -{
|
| - if (enabled())
|
| - return true;
|
| - *errorString = "Debugger agent is not enabled";
|
| - return false;
|
| -}
|
| -
|
| void InspectorDebuggerAgent::enable()
|
| {
|
| m_instrumentingAgents->setInspectorDebuggerAgent(this);
|
| @@ -290,10 +282,8 @@
|
| }
|
| }
|
|
|
| -void InspectorDebuggerAgent::setBreakpointsActive(ErrorString* errorString, bool active)
|
| -{
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| +void InspectorDebuggerAgent::setBreakpointsActive(ErrorString*, bool active)
|
| +{
|
| scriptDebugServer().setBreakpointsActivated(active);
|
| }
|
|
|
| @@ -310,7 +300,6 @@
|
|
|
| void InspectorDebuggerAgent::addMessageToConsole(ConsoleMessage* consoleMessage)
|
| {
|
| - ASSERT(enabled());
|
| if (consoleMessage->type() == AssertMessageType && scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontPauseOnExceptions)
|
| breakProgram(InspectorFrontend::Debugger::Reason::Assert, nullptr);
|
| }
|
| @@ -413,10 +402,8 @@
|
| *errorString = "Could not resolve breakpoint";
|
| }
|
|
|
| -void InspectorDebuggerAgent::removeBreakpoint(ErrorString* errorString, const String& breakpointId)
|
| -{
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| +void InspectorDebuggerAgent::removeBreakpoint(ErrorString*, const String& breakpointId)
|
| +{
|
| RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState::javaScriptBreakpoints);
|
| breakpointsCookie->remove(breakpointId);
|
| m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCookie);
|
| @@ -425,7 +412,6 @@
|
|
|
| void InspectorDebuggerAgent::removeBreakpoint(const String& breakpointId)
|
| {
|
| - ASSERT(enabled());
|
| BreakpointIdToDebugServerBreakpointIdsMap::iterator debugServerBreakpointIdsIterator = m_breakpointIdToDebugServerBreakpointIds.find(breakpointId);
|
| if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpointIds.end())
|
| return;
|
| @@ -439,8 +425,6 @@
|
|
|
| void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const RefPtr<JSONObject>& location, const bool* interstateLocationOpt)
|
| {
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| if (!m_continueToLocationBreakpointId.isEmpty()) {
|
| scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId);
|
| m_continueToLocationBreakpointId = "";
|
| @@ -484,7 +468,6 @@
|
|
|
| bool InspectorDebuggerAgent::isCallStackEmptyOrBlackboxed()
|
| {
|
| - ASSERT(enabled());
|
| for (int index = 0; ; ++index) {
|
| RefPtrWillBeRawPtr<JavaScriptCallFrame> frame = scriptDebugServer().callFrameNoScopes(index);
|
| if (!frame)
|
| @@ -497,7 +480,6 @@
|
|
|
| bool InspectorDebuggerAgent::isTopCallFrameBlackboxed()
|
| {
|
| - ASSERT(enabled());
|
| return isCallFrameWithUnknownScriptOrBlackboxed(scriptDebugServer().callFrameNoScopes(0));
|
| }
|
|
|
| @@ -559,7 +541,6 @@
|
|
|
| PassRefPtr<TypeBuilder::Debugger::Location> InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointId, const String& scriptId, const ScriptBreakpoint& breakpoint, BreakpointSource source)
|
| {
|
| - ASSERT(enabled());
|
| ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId);
|
| if (scriptIterator == m_scripts.end())
|
| return nullptr;
|
| @@ -599,8 +580,6 @@
|
|
|
| void InspectorDebuggerAgent::setScriptSource(ErrorString* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>& errorData, const String& scriptId, const String& newContent, const bool* const preview, RefPtr<Array<CallFrame> >& newCallFrames, RefPtr<JSONObject>& result, RefPtr<StackTrace>& asyncStackTrace)
|
| {
|
| - if (!checkEnabled(error))
|
| - return;
|
| if (!scriptDebugServer().setScriptSource(scriptId, newContent, asBool(preview), error, errorData, &m_currentCallStack, &result))
|
| return;
|
|
|
| @@ -636,8 +615,6 @@
|
|
|
| void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& scriptId, String* scriptSource)
|
| {
|
| - if (!checkEnabled(error))
|
| - return;
|
| ScriptsMap::iterator it = m_scripts.find(scriptId);
|
| if (it == m_scripts.end()) {
|
| *error = "No script for id: " + scriptId;
|
| @@ -652,8 +629,6 @@
|
|
|
| void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<FunctionDetails>& details)
|
| {
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(functionId);
|
| if (injectedScript.isEmpty()) {
|
| *errorString = "Function object id is obsolete";
|
| @@ -664,8 +639,6 @@
|
|
|
| void InspectorDebuggerAgent::getGeneratorObjectDetails(ErrorString* errorString, const String& objectId, RefPtr<GeneratorObjectDetails>& details)
|
| {
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
|
| if (injectedScript.isEmpty()) {
|
| *errorString = "Inspected frame has gone";
|
| @@ -676,8 +649,6 @@
|
|
|
| void InspectorDebuggerAgent::getCollectionEntries(ErrorString* errorString, const String& objectId, RefPtr<TypeBuilder::Array<CollectionEntry> >& entries)
|
| {
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
|
| if (injectedScript.isEmpty()) {
|
| *errorString = "Inspected frame has gone";
|
| @@ -688,7 +659,6 @@
|
|
|
| void InspectorDebuggerAgent::schedulePauseOnNextStatement(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<JSONObject> data)
|
| {
|
| - ASSERT(enabled());
|
| if (m_scheduledDebuggerStep == StepInto || m_javaScriptPauseScheduled || isPaused())
|
| return;
|
| m_breakReason = breakReason;
|
| @@ -700,7 +670,6 @@
|
|
|
| void InspectorDebuggerAgent::schedulePauseOnNextStatementIfSteppingInto()
|
| {
|
| - ASSERT(enabled());
|
| if (m_scheduledDebuggerStep != StepInto || m_javaScriptPauseScheduled || isPaused())
|
| return;
|
| clearBreakDetails();
|
| @@ -761,10 +730,8 @@
|
| m_listener->didCreatePromise();
|
| }
|
|
|
| -void InspectorDebuggerAgent::pause(ErrorString* errorString)
|
| -{
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| +void InspectorDebuggerAgent::pause(ErrorString*)
|
| +{
|
| if (m_javaScriptPauseScheduled || isPaused())
|
| return;
|
| clearBreakDetails();
|
| @@ -839,8 +806,6 @@
|
|
|
| void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, const String& stringPauseState)
|
| {
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| ScriptDebugServer::PauseOnExceptionsState pauseState;
|
| if (stringPauseState == "none")
|
| pauseState = ScriptDebugServer::DontPauseOnExceptions;
|
| @@ -902,8 +867,6 @@
|
|
|
| void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const String& expression, const String& sourceURL, bool persistScript, const int* executionContextId, TypeBuilder::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exceptionDetails)
|
| {
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
|
| if (injectedScript.isEmpty()) {
|
| *errorString = "Inspected frame has gone";
|
| @@ -933,8 +896,6 @@
|
|
|
| void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scriptId, const int* executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefPtr<ExceptionDetails>& exceptionDetails)
|
| {
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
|
| if (injectedScript.isEmpty()) {
|
| *errorString = "Inspected frame has gone";
|
| @@ -977,8 +938,6 @@
|
|
|
| void InspectorDebuggerAgent::setVariableValue(ErrorString* errorString, int scopeNumber, const String& variableName, const RefPtr<JSONObject>& newValue, const String* callFrameId, const String* functionObjectId)
|
| {
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| InjectedScript injectedScript;
|
| if (callFrameId) {
|
| if (!isPaused() || m_currentCallStack.isEmpty()) {
|
| @@ -1007,8 +966,6 @@
|
|
|
| void InspectorDebuggerAgent::skipStackFrames(ErrorString* errorString, const String* pattern, const bool* skipContentScripts)
|
| {
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| OwnPtr<ScriptRegexp> compiled;
|
| String patternValue = pattern ? *pattern : "";
|
| if (!patternValue.isEmpty()) {
|
| @@ -1025,35 +982,27 @@
|
| m_state->setBoolean(DebuggerAgentState::skipContentScripts, m_skipContentScripts);
|
| }
|
|
|
| -void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString* errorString, int depth)
|
| -{
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| +void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth)
|
| +{
|
| m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth);
|
| internalSetAsyncCallStackDepth(depth);
|
| }
|
|
|
| -void InspectorDebuggerAgent::enablePromiseTracker(ErrorString* errorString, const bool* captureStacks)
|
| -{
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| +void InspectorDebuggerAgent::enablePromiseTracker(ErrorString*, const bool* captureStacks)
|
| +{
|
| m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, true);
|
| m_state->setBoolean(DebuggerAgentState::promiseTrackerCaptureStacks, asBool(captureStacks));
|
| promiseTracker().setEnabled(true, asBool(captureStacks));
|
| }
|
|
|
| -void InspectorDebuggerAgent::disablePromiseTracker(ErrorString* errorString)
|
| -{
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| +void InspectorDebuggerAgent::disablePromiseTracker(ErrorString*)
|
| +{
|
| m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false);
|
| promiseTracker().setEnabled(false, false);
|
| }
|
|
|
| void InspectorDebuggerAgent::getPromiseById(ErrorString* errorString, int promiseId, const String* objectGroup, RefPtr<RemoteObject>& promise)
|
| {
|
| - if (!checkEnabled(errorString))
|
| - return;
|
| if (!promiseTracker().isEnabled()) {
|
| *errorString = "Promise tracking is disabled";
|
| return;
|
| @@ -1589,7 +1538,6 @@
|
|
|
| void InspectorDebuggerAgent::breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<JSONObject> data)
|
| {
|
| - ASSERT(enabled());
|
| if (m_skipAllPauses || m_pausedScriptState || isCallStackEmptyOrBlackboxed())
|
| return;
|
| m_breakReason = breakReason;
|
|
|