fregante / webext-permission-toggle

Browser-action context menu to request permission for the current tab.
https://fregante.github.io/webext-permission-toggle/
MIT License
70 stars 5 forks source link

Issue Unchecked runtime.lastError: Cannot find menu item with id webext-domain-permission-toggle:add-permission #47

Closed nikolay-yankov closed 8 months ago

nikolay-yankov commented 8 months ago

After installing the chrome extension and after a few minutes I get the following error in the service worker: Unchecked runtime.lastError: Cannot find menu item with id webext-domain-permission-toggle:add-permission Then the button Enable ${manifest.name} on this domain disappears from the context menu (right click the extension icon). I'm trying to debug in the library, but so far I don't have success. This happens in the latest version 4.1.0. The extension is running on Manifest v3.

Any suggestions how to fix it are welcome. Thanks!

image image

fregante commented 8 months ago

I added support for MV3 only recently so it's possible that it's incomplete, but there is a test extension in the repo and it worked fine there. Make sure you have the required setup in the manifest.

fregante commented 8 months ago

Use v5, it's been published as a "next" version under a new name. I forgot to publish it completely.

npm install webext-permission-toggle@next
nikolay-yankov commented 8 months ago

Thanks for you reply! I just tried the v5 from the standalone link but webextPermissions is undefined. I'm using it by invoking addPermissionToggle({ reloadOnSuccess: true, }); Otherwise with the v4.1.0 it was set up properly (permissions, etc). The feature was working as intended for sometime and then ceases operation with that error.

image

nikolay-yankov commented 8 months ago

Ok, I figured it out. It was because of my code in the extension. I had chrome.contextMenus.removeAll(); and completely forgot about it. I used it for other context menu items. I'll continue with the v4.1.0 Sorry for the trouble.