The IDs of actions pinned to the urlbar are kept in
PageActions._persistedActions.idsInUrlbar. To pin all actions to the urlbar,
theoretically all we need to do is add all action IDs to this array, and things
should just work. PageActions already has a migration mechanism that could check
if Proton is enabled and add all the action IDs if it is. However, that would
mean that if Proton were subsequently disabled, or if the user downgraded to a
Firefox without Proton, they'd end up with all their actions still in the
urlbar. They could remove them one by one so it's not a big problem, but it
would be annoying.
Instead, this patch keeps two arrays of urlbar IDs. One stashes the user's
original pinned actions and PageActions never touches it as long as Proton is
enabled, and the other is the usual array that happens to have the IDs of all
the actions when Proton is enabled.
When PageActions initializes
_persistedActions on init (by either loading it
from prefs or using the default value), it moves
_idsInUrlbarNonProton and then sets
idsInUrlbar to an empty array. When
PageActions subsequently registers all the built-in actions, it forces
action._pinnedToUrlbar to true instead of computing it from
pinnedToUrlbar is true, all actions end up in
works as it usually does after that, except that when it stores
_persistedActions back to prefs, it moves
_idsInUrlbarNonProton back to
idsInUrlbar, just for the store.
Ultimately we need to redesign this module. We can remove a lot of it since
Proton removes the panel, and we don't need the
idsInUrlbar array at all since
now all actions must be in the urlbar.