tor-browser

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

event.sys.mjs (992B)


      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 import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs";
      6 
      7 class EventModule extends Module {
      8  destroy() {}
      9 
     10  interceptEvent(name, payload) {
     11    if (name === "event.testEventWithInterception") {
     12      return {
     13        ...payload,
     14        additionalInformation: "information added through interception",
     15      };
     16    }
     17 
     18    if (name === "event.testEventCancelableWithInterception") {
     19      if (payload.shouldCancel) {
     20        return null;
     21      }
     22      return payload;
     23    }
     24 
     25    return payload;
     26  }
     27 
     28  /**
     29   * Commands
     30   */
     31 
     32  testEmitWindowGlobalInRootEvent(params, destination) {
     33    this.emitEvent("event-from-window-global-in-root", {
     34      text: `windowglobal-in-root event for ${destination.id}`,
     35    });
     36  }
     37 }
     38 
     39 export const event = EventModule;