Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/app/service/service_worker/value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ export class ValueService {
}
// 推送到所有加载了本脚本的tab中
for (const tab of tabs) {
const tabId = tab.id!;
const tabId = tab.id;
if (tab.discarded || !tabId) continue;
this.popup!.getScriptMenu(tabId).then((scriptMenu) => {
if (scriptMenu.find((item) => item.storageName === storageName)) {
this.runtime!.sendMessageToTab(
Expand Down
1 change: 1 addition & 0 deletions src/pkg/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function parseStorageValue(str: string): unknown {
export async function getCurrentTab(): Promise<chrome.tabs.Tab | undefined> {
// `tab` will either be a `tabs.Tab` instance or `undefined`.
const [tab] = await chrome.tabs.query({ active: true, lastFocusedWindow: true, windowType: "normal" });
if (tab?.discarded) return undefined;
return tab;
}

Expand Down
Loading