Changeset 119759 in webkit


Ignore:
Timestamp:
Jun 7, 2012 3:08:53 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebCore: Should fire error event for empty 404 script
https://bugs.webkit.org/show_bug.cgi?id=50589

Patch by Edaena Salinas Jasso <edaena@apple.com> on 2012-06-07
Reviewed by Brady Eidson.

Tests:
http/tests/loading/fire-error-event-empty-404-script.html
http/tests/loading/fire-error-script-no-content-type.html

  • loader/SubresourceLoader.cpp:

(WebCore::SubresourceLoader::didReceiveResponse): We should check for http status
codes here to stop depending on the response being non-empty.
(WebCore::SubresourceLoader::didReceiveData): Moved the http status check but
avoid messing with multipart responses.
(WebCore::SubresourceLoader::checkForHTTPStatusCodeError): Renamed from
errorLoadingResource for clarity.

  • loader/SubresourceLoader.h:
  • loader/cf/SubresourceLoaderCF.cpp:

(WebCore::SubresourceLoader::didReceiveDataArray):
Updated for errorLoadingResource renaming.

LayoutTests: Should fire error event for empty 404 script
https://bugs.webkit.org/show_bug.cgi?id=50589

Patch by Edaena Salinas Jasso <edaena@apple.com> on 2012-06-07
Reviewed by Brady Eidson.

Based on a test by Ojan Vafai.

  • http/tests/loading/fire-error-event-empty-404-script-expected.txt: Added.
  • http/tests/loading/fire-error-event-empty-404-script.html: Added.
  • http/tests/loading/fire-error-event-script-no-content-type-expected.txt: Added.
  • http/tests/loading/fire-error-event-script-no-content-type.html: Added.
  • http/tests/loading/resources/404-with-empty-body-no-content-type.cgi: Added.
  • http/tests/loading/resources/404-with-empty-body.cgi: Added.
  • http/tests/resources/network-simulator.php: Fixed to no longer return 404 error

when logging a request.

Location:
trunk
Files:
6 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r119756 r119759  
     12012-06-07  Edaena Salinas Jasso  <edaena@apple.com>
     2
     3        Should fire error event for empty 404 script
     4        https://bugs.webkit.org/show_bug.cgi?id=50589
     5
     6        Reviewed by Brady Eidson.
     7
     8        Based on a test by Ojan Vafai.
     9
     10        * http/tests/loading/fire-error-event-empty-404-script-expected.txt: Added.
     11        * http/tests/loading/fire-error-event-empty-404-script.html: Added.
     12        * http/tests/loading/fire-error-event-script-no-content-type-expected.txt: Added.
     13        * http/tests/loading/fire-error-event-script-no-content-type.html: Added.
     14        * http/tests/loading/resources/404-with-empty-body-no-content-type.cgi: Added.
     15        * http/tests/loading/resources/404-with-empty-body.cgi: Added.
     16        * http/tests/resources/network-simulator.php: Fixed to no longer return 404 error
     17        when logging a request.
     18
    1192012-06-07  Ojan Vafai  <ojan@chromium.org>
    220
  • trunk/LayoutTests/http/tests/resources/network-simulator.php

    r71196 r119759  
    153153    // Documentation says that appends are atomic.
    154154    file_put_contents($resourceLogFile, $newData, FILE_APPEND);
    155     generateResponse($path);
    156155}
    157156
  • trunk/Source/WebCore/ChangeLog

    r119755 r119759  
     12012-06-07  Edaena Salinas Jasso  <edaena@apple.com>
     2
     3        Should fire error event for empty 404 script
     4        https://bugs.webkit.org/show_bug.cgi?id=50589
     5       
     6        Reviewed by Brady Eidson.
     7
     8        Tests:
     9        http/tests/loading/fire-error-event-empty-404-script.html
     10        http/tests/loading/fire-error-script-no-content-type.html
     11
     12        * loader/SubresourceLoader.cpp:
     13        (WebCore::SubresourceLoader::didReceiveResponse): We should check for http status
     14        codes here to stop depending on the response being non-empty.
     15        (WebCore::SubresourceLoader::didReceiveData): Moved the http status check but
     16        avoid messing with multipart responses.
     17        (WebCore::SubresourceLoader::checkForHTTPStatusCodeError): Renamed from
     18        errorLoadingResource for clarity.
     19
     20        * loader/SubresourceLoader.h:
     21        * loader/cf/SubresourceLoaderCF.cpp:
     22        (WebCore::SubresourceLoader::didReceiveDataArray):
     23        Updated for errorLoadingResource renaming.
     24
    1252012-06-07  Konrad Piascik  <kpiascik@rim.com>
    226
  • trunk/Source/WebCore/loader/SubresourceLoader.cpp

    r118618 r119759  
    210210        didFinishLoadingOnePart(0);
    211211    }
     212
     213    checkForHTTPStatusCodeError();
    212214}
    213215
     
    222224    ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce);
    223225
    224     if (errorLoadingResource() || m_loadingMultipartContent)
     226    if (m_loadingMultipartContent)
    225227        return;
    226228
     
    228230}
    229231
    230 bool SubresourceLoader::errorLoadingResource()
     232bool SubresourceLoader::checkForHTTPStatusCodeError()
    231233{
    232234    if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnoreHTTPStatusCodeErrors())
  • trunk/Source/WebCore/loader/SubresourceLoader.h

    r105226 r119759  
    7373    virtual void releaseResources();
    7474
    75     bool errorLoadingResource();
     75    bool checkForHTTPStatusCodeError();
    7676    void sendDataToResource(const char*, int);
    7777
  • trunk/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp

    r104407 r119759  
    3737    ResourceLoader::didReceiveDataArray(dataArray);
    3838
    39     if (errorLoadingResource())
     39    if (checkForHTTPStatusCodeError())
    4040        return;
    4141
Note: See TracChangeset for help on using the changeset viewer.