Closed Bug 1362445 Opened 2 years ago Closed 2 years ago

Console error when right-clicking on a browserAction with no context menus defined

Categories

(WebExtensions :: General, enhancement)

enhancement
Not set

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: bsilverberg, Assigned: zombie)

Details

(Whiteboard: [browserAction], triaged)

Attachments

(1 file)

I noticed this when doing some work on browserAction telemetry. If you right-click on a browserAction, and there are no extensions loaded that use the contextmenus API, you get the following error in the console:

TypeError: global.actionContextMenu is not a function  -  ext-browserAction.js:310:11

If there are any extensions loaded that use the contextmenus API then this message does not appear. Discussing this with Luca, we believe this has to do with the lazy loading of the contextmenus API.

This doesn’t break anything, so perhaps it is something that can just be ignored, I’m not sure how critical it is to fix this.
it should be easy to avoid
Assignee: nobody → tomica
Comment on attachment 8865233 [details]
Bug 1362445 - Fix _action context menus when module is not loaded

https://reviewboard.mozilla.org/r/136900/#review140062

This looks good, thanks zombie.  I just want to confirm, there is never a case where this code could run and want to force the loading of the menus module, correct?
Attachment #8865233 - Flags: review?(bob.silverberg) → review+
> I just want to confirm, there is never a case where this code could 
> run and want to force the loading of the menus module, correct?

Correct, at least not now.  Chrome adds some items to browserAction's context menu even when the extension doesn't, and we were talking about doing something similar (can't find the bug), or when we implement menu-buttons (bug 1253419), but for now, if no extension has used the browser.contextMenus, we don't need to do anything here.
Keywords: checkin-needed
Whiteboard: [browserAction] → [browserAction], triaged
Keywords: checkin-needed
Attachment #8865233 - Flags: review?(mixedpuppy)
Comment on attachment 8865233 [details]
Bug 1362445 - Fix _action context menus when module is not loaded

https://reviewboard.mozilla.org/r/136900/#review140200
Attachment #8865233 - Flags: review?(mixedpuppy) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/2c8fe990d360
Fix _action context menus when module is not loaded r=bsilverberg,mixedpuppy
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/2c8fe990d360
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Duplicate of this bug: 1370716
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.