2

I am trying to migrate my browser extension to manifest version 3 but I am not able to access some properties from chrome.runtime in my service_worker. Code explains more than words I guess.

My background.js file:

function call() {
    console.log({ runtime: chrome.runtime })
    chrome.runtime.getPackageDirectoryEntry(() => null)
}

// putting it to timeout otherwise I couldn't access the logs page
setTimeout(() => {
    call()
}, 0)

My manifest:

{
    "manifest_version": 3,
    "name": "Test",
    "version": "0.0.0",
    "background": {
        "service_worker": "background.js"
    }
}

When I open service worker page I can see

Uncaught TypeError: chrome.runtime.getPackageDirectoryEntry is not a function

The same code works with v2:

{
    "manifest_version": 2,
    "name": "Test",
    "version": "0.0.0",
    "background": {
        "scripts": ["backgroud.js"]
    }
}

The method I am trying to use is documented here but it is clearly missing in the runtime object (with plenty of others...)

Joozty
  • 460
  • 2
  • 12
  • 40
  • 3
    It's not implemented, see [How do I get access to all the files in the extension in Chrome Extension Manifest Version 3 (MV3)?](https://stackoverflow.com/a/65976345) – wOxxOm Feb 05 '21 at 16:01

0 Answers0