2011-03-09 Andrey Kosyakov <caseq@chromium.org>
authorcaseq@chromium.org <caseq@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Mar 2011 13:40:08 +0000 (13:40 +0000)
committercaseq@chromium.org <caseq@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Mar 2011 13:40:08 +0000 (13:40 +0000)
        Reviewed by Pavel Feldman.

        Web Inspector: resource errors are not reported before front-end is opened
        https://bugs.webkit.org/show_bug.cgi?id=55939

        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::didReceiveResourceResponse):
        (WebCore::InspectorInstrumentation::didFailLoading):

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

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h

index 0303ef9..dff04f7 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-09  Andrey Kosyakov  <caseq@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: resource errors are not reported before front-end is opened
+        https://bugs.webkit.org/show_bug.cgi?id=55939
+
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::didReceiveResourceResponse):
+        (WebCore::InspectorInstrumentation::didFailLoading):
+
 2011-03-08  Hans Wennborg  <hans@chromium.org>
 
         Reviewed by Jeremy Orlow.
index dfe1c28..3623268 100644 (file)
@@ -448,10 +448,11 @@ InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResp
 
 void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
 {
-    InspectorAgent* inspectorAgent = cookie.first;
-    if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
-        resourceAgent->didReceiveResponse(identifier, loader, response);
-    inspectorAgent->consoleAgent()->didReceiveResponse(identifier, response);
+    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(loader->frame())) {
+        if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
+            resourceAgent->didReceiveResponse(identifier, loader, response);
+        inspectorAgent->consoleAgent()->didReceiveResponse(identifier, response);
+    }
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
         timelineAgent->didReceiveResourceResponse();
 }
@@ -733,6 +734,8 @@ InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(Inspecto
 
 InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
 {
+    if (!cookie.first)
+        return 0;
     InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie.first);
     if (timelineAgent && timelineAgent->id() == cookie.second)
         return timelineAgent;
index 2ea4e4f..2759c12 100644 (file)
@@ -671,8 +671,8 @@ inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResou
 inline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
 {
 #if ENABLE(INSPECTOR)
-    if (hasFrontends() && cookie.first)
-        didReceiveResourceResponseImpl(cookie, identifier, loader, response);
+    // Call this unconditionally so that we're able to log to console with no front-end attached.
+    didReceiveResourceResponseImpl(cookie, identifier, loader, response);
 #endif
 }
 
@@ -695,7 +695,7 @@ inline void InspectorInstrumentation::didFinishLoading(Frame* frame, unsigned lo
 inline void InspectorInstrumentation::didFailLoading(Frame* frame, unsigned long identifier, const ResourceError& error)
 {
 #if ENABLE(INSPECTOR)
-    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
         didFailLoadingImpl(inspectorAgent, identifier, error);
 #endif
 }