summaryrefslogtreecommitdiffstats
path: root/testing/talos/talos/tests/tabswitch/actors/TalosTabSwitchChild.sys.mjs
blob: 5b27d677e321c2dd7360c237bc9f23015a253614 (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
/* 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/. */

import { RemotePageChild } from "resource://gre/actors/RemotePageChild.sys.mjs";

export class TalosTabSwitchChild extends RemotePageChild {
  actorCreated() {
    // Ignore about:blank pages that can get here.
    if (!String(this.document.location).startsWith("about:tabswitch")) {
      return;
    }

    // If an error occurs, it was probably already added by an earlier test run.
    try {
      this.addPage("about:tabswitch", {
        RPMSendQuery: ["tabswitch-do-test"],
      });
    } catch {}

    super.actorCreated();
  }

  handleEvent(event) {}

  receiveMessage(message) {
    if (message.name == "GarbageCollect") {
      this.contentWindow.windowUtils.garbageCollect();
    }
  }
}