While implementing Bug 1646028 to support highlighters working across frames from different processes, we introduced the limitation that only one highlighter of a certain type can be visible at one time.
This allowed for a straightforward solution to hide the Box Model Highlighters from other frames when showing the same highlighter type in a specific frame (for example, when using the node picker to highlight nodes from a page with frames from different origins).
But this constraint also limited the ability to use multiple instances of the same highlighter type where it was necessary. For example, in the Animation Inspector, in
setHighlightedNode(nodeFront), we had to use to an instance of Selector Highlighter in order to have a persistent highlighter which wouldn't be unexpectedly hidden as the user moused over nodes in the Markup view which toggle the Box Model Highlighter. Ideally, we'd use separate instances of Box Model Highlighter.
It is desirable to switch from a "highlighter by type" approach in
devtools/client/inspector/shared/highlighters-overlay.js to a "highlighter by role" whereby multiple instances of the same highlighter type can be visible at a time so long as they're used in different roles as per the example above for the Animation Inspector. See discussion on https://phabricator.services.mozilla.com/D85861