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

externally_connectable doc improvements #20438

Merged
merged 7 commits into from
Sep 25, 2022

Conversation

rebloor
Copy link
Contributor

@rebloor rebloor commented Sep 8, 2022

Description

This change removes the experimental flag from the externally_connectable manifest key and adds clarification about the APIs that can be used to send messages from webpages to extensions. Also, references to the function of externally_connectable are added to runtime.sendMessage(), runtime.onMessageExternal, and runtime.connect().

Motivation

Complete work started in #19838

@rebloor rebloor added the Content:WebExt WebExtensions docs label Sep 8, 2022
@rebloor rebloor requested a review from Rob--W September 8, 2022 19:01
@rebloor rebloor self-assigned this Sep 8, 2022
@rebloor rebloor requested a review from a team as a code owner September 8, 2022 19:01
@rebloor rebloor requested review from willdurand and removed request for a team September 8, 2022 19:01
@github-actions github-actions bot added the Content:Other Any docs not covered by another "Content:" label label Sep 8, 2022
@@ -24,6 +24,8 @@ You can call this:

Note that you can't use this function to connect an extension to its content scripts. To do this, use {{WebExtAPIRef('tabs.connect()')}}.

By default, this connection can exchange messages with any other extension. However, the [`externally_connectable`](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/externally_connectable) manifest key can be used to limit communication to specific extensions and enable communication with websites.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default, this connection can exchange messages with any other extension. However, the [`externally_connectable`](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/externally_connectable) manifest key can be used to limit communication to specific extensions and enable communication with websites.
By default, this connection can exchange messages with any other extension instead of itself via the `extensionId` parameter. However, the [`externally_connectable`](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/externally_connectable) manifest key can be used to limit communication to specific extensions and enable communication with websites.

Clarification; please apply something along the lines of this to all similar texts in the PR.

@@ -15,14 +15,16 @@ browser-compat: webextensions.api.runtime.onMessageExternal
---
{{AddonSidebar()}}

Use this event to listen for messages from another extension.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this; "from another extension or web page".

Explicitly not the extension itself.


> **Note:**
> For communication with web pages:
> - In Chrome, `chrome.runtime.connect` and `chrome.runtime.sendMessage` are used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add sentence:

These methods are only available if there is at least one extension that listens for messages (https://groups.google.com/a/chromium.org/g/chromium-extensions/c/tCWVZRq77cg/m/KB6-tvCdAgAJ).

(Maybe something link text instead of just a plain link?)

@rebloor rebloor requested a review from Rob--W September 9, 2022 09:35
@rebloor rebloor requested a review from Rob--W September 15, 2022 08:56
@rebloor rebloor merged commit b1b3ff1 into mdn:main Sep 25, 2022
@rebloor rebloor deleted the externally_connectable-doc-improvements branch September 25, 2022 22:37
himanshugarg pushed a commit to himanshugarg/content that referenced this pull request Sep 27, 2022
* externally_connectable doc improvements

* Updates from feedback

* lint issues fix

* Review feedback

Co-authored-by: Rob Wu <[email protected]>

Co-authored-by: Rob Wu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Other Any docs not covered by another "Content:" label Content:WebExt WebExtensions docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants