Refactor ZenGlanceManager to improve readability and maintainability of tab opening logic

This commit is contained in:
mr. M
2025-01-21 20:43:54 +01:00
parent 839d5ce1f9
commit 4efc2cd05f

View File

@@ -13,8 +13,8 @@
XPCOMUtils.defineLazyPreferenceGetter(
this._lazyPref,
"SHOULD_OPEN_EXTERNAL_TABS_IN_GLANCE",
"zen.glance.open-essential-external-links",
'SHOULD_OPEN_EXTERNAL_TABS_IN_GLANCE',
'zen.glance.open-essential-external-links',
false
);
@@ -309,8 +309,13 @@
shouldOpenTabInGlance(tab) {
let owner = tab.owner;
return owner && owner.getAttribute('zen-essential') === 'true' && this._lazyPref.SHOULD_OPEN_EXTERNAL_TABS_IN_GLANCE
&& owner.linkedBrowser?.docShellIsActive && owner.linkedBrowser?.browsingContext?.isAppTab;
return (
owner &&
owner.getAttribute('zen-essential') === 'true' &&
this._lazyPref.SHOULD_OPEN_EXTERNAL_TABS_IN_GLANCE &&
owner.linkedBrowser?.docShellIsActive &&
owner.linkedBrowser?.browsingContext?.isAppTab
);
}
onTabOpen(event) {