Bug 1239363 - Accept non-string types for marionette.logging pref; r=AutomatedTester draft
authorAndreas Tolfsen <ato@mozilla.com>
Wed, 13 Jan 2016 17:14:49 +0000
changeset 321474 deda38098ac147883efac44e62d1a03b9c764b65
parent 321369 531d1f6d1cde1182e9f7f9dff81a4fc5abc0a601
child 512905 df4cf3fe01d90b19c3aeee6244fc59e4cb26771f
push id9384
push useratolfsen@mozilla.com
push dateWed, 13 Jan 2016 17:18:40 +0000
reviewersAutomatedTester
bugs1239363
milestone46.0a1
Bug 1239363 - Accept non-string types for marionette.logging pref; r=AutomatedTester The marionette.logging preference used to have a boolean type. To maintain backwards compatibility with earlier clients we keep accepting boolean types as input. Previously setting it to true meant you wanted all the logs, and this change respects that.
testing/marionette/components/marionettecomponent.js
--- a/testing/marionette/components/marionettecomponent.js
+++ b/testing/marionette/components/marionettecomponent.js
@@ -57,19 +57,23 @@ MarionetteComponent.prototype.determineL
 #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);
-    s = s.toLowerCase();
-    s = s.charAt(0).toUpperCase() + s.slice(1);
-    level = Log.Level[s];
+    if (typeof s == "string") {
+      s = s.toLowerCase();
+      s = s.charAt(0).toUpperCase() + s.slice(1);
+      level = Log.Level[s];
+    } else {
+      level = Log.Level.Trace;
+    }
   }
 
   return level;
 };
 
 MarionetteComponent.prototype.onSocketAccepted = function(
     socket, transport) {
   this.logger.info("onSocketAccepted for Marionette dummy socket");