Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: dd71161da413086851ceeee9cb066d7d3b5f6cae
https://github.com/WebKit/WebKit/commit/dd71161da413086851ceeee9cb066d7d3b5f6cae
Author: Adrian Perez de Castro <[email protected]>
Date: 2026-03-20 (Fri, 20 Mar 2026)
Changed paths:
M Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitFaviconDatabase.cpp
M Tools/TestWebKitAPI/glib/TestExpectations.json
Log Message:
-----------
[GTK] API test /webkit/WebKitFaviconDatabase/get-favicon often times out
https://bugs.webkit.org/show_bug.cgi?id=188110
Reviewed by Carlos Garcia Campos.
A test case that loads a page that has no <link> element for favicons
results in WebKit using /favicon.ico as fallback; then the HTTP server
used for testing returns an HTTP 404 Not Found for it. Then the test
checked for the WebKitFaviconDatabase:favicon-changed signal; but given
that there is no actual icon loaded, the signal was never emitted and
the test timed out waiting for it.
The test case is wrong because the API documentation implies that an
icon image can always be fetched after :favicon-changed is emitted,
which needs that a favicon is actually loaded and stored in the
database. Therefore it makes more sense to change the test case to
validate that the signal is *not* emitted for a page where for which a
favicon cannot be loaded.
A second issue is that depending on the order of completion of
asynchronous it may happen that WebKitFaviconDatabase:favicon-changed
may be emitted while waiting e.g. for page load using
waitUntilLoadFinishedAndFaviconChanged(), before explicitly waiting
for it with waitUntilFaviconChanged(). If that happened, the call to
waitUntilFaviconChanged() call would spin the main loop again to wait
for a signal emission that never arrives (because it had already
happened).
This patch fixes those two issues, in the following way:
0. Using an std::optional<CString> for the favicon URI, which is a
more logical representation if the "no value provided" state.
1. Split waitUntilFaviconChanged() into two separate functions:
willWaitForFaviconURIChanged() to use at the beginning of a test
case to indicate that checks will be made on :favicon-changed
(and reset values), and waitUntilFaviconURIChangedIfNeeded().
The latter checks first whether a value was already recorded,
and returns early in that case to avoid spinning the main loop
causing a timeout.
2. Allow a timeout for waitUntilFaviconURIChangedIfNeeded(), in order
to not wait forever in the case where testing the page for which
a favicon cannot be loaded. The timeout avoids spinning the main
loop forever, and afterwards it is possible to check that the
:favicon-changed signal was not emitted, and that there was no
favicon URI recorded.
* Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitFaviconDatabase.cpp:
(testFaviconDatabaseGetFavicon):
* Tools/TestWebKitAPI/glib/TestExpectations.json: Remove test expectation,
it should always pass now.
Canonical link: https://commits.webkit.org/309642@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications