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
2 changes: 1 addition & 1 deletion packages/extension-firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"browser_specific_settings": {
"gecko": {
"id": "gitmarks@paperhurts.dev",
"strict_min_version": "121.0",
"strict_min_version": "140.0",
"data_collection_permissions": {
"required": ["bookmarksInfo"]
}
Expand Down
19 changes: 7 additions & 12 deletions packages/extension-shared/src/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,18 @@ async function render(): Promise<void> {
return;
}

// Static template only — the tab title is set via textContent below so no
// dynamic value ever reaches innerHTML (AMO flags any interpolated
// innerHTML, issue #75).
root!.innerHTML = `
<p class="title" title="${escapeAttr(tab.title ?? tab.url)}">${escapeText(tab.title ?? tab.url)}</p>
<p class="title"></p>
<button id="save">Save this page</button>
<button id="save-all" class="secondary">Save all tabs</button>
<p id="status"></p>
`;
const titleEl = root!.querySelector<HTMLParagraphElement>(".title")!;
titleEl.textContent = tab.title ?? tab.url;
titleEl.title = tab.title ?? tab.url;

const errStored = await browser.storage.local.get("gitmarks:lastError");
const lastErr = errStored["gitmarks:lastError"] as LastErrorRecord | undefined;
Expand Down Expand Up @@ -170,17 +176,6 @@ async function render(): Promise<void> {
});
}

function escapeText(s: string): string {
return s
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
}

function escapeAttr(s: string): string {
return escapeText(s).replace(/"/g, "&quot;");
}

render().catch((err) => {
console.error("[gitmarks] popup render failed", err);
if (root != null) {
Expand Down
Loading