Commit Graph

735 Commits

Author SHA1 Message Date
Alex Kontos
6614ff9a2f feat(sidebar): part 2 - tree vertical tabs v1.1 2025-11-06 14:13:52 +00:00
Alex Kontos
5f4596402e feat: implement automatic tab grouping 2025-11-06 14:13:51 +00:00
goodusername123
c83e186cfb feat: restore "unread" tab Attribute 2025-11-06 14:13:46 +00:00
Alex Kontos
6d4862fcc8 feat: add session restore checkbox when quitting the browser
(cherry picked from commit 25890584ab485be765a2e4eff47e38f903a0ae24)
2025-11-06 14:13:37 +00:00
Fatih Kilic
b848b2b571 Bug 1975753 - Force site specific zoom when RFPTarget::SiteSpecificZoom is active. a=RyanVM DONTBUILD
I wasn't around when RFPTarget::SiteSpecificZoom was implemented, but the current implementation is very confusing.

In Firefox, we have two modes of zoom level. Per tab zoom, and site specific zoom. It is controlled in two (maybe more) places. browser-fullZoom.js and in [CanonicalBrowsingContext.cpp](https://searchfox.org/mozilla-central/rev/ac81a39dfe0663eb40a34c7c36d89e34be29cb20/docshell/base/CanonicalBrowsingContext.cpp#285-289).

Our current implementation disables site specific zoom in `browser-fullZoom.js` by checking the RFP target, but it doesn't modify `CanonicalBrowsingContext.cpp`. So,`CanonicalBrowsingContext` still thinks we are using site specific zoom.

Pre-bug1914149 this method worked because we didn't keep/inherit zoom level across navigations. Post-bug1914149, it no longer works because we keep the zoom level across navigations in `CanonicalBrowsingContext` and let `browser-fullZoom.js` reset to its correct value back.

The issue is caused because `CanonicalBrowsingContext` keeps the previous page's zoom level, but `browser-fullZoom.js` thinks we use tab zoom mode, so it doesn't bother setting the zoom level for the site/page. So, we end up keeping the zoom level.

The solution here I'm suggesting is, doing the opposite of what we are doing in `browser-fullZoom.js`. So, now we should force SiteSpecificZoom with RFP. The reason I'm suggesting this is because within the same site, even acrss tabs, we persist cookies, so fingerprinting isn't much of concern here. We also don't persist zoom levels in private browsing. So, linking normal to PBM isn't a concern either.

So, in summary,
- If you open the same site, in 100 tabs, all of them will get the same zoom level with this patch (just like default normal Firefox)
- If you are in PBM, the zoom level is NOT persisted.
- If you are in normal browsing, the zoom level is persisted, but so are cookies.

Original Revision: https://phabricator.services.mozilla.com/D257497

Differential Revision: https://phabricator.services.mozilla.com/D261948
2025-08-22 01:27:54 +00:00
Jeremy Swinarton
520c64e4d9 Bug 1905944: Fix intermittents in browser_tab_preview.js r=sthompson,tabbrowser-reviewers, a=test-only
This patch fixes a number of issues that clear up a few different
intermittents in browser_tab_preview.js.

1. In browser_tab_groups_tab_interactions_telemetry.js, a call to "close
   duplicate tabs" would automatically open the confirmation hint panel.
   If not manually closed, it seems to persist in a half-way open state
   where the `animating` attribute is always `true`. This is now fixed.

2. There is a test somewhere that seems to apply the
   `sidebar.verticalTabs` pref and doesn't turn it off. I would like to
   figure out which test is causing this, but as a last defence I have
   made sure this is always properly set within this test suite.

3. Some tests check that THP is disabled if another panel is open. These
   used to work by opening the `appMenu-popup` menu (the hamburger menu
   in the top right of the browser). The problem with this approach is
   that this panel (and basically every other panel) are very complex
   and are prone to change. This was causing an intermittent failure
   where attempting to close this panel threw an error in console that
   seemed to be specifically related to this panel. I fixed this by
   creating a fake minimal panel that is guaranteed to not change as
   application code changes. (I borrowed this technique from
   https://searchfox.org/mozilla-central/source/browser/base/content/test/popupNotifications/browser_popupNotification_queue.js).

4. There is a suite of tests that checks that THP is disabled in the
   event that a drag operation is performed. The problem is that
   dragging a tab by 100px sometimes detaches the tab and creates a new
   window, breaking the test run. Reducing the drag amount seems to fix
   this.

5. As a last line of defence, I have added a state reset function at the
   start of each test to ensure that all panels are closed and that the
   mouse is not hovering over the tab strip. (The latter was being done at
   the end of some tests already, but this makes sure it is consistently
   applied everywhere.)

Closes bug1898099, bug1905944, bug1933597.

Differential Revision: https://phabricator.services.mozilla.com/D258976
2025-08-05 20:51:35 +00:00
Dão Gottwald
f982fafede Bug 1964288 - Cannot drag tab to far right of tab bar r=dao,tabbrowser-reviewers, a=dmeehan
The required range for the `animDropElementIndex` is between 0 and `this.ariaFocusableItems.length`, inclusive. That maximum value signifies that all tab strip items (and particularly the last one) need to shift out of the way because the user is dragging something to the end of the tab strip.

When dragging past the last tab strip item, `animDropElementIndex == this.ariaFocusableItems.length` and there is no overlapping element. In that scenario, we fall back to setting `dropElement = this.ariaFocusableItems[oldDropElementIndex]` but there is no such element. The `dropElement` is undefined, which ultimately results in calling `Tabbrowser.moveTabsAfter` and appending the dragged tab(s). That happens to be the right result.

However, if you do a short vertical drag, `dropElement` also does not get set, so whatever you were dragging moves to the end of the tab strip. That was bug 1959350 and we tried to fix it by not moving tabs if `dropElement` wasn't set. https://phabricator.services.mozilla.com/D247339

This had the side effect of not making it possible to drop a tab at the end of the tab strip if you were dragging forward. It was still possible to drag forward to the last position, then drag backward slightly to get the front edge of the tab to overlap the last tab in the tab strip, which would allow dropping into the last position.

I think the main thing that would help is to make sure that `dropElement` is always set for valid moves. When dragging past the last tab and there is no overlap, we can fall back to the last non-moving tab strip item.

I needed to swap around how we derive `dropElement` and `newDropElementIndex`. If we fall back to making `dropElement` the last tab, the existing code will try to use `dropElement.elementIndex` as the `newDropElementIndex`, which means the `animDropElementIndex` can never achieve the maximum value that it needs to show all of the tabs moving over. I made it so that we independently determine the `newDropElementIndex` fallback and the `dropElement` fallback without using `newDropElementIndex`.

After this change, `dropElement` should always be a valid non-moving tab strip item if a move should occur. If `dropElement` is undefined, then it's correct that no move should occur.

Differential Revision: https://phabricator.services.mozilla.com/D249715
2025-06-06 19:00:43 +00:00
Jeremy Swinarton
1f70d01002 Bug 1961161: Additional metrics for closing tabs within groups r=dwalker,fxview-reviewers,tabbrowser-reviewers,nsharpley
Differential Revision: https://phabricator.services.mozilla.com/D248438
2025-05-22 22:03:01 +00:00
Sandor Molnar
630b142f33 Bug 1648512 - Disable test browser_newwindow_tabstrip_overflow.js on linux debug for frequent failures. r=tabbrowser-reviewers,dao DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D250593
2025-05-22 10:46:54 +00:00
Rolf Rando
f642a5bc2a Bug 1963623 - Fix exception when smart tab groups is off r=dwalker,tabbrowser-reviewers,ngrato
Differential Revision: https://phabricator.services.mozilla.com/D250313
2025-05-21 21:08:08 +00:00
Rolf Rando
98ed29e0aa Bug 1967501 - Fix error going to tab group manager when STG feature is off r=dwalker,tabbrowser-reviewers,ngrato
Fixes a regression that disables tab group management immediately after creating a group with STG off.

I don't quite understand why this comes up, so I hope @ngrato can shed some insight before we land it.

Differential Revision: https://phabricator.services.mozilla.com/D250344
2025-05-21 21:07:06 +00:00
Serban Stanca
aca3a7922b Bug 1921835 - fix lint failure in browser/components/tabbrowser/test/browser/tabs/browser_multiselect_tabs_move.js. 2025-05-21 15:14:08 +00:00
Jeremy Swinarton
13b5e48685 Bug 1921835: Move tab to start/end enabled when collapsed group on tab strip edge r=dao,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D249846
2025-05-21 13:55:24 +00:00
Dão Gottwald
e0a00e5f7d Bug 1966912 - Remove addTab's index alias for the tabIndex parameter. r=extension-reviewers,sessionstore-reviewers,tabbrowser-reviewers,robwu,dwalker
Differential Revision: https://phabricator.services.mozilla.com/D249783
2025-05-20 12:06:21 +00:00
Sandor Molnar
32b4815cfe Revert "Bug 1966912 - Remove addTab's index alias for the tabIndex parameter. r=extension-reviewers,sessionstore-reviewers,tabbrowser-reviewers,robwu,dwalker" for causing remote failures @ browser_TabManager.js
This reverts commit 38a0034022.
2025-05-19 21:07:58 +00:00
Dão Gottwald
38a0034022 Bug 1966912 - Remove addTab's index alias for the tabIndex parameter. r=extension-reviewers,sessionstore-reviewers,tabbrowser-reviewers,robwu,dwalker
Differential Revision: https://phabricator.services.mozilla.com/D249783
2025-05-19 19:48:54 +00:00
DJ
fb68fe5abb Bug 1966594 - fix window close logic in _beginRemoveTab. r=dao,sthompson,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D249708
2025-05-16 16:08:59 +00:00
Dão Gottwald
0007fe7bd1 Bug 1966617 - Make adoptTabGroup support both elementIndex and tabIndex, and stop converting tab indices to element indices. r=robwu,sthompson,tabbrowser-reviewers,sessionstore-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D249619
2025-05-16 00:39:26 +00:00
Rob Wu
c6223d7101 Bug 1963825 - tabGroups.move index = desired final index r=zombie,tabbrowser-reviewers,dao
To ensure that a group ends up at the position specified by `index`,
this patch adjusts the index when the tab group moves to the right.
Before this patch, the tab group appeared at a too low (left) index
because the original logic did not account for tabs shifting after a
repositioning to the right.

This also introduces stricter validation for moving tabs near pinned
tabs or other tab groups. Previously, the tabbrowser internals adjusted
the index as needed to fit adjacent to pinned tabs or groups. Now, the
extension API throws an error.

The new behavior matches developer expectations and Chrome's behavior:
https://bugzilla.mozilla.org/show_bug.cgi?id=1963825#c9

Differential Revision: https://phabricator.services.mozilla.com/D249493
2025-05-16 00:39:18 +00:00
agoloman
4b62de7961 Revert "Bug 1965343 - Adopt whole tab group at once in replaceGroupWithWindow r=tabbrowser-reviewers,sthompson" for causing bc failures @browser_tab_groups.js.
This reverts commit fac3f86e95.
2025-05-15 18:42:30 +00:00
Rob Wu
fac3f86e95 Bug 1965343 - Adopt whole tab group at once in replaceGroupWithWindow r=tabbrowser-reviewers,sthompson
The `replaceGroupWithWindow` method currently adopts a tab group in
multiple steps, asynchronously. This can result in externally observable
inconsistencies past initial adoption (see bug).

To fix this, this patch changes the adoption logic by passing the tab
group as the initial item to adopt, and adopts the whole group at once
as needed. Now the logic is similar to drag and drop adoption as
implemented in bug 1908441.

Since tabToAdopt is no longer just a tab, but also a tab group (or even
a tab group label since bug 1908441), the logic in ext-browser.js needs
to be adjusted to make sure that it does not mistake non-tab elements
for tabs. Test coverage is in browser_ext_tabGroups_move_onMoved.js,
as not changing that caused the test to fail with:

> FAIL Tab did indeed move to the new window - {"oldWindowId":3,"oldPosition":"undefined"} deepEqual {"oldWindowId":3,"oldPosition":1} -

Differential Revision: https://phabricator.services.mozilla.com/D248537
2025-05-15 13:35:45 +00:00
Rob Wu
94716102d0 Bug 1963830 - Reverse TabMove / tabs.onMoved when moving tab groups forwards r=tabbrowser-reviewers,dao
To allow extensions to correctly mirror the positions of tabs that were
bulk-moved by moving a tab group, emit the TabMove event in the reverse
order if the tab group moves forwards. This ensures that the previously
recorded index of a tab before the bulk-move remains valid.

Differential Revision: https://phabricator.services.mozilla.com/D248995
2025-05-14 16:04:08 +00:00
Dão Gottwald
61c2a7bdfc Bug 1966140 - Sort tab groups in recently-used order in address bar results. r=sthompson,daleharvey,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D249088
2025-05-14 04:13:54 +00:00
Dão Gottwald
aa008038e2 Bug 1966040 - Tab group drag image offset should match that of tabs. r=jswinarton,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D249046
2025-05-13 16:43:31 +00:00
Vasish Baungally
33c648d5ab Bug 1964774 - Improve Suggest Latency for Smart Tabs by preloading. r=ngrato,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D248098
2025-05-13 01:47:38 +00:00
Stephen Thompson
5b3f57be44 Bug 1954005 - URL bar search should not show saved tab groups in private windows r=dao,dwalker,urlbar-reviewers,tabbrowser-reviewers
In bug 1933744 we prevented SessionStore from reopening a saved tab group into a private window. In bug 1946761 we prevented users from saving tab groups from a private window. The general design principle has been to prevent tab group information leaking between private and non-private windows.

ActionsProviderTabGroups already respected privacy through the implementation of `Tabbrowser.getAllTabGroups`, but `SessionStore.getSavedTabGroups` doesn't respect privacy. Perhaps it should. But in any case, this patch ensures that search results in private windows don't include saved tab groups.

Differential Revision: https://phabricator.services.mozilla.com/D248351
2025-05-12 15:19:01 +00:00
kpatenio
0815db75f2 Bug 1961951 - clean up RC actors and classes r=shopping-reviewers,fchasen,tabbrowser-reviewers,sthompson
Differential Revision: https://phabricator.services.mozilla.com/D246981
2025-05-09 18:16:21 +00:00
DJ
4c6277efaf Bug 1957488 - record reopen event when reopening a deleted tab group. r=sthompson,sessionstore-reviewers,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D248250
2025-05-09 15:00:22 +00:00
DJ
37e0d71a14 Bug 1956458 - Always place group after pinned tabs when creating a group from the context menu. r=sthompson,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D248533
2025-05-09 14:56:17 +00:00
Rob Wu
e7af560fb9 Bug 1965057 - Set isAdoptingGroup in replaceGroupWithWindow r=tabbrowser-reviewers,sthompson
The tabGroups.onRemoved / onCreated / onMoved event depends on the
isAdoptingGroup / removedByAdoption flags to identify tab groups that are
adopted by another window. Although this flag is set for the
`gBrowser.adoptTabGroup` method, it is not in the
`gBrowser.replaceGroupWithWindow` method, which results in incorrect
events.

This patch fixes the issue by setting the isAdoptingGroup flag in
`gBrowser.replaceGroupWithWindow`.

Differential Revision: https://phabricator.services.mozilla.com/D248327
2025-05-08 23:36:16 +00:00
Gijs Kruitbosch
728ff6d544 Bug 1965273 - support up/down shortcut keys on macOS for tabswitches, r=tabbrowser-reviewers,sthompson
Differential Revision: https://phabricator.services.mozilla.com/D248464
2025-05-08 21:37:15 +00:00
Stephen Thompson
b7d69dd476 Bug 1963713 - add tab group ungroup metric event r=dao,tabbrowser-reviewers
Record when a user ungroups the tabs of a tab group.

We ungroup an entire group when the user selects the "Ungroup tabs" context menu item on the tab group, but we also do that if the user cancels out of tab group creation context menu. We are particularly interested in understanding when users cancel out of the creation process. This may give us a better indicator about accidental tab group creation, e.g. when the user intended to drag and drop to move a tab but ended up creating a tab group from two tabs.

Differential Revision: https://phabricator.services.mozilla.com/D247633
2025-05-07 15:05:43 +00:00
DJ
4e0c51a78e Bug 1956458 - Unpin tabs when they are added to a group. r=dao,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D247597
2025-05-07 13:30:59 +00:00
Dão Gottwald
ea73afd884 Bug 1964728 - Use tab group label as drag image. r=jswinarton,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D248093
2025-05-06 22:07:53 +00:00
Jeremy Swinarton
186b5eaa63 Bug 1964152: Dispatch TabGrouped and TabUngrouped from the tab group, not the tab r=dao,sthompson,tabbrowser-reviewers,zombie
Differential Revision: https://phabricator.services.mozilla.com/D247660
2025-05-06 15:43:04 +00:00
Vasish Baungally
fa152cc2f8 Bug 1962228 - Add Telemetry for Pref Changes for Smart Tab Groups. r=rrando,tabbrowser-reviewers,sthompson
Differential Revision: https://phabricator.services.mozilla.com/D246800
2025-05-01 21:19:51 +00:00
DJ
1a51ae6a74 Bug 1952900 - improve resilience of tab group removal in browser_tab_groups_closed.js. r=jswinarton,sessionstore-reviewers,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D247115
2025-05-01 20:50:13 +00:00
Narcis Beleuzu
ce7684de06 Bug 1959350 - Don't move tabs when we shouldn't translate and we don't have a dropIndex or dropElement. r=dwalker,tabbrowser-reviewers
This reverts commit 43aaf24757.
2025-05-01 15:17:10 +00:00
Sebastian Hengst
43aaf24757 Revert "Bug 1959350 - Don't move tabs when we shouldn't translate and we don't have a dropIndex or dropElement. r=dwalker,tabbrowser-reviewers" for failing browser-chrome's browser_914138_widget_API_overflowable_toolbar.js
This reverts commit 8c9266bae9.
2025-05-01 13:57:01 +00:00
Vasish Baungally
9d3b433aa4 Bug 1963120 - Update Nimbus Recipe for Smart Tab Groups. r=rrando,Mardak,tabbrowser-reviewers
New Parameters Added:
1. Suggest Other Tabs Methods
2. Topic and Embedding Model Revisions
3. Nearest Neighbor Threshold

Differential Revision: https://phabricator.services.mozilla.com/D246968
2025-05-01 02:27:16 +00:00
Dão Gottwald
8c9266bae9 Bug 1959350 - Don't move tabs when we shouldn't translate and we don't have a dropIndex or dropElement. r=dwalker,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D247339
2025-05-01 02:26:28 +00:00
Stephen Thompson
37cc744292 Bug 1962434 - raise TabGroupCreate when tab group element mounts r=dao,tabbrowser-reviewers
Session restore code doesn't use the standard Tabbrowser.addTabGroup API, so tab groups that enter the DOM via session restore don't raise any TabGroupCreate events. To be consistent, and in order to support addons that need to have an up-to-date view of the tab strip, this patch fires TabGroupCreate on each tab group that enters the DOM.

This patch renames the existing `TabGroupCreate` fired from Tabbrowser.addTabGroup to `TabGroupCreateByUser`. This new event will fire after the tab group enters the DOM (therefore after `TabGroupCreate`) in scenarios where code calls Tabbrowser.addTabGroup with `isUserTriggered = true` to indicate that a user took an explicit action to create this tab group as a new tab group.

Differential Revision: https://phabricator.services.mozilla.com/D246630
2025-04-29 20:08:49 +00:00
Dão Gottwald
a820b8f226 Bug 1962696 - Explicitly select the dragged tab. r=jswinarton,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D247064
2025-04-29 15:38:04 +00:00
Vasish Baungally
9ca170316a Bug 1951374 - damp browser-toolbox.styleeditor-ready.DAMP (Windows) regression on Tue February 18 2025 r=dao,tabbrowser-reviewers,ngrato
Differential Revision: https://phabricator.services.mozilla.com/D241510
2025-04-29 15:20:17 +00:00
Emilio Cobos Álvarez
dc6f105b8b Bug 1962688 - Fix vertical tabs on right drop zone calculation. r=tabbrowser-reviewers,nsharpley
Noticed this while going through this code. The end should be all the
way to the right, not left...

Differential Revision: https://phabricator.services.mozilla.com/D246830
2025-04-28 15:08:59 +00:00
Emilio Cobos Álvarez
d025939892 Bug 1962688 - Fix tab drop zone calculation to account for window decorations correctly. r=tabbrowser-reviewers,nsharpley
This is more visible on Linux because the decorations there are bigger, but I
believe this also fixes issues on windows specially if you have the titlebar
checkbox on.

You need to use mozInnerScreen* coords in order to get the screen coordinates
of the client area.

Differential Revision: https://phabricator.services.mozilla.com/D246829
2025-04-28 15:08:59 +00:00
Greg Stoll
45a91ceccb Bug 1962641 - only style explicitly unloaded tabs with grayscale favicon, etc. r=tabbrowser-reviewers,dao
Tabs can also be unloaded for low memory conditions, so only add the
"discarded" attribute if the tab was unloaded explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D246766
2025-04-25 15:43:31 +00:00
Rob Wu
6521fc35e2 Bug 1962592 - Reduce tab moves in adoptTabGroup r=tabbrowser-reviewers,dao
Differential Revision: https://phabricator.services.mozilla.com/D246702
2025-04-25 13:44:46 +00:00
Rob Wu
cbf77f8d55 Bug 1962475 - Do not fire tabGroups.onRemoved and onCreated when moving across windows r=zombie,tabbrowser-reviewers,dao
Differential Revision: https://phabricator.services.mozilla.com/D246688
2025-04-25 13:44:45 +00:00
zombie
7063143eaf Bug 1961660 - Implement tabGroups.move and onMoved r=robwu,tabbrowser-reviewers,dwalker,sthompson
Differential Revision: https://phabricator.services.mozilla.com/D246378
2025-04-25 13:44:44 +00:00