Closed
Bug 1370716
Opened 9 years ago
Closed 8 years ago
Error on console when browserAction button is pressed with no background script
Categories
(WebExtensions :: General, defect, P5)
WebExtensions
General
Tracking
(firefox57 verified, firefox58 verified)
VERIFIED
FIXED
mozilla57
People
(Reporter: mkaply, Assigned: zombie)
Details
(Whiteboard: triaged)
Attachments
(2 files)
The following code in background.js should add a context menu to the toolbar button menu:
chrome.contextMenus.create({
"title": "Import Friends",
"contexts": ["browser_action"],
"id": "import_friends",
"onclick": function(clickData) {
alert('here');
}
});
When you right click on the button in the toolbar, you get an error in ext-contextMenus.js at line 130
item is undefined.
| Reporter | ||
Comment 1•9 years ago
|
||
This line:
http://searchfox.org/mozilla-central/source/browser/components/extensions/ext-contextMenus.js#99
const root = gRootItems.get(contextData.extension);
in buildActionContextMenu is returning null.
| Assignee | ||
Comment 2•9 years ago
|
||
Is this the only code in the whole extension? (If not, can you attach a minimal STR extension please?)
Are you adding menu items from other contexts?
| Reporter | ||
Comment 3•9 years ago
|
||
Sorry, I'm in mid development so I misunderstood what was happening here.
I don't have a background script added yet, but every time the button is pressed there is an error.
So the bug seems to be that if you don't have a background script, we still try to add context menus (and show an error on the console)
Sorry for the confusion.
Summary: Adding a context menu using the browser_action context doesn't work → Error on console when browserAction button is pressed with no background script
| Assignee | ||
Comment 4•9 years ago
|
||
In that case, unless you are testing in Nightly, this is likely bug 1362445.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
| Assignee | ||
Comment 5•9 years ago
|
||
or perhaps not.
Assignee: nobody → tomica
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Updated•9 years ago
|
Priority: -- → P5
Whiteboard: triaged
| Comment hidden (mozreview-request) |
| Assignee | ||
Comment 7•8 years ago
|
||
So the issue is when the extension doesn't use menus (doesn't ask for the permission), the menus initialization [1] never happens, so we shouldn't even try to add _action context menus in that case.
1) http://searchfox.org/mozilla-central/source/browser/components/extensions/ext-menus.js#621
| Assignee | ||
Updated•8 years ago
|
Attachment #8894276 -
Flags: review?(mixedpuppy)
| Comment hidden (mozreview-request) |
Comment 9•8 years ago
|
||
| mozreview-review | ||
Comment on attachment 8894276 [details]
Bug 1370716 - Only try to add _action menus if extension has permission
https://reviewboard.mozilla.org/r/165364/#review170838
Attachment #8894276 -
Flags: review?(mixedpuppy) → review+
Comment 10•8 years ago
|
||
Pushed by tomica@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/6f41f31b5299
Only try to add _action menus if extension has permission r=mixedpuppy
Comment 11•8 years ago
|
||
| bugherder | ||
Status: REOPENED → RESOLVED
Closed: 9 years ago → 8 years ago
status-firefox57:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Comment 12•8 years ago
|
||
I can reproduce this issue on Firefox 55.0a1 (20170606030207) under Wind 7 64-bit.
This issue is verified as fixed on Firefox 57.0b14 (20171102181127) and Firefox 58.0a1 (2017-11-02) under Wind 7 64-bit and Mac OS X 10.13.
There is no error in the browser console when you right click on the browser_action that has no background script added.
Please see the attached video.
Updated•8 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•