       });
      }

      case "Finder:GetInitialSelection": {
        return new Promise(resolve => {
          resolve(this.finder.getActiveSelectionText());
        });
      }

      case "Finder:Find":
        return this.finder.find(data);

      case "Finder:Highlight":
        return this.finder
          .highlight(
            data.highlight,
            data.searchString,
            data.linksOnly,
            data.useSubFrames
          )
          .then(result => {
            if (result) {
              result.browsingContextId = this.browsingContext.id;
            }
            return result;
          });

      case "Finder:UpdateHighlightAndMatchCount":
        return this.finder.updateHighlightAndMatchCount(data).then(result => {
          if (result) {
            result.browsingContextId = this.browsingContext.id;
          }
          return result;
        });

      case "Finder:HighlightAllChange":
        this.finder.onHighlightAllChange(data.highlightAll);
        break;

      case "Finder:EnableSelection":
        this.finder.enableSelection();
        break;

      case "Finder:RemoveSelection":
        this.finder.removeSelection(data.keepHighlight);
        break;

      case "Finder:FocusContent":
        this.finder.focusContent();
        break;

      case "Finder:FindbarClose":
        this.finder.onFindbarClose();
        break;

      case "Finder:FindbarOpen":
        this.finder.onFindbarOpen();
        break;

      case "Finder:KeyPress":
        var KeyboardEvent = this.finder._getWindow().KeyboardEvent;
        this.finder.keyPress(new KeyboardEvent("keypress", data));
        break;

      case "Finder:MatchesCount":
        return this.finder
          .requestMatchesCount(data.searchString, {
            linksOnly: data.linksOnly,
            useSubFrames: data.useSubFrames,
            contextRange: data.contextRange,
          })
          .then(result => {
            if (result) {
              result.browsingContextId = this.browsingContext.id;
            }
            return result;
          });

      case "Finder:ModalHighlightChange":
        this.finder.onModalHighlightChange(data.useModalHighlight);
        break;

      case "Finder:EnableMarkTesting":
        this.finder.highlighter.enableTesting(data.enable);
        break;
    }

    return null;
  }
}
PK