Skip to content
Permalink
Browse files
[Qt] QWebPage MIME type handling inconsistency with other web browsers
https://bugs.webkit.org/show_bug.cgi?id=46968

Source/WebCore:

Reviewed by Kenneth Rohde Christiansen.

Implementing mime type sniffing based on
http://tools.ietf.org/html/draft-abarth-mime-sniff-06.

* WebCore.pro:
* platform/network/MIMESniffing.cpp: Added.
(MagicNumbers::dataSizeNeededForImageSniffing):
(MagicNumbers::maskedCompare):
(MagicNumbers::checkSpaceOrBracket):
(MagicNumbers::compare):
(MagicNumbers::findMIMEType):
(MagicNumbers::findSimpleMIMEType):
(MagicNumbers::textOrBinaryTypeSniffingProcedure):
(MagicNumbers::unknownTypeSniffingProcedure):
(MagicNumbers::imageTypeSniffingProcedure):
(MagicNumbers::checkText):
(MagicNumbers::checkRDF):
(MagicNumbers::skipTag):
(MagicNumbers::feedTypeSniffingProcedure):
(MIMESniffer::MIMESniffer):
* platform/network/MIMESniffing.h: Added.
(MIMESniffer::dataSize):
(MIMESniffer::sniff):
(MIMESniffer::isValid):
* platform/network/NetworkingContext.h:
* platform/network/qt/QNetworkReplyHandler.cpp:
(WebCore::QNetworkReplyWrapper::QNetworkReplyWrapper):
(WebCore::QNetworkReplyWrapper::release):
(WebCore::QNetworkReplyWrapper::receiveMetaData):
(WebCore::QNetworkReplyWrapper::receiveSniffedMIMEType):
(WebCore::QNetworkReplyWrapper::emitMetaDataChanged):
(WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
(WebCore::QNetworkReplyHandler::sendNetworkRequest):
(WebCore::QNetworkReplyHandler::start):
* platform/network/qt/QNetworkReplyHandler.h:
(WebCore::QNetworkReplyWrapper::advertisedMIMEType):
(WebCore::QNetworkReplyWrapper::mimeType):
* platform/network/qt/QtMIMETypeSniffer.cpp: Added.
(QtMIMETypeSniffer::QtMIMETypeSniffer):
(QtMIMETypeSniffer::sniff):
(QtMIMETypeSniffer::trySniffing):
* platform/network/qt/QtMIMETypeSniffer.h: Added.
(QtMIMETypeSniffer::mimeType):
(QtMIMETypeSniffer::isFinished):

Source/WebKit/qt:

Reviewed by Kenneth Rohde Christiansen.

Implementing mime type sniffing based on
http://tools.ietf.org/html/draft-abarth-mime-sniff-06.

* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::createNetworkingContext):
* WebCoreSupport/FrameNetworkingContextQt.cpp:
(WebCore::FrameNetworkingContextQt::FrameNetworkingContextQt):
(WebCore::FrameNetworkingContextQt::create):
(WebCore::FrameNetworkingContextQt::MIMESniffingEnabled):
* WebCoreSupport/FrameNetworkingContextQt.h:
* tests/MIMESniffing/MIMESniffing.pro: Added.
* tests/MIMESniffing/TestData.h: Added.
* tests/MIMESniffing/resources.qrc: Added.
* tests/MIMESniffing/resources/application_atom+xml: Added.
* tests/MIMESniffing/resources/application_ogg: Added.
* tests/MIMESniffing/resources/application_pdf: Added.
* tests/MIMESniffing/resources/application_postscript: Added.
* tests/MIMESniffing/resources/application_rdf+xml: Added.
* tests/MIMESniffing/resources/application_rss+xml: Added.
* tests/MIMESniffing/resources/application_x-gzip: Added.
* tests/MIMESniffing/resources/application_x-rar-compressed: Added.
* tests/MIMESniffing/resources/application_zip: Added.
* tests/MIMESniffing/resources/audio_x-wave: Added.
* tests/MIMESniffing/resources/image_bmp: Added.
* tests/MIMESniffing/resources/image_gif: Added.
* tests/MIMESniffing/resources/image_jpeg: Added.
* tests/MIMESniffing/resources/image_png: Added.
* tests/MIMESniffing/resources/image_vnd.microsoft.icon: Added.
* tests/MIMESniffing/resources/image_webp: Added.
* tests/MIMESniffing/resources/text_html: Added.
* tests/MIMESniffing/resources/text_xml: Added.
* tests/MIMESniffing/resources/video_webm: Added.
* tests/MIMESniffing/tst_MIMESniffing.cpp: Added.
(tst_MIMESniffing::tst_MIMESniffing):
(errorText):
(tst_MIMESniffing::testCase1):
* tests/tests.pro:

Source/WebKit2:

Reviewed by Kenneth Rohde Christiansen.

Implementing mime type sniffing based on
http://tools.ietf.org/html/draft-abarth-mime-sniff-06.

* WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.cpp:
(WebCore::WebFrameNetworkingContext::WebFrameNetworkingContext):
(WebCore::WebFrameNetworkingContext::MIMESniffingEnabled):
* WebProcess/WebCoreSupport/qt/WebFrameNetworkingContext.h:

LayoutTests:

Rubberstamped by Andreas Kling.

Unskipping http/tests/loading/text-content-type-with-binary-extension.html.

* platform/qt/Skipped:

Canonical link: https://commits.webkit.org/73798@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84057 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Luiz Agostini committed Apr 16, 2011
1 parent cff037e commit 3d7391c5b7208c27587123cf138353ddaaa1726c
Showing 42 changed files with 2,240 additions and 37 deletions.
@@ -1,3 +1,14 @@
2011-04-15 Luiz Agostini <luiz.agostini@openbossa.org>

Rubberstamped by Andreas Kling.

[Qt] QWebPage MIME type handling inconsistency with other web browsers
https://bugs.webkit.org/show_bug.cgi?id=46968

Unskipping http/tests/loading/text-content-type-with-binary-extension.html.

* platform/qt/Skipped:

2011-04-15 Emil A Eklund <eae@chromium.org>

Reviewed by Dimitri Glazkov.
@@ -241,9 +241,6 @@ http/tests/security/dataURL/xss-DENIED-to-data-url-sub-frame-uppercase.html
http/tests/media
http/tests/wml

# - content sniffing - Binary data not loaded as text.
http/tests/loading/text-content-type-with-binary-extension.html

# drag n drop support again
http/tests/local/drag-over-remote-content.html
http/tests/local/fileapi
@@ -1,3 +1,54 @@
2011-04-08 Luiz Agostini <luiz.agostini@openbossa.org>

Reviewed by Kenneth Rohde Christiansen.

[Qt] QWebPage MIME type handling inconsistency with other web browsers
https://bugs.webkit.org/show_bug.cgi?id=46968

Implementing mime type sniffing based on
http://tools.ietf.org/html/draft-abarth-mime-sniff-06.

* WebCore.pro:
* platform/network/MIMESniffing.cpp: Added.
(MagicNumbers::dataSizeNeededForImageSniffing):
(MagicNumbers::maskedCompare):
(MagicNumbers::checkSpaceOrBracket):
(MagicNumbers::compare):
(MagicNumbers::findMIMEType):
(MagicNumbers::findSimpleMIMEType):
(MagicNumbers::textOrBinaryTypeSniffingProcedure):
(MagicNumbers::unknownTypeSniffingProcedure):
(MagicNumbers::imageTypeSniffingProcedure):
(MagicNumbers::checkText):
(MagicNumbers::checkRDF):
(MagicNumbers::skipTag):
(MagicNumbers::feedTypeSniffingProcedure):
(MIMESniffer::MIMESniffer):
* platform/network/MIMESniffing.h: Added.
(MIMESniffer::dataSize):
(MIMESniffer::sniff):
(MIMESniffer::isValid):
* platform/network/NetworkingContext.h:
* platform/network/qt/QNetworkReplyHandler.cpp:
(WebCore::QNetworkReplyWrapper::QNetworkReplyWrapper):
(WebCore::QNetworkReplyWrapper::release):
(WebCore::QNetworkReplyWrapper::receiveMetaData):
(WebCore::QNetworkReplyWrapper::receiveSniffedMIMEType):
(WebCore::QNetworkReplyWrapper::emitMetaDataChanged):
(WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
(WebCore::QNetworkReplyHandler::sendNetworkRequest):
(WebCore::QNetworkReplyHandler::start):
* platform/network/qt/QNetworkReplyHandler.h:
(WebCore::QNetworkReplyWrapper::advertisedMIMEType):
(WebCore::QNetworkReplyWrapper::mimeType):
* platform/network/qt/QtMIMETypeSniffer.cpp: Added.
(QtMIMETypeSniffer::QtMIMETypeSniffer):
(QtMIMETypeSniffer::sniff):
(QtMIMETypeSniffer::trySniffing):
* platform/network/qt/QtMIMETypeSniffer.h: Added.
(QtMIMETypeSniffer::mimeType):
(QtMIMETypeSniffer::isFinished):

2011-04-15 Emil A Eklund <eae@chromium.org>

Reviewed by Dimitri Glazkov.
@@ -2001,10 +2001,12 @@ HEADERS += \
platform/network/FormData.h \
platform/network/HTTPHeaderMap.h \
platform/network/HTTPParsers.h \
platform/network/MIMESniffing.h \
platform/network/NetworkingContext.h \
platform/network/NetworkStateNotifier.h \
platform/network/ProtectionSpace.h \
platform/network/ProxyServer.h \
platform/network/qt/QtMIMETypeSniffer.h \
platform/network/qt/QNetworkReplyHandler.h \
platform/network/ResourceErrorBase.h \
platform/network/ResourceHandle.h \
@@ -2516,11 +2518,13 @@ SOURCES += \
platform/graphics/qt/PathQt.cpp \
platform/graphics/qt/PatternQt.cpp \
platform/graphics/qt/StillImageQt.cpp \
platform/network/MIMESniffing.cpp \
platform/network/qt/CredentialStorageQt.cpp \
platform/network/qt/ResourceHandleQt.cpp \
platform/network/qt/ResourceRequestQt.cpp \
platform/network/qt/DnsPrefetchHelper.cpp \
platform/network/qt/ProxyServerQt.cpp \
platform/network/qt/QtMIMETypeSniffer.cpp \
platform/network/qt/QNetworkReplyHandler.cpp \
editing/qt/EditorQt.cpp \
editing/qt/SmartReplaceQt.cpp \

0 comments on commit 3d7391c

Please sign in to comment.