Web Inspector: Debugger: lazily create the agent
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 05:40:11 +0000 (05:40 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 05:40:11 +0000 (05:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195973
<rdar://problem/49039674>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
(Inspector::JSGlobalObjectInspectorController::frontendInitialized):
(Inspector::JSGlobalObjectInspectorController::createLazyAgents):

* inspector/JSGlobalObjectConsoleClient.h:
(Inspector::JSGlobalObjectConsoleClient::setInspectorDebuggerAgent): Added.
* inspector/JSGlobalObjectConsoleClient.cpp:
(Inspector::JSGlobalObjectConsoleClient::JSGlobalObjectConsoleClient):
(Inspector::JSGlobalObjectConsoleClient::startConsoleProfile):
(Inspector::JSGlobalObjectConsoleClient::stopConsoleProfile):

* inspector/agents/InspectorDebuggerAgent.h:
(Inspector::InspectorDebuggerAgent::addListener): Added.
(Inspector::InspectorDebuggerAgent::removeListener): Added.
(Inspector::InspectorDebuggerAgent::setListener): Deleted.
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent):
(Inspector::InspectorDebuggerAgent::enable):
(Inspector::InspectorDebuggerAgent::disable):
(Inspector::InspectorDebuggerAgent::getScriptSource):
(Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement):
(Inspector::InspectorDebuggerAgent::didPause):
(Inspector::InspectorDebuggerAgent::breakProgram):
(Inspector::InspectorDebuggerAgent::clearBreakDetails):
Drive-by: reorder some member variables for better sizing.
Drive-by: rename some member variables for clarity.
Source/WebCore:

No change in functionality.

* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
(WebCore::WorkerInspectorController::createLazyAgents):

* inspector/agents/WebDebuggerAgent.cpp:
(WebCore::WebDebuggerAgent::disable):

* inspector/agents/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent):
(WebCore::InspectorDOMDebuggerAgent::discardAgent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243192 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp
Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
Source/WebCore/ChangeLog
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp
Source/WebCore/inspector/agents/WebDebuggerAgent.cpp

index 5c5a894..13b5be6 100644 (file)
@@ -1,3 +1,39 @@
+2019-03-19  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Debugger: lazily create the agent
+        https://bugs.webkit.org/show_bug.cgi?id=195973
+        <rdar://problem/49039674>
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
+        (Inspector::JSGlobalObjectInspectorController::frontendInitialized):
+        (Inspector::JSGlobalObjectInspectorController::createLazyAgents):
+
+        * inspector/JSGlobalObjectConsoleClient.h:
+        (Inspector::JSGlobalObjectConsoleClient::setInspectorDebuggerAgent): Added.
+        * inspector/JSGlobalObjectConsoleClient.cpp:
+        (Inspector::JSGlobalObjectConsoleClient::JSGlobalObjectConsoleClient):
+        (Inspector::JSGlobalObjectConsoleClient::startConsoleProfile):
+        (Inspector::JSGlobalObjectConsoleClient::stopConsoleProfile):
+
+        * inspector/agents/InspectorDebuggerAgent.h:
+        (Inspector::InspectorDebuggerAgent::addListener): Added.
+        (Inspector::InspectorDebuggerAgent::removeListener): Added.
+        (Inspector::InspectorDebuggerAgent::setListener): Deleted.
+        * inspector/agents/InspectorDebuggerAgent.cpp:
+        (Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent):
+        (Inspector::InspectorDebuggerAgent::enable):
+        (Inspector::InspectorDebuggerAgent::disable):
+        (Inspector::InspectorDebuggerAgent::getScriptSource):
+        (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement):
+        (Inspector::InspectorDebuggerAgent::didPause):
+        (Inspector::InspectorDebuggerAgent::breakProgram):
+        (Inspector::InspectorDebuggerAgent::clearBreakDetails):
+        Drive-by: reorder some member variables for better sizing.
+        Drive-by: rename some member variables for clarity.
+
 2019-03-19  Saam barati  <sbarati@apple.com>
 
         Prune code after ForceOSRExit
index c1e8581..d1bd391 100644 (file)
@@ -54,10 +54,9 @@ void JSGlobalObjectConsoleClient::setLogToSystemConsole(bool shouldLog)
     sLogToSystemConsole = shouldLog;
 }
 
-JSGlobalObjectConsoleClient::JSGlobalObjectConsoleClient(InspectorConsoleAgent* consoleAgent, InspectorDebuggerAgent* debuggerAgent)
+JSGlobalObjectConsoleClient::JSGlobalObjectConsoleClient(InspectorConsoleAgent* consoleAgent)
     : ConsoleClient()
     , m_consoleAgent(consoleAgent)
-    , m_debuggerAgent(debuggerAgent)
 {
 }
 
@@ -126,8 +125,10 @@ void JSGlobalObjectConsoleClient::startConsoleProfile()
     if (m_scriptProfilerAgent)
         m_scriptProfilerAgent->programmaticCaptureStarted();
 
-    m_profileRestoreBreakpointActiveValue = m_debuggerAgent->breakpointsActive();
-    m_debuggerAgent->setBreakpointsActive(unused, false);
+    if (m_debuggerAgent) {
+        m_profileRestoreBreakpointActiveValue = m_debuggerAgent->breakpointsActive();
+        m_debuggerAgent->setBreakpointsActive(unused, false);
+    }
 
     if (m_scriptProfilerAgent) {
         const bool includeSamples = true;
@@ -142,7 +143,8 @@ void JSGlobalObjectConsoleClient::stopConsoleProfile()
     if (m_scriptProfilerAgent)
         m_scriptProfilerAgent->stopTracking(unused);
 
-    m_debuggerAgent->setBreakpointsActive(unused, m_profileRestoreBreakpointActiveValue);
+    if (m_debuggerAgent)
+        m_debuggerAgent->setBreakpointsActive(unused, m_profileRestoreBreakpointActiveValue);
 
     // FIXME: <https://webkit.org/b/158753> Generalize the concept of Instruments on the backend to work equally for JSContext and Web inspection
     if (m_scriptProfilerAgent)
index 7401889..4194700 100644 (file)
@@ -38,12 +38,13 @@ class InspectorScriptProfilerAgent;
 class JSGlobalObjectConsoleClient final : public JSC::ConsoleClient {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit JSGlobalObjectConsoleClient(InspectorConsoleAgent*, InspectorDebuggerAgent*);
+    explicit JSGlobalObjectConsoleClient(InspectorConsoleAgent*);
     virtual ~JSGlobalObjectConsoleClient() { }
 
     static bool logToSystemConsole();
     static void setLogToSystemConsole(bool);
 
+    void setInspectorDebuggerAgent(InspectorDebuggerAgent* agent) { m_debuggerAgent = agent; }
     void setInspectorScriptProfilerAgent(InspectorScriptProfilerAgent* agent) { m_scriptProfilerAgent = agent; }
 
 protected:
@@ -67,7 +68,7 @@ private:
     void stopConsoleProfile();
 
     InspectorConsoleAgent* m_consoleAgent;
-    InspectorDebuggerAgent* m_debuggerAgent;
+    InspectorDebuggerAgent* m_debuggerAgent { nullptr };
     InspectorScriptProfilerAgent* m_scriptProfilerAgent { nullptr };
     Vector<String> m_profiles;
     bool m_profileRestoreBreakpointActiveValue { false };
index 7ff3646..7bc921c 100644 (file)
@@ -74,17 +74,14 @@ JSGlobalObjectInspectorController::JSGlobalObjectInspectorController(JSGlobalObj
     auto inspectorAgent = std::make_unique<InspectorAgent>(context);
     auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(context);
     auto consoleAgent = std::make_unique<InspectorConsoleAgent>(context);
-    auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(context, consoleAgent.get());
 
     m_inspectorAgent = inspectorAgent.get();
-    m_debuggerAgent = debuggerAgent.get();
     m_consoleAgent = consoleAgent.get();
-    m_consoleClient = std::make_unique<JSGlobalObjectConsoleClient>(m_consoleAgent, m_debuggerAgent);
+    m_consoleClient = std::make_unique<JSGlobalObjectConsoleClient>(m_consoleAgent);
 
     m_agents.append(WTFMove(inspectorAgent));
     m_agents.append(WTFMove(runtimeAgent));
     m_agents.append(WTFMove(consoleAgent));
-    m_agents.append(WTFMove(debuggerAgent));
 
     m_executionStopwatch->start();
 }
@@ -244,6 +241,8 @@ void JSGlobalObjectInspectorController::frontendInitialized()
 {
     if (m_pauseAfterInitialization) {
         m_pauseAfterInitialization = false;
+
+        ASSERT(m_debuggerAgent);
         ErrorString ignored;
         m_debuggerAgent->enable(ignored);
         m_debuggerAgent->pause(ignored);
@@ -310,6 +309,11 @@ void JSGlobalObjectInspectorController::createLazyAgents()
 
     auto context = jsAgentContext();
 
+    auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(context, m_consoleAgent);
+    m_debuggerAgent = debuggerAgent.get();
+    m_consoleClient->setInspectorDebuggerAgent(m_debuggerAgent);
+    m_agents.append(WTFMove(debuggerAgent));
+
     auto scriptProfilerAgentPtr = std::make_unique<InspectorScriptProfilerAgent>(context);
     m_consoleClient->setInspectorScriptProfilerAgent(scriptProfilerAgentPtr.get());
     m_agents.append(WTFMove(scriptProfilerAgentPtr));
index 0dbf13f..7e3dc65 100644 (file)
@@ -62,11 +62,10 @@ static String objectGroupForBreakpointAction(const ScriptBreakpointAction& actio
 
 InspectorDebuggerAgent::InspectorDebuggerAgent(AgentContext& context)
     : InspectorAgentBase("Debugger"_s)
-    , m_injectedScriptManager(context.injectedScriptManager)
     , m_frontendDispatcher(std::make_unique<DebuggerFrontendDispatcher>(context.frontendRouter))
     , m_backendDispatcher(DebuggerBackendDispatcher::create(context.backendDispatcher, this))
     , m_scriptDebugServer(context.environment.scriptDebugServer())
-    , m_continueToLocationBreakpointID(JSC::noBreakpointID)
+    , m_injectedScriptManager(context.injectedScriptManager)
 {
     // FIXME: make breakReason optional so that there was no need to init it with "other".
     clearBreakDetails();
@@ -91,12 +90,12 @@ void InspectorDebuggerAgent::enable()
     if (m_enabled)
         return;
 
-    m_scriptDebugServer.addListener(this);
+    m_enabled = true;
 
-    if (m_listener)
-        m_listener->debuggerWasEnabled();
+    m_scriptDebugServer.addListener(this);
 
-    m_enabled = true;
+    for (auto* listener : copyToVector(m_listeners))
+        listener->debuggerWasEnabled();
 }
 
 void InspectorDebuggerAgent::disable(bool isBeingDestroyed)
@@ -104,7 +103,11 @@ void InspectorDebuggerAgent::disable(bool isBeingDestroyed)
     if (!m_enabled)
         return;
 
+    for (auto* listener : copyToVector(m_listeners))
+        listener->debuggerWasDisabled();
+
     m_scriptDebugServer.removeListener(this, isBeingDestroyed);
+
     clearInspectorBreakpointState();
 
     if (!isBeingDestroyed)
@@ -112,9 +115,6 @@ void InspectorDebuggerAgent::disable(bool isBeingDestroyed)
 
     ASSERT(m_javaScriptBreakpoints.isEmpty());
 
-    if (m_listener)
-        m_listener->debuggerWasDisabled();
-
     clearAsyncStackTraceData();
 
     m_pauseOnAssertionFailures = false;
@@ -676,7 +676,7 @@ void InspectorDebuggerAgent::searchInContent(ErrorString& error, const String& s
 void InspectorDebuggerAgent::getScriptSource(ErrorString& error, const String& scriptIDStr, String* scriptSource)
 {
     JSC::SourceID sourceID = scriptIDStr.toIntPtr();
-    ScriptsMap::iterator it = m_scripts.find(sourceID);
+    auto it = m_scripts.find(sourceID);
     if (it != m_scripts.end())
         *scriptSource = it->value.source;
     else
@@ -702,7 +702,7 @@ void InspectorDebuggerAgent::schedulePauseOnNextStatement(DebuggerFrontendDispat
     m_javaScriptPauseScheduled = true;
 
     m_breakReason = breakReason;
-    m_breakAuxData = WTFMove(data);
+    m_breakData = WTFMove(data);
 
     JSC::JSLockHolder locker(m_scriptDebugServer.vm());
     m_scriptDebugServer.setPauseOnNextStatement(true);
@@ -977,17 +977,17 @@ void InspectorDebuggerAgent::didPause(JSC::ExecState& scriptState, JSC::JSValue
             JSC::BreakpointID debuggerBreakpointId = m_scriptDebugServer.pausingBreakpointID();
             if (debuggerBreakpointId != m_continueToLocationBreakpointID) {
                 m_breakReason = DebuggerFrontendDispatcher::Reason::Breakpoint;
-                m_breakAuxData = buildBreakpointPauseReason(debuggerBreakpointId);
+                m_breakData = buildBreakpointPauseReason(debuggerBreakpointId);
             }
             break;
         }
         case JSC::Debugger::PausedForDebuggerStatement:
             m_breakReason = DebuggerFrontendDispatcher::Reason::DebuggerStatement;
-            m_breakAuxData = nullptr;
+            m_breakData = nullptr;
             break;
         case JSC::Debugger::PausedForException:
             m_breakReason = DebuggerFrontendDispatcher::Reason::Exception;
-            m_breakAuxData = buildExceptionPauseReason(exceptionOrCaughtValue, injectedScript);
+            m_breakData = buildExceptionPauseReason(exceptionOrCaughtValue, injectedScript);
             break;
         case JSC::Debugger::PausedAtStatement:
         case JSC::Debugger::PausedAtExpression:
@@ -1017,7 +1017,7 @@ void InspectorDebuggerAgent::didPause(JSC::ExecState& scriptState, JSC::JSValue
             asyncStackTrace = it->value->buildInspectorObject();
     }
 
-    m_frontendDispatcher->paused(currentCallFrames(injectedScript), m_breakReason, m_breakAuxData, asyncStackTrace);
+    m_frontendDispatcher->paused(currentCallFrames(injectedScript), m_breakReason, m_breakData, asyncStackTrace);
 
     m_javaScriptPauseScheduled = false;
 
@@ -1072,7 +1072,7 @@ void InspectorDebuggerAgent::didContinue()
 void InspectorDebuggerAgent::breakProgram(DebuggerFrontendDispatcher::Reason breakReason, RefPtr<JSON::Object>&& data)
 {
     m_breakReason = breakReason;
-    m_breakAuxData = WTFMove(data);
+    m_breakData = WTFMove(data);
     m_scriptDebugServer.breakProgram();
 }
 
@@ -1136,7 +1136,7 @@ bool InspectorDebuggerAgent::assertPaused(ErrorString& errorString)
 void InspectorDebuggerAgent::clearBreakDetails()
 {
     m_breakReason = DebuggerFrontendDispatcher::Reason::Other;
-    m_breakAuxData = nullptr;
+    m_breakData = nullptr;
 }
 
 void InspectorDebuggerAgent::clearExceptionValue()
index e657da1..1311c4f 100644 (file)
@@ -37,6 +37,7 @@
 #include "ScriptDebugListener.h"
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
 
@@ -113,7 +114,8 @@ public:
         virtual void debuggerWasEnabled() = 0;
         virtual void debuggerWasDisabled() = 0;
     };
-    void setListener(Listener* listener) { m_listener = listener; }
+    void addListener(Listener& listener) { m_listeners.add(&listener); }
+    void removeListener(Listener& listener) { m_listeners.remove(&listener); }
 
 protected:
     InspectorDebuggerAgent(AgentContext&);
@@ -169,37 +171,38 @@ private:
     typedef std::pair<unsigned, int> AsyncCallIdentifier;
     static AsyncCallIdentifier asyncCallIdentifier(AsyncCallType, int callbackId);
 
-    typedef HashMap<JSC::SourceID, Script> ScriptsMap;
-    typedef HashMap<String, Vector<JSC::BreakpointID>> BreakpointIdentifierToDebugServerBreakpointIDsMap;
-    typedef HashMap<String, RefPtr<JSON::Object>> BreakpointIdentifierToBreakpointMap;
-    typedef HashMap<JSC::BreakpointID, String> DebugServerBreakpointIDToBreakpointIdentifier;
-
-    InjectedScriptManager& m_injectedScriptManager;
     std::unique_ptr<DebuggerFrontendDispatcher> m_frontendDispatcher;
     RefPtr<DebuggerBackendDispatcher> m_backendDispatcher;
+
     ScriptDebugServer& m_scriptDebugServer;
-    Listener* m_listener { nullptr };
+    InjectedScriptManager& m_injectedScriptManager;
+    HashMap<JSC::SourceID, Script> m_scripts;
+
+    HashSet<Listener*> m_listeners;
+
     JSC::ExecState* m_pausedScriptState { nullptr };
     JSC::Strong<JSC::Unknown> m_currentCallStack;
-    ScriptsMap m_scripts;
-    BreakpointIdentifierToDebugServerBreakpointIDsMap m_breakpointIdentifierToDebugServerBreakpointIDs;
-    BreakpointIdentifierToBreakpointMap m_javaScriptBreakpoints;
-    DebugServerBreakpointIDToBreakpointIdentifier m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier;
-    JSC::BreakpointID m_continueToLocationBreakpointID;
+
+    HashMap<String, Vector<JSC::BreakpointID>> m_breakpointIdentifierToDebugServerBreakpointIDs;
+    HashMap<String, RefPtr<JSON::Object>> m_javaScriptBreakpoints;
+    HashMap<JSC::BreakpointID, String> m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier;
+    JSC::BreakpointID m_continueToLocationBreakpointID { JSC::noBreakpointID };
     DebuggerFrontendDispatcher::Reason m_breakReason;
-    RefPtr<JSON::Object> m_breakAuxData;
+    RefPtr<JSON::Object> m_breakData;
     ShouldDispatchResumed m_conditionToDispatchResumed { ShouldDispatchResumed::No };
-    bool m_enablePauseWhenIdle { false };
+
     HashMap<AsyncCallIdentifier, RefPtr<AsyncStackTrace>> m_pendingAsyncCalls;
-    Optional<AsyncCallIdentifier> m_currentAsyncCallIdentifier { WTF::nullopt };
+    Optional<AsyncCallIdentifier> m_currentAsyncCallIdentifier;
+    int m_asyncStackTraceDepth { 0 };
+
     bool m_enabled { false };
-    bool m_javaScriptPauseScheduled { false };
-    bool m_hasExceptionValue { false };
-    bool m_didPauseStopwatch { false };
+    bool m_enablePauseWhenIdle { false };
     bool m_pauseOnAssertionFailures { false };
     bool m_pauseForInternalScripts { false };
+    bool m_javaScriptPauseScheduled { false };
+    bool m_didPauseStopwatch { false };
+    bool m_hasExceptionValue { false };
     bool m_registeredIdleCallback { false };
-    int m_asyncStackTraceDepth { 0 };
 };
 
 } // namespace Inspector
index 26d6b47..0eb30af 100644 (file)
@@ -1,3 +1,24 @@
+2019-03-19  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: Debugger: lazily create the agent
+        https://bugs.webkit.org/show_bug.cgi?id=195973
+        <rdar://problem/49039674>
+
+        Reviewed by Joseph Pecoraro.
+
+        No change in functionality.
+
+        * inspector/WorkerInspectorController.cpp:
+        (WebCore::WorkerInspectorController::WorkerInspectorController):
+        (WebCore::WorkerInspectorController::createLazyAgents):
+
+        * inspector/agents/WebDebuggerAgent.cpp:
+        (WebCore::WebDebuggerAgent::disable):
+
+        * inspector/agents/InspectorDOMDebuggerAgent.cpp:
+        (WebCore::InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent):
+        (WebCore::InspectorDOMDebuggerAgent::discardAgent):
+
 2019-03-18  Maciej Stachowiak  <mjs@apple.com>
 
         Simplify Cocoa platform user agent logic by using string constants instead of function calls for the frozen parts
index 0c98bc7..6a40b6b 100644 (file)
@@ -73,7 +73,6 @@ WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope& workerGl
     m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
 
     m_agents.append(std::make_unique<WorkerRuntimeAgent>(workerContext));
-    m_agents.append(std::make_unique<WorkerDebuggerAgent>(workerContext));
     m_agents.append(WTFMove(consoleAgent));
 
     if (CommandLineAPIHost* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
@@ -176,6 +175,7 @@ void WorkerInspectorController::createLazyAgents()
 #endif
 
     m_agents.append(std::make_unique<WebHeapAgent>(workerContext));
+    m_agents.append(std::make_unique<WorkerDebuggerAgent>(workerContext));
     m_agents.append(std::make_unique<WorkerAuditAgent>(workerContext));
 }
 
index 7caa375..ac915dc 100644 (file)
@@ -72,7 +72,7 @@ InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent(WebAgentContext& context, I
     , m_domAgent(domAgent)
     , m_debuggerAgent(debuggerAgent)
 {
-    m_debuggerAgent->setListener(this);
+    m_debuggerAgent->addListener(*this);
 }
 
 InspectorDOMDebuggerAgent::~InspectorDOMDebuggerAgent()
@@ -112,7 +112,7 @@ void InspectorDOMDebuggerAgent::willDestroyFrontendAndBackend(Inspector::Disconn
 
 void InspectorDOMDebuggerAgent::discardAgent()
 {
-    m_debuggerAgent->setListener(nullptr);
+    m_debuggerAgent->removeListener(*this);
     m_debuggerAgent = nullptr;
 }
 
index a39c871..cabe495 100644 (file)
@@ -47,8 +47,8 @@ void WebDebuggerAgent::enable()
 
 void WebDebuggerAgent::disable(bool isBeingDestroyed)
 {
-    InspectorDebuggerAgent::disable(isBeingDestroyed);
     m_instrumentingAgents.setInspectorDebuggerAgent(nullptr);
+    InspectorDebuggerAgent::disable(isBeingDestroyed);
 }
 
 } // namespace WebCore