Closed
Bug 1489368
Opened 6 years ago
Closed 6 years ago
Extension context menu disappears after restarting Firefox
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: tom_xyz, Unassigned)
Details
Attachments
(1 file)
684 bytes,
application/x-zip-compressed
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36
Steps to reproduce:
Here's what I observed:
- In Chrome, an extension's context menu is created once inside the onInstalled event handler. See Google's sample code:
https://github.com/GoogleChrome/chrome-app-samples/blob/master/samples/context-menu/main.js
I can verify that this works in my own Chrome extension, and the extension's context menu is preserved across Chrome sessions (i.e., after a restart).
- In Firefox, no matter where I create the context menu -- inside the onInstalled or onStartup event handler -- the context menu is only created once after the initial extension installation. After you restart Firefox, the extension's context menu disappears.
Actual results:
Extension's context menu disappears after restarting Firefox regardless of whether it's created inside onInstalled (like in Google's sample code above) or onStartup.
Expected results:
The extension's context menu, once created, should be preserved across Firefox sessions (i.e., after a restart).
> - In Firefox, no matter where I create the context menu -- inside the
> onInstalled or onStartup event handler -- the context menu is only created
> once after the initial extension installation. After you restart Firefox,
> the extension's context menu disappears.
I take this back: the context menu DOES show up if I create it inside the onStartup handler (it wasn't before because of some other condition). Still, to be consistent with Chrome and help make porting Chrome extensions more straight-forward, I hope that the Mozilla team can also persist the context menu across browser sessions like in Chrome even if it was originally created inside onInstalled.
Updated•6 years ago
|
Product: Firefox → WebExtensions
Comment 3•6 years ago
|
||
Hi Tom,
Can you please give an example of an extension for Firefox of which's context menu disappears after restart, so I can reproduce this issue?
Flags: needinfo?(tom_xyz)
Sample extension to test context menu.
Flags: needinfo?(tom_xyz)
@David Olah I identified the root cause after paring down the sample extension to the bare essentials (see context-menu.zip):
"background": {
"scripts": ["background.js"],
"persistent": false
},
The reason the context menu was persisting across sessions in Chrome and not Firefox is because of the 'persistent' property. It doesn't make any sense to me, but when you remove this property then the same disappearing-after-restart issue also happens in Chrome.
Do you think this is a Chromium bug that should be reported?
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
Comment 7•6 years ago
|
||
I agree with your statement from Comment 5. Thank you for closing the issue!
I don't know how Chromium interprets these properties. You can try your luck by logging a bug to Chrome.
You need to log in
before you can comment on or make changes to this bug.
Description
•