Ensure that when adding an essential it is saved correctly in the database.

This commit is contained in:
Kristijan Ribarić
2024-11-04 22:24:40 +01:00
parent 19f8f58618
commit bf0342eb06

View File

@@ -154,6 +154,10 @@
newTab.setAttribute("zen-workspace-id", pin.workspaceUuid); newTab.setAttribute("zen-workspace-id", pin.workspaceUuid);
} }
if (pin.isEssential) {
newTab.setAttribute("zen-essential", "true");
}
gBrowser.pinTab(newTab); gBrowser.pinTab(newTab);
} }
@@ -178,10 +182,9 @@
delete tab._zenClickEventListener; delete tab._zenClickEventListener;
} }
break; break;
// TODO: Do this in a better way. Closing a second window could trigger remove tab and delete it from db case "TabClose":
// case "TabClose": this._removePinnedAttributes(tab);
// this._removePinnedAttributes(tab); break;
// break;
default: default:
console.warn('ZenPinnedTabManager: Unhandled tab event', action); console.warn('ZenPinnedTabManager: Unhandled tab event', action);
break; break;
@@ -189,8 +192,8 @@
} }
_onTabClick(e) { _onTabClick(e) {
const tab = e.target; const tab = e.target?.closest("tab");
if (e.button === 1) { if (e.button === 1 && tab) {
this._onCloseTabShortcut(e, tab); this._onCloseTabShortcut(e, tab);
} }
} }
@@ -246,7 +249,8 @@
title: tab.label || browser.contentTitle, title: tab.label || browser.contentTitle,
url: browser.currentURI.spec, url: browser.currentURI.spec,
containerTabId: tab.getAttribute("userContextId"), containerTabId: tab.getAttribute("userContextId"),
workspaceUuid: tab.getAttribute("zen-workspace-id") workspaceUuid: tab.getAttribute("zen-workspace-id"),
isEssential: tab.getAttribute("zen-essential") === "true"
}); });
tab.setAttribute("zen-pin-id", uuid); tab.setAttribute("zen-pin-id", uuid);