electron: [Bug]: chrome.scripting API not implemented for extensions using Manifest V3

Preflight Checklist

Electron Version

24.0.0

What operating system are you using?

macOS

Operating System Version

Monterey

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

Extensions using the chrome.scripting API should work properly. Manifest v3 should work properly. A React-specific bug is here https://github.com/electron/electron/issues/36545

Actual Behavior

With the following code:

import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';

const { app } = require('electron');

app.whenReady().then(() => {
    installExtension(REACT_DEVELOPER_TOOLS)
        .then((name) => console.log(`Added Extension:  ${name}`))
        .catch((err) => console.log('An error occurred: ', err));
});

You get the following errors/issues:

[44297:1203/150155.162121:ERROR:extensions_browser_client.cc(62)] Extension Error:
  OTR:     false
  Level:   1
  Source:  manifest.json
  Message: Service worker registration failed. Status code: 15
  ID:      fmkadmapgofadopljbjfkapdkoienihi
  Type:    ManifestError
[44297:1203/150155.162205:ERROR:extensions_browser_client.cc(62)] Extension Error:
  OTR:     false
  Level:   2
  Source:  chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/background.js
  Message: Uncaught TypeError: Cannot read properties of undefined (reading 'registerContentScripts')
  ID:      fmkadmapgofadopljbjfkapdkoienihi
  Type:    RuntimeError
  Context: chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/background.js
  Stack Trace: 
    {
      Line:     107
      Column:   1
      URL:      chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/background.js
      Function: (anonymous function)
    }

Testcase Gist URL

No response

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 28 (8 by maintainers)

Most upvoted comments

hey all - i’m actively working on this and should have a flurry of PRs to improve Manifest v3 support up within 2-3 weeks at most.

On the agenda is:

I published https://www.npmjs.com/package/electron-extension-installer as a temporary workaround for some common extensions, including React, but this really should be fixed on electrons end. (source code here)

import { installExtension, REACT_DEVELOPER_TOOLS } from "electron-extension-installer";

app.on("ready", async () => {
  await installExtension(REACT_DEVELOPER_TOOLS, {
    loadExtensionOptions: {
      allowFileAccess: true,
    },
  });
});

@codebytere Is the support planned in the roadmap? React Dev tools are an important asset in the Dev’s toolbelt.

@nosferatu500 ah dang yes i know what that is - it’s not an issue with chrome.scripting but rather chrome.action. It’s on my short-term todo list to address!

@tbrkollar no promises on fix timeline but i’ll take a look before the week ends 😃

Hi @codebytere, I hope you are doing well.

I tried to fix it, but the vue tab cannot load. When I check the installation with ses.getAllExtensions() everything is all right. It returns an array that contains vue-tool extension object.  I tried to use electron-devtools-installer and also load extension manually.

Do you have any news? or idea? Thanks

@tbrkollar no promises on fix timeline but i’ll take a look before the week ends 😃

hi @codebytere When using vue devtools on electron 28.3.0 the project does not have this tool option, tried to ask the solution of gpt, still did not solve this small problem. image image

@tbrkollar no promises on fix timeline but i’ll take a look before the week ends 😃