Skip to content

a computer kept from an older image runs the box extension's new background script, so the page's focus is reported there too - #39

Merged
hexuria merged 1 commit into
mainfrom
gol/extension-version
Oct 10, 2026
Merged

hexuria merged 1 commit into
mainfrom
gol/extension-version

Conversation

@hexuria

@hexuria hexuria commented Oct 10, 2026

Copy link
Copy Markdown
Owner

The bug

After #38, a Bot's computer updated to the new image still never reported which box had focus. Bot A's fill on Facebook was refused with "the computer cannot say which box has focus": safe, but saved logins couldn't fill there at all.

A Bot's computer keeps its home volume, and with it the Chromium profile, across image updates. Chromium went on running the extension's background service worker that the profile had registered first: Default/Service Worker/ScriptCache on Bot A's computer held the old background.js (no focusByTab), dated before the update. A fresh profile held the new one. The content script ran and reported, but the old worker had no listener for it, so focus never reached the box.

Bumping the extension's manifest version did not make Chromium take the new script. That was tested and is not included here.

The fix

docker/entrypoint.sh gets refresh_extension_worker, called in start_chrome before Chromium launches:

  • It hashes /opt/box/active-tab/* and compares the result with ${BOX_CHROME_PROFILE}/.box-active-tab.sha256.
  • If the hashes differ, or there is no stamp, it clears Default/Service Worker once, then writes the stamp. Every worker registers anew: the extension's, and any a site had, which sites register again on their next visit.
  • If they match, it does nothing.

Tested (throwaway volume, never a Bot's)

  1. Made a profile with the image from before the box says what kind of box has focus on the page in front, so a password is typed only into a password box #38 (grok-box:pre-focus).
  2. Today's main image on that profile: {"url":".../login.html","seq":3}, with no focus. This reproduces the bug.
  3. The same profile with the manifest version bumped to 1.1: still no focus.
  4. This branch's image on that profile: it logged the box extension changed; clearing the profile's service workers once, then reported "focus":"password","seq":7 after a Tab into the password box.
  5. This branch's image again: it cleared nothing (0 messages) and still reported "focus":"password".

bash -n docker/entrypoint.sh passes.

…ground script, so the page's focus is reported there too
@hexuria
hexuria merged commit 3e5dfbc into main Oct 10, 2026
1 check 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.

1 participant