ext(sw): expand active-tab URL filter; isolate chrome stub in tests
Expand get_active_tab_url protocol filter regex to include view-source:, data:, devtools:, and other browser-internal/extension contexts that would misbehave if autofilled. Add third regression test for view-source: URLs. Wrap get_active_tab_url tests in dedicated describe block with beforeEach/ afterEach to snapshot/restore globalThis.chrome, preventing stub leakage between tests. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -153,7 +153,7 @@ export async function handle(
|
||||
const tab = tabs[0];
|
||||
if (!tab?.url) return { ok: true, data: null };
|
||||
// Filter out chrome:// and extension URLs — autofill doesn't apply.
|
||||
if (/^(chrome|chrome-extension|moz-extension|edge|about|file):/i.test(tab.url)) {
|
||||
if (/^(chrome|chrome-extension|chrome-search|moz-extension|edge|edge-extension|about|file|view-source|data|devtools|javascript):/i.test(tab.url)) {
|
||||
return { ok: true, data: null };
|
||||
}
|
||||
return { ok: true, data: { url: tab.url, title: tab.title ?? '' } };
|
||||
|
||||
Reference in New Issue
Block a user