Skip to content

Extension: a toolbar click that grants access to the page again - #258

Merged
TheGlitching merged 1 commit into
mainfrom
fm/squiggle-lemonde-erreur
Nov 15, 2026
Merged

TheGlitching merged 1 commit into
mainfrom
fm/squiggle-lemonde-erreur

Conversation

@TheGlitching

Copy link
Copy Markdown
Owner

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://extensions looked fine.

Cause

setupSidepanelAction called chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true }). Chrome then opens the panel itself on a toolbar click, and a click handled that way grants no activeTab. Because Chrome handled the click, action.onClicked never fired, and that is the path that grants access. With no host access, scripting.executeScript was 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.

  • Trigger: any toolbar click with the panel behaviour on.
  • Masking condition: granting "all sites" hides the bug completely, which is why it went unnoticed.
  • Symptom: the generic unreadable-page message, whose advice ("cliquez sur l'icône Squiggle depuis la page de l'article") could not help.

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 (AXPress on the action button, the same path as a mouse click). The run was started through the panel's own TRIGGER_ANALYSIS RPC, with no key and no account: it reads the page and then stops at the engine choice, so no model was called.

Build Panel opened elsewhere, article opened in a new tab, no click on it Icon clicked on the article
before "Impossible de lire cette page…" "Impossible de lire cette page…"
after "Squiggle n'a pas encore accès à cet onglet… Cliquez sur l'icône Squiggle dans la barre d'outils, puis relancez…" page read (the run goes on to the engine)

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:

  • With the panel behaviour switched off and nothing else changed, the same press on the same article makes the injection succeed.
  • With host access granted, extraction on the free article works (579 words, semantic-article).

Change

  • The panel behaviour is set to false explicitly. Chrome keeps the stored value across updates, so leaving the call out would keep existing installs broken. The existing onClicked handler opens the panel, and that click grants activeTab.
  • A refusal for lack of access (Chrome's "must request permission", Firefox's "Missing host permission") now gets its own message. It names the real situation, the panel open on a tab the icon was not clicked on, and the one action that fixes it. Browser-forbidden pages keep the existing message.

Tests

  • tests/background.test.ts: the panel behaviour is set to openPanelOnActionClick: 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:all and npm test pass.

Not covered

  • Firefox was not run: its action already goes through onClicked, which grants activeTab there.
  • No signed-in squiggle.fr session was used. The failure sits before the engine choice, so hosted and own-key runs fail at the same point.

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.
@TheGlitching
TheGlitching merged commit 4ae234e into main Nov 15, 2026
1 check passed
@TheGlitching
TheGlitching deleted the fm/squiggle-lemonde-erreur branch November 15, 2026 15:21
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.

1 participant