diff options
Diffstat (limited to 'WebCore/loader/ImageDocument.cpp')
-rw-r--r-- | WebCore/loader/ImageDocument.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/WebCore/loader/ImageDocument.cpp b/WebCore/loader/ImageDocument.cpp index ca3f785..08f2e9a 100644 --- a/WebCore/loader/ImageDocument.cpp +++ b/WebCore/loader/ImageDocument.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "ImageDocument.h" +#include "CSSStyleDeclaration.h" #include "CachedImage.h" #include "DocumentLoader.h" #include "Element.h" @@ -37,6 +38,7 @@ #include "HTMLNames.h" #include "LocalizedStrings.h" #include "MouseEvent.h" +#include "NotImplemented.h" #include "Page.h" #include "SegmentedString.h" #include "Settings.h" @@ -93,7 +95,8 @@ private: void ImageTokenizer::write(const SegmentedString&, bool) { - ASSERT_NOT_REACHED(); + // <https://bugs.webkit.org/show_bug.cgi?id=25397>: JS code can always call document.write, we need to handle it. + notImplemented(); } bool ImageTokenizer::writeRawData(const char*, int) @@ -124,9 +127,9 @@ void ImageTokenizer::finish() IntSize size = cachedImage->imageSize(m_doc->frame()->pageZoomFactor()); if (size.width()) { - // Compute the title, we use the filename of the resource, falling - // back on the hostname if there is no path. - String fileName = m_doc->url().lastPathComponent(); + // Compute the title, we use the decoded filename of the resource, falling + // back on the (decoded) hostname if there is no path. + String fileName = decodeURLEscapeSequences(m_doc->url().lastPathComponent()); if (fileName.isEmpty()) fileName = m_doc->url().host(); m_doc->setTitle(imageTitle(fileName, size)); @@ -184,7 +187,8 @@ void ImageDocument::createDocumentStructure() if (shouldShrinkToFit()) { // Add event listeners RefPtr<EventListener> listener = ImageEventListener::create(this); - addWindowEventListener("resize", listener, false); + if (DOMWindow* domWindow = this->domWindow()) + domWindow->addEventListener("resize", listener, false); imageElement->addEventListener("click", listener.release(), false); } |