Closed
Bug 1367294
Opened 7 years ago
Closed 7 years ago
runtime.sendMessage WebExtension page incorrectly describes return value and arguments
Categories
(Developer Documentation Graveyard :: Add-ons, defect)
Developer Documentation Graveyard
Add-ons
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: bill, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 Steps to reproduce: Tested on Firefox 53.0.2 (64-bit), Linux. On https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/sendMessage, MDN describes a Promise being returned from the call to `runtime.sendMessage`, and three arguments to the method. This differs from the Chrome documentation (https://developer.chrome.com/extensions/runtime#method-sendMessage) which does not specify a return value and provides a fourth argument as a `responseCallback`. In my testing, I found that the Chrome documentation was accurate, and that `sendMessage` (at least on stable) returns `undefined`. The fourth argument was available via the API in both `stable` and `54.0b5 (64-bit)` Linux. Proposed solution: If this is an error, please correct. If this reflects a planned change in the API, please make note of this.
Comment 1•7 years ago
|
||
WebExtensions implement asynchronous functions with promises, not with callbacks. This is a system-wide incompatibility with Chrome extensions: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities#Callbacks_and_the_chrome.*_namespace Firefox implements a shim which makes the "chrome" namespace available as well as the "browser" namespace. If you use the "chrome" namespace, you get the callback style for asynch functions. I hope that helps!
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 2•7 years ago
|
||
This makes sense. Thanks for the clarification.
You need to log in
before you can comment on or make changes to this bug.
Description
•