Implement initial version of ReportingObserver (#37905)

The specification moved around lately with how it defines its reports
and report bodies. They became dictionaries, but are currently missing
some fields [1].

Most tests won't be passing yet, since the `Reporting-Endpoints` header
isn't used yet. In fact, the specification leaves it up to the browser
to figure out when to run this task [2]. I am not sure if there some
background scheduling we can do here.

Confirmed with content-security-policy/reporting-api/
report-to-directive-allowed-in-meta.https.sub.html that the callback is
invoked. The test doesn't pass, since
the `describe_scripted_caller` is empty for HTML elements. Thus the
`source_file` is empty, whereas it should be equivalent to the current
document URL.

Part of #37328

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>

[1]: https://github.com/w3c/reporting/issues/286
[2]: https://w3c.github.io/reporting/#report-delivery
This commit is contained in:
Tim van der Lippe 2025-07-07 12:43:30 +02:00 committed by GitHub
parent 3d4868592a
commit fcb2a4cd95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 551 additions and 101 deletions

View file

@ -1,5 +1,5 @@
[post-redirect-stacktrace.https.html]
expected: ERROR
expected: TIMEOUT
[StackTrace do not leak cross-origin post-redirect URL]
expected: FAIL

View file

@ -1,4 +0,0 @@
[revalidate-not-blocked-by-csp.html]
[Request revalidation aren't blocked by CSP]
expected: FAIL

View file

@ -1,9 +1,10 @@
[reporting-subresource-corp.tentative.https.html]
expected: TIMEOUT
[[document\] blocked due to DIP]
expected: FAIL
expected: TIMEOUT
[[document\] blocked during redirect]
expected: FAIL
expected: NOTRUN
[destination: script]
expected: FAIL
@ -12,22 +13,22 @@
expected: FAIL
[[dedicated worker\] blocked due to DIP]
expected: FAIL
expected: NOTRUN
[[dedicated worker\] blocked during redirect]
expected: FAIL
expected: NOTRUN
[[shared worker\] same-origin]
expected: FAIL
expected: NOTRUN
[[shared worker\] blocked by CORP: same-origin]
expected: FAIL
[[shared worker\] blocked due to DIP]
expected: FAIL
expected: NOTRUN
[[shared worker\] blocked during redirect]
expected: FAIL
expected: NOTRUN
[[between service worker and page\] same-origin]
expected: FAIL
@ -42,10 +43,13 @@
expected: FAIL
[[document with service worker\] same-origin]
expected: FAIL
expected: NOTRUN
[[document with service worker\] blocked due to DIP]
expected: FAIL
expected: NOTRUN
[[document with service worker\] blocked during redirect]
expected: FAIL
expected: NOTRUN
[[dedicated worker\] same-origin]
expected: NOTRUN

View file

@ -1,6 +1,7 @@
[document-reporting-bypass-report-to.https.sub.html]
expected: TIMEOUT
[document policy violation observed]
expected: FAIL
expected: TIMEOUT
[Only the Reporting-Endpoints configured endpoint received reports.]
expected: FAIL
expected: NOTRUN

View file

@ -1,9 +1,7 @@
[document-reporting-named-endpoints.https.sub.html]
[csp violation report observed]
expected: FAIL
expected: TIMEOUT
[document policy violation observed]
expected: FAIL
expected: TIMEOUT
[Reporting endpoints received reports.]
expected: FAIL
expected: NOTRUN

View file

@ -1,6 +1,7 @@
[document-reporting-override-endpoint.https.sub.html]
expected: TIMEOUT
[document policy violation observed]
expected: FAIL
expected: TIMEOUT
[Only the second reporting endpoint received reports.]
expected: FAIL
expected: NOTRUN

View file

@ -50,33 +50,6 @@
[Report interface: attribute body]
expected: FAIL
[ReportingObserver interface: existence and properties of interface object]
expected: FAIL
[ReportingObserver interface object length]
expected: FAIL
[ReportingObserver interface object name]
expected: FAIL
[ReportingObserver interface: existence and properties of interface prototype object]
expected: FAIL
[ReportingObserver interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[ReportingObserver interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[ReportingObserver interface: operation observe()]
expected: FAIL
[ReportingObserver interface: operation disconnect()]
expected: FAIL
[ReportingObserver interface: operation takeRecords()]
expected: FAIL
[idlharness.any.worker.html]
[ReportBody interface: existence and properties of interface object]
@ -129,30 +102,3 @@
[Report interface: attribute body]
expected: FAIL
[ReportingObserver interface: existence and properties of interface object]
expected: FAIL
[ReportingObserver interface object length]
expected: FAIL
[ReportingObserver interface object name]
expected: FAIL
[ReportingObserver interface: existence and properties of interface prototype object]
expected: FAIL
[ReportingObserver interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[ReportingObserver interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[ReportingObserver interface: operation observe()]
expected: FAIL
[ReportingObserver interface: operation disconnect()]
expected: FAIL
[ReportingObserver interface: operation takeRecords()]
expected: FAIL

View file

@ -13640,14 +13640,14 @@
]
],
"interfaces.https.html": [
"eee8c799727b91e00b512795756b693a5f121f86",
"8a9345525360e7a7ce69e84e394b65a4cbc0ab34",
[
null,
{}
]
],
"interfaces.worker.js": [
"e86f34f261442aeaa7074c525fb4b1206219769d",
"f217fd8fb6b46144bc3576a081cc6ce5db3129d5",
[
"mozilla/interfaces.worker.html",
{}

View file

@ -293,6 +293,7 @@ test_interfaces([
"ReadableStreamBYOBReader",
"ReadableByteStreamController",
"ReadableStreamBYOBRequest",
"ReportingObserver",
"Request",
"ResizeObserver",
"ResizeObserverEntry",

View file

@ -103,6 +103,7 @@ test_interfaces([
"ReadableStreamBYOBReader",
"ReadableByteStreamController",
"ReadableStreamBYOBRequest",
"ReportingObserver",
"Request",
"Response",
"SecurityPolicyViolationEvent",