Changeset 112599 in webkit


Ignore:
Timestamp:
Mar 29, 2012 4:17:09 PM (12 years ago)
Author:
Nate Chapin
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):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r112596 r112599  
     12012-03-29  Nate Chapin  <japhet@chromium.org>
     2
     3        Simplify reporting a main resource error to DocumentLoader and
     4        FrameLoader.
     5        https://bugs.webkit.org/show_bug.cgi?id=82649
     6
     7        Reviewed by Adam Barth.
     8
     9        No new tests, no functionality change intended.
     10
     11        * loader/DocumentLoader.cpp:
     12        (WebCore::DocumentLoader::mainReceivedError): Remove isComplete parameter,
     13            since it was always true. Call FrameLoader::receivedMainResourceError,
     14            instead of the other way around.
     15        * loader/DocumentLoader.h:
     16        * loader/FrameLoader.cpp:
     17        (WebCore::FrameLoader::receivedMainResourceError): Remove isComplete parameter,
     18            since it was always true. Merge in most of mainReceivedCompleteError().
     19        * loader/FrameLoader.h:
     20        * loader/MainResourceLoader.cpp:
     21        (WebCore::MainResourceLoader::receivedError):
     22        (WebCore::MainResourceLoader::didCancel):
     23
    1242012-03-28  Jer Noble  <jer.noble@apple.com>
    225
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r112308 r112599  
    194194}
    195195
    196 void DocumentLoader::mainReceivedError(const ResourceError& error, bool isComplete)
     196void DocumentLoader::mainReceivedError(const ResourceError& error)
    197197{
    198198    ASSERT(!error.isNull());
     
    203203        return;
    204204    setMainDocumentError(error);
    205     if (isComplete)
    206         frameLoader()->mainReceivedCompleteError(this, error);
     205    setPrimaryLoadComplete(true);
     206    frameLoader()->receivedMainResourceError(error);
    207207}
    208208
     
    263263        // If there are no resource loaders, we need to manufacture a cancelled message.
    264264        // (A back/forward navigation has no resource loaders because its resources are cached.)
    265         mainReceivedError(frameLoader->cancelledError(m_request), true);
     265        mainReceivedError(frameLoader->cancelledError(m_request));
    266266   
    267267    stopLoadingSubresources();
  • trunk/Source/WebCore/loader/DocumentLoader.h

    r112308 r112599  
    117117        const ResourceResponse& response() const { return m_response; }
    118118        const ResourceError& mainDocumentError() const { return m_mainDocumentError; }
    119         void mainReceivedError(const ResourceError&, bool isComplete);
     119        void mainReceivedError(const ResourceError&);
    120120        void setResponse(const ResourceResponse& response) { m_response = response; }
    121121        void prepareForLoadStart();
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r112474 r112599  
    25952595}
    25962596
    2597 void FrameLoader::receivedMainResourceError(const ResourceError& error, bool isComplete)
     2597void FrameLoader::receivedMainResourceError(const ResourceError& error)
    25982598{
    25992599    // Retain because the stop may release the last reference to it.
     
    26012601
    26022602    RefPtr<DocumentLoader> loader = activeDocumentLoader();
    2603 
    2604     if (isComplete) {
    2605         // FIXME: Don't want to do this if an entirely new load is going, so should check
    2606         // that both data sources on the frame are either this or nil.
    2607         stop();
    2608         if (m_client->shouldFallBack(error))
    2609             handleFallbackContent();
    2610     }
     2603    // FIXME: Don't want to do this if an entirely new load is going, so should check
     2604    // that both data sources on the frame are either this or nil.
     2605    stop();
     2606    if (m_client->shouldFallBack(error))
     2607        handleFallbackContent();
    26112608
    26122609    if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) {
     
    26282625    }
    26292626
    2630     loader->mainReceivedError(error, isComplete);
     2627    checkCompleted();
     2628    if (m_frame->page())
     2629        checkLoadComplete();
    26312630}
    26322631
     
    30823081}
    30833082
    3084 void FrameLoader::mainReceivedCompleteError(DocumentLoader* loader, const ResourceError&)
    3085 {
    3086     loader->setPrimaryLoadComplete(true);
    3087     checkCompleted();
    3088     if (m_frame->page())
    3089         checkLoadComplete();
    3090 }
    3091 
    30923083ResourceError FrameLoader::cancelledError(const ResourceRequest& request) const
    30933084{
  • trunk/Source/WebCore/loader/FrameLoader.h

    r112184 r112599  
    151151    const ResourceRequest& originalRequest() const;
    152152    const ResourceRequest& initialRequest() const;
    153     void receivedMainResourceError(const ResourceError&, bool isComplete);
     153    void receivedMainResourceError(const ResourceError&);
    154154
    155155    bool willLoadMediaElementURL(KURL&);
     
    167167    bool isReplacing() const;
    168168    void setReplacing();
    169     void mainReceivedCompleteError(DocumentLoader*, const ResourceError&);
    170169    bool subframeIsLoading() const;
    171170    void willChangeTitle(DocumentLoader*);
  • trunk/Source/WebCore/loader/MainResourceLoader.cpp

    r111251 r112599  
    9191    RefPtr<Frame> protectFrame(m_frame);
    9292
    93     // It is important that we call FrameLoader::receivedMainResourceError before calling
    94     // FrameLoader::didFailToLoad because receivedMainResourceError clears out the relevant
    95     // document loaders. Also, receivedMainResourceError ends up calling a FrameLoadDelegate method
     93    // It is important that we call DocumentLoader::mainReceivedError before calling
     94    // ResourceLoadNotifier::didFailToLoad because mainReceivedError clears out the relevant
     95    // document loaders. Also, mainReceivedError ends up calling a FrameLoadDelegate method
    9696    // and didFailToLoad calls a ResourceLoadDelegate method and they need to be in the correct order.
    97     frameLoader()->receivedMainResourceError(error, true);
     97    documentLoader()->mainReceivedError(error);
    9898
    9999    if (!cancelled()) {
     
    123123    // We should notify the frame loader after fully canceling the load, because it can do complicated work
    124124    // like calling DOMWindow::print(), during which a half-canceled load could try to finish.
    125     frameLoader()->receivedMainResourceError(error, true);
     125    documentLoader()->mainReceivedError(error);
    126126}
    127127
Note: See TracChangeset for help on using the changeset viewer.