async rdpInstallExtensions()

in src/extension-runners/firefox-android.js [526:571]


  async rdpInstallExtensions() {
    const {
      selectedTCPPort,
      params: { extensions, firefoxClient },
    } = this;

    const remoteFirefox = (this.remoteFirefox = await firefoxClient({
      port: selectedTCPPort,
    }));

    // Exit and cleanup the extension runner if the connection to the
    // remote Firefox for Android instance has been closed.
    remoteFirefox.client.on('end', () => {
      if (!this.exiting) {
        log.info('Exiting the device because Firefox for Android disconnected');
        this.exit();
      }
    });

    // Install all the temporary addons.
    for (const extension of extensions) {
      const { sourceDir } = extension;
      const adbExtensionPath = this.adbExtensionsPathBySourceDir.get(sourceDir);

      if (!adbExtensionPath) {
        throw new WebExtError(
          `ADB extension path for "${sourceDir}" was unexpectedly empty`,
        );
      }

      const addonId = await remoteFirefox
        .installTemporaryAddon(adbExtensionPath)
        .then((installResult) => {
          return installResult.addon.id;
        });

      if (!addonId) {
        throw new WebExtError(
          'Received an empty addonId from ' +
            `remoteFirefox.installTemporaryAddon("${adbExtensionPath}")`,
        );
      }

      this.reloadableExtensions.set(extension.sourceDir, addonId);
    }
  }