talos/getInfo.html
author Joel Maher <jmaher@mozilla.com>
Fri, 29 Jun 2012 12:09:25 -0400
changeset 474 4c23320b480a80cff7c39d63a01eb081a33759bb
parent 468 18898c970f8af7d7d09066145a100e9bd488678f
child 517 6d1c5ee867e620508b59f2163e90ebc27c53a2bc
permissions -rw-r--r--
Bug 715588 - talos has enablePrivilege. fix xul with no specialpowers. r=jhammel

<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this file,
   - You can obtain one at http://mozilla.org/MPL/2.0/.  -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <meta charset="utf-8">
  <head>
    <script language="Javascript" type="text/javascript" src="scripts/MozillaFileLogger.js"></script>
    <script language="Javascript" type="text/javascript" src="page_load_test/quit.js"></script>
    <script>

  function setup() {
    var id;
    var verison;
    var buildid;

    if (!useSpecialPowers) {
      try {
        netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesRead UniversalPreferencesWrite UniversalXPConnect');
        var appInfo = Components.classes['@mozilla.org/xre/app-info;1']
                                .getService(Components.interfaces.nsIXULAppInfo);

        //NOTE: version and buildid work fine, but appInfo.ID throws an exception on XUL Fennec, so we need to do that last.
        version = appInfo.Version;
        buildid = appInfo.appBuildID;
        id = appInfo.ID;
      } 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];

    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';

    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');
    goQuitApplication();
    window.close();
">
  </body>
</html>