Fix double-prompt caused by www-redirect chain (v1.22) - #1
Merged
Conversation
The blocking UI was appearing twice consistently: once when navigating to a target site, and again immediately after pressing the allow button. Root cause was commit 50f838e's pendingPromptTabs guard clearing too eagerly on any changeInfo.url event, which fired for the browser's automatic site.com → www.site.com redirect before the tab had committed to prompt.html. The second event fell through to checkAccess and issued a duplicate prompt. Fix: introduce tabsCurrentlyAtPrompt to track when a tab has actually committed to prompt.html. Only clear pendingPromptTabs when the tab is genuinely navigating away from the prompt (i.e. tabsCurrentlyAtPrompt is set). Redirect-chain events arriving before the prompt commit are now suppressed correctly. Also clear processingTabs on prompt commit so back-button navigation is processed without waiting for the 1-second debounce to expire. Test infrastructure: add chrome.webNavigation mock to setup.js (was missing, causing all 62 tests to crash), add fireCommitted helper to helpers.js, and add two new flow tests covering the www-redirect chain and back-button without session scenarios. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tjmes3dCNNYxB5n7LzYzL
Owner
Author
|
@copilot please fix the merge conflicts in this pull request, version should be v23 |
Co-authored-by: aidankeighron <78337317+aidankeighron@users.noreply.github.com>
Contributor
Copilot stopped work on behalf of
aidankeighron due to an error
August 11, 2026 19:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The blocking UI was appearing twice every time a user opened a target app. The first prompt showed correctly; after pressing the button to proceed, a second prompt appeared immediately. This was consistent across all target sites and session types.
Root Cause
Commit
50f838eintroducedpendingPromptTabsto guard against duplicate processing, but its clearing logic was too aggressive. When a user navigated toyoutube.com(withoutwww), the browser automatically redirected towww.youtube.com. This fired a secondtabs.onUpdatedevent with a newchangeInfo.url— which the guard clearedpendingPromptTabson, treating it as a "user navigating away from prompt." The tab had not yet committed toprompt.html, so the second event fell through tocheckAccessand issued a duplicate redirect.The same pattern occurs for
instagram.com → www.instagram.comandreddit.com → www.reddit.com, which is why it affected every target site consistently.Fix
Introduced
tabsCurrentlyAtPrompt— a Set that tracks when a tab has actually committed toprompt.html. Thetabs.onUpdatedhandler now uses this to distinguish:prompt.htmlyet) → suppressedprompt.htmland now leaving) → processed normally, clears both setsAlso clear
processingTabswhen the tab commits toprompt.htmlso back-button navigation is processed correctly without waiting for the 1-second debounce.Test changes
tests/setup.js: Addedchrome.webNavigationmock — was missing entirely, causing all 62 existing tests to crash withTypeError: Cannot read properties of undefined (reading 'onCommitted').tests/helpers.js: AddedfireCommittedhelper forwebNavigation.onCommittedevents.tests/flows.test.js: Updated "fresh URL navigation away from prompt" test to use the correct flow (tab must commit toprompt.htmlbefore navigating away); added two new tests:www-redirect chain does not double-promptback button without session re-shows promptAll 64 tests pass.
Generated by Claude Code