From c5de1b21232c7114b27e42fa8c15cb323d256e47 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Tue, 31 May 2022 13:08:05 +0200 Subject: Do not reset favicon for same document navigations Fixes: QTBUG-103735 Pick-to: 6.3 6.4 Change-Id: Iee0c09cde16a825097b7c1c014655476989922c0 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/qmltests/data/tst_favicon.qml | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests/auto/quick') diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml index 79c835c70..ce4a2aa3c 100644 --- a/tests/auto/quick/qmltests/data/tst_favicon.qml +++ b/tests/auto/quick/qmltests/data/tst_favicon.qml @@ -165,6 +165,38 @@ TestWebEngineView { compare(iconUrl, Qt.resolvedUrl("icons/qt32.ico")) } + function test_faviconLoadPushState_data() { + return [ + { tag: "OTR", profile: defaultProfile }, + { tag: "non-OTR", profile: nonOTRProfile }, + ]; + } + + function test_faviconLoadPushState(row) { + webEngineView.profile = row.profile; + compare(iconChangedSpy.count, 0); + + var iconUrl; + + webEngineView.url = Qt.resolvedUrl("favicon.html"); + verify(webEngineView.waitForLoadSucceeded()); + tryCompare(iconChangedSpy, "count", 1); + iconUrl = removeFaviconProviderPrefix(webEngineView.icon); + compare(iconUrl, Qt.resolvedUrl("icons/favicon.png")); + + iconChangedSpy.clear(); + + // pushState() is a same document navigation and should not reset or + // update favicon. + compare(webEngineView.history.items.rowCount(), 1); + runJavaScript("history.pushState('', '')"); + tryVerify(function() { return webEngineView.history.items.rowCount() === 2; }); + + // Favicon change is not expected. + compare(iconChangedSpy.count, 0); + iconUrl = removeFaviconProviderPrefix(webEngineView.icon); + compare(iconUrl, Qt.resolvedUrl("icons/favicon.png")); + } function test_noFavicon_data() { return [ -- cgit v1.2.3