ToolbarContextMenu
This object manages setting the state of the toolbar-context-menu menupopup,
handling events from that popup, and also handles creating dynamic toolbar
control menuitems in other menupopups (see onViewToolbarsPopupShowing
).
- class ToolbarContextMenu()
Various events handlers to set the state of the toolbar-context-menu popup, as well as to handle some commands from that popup.
- static ToolbarContextMenu._getExtensionId(popup)
For an opened menupopup, if the triggerNode was provided by an extension, returns the extension ID. Otherwise, return the empty string.
- Arguments:
popup (DOMNode) – The menupopup that was opened.
- Returns:
string – The ID of the extension that provided the triggerNode, or the empty string if the triggerNode was not provided by an extension.
- static ToolbarContextMenu._getUnwrappedTriggerNode(popup)
Given an opened menupopup, returns the triggerNode that opened that menupopup. If customize mode is enabled, this will return the unwrapped underlying triggerNode, rather than the customize mode wrapper around it.
- Arguments:
popup (DOMNode) – The menupopup to get the unwrapped trigger node for.
- Returns:
DOMNode – The underlying trigger node that opened the menupopup.
- static ToolbarContextMenu._getWidgetId(popup)
For an opened menupopup, if the triggerNode was provided by an extension, returns the widget ID of the triggerNode. Otherwise, return the empty string.
- Arguments:
popup (DOMNode) – The menupopup that was opened.
- Returns:
string – The ID of the extension-provided widget that was the triggerNode, or the empty string if the trigger node was not provided by an extension widget.
- static ToolbarContextMenu.onDownloadsAlwaysOpenPanelChange(event)
Handler for the toolbar-context-always-open-downloads-panel command event that is fired when the checkbox for always showing the downloads panel is changed. This method does the work of updating the internal preference state for always showing the downloads panel.
- Arguments:
event (CommandEvent)
- static ToolbarContextMenu.onDownloadsAutoHideChange(event)
Handler for the toolbar-context-autohide-downloads-button command event that is fired when the checkbox for autohiding the downloads button is changed. This method does the work of updating the internal preference state for auto-hiding the downloads button.
- Arguments:
event (CommandEvent)
- static ToolbarContextMenu.onViewToolbarsPopupShowing(aEvent, aInsertPoint)
This is called when a menupopup for configuring toolbars fires its popupshowing event. There are multiple such menupopups, and this logic tries to work for all of them. This method will insert menuitems into the popup to allow for controlling the toolbars within the browser toolbox.
- Arguments:
aEvent (Event) – The popupshowing event for the menupopup.
aInsertPoint (DOMNode) – The point within the menupopup to insert the controls for each toolbar.
- static ToolbarContextMenu.openAboutAddonsForContextAction(popup)
Handler for the context menu item for managing an extension.
- Arguments:
popup (DOMNode) – The menupopup that triggered extension management.
- Returns:
Promise.<undefined> – Resolves when the extension’s about:addons management page has been opened.
- static ToolbarContextMenu.removeExtensionForContextAction(popup)
Handler for the context menu item for removing an extension.
- Arguments:
popup (DOMNode) – The menupopup that triggered the extension removal.
- Returns:
Promise.<undefined> – Resolves when the extension has been removed.
- static ToolbarContextMenu.reportExtensionForContextAction(popup, reportEntryPoint)
Handler for the context menu item for issuing a report on an extension.
- Arguments:
popup (DOMNode) – The menupopup that triggered the extension report.
reportEntryPoint (string) – A string describing the UI entrypoint for the report.
- Returns:
Promise.<undefined> – Resolves when the extension has been removed.
- static ToolbarContextMenu.updateDownloadsAlwaysOpenPanel(popup)
Makes visible the “always open downloads panel” checkbox in the popup in the event that the downloads button was context clicked. Otherwise, hides that checkbox.
This method also sets the checkbox state depending on the current user configuration for always showing the panel.
- Arguments:
popup (Element) – The toolbar-context-menu element for a window.
- static ToolbarContextMenu.updateDownloadsAutoHide(popup)
Makes visible the “autohide the downloads button” checkbox in the popup in the event that the downloads button was context clicked. Otherwise, hides that checkbox.
This method also sets the checkbox state depending on the current user configuration for hiding the downloads button.
- Arguments:
popup (Element) – The toolbar-context-menu element for a window.
- static ToolbarContextMenu.updateExtension(popup, event)
Updates the toolbar context menu to show the right state if an extension-provided widget acted as the triggerNode. This will, for example, show or hide items for managing the underlying addon.
- Arguments:
popup (DOMNode) – The menupopup for the toolbar context menu.
event (Event) – The popupshowing event for the menupopup.
- Returns:
Promise.<undefined> – Resolves once the menupopup state has been set.