Bug 220620

Summary: [GTK] webkit_settings_set_enable_plugins deprecation warning breaks unit tests
Product: WebKit Reporter: Michael Gratton <mike>
Component: WebKitGTKAssignee: Michael Catanzaro <mcatanzaro>
Status: RESOLVED FIXED    
Severity: Normal CC: berto, bugs-noreply, cgarcia, ews-watchlist, gustavo, mcatanzaro
Priority: P3 Keywords: Gtk
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch
none
Patch for landing none

Michael Gratton
Reported 2021-01-14 02:43:27 PST
Geary unit tests are currently failing on Fedora because the warning printed about calling `webkit_settings_set_enable_plugins` (Geary sets it to false) is presumably using g_warning(), causing the test harness to bail out: > Bail out! FATAL-WARNING: webkit_settings_set_enable_plugins is deprecated and does nothing. Plugins are no longer supported. Please don't do this. There's no way I can keep that disabled for older versions and not get the warning with new versions without resorting to hasty hacks like preprocessor conditionals.
Attachments
Patch (2.17 KB, patch)
2021-01-15 14:08 PST, Michael Catanzaro
no flags
Patch for landing (1.91 KB, patch)
2021-02-03 14:43 PST, Michael Catanzaro
no flags
Michael Catanzaro
Comment 1 2021-01-15 14:02:09 PST
There's also a warning for webkit_settings_set_enable_private_browsing(), but that one looks safe to keep since it's been quite a long time since it was deprecated, and using it surely indicates an application bug.
Michael Catanzaro
Comment 2 2021-01-15 14:08:08 PST
EWS Watchlist
Comment 3 2021-01-15 14:09:06 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Carlos Garcia Campos
Comment 4 2021-01-18 00:32:16 PST
You can temporary change the log fatal flag before calling webkit_settings_set_enable_plugins() and restore it after the call. That's what we do in WebKit tests too, using g_log_set_always_fatal().
Michael Gratton
Comment 5 2021-01-18 02:14:01 PST
> You can temporary change the log fatal flag before calling webkit_settings_set_enable_plugins() and restore it after the call. Sure, but this call is made by an abstract base class that gets used in a lot of different places and hence different tests, so either it has to get disabled for all tests (what's the point having it then?) or it's disabled for a bunch of seemingly unrelated tests (more random boilerplate), and still requires a code fix to unbreak CI. So I reckon it's much better that libraries just not break existing, non-problematic code in the first place. Isn't there a convention like defining `GTK_DISABLE_DEPRECATED` for people who are interested in that?
Carlos Garcia Campos
Comment 6 2021-01-18 02:22:59 PST
(In reply to Michael Gratton from comment #5) > > You can temporary change the log fatal flag before calling webkit_settings_set_enable_plugins() and restore it after the call. > > Sure, but this call is made by an abstract base class that gets used in a > lot of different places and hence different tests, so either it has to get > disabled for all tests (what's the point having it then?) or it's disabled > for a bunch of seemingly unrelated tests (more random boilerplate), and > still requires a code fix to unbreak CI. I see. > So I reckon it's much better that libraries just not break existing, > non-problematic code in the first place. Sure, a g_warning is supposed to be harmless, tough, but it's true it's problematic for unit tests. So, maybe we can just turn that into a normal printf. > Isn't there a convention like defining `GTK_DISABLE_DEPRECATED` for people > who are interested in that? We don't print a warning for every deprecated method, only when they become noop.
Michael Catanzaro
Comment 7 2021-01-18 07:15:25 PST
(In reply to Michael Gratton from comment #5) > Isn't there a convention like defining `GTK_DISABLE_DEPRECATED` for people > who are interested in that? G_ENABLE_DIAGNOSTIC controls runtime deprecation warnings for properties and signals, so it seemed like a good fit for this to me....
Michael Gratton
Comment 8 2021-01-18 15:15:06 PST
Yeah the patch as-is sounds like decent practice in general.
Carlos Garcia Campos
Comment 9 2021-01-19 00:59:39 PST
Well, this is not a "normal" deprecation warning saying that the functionality will be removed in a future version, it has already been removed, and it's important to let applications know it. I don't think it's common to run applications with G_ENABLE_DIAGNOSTIC=1, what makes the warning useless. Why not just making the call conditional to the WebKit version in Geary?
Michael Catanzaro
Comment 10 2021-02-02 15:59:24 PST
The argument for not making it conditional in Geary is: (In reply to Michael Gratton from comment #5) > Sure, but this call is made by an abstract base class that gets used in a > lot of different places and hence different tests, so either it has to get > disabled for all tests (what's the point having it then?) or it's disabled > for a bunch of seemingly unrelated tests (more random boilerplate), and > still requires a code fix to unbreak CI. I don't think it's important to let applications know the functionality has been removed if they are trying to *disable* plugins. That's why the proposed patch still warns only if applications are trying to *enable* plugins.
Carlos Garcia Campos
Comment 11 2021-02-03 01:33:32 PST
Comment on attachment 417735 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417735&action=review > Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp:1910 > + if (enabled || !g_strcmp0(g_getenv("G_ENABLE_DIAGNOSTIC"), "1")) Ok, but let's remove the G_ENABLE_DIAGNOSTIC check.
Michael Catanzaro
Comment 12 2021-02-03 14:43:05 PST
Created attachment 419187 [details] Patch for landing
EWS
Comment 13 2021-02-03 15:17:40 PST
Committed r272342: <https://trac.webkit.org/changeset/272342> All reviewed patches have been landed. Closing bug and clearing flags on attachment 419187 [details].
Note You need to log in before you can comment on or make changes to this bug.