ProvidersManager Reference

class ProvidersManager(sapName, muxerModules)

Class used to create a manager. There always exists one manager instance per input type. It is responsible to keep a list of provider instances, instantiate query objects and pass those to the providers.

Arguments:
  • sapName (string) – The SAP name this manager is for, e.g. “urlbar”, “searchbar”, …

  • muxerModules (object) – Object with symbol names as keys and module paths as values. Symbols should be UrlbarMuxer instances.

ProvidersManager.chunkResultsDelayMs

This can be set by tests to increase or reduce the chunk delays. See _notifyResultsFromProvider for additional details. To improve dataflow and reduce UI work, when a result is added we may notify it to the controller after a delay, so that we can chunk results in that timeframe into a single call. See _notifyResultsFromProvider for details.

ProvidersManager.interruptLevel

Interrupt() allows to stop any running SQL query, some provider may be running a query that shouldn’t be interrupted, and if so it should bump this through disableInterrupt and enableInterrupt.

ProvidersManager.providers

type: Array.<UrlbarProvider>

Tracks the available providers. This is a sorted array, with HEURISTIC providers at the front.

ProvidersManager.cancelQuery(queryContext)

Cancels a running query.

Arguments:
  • queryContext (UrlbarQueryContext) – The query context object

ProvidersManager.getProvider(name)

Returns the provider with the given name.

Arguments:
  • name (string) – The provider name.

Returns:

UrlbarProvider|undefined – The provider.

ProvidersManager.notifyEngagementChange(state, queryContext, details, controller, visibleResults)

Notifies all providers about changes in user engagement with the urlbar. This function centralizes the dispatch of engagement-related events to the appropriate providers based on the current state of interaction.

Arguments:
  • state (“engagement”|”abandonment”) – The state of the engagement, one of: engagement, abandonment

  • queryContext (UrlbarQueryContext) – The engagement’s query context, if available.

  • details (object) – An object that describes the search string and the picked result, if any.

  • controller (UrlbarParentController) – The controller associated with the engagement

  • visibleResults (Array.<UrlbarResult>) – The results shown at engagement. Passed on the message path, where the parent’s view has none; falls back to the view on the direct path.

ProvidersManager.registerMuxer(muxer)

Registers a muxer object with the manager.

Arguments:
  • muxer (UrlbarMuxer) – a UrlbarMuxer object

ProvidersManager.registerProvider(provider)

Registers a provider object with the manager.

Arguments:
  • provider (object) – The provider object to register.

ProvidersManager.startQuery(queryContext, controller=null)

Starts querying.

Arguments:
  • queryContext (UrlbarQueryContext) – The query context object

  • controller (UrlbarParentController) – a UrlbarParentController instance

ProvidersManager.unregisterMuxer(muxer)

Unregisters a previously registered muxer object.

Arguments:
  • muxer (UrlbarMuxer|string) – a UrlbarMuxer object or name.

ProvidersManager.unregisterProvider(provider)

Unregisters a previously registered provider object.

Arguments:
  • provider (object) – The provider object to unregister.

static ProvidersManager.getInstanceForSap(sapName)

Gets a cached ProvidersManager for the given SAP name, or creates a new one.

Arguments:
  • sapName (string) – The SAP name.

Returns:

ProvidersManager – The ProvidersManager instance.

static ProvidersManager.runInCriticalSection(taskFn)

A provider can use this util when it needs to run a SQL query that can’t be interrupted. Otherwise, when a query is canceled any running SQL query is interrupted abruptly.

Arguments:
  • taskFn (function) – a Task to execute in the critical section.