Skip to content

Drop the chrome.extension shim now that the controller targets MV3 - #2

Open
InventivetalentDev wants to merge 1 commit into
claude/manifest-v3-migration-xm48e8from
claude/manifest-v3-chrome-controller-ou4z84
Open

Drop the chrome.extension shim now that the controller targets MV3#2
InventivetalentDev wants to merge 1 commit into
claude/manifest-v3-migration-xm48e8from
claude/manifest-v3-chrome-controller-ou4z84

Conversation

@InventivetalentDev

Copy link
Copy Markdown
Member

Stacked on #1 — this targets that PR's branch, so the diff here is just the follow-up commit. Merging it updates #1.

Companion to RemoteSlide/RemoteSlide-Controller#1.

What changes

util/mv3-compat.js restored chrome.extension.onMessage/sendMessage/getURL for the bundled inject/controller submodule, which still called them. The submodule now uses chrome.runtime directly, so the shim and its injection ahead of pageController.js can go — the "can be removed once that submodule is migrated" note in #1.

The submodule pointer moves to that commit. That bump is not optional: it also carries the key-simulation fix, and without it removing the shim leaves the extension broken.

Why the submodule bump matters on its own

simulateKeyEvent in the controller appended an inline <script> to the page. MV3 applies the extension's own CSP (script-src 'self') to scripts a content script injects, so it is refused — on every site, not just ones with a strict CSP of their own. Verified by loading this extension unpacked against a page serving no CSP header at all:

Refused to execute inline script because it violates the following Content Security Policy
directive: "script-src 'self' 'wasm-unsafe-eval' 'inline-speculation-rules' ..."

So on #1 as it stands the extension connects, shows a green badge, and controls nothing. The controller PR has the detail and the fix.

Verification

Extension loaded unpacked in Chromium at this commit:

service worker registered : YES  <ext>/background.js
worker probe             : {
  "importedSessionGrabber": true,
  "hasOffscreenCanvas": true,
  "hasCreateImageBitmap": true,
  "hasFileReader": true,
  "noDocument": true,
  "chromeAction": true,
  "chromeScripting": true,
  "legacyBrowserAction": false,
  "resizeImageDefined": true,
  "takeScreenshotDefined": true
}
content-script errors    : (none)

The MV3 service worker registers, importScripts("sessionGrabber.js") resolves, chrome.browserAction is correctly absent, and the OffscreenCanvas/createImageBitmap/FileReader globals the rewritten resizeImage depends on are all present in the worker.

Merge order

RemoteSlide/RemoteSlide-Controller#1 should land first — the pointer here references a commit on that PR's branch. It is reachable either way, but pointing master's submodule at an unmerged branch commit is worth avoiding.


Generated by Claude Code

util/mv3-compat.js restored chrome.extension.onMessage/sendMessage/getURL
for the bundled inject/controller submodule, which still called them. The
submodule now uses chrome.runtime directly, so the shim and its injection
ahead of pageController.js can go.

The submodule pointer moves to that commit, which also fixes the key
simulation: it appended an inline <script> to the page, and MV3 applies
the extension's CSP ("script-src 'self'") to scripts a content script
injects, so it was refused on every site. Without this bump the extension
connects and controls nothing.
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