Changeset 53292 in webkit


Ignore:
Timestamp:
Jan 14, 2010 3:05:38 PM (14 years ago)
Author:
Adam Roben
Message:

2010-01-14 Adam Roben <Adam Roben>

Add a test that shows onload still fires if a load of a <script src>
is cancelled by the resource load delegate

Tests for <http://webkit.org/b/33687> window.onload never fires if
page contains a <script src=foo> whose load is cancelled by resource
load delegate returning null from willSendRequest

Reviewed by Dave Hyatt.

  • fast/loader/onload-willSendRequest-null-for-script-expected.txt: Added.
  • fast/loader/onload-willSendRequest-null-for-script.html: Added.
  • platform/qt/Skipped: Added the new test since Qt doesn't have layoutTestController.setWillSendRequestReturnsNull.

2010-01-14 Adam Roben <Adam Roben>

Make Cache::requestResource return 0 if the resource's load fails
immediately

Fixes <http://webkit.org/b/33687> window.onload never fires if page
contains a <script src=foo> whose load is cancelled by resource load
delegate returning null from willSendRequest

Test: fast/loader/onload-willSendRequest-null-for-script.html

Reviewed by Dave Hyatt.

  • loader/Cache.cpp: (WebCore::Cache::requestResource): Moved code to handle immediate load failure out of the "cache is disabled" block so that it will run even when the cache is enabled.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r53291 r53292  
     12010-01-14  Adam Roben  <aroben@apple.com>
     2
     3        Add a test that shows onload still fires if a load of a <script src>
     4        is cancelled by the resource load delegate
     5
     6        Tests for <http://webkit.org/b/33687> window.onload never fires if
     7        page contains a <script src=foo> whose load is cancelled by resource
     8        load delegate returning null from willSendRequest
     9
     10        Reviewed by Dave Hyatt.
     11
     12        * fast/loader/onload-willSendRequest-null-for-script-expected.txt: Added.
     13        * fast/loader/onload-willSendRequest-null-for-script.html: Added.
     14
     15        * platform/qt/Skipped: Added the new test since Qt doesn't have
     16        layoutTestController.setWillSendRequestReturnsNull.
     17
    1182010-01-14  Stephen White  <senorblanco@chromium.org>
    219
  • trunk/LayoutTests/platform/qt/Skipped

    r53289 r53292  
    198198# Missing layoutTestController.setWillSendRequestReturnsNull()
    199199fast/loader/onload-willSendRequest-null-for-frame.html
     200fast/loader/onload-willSendRequest-null-for-script.html
    200201
    201202# Missing layoutTestController.setWillSendRequestReturnsNullOnRedirect()
  • trunk/WebCore/ChangeLog

    r53291 r53292  
     12010-01-14  Adam Roben  <aroben@apple.com>
     2
     3        Make Cache::requestResource return 0 if the resource's load fails
     4        immediately
     5
     6        Fixes <http://webkit.org/b/33687> window.onload never fires if page
     7        contains a <script src=foo> whose load is cancelled by resource load
     8        delegate returning null from willSendRequest
     9
     10        Test: fast/loader/onload-willSendRequest-null-for-script.html
     11
     12        Reviewed by Dave Hyatt.
     13
     14        * loader/Cache.cpp:
     15        (WebCore::Cache::requestResource): Moved code to handle immediate load
     16        failure out of the "cache is disabled" block so that it will run even
     17        when the cache is enabled.
     18
    1192010-01-14  Stephen White  <senorblanco@chromium.org>
    220
  • trunk/WebCore/loader/Cache.cpp

    r53151 r53292  
    125125        resource->load(docLoader);
    126126       
     127        if (resource->errorOccurred()) {
     128            // We don't support immediate loads, but we do support immediate failure.
     129            // In that case we should to delete the resource now and return 0 because otherwise
     130            // it would leak if no ref/deref was ever done on it.
     131            resource->setInCache(false);
     132            delete resource;
     133            return 0;
     134        }
     135
    127136        if (!disabled())
    128137            m_resources.set(url.string(), resource);  // The size will be added in later once the resource is loaded and calls back to us with the new size.
     
    131140            resource->setInCache(false);
    132141            resource->setDocLoader(docLoader);
    133             if (resource->errorOccurred()) {
    134                 // We don't support immediate loads, but we do support immediate failure.
    135                 // In that case we should to delete the resource now and return 0 because otherwise
    136                 // it would leak if no ref/deref was ever done on it.
    137                 delete resource;
    138                 return 0;
    139             }
    140142        }
    141143    }
Note: See TracChangeset for help on using the changeset viewer.