tor-browser

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

shared-worker-initializer.js (672B)


      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
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 const lazy = {};
      8 
      9 ChromeUtils.defineLazyGetter(lazy, "handleDevToolsPacket", () => {
     10  return ChromeUtils.importESModule(
     11    "resource://devtools/server/startup/worker.sys.mjs",
     12    { global: "current" }
     13  ).handleDevToolsPacket;
     14 });
     15 
     16 this.addEventListener("message", async function (event) {
     17  const packet = JSON.parse(event.data);
     18  // Switch on packet type to target different protocols: DevTools or BiDi
     19  lazy.handleDevToolsPacket(packet);
     20 });