Skip to content
Open
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
6 changes: 5 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export async function getSiteName() {
const tab = await getCurrentTab();
const query = new URLSearchParams(document.location.search.substring(1));
// The popup passes the tab's title and url in its own query string. The MV3
// service worker calls this too and has no document, so fall back to the tab.
const query = new URLSearchParams(
typeof document !== "undefined" ? document.location.search.substring(1) : ""
);

let title: string | null;
let url: string | null;
Expand Down