Repository navigation
Extension: a toolbar click that grants access to the page again - #258
Merged
Merged
Conversation
Chrome opened the side panel itself (`openPanelOnActionClick: true`), and a click handled that way grants no `activeTab`. `action.onClicked` never fired, so injecting the content script was refused on every page, and a reader who had not allowed all sites could analyse nothing. The error then blamed pages the browser forbids (its settings, the extension gallery) and advised clicking the icon on the article, which changed nothing. Measured in Chrome 152 on a fresh profile with real toolbar presses, on a free lemonde.fr article and on franceinfo.fr alike, with and without uBlock Origin Lite and AdBlock: the injection is refused after the click with the panel behaviour on, and succeeds once the click reaches `onClicked`. The ad blockers change nothing. The panel behaviour is now set to false explicitly, since Chrome keeps the stored value across updates. When the panel is already open on a tab the reader never clicked the icon on, the refusal now says so and names the one action that grants access.
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.
The problem
On Chrome, a new install could not read any article. A friend tried it on a free lemonde.fr article and got "Impossible de lire cette page. Le navigateur interdit aux extensions d'accéder à certaines pages…", which reads like a missing permission. No permission prompt ever appeared, and the extension's page in
chrome://extensionslooked fine.Cause
setupSidepanelActioncalledchrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true }). Chrome then opens the panel itself on a toolbar click, and a click handled that way grants noactiveTab. Because Chrome handled the click,action.onClickednever fired, and that is the path that grants access. With no host access,scripting.executeScriptwas refused on every page ("Cannot access contents of the page. Extension manifest must request permission to access the respective host."). The extension only worked for readers who had allowed all sites in the settings.It has nothing to do with lemonde.fr: franceinfo.fr fails identically.
Reproduction (Chrome for Testing 152, fresh profile, current build)
The toolbar button was pressed for real through macOS accessibility (
AXPresson the action button, the same path as a mouse click). The run was started through the panel's ownTRIGGER_ANALYSISRPC, with no key and no account: it reads the page and then stops at the engine choice, so no model was called.Same results with uBlock Origin Lite and AdBlock installed (uBlock Origin itself no longer installs on Chrome, which is MV3 only). The ad blockers were ruled out as a cause. What would disprove the explanation, and was checked:
semantic-article).Change
falseexplicitly. Chrome keeps the stored value across updates, so leaving the call out would keep existing installs broken. The existingonClickedhandler opens the panel, and that click grantsactiveTab.Tests
tests/background.test.ts: the panel behaviour is set toopenPanelOnActionClick: false.tests/contentScriptRecovery.test.ts: Chrome's exact refusal string yields the no-access message, not the browser-forbidden one.Both fail against the previous code.
npm run typecheck,SQUIGGLE_HOSTED_ORIGIN=https://squiggle.fr npm run build:allandnpm testpass.Not covered
onClicked, which grantsactiveTabthere.