Bug 1239371 - Consider state of boolean values for marionette.logging pref; r=automatedtester
authorAndreas Tolfsen <ato@mozilla.com>
Wed, 13 Jan 2016 18:47:58 +0000
changeset 280049 54427ab62f79feb5be0795ba13d90a7d90fda09d
parent 280048 0fff5b609f71a2f7efa1ca443a5cc9480ab379cc
child 280050 9a062cdf1c8a4ea9c6a8458f6baabae655b42f4b
push id29900
push usercbook@mozilla.com
push dateFri, 15 Jan 2016 10:47:20 +0000
treeherdermozilla-central@e1486d83107f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1239371, 1239363
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1239371 - Consider state of boolean values for marionette.logging pref; r=automatedtester The patch for bug 1239363 treated the marionette.logging preference as a defined/undefined state, and didn't look specifically at the state of the variable itself. This meant that if it was set to false, logging would still be enabled. As this was not the original behaviour were adding backwards compatibility for, this patch corrects this problem by making false equivalent to the default (Log.Level.Info).
testing/marionette/components/marionettecomponent.js
--- a/testing/marionette/components/marionettecomponent.js
+++ b/testing/marionette/components/marionettecomponent.js
@@ -56,23 +56,32 @@ MarionetteComponent.prototype.determineL
   let level = Log.Level.Info;
 #ifdef DEBUG
   level = Log.Level.Trace;
 #endif
 
   // marionette.logging pref can override default
   // with an entry from the Log.Level enum
   if (Preferences.has(LOG_PREF)) {
-    let s = Preferences.get(LOG_PREF);
-    if (typeof s == "string") {
-      s = s.toLowerCase();
-      s = s.charAt(0).toUpperCase() + s.slice(1);
-      level = Log.Level[s];
-    } else {
-      level = Log.Level.Trace;
+    let p = Preferences.get(LOG_PREF);
+
+    switch (typeof p) {
+      // Gecko >= 46
+      case "string":
+        let s = p.toLowerCase();
+        s = s.charAt(0).toUpperCase() + s.slice(1);
+        level = Log.Level[s];
+        break;
+
+      // Gecko <= 45
+      case "boolean":
+        if (p) {
+          level = Log.Level.Trace;
+        }
+        break;
     }
   }
 
   return level;
 };
 
 MarionetteComponent.prototype.onSocketAccepted = function(
     socket, transport) {