diff options
author | Tamas Zakor <ztamas@inf.u-szeged.hu> | 2020-10-14 14:56:47 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-11-10 11:02:57 +0100 |
commit | bbf7226ace4d9bbcff4d68c063dc598c2d3f2ff0 (patch) | |
tree | 922e100467cc80f1dd6d794b07a35c12cf314bee /tests/auto/quick/qmltests/data/tst_newViewRequest.qml | |
parent | f93900ec2e5e4289f562b630821650f7c3f8f906 (diff) |
Fix new view request handling
Ignore url loading if the request is not from a data
url and the Q(Quick)WebEngineNewViewRequest.openIn() is not
called on newViewRequested().
Set the missing Q(Quick)WebEngineNewViewRequest::requestedUrl
property.
Fixes: QTBUG-87378
Change-Id: Idddc9cf075db68dcf5825b3e746d16419d02cfa0
Reviewed-by: Tamas Zakor <ztamas@inf.u-szeged.hu>
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/quick/qmltests/data/tst_newViewRequest.qml')
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_newViewRequest.qml | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_newViewRequest.qml b/tests/auto/quick/qmltests/data/tst_newViewRequest.qml index 80389e9f8..08d63d956 100644 --- a/tests/auto/quick/qmltests/data/tst_newViewRequest.qml +++ b/tests/auto/quick/qmltests/data/tst_newViewRequest.qml @@ -38,6 +38,13 @@ TestWebEngineView { property var newViewRequest: null property var dialog: null property string viewType: "" + property var loadRequestArray: [] + + onLoadingChanged: { + loadRequestArray.push({ + "status": loadRequest.status, + }); + } SignalSpy { id: newViewRequestedSpy @@ -81,6 +88,7 @@ TestWebEngineView { newViewRequestedSpy.clear(); newViewRequest = null; viewType = ""; + loadRequestArray = []; } function cleanup() { @@ -163,6 +171,23 @@ TestWebEngineView { } newViewRequestedSpy.clear(); } + + loadRequestArray = []; + compare(loadRequestArray.length, 0); + webEngineView.url = Qt.resolvedUrl("test2.html"); + verify(webEngineView.waitForLoadSucceeded()); + var center = getElementCenter("link"); + mouseClick(webEngineView, center.x, center.y, Qt.LeftButton, Qt.ControlModifier); + tryCompare(newViewRequestedSpy, "count", 1); + compare(newViewRequest.requestedUrl, Qt.resolvedUrl("test1.html")); + compare(newViewRequest.destination, WebEngineView.NewViewInBackgroundTab); + verify(newViewRequest.userInitiated); + if (viewType === "" || viewType === "null") { + compare(loadRequestArray[0].status, WebEngineView.LoadStartedStatus); + compare(loadRequestArray[1].status, WebEngineView.LoadSucceededStatus); + compare(loadRequestArray.length, 2); + } + newViewRequestedSpy.clear(); } } } |