wait lazy.ActionsProviderQuickActions.getActions({
      input,
      includesExactMatch: true,
    });
    results.forEach(resultKey => {
      let result = new lazy.UrlbarResult({
        type: UrlbarUtils.RESULT_TYPE.DYNAMIC,
        source: UrlbarUtils.RESULT_SOURCE.ACTIONS,
        payload: {
          key: resultKey,
          dynamicType: DYNAMIC_TYPE_NAME,
        },
      });
      addCallback(this, result);
    });
  }

  onEngagement(queryContext, controller, details) {
    lazy.ActionsProviderQuickActions.pickAction(
      queryContext,
      controller,
      details.element
    );
  }

  getViewTemplate(result) {
    let action = lazy.ActionsProviderQuickActions.getAction(result.payload.key);
    let inActive = "isActive" in action && !action.isActive();
    return {
      children: [
        {
          tag: "span",
          classList: ["urlbarView-action-btn"],
          attributes: {
            "data-action": result.payload.key,
            "data-input-length": result.payload.inputLength,
            role: inActive ? "" : "button",
            disabled: inActive,
          },
          children: [
            {
              tag: "img",
              attributes: {
                src: action.icon || DEFAULT_ICON,
              },
            },
            {
              name: `label`,
              tag: "span",
            },
          ],
        },
      ],
    };
  }

  getViewUpdate(result) {
    let action = lazy.ActionsProviderQuickActions.getAction(result.payload.key);

    return {
      label: {
        l10n: { id: action.label },
      },
    };
  }
}
PK