From 8e1acd3704e22904acc2fee0d4a2f5344257434c Mon Sep 17 00:00:00 2001 From: Pablo Saavedra Date: Fri, 12 May 2023 00:56:46 +0200 Subject: [PATCH] webkit-utils: Check if the media engine will show the resource cog_handle_web_view_load_failed() checks if the error is WEBKIT_MEDIA_ERROR or WEBKIT_MEDIA_ERROR_WILL_HANDLE_LOAD and relies on WebKit in these cases. Similarly it does the same for the case of WPE API previous to 2.0 but using WEBKIT_PLUGIN_ERROR and WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD. This reverts commit c7bdb9cd3991b29abe9f4574685467f79d8fed34. --- core/cog-webkit-utils.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/cog-webkit-utils.c b/core/cog-webkit-utils.c index 81e5252f..71e7bdee 100644 --- a/core/cog-webkit-utils.c +++ b/core/cog-webkit-utils.c @@ -72,6 +72,16 @@ cog_handle_web_view_load_failed (WebKitWebView *web_view, GError *error, void *userdata) { + // If the resource is going to be shown by a plug-in or a + // media engine (for the case of API WPE2) just return FALSE and + // let WebKit handle it. +#if COG_USE_WPE2 + if (g_error_matches(error, WEBKIT_MEDIA_ERROR, WEBKIT_MEDIA_ERROR_WILL_HANDLE_LOAD)) +#else + if (g_error_matches(error, WEBKIT_PLUGIN_ERROR, WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD)) +#endif + return FALSE; + // Ignore cancellation errors as the active URI may be changing if (g_error_matches (error, WEBKIT_NETWORK_ERROR,