We ran the Unified Extensions migration method on each CUI init on the
off-chance that we would need to turn off or reverse the migration for
some reason.
Now that 109 has rolled out successfully, we can make this a one-time
migration for anybody that isn't following each version (for example,
ESR channel users).
Differential Revision: https://phabricator.services.mozilla.com/D167584
This patch removes the use of the "unified extensions" pref and adjust
the existing tests. More clean-ups will be done in follow-ups, e.g. the
removal of `gUnifiedExtensions.isEnabled` and some test-only changes to
no longer create a new window in each test file.
Differential Revision: https://phabricator.services.mozilla.com/D166908
We have a function, OverflowableToolbar.findOverflowedInsertionPoints, whose job it is to compute
the right insertion point for a widget if the widget is being inserted into an overflowable
toolbar.
That function failed to account for the possibility that the widget was a browser action, and
would return the #defaultList instead of the #webExtList if the item was overflowing. This
patch checks the ID of the widget first, and then supplies the correct list.
Differential Revision: https://phabricator.services.mozilla.com/D162586
The WebExtension overflow list is created lazily because the panel itself is lazy, and only gets
inserted the first time it is needed. Originally, I had written a separate function `#getWebExtList()`
to do the work of forcing the WebExtension overflow list to de-lazify, and then hold a reference
to it in #webExtList.
It turns out, that's a bit of a footgun. More than once, I've used #webExtList directly, forgetting
that the value might turn out to be `null` because the list hasn't delazified yet.
In order to smooth out that rough edge, this patch makes `#webExtList` a memoizing (evalutes once,
caches the return value for subsequent calls) getter so that anything that uses it doesn't have
to worry about the lazification. The reference member is now called #webExtListRef, and I've
added documentation about how it's probably best not to use it directly.
Differential Revision: https://phabricator.services.mozilla.com/D162585
We have some internal bookkeeping within OverflowableToolbar to remember the state of things that
have overflowed, like how wide the window needs to be before they can be moved back, etc. When an
item is removed from an overflowable toolbar while overflowed, we update that internal bookkeeping
so that OverflowableToolbar doesn't accidentally try to move those items back into the toolbar
when the window becomes wide enough again.
We've added a new overflow list for extension buttons, but we weren't updating our internal accounting
when items had been overflowed into that list. This patch fixes that.
Differential Revision: https://phabricator.services.mozilla.com/D162434
Even if Unified Extensions is enabled, it is expected that each registered area
will have a placements array set in gPlacements. When resetting, that's normally
re-created in restoreStateForArea, but we were skipping that call for AREA_ADDONS,
and then manually setting the placements array - but only if Unified Extensions
was enabled.
This change makes it so that we always set it when resetting.
Differential Revision: https://phabricator.services.mozilla.com/D162306
This isn't a migration just yet. I'm following the same technique that we seemed to follow
when we first introduced the original overflow menu (see bug 1354117) - I'm going to add
a function to do the migration here, with a mechanism for (somewhat) reversing the
migration if the preference gets flipped back to false at some point.
There is no expectation that this preference will be flipped back to false - it's more of
a safety mechanism. Once we're confident that the routine in the function properly moves
items to right places, we can convert it to a proper migration so that it only runs
once on startup for folks who upgrade.
Differential Revision: https://phabricator.services.mozilla.com/D161839
This area doesn't have any special rules applied yet, nor can it have items moved to
it except programmatically. All of that will come later, including tests.
Differential Revision: https://phabricator.services.mozilla.com/D161079
Long ago, the menu panel in was a customizable area that users could drag things into.
That changed back around 2017 in bug 1354117 when the Photon redesign was built. The
menu panel become a static menu, but we also made it possible to permanently move things
to the overflow panel of the nav-bar.
It looks like we never updated the area type constant from referring to the old menu panel
though, so it's "TYPE_MENU_PANEL", and registering a node for it happens with
registerMenuPanel. This patch changes to constant to TYPE_PANEL and updates the registration
method to registerPanelNode.
I a check around the codebase as well as GitHub looking to see if there were any
system add-ons or experimental WebExtensions that rely on TYPE_MENU_PANEL / registerMenuPanel,
but I couldn't find any.
Differential Revision: https://phabricator.services.mozilla.com/D161078
This property, along with the CustomizableUI.isWebExtensionWidget, will make it possible
to distinguish WebExtension-provided widgets without sniffing CSS classes, which is what
we currently do.
In the event that the widget has been destroyed or hasn't yet been created, this will
fallback to looking for the `-browser-action` suffix on the ID. This is mainly for use during
migrations which happen early during CustomizableUI startup, when it's unlikely that the
extensions have finished initializing themselves and creating their widgets yet.
Differential Revision: https://phabricator.services.mozilla.com/D160802
When Unified Extensions is enabled, we want to make it so that any WebExtension browser_actions
overflow into the Unified Extensions panel instead of the default overflow panel.
Depends on D160292
Differential Revision: https://phabricator.services.mozilla.com/D160293
This patch makes it so that OverflowableToolbar.#moveItemsBackToTheirOrigin
is not coupled to the existing overflowed item list, and instead takes
advantage of the insert-order provided when calling #overflowedInfo.entries()
and queries the DOM for the overflowed item IDs directly.
A later patch in this series is going to conditionally move overflowed
items into different panels based on whether or not they're provided
by WebExtensions, and so this change means that #moveItemsBackToTheirOrigin
is not going to care which panel the overflowed items are in, it should
behave the same.
Differential Revision: https://phabricator.services.mozilla.com/D160292
When Unified Extensions is enabled, we want to make it so that any WebExtension browser_actions
overflow into the Unified Extensions panel instead of the default overflow panel.
Differential Revision: https://phabricator.services.mozilla.com/D160293
This patch makes it so that OverflowableToolbar.#moveItemsBackToTheirOrigin
is not coupled to the existing overflowed item list, and instead takes
advantage of the insert-order provided when calling #overflowedInfo.entries()
and queries the DOM for the overflowed item IDs directly.
A later patch in this series is going to conditionally move overflowed
items into different panels based on whether or not they're provided
by WebExtensions, and so this change means that #moveItemsBackToTheirOrigin
is not going to care which panel the overflowed items are in, it should
behave the same.
Differential Revision: https://phabricator.services.mozilla.com/D160292
When Unified Extensions is enabled, we want to make it so that any WebExtension browser_actions
overflow into the Unified Extensions panel instead of the default overflow panel.
Differential Revision: https://phabricator.services.mozilla.com/D160293
This patch makes it so that OverflowableToolbar.#moveItemsBackToTheirOrigin
is not coupled to the existing overflowed item list, and instead takes
advantage of the insert-order provided when calling #overflowedInfo.entries()
and queries the DOM for the overflowed item IDs directly.
A later patch in this series is going to conditionally move overflowed
items into different panels based on whether or not they're provided
by WebExtensions, and so this change means that #moveItemsBackToTheirOrigin
is not going to care which panel the overflowed items are in, it should
behave the same.
Differential Revision: https://phabricator.services.mozilla.com/D160292
This patch does not aim to change the behaviour of OverflowableToolbar
at all. Instead, it:
1. Migrates off of old-school prototype class to a modern ES6 class
2. Uses actual private members and methods rather than underscore
pseudo-private members and methods.
3. Tries to group the methods of OverflowableToolbar into groups like
public methods, private methods, private event handlers, CUI widget
listener methods and finally XPCOM interface implementations.
4. Tries to add JSDoc-style documentation where possible.
Differential Revision: https://phabricator.services.mozilla.com/D160106
The bug fix is in the line:
this._collapsed.set(child.id, targetContentWidth);
we used to set this._target.clientWidth, which doesn't account for the
potentially-overflowing children of this._target. Propagate that from
the _checkOverflow function instead.
I'm not sure what's the best way to write a test for this. Any ideas?
Differential Revision: https://phabricator.services.mozilla.com/D159773
By using delegatesanchor="true", we delegate the anchor node to the
first in-flow box (that is the icon), simplifying a lot of the
hard-coded margins in the CSS.
Do that, plus make menupopup[type="arrow"] work consistently, to
simplify the styling of the bookmarks popup a bit.
Differential Revision: https://phabricator.services.mozilla.com/D158569
For that, we need to min-width: 0 the nav-bar target, which itself
requires us to tweak the overflow detection so that we look at all
children of the customization target, not only the target itself.
Differential Revision: https://phabricator.services.mozilla.com/D159377
(To be landed right after the soft freeze is over)
One interesting consequence of my previous patch in this bug, is that
the time at which the XUL element processes the click event is different
(earlier, at bubbling phase rather than after everything).
This caused some test failures caused by the panel autohide, since now
it goes after than the native handling and the native handling
default-prevents to dispatch the XUL command.
Given we don't check key events for defaultPrevented either, it makes
sense to be consistent.
This uncovered an interesting failure, where the "show more tabs" button
in the sync menu starts closing the panel unexpectedly on click. The
right fix is to use closemenu="none" in that button, since otherwise
that button is not keyboard accessible (this is an issue on current
nightly that this patch fixes).
Differential Revision: https://phabricator.services.mozilla.com/D157584
My guess is that this didn't use to fail so much because
_getOverflowInfo was effectively synchronous before, but after my patch
the flush is lazy, and the promiseDocumentFlushed call is actually
async.
With this change I can't reproduce the failure locally anymore, while
it's trivial to repro this failure with --run-until-failure before this
change.
Differential Revision: https://phabricator.services.mozilla.com/D156418