tor-browser

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

GeckoViewSelectionAction.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 { GeckoViewModule } from "resource://gre/modules/GeckoViewModule.sys.mjs";
      6 
      7 export class GeckoViewSelectionAction extends GeckoViewModule {
      8  onEnable() {
      9    debug`onEnable`;
     10    this.registerListener(["GeckoView:ExecuteSelectionAction"]);
     11  }
     12 
     13  onDisable() {
     14    debug`onDisable`;
     15    this.unregisterListener();
     16  }
     17 
     18  get actor() {
     19    return this.getActor("SelectionActionDelegate");
     20  }
     21 
     22  // Bundle event handler.
     23  onEvent(aEvent, aData) {
     24    debug`onEvent: ${aEvent}`;
     25 
     26    switch (aEvent) {
     27      case "GeckoView:ExecuteSelectionAction": {
     28        this.actor.executeSelectionAction(aData);
     29      }
     30    }
     31  }
     32 }
     33 
     34 const { debug, warn } = GeckoViewSelectionAction.initLogging(
     35  "GeckoViewSelectionAction"
     36 );