Reputation: 167
I'm getting the following error. The extension is working fine as I want it to but what's with the error?
Upvotes: 0
Views: 221
Reputation: 77591
Context items persist between extension reloads - something not very obvious.
So you're getting this when this code is executed a second time.
A common pattern is clear-then-register:
chrome.contextMenus.removeAll(function() {
chrome.contextMenus.create(contextMenuItem);
// Add more
});
If you're using an Event page (persistent: false
background page), you probably don't want to execute that every time the page is woken up; wrap it in chrome.runtime.onStartup
or even chrome.runtime.onInstalled
(to register once per update).
Upvotes: 1
Reputation: 222
Have you added the menu to the permissions-part of your manifest.json? More info can be found here.
Upvotes: 0