From 90888e4835f80f278c612a2e7d5797e915767f56 Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Thu, 24 Jun 2021 20:57:21 +0200 Subject: WebEngineNavigationRequest: add accept/reject and deprecate setAction Match naming with others and use accept/reject methods to handle request. Also, allow to use request object after call scope in QML. [ChangeLog][QWebEngineQuick][WebEngineNavigationRequest] setAction(action) is deprecated in favor of new accept/reject methods Change-Id: I83252370e2e83017008f6951f98b7ecad119e232 Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit 13254e7950a032ebbeb11b1cf54b850c8326fb30) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/quick/publicapi/tst_publicapi.cpp | 2 ++ tests/auto/quick/qmltests/data/tst_navigationRequested.qml | 6 +++--- tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 9532dd412..fe0b9d2b4 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -333,6 +333,8 @@ static const QStringList expectedAPI = QStringList() << "QWebEngineNavigationRequest.RedirectNavigation --> NavigationType" << "QWebEngineNavigationRequest.ReloadNavigation --> NavigationType" << "QWebEngineNavigationRequest.TypedNavigation --> NavigationType" + << "QWebEngineNavigationRequest.accept() --> void" + << "QWebEngineNavigationRequest.reject() --> void" << "QWebEngineNewWindowRequest.destination --> QWebEngineNewWindowRequest::DestinationType" << "QWebEngineNewWindowRequest.requestedUrl --> QUrl" << "QWebEngineNewWindowRequest.requestedGeometry --> QRect" diff --git a/tests/auto/quick/qmltests/data/tst_navigationRequested.qml b/tests/auto/quick/qmltests/data/tst_navigationRequested.qml index bb2864a7d..462dc8297 100644 --- a/tests/auto/quick/qmltests/data/tst_navigationRequested.qml +++ b/tests/auto/quick/qmltests/data/tst_navigationRequested.qml @@ -59,20 +59,20 @@ TestWebEngineView { signalName: "navigationRequested" } - onNavigationRequested: { + onNavigationRequested: function(request) { if (request.isMainFrame) { attributes.mainUrl = request.url } else { attributes.iframeUrl = request.url if (shouldIgnoreSubFrameRequests) { - request.action = WebEngineNavigationRequest.IgnoreRequest + request.reject() } } if (request.navigationType === WebEngineNavigationRequest.LinkClickedNavigation) { attributes.linkClickedNavigationRequested = true if (shouldIgnoreLinkClicks) { - request.action = WebEngineNavigationRequest.IgnoreRequest + request.reject() attributes.linkClickedNavigationIgnored = true } } diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 7ac2b043a..8df70d917 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -557,7 +557,7 @@ private Q_SLOTS: n.type = request.navigationType(); n.isMainFrame = request.isMainFrame(); navigations.append(n); - request.setAction(QWebEngineNavigationRequest::AcceptRequest); + request.accept(); } void slotNewWindowRequested(QWebEngineNewWindowRequest &request) { -- cgit v1.2.3