Changeset 30438 in webkit


Ignore:
Timestamp:
Feb 20, 2008 5:59:14 PM (16 years ago)
Author:
hyatt@apple.com
Message:

Fix for bug 16760, incorrect <object> MIME type handling and fallback
handling.

Reviewed by darin

  • html/HTMLImageLoader.cpp: (WebCore::HTMLImageLoader::notifyFinished): If the image had an error, make sure to do <object> fallback.
  • html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::renderFallbackContent): Before doing fallback check if there is a MIME type mismatch between an image type and a non-image type. If so, detach and re-attach after storing the correct MIME type.
  • loader/loader.cpp: (WebCore::Loader::didReceiveData): Consider it an error when a 404 is encountered on a CachedResource load.
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r30437 r30438  
     12008-02-20  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for bug 16760, incorrect <object> MIME type handling and fallback
     4        handling.
     5
     6        Reviewed by darin
     7
     8        * html/HTMLImageLoader.cpp:
     9        (WebCore::HTMLImageLoader::notifyFinished):
     10        If the image had an error, make sure to do <object> fallback.
     11
     12        * html/HTMLObjectElement.cpp:
     13        (WebCore::HTMLObjectElement::renderFallbackContent):
     14        Before doing fallback check if there is a MIME type mismatch between
     15        an image type and a non-image type.  If so, detach and re-attach after
     16        storing the correct MIME type.
     17
     18        * loader/loader.cpp:
     19        (WebCore::Loader::didReceiveData):
     20        Consider it an error when a 404 is encountered on a CachedResource load.
     21
    1222008-02-20  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/WebCore/html/HTMLImageLoader.cpp

    r27465 r30438  
    3030#include "EventNames.h"
    3131#include "HTMLNames.h"
     32#include "HTMLObjectElement.h"
    3233#include "RenderImage.h"
    3334
     
    143144        if (renderer->isImage())
    144145            static_cast<RenderImage*>(renderer)->setCachedImage(m_image);
     146           
     147    if (image->errorOccurred() && elem->hasTagName(objectTag))
     148        static_cast<HTMLObjectElement*>(elem)->renderFallbackContent();
    145149}
    146150
  • trunk/WebCore/html/HTMLObjectElement.cpp

    r30243 r30438  
    287287        return;
    288288
     289    // Before we give up and use fallback content, check to see if this is a MIME type issue.
     290    if (m_imageLoader && m_imageLoader->image()) {
     291        m_serviceType = m_imageLoader->image()->response().mimeType();
     292        if (!isImageType()) {
     293            detach();
     294            attach();
     295            return;
     296        }
     297    }
     298
    289299    // Mark ourselves as using the fallback content.
    290300    m_useFallbackContent = true;
  • trunk/WebCore/loader/loader.cpp

    r30243 r30438  
    195195
    196196    CachedResource* object = request->cachedResource();   
     197    if (object->errorOccurred())
     198        return;
     199   
     200    if (object->response().httpStatusCode() / 100 == 4) {
     201        // Make sure the 4xx error codes result in an error.
     202        object->error();
     203        return;
     204    }
    197205
    198206    // Set the data.
Note: See TracChangeset for help on using the changeset viewer.