Title: [112599] trunk/Source/WebCore
Revision
112599
Author
[email protected]
Date
2012-03-29 16:17:09 -0700 (Thu, 29 Mar 2012)

Log Message

Simplify reporting a main resource error to DocumentLoader and
FrameLoader.
https://bugs.webkit.org/show_bug.cgi?id=82649

Reviewed by Adam Barth.

No new tests, no functionality change intended.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::mainReceivedError): Remove isComplete parameter,
    since it was always true. Call FrameLoader::receivedMainResourceError,
    instead of the other way around.
* loader/DocumentLoader.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::receivedMainResourceError): Remove isComplete parameter,
    since it was always true. Merge in most of mainReceivedCompleteError().
* loader/FrameLoader.h:
* loader/MainResourceLoader.cpp:
(WebCore::MainResourceLoader::receivedError):
(WebCore::MainResourceLoader::didCancel):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (112598 => 112599)


--- trunk/Source/WebCore/ChangeLog	2012-03-29 23:16:33 UTC (rev 112598)
+++ trunk/Source/WebCore/ChangeLog	2012-03-29 23:17:09 UTC (rev 112599)
@@ -1,3 +1,26 @@
+2012-03-29  Nate Chapin  <[email protected]>
+
+        Simplify reporting a main resource error to DocumentLoader and
+        FrameLoader.
+        https://bugs.webkit.org/show_bug.cgi?id=82649
+
+        Reviewed by Adam Barth.
+
+        No new tests, no functionality change intended.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::mainReceivedError): Remove isComplete parameter,
+            since it was always true. Call FrameLoader::receivedMainResourceError,
+            instead of the other way around.
+        * loader/DocumentLoader.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::receivedMainResourceError): Remove isComplete parameter,
+            since it was always true. Merge in most of mainReceivedCompleteError().
+        * loader/FrameLoader.h:
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::receivedError):
+        (WebCore::MainResourceLoader::didCancel):
+
 2012-03-28  Jer Noble  <[email protected]>
 
         Heap-use-after-free in WebCore::InlineFlowBox::deleteLine due to fullscreen issues.

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (112598 => 112599)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2012-03-29 23:16:33 UTC (rev 112598)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2012-03-29 23:17:09 UTC (rev 112599)
@@ -193,7 +193,7 @@
     m_mainDocumentError = ResourceError();
 }
 
-void DocumentLoader::mainReceivedError(const ResourceError& error, bool isComplete)
+void DocumentLoader::mainReceivedError(const ResourceError& error)
 {
     ASSERT(!error.isNull());
 
@@ -202,8 +202,8 @@
     if (!frameLoader())
         return;
     setMainDocumentError(error);
-    if (isComplete)
-        frameLoader()->mainReceivedCompleteError(this, error);
+    setPrimaryLoadComplete(true);
+    frameLoader()->receivedMainResourceError(error);
 }
 
 // Cancels the data source's pending loads.  Conceptually, a data source only loads
@@ -262,7 +262,7 @@
     else
         // If there are no resource loaders, we need to manufacture a cancelled message.
         // (A back/forward navigation has no resource loaders because its resources are cached.)
-        mainReceivedError(frameLoader->cancelledError(m_request), true);
+        mainReceivedError(frameLoader->cancelledError(m_request));
     
     stopLoadingSubresources();
     stopLoadingPlugIns();

Modified: trunk/Source/WebCore/loader/DocumentLoader.h (112598 => 112599)


--- trunk/Source/WebCore/loader/DocumentLoader.h	2012-03-29 23:16:33 UTC (rev 112598)
+++ trunk/Source/WebCore/loader/DocumentLoader.h	2012-03-29 23:17:09 UTC (rev 112599)
@@ -116,7 +116,7 @@
         void finishedLoading();
         const ResourceResponse& response() const { return m_response; }
         const ResourceError& mainDocumentError() const { return m_mainDocumentError; }
-        void mainReceivedError(const ResourceError&, bool isComplete);
+        void mainReceivedError(const ResourceError&);
         void setResponse(const ResourceResponse& response) { m_response = response; }
         void prepareForLoadStart();
         bool isClientRedirect() const { return m_isClientRedirect; }

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (112598 => 112599)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2012-03-29 23:16:33 UTC (rev 112598)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2012-03-29 23:17:09 UTC (rev 112599)
@@ -2594,21 +2594,18 @@
     return activeDocumentLoader()->originalRequestCopy();
 }
 
-void FrameLoader::receivedMainResourceError(const ResourceError& error, bool isComplete)
+void FrameLoader::receivedMainResourceError(const ResourceError& error)
 {
     // Retain because the stop may release the last reference to it.
     RefPtr<Frame> protect(m_frame);
 
     RefPtr<DocumentLoader> loader = activeDocumentLoader();
+    // FIXME: Don't want to do this if an entirely new load is going, so should check
+    // that both data sources on the frame are either this or nil.
+    stop();
+    if (m_client->shouldFallBack(error))
+        handleFallbackContent();
 
-    if (isComplete) {
-        // FIXME: Don't want to do this if an entirely new load is going, so should check
-        // that both data sources on the frame are either this or nil.
-        stop();
-        if (m_client->shouldFallBack(error))
-            handleFallbackContent();
-    }
-
     if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) {
         if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCopy().url())
             m_submittedFormURL = KURL();
@@ -2627,7 +2624,9 @@
             clientRedirectCancelledOrFinished(false);
     }
 
-    loader->mainReceivedError(error, isComplete);
+    checkCompleted();
+    if (m_frame->page())
+        checkLoadComplete();
 }
 
 void FrameLoader::callContinueFragmentScrollAfterNavigationPolicy(void* argument,
@@ -3081,14 +3080,6 @@
         loadDifferentDocumentItem(item, loadType);
 }
 
-void FrameLoader::mainReceivedCompleteError(DocumentLoader* loader, const ResourceError&)
-{
-    loader->setPrimaryLoadComplete(true);
-    checkCompleted();
-    if (m_frame->page())
-        checkLoadComplete();
-}
-
 ResourceError FrameLoader::cancelledError(const ResourceRequest& request) const
 {
     ResourceError error = m_client->cancelledError(request);

Modified: trunk/Source/WebCore/loader/FrameLoader.h (112598 => 112599)


--- trunk/Source/WebCore/loader/FrameLoader.h	2012-03-29 23:16:33 UTC (rev 112598)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2012-03-29 23:17:09 UTC (rev 112599)
@@ -150,7 +150,7 @@
 
     const ResourceRequest& originalRequest() const;
     const ResourceRequest& initialRequest() const;
-    void receivedMainResourceError(const ResourceError&, bool isComplete);
+    void receivedMainResourceError(const ResourceError&);
 
     bool willLoadMediaElementURL(KURL&);
 
@@ -166,7 +166,6 @@
     void finishedLoadingDocument(DocumentLoader*);
     bool isReplacing() const;
     void setReplacing();
-    void mainReceivedCompleteError(DocumentLoader*, const ResourceError&);
     bool subframeIsLoading() const;
     void willChangeTitle(DocumentLoader*);
     void didChangeTitle(DocumentLoader*);

Modified: trunk/Source/WebCore/loader/MainResourceLoader.cpp (112598 => 112599)


--- trunk/Source/WebCore/loader/MainResourceLoader.cpp	2012-03-29 23:16:33 UTC (rev 112598)
+++ trunk/Source/WebCore/loader/MainResourceLoader.cpp	2012-03-29 23:17:09 UTC (rev 112599)
@@ -90,11 +90,11 @@
     RefPtr<MainResourceLoader> protect(this);
     RefPtr<Frame> protectFrame(m_frame);
 
-    // It is important that we call FrameLoader::receivedMainResourceError before calling 
-    // FrameLoader::didFailToLoad because receivedMainResourceError clears out the relevant
-    // document loaders. Also, receivedMainResourceError ends up calling a FrameLoadDelegate method
+    // It is important that we call DocumentLoader::mainReceivedError before calling 
+    // ResourceLoadNotifier::didFailToLoad because mainReceivedError clears out the relevant
+    // document loaders. Also, mainReceivedError ends up calling a FrameLoadDelegate method
     // and didFailToLoad calls a ResourceLoadDelegate method and they need to be in the correct order.
-    frameLoader()->receivedMainResourceError(error, true);
+    documentLoader()->mainReceivedError(error);
 
     if (!cancelled()) {
         ASSERT(!reachedTerminalState());
@@ -122,7 +122,7 @@
 {
     // We should notify the frame loader after fully canceling the load, because it can do complicated work
     // like calling DOMWindow::print(), during which a half-canceled load could try to finish.
-    frameLoader()->receivedMainResourceError(error, true);
+    documentLoader()->mainReceivedError(error);
 }
 
 ResourceError MainResourceLoader::interruptedForPolicyChangeError() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to