Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with "runtime.sendMessage()": update example: returning a Promise is now preferred, as sendResponse() will be removed from the W3C spec #5169

Closed
FoE-Info opened this issue May 20, 2021 · 3 comments
Assignees
Labels
Content:WebExt WebExtensions docs

Comments

@FoE-Info
Copy link

MDN URL: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/sendMessage

What information was incorrect, unhelpful, or incomplete?

Returning a Promise is now preferred, as sendResponse() will be removed from the W3C spec
nee to update the example to use a promise - sendResponse({response: "Response from background script"});

Specific section or headline?

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/sendMessage#examples

What did you expect to see?

example that complies with current recommendations

Did you test this? If so, how?

the example code results in a warning:
browser-polyfill.js:1075 Returning a Promise is the preferred way to send a reply from an onMessage/onMessageExternal listener, as the sendResponse will be removed from the specs (See https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage)

MDN Content page report details
@chrisdavidmills chrisdavidmills added Content:WebExt WebExtensions docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels May 21, 2021
@rebloor rebloor added P3 and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Aug 2, 2021
@sideshowbarker sideshowbarker changed the title Issue with "runtime.sendMessage()": (short summary here please) Issue with "runtime.sendMessage()": update example: returning a Promise is now preferred, as sendResponse() will be removed from the W3C spec Feb 17, 2022
@rebloor
Copy link
Contributor

rebloor commented Jun 20, 2022

@rpl see you are the assignee on this one, can I help move this one forward?

@rpl
Copy link
Member

rpl commented Jun 23, 2022

@rpl see you are the assignee on this one, can I help move this one forward?

The warning emitted by the webextension-polyfill will be going away, the w3c specs draft the warning refers to is an obsolete draft.

I filed mozilla/webextension-polyfill#386 to track that.

@rebloor
Copy link
Contributor

rebloor commented Jun 26, 2022

Thanks @rpl, from your feedback I assume that this issue is now moot so I've closed it.

@rebloor rebloor closed this as completed Jun 26, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Content:WebExt WebExtensions docs
Projects
None yet
Development

No branches or pull requests

3 participants