mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-11 21:57:14 +03:00
fix(extension): popup scan stuck on Scanning after page reload (v1.0.2)
The service worker's webNavigation.onCompleted handler only cleared csInjected when DevTools was open. The popup-only flow never registered the tab in devtoolsTabs, so a page reload left a stale csInjected: true even though the content script had been destroyed. The next popup scan saw the stale flag, skipped re-injection, and silently sent its scan request to a tab with no listener — popup UI got stuck on "Scanning..." indefinitely. Reset is now unconditional (page reload always destroys the content script regardless of which UI is open). Auto-rescan stays gated to DevTools, since the popup is strictly user-driven. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
ac2237a7a9
commit
d154a5feb3
@@ -238,20 +238,29 @@ chrome.runtime.onConnect.addListener((port) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Re-scan on navigation (only if DevTools is open AND user was actively scanning)
|
||||
// On navigation, reset content-script state for any tracked tab (page reload destroys
|
||||
// the content script regardless of which UI surfaced it). Auto-rescan is gated separately
|
||||
// on DevTools being open AND the user having previously engaged.
|
||||
chrome.webNavigation?.onCompleted?.addListener((details) => {
|
||||
if (details.frameId !== 0) return;
|
||||
if (!devtoolsTabs.has(details.tabId)) return;
|
||||
const state = tabState.get(details.tabId);
|
||||
if (!state) return;
|
||||
// Only re-scan if the user has actively engaged (had findings or injected previously)
|
||||
|
||||
// Capture engagement state BEFORE clearing (used by the auto-rescan branch).
|
||||
const wasActive = state.injected || state.findings.length > 0;
|
||||
|
||||
// Always clear: the content script is gone after reload, full stop. Skipping this when
|
||||
// DevTools wasn't open meant the popup-only flow saw a stale csInjected: true on the
|
||||
// second click and silently no-op'd against a tab that had no listener.
|
||||
state.findings = [];
|
||||
state.injected = false;
|
||||
state.csInjected = false; // page reload destroys the content script
|
||||
state.csInjected = false;
|
||||
updateBadge(details.tabId);
|
||||
notifyPanels(details.tabId, { action: 'navigated' });
|
||||
if (wasActive) {
|
||||
|
||||
// Auto-rescan only when DevTools is the driver — the popup is user-triggered and
|
||||
// shouldn't fire scans the user didn't ask for.
|
||||
if (devtoolsTabs.has(details.tabId) && wasActive) {
|
||||
setTimeout(() => sendScanToTab(details.tabId), 300);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"manifest_version": 3,
|
||||
"name": "Impeccable",
|
||||
"description": "Detect common UI anti-patterns in any web page",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"permissions": ["activeTab", "scripting", "storage", "webNavigation"],
|
||||
"host_permissions": ["<all_urls>"],
|
||||
"background": {
|
||||
|
||||
@@ -933,6 +933,17 @@
|
||||
</div>
|
||||
|
||||
<div class="changelog-list" data-reveal>
|
||||
<div class="changelog-entry">
|
||||
<div class="changelog-version-header">
|
||||
<span class="changelog-version">Extension v1.0.2</span>
|
||||
<span class="changelog-date">April 29, 2026</span>
|
||||
</div>
|
||||
<ul class="changelog-items">
|
||||
<li><strong>Popup scan no longer hangs after a page reload.</strong> The toolbar-icon flow worked the first time but got stuck on "Scanning…" on subsequent clicks if the page had been reloaded in between. The service worker only cleared its content-script-injected flag when DevTools was open, so the popup-only path saw a stale flag and silently sent its scan request to a tab whose content script had already been wiped. Reset is now unconditional; auto-rescan stays gated to DevTools.</li>
|
||||
<li><strong>Detector flags the new monoculture.</strong> The overused-font rule now catches Fraunces, Geist, Mona Sans, Plus Jakarta Sans, Space Grotesk, Recoleta, and Instrument Sans alongside Inter and the older defaults. Brand exceptions for Vercel, Next.js, and GitHub on their own domains.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="changelog-entry">
|
||||
<div class="changelog-version-header">
|
||||
<span class="changelog-version">CLI v2.1.8</span>
|
||||
|
||||
Reference in New Issue
Block a user