Bug 1027372 - Only use info() if it has been loaded. r=gmealer
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Wed, 18 Jun 2014 17:27:00 -0400
changeset 190184 3b965d005fb31d3a84ebfa1fdc791603f2c0e809
parent 190183 5e70b11b57c6d74f8164fd26a2865292e1c5f244
child 190185 ad7616fcaefef7e18f52abfdb126e06bc9278337
push id7411
push userkwierso@gmail.com
push dateTue, 24 Jun 2014 02:07:45 +0000
treeherderfx-team@cc4602e0c1d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgmealer
bugs1027372
milestone33.0a1
Bug 1027372 - Only use info() if it has been loaded. r=gmealer
dom/media/tests/mochitest/pc.js
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -344,16 +344,25 @@ MediaElementChecker.prototype = {
    */
   checkForNoMediaFlow : function MEC_CheckForNoMediaFlow() {
     ok(this.element.readyState === HTMLMediaElement.HAVE_METADATA,
        'Media element has a ready state of HAVE_METADATA');
   }
 };
 
 /**
+ * Only calls info() if SimpleTest.info() is available
+ */
+function safeInfo(message) {
+  if (typeof(info) === "function") {
+    info(message);
+  }
+}
+
+/**
  * Query function for determining if any IP address is available for
  * generating SDP.
  *
  * @return false if required additional network setup.
  */
 function isNetworkReady() {
   // for gonk platform
   if ("nsINetworkInterfaceListService" in SpecialPowers.Ci) {
@@ -369,26 +378,26 @@ function isNetworkReady() {
       var ips = {};
       var prefixLengths = {};
       var length = itfList.getInterface(i).getAddresses(ips, prefixLengths);
 
       for (var j = 0; j < length; j++) {
         var ip = ips.value[j];
         // skip IPv6 address until bug 797262 is implemented
         if (ip.indexOf(":") < 0) {
-          info("Network interface is ready with address: " + ip);
+          safeInfo("Network interface is ready with address: " + ip);
           return true;
         }
       }
     }
     // ip address is not available
-    info("Network interface is not ready, required additional network setup");
+    safeInfo("Network interface is not ready, required additional network setup");
     return false;
   }
-  info("Network setup is not required");
+  safeInfo("Network setup is not required");
   return true;
 }
 
 /**
  * Network setup utils for Gonk
  *
  * @return {object} providing functions for setup/teardown data connection
  */