Bug 715588 - talos needs to check for specialpowers before using it. r=jhammel
authorJoel Maher <jmaher@mozilla.com>
Wed, 27 Jun 2012 18:53:11 -0400
changeset 471 9c0b93b5f52136677ccec70304e44e4ae4d394b8
parent 470 0c2521dde365bc517d6acd02df54f1d03a257806
child 472 09e7ed37236b791d64eec0525862d55103570e8f
push id220
push userjmaher@mozilla.com
push dateWed, 27 Jun 2012 22:53:41 +0000
reviewersjhammel
bugs715588
Bug 715588 - talos needs to check for specialpowers before using it. r=jhammel
talos/page_load_test/a11y/a11y.js
talos/scripts/MozillaFileLogger.js
--- a/talos/page_load_test/a11y/a11y.js
+++ b/talos/page_load_test/a11y/a11y.js
@@ -1,25 +1,22 @@
 const nsIAccessible = Components.interfaces.nsIAccessible;
 const nsIAccessNode = Components.interfaces.nsIAccessNode;
 const nsIDOMNode = Components.interfaces.nsIDOMNode;
 
 gAccRetrieval = 0;
 
 // Detect if we are on older branches that don't have specialpowers enabled talos available
-var ua_plat = window.navigator.userAgent.split('(')[1].split(')')[0];
-var parts = ua_plat.split(';');
 var useSpecialPowers = true;
-if (parts.length >= 2) {
-  var rev = parseInt(parts[2].split(':')[1]);
-  if (parts[0].replace(/^\s+|\s+$/g, '') == 'Android' && parts[1].replace(/^\s+|\s+$/g, '') == 'Mobile' && parseInt(rev) < 16)
-  {
+try {
+  if (SpecialPowers === undefined)
     useSpecialPowers = false;
-  }
-} //else we are on windows xp or windows 7
+} catch (ex) {
+  useSpecialPowers = false;
+}
 
 function initAccessibility()
 {
   if (useSpecialPowers)
     return SpecialPowers.isAccessible();
 
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   if (!gAccRetrieval) {
--- a/talos/scripts/MozillaFileLogger.js
+++ b/talos/scripts/MozillaFileLogger.js
@@ -1,24 +1,20 @@
 /**
  * MozFileLogger, a log listener that can write to a local file.
  */
 
 // Detect if we are on older branches that don't have specialpowers enabled talos available
-var ua_plat = window.navigator.userAgent.split('(')[1].split(')')[0];
-var parts = ua_plat.split(';');
 var useSpecialPowers = true;
-if (parts.length >= 2) {
-  var rev = parseInt(parts[2].split(':')[1]);
-  if (parts[0].replace(/^\s+|\s+$/g, '') == 'Android' && parts[1].replace(/^\s+|\s+$/g, '') == 'Mobile' && parseInt(rev) < 16)
-  {
+try {
+  if (SpecialPowers === undefined)
     useSpecialPowers = false;
-  }
-} //else we are on windows xp or windows 7
-
+} catch (ex) {
+  useSpecialPowers = false;
+}
 var ipcMode = false; // running in e10s build and need to use IPC?
 if (!useSpecialPowers) {
   try {
     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
     var ipcsanity = Components.classes["@mozilla.org/preferences-service;1"]
                       .getService(Components.interfaces.nsIPrefBranch);
     ipcsanity.setIntPref("mochitest.ipcmode", 0);
   } catch (e) {