DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (c291143e2401)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
<!-- 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/.  -->
<html>
<meta charset="utf-8">
<!-- Pick off begin time as a cgi argument and print it out -->
<!-- call this with an arg, e.g. file://foo/startup-test.html?begin=12345678 -->
<!-- In-line this to avoid compilation. -->
<script language="Javascript" type="text/javascript" src="../talos-powers/content/TalosPowersContent.js"></script>
<script language="Javascript" type="text/javascript" src="../scripts/MozillaFileLogger.js"></script>
<script language="Javascript" type="text/javascript" src="../talos-powers/content/TalosContentProfiler.js"></script>
<script language="javascript" type="text/javascript">

async function painted() {
  window.removeEventListener("MozAfterPaint", painted, true);

  await TalosPowers.loadPromise;

  await TalosContentProfiler.pause();
  await TalosContentProfiler.initFromURLQueryParams(location.search);
  await TalosContentProfiler.finishStartupProfiling();

  let startupInfo = await TalosPowersContent.getStartupInfo();

  let startupTime = startupInfo.firstPaint - startupInfo.process;

  document.body.textContent = "Startup time = " + startupTime + " ms";
  if (window.dump) {
    dumpLog("__start_report" + startupTime + "__end_report\n\n");
  }
  dumpConsoleAndQuit();
}

function failed() {
  if (window.dump) {
    dumpLog("BROWSER FAILED TO GENERATE MOZAFTERPAINT IN 5 SECONDS\n");
  }
  dumpConsoleAndQuit();
}

function dumpConsoleAndQuit() {
  var messages = {};

  try {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    // ChromeUtils is not available in this scope.
    // eslint-disable-next-line mozilla/use-chromeutils-import
    Cu.import("resource://gre/modules/Services.jsm");
    Services.console.getMessageArray(messages, {});
  } catch (ex) {
    dumpLog(ex + "\n");
  }

  for (var i = 0; i < messages.value.length; i++)
    dumpLog(messages.value[i].message + "\n");

  // Close window asynchronously, there might still be startup operations that still need to run
  window.setTimeout(function() {
    if (window.dump) {
      // eslint-disable-next-line mozilla/avoid-Date-timing
      dumpLog("__startTimestamp" + Date.now() + "__endTimestamp\n");
    }
    TalosPowersContent.goQuitApplication();
  }, 0);
}

window.addEventListener("MozAfterPaint", painted, true);
setTimeout(failed, 5000);

</script>
<body></body>
</html>