Callback for contextMenus.create is not called when a failure occurs

VERIFIED FIXED in Firefox 63

Status

P3
normal
VERIFIED FIXED
2 years ago
8 months ago

People

(Reporter: 61.1p57, Assigned: robwu)

Tracking

(Blocks: 1 bug)

54 Branch
mozilla63

Firefox Tracking Flags

(firefox63 verified)

Details

(Whiteboard: triaged)

Attachments

(2 attachments)

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0
Build ID: 20170518105722

Steps to reproduce:

Run following code on extension console twice:

browser.contextMenus.create({
    id: '0',
    title: '0',
    contexts: ['all']
}, () => {
    console.error(browser.runtime.lastError);
});


Actual results:

1st
Returns `0`
Logs     `null`

2nd
Returns `0`
Raises   "Id already exists"  (ext-contextMenus.js:389)
            "Error: An unexpected error occurred" (unknown)
Nothing is logged


Expected results:

The callback should also be called when a failure occurs, as the document at [1] states that "It uses an optional callback to communicate success or failure"

[1]: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextMenus/create#Parameters
Component: Untriaged → WebExtensions: Frontend
Product: Firefox → Toolkit

Updated

2 years ago
Priority: -- → P3
Whiteboard: triaged

Updated

9 months ago
Product: Toolkit → WebExtensions

Updated

8 months ago
Blocks: 1466876
(Assignee)

Updated

8 months ago
Assignee: nobody → rob
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment hidden (mozreview-request)
Iteration: --- → 63.2 - July 23

Comment 2

8 months ago
mozreview-review
Comment on attachment 8993766 [details]
Bug 1366702 - Invoke menus.create callback if error occurs + tests

https://reviewboard.mozilla.org/r/258466/#review266410
Attachment #8993766 - Flags: review?(mixedpuppy) → review+

Comment 3

8 months ago
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/c344f123a5c6
Invoke menus.create callback if error occurs + tests r=mixedpuppy

Comment 4

8 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/c344f123a5c6
Status: ASSIGNED → RESOLVED
Last Resolved: 8 months ago
status-firefox63: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63

Comment 5

8 months ago
Posted image Bug1366702.png
This issue is verified as fixed on Firefox 63.0a1 (20180729220222) under Win 7 64-bit and Mac OS X 10.13.3.

Please see the attached screenshot.

Updated

8 months ago
Status: RESOLVED → VERIFIED
status-firefox63: fixed → verified
You need to log in before you can comment on or make changes to this bug.