Open
Bug 1250223
Opened 8 years ago
Updated 9 months ago
When using promise-style WebExtension interfaces, validation errors throw instead of returning a rejected promise
Categories
(WebExtensions :: General, defect, P3)
WebExtensions
General
Tracking
(Not tracked)
NEW
People
(Reporter: aswan, Unassigned)
References
Details
(Whiteboard: triaged)
The code that does type, format, etc checking on parameters passed into WebExtensions functions always throws, but this is awkward when using the promise-style interfaces. As an example, the url field in the options passed to browser.downloads.download() must be in the "url" format. But that means that this code is broken since download() will throw, and neither the then() or catch() handler will ever be invoked: browser.downloads.download({url: someURL}) .then(id => ..) .catch(err => ..) :kmag points out that if the parameters are so hopelessly broken that we can't even figure out if there is a valid callback, then the only option is to throw. But lets make this better for the case outlined above.
Reporter | ||
Updated•8 years ago
|
Assignee: nobody → aswan
Updated•8 years ago
|
Priority: -- → P3
Whiteboard: triaged
Updated•8 years ago
|
Component: WebExtensions: Untriaged → WebExtensions: General
Comment 2•7 years ago
|
||
This also affects chrome-like callback code. E. g. |chrome.notifications.create| throws if trying to use buttons, while it should instead be executing the callback with chrome.extension.lastError set (for chrome compatibility)
Reporter | ||
Comment 3•7 years ago
|
||
I'm not actually working on this so un-assigning. At this point, it may be too late to make any changes if people are writing code that depends on the current behavior...
Assignee: aswan → nobody
Comment 4•7 years ago
|
||
It's never too late to fix bugs
Updated•6 years ago
|
Product: Toolkit → WebExtensions
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•