[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 11:43:01 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit bef62ac54d102a917b1da11f5ac00dc132cbb5bd
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Aug 4 21:26:22 2010 +0000
2010-08-04 Pierre Rossi <pierre.rossi at nokia.com>
Reviewed by Antonio Gomes.
[Qt] QWebFrame::setContent() does not respect charset provided in the mimeType
https://bugs.webkit.org/show_bug.cgi?id=43125
* Api/qwebframe.cpp:
(QWebFrame::setContent):
* tests/qwebframe/tst_qwebframe.cpp:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
index e90367e..8620290 100644
--- a/WebKit/qt/Api/qwebframe.cpp
+++ b/WebKit/qt/Api/qwebframe.cpp
@@ -36,6 +36,7 @@
#include "GraphicsContext.h"
#include "HTMLMetaElement.h"
#include "HitTestResult.h"
+#include "HTTPParsers.h"
#include "IconDatabase.h"
#include "InspectorController.h"
#include "JSDOMBinding.h"
@@ -830,10 +831,15 @@ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, cons
KURL kurl(baseUrl);
WebCore::ResourceRequest request(kurl);
WTF::RefPtr<WebCore::SharedBuffer> buffer = WebCore::SharedBuffer::create(data.constData(), data.length());
- QString actualMimeType = mimeType;
- if (actualMimeType.isEmpty())
+ QString actualMimeType;
+ WebCore::String encoding;
+ if (mimeType.isEmpty())
actualMimeType = QLatin1String("text/html");
- WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), WebCore::String(), KURL());
+ else {
+ actualMimeType = extractMIMETypeFromMediaType(mimeType);
+ encoding = extractCharsetFromMediaType(mimeType);
+ }
+ WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), encoding, KURL());
d->frame->loader()->load(request, substituteData, false);
}
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index ef37fa6..38e1ceb 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,14 @@
+2010-08-04 Pierre Rossi <pierre.rossi at nokia.com>
+
+ Reviewed by Antonio Gomes.
+
+ [Qt] QWebFrame::setContent() does not respect charset provided in the mimeType
+ https://bugs.webkit.org/show_bug.cgi?id=43125
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::setContent):
+ * tests/qwebframe/tst_qwebframe.cpp:
+
2010-08-03 Noam Rosenthal <noam.rosenthal at nokia.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index b208447..83b8600 100644
--- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -33,6 +33,7 @@
#include <QRegExp>
#include <QNetworkRequest>
#include <QNetworkReply>
+#include <QTextCodec>
#ifndef QT_NO_OPENSSL
#include <qsslerror.h>
#endif
@@ -625,6 +626,8 @@ private slots:
void qObjectWrapperWithSameIdentity();
void introspectQtMethods_data();
void introspectQtMethods();
+ void setContent_data();
+ void setContent();
private:
QString evalJS(const QString&s) {
@@ -3101,5 +3104,34 @@ void tst_QWebFrame::introspectQtMethods()
QVERIFY(evalJSV("var props=[]; for (var p in myObject.deleteLater) {props.push(p);}; props.sort()").toStringList().isEmpty());
}
+void tst_QWebFrame::setContent_data()
+{
+ QTest::addColumn<QString>("mimeType");
+ QTest::addColumn<QByteArray>("testContents");
+ QTest::addColumn<QString>("expected");
+
+ QString str = QString::fromUtf8("ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει");
+ QTest::newRow("UTF-8 plain text") << "text/plain; charset=utf-8" << str.toUtf8() << str;
+
+ QTextCodec *utf16 = QTextCodec::codecForName("UTF-16");
+ if (utf16)
+ QTest::newRow("UTF-16 plain text") << "text/plain; charset=utf-16" << utf16->fromUnicode(str) << str;
+
+ str = QString::fromUtf8("Une chaîne de caractères à sa façon.");
+ QTest::newRow("latin-1 plain text") << "text/plain; charset=iso-8859-1" << str.toLatin1() << str;
+
+
+}
+
+void tst_QWebFrame::setContent()
+{
+ QFETCH(QString, mimeType);
+ QFETCH(QByteArray, testContents);
+ QFETCH(QString, expected);
+ m_view->setContent(testContents, mimeType);
+ QWebFrame* mainFrame = m_view->page()->mainFrame();
+ QCOMPARE(expected , mainFrame->toPlainText());
+}
+
QTEST_MAIN(tst_QWebFrame)
#include "tst_qwebframe.moc"
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list