RESOLVED FIXED 240327
[GTK][WPE] Do not return pointer to disposed timezone string
https://bugs.webkit.org/show_bug.cgi?id=240327
Summary [GTK][WPE] Do not return pointer to disposed timezone string
Yury Semikhatsky
Reported 2022-05-11 18:20:36 PDT
[GTK][WPE] Do not return pointer to disposed timezone string
Attachments
Patch (2.93 KB, patch)
2022-05-11 18:22 PDT, Yury Semikhatsky
no flags
Patch (3.97 KB, patch)
2022-05-11 19:19 PDT, Yury Semikhatsky
no flags
Patch (5.85 KB, patch)
2022-05-12 10:03 PDT, Yury Semikhatsky
no flags
Yury Semikhatsky
Comment 1 2022-05-11 18:22:04 PDT
Yury Semikhatsky
Comment 2 2022-05-11 19:19:23 PDT
Michael Catanzaro
Comment 3 2022-05-12 06:42:23 PDT
Comment on attachment 459201 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=459201&action=review > Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:396 > + if (const auto* override = g_value_get_string(value); isTimeZoneValid(override)) IMO it's more readable if you use two ifs rather than a semicolon. > Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:-1883 > -/** > - * webkit_web_context_set_time_zone_override: > - * @context: a #WebKitWebContext > - * @time_zone_override: value to set > - * > - * Set the #WebKitWebContext:time-zone-override property. Refer to the IANA database for valid > - * specifiers, https://en.wikipedia.org/wiki/List_of_tz_database_time_zones > - * > - * Since: 2.38 > - */ > -void webkit_web_context_set_time_zone_override(WebKitWebContext* context, const gchar* timeZoneOverride) Hm, why are you removing this? Since it's declared in public headers, you need to remove it from the headers too. > Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:-1888 > - context->priv->timeZoneOverride = String::fromUTF8(timeZoneOverride); If you don't want to remove the setter, I think you can just do: context->priv->timeZoneOverride = timeZoneOverride ?
Yury Semikhatsky
Comment 4 2022-05-12 09:55:46 PDT
Comment on attachment 459201 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=459201&action=review >> Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:396 >> + if (const auto* override = g_value_get_string(value); isTimeZoneValid(override)) > > IMO it's more readable if you use two ifs rather than a semicolon. Changed. I personally prefer single statement per line but in another review[1] I was suggested reduce the scope of variables to the if block when possible. [1] https://bugs.webkit.org/show_bug.cgi?id=213884#c37 >> Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:-1883 >> -void webkit_web_context_set_time_zone_override(WebKitWebContext* context, const gchar* timeZoneOverride) > > Hm, why are you removing this? > > Since it's declared in public headers, you need to remove it from the headers too. Removed it from the header as well. There is no point in this method as calling it after context has been created will not update WebProcessPool configuration (and that is intentional as we don't want to have mixed time zones for pages in one pool).
Yury Semikhatsky
Comment 5 2022-05-12 10:03:32 PDT
Michael Catanzaro
Comment 6 2022-05-12 10:08:33 PDT
(In reply to Yury Semikhatsky from comment #4) > Removed it from the header as well. There is no point in this method as > calling it after context has been created will not update WebProcessPool > configuration (and that is intentional as we don't want to have mixed time > zones for pages in one pool). Ah yes, I see the property is construct only, so that's a good clue that there should definitely not be a setter function. Another concern: removing it without breaking any tests reveals that there was no API test for it, which would have caught that it could not work.
EWS
Comment 7 2022-05-12 10:45:47 PDT
Committed r294109 (250492@main): <https://commits.webkit.org/250492@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 459236 [details].
Note You need to log in before you can comment on or make changes to this bug.