https://bugs.webkit.org/show_bug.cgi?id=77417
Make the UIProcess decide about the encoding and display
a warning in case no encoding was defined.
Make the QQuickNetworkReply store a QWeakPointer to the
QQuickWebViewExperimental to get rid of hackish chain of parental queries.
Reviewed by Simon Hausmann.
* UIProcess/API/qt/qquicknetworkreply.cpp:
(QQuickNetworkReply::send):
(QQuickNetworkReply::setWebViewExperimental):
* UIProcess/API/qt/qquicknetworkreply_p.h:
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewExperimental::schemeDelegates_Append):
* WebProcess/qt/QtNetworkReply.cpp:
(WebKit::QtNetworkReply::QtNetworkReply):
(WebKit::QtNetworkReply::setReplyData):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106355
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-31 Zeno Albisser <zeno@webkit.org>
+
+ [Qt][WK2] Make UIProcess decide about encoding of input data for application URL schemes.
+ https://bugs.webkit.org/show_bug.cgi?id=77417
+
+ Make the UIProcess decide about the encoding and display
+ a warning in case no encoding was defined.
+ Make the QQuickNetworkReply store a QWeakPointer to the
+ QQuickWebViewExperimental to get rid of hackish chain of parental queries.
+
+ Reviewed by Simon Hausmann.
+
+ * UIProcess/API/qt/qquicknetworkreply.cpp:
+ (QQuickNetworkReply::send):
+ (QQuickNetworkReply::setWebViewExperimental):
+ * UIProcess/API/qt/qquicknetworkreply_p.h:
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewExperimental::schemeDelegates_Append):
+ * WebProcess/qt/QtNetworkReply.cpp:
+ (WebKit::QtNetworkReply::QtNetworkReply):
+ (WebKit::QtNetworkReply::setReplyData):
+
2012-01-30 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
[Qt] Disconnect the LayerTreeHost from layers when they get removed from their parent.
stringData = m_data.toString();
ptrData = reinterpret_cast<const void*>(stringData.constData());
smLength = sizeof(QChar) * stringData.length();
+ setContentType(QLatin1String("text/html; charset=utf-16"));
} else {
if (!m_data.canConvert<QByteArray>())
return;
smLength = byteArrayData.size();
}
+ if (contentType().isEmpty()) {
+ qWarning("QQuickNetworkReply::send - Cannot send raw data without a content type being specified!");
+ return;
+ }
+
WTF::RefPtr<WebKit::SharedMemory> sharedMemory = SharedMemory::create(smLength);
if (!sharedMemory)
return;
if (sharedMemory->createHandle(m_networkReplyData->data().m_dataHandle, SharedMemory::ReadOnly)) {
m_networkReplyData->data().m_contentLength = smLength;
-
- QObject* schemeParent = parent()->parent();
- if (schemeParent) {
- QQuickWebViewExperimental* webViewExperimental = qobject_cast<QQuickWebViewExperimental*>(schemeParent->parent());
- if (webViewExperimental)
- webViewExperimental->sendApplicationSchemeReply(this);
- }
+ if (m_webViewExperimental)
+ m_webViewExperimental.data()->sendApplicationSchemeReply(this);
}
// After sending the reply data, we have to reinitialize the m_networkReplyData,
m_networkReplyData = adoptRef(new WebKit::QtRefCountedNetworkReplyData);
}
+void QQuickNetworkReply::setWebViewExperimental(QQuickWebViewExperimental* webViewExperimental)
+{
+ m_webViewExperimental = webViewExperimental;
+}
+
WebKit::QtRefCountedNetworkRequestData* QQuickNetworkReply::networkRequestData() const
{
return m_networkRequestData.get();
#include "QtNetworkReplyData.h"
#include "QtNetworkRequestData.h"
+#include "qquickwebview_p.h"
#include "SharedMemory.h"
#include "qwebkitglobal.h"
#include <QNetworkAccessManager>
#include <QObject>
+#include <QWeakPointer>
#include <QtDeclarative/qdeclarativelist.h>
#include <QtQuick/qquickitem.h>
QVariant data() const;
void setData(const QVariant& data);
+ void setWebViewExperimental(QQuickWebViewExperimental*);
WebKit::QtRefCountedNetworkRequestData* networkRequestData() const;
void setNetworkRequestData(WTF::PassRefPtr<WebKit::QtRefCountedNetworkRequestData> data);
WebKit::QtRefCountedNetworkReplyData* networkReplyData() const;
WTF::RefPtr<WebKit::QtRefCountedNetworkRequestData> m_networkRequestData;
WTF::RefPtr<WebKit::QtRefCountedNetworkReplyData> m_networkReplyData;
QVariant m_data;
+ QWeakPointer<QQuickWebViewExperimental> m_webViewExperimental;
};
QML_DECLARE_TYPE(QQuickNetworkReply)
QQuickWebViewExperimental* webViewExperimental = qobject_cast<QQuickWebViewExperimental*>(property->object->parent());
if (!webViewExperimental)
return;
+ scheme->reply()->setWebViewExperimental(webViewExperimental);
QQuickWebViewPrivate* d = webViewExperimental->d_func();
d->webPageProxy->registerApplicationScheme(scheme->scheme());
}
setOperation(QNetworkAccessManager::GetOperation);
setUrl(req.url());
setOpenMode(QIODevice::ReadOnly);
- setHeader(QNetworkRequest::ContentTypeHeader, QVariant(QString::fromLocal8Bit("text/html; charset=UTF-16")));
}
void QtNetworkReply::setData(const SharedMemory::Handle& handle, qint64 dataSize)
void QtNetworkReply::setReplyData(const QtNetworkReplyData& replyData)
{
- if (!replyData.m_contentType.isNull())
+ if (!replyData.m_contentType.isEmpty())
setHeader(QNetworkRequest::ContentTypeHeader, QString(replyData.m_contentType));
setHeader(QNetworkRequest::ContentLengthHeader, QVariant::fromValue(replyData.m_contentLength));
setData(replyData.m_dataHandle, replyData.m_contentLength);