summaryrefslogtreecommitdiffstats
path: root/src/webengine
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-06-19 13:10:53 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-06-19 20:36:22 +0000
commit0c3542eb5e15013e1cece77acb7f1c69ba534891 (patch)
tree1e00fa310e397fb8c9609a21975d739e0d8f7bd8 /src/webengine
parent4f7f139badd6d928aa053afa04d94e256ac52f23 (diff)
Avoid using string constructor of QJSValue for byte-array
We were returning the PDF byte-data as a javascript unicode string using the deprecated ascii cast constructor. This patch changes the behavior to match that of runJavaScript callbacks and uses a script value over QVariant. [ChangeLog][QtWebEngine] The callback version of WebEngineView::printToPdf is now called with a proper bytearray result instead of PDF byte data in a javascript string. Change-Id: I71565623465c54052568bb5ff34665baaa93e187 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index cd734f971..8021d0a1e 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -1097,9 +1097,10 @@ void QQuickWebEngineViewPrivate::didFindText(quint64 requestId, int matchCount)
void QQuickWebEngineViewPrivate::didPrintPage(quint64 requestId, const QByteArray &result)
{
+ Q_Q(QQuickWebEngineView);
QJSValue callback = m_callbacks.take(requestId);
QJSValueList args;
- args.append(QJSValue(result.data()));
+ args.append(qmlEngine(q)->toScriptValue(result));
callback.call(args);
}