2010-08-10 Yury Semikhatsky <yurys@chromium.org>
authoryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Aug 2010 12:42:37 +0000 (12:42 +0000)
committeryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Aug 2010 12:42:37 +0000 (12:42 +0000)
        Reviewed by Pavel Feldman.

        Web Inspector, Chromium: reloading of inspected page hits assert in InspectorController::enableDebuggerFromFrontend()
        https://bugs.webkit.org/show_bug.cgi?id=43780

        * inspector/CodeGeneratorInspector.pm:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::enableDebuggerFromFrontend):
        * inspector/InspectorController.h:
        (WebCore::InspectorController::hasFrontend):
        * inspector/InspectorDebuggerAgent.cpp:
        (WebCore::InspectorDebuggerAgent::create):
        (WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
        (WebCore::InspectorDebuggerAgent::setPauseOnExceptionsState):
        (WebCore::InspectorDebuggerAgent::didParseSource):
        (WebCore::InspectorDebuggerAgent::failedToParseSource):
        (WebCore::InspectorDebuggerAgent::didPause):
        (WebCore::InspectorDebuggerAgent::didContinue):
        * inspector/InspectorDebuggerAgent.h:

2010-08-10  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector, Chromium: reloading of inspected page hits assert in InspectorController::enableDebuggerFromFrontend()
        https://bugs.webkit.org/show_bug.cgi?id=43780

        * src/WebDevToolsAgentImpl.cpp:
        (WebKit::WebDevToolsAgentImpl::setRuntimeFeatureEnabled):

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

WebCore/ChangeLog
WebCore/inspector/CodeGeneratorInspector.pm
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorController.h
WebCore/inspector/InspectorDebuggerAgent.cpp
WebCore/inspector/InspectorDebuggerAgent.h
WebKit/chromium/ChangeLog
WebKit/chromium/src/WebDevToolsAgentImpl.cpp

index 07a06ee..b85bd24 100644 (file)
@@ -1,3 +1,25 @@
+2010-08-10  Yury Semikhatsky  <yurys@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector, Chromium: reloading of inspected page hits assert in InspectorController::enableDebuggerFromFrontend()
+        https://bugs.webkit.org/show_bug.cgi?id=43780
+
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::enableDebuggerFromFrontend):
+        * inspector/InspectorController.h:
+        (WebCore::InspectorController::hasFrontend):
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::InspectorDebuggerAgent::create):
+        (WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
+        (WebCore::InspectorDebuggerAgent::setPauseOnExceptionsState):
+        (WebCore::InspectorDebuggerAgent::didParseSource):
+        (WebCore::InspectorDebuggerAgent::failedToParseSource):
+        (WebCore::InspectorDebuggerAgent::didPause):
+        (WebCore::InspectorDebuggerAgent::didContinue):
+        * inspector/InspectorDebuggerAgent.h:
+
 2010-08-10  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
 
         Reviewed by Simon Hausmann.
index 50a29b9..67ea1ae 100644 (file)
@@ -206,7 +206,6 @@ sub GenerateInterface
     $backendClassName = $className . "BackendDispatcher";
     my @backendHead;
     push(@backendHead, "    ${backendClassName}(InspectorController* inspectorController) : m_inspectorController(inspectorController) { }");
-    push(@backendHead, "    RemoteInspectorFrontend* inspectorFrontend() const { return m_inspectorController->remoteInspectorFrontend(); }");
     push(@backendHead, "    void reportProtocolError(const long callId, const String& method, const String& errorText) const;");
     push(@backendHead, "    void dispatch(const String& message);");
     push(@backendHead, "private:");
@@ -352,7 +351,7 @@ sub generateBackendFunction
 
         push(@function, "");
         push(@function, "    // use InspectorFrontend as a marker of WebInspector availability");
-        push(@function, "    if (m_inspectorController->remoteInspectorFrontend()) {");
+        push(@function, "    if (m_inspectorController->hasFrontend()) {");
         push(@function, "        RefPtr<InspectorArray> arguments = InspectorArray::create();");
         push(@function, "        arguments->pushString(\"processResponse\");");
         push(@function, "        arguments->pushNumber(callId);");
index e1aeff9..9e55067 100644 (file)
@@ -1624,7 +1624,7 @@ void InspectorController::enableDebuggerFromFrontend(bool always)
 
     ASSERT(m_inspectedPage);
 
-    m_debuggerAgent = InspectorDebuggerAgent::create(this);
+    m_debuggerAgent = InspectorDebuggerAgent::create(this, m_remoteFrontend.get());
 
     m_remoteFrontend->debuggerWasEnabled();
 }
index e3569cc..55252e9 100644 (file)
@@ -207,7 +207,7 @@ public:
 
     const ResourcesMap& resources() const { return m_resources; }
     InspectorResource* resourceForURL(const String& url);
-    RemoteInspectorFrontend* remoteInspectorFrontend() { return m_remoteFrontend.get(); }
+    bool hasFrontend() const { return m_remoteFrontend; }
 
     void drawNodeHighlight(GraphicsContext&) const;
 
index a617e79..b70ddbf 100644 (file)
@@ -46,16 +46,17 @@ static String formatBreakpointId(const String& sourceID, unsigned lineNumber)
     return String::format("%s:%d", sourceID.utf8().data(), lineNumber);
 }
 
-PassOwnPtr<InspectorDebuggerAgent> InspectorDebuggerAgent::create(InspectorController* inspectorController)
+PassOwnPtr<InspectorDebuggerAgent> InspectorDebuggerAgent::create(InspectorController* inspectorController, RemoteInspectorFrontend* remoteFrontend)
 {
-    OwnPtr<InspectorDebuggerAgent> agent = adoptPtr(new InspectorDebuggerAgent(inspectorController));
+    OwnPtr<InspectorDebuggerAgent> agent = adoptPtr(new InspectorDebuggerAgent(inspectorController, remoteFrontend));
     ScriptDebugServer::shared().clearBreakpoints();
     ScriptDebugServer::shared().addListener(agent.get(), inspectorController->inspectedPage());
     return agent.release();
 }
 
-InspectorDebuggerAgent::InspectorDebuggerAgent(InspectorController* inspectorController)
+InspectorDebuggerAgent::InspectorDebuggerAgent(InspectorController* inspectorController, RemoteInspectorFrontend* remoteFrontend)
     : m_inspectorController(inspectorController)
+    , m_remoteFrontend(remoteFrontend)
     , m_pausedScriptState(0)
     , m_breakpointsLoaded(false)
 {
@@ -166,8 +167,7 @@ void InspectorDebuggerAgent::stepOutOfFunction()
 void InspectorDebuggerAgent::setPauseOnExceptionsState(long pauseState)
 {
     ScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState));
-    if (remoteFrontend())
-        remoteFrontend()->updatePauseOnExceptionsState(ScriptDebugServer::shared().pauseOnExceptionsState());
+    m_remoteFrontend->updatePauseOnExceptionsState(ScriptDebugServer::shared().pauseOnExceptionsState());
 }
 
 void InspectorDebuggerAgent::clearForPageNavigation()
@@ -246,7 +246,7 @@ void InspectorDebuggerAgent::saveBreakpoints()
 void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String& url, const String& data, int firstLine, ScriptWorldType worldType)
 {
     // Don't send script content to the front end until it's really needed.
-    remoteFrontend()->parsedScriptSource(sourceID, url, "", firstLine, worldType);
+    m_remoteFrontend->parsedScriptSource(sourceID, url, "", firstLine, worldType);
 
     m_scriptIDToContent.set(sourceID, data);
 
@@ -264,7 +264,7 @@ void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String
             bool success = ScriptDebugServer::shared().setBreakpoint(sourceID, breakpointIt->second, lineNumber, &actualLineNumber);
             if (!success)
                 continue;
-            remoteFrontend()->restoredBreakpoint(sourceID, url, actualLineNumber, breakpointIt->second.enabled, breakpointIt->second.condition);
+            m_remoteFrontend->restoredBreakpoint(sourceID, url, actualLineNumber, breakpointIt->second.enabled, breakpointIt->second.condition);
             String breakpointId = formatBreakpointId(sourceID, actualLineNumber);
             m_breakpointsMapping.set(breakpointId, lineNumber);
         }
@@ -274,7 +274,7 @@ void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String
 
 void InspectorDebuggerAgent::failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage)
 {
-    remoteFrontend()->failedToParseScriptSource(url, data, firstLine, errorLine, errorMessage);
+    m_remoteFrontend->failedToParseScriptSource(url, data, firstLine, errorLine, errorMessage);
 }
 
 void InspectorDebuggerAgent::didPause(ScriptState* scriptState)
@@ -282,18 +282,13 @@ void InspectorDebuggerAgent::didPause(ScriptState* scriptState)
     ASSERT(scriptState && !m_pausedScriptState);
     m_pausedScriptState = scriptState;
     RefPtr<InspectorValue> callFrames = currentCallFrames();
-    remoteFrontend()->pausedScript(callFrames.get());
+    m_remoteFrontend->pausedScript(callFrames.get());
 }
 
 void InspectorDebuggerAgent::didContinue()
 {
     m_pausedScriptState = 0;
-    remoteFrontend()->resumedScript();
-}
-
-RemoteInspectorFrontend* InspectorDebuggerAgent::remoteFrontend() const
-{
-    return m_inspectorController->remoteInspectorFrontend();
+    m_remoteFrontend->resumedScript();
 }
 
 } // namespace WebCore
index 6db6267..5428eb2 100644 (file)
@@ -47,7 +47,7 @@ class RemoteInspectorFrontend;
 
 class InspectorDebuggerAgent : public ScriptDebugListener, public Noncopyable {
 public:
-    static PassOwnPtr<InspectorDebuggerAgent> create(InspectorController*);
+    static PassOwnPtr<InspectorDebuggerAgent> create(InspectorController*, RemoteInspectorFrontend*);
     virtual ~InspectorDebuggerAgent();
 
     static bool isDebuggerAlwaysEnabled();
@@ -73,7 +73,7 @@ public:
     static String md5Base16(const String& string);
 
 private:
-    InspectorDebuggerAgent(InspectorController*);
+    InspectorDebuggerAgent(InspectorController*, RemoteInspectorFrontend*);
 
     PassRefPtr<InspectorValue> currentCallFrames();
 
@@ -85,9 +85,8 @@ private:
     virtual void didPause(ScriptState*);
     virtual void didContinue();
 
-    RemoteInspectorFrontend* remoteFrontend() const;
-
     InspectorController* m_inspectorController;
+    RemoteInspectorFrontend* m_remoteFrontend;
     ScriptState* m_pausedScriptState;
     HashMap<String, String> m_sourceIDToURL;
     HashMap<String, String> m_scriptIDToContent;
index b0ed13e..7e5f82c 100644 (file)
@@ -1,3 +1,13 @@
+2010-08-10  Yury Semikhatsky  <yurys@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector, Chromium: reloading of inspected page hits assert in InspectorController::enableDebuggerFromFrontend()
+        https://bugs.webkit.org/show_bug.cgi?id=43780
+
+        * src/WebDevToolsAgentImpl.cpp:
+        (WebKit::WebDevToolsAgentImpl::setRuntimeFeatureEnabled):
+
 2010-08-10  Hans Wennborg  <hans@chromium.org>
 
         Reviewed by Jeremy Orlow.
index 1a74ff6..7a825c8 100644 (file)
@@ -304,7 +304,7 @@ void WebDevToolsAgentImpl::setRuntimeFeatureEnabled(const WebString& feature, bo
           ic->enableResourceTracking(false /* not sticky */, false /* no reload */);
         else
           ic->disableResourceTracking(false /* not sticky */);
-    } else if (feature == kFrontendConnectedFeatureName && enabled)
+    } else if (feature == kFrontendConnectedFeatureName && enabled && !inspectorController()->hasFrontend())
         frontendLoaded();
 }