tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GeckoViewActorManager.sys.mjs (799B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
      6 
      7 const actors = new Set();
      8 
      9 export var GeckoViewActorManager = {
     10  addJSWindowActors(actors) {
     11    for (const [actorName, actor] of Object.entries(actors)) {
     12      this._register(actorName, actor);
     13    }
     14  },
     15 
     16  _register(actorName, actor) {
     17    if (actors.has(actorName)) {
     18      // Actor already registered, nothing to do
     19      return;
     20    }
     21 
     22    ChromeUtils.registerWindowActor(actorName, actor);
     23    actors.add(actorName);
     24  },
     25 };
     26 
     27 const { debug, warn } = GeckoViewUtils.initLogging("GeckoViewActorManager");