Bug 715588 - talos has enablePrivilege deprecated warning, need to use specialpowers. r=jhammel
authorJoel Maher <jmaher@mozilla.com>
Wed, 27 Jun 2012 14:16:07 -0400
changeset 468 18898c970f8af7d7d09066145a100e9bd488678f
parent 467 7d28f2533eb58b99fc5cedf7ea5e069ba71c676c
child 469 249452fec498a7d267c55a5af85ca12394f4da5c
push id218
push userjmaher@mozilla.com
push dateWed, 27 Jun 2012 18:16:35 +0000
reviewersjhammel
bugs715588
Bug 715588 - talos has enablePrivilege deprecated warning, need to use specialpowers. r=jhammel
create_talos_zip.py
talos/getInfo.html
talos/specialpowers/chrome/specialpowers/content/MozillaLogger.js
talos/specialpowers/chrome/specialpowers/content/specialpowersAPI.js
talos/xtalos/etlparser.py
--- a/create_talos_zip.py
+++ b/create_talos_zip.py
@@ -12,16 +12,17 @@ import sys
 import tarfile
 import urllib2
 import zipfile
 
 # globals
 here = os.path.dirname(os.path.abspath(__file__))
 dest = os.path.join(here, 'talos')
 manifest = [('https://raw.github.com/mozilla/mozbase/master/mozhttpd/mozhttpd/mozhttpd.py', 'mozhttpd.py'),
+            ('https://raw.github.com/mozilla/mozbase/master/mozhttpd/mozhttpd/iface.py', 'iface.py'),
             ('https://raw.github.com/mozilla/mozbase/master/mozinfo/mozinfo/mozinfo.py', 'mozinfo.py'),
             ('https://raw.github.com/mozilla/mozbase/master/mozdevice/mozdevice/__init__.py', 'mozdevice/__init__.py'),
             ('https://raw.github.com/mozilla/mozbase/master/mozdevice/mozdevice/devicemanager.py', 'mozdevice/devicemanager.py'),
             ('https://raw.github.com/mozilla/mozbase/master/mozdevice/mozdevice/devicemanagerADB.py', 'mozdevice/devicemanagerADB.py'),
             ('https://raw.github.com/mozilla/mozbase/master/mozdevice/mozdevice/devicemanagerSUT.py', 'mozdevice/devicemanagerSUT.py'),
             ('https://raw.github.com/mozilla/mozbase/master/mozdevice/mozdevice/droid.py', 'mozdevice/droid.py'),
             ('http://pyyaml.org/export/360/pyyaml/trunk/lib/yaml/composer.py', 'yaml/composer.py'),
             ('http://pyyaml.org/export/360/pyyaml/trunk/lib/yaml/constructor.py', 'yaml/constructor.py'),
--- a/talos/getInfo.html
+++ b/talos/getInfo.html
@@ -23,49 +23,42 @@
         version = appInfo.Version;
         buildid = appInfo.appBuildID;
       } catch(err) {
           dumpLog('exception getting privileged access, defaulting to XUL_FENNEC');
           id = '{a23983c0-fd0e-11dc-95ff-0800200c9a66}';
       }
     } else {
       id = SpecialPowers.ID;
+      if (id == null) {
+          id = '{a23983c0-fd0e-11dc-95ff-0800200c9a66}';
+      }
       version = SpecialPowers.Version;
       buildid = SpecialPowers.BuildID;
     }
     return [id, version, buildid]
   }
     </script>
     <title>shutdown script</title>
   </head>
 
   <body onload="
     var appinfo = setup();
     var id = appinfo[0];
     var version = appinfo[1];
     var buildid = appinfo[2];
 
-    const FIREFOX_ID = '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}';
-    const THUNDERBIRD_ID = '{3550f703-e582-4d05-9a08-453d09bdfdc6}';
-    const SEAMONKEY_ID = '{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}';
-    const FENNEC_ID = '{aa3c5121-dab2-40e2-81ca-7ea25febc110}';
-    const XUL_FENNEC_ID = '{a23983c0-fd0e-11dc-95ff-0800200c9a66}';
-    product = 'undefined';
+    var productid = [];
+    productid['{ec8030f7-c20a-464f-9b0e-13a3a9e97384}'] = 'Firefox';
+    productid['{3550f703-e582-4d05-9a08-453d09bdfdc6}'] = 'Thunderbird';
+    productid['{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}'] = 'SeaMonkey';
+    productid['{aa3c5121-dab2-40e2-81ca-7ea25febc110}'] = 'Fennec';
+    productid['{a23983c0-fd0e-11dc-95ff-0800200c9a66}'] = 'Fennec';
 
-    if(id == FIREFOX_ID) {  
-      product = 'Firefox';
-    } else if(id == THUNDERBIRD_ID) {  
-      product = 'Thunderbird';
-    } else if(id == SEAMONKEY_ID) {
-      product = 'SeaMonkey';
-    } else if(id == XUL_FENNEC_ID) {
-      product = 'Fennec';
-    } else if(id == FENNEC_ID) {
-      product = 'Fennec';
-    }
+    var product = productid[id];
 
     dumpLog('__browserInfo\nbrowser_name:' + product + '\nbrowser_version:' + version + '\nbuildID:' + buildid + '\n__browserInfo');
 
     dumpLog('__metrics\tScreen width/height:' + screen.width + '/' + screen.height + '\n\tcolorDepth:' + screen.colorDepth + '\n');
     dumpLog('\tBrowser inner width/height: ' + window.innerWidth + '/' + window.innerHeight + '\n');
 //JMAHER: this is temporarily commented out because this hangs the fennec browser
 //  dumpLog('\tBrowser outer width/height: ' + window.outerWidth + '/' + window.outerHeight);
     dumpLog('__metrics');
--- a/talos/specialpowers/chrome/specialpowers/content/MozillaLogger.js
+++ b/talos/specialpowers/chrome/specialpowers/content/MozillaLogger.js
@@ -78,17 +78,22 @@ function MozillaFileLogger(aPath) {
 MozillaFileLogger.prototype = {
   
   init : function (path) {
     var PR_WRITE_ONLY   = 0x02; // Open for writing only.
     var PR_CREATE_FILE  = 0x08;
     var PR_APPEND       = 0x10;
     this._file = Components.classes["@mozilla.org/file/local;1"].
                             createInstance(Components.interfaces.nsILocalFile);
-    this._file.initWithPath(path);
+    try {
+        this._file.initWithPath(path);
+    } catch (ex) {
+        path = path.replace(/\//g, '\\\\');
+        this._file.initWithPath(path);
+    }
     this._foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
                                      createInstance(Components.interfaces.nsIFileOutputStream);
     this._foStream.init(this._file, PR_WRITE_ONLY | PR_CREATE_FILE | PR_APPEND,
                                      0664, 0);
   },
 
   getLogCallback : function() {
     return function (msg) {
--- a/talos/specialpowers/chrome/specialpowers/content/specialpowersAPI.js
+++ b/talos/specialpowers/chrome/specialpowers/content/specialpowersAPI.js
@@ -132,17 +132,21 @@ SpecialPowersAPI.prototype = {
         rval[obj] = ival[obj];
       }
     }
     return retVal;
   },
 
   get ID() {
     var appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
-    return appInfo.ID;
+    try {
+      var id = appInfo.ID;
+      return id;
+    } catch(err) {};
+    return null;
   },
 
   get Version() {
     var appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
     return appInfo.version;
   },
 
   get BuildID() {
--- a/talos/xtalos/etlparser.py
+++ b/talos/xtalos/etlparser.py
@@ -77,18 +77,21 @@ class XPerfAutoLog(object):
       os = testos,
       platform = testplatform,
       machine = self.yaml_config['title'],
       starttime = int(time.time()),
       builder = '%s_%s-opt_test-%s' % (self.yaml_config['title'], os, testname),
       restserver = 'http://10.2.74.141/autologserver'
     )
   
+    tree = self.yaml_config.get('repository', '')
+    if tree:
+      tree = tree.split('/')[-1]
     self.testGroup.set_primary_product(
-      tree = self.yaml_config['repository'].split('/')[-1], 
+      tree = tree,
       buildtype = 'opt', #we only run talos on opt builds
       buildid = self.yaml_config['buildid'],
       revision = self.yaml_config['sourcestamp'],
     )
 
   def addData(self, filename, readcount, readbytes, writecount, writebytes):
     if (self.testGroup == None):
       self.autolog_init()