1
1
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
2
- index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca08923f359862 100644
2
+ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..b46335091e4d4ea71bf5027ea3a472cc839781b8 100644
3
3
--- a/browser/components/tabbrowser/content/tabbrowser.js
4
4
+++ b/browser/components/tabbrowser/content/tabbrowser.js
5
5
@@ -422,15 +422,60 @@
@@ -293,7 +293,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
293
293
}
294
294
295
295
if (!color) {
296
- @@ -3040,7 +3132,12 @@
296
+ @@ -3040,9 +3132,13 @@
297
297
label,
298
298
isAdoptingGroup
299
299
);
@@ -303,11 +303,13 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
303
303
+ }
304
304
+ group.essential = tabs.some(tab => tab.hasAttribute("essential"));
305
305
+ group.pinned = group.essential || tabs.some(tab => tab.pinned);
306
- + (( insertBefore?.group ?? insertBefore).parentNode).insertBefore (
306
+ + insertBefore.before (
307
307
group,
308
- insertBefore?.group ?? insertBefore
308
+ - insertBefore?.group ?? insertBefore
309
309
);
310
- @@ -3163,7 +3260,7 @@
310
+ group.addTabs(tabs);
311
+
312
+ @@ -3163,7 +3259,7 @@
311
313
}
312
314
313
315
this.#handleTabMove(tab, () =>
@@ -316,23 +318,23 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
316
318
);
317
319
}
318
320
319
- @@ -3357,6 +3454 ,7 @@
321
+ @@ -3357,6 +3453 ,7 @@
320
322
openWindowInfo,
321
323
skipLoad,
322
324
triggeringRemoteType,
323
325
+ _forZenEmptyTab
324
326
}
325
327
) {
326
328
// If we don't have a preferred remote type (or it is `NOT_REMOTE`), and
327
- @@ -3426,6 +3524 ,7 @@
329
+ @@ -3426,6 +3523 ,7 @@
328
330
openWindowInfo,
329
331
name,
330
332
skipLoad,
331
333
+ _forZenEmptyTab
332
334
});
333
335
}
334
336
335
- @@ -3613,7 +3712 ,7 @@
337
+ @@ -3613,7 +3711 ,7 @@
336
338
// Add a new tab if needed.
337
339
if (!tab) {
338
340
let createLazyBrowser =
@@ -341,7 +343,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
341
343
342
344
let url = "about:blank";
343
345
if (tabData.entries?.length) {
344
- @@ -3650,8 +3749 ,10 @@
346
+ @@ -3650,8 +3748 ,10 @@
345
347
insertTab: false,
346
348
skipLoad: true,
347
349
preferredRemoteType,
@@ -353,7 +355,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
353
355
if (select) {
354
356
tabToSelect = tab;
355
357
}
356
- @@ -3663,7 +3764 ,8 @@
358
+ @@ -3663,7 +3763 ,8 @@
357
359
this.pinTab(tab);
358
360
// Then ensure all the tab open/pinning information is sent.
359
361
this._fireTabOpen(tab, {});
@@ -363,7 +365,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
363
365
let { groupId } = tabData;
364
366
const tabGroup = tabGroupWorkingData.get(groupId);
365
367
// if a tab refers to a tab group we don't know, skip any group
366
- @@ -3677,7 +3779 ,10 @@
368
+ @@ -3677,7 +3778 ,10 @@
367
369
tabGroup.stateData.id,
368
370
tabGroup.stateData.color,
369
371
tabGroup.stateData.collapsed,
@@ -375,7 +377,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
375
377
);
376
378
tabsFragment.appendChild(tabGroup.node);
377
379
}
378
- @@ -3722,9 +3827 ,23 @@
380
+ @@ -3722,9 +3826 ,23 @@
379
381
// to remove the old selected tab.
380
382
if (tabToSelect) {
381
383
let leftoverTab = this.selectedTab;
@@ -399,7 +401,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
399
401
400
402
if (tabs.length > 1 || !tabs[0].selected) {
401
403
this._updateTabsAfterInsert();
402
- @@ -3919,7 +4038 ,7 @@
404
+ @@ -3919,7 +4037 ,7 @@
403
405
// Ensure we have an index if one was not provided.
404
406
if (typeof elementIndex != "number" && typeof tabIndex != "number") {
405
407
// Move the new tab after another tab if needed, to the end otherwise.
@@ -408,7 +410,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
408
410
if (
409
411
!bulkOrderedOpen &&
410
412
((openerTab &&
411
- @@ -3931,7 +4050 ,7 @@
413
+ @@ -3931,7 +4049 ,7 @@
412
414
let lastRelatedTab =
413
415
openerTab && this._lastRelatedTabMap.get(openerTab);
414
416
let previousTab = lastRelatedTab || openerTab || this.selectedTab;
@@ -417,7 +419,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
417
419
tabGroup = previousTab.group;
418
420
}
419
421
if (
420
- @@ -3942,7 +4061 ,7 @@
422
+ @@ -3942,7 +4060 ,7 @@
421
423
) {
422
424
elementIndex = Infinity;
423
425
} else if (previousTab.visible) {
@@ -426,7 +428,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
426
428
} else if (previousTab == FirefoxViewHandler.tab) {
427
429
elementIndex = 0;
428
430
}
429
- @@ -3970,14 +4089 ,14 @@
431
+ @@ -3970,14 +4088 ,14 @@
430
432
}
431
433
// Ensure index is within bounds.
432
434
if (tab.pinned) {
@@ -445,7 +447,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
445
447
446
448
// Prevent a flash of unstyled content by setting up the tab content
447
449
// and inherited attributes before appending it (see Bug 1592054):
448
- @@ -3985,7 +4104 ,7 @@
450
+ @@ -3985,7 +4103 ,7 @@
449
451
450
452
this.tabContainer._invalidateCachedTabs();
451
453
@@ -454,15 +456,15 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
454
456
if (this.isTab(itemAfter) && itemAfter.group == tabGroup) {
455
457
// Place at the front of, or between tabs in, the same tab group
456
458
this.tabContainer.insertBefore(tab, itemAfter);
457
- @@ -4018,6 +4137 ,7 @@
459
+ @@ -4018,6 +4136 ,7 @@
458
460
if (pinned) {
459
461
this._updateTabBarForPinnedTabs();
460
462
}
461
463
+ gZenWorkspaces.fixTabInsertLocation(tab, itemAfter);
462
464
463
465
TabBarVisibility.update();
464
466
}
465
- @@ -4307,6 +4427 ,9 @@
467
+ @@ -4307,6 +4426 ,9 @@
466
468
return;
467
469
}
468
470
@@ -472,23 +474,23 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
472
474
this.removeTabs(selectedTabs, { isUserTriggered, telemetrySource });
473
475
}
474
476
475
- @@ -4568,6 +4691 ,7 @@
477
+ @@ -4568,6 +4690 ,7 @@
476
478
telemetrySource,
477
479
} = {}
478
480
) {
479
481
+ tabs = tabs.filter(tab => !tab.hasAttribute("zen-empty-tab"));
480
482
// When 'closeWindowWithLastTab' pref is enabled, closing all tabs
481
483
// can be considered equivalent to closing the window.
482
484
if (
483
- @@ -4657,6 +4781 ,7 @@
485
+ @@ -4657,6 +4780 ,7 @@
484
486
if (lastToClose) {
485
487
this.removeTab(lastToClose, aParams);
486
488
}
487
489
+ gZenUIManager.onTabClose(undefined);
488
490
} catch (e) {
489
491
console.error(e);
490
492
}
491
- @@ -4695,6 +4820 ,12 @@
493
+ @@ -4695,6 +4819 ,12 @@
492
494
aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start();
493
495
}
494
496
@@ -501,7 +503,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
501
503
// Handle requests for synchronously removing an already
502
504
// asynchronously closing tab.
503
505
if (!animate && aTab.closing) {
504
- @@ -4709,6 +4840 ,9 @@
506
+ @@ -4709,6 +4839 ,9 @@
505
507
// state).
506
508
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
507
509
let isLastTab = this.#isLastTabInWindow(aTab);
@@ -511,7 +513,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
511
513
if (
512
514
!this._beginRemoveTab(aTab, {
513
515
closeWindowFastpath: true,
514
- @@ -4891,7 +5025 ,7 @@
516
+ @@ -4891,7 +5024 ,7 @@
515
517
closeWindowWithLastTab != null
516
518
? closeWindowWithLastTab
517
519
: !window.toolbar.visible ||
@@ -520,15 +522,15 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
520
522
521
523
if (closeWindow) {
522
524
// We've already called beforeunload on all the relevant tabs if we get here,
523
- @@ -4915,6 +5049 ,7 @@
525
+ @@ -4915,6 +5048 ,7 @@
524
526
525
527
newTab = true;
526
528
}
527
529
+ gZenWorkspaces._removedByStartupPage = false;
528
530
aTab._endRemoveArgs = [closeWindow, newTab];
529
531
530
532
// swapBrowsersAndCloseOther will take care of closing the window without animation.
531
- @@ -4955,9 +5090 ,7 @@
533
+ @@ -4955,9 +5089 ,7 @@
532
534
aTab._mouseleave();
533
535
534
536
if (newTab) {
@@ -539,23 +541,23 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
539
541
} else {
540
542
TabBarVisibility.update();
541
543
}
542
- @@ -5090,6 +5223 ,7 @@
544
+ @@ -5090,6 +5222 ,7 @@
543
545
this.tabs[i]._tPos = i;
544
546
}
545
547
546
548
+ gZenWorkspaces.updateTabsContainers();
547
549
if (!this._windowIsClosing) {
548
550
// update tab close buttons state
549
551
this.tabContainer._updateCloseButtons();
550
- @@ -5302,6 +5436 ,7 @@
552
+ @@ -5302,6 +5435 ,7 @@
551
553
}
552
554
553
555
let excludeTabs = new Set(aExcludeTabs);
554
556
+ gZenWorkspaces.getTabsToExclude(aTab).forEach(tab => excludeTabs.add(tab));
555
557
556
558
// If this tab has a successor, it should be selectable, since
557
559
// hiding or closing a tab removes that tab as a successor.
558
- @@ -5314,13 +5449 ,13 @@
560
+ @@ -5314,13 +5448 ,13 @@
559
561
!excludeTabs.has(aTab.owner) &&
560
562
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
561
563
) {
@@ -571,7 +573,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
571
573
);
572
574
573
575
let tab = this.tabContainer.findNextTab(aTab, {
574
- @@ -5336,7 +5471 ,7 @@
576
+ @@ -5336,7 +5470 ,7 @@
575
577
}
576
578
577
579
if (tab) {
@@ -580,7 +582,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
580
582
}
581
583
582
584
// If no qualifying visible tab was found, see if there is a tab in
583
- @@ -5357,7 +5492 ,7 @@
585
+ @@ -5357,7 +5491 ,7 @@
584
586
});
585
587
}
586
588
@@ -589,7 +591,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
589
591
}
590
592
591
593
_blurTab(aTab) {
592
- @@ -5759,10 +5894 ,10 @@
594
+ @@ -5759,10 +5893 ,10 @@
593
595
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
594
596
}
595
597
@@ -602,7 +604,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
602
604
aTab.selected ||
603
605
aTab.closing ||
604
606
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
605
- @@ -5952,7 +6087 ,7 @@
607
+ @@ -5952,7 +6086 ,7 @@
606
608
* `true` if element is a `<tab-group>`
607
609
*/
608
610
isTabGroup(element) {
@@ -611,7 +613,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
611
613
}
612
614
613
615
/**
614
- @@ -6029,7 +6164 ,7 @@
616
+ @@ -6029,7 +6163 ,7 @@
615
617
616
618
// Don't allow mixing pinned and unpinned tabs.
617
619
if (this.isTab(element) && element.pinned) {
@@ -620,7 +622,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
620
622
} else {
621
623
tabIndex = Math.max(tabIndex, this.pinnedTabCount);
622
624
}
623
- @@ -6055,10 +6190 ,16 @@
625
+ @@ -6055,10 +6189 ,16 @@
624
626
this.#handleTabMove(
625
627
element,
626
628
() => {
@@ -639,7 +641,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
639
641
if (neighbor && this.isTab(element) && tabIndex > element._tPos) {
640
642
neighbor.after(element);
641
643
} else {
642
- @@ -6116,22 +6257 ,26 @@
644
+ @@ -6116,22 +6256 ,26 @@
643
645
#moveTabNextTo(element, targetElement, moveBefore = false, metricsContext) {
644
646
if (this.isTabGroupLabel(targetElement)) {
645
647
targetElement = targetElement.group;
@@ -672,7 +674,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
672
674
moveBefore = false;
673
675
} else if (!element.pinned && targetElement && targetElement.pinned) {
674
676
// If the caller asks to move an unpinned element next to a pinned
675
- @@ -6145,14 +6290 ,18 @@
677
+ @@ -6145,14 +6289 ,18 @@
676
678
// move the tab group right before the first unpinned tab.
677
679
// 4. Moving a tab group and the first unpinned tab is grouped:
678
680
// move the tab group right before the first unpinned tab's tab group.
@@ -692,7 +694,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
692
694
element.pinned
693
695
? this.tabContainer.pinnedTabsContainer
694
696
: this.tabContainer;
695
- @@ -6161,7 +6310 ,7 @@
697
+ @@ -6161,7 +6309 ,7 @@
696
698
element,
697
699
() => {
698
700
if (moveBefore) {
@@ -701,7 +703,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
701
703
} else if (targetElement) {
702
704
targetElement.after(element);
703
705
} else {
704
- @@ -6210,7 +6359 ,7 @@
706
+ @@ -6210,7 +6358 ,7 @@
705
707
if (!this.isTab(aTab)) {
706
708
throw new Error("Can only move a tab into a tab group");
707
709
}
@@ -710,7 +712,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
710
712
return;
711
713
}
712
714
if (aTab.group && aTab.group.id === aGroup.id) {
713
- @@ -6304,6 +6453 ,10 @@
715
+ @@ -6304,6 +6452 ,10 @@
714
716
715
717
moveActionCallback();
716
718
@@ -721,7 +723,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
721
723
// Clear tabs cache after moving nodes because the order of tabs may have
722
724
// changed.
723
725
this.tabContainer._invalidateCachedTabs();
724
- @@ -7198,7 +7351 ,7 @@
726
+ @@ -7198,7 +7350 ,7 @@
725
727
// preventDefault(). It will still raise the window if appropriate.
726
728
break;
727
729
}
@@ -730,15 +732,15 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
730
732
window.focus();
731
733
aEvent.preventDefault();
732
734
break;
733
- @@ -8143,6 +8296 ,7 @@
735
+ @@ -8143,6 +8295 ,7 @@
734
736
aWebProgress.isTopLevel
735
737
) {
736
738
this.mTab.setAttribute("busy", "true");
737
739
+ if (!this.mTab.selected) this.mTab.setAttribute("unread", "true");
738
740
gBrowser._tabAttrModified(this.mTab, ["busy"]);
739
741
this.mTab._notselectedsinceload = !this.mTab.selected;
740
742
}
741
- @@ -9108,7 +9262 ,7 @@ var TabContextMenu = {
743
+ @@ -9108,7 +9261 ,7 @@ var TabContextMenu = {
742
744
);
743
745
contextUnpinSelectedTabs.hidden =
744
746
!this.contextTab.pinned || !this.multiselected;
@@ -747,7 +749,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..7bb218913170222d55e7b7bdf4ca0892
747
749
// Move Tab items
748
750
let contextMoveTabOptions = document.getElementById(
749
751
"context_moveTabOptions"
750
- @@ -9384,6 +9538 ,7 @@ var TabContextMenu = {
752
+ @@ -9384,6 +9537 ,7 @@ var TabContextMenu = {
751
753
)
752
754
);
753
755
} else {
0 commit comments