diff options
Diffstat (limited to 'WebCore/loader/ImageLoader.cpp')
-rw-r--r-- | WebCore/loader/ImageLoader.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/WebCore/loader/ImageLoader.cpp b/WebCore/loader/ImageLoader.cpp index da159b4..43e08c0 100644 --- a/WebCore/loader/ImageLoader.cpp +++ b/WebCore/loader/ImageLoader.cpp @@ -49,6 +49,7 @@ ImageLoader::~ImageLoader() void ImageLoader::setImage(CachedImage* newImage) { + ASSERT(m_failedLoadURL.isEmpty()); CachedImage* oldImage = m_image.get(); if (newImage != oldImage) { setLoadingImage(newImage); @@ -86,6 +87,9 @@ void ImageLoader::updateFromElement() AtomicString attr = elem->getAttribute(elem->imageSourceAttributeName()); + if (attr == m_failedLoadURL) + return; + // Do not load any image if the 'src' attribute is missing or if it is // an empty string referring to a local file. The latter condition is // a quirk that preserves old behavior that Dashboard widgets @@ -97,9 +101,13 @@ void ImageLoader::updateFromElement() newImage = new CachedImage(sourceURI(attr)); newImage->setLoading(true); newImage->setDocLoader(doc->docLoader()); - doc->docLoader()->m_docResources.set(newImage->url(), newImage); + doc->docLoader()->m_documentResources.set(newImage->url(), newImage); } else newImage = doc->docLoader()->requestImage(sourceURI(attr)); + + // If we do not have an image here, it means that a cross-site + // violation occurred. + m_failedLoadURL = !newImage ? attr : AtomicString(); } CachedImage* oldImage = m_image.get(); @@ -119,8 +127,16 @@ void ImageLoader::updateFromElement() } } -void ImageLoader::notifyFinished(CachedResource *image) +void ImageLoader::updateFromElementIgnoringPreviousError() +{ + // Clear previous error. + m_failedLoadURL = AtomicString(); + updateFromElement(); +} + +void ImageLoader::notifyFinished(CachedResource*) { + ASSERT(m_failedLoadURL.isEmpty()); m_imageComplete = true; Element* elem = element(); |