Closed Bug 1489368 Opened 6 years ago Closed 6 years ago

Extension context menu disappears after restarting Firefox

Categories

(WebExtensions :: Untriaged, defect)

61 Branch
defect
Not set
normal

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).
This is indeed the case, I hope Firefox can solve this bug.
> - 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.
Product: Firefox → WebExtensions
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)
Attached file context-menu.zip
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?
The behavior in Firefox is correct, so closing...
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
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.

Attachment

General

Creator:
Created:
Updated:
Size: