Skip to content

Commit 69c8e6a

Browse files
committed
Merge branch 'dev' of https://github.com/zen-browser/desktop into dev
2 parents e395e0f + 19fbad7 commit 69c8e6a

File tree

6 files changed

+81
-69
lines changed

6 files changed

+81
-69
lines changed

src/browser/components/tabbrowser/content/tabbrowser-js.patch

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
2-
index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a0291b4d8d35 100644
2+
index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..87fb109037d13183e76184201de600a92b6a07d6 100644
33
--- a/browser/components/tabbrowser/content/tabbrowser.js
44
+++ b/browser/components/tabbrowser/content/tabbrowser.js
55
@@ -422,15 +422,49 @@
@@ -307,18 +307,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
307307
});
308308
}
309309

310-
@@ -3570,7 +3659,9 @@
311-
let hiddenTabs = new Map();
312-
/** @type {Map<TabGroupStateData['id'], TabGroupWorkingData>} */
313-
let tabGroupWorkingData = new Map();
314-
-
315-
+ if (this._hasAlreadyInitializedZenSessionStore) {
316-
+ selectTab += 1; // SessionStoreInternal.restoreTabs expects a 1-based index.
317-
+ }
318-
for (const tabGroupData of tabGroupDataList) {
319-
tabGroupWorkingData.set(tabGroupData.id, {
320-
stateData: tabGroupData,
321-
@@ -3613,7 +3704,7 @@
310+
@@ -3613,7 +3702,7 @@
322311
// Add a new tab if needed.
323312
if (!tab) {
324313
let createLazyBrowser =
@@ -327,7 +316,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
327316

328317
let url = "about:blank";
329318
if (tabData.entries?.length) {
330-
@@ -3651,7 +3742,8 @@
319+
@@ -3651,7 +3740,8 @@
331320
skipLoad: true,
332321
preferredRemoteType,
333322
});
@@ -337,7 +326,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
337326
if (select) {
338327
tabToSelect = tab;
339328
}
340-
@@ -3663,7 +3755,8 @@
329+
@@ -3663,7 +3753,8 @@
341330
this.pinTab(tab);
342331
// Then ensure all the tab open/pinning information is sent.
343332
this._fireTabOpen(tab, {});
@@ -347,7 +336,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
347336
let { groupId } = tabData;
348337
const tabGroup = tabGroupWorkingData.get(groupId);
349338
// if a tab refers to a tab group we don't know, skip any group
350-
@@ -3677,7 +3770,10 @@
339+
@@ -3677,7 +3768,10 @@
351340
tabGroup.stateData.id,
352341
tabGroup.stateData.color,
353342
tabGroup.stateData.collapsed,
@@ -359,7 +348,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
359348
);
360349
tabsFragment.appendChild(tabGroup.node);
361350
}
362-
@@ -3722,9 +3818,23 @@
351+
@@ -3722,9 +3816,23 @@
363352
// to remove the old selected tab.
364353
if (tabToSelect) {
365354
let leftoverTab = this.selectedTab;
@@ -369,21 +358,21 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
369358
+ } else {
370359
+ gZenWorkspaces._tabToRemoveForEmpty = leftoverTab;
371360
+ if (Services.prefs.getBoolPref("zen.workspaces.continue-where-left-off")) {
372-
+ gZenWorkspaces._tabToSelect = selectTab - 1;
361+
+ gZenWorkspaces._tabToSelect = selectTab - 2; // -1 for the offset, and another -1 for the empty tab.
373362
+ }
374363
+ if (gZenWorkspaces._initialTab && !gZenVerticalTabsManager._canReplaceNewTab) {
375364
+ gZenWorkspaces._initialTab._shouldRemove = true;
376365
+ }
377366
+ }
378-
+ }
367+
}
379368
+ else {
380369
+ gZenWorkspaces._tabToRemoveForEmpty = this.selectedTab;
381-
}
370+
+ }
382371
+ this._hasAlreadyInitializedZenSessionStore = true;
383372

384373
if (tabs.length > 1 || !tabs[0].selected) {
385374
this._updateTabsAfterInsert();
386-
@@ -3919,7 +4029,7 @@
375+
@@ -3919,7 +4027,7 @@
387376
// Ensure we have an index if one was not provided.
388377
if (typeof elementIndex != "number" && typeof tabIndex != "number") {
389378
// Move the new tab after another tab if needed, to the end otherwise.
@@ -392,7 +381,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
392381
if (
393382
!bulkOrderedOpen &&
394383
((openerTab &&
395-
@@ -3942,7 +4052,7 @@
384+
@@ -3942,7 +4050,7 @@
396385
) {
397386
elementIndex = Infinity;
398387
} else if (previousTab.visible) {
@@ -401,7 +390,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
401390
} else if (previousTab == FirefoxViewHandler.tab) {
402391
elementIndex = 0;
403392
}
404-
@@ -3970,14 +4080,14 @@
393+
@@ -3970,14 +4078,14 @@
405394
}
406395
// Ensure index is within bounds.
407396
if (tab.pinned) {
@@ -420,7 +409,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
420409

421410
// Prevent a flash of unstyled content by setting up the tab content
422411
// and inherited attributes before appending it (see Bug 1592054):
423-
@@ -3985,7 +4095,7 @@
412+
@@ -3985,7 +4093,7 @@
424413

425414
this.tabContainer._invalidateCachedTabs();
426415

@@ -429,15 +418,15 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
429418
if (this.isTab(itemAfter) && itemAfter.group == tabGroup) {
430419
// Place at the front of, or between tabs in, the same tab group
431420
this.tabContainer.insertBefore(tab, itemAfter);
432-
@@ -4018,6 +4128,7 @@
421+
@@ -4018,6 +4126,7 @@
433422
if (pinned) {
434423
this._updateTabBarForPinnedTabs();
435424
}
436425
+ gZenWorkspaces.fixTabInsertLocation(tab, itemAfter);
437426

438427
TabBarVisibility.update();
439428
}
440-
@@ -4307,6 +4418,9 @@
429+
@@ -4307,6 +4416,9 @@
441430
return;
442431
}
443432

@@ -447,23 +436,23 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
447436
this.removeTabs(selectedTabs, { isUserTriggered, telemetrySource });
448437
}
449438

450-
@@ -4568,6 +4682,7 @@
439+
@@ -4568,6 +4680,7 @@
451440
telemetrySource,
452441
} = {}
453442
) {
454443
+ tabs = tabs.filter(tab => !tab.hasAttribute("zen-empty-tab"));
455444
// When 'closeWindowWithLastTab' pref is enabled, closing all tabs
456445
// can be considered equivalent to closing the window.
457446
if (
458-
@@ -4657,6 +4772,7 @@
447+
@@ -4657,6 +4770,7 @@
459448
if (lastToClose) {
460449
this.removeTab(lastToClose, aParams);
461450
}
462451
+ gZenUIManager.onTabClose(undefined);
463452
} catch (e) {
464453
console.error(e);
465454
}
466-
@@ -4695,6 +4811,12 @@
455+
@@ -4695,6 +4809,12 @@
467456
aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start();
468457
}
469458

@@ -476,7 +465,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
476465
// Handle requests for synchronously removing an already
477466
// asynchronously closing tab.
478467
if (!animate && aTab.closing) {
479-
@@ -4709,6 +4831,9 @@
468+
@@ -4709,6 +4829,9 @@
480469
// state).
481470
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
482471
let isLastTab = this.#isLastTabInWindow(aTab);
@@ -486,7 +475,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
486475
if (
487476
!this._beginRemoveTab(aTab, {
488477
closeWindowFastpath: true,
489-
@@ -4891,7 +5016,7 @@
478+
@@ -4891,7 +5014,7 @@
490479
closeWindowWithLastTab != null
491480
? closeWindowWithLastTab
492481
: !window.toolbar.visible ||
@@ -495,15 +484,15 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
495484

496485
if (closeWindow) {
497486
// We've already called beforeunload on all the relevant tabs if we get here,
498-
@@ -4915,6 +5040,7 @@
487+
@@ -4915,6 +5038,7 @@
499488

500489
newTab = true;
501490
}
502491
+ gZenWorkspaces._removedByStartupPage = false;
503492
aTab._endRemoveArgs = [closeWindow, newTab];
504493

505494
// swapBrowsersAndCloseOther will take care of closing the window without animation.
506-
@@ -4955,9 +5081,7 @@
495+
@@ -4955,9 +5079,7 @@
507496
aTab._mouseleave();
508497

509498
if (newTab) {
@@ -514,23 +503,23 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
514503
} else {
515504
TabBarVisibility.update();
516505
}
517-
@@ -5090,6 +5214,7 @@
506+
@@ -5090,6 +5212,7 @@
518507
this.tabs[i]._tPos = i;
519508
}
520509

521510
+ gZenWorkspaces.updateTabsContainers();
522511
if (!this._windowIsClosing) {
523512
// update tab close buttons state
524513
this.tabContainer._updateCloseButtons();
525-
@@ -5302,6 +5427,7 @@
514+
@@ -5302,6 +5425,7 @@
526515
}
527516

528517
let excludeTabs = new Set(aExcludeTabs);
529518
+ gZenWorkspaces.getTabsToExclude(aTab).forEach(tab => excludeTabs.add(tab));
530519

531520
// If this tab has a successor, it should be selectable, since
532521
// hiding or closing a tab removes that tab as a successor.
533-
@@ -5314,13 +5440,13 @@
522+
@@ -5314,13 +5438,13 @@
534523
!excludeTabs.has(aTab.owner) &&
535524
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
536525
) {
@@ -546,7 +535,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
546535
);
547536

548537
let tab = this.tabContainer.findNextTab(aTab, {
549-
@@ -5336,7 +5462,7 @@
538+
@@ -5336,7 +5460,7 @@
550539
}
551540

552541
if (tab) {
@@ -555,7 +544,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
555544
}
556545

557546
// If no qualifying visible tab was found, see if there is a tab in
558-
@@ -5357,7 +5483,7 @@
547+
@@ -5357,7 +5481,7 @@
559548
});
560549
}
561550

@@ -564,7 +553,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
564553
}
565554

566555
_blurTab(aTab) {
567-
@@ -5759,10 +5885,10 @@
556+
@@ -5759,10 +5883,10 @@
568557
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
569558
}
570559

@@ -577,7 +566,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
577566
aTab.selected ||
578567
aTab.closing ||
579568
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
580-
@@ -5952,7 +6078,7 @@
569+
@@ -5952,7 +6076,7 @@
581570
* `true` if element is a `<tab-group>`
582571
*/
583572
isTabGroup(element) {
@@ -586,7 +575,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
586575
}
587576

588577
/**
589-
@@ -6029,7 +6155,7 @@
578+
@@ -6029,7 +6153,7 @@
590579

591580
// Don't allow mixing pinned and unpinned tabs.
592581
if (this.isTab(element) && element.pinned) {
@@ -595,7 +584,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
595584
} else {
596585
tabIndex = Math.max(tabIndex, this.pinnedTabCount);
597586
}
598-
@@ -6055,10 +6181,16 @@
587+
@@ -6055,10 +6179,16 @@
599588
this.#handleTabMove(
600589
element,
601590
() => {
@@ -614,7 +603,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
614603
if (neighbor && this.isTab(element) && tabIndex > element._tPos) {
615604
neighbor.after(element);
616605
} else {
617-
@@ -6122,7 +6254,7 @@
606+
@@ -6122,7 +6252,7 @@
618607
moveBefore = true;
619608
}
620609
}
@@ -623,7 +612,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
623612
element = element.group;
624613
if (targetElement?.group) {
625614
targetElement = targetElement.group;
626-
@@ -6130,8 +6262,12 @@
615+
@@ -6130,8 +6260,12 @@
627616
}
628617

629618
// Don't allow mixing pinned and unpinned tabs.
@@ -637,7 +626,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
637626
moveBefore = false;
638627
} else if (!element.pinned && targetElement && targetElement.pinned) {
639628
// If the caller asks to move an unpinned element next to a pinned
640-
@@ -6145,7 +6281,7 @@
629+
@@ -6145,7 +6279,7 @@
641630
// move the tab group right before the first unpinned tab.
642631
// 4. Moving a tab group and the first unpinned tab is grouped:
643632
// move the tab group right before the first unpinned tab's tab group.
@@ -646,15 +635,15 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
646635
if (targetElement.group) {
647636
targetElement = targetElement.group;
648637
}
649-
@@ -6153,6 +6289,7 @@
638+
@@ -6153,6 +6287,7 @@
650639
}
651640

652641
let getContainer = () =>
653642
+ element.hasAttribute("zen-essential") ? gZenWorkspaces.getEssentialsSection(element) :
654643
element.pinned
655644
? this.tabContainer.pinnedTabsContainer
656645
: this.tabContainer;
657-
@@ -6210,7 +6347,7 @@
646+
@@ -6210,7 +6345,7 @@
658647
if (!this.isTab(aTab)) {
659648
throw new Error("Can only move a tab into a tab group");
660649
}
@@ -663,7 +652,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
663652
return;
664653
}
665654
if (aTab.group && aTab.group.id === aGroup.id) {
666-
@@ -6304,6 +6441,10 @@
655+
@@ -6304,6 +6439,10 @@
667656

668657
moveActionCallback();
669658

@@ -674,7 +663,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
674663
// Clear tabs cache after moving nodes because the order of tabs may have
675664
// changed.
676665
this.tabContainer._invalidateCachedTabs();
677-
@@ -7198,7 +7339,7 @@
666+
@@ -7198,7 +7337,7 @@
678667
// preventDefault(). It will still raise the window if appropriate.
679668
break;
680669
}
@@ -683,15 +672,15 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
683672
window.focus();
684673
aEvent.preventDefault();
685674
break;
686-
@@ -8143,6 +8284,7 @@
675+
@@ -8143,6 +8282,7 @@
687676
aWebProgress.isTopLevel
688677
) {
689678
this.mTab.setAttribute("busy", "true");
690679
+ if (!this.mTab.selected) this.mTab.setAttribute("unread", "true");
691680
gBrowser._tabAttrModified(this.mTab, ["busy"]);
692681
this.mTab._notselectedsinceload = !this.mTab.selected;
693682
}
694-
@@ -9108,7 +9250,7 @@ var TabContextMenu = {
683+
@@ -9108,7 +9248,7 @@ var TabContextMenu = {
695684
);
696685
contextUnpinSelectedTabs.hidden =
697686
!this.contextTab.pinned || !this.multiselected;
@@ -700,7 +689,7 @@ index 96fd8acdc09cc4c9649d1ed7503c2a0bde536613..e6b46996d96706d3641b6fc5c435a029
700689
// Move Tab items
701690
let contextMoveTabOptions = document.getElementById(
702691
"context_moveTabOptions"
703-
@@ -9384,6 +9526,7 @@ var TabContextMenu = {
692+
@@ -9384,6 +9524,7 @@ var TabContextMenu = {
704693
)
705694
);
706695
} else {

src/zen/common/styles/zen-browser-container.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#tabbrowser-tabpanels[dragging-split='true'] {
99
width: -moz-available;
1010
position: relative;
11-
overflow: hidden;
11+
overflow: clip;
1212

1313
&.browserSidebarContainer {
1414
:root:not([zen-no-padding='true']) & {

src/zen/common/zenThemeModifier.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ var ZenThemeModifier = {
4646
Services.prefs.addObserver(pref, handleEvent);
4747
}
4848

49-
window.addEventListener('unload', () => {
50-
for (let pref of kZenThemePrefsList) {
51-
Services.prefs.removeObserver(pref, handleEvent);
52-
}
53-
});
49+
window.addEventListener(
50+
'unload',
51+
() => {
52+
for (let pref of kZenThemePrefsList) {
53+
Services.prefs.removeObserver(pref, handleEvent);
54+
}
55+
},
56+
{ once: true }
57+
);
5458
},
5559

5660
handleEvent(event) {

0 commit comments

Comments
 (0)