update coop docs, particularly with -report-only#42051
update coop docs, particularly with -report-only#42051steve-a-walsh wants to merge 3 commits intomdn:mainfrom
Conversation
There was a problem hiding this comment.
| The behavior depends on the policies of both the new document and its opener, and whether the new document is opened following a navigation or using {{domxref("Window.open()")}}. | ||
|
|
||
| There are two variants of this header: | ||
| - **`Cross-Origin-Opener-Policy`**: Enforces the policy and controls browsing context group behavior. |
There was a problem hiding this comment.
[mdn-linter] reported by reviewdog 🐶
| - **`Cross-Origin-Opener-Policy`**: Enforces the policy and controls browsing context group behavior. | |
| - **`Cross-Origin-Opener-Policy`**: Enforces the policy and controls browsing context group behavior. |
| The `Cross-Origin-Opener-Policy-Report-Only` header monitors the policy without enforcing it. When a browsing context group switch would occur that violates the policy specified in `Cross-Origin-Opener-Policy-Report-Only`, the browser sends a report to the specified endpoint (if `report-to` is provided) but still allows the navigation or window opening to proceed according to the actual policy enforcement. | ||
|
|
||
| Both headers can be present simultaneously: | ||
| - `Cross-Origin-Opener-Policy` controls the actual behavior |
There was a problem hiding this comment.
[mdn-linter] reported by reviewdog 🐶
| - `Cross-Origin-Opener-Policy` controls the actual behavior | |
| - `Cross-Origin-Opener-Policy` controls the actual behavior |
| ``` | ||
|
|
||
| In this example: | ||
| - The actual policy is `unsafe-none` (permissive) |
There was a problem hiding this comment.
[mdn-linter] reported by reviewdog 🐶
| - The actual policy is `unsafe-none` (permissive) | |
| - The actual policy is `unsafe-none` (permissive) |
|
Thanks for your PR! I know it's still in draft, but a couple of quick comments that might be helpful.
|
|
Also this in its proper form will fix #39432 |
|
See also #39880 where I made a good start on this. I've been stalled for a while on #39880 (comment) Usually violations that do reporting use the reporting API https://developer.mozilla.org/en-US/docs/Web/API/Reporting_API which has both a JavaScript side and an HTTP endpoint side. Normally you document the report format methodically in the reporting API part and then reference it from the HTTP header side. Given response time/bandwidth probably worth documenting this HTTP side much as you have done and and we can add the reporting API and "fix this up" later. |
Thanks for the advice. I will make this adjustment based on how the CSP and CSP-RO pages relate to one-another. Sorry for the delays given the Thanksgiving holiday. |
This is great, thanks! It would be beneficial to incrementally improve the docs here so at least more/better documentation is available to the developing public. |
Description
This PR adds comprehensive documentation for the
Cross-Origin-Opener-Policy-Report-Onlyheader and thereport-toparameter, which were previously missing from the MDN documentation. The update includes a new reporting section explaining how to set up and use COOP violation reporting, enhanced syntax documentation showing both header variants, and practical examples demonstrating how to test policies using the report-only variant.Motivation
The MDN documentation for
Cross-Origin-Opener-Policywas missing critical information that developers need to effectively implement and monitor COOP policies:Missing
Cross-Origin-Opener-Policy-Report-Onlyheader: This header is part of the official specification and is commonly used in production codebases to test policies before enforcement, but was completely absent from MDN documentation.Missing
report-toparameter: The specification supports areport-toparameter for both COOP headers (similar to CSP), allowing developers to monitor policy violations. This functionality is already being used in real-world implementations but was undocumented.No reporting guidance: Developers had no documentation on how to set up reporting endpoints, what reports contain, or when they are generated.
These gaps made it difficult for developers to:
The updates align the MDN documentation with the official specification (WHATWG HTML Living Standard, section 7.1.3) and provide developers with the complete information needed to implement COOP effectively.
Additional details
report-toparameter andCross-Origin-Opener-Policy-Report-Onlyheader are already in use in production codebases (e.g., for monitoring policy violations before enforcement)Related issues and pull requests
Relates to #39880
Fixes #39432