plasmo icon indicating copy to clipboard operation
plasmo copied to clipboard

[BUG] Uncaught Error: Extension context invalidated.

Open aiddroid opened this issue 7 months ago • 6 comments

What happened?

A bug happened! So many errors. I don't know why.

background.ts

import browser from 'webextension-polyfill'

browser.contextMenus.removeAll();
browser.contextMenus.create({
    id: 'test',
    title: "test",
    contexts: [
        "image",
    ]
});

browser.contextMenus.onClicked.addListener(function(info, tab) {
   // TODO
   browser.tabs.sendMessage(tab.id, {...});
});

content.ts

import browser from 'webextension-polyfill'

browser.runtime.onMessage.addListener(function(request, sender, sendResponse) {
    // Do some thing with promise.
    fetch('/api').then((res) => {
             // TODO
    }).catch();

    return true;
});

errors in file content.480c00a3.js:328 image

Version

Latest

What OS are you seeing the problem on?

No response

What browsers are you seeing the problem on?

No response

Relevant log output

No response

(OPTIONAL) Contribution

  • [ ] I would like to fix this BUG via a PR

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] I checked the current issues for duplicate problems.

aiddroid avatar Jan 20 '24 08:01 aiddroid