diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2019-02-11 16:38:47 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2019-02-25 07:14:32 +0000 |
commit | 837347e1901086a9757b5aca7e5bbee7b0d8e20e (patch) | |
tree | e0bf0ed4ae2523f87e96e65b57858c5e5f3405d7 /tests/auto/quick | |
parent | 598bfc652edffb047948e01c3c76eb9e0cb7db4e (diff) |
Fix handling of touch icons when it is disabled
Store the icon type in a bitfield because the same icon URL might be
used for various types on same page. This way webengine won't ignore to
download a default icon what is also set as a touch icon when touch
icons are disabled.
Moreover, do not store the icon types from the previous page because
a subsequent page might use the same icon URL but with different type.
With this change the type of the cached icons are updated after each
page load.
Fixes: QTBUG-70081
Change-Id: I8031a740b07b0c6a8e5759a994f386b13ce87be2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_favicon.qml | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml index 563a87c83..50a412384 100644 --- a/tests/auto/quick/qmltests/data/tst_favicon.qml +++ b/tests/auto/quick/qmltests/data/tst_favicon.qml @@ -375,5 +375,38 @@ TestWebEngineView { faviconImage.destroy() } + + function test_touchIconWithSameURL() + { + WebEngine.settings.touchIconsEnabled = false; + + var icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="; + + webEngineView.loadHtml( + "<html>" + + "<link rel='icon' type='image/png' href='" + icon + "'/>" + + "<link rel='apple-touch-icon' type='image/png' href='" + icon + "'/>" + + "</html>" + ); + verify(webEngineView.waitForLoadSucceeded()); + + // The default favicon has to be loaded even if its URL is also set as a touch icon while touch icons are disabled. + tryCompare(iconChangedSpy, "count", 1); + compare(webEngineView.icon.toString().replace(/^image:\/\/favicon\//, ''), icon); + + iconChangedSpy.clear(); + + webEngineView.loadHtml( + "<html>" + + "<link rel='apple-touch-icon' type='image/png' href='" + icon + "'/>" + + "</html>" + ); + verify(webEngineView.waitForLoadSucceeded()); + + // This page only has a touch icon. With disabled touch icons we don't expect any icon to be shown even if the same icon + // was loaded previously. + tryCompare(iconChangedSpy, "count", 1); + verify(!webEngineView.icon.toString().replace(/^image:\/\/favicon\//, '')); + } } } |