Closed
Bug 1287359
Opened 10 years ago
Closed 10 years ago
contextMenus API: contextmenus not removed when addon is disabled/removed
Categories
(WebExtensions :: Untriaged, defect)
WebExtensions
Untriaged
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: robwu, Unassigned)
Details
Attachments
(1 file)
|
758 bytes,
application/zip
|
Details |
1. Visit about:debugging and load the attached addon - it registers two context menus (and one menu item with a duplicate ID, which ought to be ignored - this indeed happens).
2. Visit example.com
3. Right-click on the link at example.com and look for the menu item added by the addon.
4. Reload the addon via about:debugging
5. Repeat step 3.
6. Visit about:addons and disable the addon.
7. Repeat step 3.
8. Visit about:addons and enable the addon.
9. Repeat step 3.
10. Visit about:addons and remove the addon.
11. Repeat step 3.
Expected:
- After step 3, you should observe one menu item (with two submenus).
- After step 5, you should still see one menu item.
- After step 7, you should not see any menu items (added by the addon).
- After step 9, you should see one menu item again.
- After step 11, you should not see any menu items.
Actual (in Firefox 47 and Nightly):
- Step 5 fails: There are two menu items instead of one.
- Step 9 fails: There is more than one menu item because the previous items are not removed.
In Chrome, when an extension is updated, all contextMenus registrations are wiped and the extension has to register new ones in order to get them back (via the chrome.runtime.onInstalled event).
If one calls chrome.contextMenus.create without an ID and reload the extension without updating it, then multiple menus may be registered. To counter that, one can specify an explicit menu ID, so that duplicate registrations are rejected.
With an explicit ID, the second contextMenus.create call within the script is rejected. However, after reloading the addon, the old context menu appears again, even if the addon passes an identical ID to the contextMenu.create method.
Another thing: When a context menu is added through contextMenus.create, multiple items are collapsed under one menu entry. With this bug, each reload adds another menu entry, as if the addons are distinct.
| Reporter | ||
Comment 1•10 years ago
|
||
Tried on latest Nightly (2016-07-20) and it works. mozregression points to https://hg.mozilla.org/integration/fx-team/pushloghtml?fromchange=74dd49dcf6c944a1de2b1762ee328710aa4358a4&tochange=811b5f9b7ae8548ca59f692e64f9e64bfdac132c, probably https://hg.mozilla.org/integration/fx-team/rev/2eb259ef1448.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Comment 2•10 years ago
|
||
Rob Wu, yep that change was meant to fix this issue. I was worried at first that this bug was found after that change had landed. Thanks for the detailed analysis of the issue and I'm glad it's resolved now.
Updated•8 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•