summaryrefslogtreecommitdiffstats
path: root/testing/talos/talos/pageloader/chrome/lh_moz.js
blob: 46d4a74a7c234a6a80c98be2b4a931dd1e58a3e7 (plain)
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
/* 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/. */

/* eslint-env mozilla/frame-script */

function _contentPaintHandler() {
  var utils = content.windowUtils;
  if (utils.isMozAfterPaintPending) {
    addEventListener(
      "MozAfterPaint",
      function afterpaint(e) {
        removeEventListener("MozAfterPaint", afterpaint, true);
        sendAsyncMessage("PageLoader:LoadEvent", {});
      },
      true
    );
  } else {
    sendAsyncMessage("PageLoader:LoadEvent", {});
  }
}

addEventListener(
  "load",
  // eslint-disable-next-line no-undef
  contentLoadHandlerCallback(_contentPaintHandler),
  true
);