mirror of
https://github.com/XFox111/TabsAsideExtension.git
synced 2026-04-22 07:58:01 +03:00
fix: groupig fails on private windows when group contains restricted tabs
This commit is contained in:
@@ -55,8 +55,8 @@ export async function openGroup(group: GroupItem, newWindow: boolean = false): P
|
|||||||
async function createGroup(group: GroupItem, windowId: number, discard?: boolean): Promise<void>
|
async function createGroup(group: GroupItem, windowId: number, discard?: boolean): Promise<void>
|
||||||
{
|
{
|
||||||
discard ??= await settings.dismissOnLoad.getValue();
|
discard ??= await settings.dismissOnLoad.getValue();
|
||||||
const tabIds: number[] = await Promise.all(group.items.map(async i =>
|
const tabs: Tabs.Tab[] = await Promise.all(group.items.map(async i =>
|
||||||
(await createTab(i.url, windowId, discard, group.pinned)).id!
|
await createTab(i.url, windowId, discard, group.pinned)
|
||||||
));
|
));
|
||||||
|
|
||||||
// "Pinned" group is technically not a group, so not much else to do here
|
// "Pinned" group is technically not a group, so not much else to do here
|
||||||
@@ -65,9 +65,8 @@ async function createGroup(group: GroupItem, windowId: number, discard?: boolean
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const groupId: number = await chrome.tabs.group({
|
const groupId: number = await chrome.tabs.group({
|
||||||
tabIds, createProperties: {
|
tabIds: tabs.filter(i => i.windowId === windowId).map(i => i.id!),
|
||||||
windowId
|
createProperties: { windowId }
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await chrome.tabGroups.update(groupId, {
|
await chrome.tabGroups.update(groupId, {
|
||||||
@@ -79,12 +78,14 @@ async function createGroup(group: GroupItem, windowId: number, discard?: boolean
|
|||||||
async function manageWindow(handle: (windowId: number) => Promise<void>, windowProps?: Windows.CreateCreateDataType): Promise<void>
|
async function manageWindow(handle: (windowId: number) => Promise<void>, windowProps?: Windows.CreateCreateDataType): Promise<void>
|
||||||
{
|
{
|
||||||
const currentWindow: Windows.Window = windowProps ?
|
const currentWindow: Windows.Window = windowProps ?
|
||||||
await browser.windows.create({ url: "about:blank", focused: true, ...windowProps }) :
|
await browser.windows.create({ url: "about:blank", focused: false, ...windowProps }) :
|
||||||
await browser.windows.getCurrent();
|
await browser.windows.getCurrent();
|
||||||
const windowId: number = currentWindow.id!;
|
const windowId: number = currentWindow.id!;
|
||||||
|
|
||||||
await handle(windowId);
|
await handle(windowId);
|
||||||
|
|
||||||
|
await browser.windows.update(windowId, { focused: true });
|
||||||
|
|
||||||
if (windowProps)
|
if (windowProps)
|
||||||
// Close "about:blank" tab
|
// Close "about:blank" tab
|
||||||
await browser.tabs.remove(currentWindow.tabs![0].id!);
|
await browser.tabs.remove(currentWindow.tabs![0].id!);
|
||||||
|
|||||||
Reference in New Issue
Block a user