Skip to content

Commit

Permalink
feat: set openerTabId to tabs opened from links (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Oct 9, 2020
1 parent 083b523 commit d2e904e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/background/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class Container {
dontPin = true,
deletesHistory = false,
macConfirmPage = false,
openerTab,
}: TmpTabOptions): Promise<Tab | undefined> {
if (request && request.requestId) {
// we saw that request already
Expand Down Expand Up @@ -98,6 +99,7 @@ export class Container {
dontPin,
macConfirmPage,
contextualIdentity,
openerTab,
});
}

Expand Down Expand Up @@ -165,13 +167,15 @@ export class Container {
dontPin,
macConfirmPage,
contextualIdentity,
openerTab,
}: {
url?: string;
tab?: Tab;
active?: boolean;
dontPin?: boolean;
macConfirmPage?: boolean;
contextualIdentity: browser.contextualIdentities.ContextualIdentity;
openerTab?: Tab;
}): Promise<Tab> {
try {
const newTabOptions: CreateTabOptions = {
Expand Down Expand Up @@ -212,7 +216,9 @@ export class Container {
if (tab.pinned && !dontPin) {
newTabOptions.pinned = true;
}
if (tab.openerTabId) {
if (openerTab) {
newTabOptions.openerTabId = openerTab.id;
} else if (tab.openerTabId) {
newTabOptions.openerTabId = tab.openerTabId;
}
if (tab.windowId) {
Expand Down
2 changes: 2 additions & 0 deletions src/background/contextmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class ContextMenu {
active: false,
deletesHistory:
this.pref.deletesHistory.automaticMode === 'automatic',
openerTab: tab,
});
break;

Expand All @@ -39,6 +40,7 @@ export class ContextMenu {
url: info.linkUrl,
active: false,
deletesHistory: true,
openerTab: tab,
});
break;

Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface TmpTabOptions {
dontPin?: boolean;
deletesHistory?: boolean;
macConfirmPage?: boolean;
openerTab?: Tab;
}

export type IsolationAction =
Expand Down

0 comments on commit d2e904e

Please sign in to comment.