Skip to content

Clarification of difference between additional privileges granted in MV2 and MV3 host permissions #39260

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rebloor
Copy link
Contributor

@rebloor rebloor commented Apr 24, 2025

Description

Rephrases the comment "though not for requests from content scripts, as was the case in Manifest V2" made in the host_permissions manifest key discussion about extra privileges given to XMLHttpRequest and fetch to access the declared origins without cross-origin restrictions. The statement has been interpreted to mean that the privilege isn't given for requests from content scripts in Manifest V2, when it is.

Change originally made as a result of this comment.

Related issues and pull requests

Fixes #39168

@rebloor rebloor added the Content:WebExt WebExtensions docs label Apr 24, 2025
@rebloor rebloor requested a review from dotproto April 24, 2025 04:22
@rebloor rebloor self-assigned this Apr 24, 2025
@rebloor rebloor requested a review from a team as a code owner April 24, 2025 04:22
@github-actions github-actions bot added the size/xs [PR only] 0-5 LoC changed label Apr 24, 2025
Copy link
Contributor

@@ -59,7 +59,7 @@ Host permissions are specified as [match patterns](/en-US/docs/Mozilla/Add-ons/W

The extra privileges include:

- [XMLHttpRequest](/en-US/docs/Web/API/XMLHttpRequest) and [fetch](/en-US/docs/Web/API/Fetch_API) access to those origins without cross-origin restrictions (though not for requests from content scripts, as was the case in Manifest V2).
- [XMLHttpRequest](/en-US/docs/Web/API/XMLHttpRequest) and [fetch](/en-US/docs/Web/API/Fetch_API) access to those origins without cross-origin restrictions, but not for requests from content scripts. (This differs from the behavior of [host permissions in Manifest V2](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions#host_permissions) that provided this privilege for requests from content scripts.)
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a reader, I still find this wording a bit confusing.

The parenthetical sentence contrasts the described behavior with Manifest V2, but it wasn't clear that the first sentence was referring to Manifest V3 in the first place. This is further complicated by the fact that content script behaviors differ across browsers –  but lets table this concern for the moment.

I've taken a shot at rewriting this line to be more easily understandable on first read.

Suggested change
- [XMLHttpRequest](/en-US/docs/Web/API/XMLHttpRequest) and [fetch](/en-US/docs/Web/API/Fetch_API) access to those origins without cross-origin restrictions, but not for requests from content scripts. (This differs from the behavior of [host permissions in Manifest V2](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions#host_permissions) that provided this privilege for requests from content scripts.)
- the ability to use [XMLHttpRequest](/en-US/docs/Web/API/XMLHttpRequest) and [fetch](/en-US/docs/Web/API/Fetch_API) to perform HTTP requests on matching origins without encountering cross-origin restrictions. (In Manifest V3 extensions this only applies to requests issued from extension contexts. In Manifest V2 it also applies to requests made by content scripts.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dotproto the manifest version is stated at the top of the page and clearly identifies that this feature is supported in 3 or above. So I don't believe there was a need to reword. The rewording adds ambiguity as it suggests this feature can be used in 2 and 3 but has different behavior in each.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebExt WebExtensions docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Host Permissions CORS contradiction
2 participants