Title: [282305] trunk
Revision
282305
Author
cdu...@apple.com
Date
2021-09-10 19:51:32 -0700 (Fri, 10 Sep 2021)

Log Message

Implement navigation reporting for Cross-Origin-Opener-Policy
https://bugs.webkit.org/show_bug.cgi?id=230046

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline WPT COOP navigation reporting tests now that they are passing.

Merge the following fix to WPT tests so they can run with the WebKit infrastructure:
- https://github.com/web-platform-tests/wpt/pull/30411

Merge the following WPT test fix to address flakiness:
- https://github.com/web-platform-tests/wpt/pull/30548

* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https.html.sub.headers:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-from-unsafe-none.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https.html.sub.headers:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-opener.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-popup.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https.html.sub.headers:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https.html.sub.headers:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html.sub.headers:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html.sub.headers:
* web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-redirect-with-same-origin-allow-popups.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/reporting/resources/reporting-common.js:

Source/WebCore:

Implement navigation reporting for Cross-Origin-Opener-Policy as per:
- https://html.spec.whatwg.org/multipage/origin.html#coop-violation-navigation-to
- https://html.spec.whatwg.org/multipage/origin.html#coop-violation-navigation-from

With support for the Report-To HTTP header as documented here:
- https://www.w3.org/TR/reporting/#header

When adopting Cross-Origin-Opener-Policy or Cross-Origin-Opener-Policy-Report-Only HTTP headers,
developers can now specify a `report-to` directive with the name of the endpoint to report
COOP violations to. The mapping from endpoint name to URL is provided via teh Report-To HTTP
header, as is expected by the WPT tests.

No new tests, unskipped and rebaselined existing tests.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* loader/CrossOriginOpenerPolicy.cpp:
(WebCore::sanitizeReferrerForURLReport):
(WebCore::crossOriginOpenerPolicyValueToString):
(WebCore::sendCOOPViolationReport):
(WebCore::sendViolationReportWhenNavigatingToCOOPResponse):
(WebCore::sendViolationReportWhenNavigatingAwayFromCOOPResponse):
* loader/CrossOriginOpenerPolicy.h:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest):
(WebCore::checkIfEnforcingReportOnlyCOOPWouldRequireBrowsingContextGroupSwitch):
(WebCore::DocumentLoader::enforceResponseCrossOriginOpenerPolicy):
(WebCore::DocumentLoader::responseReceived):
* loader/PingLoader.cpp:
(WebCore::PingLoader::sendViolationReport):
(WebCore::PingLoader::startPingLoad):
* loader/PingLoader.h:
* loader/ReportingEndpointsCache.cpp: Added.
(WebCore::ReportingEndpointsCache::singleton):
(WebCore::ReportingEndpointsCache::addEndPointsFromResponse):
(WebCore::ReportingEndpointsCache::addEndpointFromDictionary):
(WebCore::ReportingEndpointsCache::endpointURL const):
(WebCore::ReportingEndpointsCache::EndPoint::EndPoint):
(WebCore::ReportingEndpointsCache::EndPoint::hasExpired const):
* loader/ReportingEndpointsCache.h: Added.
* loader/ResourceLoaderOptions.h:
(WebCore::ResourceLoaderOptions::shouldOmitUserAgent):
(WebCore::ResourceLoaderOptions::ResourceLoaderOptions):
* loader/WorkerThreadableLoader.cpp:
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
* platform/network/HTTPHeaderNames.in:

Source/WebKit:

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::didCleanupResourceLoader):
Now that we may abort expired loaders that are cached on the NetworkSession
(because awaiting transfer to another web process connection), we would hit
this assertion because the loader is not associated with this connection
anymore at the point it is adopted. For this reason, I silenced this
assertion.

* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::CachedNetworkResourceLoader::expirationTimerFired):
Abort the loader before destroying it to avoid hitting an assertion in the
destructor (loaders cannot be loading at the point they are destroyed).

Tools:

Fix issue where [DumpJSConsoleLogInStdErr] was not working for tests that process-swap
due to COOP. Some data members on InjectedBundle such as m_dumpJSConsoleLogInStdErr
were only set in didReceiveMessageToPage(), before calling beginTesting(). However, in
case of process-swap, beginTesting() gets called a second time in the new process, from
InjectedBundle::didCreatePage() with BegingTestingMode::Resume. As a result, the
m_dumpJSConsoleLogInStdErr flag was not getting set in the new process' injected bundle
after a process-swap. To address the issue, those data members now get initialized in
beginTesting() instead.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
(WTR::InjectedBundle::beginTesting):

LayoutTests:

Unskip COOP navigation reporting tests.

* TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (282304 => 282305)


--- trunk/LayoutTests/ChangeLog	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/ChangeLog	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,3 +1,14 @@
+2021-09-10  Chris Dumez  <cdu...@apple.com>
+
+        Implement navigation reporting for Cross-Origin-Opener-Policy
+        https://bugs.webkit.org/show_bug.cgi?id=230046
+
+        Reviewed by Alex Christensen.
+
+        Unskip COOP navigation reporting tests.
+
+        * TestExpectations:
+
 2021-09-10  Eric Hutchison  <ehutchi...@apple.com>
 
         Update test expectations for fast/events/ios/rotation/basic-rotation.html.

Modified: trunk/LayoutTests/TestExpectations (282304 => 282305)


--- trunk/LayoutTests/TestExpectations	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/TestExpectations	2021-09-11 02:51:32 UTC (rev 282305)
@@ -410,6 +410,8 @@
 imported/w3c/web-platform-tests/html/cross-origin-opener-policy/navigate-to-aboutblank.https.html [ DumpJSConsoleLogInStdErr ]
 imported/w3c/web-platform-tests/html/cross-origin-opener-policy/navigate-top-to-aboutblank.https.html [ DumpJSConsoleLogInStdErr ]
 imported/w3c/web-platform-tests/html/cross-origin-opener-policy/popup-coop-by-sw.https.html [ DumpJSConsoleLogInStdErr ]
+imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-opener.https.html [ DumpJSConsoleLogInStdErr ]
+imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-popup.https.html [ DumpJSConsoleLogInStdErr ]
 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-network-error.sub.html [ DumpJSConsoleLogInStdErr ]
 imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/integrity.html [ DumpJSConsoleLogInStdErr ]
 imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/import-css-module-basic.html [ DumpJSConsoleLogInStdErr ]
@@ -717,8 +719,8 @@
 imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/form-controls/select-sizing-001.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-x.xhtml [ ImageOnlyFailure ]
 
-# Cross-Origin Opener Policy reporting is not supported and it is causing those tests to time out.
-imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting [ Skip ]
+# Cross-Origin Opener Policy access reporting is not supported and it is causing those tests to time out.
+imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/access-reporting [ Skip ]
 
 # Cross-Origin-Embedder-Policy: credentialless is not supported.
 imported/w3c/web-platform-tests/html/cross-origin-embedder-policy/credentialless

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,3 +1,38 @@
+2021-09-10  Chris Dumez  <cdu...@apple.com>
+
+        Implement navigation reporting for Cross-Origin-Opener-Policy
+        https://bugs.webkit.org/show_bug.cgi?id=230046
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline WPT COOP navigation reporting tests now that they are passing.
+
+        Merge the following fix to WPT tests so they can run with the WebKit infrastructure:
+        - https://github.com/web-platform-tests/wpt/pull/30411
+
+        Merge the following WPT test fix to address flakiness:
+        - https://github.com/web-platform-tests/wpt/pull/30548
+
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https.html.sub.headers:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-from-unsafe-none.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https.html.sub.headers:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-opener.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-popup.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https.html.sub.headers:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https.html.sub.headers:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html.sub.headers:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html.sub.headers:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-redirect-with-same-origin-allow-popups.https-expected.txt:
+        * web-platform-tests/html/cross-origin-opener-policy/reporting/resources/reporting-common.js:
+
 2021-09-10  Simon Fraser  <simon.fra...@apple.com>
 
         Update css-transforms WPT

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,4 +1,4 @@
 
-FAIL coop reporting test A test with both COOP and COOP report only setup to CROSS_ORIGIN with same-origin-allow-popups; report-to="coop-popup-report-endpoint", require-corp, same-origin; report-to="coop-popup-report-only-endpoint", require-corp promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin-allow-popups\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https.html\",\"type\":\"coop\"}, within available reports: []"
+PASS coop reporting test A test with both COOP and COOP report only setup to CROSS_ORIGIN with same-origin-allow-popups; report-to="coop-popup-report-endpoint", require-corp, same-origin; report-to="coop-popup-report-only-endpoint", require-corp
 PASS verify remaining reports
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https.html.sub.headers (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https.html.sub.headers	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https.html.sub.headers	2021-09-11 02:51:32 UTC (rev 282305)
@@ -3,4 +3,4 @@
 Cross-Origin-Embedder-Policy: require-corp
 Cross-Origin-Embedder-Policy-Report-Only: require-corp
 Referrer-Policy: origin
-report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}
+report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-from-unsafe-none.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-from-unsafe-none.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-from-unsafe-none.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,5 +1,5 @@
 
-FAIL coop reporting test Report only tests for an opener without any COOP/COOP report only set to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-popup-report-only-endpoint, expected report: {\"body\":{\"disposition\":\"reporting\",\"effectivePolicy\":\"same-origin\",\"previousResponseURL\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-from-unsafe-none.https.html\",\"referrer\":\"https://localhost:9443/\",\"type\":\"navigation-to-response\"},\"url\":\"/uuid=(uuid)$/\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test Report only tests for an opener without any COOP/COOP report only set to CROSS_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-popup-report-only-endpoint, expected report: {\"body\":{\"disposition\":\"reporting\",\"effectivePolicy\":\"same-origin\",\"previousResponseURL\":\"\",\"referrer\":\"https://localhost:9443/\",\"type\":\"navigation-to-response\"},\"url\":\"/uuid=(uuid)$/\",\"type\":\"coop\"}, within available reports: []"
+PASS coop reporting test Report only tests for an opener without any COOP/COOP report only set to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",
+PASS coop reporting test Report only tests for an opener without any COOP/COOP report only set to CROSS_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",
 PASS verify remaining reports
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,6 +1,6 @@
 
-FAIL coop reporting test reporting same origin with report-to to CROSS_ORIGIN with , , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-only-endpoint, expected report: {\"body\":{\"disposition\":\"reporting\",\"effectivePolicy\":\"same-origin\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to CROSS_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-only-endpoint, expected report: {\"body\":{\"disposition\":\"reporting\",\"effectivePolicy\":\"same-origin\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
+PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with , , ,
+PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",
 PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",
 PASS verify remaining reports
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https.html.sub.headers (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https.html.sub.headers	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https.html.sub.headers	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,3 +1,3 @@
 Cross-Origin-Opener-Policy-Report-Only: same-origin; report-to="coop-report-only-endpoint"
 Referrer-Policy: origin
-report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}
+report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,5 +1,5 @@
 
-FAIL coop reporting test reporting same origin with report-to to SAME_ORIGIN with , require-corp, same-origin; report-to="coop-popup-report-only-endpoint",  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-popup-report-only-endpoint, expected report: {\"body\":{\"disposition\":\"reporting\",\"effectivePolicy\":\"same-origin-plus-coep\",\"previousResponseURL\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin.https.html\",\"referrer\":\"https://localhost:9443/\",\"type\":\"navigation-to-response\"},\"url\":\"/uuid=(uuid)$/\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint", require-corp promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-popup-report-only-endpoint, expected report: {\"body\":{\"disposition\":\"reporting\",\"effectivePolicy\":\"same-origin-plus-coep\",\"previousResponseURL\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin.https.html\",\"referrer\":\"https://localhost:9443/\",\"type\":\"navigation-to-response\"},\"url\":\"/uuid=(uuid)$/\",\"type\":\"coop\"}, within available reports: []"
+PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with , require-corp, same-origin; report-to="coop-popup-report-only-endpoint",
+PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint", require-corp
 PASS verify remaining reports
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-opener.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-opener.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-opener.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,6 +1,3 @@
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: cancelled
 
-Harness Error (TIMEOUT), message = null
+PASS navigation-report-from-opener-navigation
 
-TIMEOUT navigation-report-from-opener-navigation Test timed out
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-popup.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-popup.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-popup.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,4 +1,4 @@
 
-FAIL Open a popup to a document without COOP, then navigate it to a document with promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-popup-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"unsafe-none\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"/uuid=(uuid)$/\",\"type\":\"coop\"}, within available reports: []"
+PASS Open a popup to a document without COOP, then navigate it to a document with
 PASS verify remaining reports
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,6 +1,6 @@
 
-FAIL coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin-allow-popups\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin-allow-popups; report-to="coop-popup-report-endpoint", require-corp, ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin-allow-popups\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin, require-corp, ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin-allow-popups\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
+PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
+PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin-allow-popups; report-to="coop-popup-report-endpoint", require-corp, ,
+PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin, require-corp, ,
 PASS verify remaining reports
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https.html.sub.headers (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https.html.sub.headers	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https.html.sub.headers	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,3 +1,3 @@
-report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}
+report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}
 Cross-Origin-Opener-Policy: same-origin-allow-popups; report-to="coop-report-endpoint"
 Referrer-Policy: origin

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,9 +1,9 @@
 >
 
 PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", require-corp, ,
-FAIL coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin-plus-coep\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", require-corp, ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin-plus-coep\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint", require-corp promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin-plus-coep\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to CROSS_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint", require-corp promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin-plus-coep\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
+PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
+PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", require-corp, ,
+PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint", require-corp
+PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint", require-corp
 PASS verify remaining reports
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https.html.sub.headers (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https.html.sub.headers	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https.html.sub.headers	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,4 +1,4 @@
-report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}
+report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}
 Cross-Origin-Opener-Policy: same-origin; report-to="coop-report-endpoint"
 Cross-Origin-Embedder-Policy: require-corp
 Referrer-Policy: origin

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,9 +1,9 @@
 
 PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
-FAIL coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to SAME_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", require-corp, ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to CROSS_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to SAME_ORIGIN with unsafe-none, , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
+PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
+PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,
+PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", require-corp, ,
+PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,
+PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with unsafe-none, , ,
 PASS verify remaining reports
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html.sub.headers (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html.sub.headers	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html.sub.headers	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,3 +1,3 @@
-report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}
+report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}
 Cross-Origin-Opener-Policy: same-origin; report-to="coop-report-endpoint"
 Referrer-Policy: no-referrer

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,7 +1,7 @@
 
-FAIL coop reporting test reporting same origin to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-popup-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"same-origin\",\"previousResponseURL\":\"\",\"referrer\":\"https://localhost:9443/\",\"type\":\"navigation-to-response\"},\"url\":\"/uuid=(uuid)$/\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin to SAME_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-popup-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"unsafe-none\",\"previousResponseURL\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https.html\",\"referrer\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https.html\",\"type\":\"navigation-to-response\"},\"url\":\"/uuid=(uuid)$/\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin to CROSS_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-popup-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"previousResponseURL\":\"\",\"referrer\":\"https://localhost:9443/\",\"type\":\"navigation-to-response\"},\"url\":\"/uuid=(uuid)$/\",\"type\":\"coop\"}, within available reports: []"
+PASS coop reporting test reporting same origin to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
+PASS coop reporting test reporting same origin to SAME_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,
+PASS coop reporting test reporting same origin to CROSS_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,
 PASS coop reporting test reporting same origin to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",
 PASS verify remaining reports
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,6 +1,6 @@
 
-FAIL coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"unsafe-none\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin, , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"unsafe-none\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
-FAIL coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,  promise_test: Unhandled rejection with value: "No report matched the expected report for endpoint: coop-report-endpoint, expected report: {\"body\":{\"disposition\":\"enforce\",\"effectivePolicy\":\"unsafe-none\",\"nextResponseURL\":\"/uuid=(uuid)$/\",\"type\":\"navigation-from-response\"},\"url\":\"https://localhost:9443/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html\",\"type\":\"coop\"}, within available reports: []"
+PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
+PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin, , ,
+PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
 PASS verify remaining reports
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html.sub.headers (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html.sub.headers	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html.sub.headers	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,2 +1,2 @@
-report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}
+report-to: { "group": "coop-report-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-endpoint" }] }, { "group": "coop-report-only-endpoint", "max_age": 10886400, "endpoints": [{ "url": "/reporting/resources/report.py?endpoint=coop-report-only-endpoint" }]}
 Cross-Origin-Opener-Policy: unsafe-none; report-to="coop-report-endpoint"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-redirect-with-same-origin-allow-popups.https-expected.txt (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-redirect-with-same-origin-allow-popups.https-expected.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-redirect-with-same-origin-allow-popups.https-expected.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,6 +1,4 @@
 
-Harness Error (TIMEOUT), message = null
+PASS Same origin openee redirected to same-origin with same-origin-allow-popups
+PASS Cross origin openee redirected to same-origin with same-origin-allow-popups
 
-TIMEOUT Same origin openee redirected to same-origin with same-origin-allow-popups Test timed out
-NOTRUN Cross origin openee redirected to same-origin with same-origin-allow-popups
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/resources/reporting-common.js (282304 => 282305)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/resources/reporting-common.js	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/resources/reporting-common.js	2021-09-11 02:51:32 UTC (rev 282305)
@@ -72,6 +72,7 @@
             expectedReport.report)){
           expectedReport.endpoint.reports.splice(j,1);
           resolve();
+          return;
         }
       };
       await wait(waitTime);

Modified: trunk/Source/WebCore/ChangeLog (282304 => 282305)


--- trunk/Source/WebCore/ChangeLog	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/ChangeLog	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,3 +1,58 @@
+2021-09-10  Chris Dumez  <cdu...@apple.com>
+
+        Implement navigation reporting for Cross-Origin-Opener-Policy
+        https://bugs.webkit.org/show_bug.cgi?id=230046
+
+        Reviewed by Alex Christensen.
+
+        Implement navigation reporting for Cross-Origin-Opener-Policy as per:
+        - https://html.spec.whatwg.org/multipage/origin.html#coop-violation-navigation-to
+        - https://html.spec.whatwg.org/multipage/origin.html#coop-violation-navigation-from
+
+        With support for the Report-To HTTP header as documented here:
+        - https://www.w3.org/TR/reporting/#header
+
+        When adopting Cross-Origin-Opener-Policy or Cross-Origin-Opener-Policy-Report-Only HTTP headers,
+        developers can now specify a `report-to` directive with the name of the endpoint to report
+        COOP violations to. The mapping from endpoint name to URL is provided via teh Report-To HTTP
+        header, as is expected by the WPT tests.
+
+        No new tests, unskipped and rebaselined existing tests.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/CrossOriginOpenerPolicy.cpp:
+        (WebCore::sanitizeReferrerForURLReport):
+        (WebCore::crossOriginOpenerPolicyValueToString):
+        (WebCore::sendCOOPViolationReport):
+        (WebCore::sendViolationReportWhenNavigatingToCOOPResponse):
+        (WebCore::sendViolationReportWhenNavigatingAwayFromCOOPResponse):
+        * loader/CrossOriginOpenerPolicy.h:
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::willSendRequest):
+        (WebCore::checkIfEnforcingReportOnlyCOOPWouldRequireBrowsingContextGroupSwitch):
+        (WebCore::DocumentLoader::enforceResponseCrossOriginOpenerPolicy):
+        (WebCore::DocumentLoader::responseReceived):
+        * loader/PingLoader.cpp:
+        (WebCore::PingLoader::sendViolationReport):
+        (WebCore::PingLoader::startPingLoad):
+        * loader/PingLoader.h:
+        * loader/ReportingEndpointsCache.cpp: Added.
+        (WebCore::ReportingEndpointsCache::singleton):
+        (WebCore::ReportingEndpointsCache::addEndPointsFromResponse):
+        (WebCore::ReportingEndpointsCache::addEndpointFromDictionary):
+        (WebCore::ReportingEndpointsCache::endpointURL const):
+        (WebCore::ReportingEndpointsCache::EndPoint::EndPoint):
+        (WebCore::ReportingEndpointsCache::EndPoint::hasExpired const):
+        * loader/ReportingEndpointsCache.h: Added.
+        * loader/ResourceLoaderOptions.h:
+        (WebCore::ResourceLoaderOptions::shouldOmitUserAgent):
+        (WebCore::ResourceLoaderOptions::ResourceLoaderOptions):
+        * loader/WorkerThreadableLoader.cpp:
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
+        * platform/network/HTTPHeaderNames.in:
+
 2021-09-10  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Start teaching WidthIterator about character clusters

Modified: trunk/Source/WebCore/Headers.cmake (282304 => 282305)


--- trunk/Source/WebCore/Headers.cmake	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/Headers.cmake	2021-09-11 02:51:32 UTC (rev 282305)
@@ -831,6 +831,7 @@
     loader/PrivateClickMeasurement.h
     loader/ProgressTracker.h
     loader/ProgressTrackerClient.h
+    loader/ReportingEndpointsCache.h
     loader/ResourceCryptographicDigest.h
     loader/ResourceLoadInfo.h
     loader/ResourceLoadNotifier.h

Modified: trunk/Source/WebCore/Sources.txt (282304 => 282305)


--- trunk/Source/WebCore/Sources.txt	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/Sources.txt	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1542,6 +1542,7 @@
 loader/PingLoader.cpp
 loader/PolicyChecker.cpp
 loader/ProgressTracker.cpp
+loader/ReportingEndpointsCache.cpp
 loader/ResourceCryptographicDigest.cpp
 loader/ResourceLoadInfo.cpp
 loader/ResourceLoadNotifier.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (282304 => 282305)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1325,6 +1325,7 @@
 		46CA9C441F97BBE9004CFC3A /* VisibilityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 46CA9C411F97BBE7004CFC3A /* VisibilityState.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46D0004026A0FEB300D1BF1E /* SubmitEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 46D0003E26A0FE6F00D1BF1E /* SubmitEvent.h */; };
 		46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		46DD6E1F26E7DBE7008C1F4C /* ReportingEndpointsCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DD6E1C26E7DBE6008C1F4C /* ReportingEndpointsCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46DD93D7269DE756001AFD88 /* BroadcastChannelIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DD93D5269DE74B001AFD88 /* BroadcastChannelIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46DE9BB5269DF93E0024C5A6 /* BroadcastChannelRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DE9BB4269DF9320024C5A6 /* BroadcastChannelRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46DFF4981DC2603100B80B48 /* ShadowRootMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DFF4961DC2601300B80B48 /* ShadowRootMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8423,6 +8424,8 @@
 		46D0003E26A0FE6F00D1BF1E /* SubmitEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubmitEvent.h; sourceTree = "<group>"; };
 		46D0003F26A0FE7000D1BF1E /* SubmitEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SubmitEvent.idl; sourceTree = "<group>"; };
 		46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PowerObserverMac.h; sourceTree = "<group>"; };
+		46DD6E1C26E7DBE6008C1F4C /* ReportingEndpointsCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReportingEndpointsCache.h; sourceTree = "<group>"; };
+		46DD6E1E26E7DBE7008C1F4C /* ReportingEndpointsCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReportingEndpointsCache.cpp; sourceTree = "<group>"; };
 		46DD93D5269DE74B001AFD88 /* BroadcastChannelIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BroadcastChannelIdentifier.h; sourceTree = "<group>"; };
 		46DE9BB4269DF9320024C5A6 /* BroadcastChannelRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BroadcastChannelRegistry.h; sourceTree = "<group>"; };
 		46DFF4961DC2601300B80B48 /* ShadowRootMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowRootMode.h; sourceTree = "<group>"; };
@@ -27567,6 +27570,8 @@
 				1A2A68210B5BEDE70002A480 /* ProgressTracker.cpp */,
 				1A2A68220B5BEDE70002A480 /* ProgressTracker.h */,
 				1ACADD781880D91C00D8B71D /* ProgressTrackerClient.h */,
+				46DD6E1E26E7DBE7008C1F4C /* ReportingEndpointsCache.cpp */,
+				46DD6E1C26E7DBE6008C1F4C /* ReportingEndpointsCache.h */,
 				7C2FA60F1EA95A3200A03108 /* ResourceCryptographicDigest.cpp */,
 				7C2FA6101EA95A3200A03108 /* ResourceCryptographicDigest.h */,
 				93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */,
@@ -34487,6 +34492,7 @@
 				A89CCC530F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.h in Headers */,
 				2DF512CE1D873E47001D6780 /* ReplaceRangeWithTextCommand.h in Headers */,
 				93309E0A099E64920056E581 /* ReplaceSelectionCommand.h in Headers */,
+				46DD6E1F26E7DBE7008C1F4C /* ReportingEndpointsCache.h in Headers */,
 				4998AEC613F9D0EA0090B1AA /* RequestAnimationFrameCallback.h in Headers */,
 				F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */,
 				58B2F9F42232D45300938D63 /* ResizeObservation.h in Headers */,

Modified: trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.cpp (282304 => 282305)


--- trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -29,13 +29,25 @@
 #include "CrossOriginEmbedderPolicy.h"
 #include "HTTPHeaderNames.h"
 #include "HTTPParsers.h"
+#include "PingLoader.h"
+#include "ReportingEndpointsCache.h"
 #include "ResourceResponse.h"
 #include "ScriptExecutionContext.h"
+#include <wtf/JSONValues.h>
 
 namespace WebCore {
 
-static String crossOriginOpenerPolicyToString(const CrossOriginOpenerPolicyValue& coop)
+// https://html.spec.whatwg.org/multipage/origin.html#sanitize-url-report
+static String sanitizeReferrerForURLReport(const URL& referrer)
 {
+    URL sanitizedReferrer = referrer;
+    sanitizedReferrer.removeCredentials();
+    sanitizedReferrer.removeFragmentIdentifier();
+    return sanitizedReferrer.string();
+}
+
+static ASCIILiteral crossOriginOpenerPolicyToString(const CrossOriginOpenerPolicyValue& coop)
+{
     switch (coop) {
     case CrossOriginOpenerPolicyValue::SameOrigin:
     case CrossOriginOpenerPolicyValue::SameOriginPlusCOEP:
@@ -48,6 +60,21 @@
     return "unsafe-none"_s;
 }
 
+static ASCIILiteral crossOriginOpenerPolicyValueToEffectivePolicyString(CrossOriginOpenerPolicyValue coop)
+{
+    switch (coop) {
+    case CrossOriginOpenerPolicyValue::SameOriginAllowPopups:
+        return "same-origin-allow-popups"_s;
+    case CrossOriginOpenerPolicyValue::SameOrigin:
+        return "same-origin"_s;
+    case CrossOriginOpenerPolicyValue::SameOriginPlusCOEP:
+        return "same-origin-plus-coep"_s;
+    case CrossOriginOpenerPolicyValue::UnsafeNone:
+        break;
+    }
+    return "unsafe-none"_s;
+}
+
 // https://html.spec.whatwg.org/multipage/origin.html#obtain-coop
 CrossOriginOpenerPolicy obtainCrossOriginOpenerPolicy(const ResourceResponse& response, const ScriptExecutionContext& context)
 {
@@ -109,4 +136,56 @@
     }
 }
 
+// https://www.w3.org/TR/reporting/#try-delivery
+static void sendCOOPViolationReport(Frame& frame, CrossOriginOpenerPolicy coop, COOPDisposition disposition, const URL& coopURL, const SecurityOrigin& coopOrigin, const String& userAgent, Function<void(JSON::Object&)>&& populateBody)
+{
+    auto& reportingEndpoint = disposition == COOPDisposition::Reporting ? coop.reportOnlyReportingEndpoint : coop.reportingEndpoint;
+    if (reportingEndpoint.isEmpty())
+        return;
+
+    auto reportingEndpointsCache = frame.page() ? frame.page()->reportingEndpointsCache() : nullptr;
+    if (!reportingEndpointsCache)
+        return;
+    auto endpointURL = reportingEndpointsCache->endpointURL(coopOrigin.data(), reportingEndpoint);
+    if (!endpointURL.isValid())
+        return;
+
+    auto body = JSON::Object::create();
+    body->setString("disposition"_s, disposition == COOPDisposition::Reporting ? "reporting"_s : "enforce"_s);
+    body->setString("effectivePolicy"_s, crossOriginOpenerPolicyValueToEffectivePolicyString(disposition == COOPDisposition::Reporting ? coop.reportOnlyValue : coop.value));
+    populateBody(body);
+
+    auto reportObject = JSON::Object::create();
+    reportObject->setString("type"_s, "coop"_s);
+    reportObject->setString("url"_s, coopURL.string());
+    reportObject->setString("user_agent", userAgent);
+    reportObject->setInteger("age", 0); // We currently do not delay sending the reports.
+    reportObject->setObject("body"_s, WTFMove(body));
+
+    auto reportList = JSON::Array::create();
+    reportList->pushObject(reportObject);
+
+    auto report = FormData::create(reportList->toJSONString().utf8());
+    PingLoader::sendViolationReport(frame, endpointURL, WTFMove(report), ViolationReportType::StandardReportingAPIViolation);
+}
+
+// https://html.spec.whatwg.org/multipage/origin.html#coop-violation-navigation-to
+void sendViolationReportWhenNavigatingToCOOPResponse(Frame& frame, CrossOriginOpenerPolicy coop, COOPDisposition disposition, const URL& coopURL, const URL& previousResponseURL, const SecurityOrigin& coopOrigin, const SecurityOrigin& previousResponseOrigin, const String& referrer, const String& userAgent)
+{
+    sendCOOPViolationReport(frame, coop, disposition, coopURL, coopOrigin, userAgent, [&](auto& body) {
+        body.setString("previousResponseURL"_s, coopOrigin.isSameOriginAs(previousResponseOrigin) ? sanitizeReferrerForURLReport(previousResponseURL) : String());
+        body.setString("type"_s, "navigation-to-response"_s);
+        body.setString("referrer"_s, referrer);
+    });
+}
+
+// https://html.spec.whatwg.org/multipage/origin.html#coop-violation-navigation-from
+void sendViolationReportWhenNavigatingAwayFromCOOPResponse(Frame& frame, CrossOriginOpenerPolicy coop, COOPDisposition disposition, const URL& coopURL, const URL& nextResponseURL, const SecurityOrigin& coopOrigin, const SecurityOrigin& nextResponseOrigin, bool isCOOPResponseNavigationSource, const String& userAgent)
+{
+    sendCOOPViolationReport(frame, coop, disposition, coopURL, coopOrigin, userAgent, [&](auto& body) {
+        body.setString("nextResponseURL"_s, coopOrigin.isSameOriginAs(nextResponseOrigin) || isCOOPResponseNavigationSource ? sanitizeReferrerForURLReport(nextResponseURL) : String());
+        body.setString("type"_s, "navigation-from-response"_s);
+    });
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.h (282304 => 282305)


--- trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.h	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.h	2021-09-11 02:51:32 UTC (rev 282305)
@@ -106,8 +106,12 @@
     bool isCurrentContextNavigationSource { true };
 };
 
+enum class COOPDisposition : bool { Reporting , Enforce };
+
 CrossOriginOpenerPolicy obtainCrossOriginOpenerPolicy(const ResourceResponse&, const ScriptExecutionContext&);
 WEBCORE_EXPORT void addCrossOriginOpenerPolicyHeaders(ResourceResponse&, const CrossOriginOpenerPolicy&);
+void sendViolationReportWhenNavigatingToCOOPResponse(Frame&, CrossOriginOpenerPolicy, COOPDisposition, const URL& coopURL, const URL& previousResponseURL, const SecurityOrigin& coopOrigin, const SecurityOrigin& previousResponseOrigin, const String& referrer, const String& userAgent);
+void sendViolationReportWhenNavigatingAwayFromCOOPResponse(Frame&, CrossOriginOpenerPolicy, COOPDisposition, const URL& coopURL, const URL& nextResponseURL, const SecurityOrigin& coopOrigin, const SecurityOrigin& nextResponseOrigin, bool isCOOPResponseNavigationSource, const String& userAgent);
 
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (282304 => 282305)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -79,6 +79,7 @@
 #include "PolicyChecker.h"
 #include "ProgressTracker.h"
 #include "Quirks.h"
+#include "ReportingEndpointsCache.h"
 #include "ResourceHandle.h"
 #include "ResourceLoadObserver.h"
 #include "RuntimeEnabledFeatures.h"
@@ -632,6 +633,11 @@
         DOCUMENTLOADER_RELEASE_LOG("willSendRequest: With no provisional document loader");
 
     bool didReceiveRedirectResponse = !redirectResponse.isNull();
+    if (didReceiveRedirectResponse && m_frame->isMainFrame()) {
+        if (auto reportingEndpointsCache = m_frame->page() ? m_frame->page()->reportingEndpointsCache() : nullptr)
+            reportingEndpointsCache->addEndPointsFromResponse(redirectResponse);
+    }
+
     if (!frameLoader()->checkIfFormActionAllowedByCSP(newRequest.url(), didReceiveRedirectResponse)) {
         DOCUMENTLOADER_RELEASE_LOG("willSendRequest: canceling - form action not allowed by CSP");
         cancelMainResourceLoad(frameLoader()->cancelledError(newRequest));
@@ -759,6 +765,21 @@
     return true;
 }
 
+// https://html.spec.whatwg.org/multipage/origin.html#check-bcg-switch-navigation-report-only
+static bool checkIfEnforcingReportOnlyCOOPWouldRequireBrowsingContextGroupSwitch(bool isInitialAboutBlank, const CrossOriginOpenerPolicy& activeDocumentCOOP, const SecurityOrigin& activeDocumentNavigationOrigin, const CrossOriginOpenerPolicy& responseCOOP, const SecurityOrigin& responseOrigin)
+{
+    if (!checkIfCOOPValuesRequireBrowsingContextGroupSwitch(isInitialAboutBlank, activeDocumentCOOP.reportOnlyValue, activeDocumentNavigationOrigin, responseCOOP.reportOnlyValue, responseOrigin))
+        return false;
+
+    if (checkIfCOOPValuesRequireBrowsingContextGroupSwitch(isInitialAboutBlank, activeDocumentCOOP.reportOnlyValue, activeDocumentNavigationOrigin, responseCOOP.value, responseOrigin))
+        return true;
+
+    if (checkIfCOOPValuesRequireBrowsingContextGroupSwitch(isInitialAboutBlank, activeDocumentCOOP.value, activeDocumentNavigationOrigin, responseCOOP.reportOnlyValue, responseOrigin))
+        return true;
+
+    return false;
+}
+
 static std::tuple<Ref<SecurityOrigin>, CrossOriginOpenerPolicy> computeResponseOriginAndCOOP(const ResourceResponse& response, const Document& document, const std::optional<NavigationAction::Requester>& requester, ContentSecurityPolicy* responseCSP)
 {
     // Non-initial empty documents (about:blank) should inherit their cross-origin-opener-policy from the navigation's initiator top level document,
@@ -813,6 +834,12 @@
             m_frame->document()->crossOriginOpenerPolicy(),
             currentContextIsSource,
         };
+        if (SecurityPolicy::shouldInheritSecurityOriginFromOwner(m_frame->document()->url())) {
+            if (auto openerFrame = m_frame->loader().opener()) {
+                if (auto openerDocument = openerFrame->document())
+                    m_currentCoopEnforcementResult->url = ""
+            }
+        }
     }
 
     CrossOriginOpenerPolicyEnforcementResult newCOOPEnforcementResult = {
@@ -824,9 +851,26 @@
         true
     };
 
-    if (checkIfCOOPValuesRequireBrowsingContextGroupSwitch(frameLoader()->stateMachine().isDisplayingInitialEmptyDocument(), m_currentCoopEnforcementResult->crossOriginOpenerPolicy.value, m_currentCoopEnforcementResult->currentOrigin, responseCOOP.value, responseOrigin))
+    if (checkIfCOOPValuesRequireBrowsingContextGroupSwitch(frameLoader()->stateMachine().isDisplayingInitialEmptyDocument(), m_currentCoopEnforcementResult->crossOriginOpenerPolicy.value, m_currentCoopEnforcementResult->currentOrigin, responseCOOP.value, responseOrigin)) {
         newCOOPEnforcementResult.needsBrowsingContextGroupSwitch = true;
 
+        // FIXME: Add the concept of browsing context group like in the specification instead of treating the whole process as a group.
+        if (Page::nonUtilityPageCount() > 1) {
+            sendViolationReportWhenNavigatingToCOOPResponse(*m_frame, responseCOOP, COOPDisposition::Enforce, responseURL, m_currentCoopEnforcementResult->url, responseOrigin, m_currentCoopEnforcementResult->currentOrigin, m_request.httpReferrer(), m_request.httpUserAgent());
+            sendViolationReportWhenNavigatingAwayFromCOOPResponse(*m_frame, m_currentCoopEnforcementResult->crossOriginOpenerPolicy, COOPDisposition::Enforce, m_currentCoopEnforcementResult->url, responseURL, m_currentCoopEnforcementResult->currentOrigin, responseOrigin, m_currentCoopEnforcementResult->isCurrentContextNavigationSource, m_request.httpUserAgent());
+        }
+    }
+
+    if (checkIfEnforcingReportOnlyCOOPWouldRequireBrowsingContextGroupSwitch(frameLoader()->stateMachine().isDisplayingInitialEmptyDocument(), m_currentCoopEnforcementResult->crossOriginOpenerPolicy, m_currentCoopEnforcementResult->currentOrigin, responseCOOP, responseOrigin)) {
+        newCOOPEnforcementResult.needsBrowsingContextGroupSwitchDueToReportOnly = true;
+
+        // FIXME: Add the concept of browsing context group like in the specification instead of treating the whole process as a group.
+        if (Page::nonUtilityPageCount() > 1) {
+            sendViolationReportWhenNavigatingToCOOPResponse(*m_frame, responseCOOP, COOPDisposition::Reporting, responseURL, m_currentCoopEnforcementResult->url, responseOrigin, m_currentCoopEnforcementResult->currentOrigin, m_request.httpReferrer(), m_request.httpUserAgent());
+            sendViolationReportWhenNavigatingAwayFromCOOPResponse(*m_frame, m_currentCoopEnforcementResult->crossOriginOpenerPolicy, COOPDisposition::Reporting, m_currentCoopEnforcementResult->url, responseURL, m_currentCoopEnforcementResult->currentOrigin, responseOrigin, m_currentCoopEnforcementResult->isCurrentContextNavigationSource, m_request.httpUserAgent());
+        }
+    }
+
     return newCOOPEnforcementResult;
 }
 
@@ -987,6 +1031,11 @@
     if (willLoadFallback)
         return;
 
+    if (m_frame->isMainFrame()) {
+        if (auto reportingEndpointsCache = m_frame->page() ? m_frame->page()->reportingEndpointsCache() : nullptr)
+            reportingEndpointsCache->addEndPointsFromResponse(response);
+    }
+
     ASSERT(m_identifierForLoadWithoutResourceLoader || m_mainResource);
     unsigned long identifier = m_identifierForLoadWithoutResourceLoader ? m_identifierForLoadWithoutResourceLoader : m_mainResource->identifier();
     ASSERT(identifier);

Modified: trunk/Source/WebCore/loader/PingLoader.cpp (282304 => 282305)


--- trunk/Source/WebCore/loader/PingLoader.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/loader/PingLoader.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -174,6 +174,9 @@
     case ViolationReportType::XSSAuditor:
         request.setHTTPContentType("application/json"_s);
         break;
+    case ViolationReportType::StandardReportingAPIViolation:
+        request.setHTTPContentType("application/reports+json"_s);
+        break;
     }
 
     bool removeCookies = true;
@@ -184,16 +187,17 @@
 
     HTTPHeaderMap originalRequestHeader = request.httpHeaderFields();
 
-    frame.loader().updateRequestAndAddExtraFields(request, IsMainResource::No);
+    if (reportType != ViolationReportType::StandardReportingAPIViolation)
+        frame.loader().updateRequestAndAddExtraFields(request, IsMainResource::No);
 
     String referrer = SecurityPolicy::generateReferrerHeader(document.referrerPolicy(), reportURL, frame.loader().outgoingReferrer());
     if (!referrer.isEmpty())
         request.setHTTPReferrer(referrer);
 
-    startPingLoad(frame, request, WTFMove(originalRequestHeader), ShouldFollowRedirects::No, ContentSecurityPolicyImposition::SkipPolicyCheck, ReferrerPolicy::EmptyString);
+    startPingLoad(frame, request, WTFMove(originalRequestHeader), ShouldFollowRedirects::No, ContentSecurityPolicyImposition::SkipPolicyCheck, ReferrerPolicy::EmptyString, reportType);
 }
 
-void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request, HTTPHeaderMap&& originalRequestHeaders, ShouldFollowRedirects shouldFollowRedirects, ContentSecurityPolicyImposition policyCheck, ReferrerPolicy referrerPolicy)
+void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request, HTTPHeaderMap&& originalRequestHeaders, ShouldFollowRedirects shouldFollowRedirects, ContentSecurityPolicyImposition policyCheck, ReferrerPolicy referrerPolicy, std::optional<ViolationReportType> violationReportType)
 {
     unsigned long identifier = frame.page()->progress().createUniqueIdentifier();
     // FIXME: Why activeDocumentLoader? I would have expected documentLoader().
@@ -211,6 +215,14 @@
     options.sendLoadCallbacks = SendCallbackPolicy::SendCallbacks;
     options.cache = FetchOptions::Cache::NoCache;
 
+    // https://www.w3.org/TR/reporting/#try-delivery
+    if (violationReportType == ViolationReportType::StandardReportingAPIViolation) {
+        options.credentials = FetchOptions::Credentials::SameOrigin;
+        options.mode = FetchOptions::Mode::Cors;
+        options.serviceWorkersMode = ServiceWorkersMode::None;
+        options.destination = FetchOptions::Destination::Report;
+    }
+
     // FIXME: Deprecate the ping load code path.
     if (platformStrategies()->loaderStrategy()->usePingLoad()) {
         InspectorInstrumentation::willSendRequestOfType(&frame, identifier, frame.loader().activeDocumentLoader(), request, InspectorInstrumentation::LoadType::Ping);

Modified: trunk/Source/WebCore/loader/PingLoader.h (282304 => 282305)


--- trunk/Source/WebCore/loader/PingLoader.h	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/loader/PingLoader.h	2021-09-11 02:51:32 UTC (rev 282305)
@@ -43,9 +43,10 @@
 class HTTPHeaderMap;
 class ResourceRequest;
 
-enum class ViolationReportType {
+enum class ViolationReportType : uint8_t {
     ContentSecurityPolicy,
     XSSAuditor,
+    StandardReportingAPIViolation // https://www.w3.org/TR/reporting/#try-delivery
 };
 
 enum class ContentSecurityPolicyImposition : uint8_t;
@@ -58,7 +59,7 @@
 
 private:
     enum class ShouldFollowRedirects { No, Yes };
-    static void startPingLoad(Frame&, ResourceRequest&, HTTPHeaderMap&& originalRequestHeaders, ShouldFollowRedirects, ContentSecurityPolicyImposition, ReferrerPolicy);
+    static void startPingLoad(Frame&, ResourceRequest&, HTTPHeaderMap&& originalRequestHeaders, ShouldFollowRedirects, ContentSecurityPolicyImposition, ReferrerPolicy, std::optional<ViolationReportType> = std::nullopt);
 };
 
 } // namespace WebCore

Added: trunk/Source/WebCore/loader/ReportingEndpointsCache.cpp (0 => 282305)


--- trunk/Source/WebCore/loader/ReportingEndpointsCache.cpp	                        (rev 0)
+++ trunk/Source/WebCore/loader/ReportingEndpointsCache.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ReportingEndpointsCache.h"
+
+#include "HTTPHeaderNames.h"
+#include "ResourceResponse.h"
+#include "SecurityOrigin.h"
+#include <wtf/JSONValues.h>
+
+namespace WebCore {
+
+struct ReportingEndpointsCache::Endpoint {
+    Endpoint() = default;
+    Endpoint(URL&&, Seconds maxAge);
+
+    bool hasExpired() const;
+
+    URL url;
+    MonotonicTime addTime;
+    Seconds maxAge;
+};
+
+ReportingEndpointsCache::Endpoint::Endpoint(URL&& url, Seconds maxAge)
+    : url(WTFMove(url))
+    , addTime(MonotonicTime::now())
+    , maxAge(maxAge)
+{
+}
+
+bool ReportingEndpointsCache::Endpoint::hasExpired() const
+{
+    return MonotonicTime::now() - addTime > maxAge;
+}
+
+Ref<ReportingEndpointsCache> ReportingEndpointsCache::create()
+{
+    return adoptRef(*new ReportingEndpointsCache);
+}
+
+ReportingEndpointsCache::ReportingEndpointsCache() = default;
+ReportingEndpointsCache::~ReportingEndpointsCache() = default;
+
+// https://www.w3.org/TR/reporting/#process-header
+void ReportingEndpointsCache::addEndPointsFromResponse(const ResourceResponse& response)
+{
+    auto reportToHeaderValue = response.httpHeaderField(HTTPHeaderName::ReportTo);
+    if (reportToHeaderValue.isEmpty())
+        return;
+
+    auto securityOrigin = SecurityOrigin::create(response.url());
+    if (securityOrigin->isUnique() || !securityOrigin->isPotentiallyTrustworthy())
+        return;
+
+    auto findNextTopLevelComma = [&reportToHeaderValue](size_t startIndex) {
+        unsigned depth = 0;
+        for (size_t i = startIndex; i < reportToHeaderValue.length(); ++i) {
+            auto c = reportToHeaderValue[i];
+            if (c == '{')
+                ++depth;
+            else if (c == '}') {
+                if (!depth)
+                    break;
+                --depth;
+            } else if (c == ',' && !depth)
+                return i;
+        }
+        return notFound;
+    };
+    size_t dictionaryStart = 0;
+    while (dictionaryStart < reportToHeaderValue.length()) {
+        auto indexOfNextTopLevelComma = findNextTopLevelComma(dictionaryStart);
+        if (indexOfNextTopLevelComma == notFound) {
+            addEndpointFromDictionary(securityOrigin->data(), response.url(), reportToHeaderValue.substring(dictionaryStart));
+            break;
+        }
+        addEndpointFromDictionary(securityOrigin->data(), response.url(), reportToHeaderValue.substring(dictionaryStart, indexOfNextTopLevelComma - dictionaryStart));
+        dictionaryStart = indexOfNextTopLevelComma + 1;
+    }
+}
+
+// https://www.w3.org/TR/reporting/#process-header
+void ReportingEndpointsCache::addEndpointFromDictionary(const SecurityOriginData& securityOrigin, const URL& responseURL, StringView dictionaryString)
+{
+    auto json = JSON::Value::parseJSON(dictionaryString.toStringWithoutCopying());
+    if (!json)
+        return;
+
+    auto jsonDictionary = json->asObject();
+    if (!jsonDictionary)
+        return;
+
+    auto group = jsonDictionary->getString("group"_s);
+    if (group.isEmpty())
+        group = "default"_s;
+
+    auto maxAge = jsonDictionary->getInteger("max_age");
+    if (!maxAge || *maxAge < 0)
+        return;
+
+    if (!*maxAge) {
+        // A value of 0 indicates we should remove the group from the cache.
+        auto it = m_endpointsPerOrigin.find(securityOrigin);
+        if (it == m_endpointsPerOrigin.end())
+            return;
+        it->value.remove(group);
+        if (it->value.isEmpty())
+            m_endpointsPerOrigin.remove(it);
+        return;
+    }
+
+    auto endpoints = jsonDictionary->getArray("endpoints"_s);
+    if (!endpoints || !endpoints->length())
+        return;
+
+    for (size_t i = 0; i < endpoints->length(); ++i) {
+        auto endpoint = endpoints->get(i)->asObject();
+        if (!endpoint)
+            continue;
+
+        auto endpointURLString = endpoint->getString("url"_s);
+        if (endpointURLString.isEmpty())
+            continue;
+
+        auto endpointURL = URL(responseURL, endpointURLString);
+        if (!endpointURL.isValid())
+            continue;
+
+        auto& endpointsForOrigin = m_endpointsPerOrigin.ensure(securityOrigin, [] {
+            return HashMap<String, Endpoint> { };
+        }).iterator->value;
+        endpointsForOrigin.add(WTFMove(group), Endpoint(WTFMove(endpointURL), Seconds { static_cast<double>(*maxAge) }));
+    }
+}
+
+URL ReportingEndpointsCache::endpointURL(const SecurityOriginData& origin, const String& group) const
+{
+    auto outerIterator = m_endpointsPerOrigin.find(origin);
+    if (outerIterator == m_endpointsPerOrigin.end())
+        return { };
+    auto& endpointsForOrigin = outerIterator->value;
+    auto innerIterator = endpointsForOrigin.find(group);
+    if (innerIterator == endpointsForOrigin.end())
+        return { };
+    if (innerIterator->value.hasExpired()) {
+        endpointsForOrigin.remove(innerIterator);
+        if (endpointsForOrigin.isEmpty())
+            m_endpointsPerOrigin.remove(outerIterator);
+        return { };
+    }
+    return innerIterator->value.url;
+}
+
+} // namespace WebCore

Added: trunk/Source/WebCore/loader/ReportingEndpointsCache.h (0 => 282305)


--- trunk/Source/WebCore/loader/ReportingEndpointsCache.h	                        (rev 0)
+++ trunk/Source/WebCore/loader/ReportingEndpointsCache.h	2021-09-11 02:51:32 UTC (rev 282305)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "SecurityOriginData.h"
+#include <wtf/HashMap.h>
+#include <wtf/MonotonicTime.h>
+#include <wtf/RefCounted.h>
+#include <wtf/URLHash.h>
+
+namespace WebCore {
+
+class ResourceResponse;
+
+// https://www.w3.org/TR/reporting/#concept-storage
+class ReportingEndpointsCache : public RefCounted<ReportingEndpointsCache> {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    WEBCORE_EXPORT static Ref<ReportingEndpointsCache> create();
+    WEBCORE_EXPORT ~ReportingEndpointsCache();
+
+    void addEndPointsFromResponse(const ResourceResponse&);
+    URL endpointURL(const SecurityOriginData&, const String& group) const;
+
+private:
+    ReportingEndpointsCache();
+    void addEndpointFromDictionary(const SecurityOriginData&, const URL& responseURL, StringView);
+
+    struct Endpoint;
+    mutable HashMap<SecurityOriginData, HashMap<String, Endpoint>> m_endpointsPerOrigin;
+};
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (282304 => 282305)


--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -45,6 +45,7 @@
 #include "ServiceWorker.h"
 #include "ServiceWorkerGlobalScope.h"
 #include "ThreadableLoader.h"
+#include "WorkerGlobalScope.h"
 #include "WorkerLoaderProxy.h"
 #include "WorkerOrWorkletGlobalScope.h"
 #include "WorkerThread.h"

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (282304 => 282305)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -358,7 +358,7 @@
 
 ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestPingResource(CachedResourceRequest&& request)
 {
-    ASSERT(request.options().destination == FetchOptions::Destination::EmptyString);
+    ASSERT(request.options().destination == FetchOptions::Destination::EmptyString || request.options().destination == FetchOptions::Destination::Report);
     return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::Type::Ping, WTFMove(request)));
 }
 

Modified: trunk/Source/WebCore/page/Page.cpp (282304 => 282305)


--- trunk/Source/WebCore/page/Page.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/page/Page.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -117,6 +117,7 @@
 #include "RenderView.h"
 #include "RenderWidget.h"
 #include "RenderingUpdateScheduler.h"
+#include "ReportingEndpointsCache.h"
 #include "ResizeObserver.h"
 #include "ResourceUsageOverlay.h"
 #include "RuntimeEnabledFeatures.h"
@@ -328,6 +329,7 @@
     , m_shouldRelaxThirdPartyCookieBlocking(pageConfiguration.shouldRelaxThirdPartyCookieBlocking)
     , m_httpsUpgradeEnabled(pageConfiguration.httpsUpgradeEnabled)
     , m_permissionController(WTFMove(pageConfiguration.permissionController))
+    , m_reportingEndpointsCache(WTFMove(pageConfiguration.reportingEndpointsCache))
     , m_storageProvider(WTFMove(pageConfiguration.storageProvider))
 {
     updateTimerThrottlingState();

Modified: trunk/Source/WebCore/page/Page.h (282304 => 282305)


--- trunk/Source/WebCore/page/Page.h	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/page/Page.h	2021-09-11 02:51:32 UTC (rev 282305)
@@ -139,6 +139,7 @@
 class PointerLockController;
 class ProgressTracker;
 class RenderObject;
+class ReportingEndpointsCache;
 class ResourceUsageOverlay;
 class RenderingUpdateScheduler;
 class ScrollLatchingController;
@@ -307,6 +308,8 @@
     void remoteInspectorInformationDidChange() const;
 #endif
 
+    ReportingEndpointsCache* reportingEndpointsCache() { return m_reportingEndpointsCache.get(); }
+
     Chrome& chrome() const { return *m_chrome; }
     DragCaretController& dragCaretController() const { return *m_dragCaretController; }
 #if ENABLE(DRAG_SUPPORT)
@@ -1200,6 +1203,7 @@
     mutable MediaSessionGroupIdentifier m_mediaSessionGroupIdentifier;
 
     Ref<PermissionController> m_permissionController;
+    RefPtr<ReportingEndpointsCache> m_reportingEndpointsCache;
     UniqueRef<StorageProvider> m_storageProvider;
 
 #if ENABLE(IMAGE_ANALYSIS)

Modified: trunk/Source/WebCore/page/PageConfiguration.cpp (282304 => 282305)


--- trunk/Source/WebCore/page/PageConfiguration.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/page/PageConfiguration.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -43,6 +43,7 @@
 #include "PermissionController.h"
 #include "PluginInfoProvider.h"
 #include "ProgressTrackerClient.h"
+#include "ReportingEndpointsCache.h"
 #include "SocketProvider.h"
 #include "SpeechRecognitionProvider.h"
 #include "SpeechSynthesisClient.h"

Modified: trunk/Source/WebCore/page/PageConfiguration.h (282304 => 282305)


--- trunk/Source/WebCore/page/PageConfiguration.h	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/page/PageConfiguration.h	2021-09-11 02:51:32 UTC (rev 282305)
@@ -62,6 +62,7 @@
 class PermissionController;
 class PluginInfoProvider;
 class ProgressTrackerClient;
+class ReportingEndpointsCache;
 class SocketProvider;
 class SpeechRecognitionProvider;
 class StorageNamespaceProvider;
@@ -133,6 +134,7 @@
     Vector<UserContentURLPattern> corsDisablingPatterns;
     UniqueRef<SpeechRecognitionProvider> speechRecognitionProvider;
     UniqueRef<MediaRecorderProvider> mediaRecorderProvider;
+    RefPtr<ReportingEndpointsCache> reportingEndpointsCache;
 
     // FIXME: These should be all be Settings.
     bool loadsSubresources { true };

Modified: trunk/Source/WebCore/platform/network/HTTPHeaderNames.in (282304 => 282305)


--- trunk/Source/WebCore/platform/network/HTTPHeaderNames.in	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderNames.in	2021-09-11 02:51:32 UTC (rev 282305)
@@ -83,6 +83,7 @@
 Referer
 Referrer-Policy
 Refresh
+Report-To
 Sec-WebSocket-Accept
 Sec-WebSocket-Extensions
 Sec-WebSocket-Key

Modified: trunk/Source/WebKit/ChangeLog (282304 => 282305)


--- trunk/Source/WebKit/ChangeLog	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebKit/ChangeLog	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,3 +1,23 @@
+2021-09-10  Chris Dumez  <cdu...@apple.com>
+
+        Implement navigation reporting for Cross-Origin-Opener-Policy
+        https://bugs.webkit.org/show_bug.cgi?id=230046
+
+        Reviewed by Alex Christensen.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::didCleanupResourceLoader):
+        Now that we may abort expired loaders that are cached on the NetworkSession
+        (because awaiting transfer to another web process connection), we would hit
+        this assertion because the loader is not associated with this connection
+        anymore at the point it is adopted. For this reason, I silenced this
+        assertion.
+
+        * NetworkProcess/NetworkSession.cpp:
+        (WebKit::NetworkSession::CachedNetworkResourceLoader::expirationTimerFired):
+        Abort the loader before destroying it to avoid hitting an assertion in the
+        destructor (loaders cannot be loading at the point they are destroyed).
+
 2021-09-10  Stephan Szabo  <stephan.sz...@sony.com>
 
         [PlayStation] Support running applications with ENABLE_STATIC_JSC=ON

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (282304 => 282305)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -175,7 +175,6 @@
         return;
     }
 
-    ASSERT(m_networkResourceLoaders.get(loader.coreIdentifier()) == &loader);
     m_networkResourceLoaders.remove(loader.coreIdentifier());
 }
 

Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp (282304 => 282305)


--- trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -429,7 +429,9 @@
         return;
 
     auto loader = session->takeLoaderAwaitingWebProcessTransfer(m_loader->identifier());
-    ASSERT_UNUSED(loader, loader);
+    ASSERT(loader);
+    if (loader)
+        loader->abort();
 }
 
 void NetworkSession::addLoaderAwaitingWebProcessTransfer(Ref<NetworkResourceLoader>&& loader)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (282304 => 282305)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -231,6 +231,7 @@
 #include <WebCore/RenderTheme.h>
 #include <WebCore/RenderTreeAsText.h>
 #include <WebCore/RenderView.h>
+#include <WebCore/ReportingEndpointsCache.h>
 #include <WebCore/ResourceLoadStatistics.h>
 #include <WebCore/ResourceRequest.h>
 #include <WebCore/ResourceResponse.h>
@@ -604,6 +605,7 @@
     pageConfiguration.pluginInfoProvider = &WebPluginInfoProvider::singleton();
     pageConfiguration.storageNamespaceProvider = WebStorageNamespaceProvider::getOrCreate(*m_pageGroup);
     pageConfiguration.visitedLinkStore = VisitedLinkTableController::getOrCreate(parameters.visitedLinkTableID);
+    pageConfiguration.reportingEndpointsCache = &WebProcess::singleton().reportingEndpointsCache();
 
 #if ENABLE(APPLE_PAY)
     pageConfiguration.paymentCoordinatorClient = new WebPaymentCoordinator(*this);

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (282304 => 282305)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -126,6 +126,7 @@
 #include <WebCore/ProcessWarming.h>
 #include <WebCore/RegistrableDomain.h>
 #include <WebCore/RemoteCommandListener.h>
+#include <WebCore/ReportingEndpointsCache.h>
 #include <WebCore/ResourceLoadStatistics.h>
 #include <WebCore/RuntimeApplicationChecks.h>
 #include <WebCore/RuntimeEnabledFeatures.h>
@@ -274,6 +275,7 @@
     , m_cacheStorageProvider(WebCacheStorageProvider::create())
     , m_broadcastChannelRegistry(WebBroadcastChannelRegistry::create())
     , m_cookieJar(WebCookieJar::create())
+    , m_reportingEndpointsCache(ReportingEndpointsCache::create())
     , m_dnsPrefetchHystereris([this](PAL::HysteresisState state) { if (state == PAL::HysteresisState::Stopped) m_dnsPrefetchedHosts.clear(); })
 #if ENABLE(NETSCAPE_PLUGIN_API)
     , m_pluginProcessConnectionManager(PluginProcessConnectionManager::create())

Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (282304 => 282305)


--- trunk/Source/WebKit/WebProcess/WebProcess.h	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h	2021-09-11 02:51:32 UTC (rev 282305)
@@ -94,6 +94,7 @@
 class CertificateInfo;
 class PageGroup;
 class RegistrableDomain;
+class ReportingEndpointsCache;
 class ResourceRequest;
 class UserGestureToken;
 
@@ -340,6 +341,7 @@
     WebBroadcastChannelRegistry& broadcastChannelRegistry() { return m_broadcastChannelRegistry.get(); }
     WebCookieJar& cookieJar() { return m_cookieJar.get(); }
     WebSocketChannelManager& webSocketChannelManager() { return m_webSocketChannelManager; }
+    WebCore::ReportingEndpointsCache& reportingEndpointsCache() { return m_reportingEndpointsCache.get(); }
 
 #if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
     float backlightLevel() const { return m_backlightLevel; }
@@ -662,6 +664,7 @@
     Ref<WebCacheStorageProvider> m_cacheStorageProvider;
     Ref<WebBroadcastChannelRegistry> m_broadcastChannelRegistry;
     Ref<WebCookieJar> m_cookieJar;
+    Ref<WebCore::ReportingEndpointsCache> m_reportingEndpointsCache;
     WebSocketChannelManager m_webSocketChannelManager;
 
     std::unique_ptr<LibWebRTCNetwork> m_libWebRTCNetwork;

Modified: trunk/Tools/ChangeLog (282304 => 282305)


--- trunk/Tools/ChangeLog	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Tools/ChangeLog	2021-09-11 02:51:32 UTC (rev 282305)
@@ -1,3 +1,23 @@
+2021-09-10  Chris Dumez  <cdu...@apple.com>
+
+        Implement navigation reporting for Cross-Origin-Opener-Policy
+        https://bugs.webkit.org/show_bug.cgi?id=230046
+
+        Reviewed by Alex Christensen.
+
+        Fix issue where [DumpJSConsoleLogInStdErr] was not working for tests that process-swap
+        due to COOP. Some data members on InjectedBundle such as m_dumpJSConsoleLogInStdErr
+        were only set in didReceiveMessageToPage(), before calling beginTesting(). However, in
+        case of process-swap, beginTesting() gets called a second time in the new process, from
+        InjectedBundle::didCreatePage() with BegingTestingMode::Resume. As a result, the
+        m_dumpJSConsoleLogInStdErr flag was not getting set in the new process' injected bundle
+        after a process-swap. To address the issue, those data members now get initialized in
+        beginTesting() instead.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::didReceiveMessageToPage):
+        (WTR::InjectedBundle::beginTesting):
+
 2021-09-10  Jonathan Bedard  <jbed...@apple.com>
 
         [webkitcorepy] AutoInstall occasionally raising SSL error (Part 2)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (282304 => 282305)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2021-09-11 00:37:51 UTC (rev 282304)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2021-09-11 02:51:32 UTC (rev 282305)
@@ -192,9 +192,6 @@
     if (WKStringIsEqualToUTF8CString(messageName, "BeginTest")) {
         ASSERT(messageBody);
         auto messageBodyDictionary = dictionaryValue(messageBody);
-        m_dumpPixels = booleanValue(messageBodyDictionary, "DumpPixels");
-        m_timeout = Seconds::fromMilliseconds(uint64Value(messageBodyDictionary, "Timeout"));
-        m_dumpJSConsoleLogInStdErr = booleanValue(messageBodyDictionary, "DumpJSConsoleLogInStdErr");
         WKBundlePagePostMessage(page, toWK("Ack").get(), toWK("BeginTest").get());
         beginTesting(messageBodyDictionary, BegingTestingMode::New);
         return;
@@ -491,6 +488,10 @@
 {
     m_state = Testing;
 
+    m_dumpPixels = booleanValue(settings, "DumpPixels");
+    m_timeout = Seconds::fromMilliseconds(uint64Value(settings, "Timeout"));
+    m_dumpJSConsoleLogInStdErr = booleanValue(settings, "DumpJSConsoleLogInStdErr");
+
     m_pixelResult.clear();
     m_repaintRects.clear();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to