Commit 359dcb61 authored by beidson@apple.com's avatar beidson@apple.com

2009-05-04 Brady Eidson <beidson@apple.com>

        Reviewed by Darin Adler.

        <rdar://problem/6839881> With "Mail Contents of This Page" in Safari images don't appear in the Tiger Mail compose window

        DocumentLoader::subresource() is the implementation for the WebKit API [WebDataSource subresourceForURL:] and has 
        particularly sticky behavior.  

        If the DocumentLoader represents a WebArchive, this method should return ArchiveResources from that archive.  However, we 
        prefer CachedResources over ArchiveResources because they might represent fresher data than what was originally loaded 
        from the WebArchive.

        In some instances, CachedResources are created and associated with the DocumentLoader but not immediately run through the 
        loading delegate machinery.  This was always a possibility, but the Preload Scanner made this significantly more likely.

        When this happens and someone asks the WebDataSource for a subresource, it would prefer the CachedResource over an 
        ArchiveResource it has even if the CachedResource hasn't been loaded yet.  The CachedResource has nil data, so no
        WebResource is returned, and the client thinks the subresource doesn't exist even though it does.

        This broke Tiger Mail and probably various other WebKit applications but has a fairly straightforward fix.

        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::subresource): If there is a CachedResource but it hasn't been loaded yet, fallback to the
          ArchiveResource.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43183 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 36756dde
2009-05-04 Brady Eidson <beidson@apple.com>
Reviewed by Darin Adler.
<rdar://problem/6839881> With "Mail Contents of This Page" in Safari images don't appear in the Tiger Mail compose window
DocumentLoader::subresource() is the implementation for the WebKit API [WebDataSource subresourceForURL:] and has
particularly sticky behavior.
If the DocumentLoader represents a WebArchive, this method should return ArchiveResources from that archive. However, we
prefer CachedResources over ArchiveResources because they might represent fresher data than what was originally loaded
from the WebArchive.
In some instances, CachedResources are created and associated with the DocumentLoader but not immediately run through the
loading delegate machinery. This was always a possibility, but the Preload Scanner made this significantly more likely.
When this happens and someone asks the WebDataSource for a subresource, it would prefer the CachedResource over an
ArchiveResource it has even if the CachedResource hasn't been loaded yet. The CachedResource has nil data, so no
WebResource is returned, and the client thinks the subresource doesn't exist even though it does.
This broke Tiger Mail and probably various other WebKit applications but has a fairly straightforward fix.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::subresource): If there is a CachedResource but it hasn't been loaded yet, fallback to the
ArchiveResource.
2009-05-04 Eric Carlson <eric.carlson@apple.com>
Reviewed by Adam Roben.
......@@ -554,7 +554,7 @@ PassRefPtr<ArchiveResource> DocumentLoader::subresource(const KURL& url) const
return 0;
CachedResource* resource = m_frame->document()->docLoader()->cachedResource(url);
if (!resource)
if (!resource || !resource->isLoaded())
return archiveResourceForURL(url);
// FIXME: This has the side effect of making the resource non-purgeable.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment