chProvider(candidateShortURL) {
  return (
    SEARCH_SHORTCUTS.filter(match => candidateShortURL === match.shortURL)[0] ||
    null
  );
}

// Check topsite against predefined list of valid search engines
// https://searchfox.org/mozilla-central/rev/ca869724246f4230b272ed1c8b9944596e80d920/toolkit/components/search/nsSearchService.js#939
export async function checkHasSearchEngine(keyword) {
  try {
    return !!(await Services.search.getAppProvidedEngines()).find(
      e => e.aliases.includes(keyword) && !e.hidden
    );
  } catch {
    // When the search service has not successfully initialized,
    // there will be no search engines ready.
    return false;
  }
}
PK