summaryrefslogtreecommitdiffstats
path: root/testing/talos/talos/tests/cpstartup/extension/framescript.js
blob: 972f9388815c81cf0c99419850e72ce8747c981d (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
29
30
31
32
33
34
35
36
37
38
39
40
/* eslint-env mozilla/frame-script */

(function () {
  sendAsyncMessage("CPStartup:BrowserChildReady", {
    time: Services.telemetry.msSystemNow(),
  });

  addEventListener(
    "CPStartup:Ping",
    e => {
      let evt = new content.CustomEvent("CPStartup:Pong", { bubbles: true });
      content.dispatchEvent(evt);
    },
    false,
    true
  );

  addEventListener(
    "CPStartup:Go",
    e => {
      sendAsyncMessage("CPStartup:Go", e.detail);
    },
    false,
    true
  );

  addMessageListener("CPStartup:FinalResults", msg => {
    let evt = Cu.cloneInto(
      {
        bubbles: true,
        detail: msg.data,
      },
      content
    );

    content.dispatchEvent(
      new content.CustomEvent("CPStartup:FinalResults", evt)
    );
  });
})();