-
-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
I couldn't find good docs on MDN about this :(
https://github.com/w3c/webappsec-permissions-policy/blob/main/reporting.md has some good info, though.
I reckon we need some custom test like below plus a way to actually trigger a permission policy violation.
PermissionsPolicyViolationReportBody:
__base: |-
// Note: the Content-Security-Policy header is already configured on this website
if (!('ReportingObserver' in self)) {
return {result: false, message: 'ReportingObserver is not defined'};
}
// Create the observer
var observer = new ReportingObserver(
function(reports, observer) {
var instance = reports.length && reports[0].body;
callback(instance);
observer.disconnect();
},
{
types: ["permissions-policy-violation"],
buffered: true,
}
);
// Start observing
observer.observe();
toJSON: |-
function callback(instance) {
try {
success(!!instance && 'toJSON' in instance);
} catch(e) {
fail(e);
}
}
return 'callback';
PermissionsPolicyViolationReportBody
ships in Chrome 120 and wasn't detected by our collector, see mdn/browser-compat-data#21148 (comment)
Metadata
Metadata
Assignees
Labels
No labels