pixiebrix-extension icon indicating copy to clipboard operation
pixiebrix-extension copied to clipboard

Context menu items showing for mods that are not active

Open grahamlangford opened this issue 2 years ago • 4 comments

https://pixiebrix.slack.com/archives/C0436P48QHY/p1694551866880489

grahamlangford avatar Sep 13 '23 15:09 grahamlangford

This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.

github-actions[bot] avatar Feb 08 '24 00:02 github-actions[bot]

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:

  1. the mod is updated/removed in the background
  2. 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.

fregante avatar Feb 08 '24 03:02 fregante

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:

Screenshot 3

There's no reason for every content script in every frame and every tab to request this on every load:

Screenshot 4

fregante avatar Feb 08 '24 05:02 fregante

This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.

github-actions[bot] avatar May 09 '24 00:05 github-actions[bot]

This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.

github-actions[bot] avatar Aug 08 '24 00:08 github-actions[bot]

This issue was closed because it has been stale for 7 days with no activity.

github-actions[bot] avatar Aug 16 '24 00:08 github-actions[bot]