Commit graph

386 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
0bcd46b1b0 Bug 1815866 - Notify for DOM changes when nodes are moved to the palette due to area reset. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D169357
2023-02-09 23:21:14 +00:00
Mike Conley
1bf577cba5 Bug 1801266 - Add CustomizableUI.getCollapsedToolbarIds. r=sclements,Gijs
This returns a Set of all registered toolbar areas that are collapsed by default.

Differential Revision: https://phabricator.services.mozilla.com/D163021
2023-02-06 18:31:39 +00:00
Mike Conley
5de446476e Bug 1805236 - Make the Unified Extensions migration a one-time event using the CUI migration mechanism. r=Gijs
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
2023-01-24 14:19:05 +00:00
Mark Banner
a94fe03b9d Bug 1811334 - Automatically replace Cu.reportError with console.error (most of browser/components). r=settings-reviewers,mconley
Differential Revision: https://phabricator.services.mozilla.com/D167297
2023-01-20 17:49:21 +00:00
William Durand
09093658ff Bug 1799009 - Remove unified extensions pref and non-unified extensions variants from test suite. r=rpl,mconley,fluent-reviewers,desktop-theme-reviewers,Itiel
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
2023-01-19 10:59:25 +00:00
Mike Conley
1dea2f808d Bug 1801678 - Compute the right insertion point for a browser action widget when the toolbar is overflowed. r=Gijs
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
2022-11-24 18:51:19 +00:00
Mike Conley
62b8b0976b Bug 1801678 - Refactor OverflowableToolbar to turn #webExtList into a memoizing getter. r=Gijs
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
2022-11-24 18:51:19 +00:00
Mike Conley
5c458d3f99 Bug 1798377 - Don't display the overflow button unless there's at least 1 item overflowed with non-zero width. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D162576
2022-11-24 18:51:18 +00:00
Mike Conley
bc3e16afed Bug 1800967 - Update internal OverflowableToolbar state when unpinning an extension button from the toolbar when overflowed. r=willdurand,Gijs
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
2022-11-24 18:51:18 +00:00
Mike Conley
a6cc086252 Bug 1801097 - Set the AREA_ADDONS placements when resetting, even if Unified Extensions is disabled. r=Gijs
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
2022-11-17 18:13:44 +00:00
Mike Conley
b1443a9190 Bug 1798896 - Prevent extension buttons from moving to the palette or overflow panel if Unified Extensions is enabled. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D161840
2022-11-17 01:59:58 +00:00
Mike Conley
d5c2a09371 Bug 1798896 - Move extension buttons to the addons panel if Unified Extensions is enabled on startup. r=Gijs
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
2022-11-17 01:59:58 +00:00
Mike Conley
1f6c401024 Bug 1782203 - Add context menu items for pinning and unpinning addon buttons to the toolbar. r=willdurand,extension-reviewers,Itiel
Differential Revision: https://phabricator.services.mozilla.com/D161200
2022-11-15 16:37:23 +00:00
Stanca Serban
d7d2cc6477 Backed out 3 changesets (bug 1782203) for causing lint failures on browser_unified_extensions_overflowable_toolbar.js. CLOSED TREE
Backed out changeset 50e57afebed3 (bug 1782203)
Backed out changeset d17ea376ed45 (bug 1782203)
Backed out changeset e91d51f1ce90 (bug 1782203)
2022-11-15 17:42:22 +02:00
Mike Conley
eee9638cbe Bug 1782203 - Add context menu items for pinning and unpinning addon buttons to the toolbar. r=willdurand,extension-reviewers,Itiel
Differential Revision: https://phabricator.services.mozilla.com/D161200
2022-11-15 15:02:08 +00:00
Csoregi Natalia
f4019206c2 Backed out 4 changesets (bug 1782203, bug 1777484) for failures on browser_unified_extensions_overflowable_toolbar.js. CLOSED TREE
Backed out changeset ae47d92443a7 (bug 1782203)
Backed out changeset 0c90b1d40e9f (bug 1782203)
Backed out changeset 4b4cae098ea0 (bug 1782203)
Backed out changeset 75eba3b7a626 (bug 1777484)
2022-11-15 03:06:21 +02:00
Mike Conley
f12b95a7e7 Bug 1782203 - Add context menu items for pinning and unpinning addon buttons to the toolbar. r=willdurand,extension-reviewers,Itiel
Differential Revision: https://phabricator.services.mozilla.com/D161200
2022-11-14 22:41:09 +00:00
Emilio Cobos Álvarez
f58e73e709 Bug 1799580 - Remove display: -moz-popup. r=TYLin
We already rely on it applying only to XULPopupElement's. Make it
explicit and remove the CSS value.

Differential Revision: https://phabricator.services.mozilla.com/D161552
2022-11-09 20:38:04 +00:00
Csoregi Natalia
9d2ea21e26 Backed out 3 changesets (bug 1799343, bug 1799580) for causing failures on /browser_history_after_appMenu.js. CLOSED TREE
Backed out changeset 63c270ba91ad (bug 1799343)
Backed out changeset 713e6f0fbd20 (bug 1799580)
Backed out changeset 42d1b8742662 (bug 1799343)
2022-11-09 21:26:06 +02:00
Emilio Cobos Álvarez
58a308d108 Bug 1799580 - Remove display: -moz-popup. r=TYLin
We already rely on it applying only to XULPopupElement's. Make it
explicit and remove the CSS value.

Differential Revision: https://phabricator.services.mozilla.com/D161552
2022-11-09 14:19:22 +00:00
Cristian Tuns
01dcbc81d3 Backed out 2 changesets (bug 1799580, bug 1799343) for causing mochitest failures on win7 CLOSED TREE
Backed out changeset fb0df93a4719 (bug 1799580)
Backed out changeset 493c9ca00c91 (bug 1799343)
2022-11-09 07:15:51 -05:00
Emilio Cobos Álvarez
636d705f3b Bug 1799580 - Remove display: -moz-popup. r=TYLin
We already rely on it applying only to XULPopupElement's. Make it
explicit and remove the CSS value.

Differential Revision: https://phabricator.services.mozilla.com/D161552
2022-11-09 09:17:22 +00:00
Mike Conley
373c121342 Bug 1798814 - Prevent non-extension buttons from entering the AREA_ADDONS area. r=cmkm
Differential Revision: https://phabricator.services.mozilla.com/D161096
2022-11-08 14:51:41 +00:00
Mike Conley
2945d873b2 Bug 1797836 - Part 3: Add a new AREA_ADDONS for the Unified Extensions panel. r=Gijs
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
2022-11-08 14:51:40 +00:00
Mike Conley
42a671591b Bug 1797836 - Part 2: Update CUI to have a general TYPE_PANEL instead of TYPE_MENU_PANEL. r=desktop-theme-reviewers,dao,sclements
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
2022-11-08 14:51:40 +00:00
Shane Caraveo
9c2dfd1ba0 Bug 1784946 support views in custom CUI widgets and remove button-and-view widget type r=desktop-theme-reviewers,mconley,dao
Depends on D160802

Differential Revision: https://phabricator.services.mozilla.com/D154471
2022-11-03 09:30:21 +00:00
Mike Conley
c296fe3cc4 Bug 1797838 - Add a webExtension property to CustomizableUI widgets for browserAction buttons. r=dao,willdurand
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
2022-11-02 16:52:59 +00:00
Mike Conley
2938f20372 Bug 1797155 - Part 2: Make it possible to redirect browser action widgets to the Unified Extension panel on overflow. r=sclements,willdurand
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
2022-11-01 21:50:56 +00:00
Mike Conley
a35317ba29 Bug 1797155 - Part 1: Don't walk the #list children directly in OverflowableToolbar.#moveItemsBackToTheirOrigin. r=sclements
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
2022-11-01 21:50:55 +00:00
Butkovits Atila
a5fa6f4b4b Backed out 3 changesets (bug 1797155) for causing failures at browser_unified_extensions_overflowable_toolbar.js. CLOSED TREE
Backed out changeset 67f5e4af25b6 (bug 1797155)
Backed out changeset b8a8bd646606 (bug 1797155)
Backed out changeset ec7cdd68c414 (bug 1797155)
2022-11-01 19:33:25 +02:00
Mike Conley
b41c17430f Bug 1797155 - Part 2: Make it possible to redirect browser action widgets to the Unified Extension panel on overflow. r=sclements,willdurand
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
2022-11-01 16:44:33 +00:00
Mike Conley
317d9e2c47 Bug 1797155 - Part 1: Don't walk the #list children directly in OverflowableToolbar.#moveItemsBackToTheirOrigin. r=sclements
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
2022-11-01 16:44:32 +00:00
Marian-Vasile Laza
18bb50b232 Backed out 3 changesets (bug 1797155) for causing bc failures on browser_unified_extensions_overflowable_toolbar.js. CLOSED TREE
Backed out changeset ee3f27f43bc5 (bug 1797155)
Backed out changeset 863603ed770a (bug 1797155)
Backed out changeset 3fbfc3d94e5a (bug 1797155)
2022-10-31 21:29:22 +02:00
Mike Conley
1d297656a0 Bug 1797155 - Part 2: Make it possible to redirect browser action widgets to the Unified Extension panel on overflow. r=sclements,willdurand
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
2022-10-31 18:05:20 +00:00
Mike Conley
987736f440 Bug 1797155 - Part 1: Don't walk the #list children directly in OverflowableToolbar.#moveItemsBackToTheirOrigin. r=sclements
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
2022-10-31 18:05:19 +00:00
Emilio Cobos Álvarez
c6a71bdc14 Bug 1797156 - Fix browser_976792_insertNodeInWindow, and fix a couple minor typos.
MANUAL PUSH: Trivial fix CLOSED TREE
2022-10-26 20:07:30 +02:00
Mike Conley
b01ae33f91 Bug 1797156 - Refactor OverflowableToolbar and add documentation. r=sclements,cmkm
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
2022-10-26 14:40:49 +00:00
Emilio Cobos Álvarez
58379b8620 Bug 1796231 - Fix _collapsed map calculations. r=Gijs
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
2022-10-24 18:32:08 +00:00
Emilio Cobos Álvarez
487b3234a1 Bug 1793359 - Simplify bookmarks popup placement. r=Itiel,dao,mak
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
2022-10-20 15:50:23 +00:00
Mark Banner
2ffde1e92f Bug 1792341 - Migrate more toolkit/modules consumers to use direct ES module import. r=Gijs,webdriver-reviewers,perftest-reviewers,necko-reviewers,geckoview-reviewers,preferences-reviewers,application-update-reviewers,pip-reviewers,credential-management-reviewers,sgalich,owlish,bytesized,AlexandruIonescu,whimboo,mconley,mixedpuppy
Mainly automated changes. Some manual ESLint fixes and whitespace cleanup.

Differential Revision: https://phabricator.services.mozilla.com/D158452
2022-10-18 11:21:26 +00:00
Emilio Cobos Álvarez
fc722502de Bug 1795260 - Make a too-big searchbar not push the rest of the UI out. r=Gijs
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
2022-10-17 17:07:15 +00:00
Mark Banner
8d1ebcb9d6 Bug 1792365 - Convert toolkit/modules consumers to use ES module imports directly. r=webdriver-reviewers,perftest-reviewers,geckoview-reviewers,extension-reviewers,preferences-reviewers,desktop-theme-reviewers,application-update-reviewers,pip-reviewers,credential-management-reviewers,robwu,Gijs,sgalich,bytesized,AlexandruIonescu,dao,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D158094
2022-09-29 06:52:34 +00:00
Emilio Cobos Álvarez
69965626d8 Bug 1790920 - Don't check defaultPrevented for click events closing panels. r=Gijs
(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
2022-09-19 17:02:37 +00:00
Emilio Cobos Álvarez
79ce0456b5 Bug 1775674 - Synchronize _checkOverflow properly. r=mak
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
2022-09-05 14:58:38 +00:00
Gijs Kruitbosch
31960f9a88 Bug 1787443 - ensure fxview button is always present by default, also for upgrading profiles, r=dao
Differential Revision: https://phabricator.services.mozilla.com/D155695
2022-08-26 15:50:18 +00:00
Shane Caraveo
a247d704af Bug 1786587 Fix browser action panel when toolbar is overflowed r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D155527
2022-08-26 15:31:01 +00:00
Gijs Kruitbosch
67ff8f1d53 Bug 1787439 - call buildArea if toolbar default placements contain API-provided widgets that therefore cannot be in the DOM when the toolbar is registered, r=dao
Differential Revision: https://phabricator.services.mozilla.com/D155696
2022-08-26 13:34:19 +00:00
Shane Caraveo
41e03a66c8 Bug 1783972 make browser actions pop out of overflow r=zombie,Gijs
Differential Revision: https://phabricator.services.mozilla.com/D154179
2022-08-22 18:55:59 +00:00
Niklas Baumgardner
a4cc34dcb2 Bug 1782709 - Place Firefox View widget in existing position. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D153749
2022-08-10 13:37:41 +00:00
Tooru Fujisawa
54623364da Bug 1777486 - Part 2: Migrate XPCOMUtils.jsm consumers with automatic migration. r=webdriver-reviewers,geckoview-reviewers,preferences-reviewers,application-update-reviewers,pip-reviewers,kmag,owlish,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D151214
2022-07-12 04:21:34 +00:00