Bug 1532850 - Check the return value of LookAndFeel::GetInt() in case of the function failure. r=emilio a=pascalc
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 19 Mar 2019 10:10:39 +0000
changeset 525818 33a8d0d55cf4b7d419a8c5803a9ac234d3d330fb
parent 525817 f9c39d67b0d6c8b192af593ed98e8ae71f567734
child 525819 c744534702892c60350398ce2d3bd41ebdd3f43b
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio, pascalc
bugs1532850
milestone67.0
Bug 1532850 - Check the return value of LookAndFeel::GetInt() in case of the function failure. r=emilio a=pascalc Actually the function will fail on Android since on xpcshell tests we don't initialize AndroidBridge so that we can't query the corresponding system settings. Differential Revision: https://phabricator.services.mozilla.com/D22270
layout/style/nsMediaFeatures.cpp
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -457,18 +457,19 @@ void nsMediaFeatures::InitSystemMetrics(
 
   rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDReversedPlacement,
                            &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(
         (nsStaticAtom*)nsGkAtoms::_moz_gtk_csd_reversed_placement);
   }
 
-  metricResult = LookAndFeel::GetInt(LookAndFeel::eIntID_SystemUsesDarkTheme);
-  if (metricResult) {
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_SystemUsesDarkTheme,
+                           &metricResult);
+  if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(
         (nsStaticAtom*)nsGkAtoms::_moz_system_dark_theme);
   }
 }
 
 /* static */
 void nsMediaFeatures::FreeSystemMetrics() {
   delete sSystemMetrics;