Skip to content

Keep the permission prompt inside the user's gesture on Firefox - #12

Merged
tshmieldev merged 1 commit into
mainfrom
tshmieldev/gesture-safe-permissions
Sep 23, 2026
Merged

tshmieldev merged 1 commit into
mainfrom
tshmieldev/gesture-safe-permissions

Conversation

@tshmieldev

Copy link
Copy Markdown
Owner

Follow-up to CodeRabbit's comment on #11, which was right: Firefox allows permissions.request only while the user's gesture is live, and any earlier await in the handler ends it. #11 awaited permissions.contains first, which would have broken every save that needs a prompt on Firefox desktop (Vercel, TypeSafe, custom endpoints).

  • Granted origins are read once when the popup opens, and again on permissions.onAdded/onRemoved.
  • ensureOrigins compares synchronously and calls permissions.request before yielding; a test asserts the request is already in flight when the function returns.
  • A grant covering every site (https://*/*, <all_urls>) counts as covering the origin, so an all-sites grant is never re-asked.

The Kiwi fix from #11 stands: an origin the manifest already covers is never requested. 128 tests pass. Not tried on Firefox or a phone; reasoned from the docs and covered by unit tests.

From the review on #11. Firefox allows permissions.request only while the
user's gesture is live, and any earlier await in the handler ends it. The
"no active window" fix awaited permissions.contains first, which would have
broken every save that needs a prompt on Firefox desktop: Vercel, TypeSafe,
and custom endpoints.

The granted origins are now read once when the popup opens (and again on
every grant or revocation), the comparison is synchronous, and the prompt
is the first thing the save handler awaits. A grant that covers every site
counts as covering the origin.
Copilot AI lite review requested due to automatic review settings September 23, 2026 10:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 704a216e-3abd-4234-bff7-f5d6dd95f230

📥 Commits

Reviewing files that changed from the base of the PR and between 28eab48 and 87cb74e.

📒 Files selected for processing (2)
  • src/popup/App.tsx
  • tests/permissions.test.ts
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@tshmieldev
tshmieldev merged commit 6b5e525 into main Sep 23, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants