Chrome Extension Context Menu not working after update

I have an extension that I recently pushed an update for with updated permissions. Some users are upgrading and reporting that the app doesn't work after the update, in order to make it work again they are having to completely uninstall the app and re-install and everything works as it should.

Has anyone ever had a similar issue? For me in testing everything updated properly, and not everyone is having this issue but it is becoming an issue.

Something to note - the popup tab does work it's just the context menu that has the issue.

EDIT - I am unable to replicate and have no clear way to test this beyond getting reports from users. I did notice a drop in reports after deploying another update where I adjusted the order of the permissions... I don't see how this is at all related but I am looking for any clarity as to why this is happening and if there is something that can be done to avoid it in the future.


You're creating context menu items in a listener for the chrome.runtime.onInstalled event. This is the documented and recommended way to create context menu items, but it is not always triggered due to bugs in Chrome (,,

I guess that in your case the permission update caused the extension to be disabled, and then chrome.runtime.onInstalled was not triggered any more after re-enabling it because of

A work-around for this bug is to use a short timer and try to update the context menu item that should have been created. If the onInstalled event is not triggered, then the context menu is not created and trying to update it will fail. This condition can then be used to ensure that the context menu is created correctly.

var SOME_CONTEXTMENU_ID = "GifMeContextMenu";

function onInstalled() {
    // ... do your thing, e.g. creating a context menu item:
        "title": "GifMe",
        "contexts": ["image"],

// Should be triggered whenever the extension or browser is
// reloaded, installed or updated.

setTimeout(function() {
    // This .update() call does not change the context menu if it exists,
    // but sets chrome.runtime.lastError if the menu does not exist.
    chrome.contextMenus.update(SOME_CONTEXTMENU_ID, {}, function() {
        if (chrome.runtime.lastError) {
            // Assume that occured, manually call the
            // onInstalled handler.
}, 222); // <-- Some short timeout.

Need Your Help

How to add button using layout both defined in the main.xml?

java android xml button

I created the button in the main.xml file and initialized it in the activity file but I am not sure how to get the button to appear on screen using the layout defined in the xml. Can anyone help me...

How to downcast from AnyObject to UInt16?


I'm trying to pass some values into a function that accepts UInt16 values as arguments.