Check presence GSettingsSchema keys before getting them

The Glib documentation [1] states that "It is a programmer error to
give a key that isn't specified as having a string type in the schema
for settings."  Therefore, we must check if the settings schema has the
key before actually getting any settings. If we do not do this, glib
will terminate chrome with this error message:

  GLib-GIO-ERROR **: Settings schema 'org.cinnamon.muffin' does not
  contain a key named 'button-layout'

Also increase the glib requirement to 2.40 since that's the minimum
version that provides g_settings_schema_has_key.  This version is
available on all supported distros all the way back to Ubuntu Trusty.

[1] https://developer.gnome.org/gio/stable/GSettings.html#g-settings-get-string

BUG=1017974
R=thestig

Change-Id: I46f95bd7a242e48e1d9dc910f6b1f3ed114e7d9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1880567
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#710152}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e105a8815f5fb546b486496cb11d70638de7b11b
This commit is contained in:
Tom Anderson 2019-10-29 01:56:42 +00:00 коммит произвёл Commit Bot
Родитель 93d662ffc3
Коммит e7e9818a33
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -94,8 +94,8 @@ if (use_glib) {
"gthread-2.0",
]
defines = [
"GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32",
"GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26",
"GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40",
"GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40",
]
}
}