Changeset 64679 in webkit
- Timestamp:
- Aug 4, 2010 2:26:22 PM (14 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qwebframe.cpp
r64284 r64679 37 37 #include "HTMLMetaElement.h" 38 38 #include "HitTestResult.h" 39 #include "HTTPParsers.h" 39 40 #include "IconDatabase.h" 40 41 #include "InspectorController.h" … … 831 832 WebCore::ResourceRequest request(kurl); 832 833 WTF::RefPtr<WebCore::SharedBuffer> buffer = WebCore::SharedBuffer::create(data.constData(), data.length()); 833 QString actualMimeType = mimeType; 834 if (actualMimeType.isEmpty()) 834 QString actualMimeType; 835 WebCore::String encoding; 836 if (mimeType.isEmpty()) 835 837 actualMimeType = QLatin1String("text/html"); 836 WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), WebCore::String(), KURL()); 838 else { 839 actualMimeType = extractMIMETypeFromMediaType(mimeType); 840 encoding = extractCharsetFromMediaType(mimeType); 841 } 842 WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), encoding, KURL()); 837 843 d->frame->loader()->load(request, substituteData, false); 838 844 } -
trunk/WebKit/qt/ChangeLog
r64621 r64679 1 2010-08-04 Pierre Rossi <pierre.rossi@nokia.com> 2 3 Reviewed by Antonio Gomes. 4 5 [Qt] QWebFrame::setContent() does not respect charset provided in the mimeType 6 https://bugs.webkit.org/show_bug.cgi?id=43125 7 8 * Api/qwebframe.cpp: 9 (QWebFrame::setContent): 10 * tests/qwebframe/tst_qwebframe.cpp: 11 1 12 2010-08-03 Noam Rosenthal <noam.rosenthal@nokia.com> 2 13 -
trunk/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
r64036 r64679 34 34 #include <QNetworkRequest> 35 35 #include <QNetworkReply> 36 #include <QTextCodec> 36 37 #ifndef QT_NO_OPENSSL 37 38 #include <qsslerror.h> … … 626 627 void introspectQtMethods_data(); 627 628 void introspectQtMethods(); 629 void setContent_data(); 630 void setContent(); 628 631 629 632 private: … … 3102 3105 } 3103 3106 3107 void tst_QWebFrame::setContent_data() 3108 { 3109 QTest::addColumn<QString>("mimeType"); 3110 QTest::addColumn<QByteArray>("testContents"); 3111 QTest::addColumn<QString>("expected"); 3112 3113 QString str = QString::fromUtf8("ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει"); 3114 QTest::newRow("UTF-8 plain text") << "text/plain; charset=utf-8" << str.toUtf8() << str; 3115 3116 QTextCodec *utf16 = QTextCodec::codecForName("UTF-16"); 3117 if (utf16) 3118 QTest::newRow("UTF-16 plain text") << "text/plain; charset=utf-16" << utf16->fromUnicode(str) << str; 3119 3120 str = QString::fromUtf8("Une chaîne de caractères à sa façon."); 3121 QTest::newRow("latin-1 plain text") << "text/plain; charset=iso-8859-1" << str.toLatin1() << str; 3122 3123 3124 } 3125 3126 void tst_QWebFrame::setContent() 3127 { 3128 QFETCH(QString, mimeType); 3129 QFETCH(QByteArray, testContents); 3130 QFETCH(QString, expected); 3131 m_view->setContent(testContents, mimeType); 3132 QWebFrame* mainFrame = m_view->page()->mainFrame(); 3133 QCOMPARE(expected , mainFrame->toPlainText()); 3134 } 3135 3104 3136 QTEST_MAIN(tst_QWebFrame) 3105 3137 #include "tst_qwebframe.moc"
Note: See TracChangeset
for help on using the changeset viewer.