tor-browser

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

event.sys.mjs (929B)


      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  /**
     11   * Commands
     12   */
     13 
     14  testEmitEvent() {
     15    // Emit a payload including the contextId to check which context emitted
     16    // a specific event.
     17    const text = `event from ${this.messageHandler.contextId}`;
     18    this.emitEvent("event-from-window-global", { text });
     19  }
     20 
     21  testEmitEventCancelableWithInterception(params) {
     22    this.emitEvent("event.testEventCancelableWithInterception", {
     23      shouldCancel: params.shouldCancel,
     24    });
     25  }
     26 
     27  testEmitEventWithInterception() {
     28    this.emitEvent("event.testEventWithInterception", {});
     29  }
     30 }
     31 
     32 export const event = EventModule;