Address Bar and Search Bars
This document describes the implementation of Firefox’s address bar, also known as the quantumbar or urlbar. The address bar was also called the awesomebar until Firefox 68, when it was substantially rewritten.
The same code also runs the search bar in the toolbar and the search bar on the New Tab page, so most of these pages apply to all three.
The address bar is a specialized search access point that aggregates data from several different sources, including:
Places (Firefox’s history and bookmarks system)
Search engines (including search suggestions)
WebExtensions
Open tabs
Where to Start
If you want a high level, nontechnical summary of how the address bar works, read Nontechnical Overview.
If you are interested in the technical details, you might want to skip ahead to Architecture.
Codebase
The code lives in browser/components/urlbar, which is where the often-used urlbar shorthand comes from.
Table of Contents
- Nontechnical Overview
- Architecture
- Search Lifecycle
- The Process Boundary
- Writing Code for the Message Path
- Utilities
- UrlbarPrefs.sys.mjs
- UrlbarContentPrefs.mjs
- UrlbarUtils.sys.mjs
- UrlbarShared.mjs
- UrlbarContentUtils.mjs
UrlbarContentUtilsUrlbarContentUtils.getContainers()UrlbarContentUtils.getDisplaySpec()UrlbarContentUtils.getFixupPrimitives()UrlbarContentUtils.getPlatform()UrlbarContentUtils.getSupportUrl()UrlbarContentUtils.isTextDirectionRTL()UrlbarContentUtils.isWindowPrivate()UrlbarContentUtils.unEscapeURIForUI()UrlbarContentUtils.usesMessagePath()UrlbarContentUtils.whereToOpenLink()UrlbarContentUtils.willLoadInBackground()
- Telemetry
- Histograms
- Scalars
- urlbar.abandonment
- urlbar.autofill_deletion
- urlbar.engagement
- urlbar.impression.*
- urlbar.persistedsearchterms.revert_by_popup_count
- urlbar.persistedsearchterms.view_count
- urlbar.tips
- urlbar.searchmode.*
- urlbar.picked.*
- urlbar.picked.searchmode.*
- urlbar.tabtosearch.*
- urlbar.zeroprefix.abandonment
- urlbar.zeroprefix.engagement
- urlbar.zeroprefix.exposure
- urlbar.quickaction.picked
- urlbar.unifiedsearchbutton.opened
- urlbar.unifiedsearchbutton.picked
- places.*
- Search Engagement Telemetry
- Custom pings for Contextual Services
- Other telemetry relevant to the Address Bar
- Firefox Suggest Telemetry
- Histograms
- Scalars
- browser.ui.interaction.preferences_paneSearch
- contextual.services.quicksuggest.block_dynamic_wikipedia
- contextual.services.quicksuggest.block_nonsponsored
- contextual.services.quicksuggest.block_nonsponsored_bestmatch
- contextual.services.quicksuggest.block_sponsored
- contextual.services.quicksuggest.block_sponsored_bestmatch
- contextual.services.quicksuggest.block_weather
- contextual.services.quicksuggest.click
- contextual.services.quicksuggest.click_dynamic_wikipedia
- contextual.services.quicksuggest.click_nav_notmatched
- contextual.services.quicksuggest.click_nav_shown_heuristic
- contextual.services.quicksuggest.click_nav_shown_nav
- contextual.services.quicksuggest.click_nav_superceded
- contextual.services.quicksuggest.click_nonsponsored
- contextual.services.quicksuggest.click_nonsponsored_bestmatch
- contextual.services.quicksuggest.click_sponsored
- contextual.services.quicksuggest.click_sponsored_bestmatch
- contextual.services.quicksuggest.click_weather
- contextual.services.quicksuggest.exposure_weather
- contextual.services.quicksuggest.help
- contextual.services.quicksuggest.help_dynamic_wikipedia
- contextual.services.quicksuggest.help_nonsponsored
- contextual.services.quicksuggest.help_nonsponsored_bestmatch
- contextual.services.quicksuggest.help_sponsored
- contextual.services.quicksuggest.help_sponsored_bestmatch
- contextual.services.quicksuggest.help_weather
- contextual.services.quicksuggest.impression
- contextual.services.quicksuggest.impression_dynamic_wikipedia
- contextual.services.quicksuggest.impression_nav_notmatched
- contextual.services.quicksuggest.impression_nav_shown
- contextual.services.quicksuggest.impression_nav_superceded
- contextual.services.quicksuggest.impression_nonsponsored
- contextual.services.quicksuggest.impression_nonsponsored_bestmatch
- contextual.services.quicksuggest.impression_sponsored
- contextual.services.quicksuggest.impression_sponsored_bestmatch
- contextual.services.quicksuggest.impression_weather
- Events
- Environment
- The “quick-suggest” Ping
- Nimbus Exposure Event
- Merino Search Queries
- Debugging & Logging
- Ranking
- Dynamic Result Types
- Adding a Search Bar
- Preferences
- Testing
- Getting in Touch
API Reference
- ProvidersManager Reference
ProvidersManagerProvidersManager.chunkResultsDelayMsProvidersManager.interruptLevelProvidersManager.providersProvidersManager.cancelQuery()ProvidersManager.getProvider()ProvidersManager.notifyEngagementChange()ProvidersManager.registerMuxer()ProvidersManager.registerProvider()ProvidersManager.startQuery()ProvidersManager.unregisterMuxer()ProvidersManager.unregisterProvider()ProvidersManager.getInstanceForSap()ProvidersManager.runInCriticalSection()
- UrlbarChildController Reference
UrlbarChildControllerUrlbarChildController.UrlbarChildControllerUrlbarChildController.engagementEventUrlbarChildController.inputUrlbarChildController.isProxyUrlbarChildController.parentControllerUrlbarChildController.userSelectionBehaviorUrlbarChildController.windowUrlbarChildController.discardResults()UrlbarChildController.handleKeyNavigation()UrlbarChildController.isCanonizeKeyboardEvent()UrlbarChildController.keyEventMovesCaret()UrlbarChildController.notify()UrlbarChildController.notifyFromWire()UrlbarChildController.startQuery()UrlbarChildController.updateEngineStore()UrlbarChildController.whereToOpen()
- UrlbarInputBase Reference
UrlbarInputBaseUrlbarInputBase._autofillPlaceholderUrlbarInputBase._keyDownEnterDeferredUrlbarInputBase.addSearchEngineHelperUrlbarInputBase.handlesOpenInCommandsUrlbarInputBase.isComposingUrlbarInputBase.isSearchbarSAPUrlbarInputBase.lastQueryContextPromiseUrlbarInputBase.onSearchEngineUpdateUrlbarInputBase.placeholderUrlbarInputBase.readOnlyUrlbarInputBase.searchModeUrlbarInputBase.selectionEndUrlbarInputBase.selectionStartUrlbarInputBase.variantAUrlbarInputBase.variantBUrlbarInputBase.windowModeUrlbarInputBase.fragmentUrlbarInputBase._autofillFirstResult()UrlbarInputBase._autofillValue()UrlbarInputBase._maybeAutofillPlaceholder()UrlbarInputBase._maybeCanonizeURL()UrlbarInputBase._on_dragover()UrlbarInputBase._on_drop()UrlbarInputBase._recordSearch()UrlbarInputBase._resetSearchState()UrlbarInputBase._searchModeForResult()UrlbarInputBase._setPlaceholder()UrlbarInputBase._trimValue()UrlbarInputBase._updateSearchModeUI()UrlbarInputBase.addContextMenuItems()UrlbarInputBase.afterTabSwitchFocusChange()UrlbarInputBase.confirmSearchMode()UrlbarInputBase.formatValue()UrlbarInputBase.getSearchMode()UrlbarInputBase.getSearchSource()UrlbarInputBase.handleCommand()UrlbarInputBase.handleEmptyValueNavigation()UrlbarInputBase.handleEvent()UrlbarInputBase.handleNavigation()UrlbarInputBase.handoff()UrlbarInputBase.initSapContextMenuItems()UrlbarInputBase.makeURIReadable()UrlbarInputBase.maybeConfirmSearchModeFromResult()UrlbarInputBase.onFirstResult()UrlbarInputBase.onLocationChange()UrlbarInputBase.onPrefChanged()UrlbarInputBase.openSearchEnginePage()UrlbarInputBase.pickElement()UrlbarInputBase.pickResult()UrlbarInputBase.removeHiddenFocus()UrlbarInputBase.restoreSearchModeState()UrlbarInputBase.sapConnectedCallback()UrlbarInputBase.sapDisconnectedCallback()UrlbarInputBase.sapInit()UrlbarInputBase.search()UrlbarInputBase.searchModeForToken()UrlbarInputBase.searchModeShortcut()UrlbarInputBase.setHiddenFocus()UrlbarInputBase.setPageProxyState()UrlbarInputBase.setResultForCurrentValue()UrlbarInputBase.setSearchMode()UrlbarInputBase.setURI()UrlbarInputBase.setUnifiedSearchButtonAvailability()UrlbarInputBase.setValue()UrlbarInputBase.setValueFromResult()UrlbarInputBase.startQuery()UrlbarInputBase.updatePlaceholder()UrlbarInputBase.updatePopover()UrlbarInputBase.updateTextOverflow()
- UrlbarMuxer Reference
- UrlbarParentController Reference
UrlbarParentControllerUrlbarParentController.UrlbarParentControllerUrlbarParentController._lastAutofillReintegrationPromiseUrlbarParentController.browserWindowUrlbarParentController.inputUrlbarParentController.liveResultsUrlbarParentController.managerUrlbarParentController.observeUrlbarParentController.platformUrlbarParentController.rendersInContentProcessUrlbarParentController.viewUrlbarParentController.addToInputHistory()UrlbarParentController.cancelQuery()UrlbarParentController.checkKeywordURIFixup()UrlbarParentController.clearAutofillBackspaceEntryForUrl()UrlbarParentController.clearLastQueryContextCache()UrlbarParentController.destroy()UrlbarParentController.dismissAutofill()UrlbarParentController.focusBrowser()UrlbarParentController.getEngineIconURL()UrlbarParentController.getHeuristicResult()UrlbarParentController.handleAutofillReintegration()UrlbarParentController.loadURL()UrlbarParentController.markEngineAsUsed()UrlbarParentController.maybeInitEngineStore()UrlbarParentController.notify()UrlbarParentController.onBeforeSelection()UrlbarParentController.onSelection()UrlbarParentController.openContainerCreationPanel()UrlbarParentController.openPreferences()UrlbarParentController.openSERP()UrlbarParentController.openSearchForm()UrlbarParentController.receiveResults()UrlbarParentController.recordAutofillBackspace()UrlbarParentController.recordAutofillDeletion()UrlbarParentController.recordEngagement()UrlbarParentController.recordSearch()UrlbarParentController.recordSearchForm()UrlbarParentController.recordSearchInOpenedTab()UrlbarParentController.recordSearchMode()UrlbarParentController.recordZeroPrefix()UrlbarParentController.removeResult()UrlbarParentController.resetEngagement()UrlbarParentController.resolveFallbackNavigation()UrlbarParentController.resolveTargetBrowser()UrlbarParentController.setChild()UrlbarParentController.setLastQueryContextCache()UrlbarParentController.speculativeConnect()UrlbarParentController.startQuery()UrlbarParentController.startTrackingBuiltBounce()UrlbarParentController.switchToTab()
- UrlbarProvider Reference
UrlbarProviderUrlbarProvider.deferUserSelectionUrlbarProvider.nameUrlbarProvider.queryInstanceUrlbarProvider.typeUrlbarProvider.cancelQuery()UrlbarProvider.getPriority()UrlbarProvider.getResultCommands()UrlbarProvider.getViewTemplate()UrlbarProvider.getViewUpdate()UrlbarProvider.isActive()UrlbarProvider.onAbandonment()UrlbarProvider.onBeforeSelection()UrlbarProvider.onEngagement()UrlbarProvider.onImpression()UrlbarProvider.onSearchSessionEnd()UrlbarProvider.onSelection()UrlbarProvider.startQuery()UrlbarProvider.tryMethod()
- UrlbarQueryContext Reference
UrlbarQueryContextUrlbarQueryContext.allowAutofillUrlbarQueryContext.canceledUrlbarQueryContext.currentPageUrlbarQueryContext.excludeSponsoredResultsUrlbarQueryContext.firstResultUrlbarQueryContext.firstResultChangedUrlbarQueryContext.fixupErrorUrlbarQueryContext.fixupInfoUrlbarQueryContext.heuristicResultUrlbarQueryContext.idUrlbarQueryContext.isPrivateUrlbarQueryContext.isSearchbarSAPUrlbarQueryContext.keywordEnabledUrlbarQueryContext.maxResultsUrlbarQueryContext.muxerUrlbarQueryContext.navigationEnabledUrlbarQueryContext.navigationInSearchModeEnabledUrlbarQueryContext.prohibitRemoteResultsUrlbarQueryContext.providersUrlbarQueryContext.restrictSourceUrlbarQueryContext.restrictTokenUrlbarQueryContext.resultsUrlbarQueryContext.sapNameUrlbarQueryContext.searchModeUrlbarQueryContext.searchStringUrlbarQueryContext.sourcesUrlbarQueryContext.tabGroupUrlbarQueryContext.tokensUrlbarQueryContext.userContextIdUrlbarQueryContext.allowRemoteResults()UrlbarQueryContext.restrictInSearchMode()UrlbarQueryContext.toWire()UrlbarQueryContext.fromWire()
- UrlbarResult Reference
UrlbarResultUrlbarResult.autofillUrlbarResult.commandsUrlbarResult.exposureTelemetryUrlbarResult.groupUrlbarResult.hasSuggestedIndexUrlbarResult.heuristicUrlbarResult.hideRowLabelUrlbarResult.iconUrlbarResult.idUrlbarResult.isBestMatchUrlbarResult.isBottomUrlSuggestionUrlbarResult.isHiddenExposureUrlbarResult.isRichSuggestionUrlbarResult.isSERPUrlbarResult.isSuggestedIndexRelativeToGroupUrlbarResult.payloadUrlbarResult.providerNameUrlbarResult.providerTypeUrlbarResult.resultSpanUrlbarResult.richSuggestionIconSizeUrlbarResult.richSuggestionIconVariationUrlbarResult.rowIndexUrlbarResult.rowLabelUrlbarResult.showFeedbackMenuUrlbarResult.sourceUrlbarResult.suggestedIndexUrlbarResult.typeUrlbarResult.getDisplayableValueAndHighlights()UrlbarResult.toString()UrlbarResult.toWire()UrlbarResult.fromWire()
- UrlbarView Reference
UrlbarViewUrlbarView.chromeWindowUrlbarView.isOpenUrlbarView.queryContextUrlbarView.selectedElementUrlbarView.selectedResultUrlbarView.visibleRowCountUrlbarView.acknowledgeFeedback()UrlbarView.autoOpen()UrlbarView.clearSelection()UrlbarView.close()UrlbarView.getFirstSelectableElement()UrlbarView.getLastSelectableElement()UrlbarView.getResultAtIndex()UrlbarView.getResultFromElement()UrlbarView.handleEvent()UrlbarView.maybeRollupPopups()UrlbarView.onQueryCancelled()UrlbarView.onQueryFinished()UrlbarView.onQueryResultRemoved()UrlbarView.onQueryResults()UrlbarView.onQueryStarted()UrlbarView.resultIsSelected()UrlbarView.selectBy()UrlbarView.shouldSpaceActivateSelectedElement()UrlbarView.telemetryTypeFromElement()UrlbarView.telemetryTypeFromResult()UrlbarView.updateResultMenuCommands()