Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

docs: move the firefox install workaround note from the code into the extension rules

Luis Ortiz0266dd2ac00f
diff --git a/src/AGENTS.md b/src/AGENTS.md
index 5f9f563..27f57b2 100644
--- a/src/AGENTS.md
+++ b/src/AGENTS.md
@@ -13,9 +13,9 @@ Guide changes cross contexts on the `mimik-guides` BroadcastChannel. The message
## Capture lifecycle (xstate in the background)
-- `PAUSED` is a real state with a `pauseReason` (`'blur' | 'manual' | 'area'`, where `area` is desktop only). It never handles
- `USER_ACTION`. Step writes are gated on `RECORDING`, except `finalizeInputStep`, which is gated on
- "not IDLE".
+- `PAUSED` is a real state with a `pauseReason` (`'blur' | 'manual' | 'area'`, where `area` is
+ desktop only). It never handles `USER_ACTION`. Step writes are gated on `RECORDING`, except
+ `finalizeInputStep`, which is gated on "not IDLE".
- Read paused-ness from the state value, never from `pauseReason`. A snapshot restored from
`sessionStorage` may predate any context key, so treat new keys as possibly `undefined` (compare
with `=== true`).
@@ -45,5 +45,9 @@ Guide changes cross contexts on the `mimik-guides` BroadcastChannel. The message
- A `vi.mock` path must name the file the function lives in, not its folder. A stale path mocks
nothing and does not fail.
- `logger.warn` is compiled out of builds. Use `error` for anything a user could hit.
+- On a fresh Firefox install the background removes the `<all_urls>` grant. Firefox bug 1758306
+ records the grant but `captureVisibleTab` still rejects, and removing it makes the next
+ user-gesture `permissions.request()` grant it properly. Drop the workaround once Mozilla ships
+ the fix.
- Smart Blur cannot reach iframes, shadow DOM, canvas, pseudo-elements, `<select>` or attribute
values. The five READMEs say so, and they need updating with any change to the scanner.
diff --git a/src/entrypoints/background/index.ts b/src/entrypoints/background/index.ts
index fec233b..5e678f3 100644
--- a/src/entrypoints/background/index.ts
+++ b/src/entrypoints/background/index.ts
@@ -74,15 +74,6 @@ export default defineBackground(() => {
await recordUpdate(details.reason);
if (details.reason !== 'install') return;
if (import.meta.env.BROWSER === 'firefox') {
- // Firefox MV3 bug 1758306: the <all_urls> grant lands in the origin
- // store but is missed by _setupStartupPermissions when populating the
- // API-permission resolution table that captureVisibleTab consults.
- // Result: permissions.contains() returns true but captureVisibleTab
- // silently rejects. Removing the permission here forces a clean state
- // so the user-gesture permissions.request() in onboarding's "Get
- // Started" / sidepanel's "Start Recording" goes through the working
- // re-grant code path. Remove this when Mozilla ships:
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1758306
try {
await browser.permissions.remove({ origins: ['<all_urls>'] });
} catch (err) {
@@ -265,7 +256,7 @@ export default defineBackground(() => {
const steps = actionSteps(await getStepsForGuide(data.guideId));
if (steps.length === 0) return { started: false, error: 'No steps' };
- const firstStep = steps.find((s) => s.elementMeta) ?? steps[0];
+ const firstStep = steps.find((s) => s.elementMeta) ?? steps[0]!;
if (!steps.some((s) => s.elementMeta)) return { started: false, error: 'Guide lacks element metadata' };
await startSession(data.guideId, steps.length, firstStep, await resolveManual(firstStep));