Context menu items showing for mods that are not active
https://pixiebrix.slack.com/archives/C0436P48QHY/p1694551866880489
This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.
From slack:
sticky context menus have been like playing whack a mole
We should move the registration out of the content script, context menus should not be registered on page load (which is when the content scripts run)
I think this bug happens because:
- the mod is updated/removed in the background
- when the content script runs, it just tries to register the context menu with the latest information, it has no recollection of the previous context menu that should now be removed
If context menus were handled entirely by the background page, then a mod update in the background would automatically be followed by "unregister all context menus, then register the ones that are enabled"
Then the page editor can register the dynamic context menus directly, perhaps via a special contextMenuId that starts with dynamic: so that they can be recognized and handled better.
Disregard. It looks like ensureContextMenu is already being called by the background page on load, which is good.
However the content script also calls it at every page load, which should probably be dropped and let the background page (and page editor) deal with registration independently:
There's no reason for every content script in every frame and every tab to request this on every load:
This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.
This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.
This issue was closed because it has been stale for 7 days with no activity.