testing/talos/talos/tests/tabpaint/content/target.html
author Joel Maher <jmaher@mozilla.com>
Mon, 21 Mar 2016 04:11:59 -0700
changeset 289711 73bef86f117222773ad2d06d55964915c41ad180
permissions -rw-r--r--
Bug 1258015 - tabpaint test is missing target.html file. r=mconley MozReview-Commit-ID: AlK80UiqNyv

<html>
<head>
<title>TABPAINT</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
</head>
<body>
<p>TABPAINT</p>
</body>
<script>
  const { classes: Cc, interfaces: Ci } = Components;

  /**
   * When this page is loaded, we expect a search string to be
   * appended with the "starting time" (in ms) of when the tab
   * was opened.
   *
   * Example: target.htmml?1457063506846
   */
  addEventListener("load", function onLoad() {
    removeEventListener("load", onLoad);
    addEventListener("MozAfterPaint", function onPaint() {
      let presented = Date.now();
      removeEventListener("MozAfterPaint", onPaint);

      let opened = parseInt(location.search.substring(1), 10);
      let delta = presented - opened;

      let mm = window.QueryInterface(Ci.nsIInterfaceRequestor)
                     .getInterface(Ci.nsIWebNavigation)
                     .QueryInterface(Ci.nsIInterfaceRequestor)
                     .getInterface(Ci.nsIContentFrameMessageManager);

      mm.sendAsyncMessage("TabPaint:Painted", { delta });
    });
  });
</script>
</html>