UrlbarChildController Reference

class UrlbarChildController(options)

The in-process face of the address bar controller. Lives next to the <moz-urlbar> custom element and forwards work that has to happen in the parent process to a paired UrlbarParentController via the UrlbarChild/UrlbarParent JSWindowActor pair. The actor owns the per-instance bookkeeping (instance id, lifetime); this wrapper just holds the controller it hands back.

Today both chrome <moz-urlbar> instances live in the parent process, so the actor pair hands the real UrlbarParentController reference back and method calls happen synchronously. The wrapper exists so that a future content-process <moz-urlbar> (e.g. on about:newtab) can swap in async/message-passing implementations of the same surface without touching UrlbarInput, UrlbarView, or other callers.

Arguments:
UrlbarChildController.UrlbarChildController
UrlbarChildController.input

type: unknown

UrlbarChildController.userSelectionBehavior

type: “arrow”|”tab”|”none”

The selection behavior that the user has used to select a result. The setter ignores a change to “arrow” once “tab” has been recorded, since we want to know that tab was used first.

UrlbarChildController.handleKeyNavigation(event, executeAction=true)

Receives keyboard events from the input and handles those that should navigate within the view or pick the currently selected item.

Arguments:
  • event (KeyboardEvent) – The DOM KeyboardEvent.

  • executeAction (boolean) – Whether the event should actually execute the associated action, or just be managed (at a preventDefault() level). This is used when the event will be deferred by the event bufferer, but preventDefault() and friends should still happen synchronously.

UrlbarChildController.keyEventMovesCaret(event)

Checks whether a keyboard event that would normally open the view should instead be handled natively by the input field. On certain platforms, the up and down keys can be used to move the caret, in which case we only want to open the view if the caret is at the start or end of the input.

Arguments:
  • event (KeyboardEvent) – The DOM KeyboardEvent.

Returns:

boolean – Returns true if the event should move the caret instead of opening the view.