diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-02-28 12:30:36 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-28 12:48:59 +0100 |
commit | ae197e4992d9f8c63bf5d0c0f72f712dbe09b1ae (patch) | |
tree | fafd8f6c27b77535ebd4cdc3409f9cb834a5e35b | |
parent | 6cec10879f382bbd007a5a3819d37e49de2c3c7a (diff) | |
download | qtwebkit-ae197e4992d9f8c63bf5d0c0f72f712dbe09b1ae.tar.gz |
Treat qrc protocol the same as file protocol in loading
KUrl's with qrc protocol was not recognized as local files which
triggered mimetype sniffing that doesn't support SVG and break it.
This patch makes qrc urls be treated as local files and modifies the
one place were KURL::isLocalFile depended on the protocol being exactly
"file" and not "qrc".
Task-number: QTBUG-37058
Change-Id: Iad35ebc1fd72049484d2efa1f9caee96060fb236
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
-rw-r--r-- | Source/WebCore/platform/KURL.cpp | 4 | ||||
-rw-r--r-- | Source/WebCore/platform/network/ResourceHandle.cpp | 2 | ||||
-rw-r--r-- | Source/WebCore/platform/qt/KURLQt.cpp | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/Source/WebCore/platform/KURL.cpp b/Source/WebCore/platform/KURL.cpp index 2a00ac324..014d3d738 100644 --- a/Source/WebCore/platform/KURL.cpp +++ b/Source/WebCore/platform/KURL.cpp @@ -1752,7 +1752,11 @@ bool KURL::isLocalFile() const // and including feed would allow feeds to potentially let someone's blog // read the contents of the clipboard on a drag, even without a drop. // Likewise with using the FrameLoader::shouldTreatURLAsLocal() function. +#if PLATFORM(QT) + return protocolIs("file") || protocolIs("qrc"); +#else return protocolIs("file"); +#endif } bool protocolIsJavaScript(const String& url) diff --git a/Source/WebCore/platform/network/ResourceHandle.cpp b/Source/WebCore/platform/network/ResourceHandle.cpp index cd768f290..0ea9d1c34 100644 --- a/Source/WebCore/platform/network/ResourceHandle.cpp +++ b/Source/WebCore/platform/network/ResourceHandle.cpp @@ -212,7 +212,7 @@ bool ResourceHandle::shouldContentSniffURL(const KURL& url) return true; #endif // We shouldn't content sniff file URLs as their MIME type should be established via their extension. - return !url.protocolIs("file"); + return !url.isLocalFile(); } void ResourceHandle::forceContentSniffing() diff --git a/Source/WebCore/platform/qt/KURLQt.cpp b/Source/WebCore/platform/qt/KURLQt.cpp index 3dca4eee0..46d771f22 100644 --- a/Source/WebCore/platform/qt/KURLQt.cpp +++ b/Source/WebCore/platform/qt/KURLQt.cpp @@ -42,7 +42,7 @@ String KURL::fileSystemPath() const if (!isValid()) return String(); - if (isLocalFile()) + if (protocolIs("file")) return static_cast<QUrl>(*this).toLocalFile(); // A valid qrc resource path begins with a colon. |