Closed Bug 1366702 Opened 3 years ago Closed 2 years ago

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

Categories

(WebExtensions :: Frontend, defect, P3)

54 Branch
defect

Tracking

(firefox63 verified)

VERIFIED FIXED
mozilla63
Iteration:
63.2 - July 23
Tracking Status
firefox63 --- verified

People

(Reporter: 61.1p57, Assigned: robwu)

References

(Blocks 1 open bug)

Details

(Whiteboard: triaged)

Attachments

(2 files)

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
Priority: -- → P3
Whiteboard: triaged
Product: Toolkit → WebExtensions
Blocks: 1466876
Assignee: nobody → rob
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Iteration: --- → 63.2 - July 23
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+
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/c344f123a5c6
Invoke menus.create callback if error occurs + tests r=mixedpuppy
https://hg.mozilla.org/mozilla-central/rev/c344f123a5c6
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Attached 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.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.