tor-browser

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

head.js (1489B)


      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 Services.scriptloader.loadSubScript(
      8  "chrome://mochitests/content/browser/remote/shared/messagehandler/test/browser/head.js",
      9  this
     10 );
     11 
     12 /**
     13 * Broadcast the provided method to WindowGlobal contexts on a MessageHandler
     14 * network.
     15 * Returns a promise which will resolve the result of the command broadcast.
     16 *
     17 * @param {string} module
     18 *     The name of the module implementing the command to broadcast.
     19 * @param {string} command
     20 *     The name of the command to broadcast.
     21 * @param {object} params
     22 *     The parameters for the command.
     23 * @param {ContextDescriptor} contextDescriptor
     24 *     The context descriptor to use for this broadcast
     25 * @param {RootMessageHandler} rootMessageHandler
     26 *     The root of the MessageHandler network.
     27 * @returns {Promise.<Array>}
     28 *     Promise which resolves an array where each item is the result of the
     29 *     command handled by an individual context.
     30 */
     31 function sendTestBroadcastCommand(
     32  module,
     33  command,
     34  params,
     35  contextDescriptor,
     36  rootMessageHandler
     37 ) {
     38  info("Send a test broadcast command");
     39  return rootMessageHandler.handleCommand({
     40    moduleName: module,
     41    commandName: command,
     42    params,
     43    destination: {
     44      contextDescriptor,
     45      type: WindowGlobalMessageHandler.type,
     46    },
     47  });
     48 }