Changeset 282305 in webkit


Ignore:
Timestamp:
Sep 10, 2021 7:51:32 PM (10 months ago)
Author:
Chris Dumez
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:

Merge the following WPT test fix to address flakiness:

  • 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:

With support for the Report-To HTTP header as documented here:

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.

Location:
trunk
Files:
2 added
46 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r282299 r282305  
     12021-09-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement navigation reporting for Cross-Origin-Opener-Policy
     4        https://bugs.webkit.org/show_bug.cgi?id=230046
     5
     6        Reviewed by Alex Christensen.
     7
     8        Unskip COOP navigation reporting tests.
     9
     10        * TestExpectations:
     11
    1122021-09-10  Eric Hutchison  <ehutchison@apple.com>
    213
  • trunk/LayoutTests/TestExpectations

    r282287 r282305  
    411411imported/w3c/web-platform-tests/html/cross-origin-opener-policy/navigate-top-to-aboutblank.https.html [ DumpJSConsoleLogInStdErr ]
    412412imported/w3c/web-platform-tests/html/cross-origin-opener-policy/popup-coop-by-sw.https.html [ DumpJSConsoleLogInStdErr ]
     413imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-opener.https.html [ DumpJSConsoleLogInStdErr ]
     414imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-popup.https.html [ DumpJSConsoleLogInStdErr ]
    413415imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-network-error.sub.html [ DumpJSConsoleLogInStdErr ]
    414416imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/integrity.html [ DumpJSConsoleLogInStdErr ]
     
    718720imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-x.xhtml [ ImageOnlyFailure ]
    719721
    720 # Cross-Origin Opener Policy reporting is not supported and it is causing those tests to time out.
    721 imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting [ Skip ]
     722# Cross-Origin Opener Policy access reporting is not supported and it is causing those tests to time out.
     723imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/access-reporting [ Skip ]
    722724
    723725# Cross-Origin-Embedder-Policy: credentialless is not supported.
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r282287 r282305  
     12021-09-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement navigation reporting for Cross-Origin-Opener-Policy
     4        https://bugs.webkit.org/show_bug.cgi?id=230046
     5
     6        Reviewed by Alex Christensen.
     7
     8        Rebaseline WPT COOP navigation reporting tests now that they are passing.
     9
     10        Merge the following fix to WPT tests so they can run with the WebKit infrastructure:
     11        - https://github.com/web-platform-tests/wpt/pull/30411
     12
     13        Merge the following WPT test fix to address flakiness:
     14        - https://github.com/web-platform-tests/wpt/pull/30548
     15
     16        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https-expected.txt:
     17        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https.html.sub.headers:
     18        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-from-unsafe-none.https-expected.txt:
     19        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https-expected.txt:
     20        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https.html.sub.headers:
     21        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin.https-expected.txt:
     22        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-opener.https-expected.txt:
     23        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-popup.https-expected.txt:
     24        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https-expected.txt:
     25        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-allow-popups-report-to.https.html.sub.headers:
     26        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https-expected.txt:
     27        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-coep-report-to.https.html.sub.headers:
     28        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https-expected.txt:
     29        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https.html.sub.headers:
     30        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https-expected.txt:
     31        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https-expected.txt:
     32        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https.html.sub.headers:
     33        * web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-redirect-with-same-origin-allow-popups.https-expected.txt:
     34        * web-platform-tests/html/cross-origin-opener-policy/reporting/resources/reporting-common.js:
     35
    1362021-09-10  Simon Fraser  <simon.fraser@apple.com>
    237
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https-expected.txt

    r280044 r282305  
    11
    2 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: []"
     2PASS 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
    33PASS verify remaining reports
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-four-reports.https.html.sub.headers

    r279427 r282305  
    44Cross-Origin-Embedder-Policy-Report-Only: require-corp
    55Referrer-Policy: origin
    6 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" }]}
     6report-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" }]}
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-from-unsafe-none.https-expected.txt

    r280044 r282305  
    11
    2 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: []"
    3 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: []"
     2PASS 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",
     3PASS 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",
    44PASS verify remaining reports
    55
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin-report-to.https-expected.txt

    r280044 r282305  
    11
    2 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: []"
    3 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: []"
     2PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with , , ,
     3PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",
    44PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",
    55PASS verify remaining reports
  • 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

    r279427 r282305  
    11Cross-Origin-Opener-Policy-Report-Only: same-origin; report-to="coop-report-only-endpoint"
    22Referrer-Policy: origin
    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" }]}
     3report-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" }]}
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/report-only-same-origin.https-expected.txt

    r280044 r282305  
    11
    2 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: []"
    3 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: []"
     2PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with , require-corp, same-origin; report-to="coop-popup-report-only-endpoint",
     3PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint", require-corp
    44PASS verify remaining reports
    55
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-opener.https-expected.txt

    r280044 r282305  
    1 CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: cancelled
    21
    3 Harness Error (TIMEOUT), message = null
     2PASS navigation-report-from-opener-navigation
    43
    5 TIMEOUT navigation-report-from-opener-navigation Test timed out
    6 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-coop-navigated-popup.https-expected.txt

    r280044 r282305  
    11
    2 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: []"
     2PASS Open a popup to a document without COOP, then navigate it to a document with
    33PASS verify remaining reports
    44
  • 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

    r280044 r282305  
    11
    2 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: []"
    3 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: []"
    4 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: []"
     2PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
     3PASS 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, ,
     4PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin, require-corp, ,
    55PASS verify remaining reports
    66
  • 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

    r279427 r282305  
    1 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" }]}
     1report-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" }]}
    22Cross-Origin-Opener-Policy: same-origin-allow-popups; report-to="coop-report-endpoint"
    33Referrer-Policy: origin
  • 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

    r280044 r282305  
    22
    33PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", require-corp, ,
    4 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: []"
    5 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: []"
    6 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: []"
    7 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: []"
     4PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
     5PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", require-corp, ,
     6PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint", require-corp
     7PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint", require-corp
    88PASS verify remaining reports
    99
  • 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

    r279427 r282305  
    1 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" }]}
     1report-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" }]}
    22Cross-Origin-Opener-Policy: same-origin; report-to="coop-report-endpoint"
    33Cross-Origin-Embedder-Policy: require-corp
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin-report-to.https-expected.txt

    r280044 r282305  
    11
    22PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
    3 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: []"
    4 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: []"
    5 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: []"
    6 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: []"
    7 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: []"
     3PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
     4PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,
     5PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", require-corp, ,
     6PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,
     7PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with unsafe-none, , ,
    88PASS verify remaining reports
    99
  • 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

    r279427 r282305  
    1 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" }]}
     1report-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" }]}
    22Cross-Origin-Opener-Policy: same-origin; report-to="coop-report-endpoint"
    33Referrer-Policy: no-referrer
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-same-origin.https-expected.txt

    r280044 r282305  
    11
    2 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: []"
    3 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: []"
    4 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: []"
     2PASS coop reporting test reporting same origin to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
     3PASS coop reporting test reporting same origin to SAME_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,
     4PASS coop reporting test reporting same origin to CROSS_ORIGIN with unsafe-none; report-to="coop-popup-report-endpoint", , ,
    55PASS coop reporting test reporting same origin to SAME_ORIGIN with , , same-origin; report-to="coop-popup-report-only-endpoint",
    66PASS verify remaining reports
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/navigation-reporting/reporting-popup-unsafe-none-report-to.https-expected.txt

    r280044 r282305  
    11
    2 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: []"
    3 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: []"
    4 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: []"
     2PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
     3PASS coop reporting test reporting same origin with report-to to SAME_ORIGIN with same-origin, , ,
     4PASS coop reporting test reporting same origin with report-to to CROSS_ORIGIN with same-origin; report-to="coop-popup-report-endpoint", , ,
    55PASS verify remaining reports
    66
  • 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

    r279427 r282305  
    1 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" }]}
     1report-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" }]}
    22Cross-Origin-Opener-Policy: unsafe-none; report-to="coop-report-endpoint"
  • 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

    r280582 r282305  
    11
    2 Harness Error (TIMEOUT), message = null
     2PASS Same origin openee redirected to same-origin with same-origin-allow-popups
     3PASS Cross origin openee redirected to same-origin with same-origin-allow-popups
    34
    4 TIMEOUT Same origin openee redirected to same-origin with same-origin-allow-popups Test timed out
    5 NOTRUN Cross origin openee redirected to same-origin with same-origin-allow-popups
    6 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/cross-origin-opener-policy/reporting/resources/reporting-common.js

    r279427 r282305  
    7373          expectedReport.endpoint.reports.splice(j,1);
    7474          resolve();
     75          return;
    7576        }
    7677      };
  • trunk/Source/WebCore/ChangeLog

    r282304 r282305  
     12021-09-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement navigation reporting for Cross-Origin-Opener-Policy
     4        https://bugs.webkit.org/show_bug.cgi?id=230046
     5
     6        Reviewed by Alex Christensen.
     7
     8        Implement navigation reporting for Cross-Origin-Opener-Policy as per:
     9        - https://html.spec.whatwg.org/multipage/origin.html#coop-violation-navigation-to
     10        - https://html.spec.whatwg.org/multipage/origin.html#coop-violation-navigation-from
     11
     12        With support for the Report-To HTTP header as documented here:
     13        - https://www.w3.org/TR/reporting/#header
     14
     15        When adopting Cross-Origin-Opener-Policy or Cross-Origin-Opener-Policy-Report-Only HTTP headers,
     16        developers can now specify a `report-to` directive with the name of the endpoint to report
     17        COOP violations to. The mapping from endpoint name to URL is provided via teh Report-To HTTP
     18        header, as is expected by the WPT tests.
     19
     20        No new tests, unskipped and rebaselined existing tests.
     21
     22        * Sources.txt:
     23        * WebCore.xcodeproj/project.pbxproj:
     24        * loader/CrossOriginOpenerPolicy.cpp:
     25        (WebCore::sanitizeReferrerForURLReport):
     26        (WebCore::crossOriginOpenerPolicyValueToString):
     27        (WebCore::sendCOOPViolationReport):
     28        (WebCore::sendViolationReportWhenNavigatingToCOOPResponse):
     29        (WebCore::sendViolationReportWhenNavigatingAwayFromCOOPResponse):
     30        * loader/CrossOriginOpenerPolicy.h:
     31        * loader/DocumentLoader.cpp:
     32        (WebCore::DocumentLoader::willSendRequest):
     33        (WebCore::checkIfEnforcingReportOnlyCOOPWouldRequireBrowsingContextGroupSwitch):
     34        (WebCore::DocumentLoader::enforceResponseCrossOriginOpenerPolicy):
     35        (WebCore::DocumentLoader::responseReceived):
     36        * loader/PingLoader.cpp:
     37        (WebCore::PingLoader::sendViolationReport):
     38        (WebCore::PingLoader::startPingLoad):
     39        * loader/PingLoader.h:
     40        * loader/ReportingEndpointsCache.cpp: Added.
     41        (WebCore::ReportingEndpointsCache::singleton):
     42        (WebCore::ReportingEndpointsCache::addEndPointsFromResponse):
     43        (WebCore::ReportingEndpointsCache::addEndpointFromDictionary):
     44        (WebCore::ReportingEndpointsCache::endpointURL const):
     45        (WebCore::ReportingEndpointsCache::EndPoint::EndPoint):
     46        (WebCore::ReportingEndpointsCache::EndPoint::hasExpired const):
     47        * loader/ReportingEndpointsCache.h: Added.
     48        * loader/ResourceLoaderOptions.h:
     49        (WebCore::ResourceLoaderOptions::shouldOmitUserAgent):
     50        (WebCore::ResourceLoaderOptions::ResourceLoaderOptions):
     51        * loader/WorkerThreadableLoader.cpp:
     52        * loader/cache/CachedResourceLoader.cpp:
     53        (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
     54        * platform/network/HTTPHeaderNames.in:
     55
    1562021-09-10  Myles C. Maxfield  <mmaxfield@apple.com>
    257
  • trunk/Source/WebCore/Headers.cmake

    r282265 r282305  
    832832    loader/ProgressTracker.h
    833833    loader/ProgressTrackerClient.h
     834    loader/ReportingEndpointsCache.h
    834835    loader/ResourceCryptographicDigest.h
    835836    loader/ResourceLoadInfo.h
  • trunk/Source/WebCore/Sources.txt

    r282278 r282305  
    15431543loader/PolicyChecker.cpp
    15441544loader/ProgressTracker.cpp
     1545loader/ReportingEndpointsCache.cpp
    15451546loader/ResourceCryptographicDigest.cpp
    15461547loader/ResourceLoadInfo.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r282304 r282305  
    13261326                46D0004026A0FEB300D1BF1E /* SubmitEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 46D0003E26A0FE6F00D1BF1E /* SubmitEvent.h */; };
    13271327                46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1328                46DD6E1F26E7DBE7008C1F4C /* ReportingEndpointsCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DD6E1C26E7DBE6008C1F4C /* ReportingEndpointsCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13281329                46DD93D7269DE756001AFD88 /* BroadcastChannelIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DD93D5269DE74B001AFD88 /* BroadcastChannelIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13291330                46DE9BB5269DF93E0024C5A6 /* BroadcastChannelRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DE9BB4269DF9320024C5A6 /* BroadcastChannelRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    84248425                46D0003F26A0FE7000D1BF1E /* SubmitEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SubmitEvent.idl; sourceTree = "<group>"; };
    84258426                46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PowerObserverMac.h; sourceTree = "<group>"; };
     8427                46DD6E1C26E7DBE6008C1F4C /* ReportingEndpointsCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReportingEndpointsCache.h; sourceTree = "<group>"; };
     8428                46DD6E1E26E7DBE7008C1F4C /* ReportingEndpointsCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReportingEndpointsCache.cpp; sourceTree = "<group>"; };
    84268429                46DD93D5269DE74B001AFD88 /* BroadcastChannelIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BroadcastChannelIdentifier.h; sourceTree = "<group>"; };
    84278430                46DE9BB4269DF9320024C5A6 /* BroadcastChannelRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BroadcastChannelRegistry.h; sourceTree = "<group>"; };
     
    2756827571                                1A2A68220B5BEDE70002A480 /* ProgressTracker.h */,
    2756927572                                1ACADD781880D91C00D8B71D /* ProgressTrackerClient.h */,
     27573                                46DD6E1E26E7DBE7008C1F4C /* ReportingEndpointsCache.cpp */,
     27574                                46DD6E1C26E7DBE6008C1F4C /* ReportingEndpointsCache.h */,
    2757027575                                7C2FA60F1EA95A3200A03108 /* ResourceCryptographicDigest.cpp */,
    2757127576                                7C2FA6101EA95A3200A03108 /* ResourceCryptographicDigest.h */,
     
    3448834493                                2DF512CE1D873E47001D6780 /* ReplaceRangeWithTextCommand.h in Headers */,
    3448934494                                93309E0A099E64920056E581 /* ReplaceSelectionCommand.h in Headers */,
     34495                                46DD6E1F26E7DBE7008C1F4C /* ReportingEndpointsCache.h in Headers */,
    3449034496                                4998AEC613F9D0EA0090B1AA /* RequestAnimationFrameCallback.h in Headers */,
    3449134497                                F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */,
  • trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.cpp

    r281935 r282305  
    3030#include "HTTPHeaderNames.h"
    3131#include "HTTPParsers.h"
     32#include "PingLoader.h"
     33#include "ReportingEndpointsCache.h"
    3234#include "ResourceResponse.h"
    3335#include "ScriptExecutionContext.h"
     36#include <wtf/JSONValues.h>
    3437
    3538namespace WebCore {
    3639
    37 static String crossOriginOpenerPolicyToString(const CrossOriginOpenerPolicyValue& coop)
     40// https://html.spec.whatwg.org/multipage/origin.html#sanitize-url-report
     41static String sanitizeReferrerForURLReport(const URL& referrer)
     42{
     43    URL sanitizedReferrer = referrer;
     44    sanitizedReferrer.removeCredentials();
     45    sanitizedReferrer.removeFragmentIdentifier();
     46    return sanitizedReferrer.string();
     47}
     48
     49static ASCIILiteral crossOriginOpenerPolicyToString(const CrossOriginOpenerPolicyValue& coop)
    3850{
    3951    switch (coop) {
     
    4355    case CrossOriginOpenerPolicyValue::SameOriginAllowPopups:
    4456        return "same-origin-allow-popups"_s;
     57    case CrossOriginOpenerPolicyValue::UnsafeNone:
     58        break;
     59    }
     60    return "unsafe-none"_s;
     61}
     62
     63static ASCIILiteral crossOriginOpenerPolicyValueToEffectivePolicyString(CrossOriginOpenerPolicyValue coop)
     64{
     65    switch (coop) {
     66    case CrossOriginOpenerPolicyValue::SameOriginAllowPopups:
     67        return "same-origin-allow-popups"_s;
     68    case CrossOriginOpenerPolicyValue::SameOrigin:
     69        return "same-origin"_s;
     70    case CrossOriginOpenerPolicyValue::SameOriginPlusCOEP:
     71        return "same-origin-plus-coep"_s;
    4572    case CrossOriginOpenerPolicyValue::UnsafeNone:
    4673        break;
     
    110137}
    111138
     139// https://www.w3.org/TR/reporting/#try-delivery
     140static void sendCOOPViolationReport(Frame& frame, CrossOriginOpenerPolicy coop, COOPDisposition disposition, const URL& coopURL, const SecurityOrigin& coopOrigin, const String& userAgent, Function<void(JSON::Object&)>&& populateBody)
     141{
     142    auto& reportingEndpoint = disposition == COOPDisposition::Reporting ? coop.reportOnlyReportingEndpoint : coop.reportingEndpoint;
     143    if (reportingEndpoint.isEmpty())
     144        return;
     145
     146    auto reportingEndpointsCache = frame.page() ? frame.page()->reportingEndpointsCache() : nullptr;
     147    if (!reportingEndpointsCache)
     148        return;
     149    auto endpointURL = reportingEndpointsCache->endpointURL(coopOrigin.data(), reportingEndpoint);
     150    if (!endpointURL.isValid())
     151        return;
     152
     153    auto body = JSON::Object::create();
     154    body->setString("disposition"_s, disposition == COOPDisposition::Reporting ? "reporting"_s : "enforce"_s);
     155    body->setString("effectivePolicy"_s, crossOriginOpenerPolicyValueToEffectivePolicyString(disposition == COOPDisposition::Reporting ? coop.reportOnlyValue : coop.value));
     156    populateBody(body);
     157
     158    auto reportObject = JSON::Object::create();
     159    reportObject->setString("type"_s, "coop"_s);
     160    reportObject->setString("url"_s, coopURL.string());
     161    reportObject->setString("user_agent", userAgent);
     162    reportObject->setInteger("age", 0); // We currently do not delay sending the reports.
     163    reportObject->setObject("body"_s, WTFMove(body));
     164
     165    auto reportList = JSON::Array::create();
     166    reportList->pushObject(reportObject);
     167
     168    auto report = FormData::create(reportList->toJSONString().utf8());
     169    PingLoader::sendViolationReport(frame, endpointURL, WTFMove(report), ViolationReportType::StandardReportingAPIViolation);
     170}
     171
     172// https://html.spec.whatwg.org/multipage/origin.html#coop-violation-navigation-to
     173void 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)
     174{
     175    sendCOOPViolationReport(frame, coop, disposition, coopURL, coopOrigin, userAgent, [&](auto& body) {
     176        body.setString("previousResponseURL"_s, coopOrigin.isSameOriginAs(previousResponseOrigin) ? sanitizeReferrerForURLReport(previousResponseURL) : String());
     177        body.setString("type"_s, "navigation-to-response"_s);
     178        body.setString("referrer"_s, referrer);
     179    });
     180}
     181
     182// https://html.spec.whatwg.org/multipage/origin.html#coop-violation-navigation-from
     183void sendViolationReportWhenNavigatingAwayFromCOOPResponse(Frame& frame, CrossOriginOpenerPolicy coop, COOPDisposition disposition, const URL& coopURL, const URL& nextResponseURL, const SecurityOrigin& coopOrigin, const SecurityOrigin& nextResponseOrigin, bool isCOOPResponseNavigationSource, const String& userAgent)
     184{
     185    sendCOOPViolationReport(frame, coop, disposition, coopURL, coopOrigin, userAgent, [&](auto& body) {
     186        body.setString("nextResponseURL"_s, coopOrigin.isSameOriginAs(nextResponseOrigin) || isCOOPResponseNavigationSource ? sanitizeReferrerForURLReport(nextResponseURL) : String());
     187        body.setString("type"_s, "navigation-from-response"_s);
     188    });
     189}
     190
    112191} // namespace WebCore
  • trunk/Source/WebCore/loader/CrossOriginOpenerPolicy.h

    r280881 r282305  
    107107};
    108108
     109enum class COOPDisposition : bool { Reporting , Enforce };
     110
    109111CrossOriginOpenerPolicy obtainCrossOriginOpenerPolicy(const ResourceResponse&, const ScriptExecutionContext&);
    110112WEBCORE_EXPORT void addCrossOriginOpenerPolicyHeaders(ResourceResponse&, const CrossOriginOpenerPolicy&);
     113void sendViolationReportWhenNavigatingToCOOPResponse(Frame&, CrossOriginOpenerPolicy, COOPDisposition, const URL& coopURL, const URL& previousResponseURL, const SecurityOrigin& coopOrigin, const SecurityOrigin& previousResponseOrigin, const String& referrer, const String& userAgent);
     114void sendViolationReportWhenNavigatingAwayFromCOOPResponse(Frame&, CrossOriginOpenerPolicy, COOPDisposition, const URL& coopURL, const URL& nextResponseURL, const SecurityOrigin& coopOrigin, const SecurityOrigin& nextResponseOrigin, bool isCOOPResponseNavigationSource, const String& userAgent);
    111115
    112116} // namespace WebCore
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r282084 r282305  
    8080#include "ProgressTracker.h"
    8181#include "Quirks.h"
     82#include "ReportingEndpointsCache.h"
    8283#include "ResourceHandle.h"
    8384#include "ResourceLoadObserver.h"
     
    633634
    634635    bool didReceiveRedirectResponse = !redirectResponse.isNull();
     636    if (didReceiveRedirectResponse && m_frame->isMainFrame()) {
     637        if (auto reportingEndpointsCache = m_frame->page() ? m_frame->page()->reportingEndpointsCache() : nullptr)
     638            reportingEndpointsCache->addEndPointsFromResponse(redirectResponse);
     639    }
     640
    635641    if (!frameLoader()->checkIfFormActionAllowedByCSP(newRequest.url(), didReceiveRedirectResponse)) {
    636642        DOCUMENTLOADER_RELEASE_LOG("willSendRequest: canceling - form action not allowed by CSP");
     
    758764
    759765    return true;
     766}
     767
     768// https://html.spec.whatwg.org/multipage/origin.html#check-bcg-switch-navigation-report-only
     769static bool checkIfEnforcingReportOnlyCOOPWouldRequireBrowsingContextGroupSwitch(bool isInitialAboutBlank, const CrossOriginOpenerPolicy& activeDocumentCOOP, const SecurityOrigin& activeDocumentNavigationOrigin, const CrossOriginOpenerPolicy& responseCOOP, const SecurityOrigin& responseOrigin)
     770{
     771    if (!checkIfCOOPValuesRequireBrowsingContextGroupSwitch(isInitialAboutBlank, activeDocumentCOOP.reportOnlyValue, activeDocumentNavigationOrigin, responseCOOP.reportOnlyValue, responseOrigin))
     772        return false;
     773
     774    if (checkIfCOOPValuesRequireBrowsingContextGroupSwitch(isInitialAboutBlank, activeDocumentCOOP.reportOnlyValue, activeDocumentNavigationOrigin, responseCOOP.value, responseOrigin))
     775        return true;
     776
     777    if (checkIfCOOPValuesRequireBrowsingContextGroupSwitch(isInitialAboutBlank, activeDocumentCOOP.value, activeDocumentNavigationOrigin, responseCOOP.reportOnlyValue, responseOrigin))
     778        return true;
     779
     780    return false;
    760781}
    761782
     
    814835            currentContextIsSource,
    815836        };
     837        if (SecurityPolicy::shouldInheritSecurityOriginFromOwner(m_frame->document()->url())) {
     838            if (auto openerFrame = m_frame->loader().opener()) {
     839                if (auto openerDocument = openerFrame->document())
     840                    m_currentCoopEnforcementResult->url = openerDocument->url();
     841            }
     842        }
    816843    }
    817844
     
    825852    };
    826853
    827     if (checkIfCOOPValuesRequireBrowsingContextGroupSwitch(frameLoader()->stateMachine().isDisplayingInitialEmptyDocument(), m_currentCoopEnforcementResult->crossOriginOpenerPolicy.value, m_currentCoopEnforcementResult->currentOrigin, responseCOOP.value, responseOrigin))
     854    if (checkIfCOOPValuesRequireBrowsingContextGroupSwitch(frameLoader()->stateMachine().isDisplayingInitialEmptyDocument(), m_currentCoopEnforcementResult->crossOriginOpenerPolicy.value, m_currentCoopEnforcementResult->currentOrigin, responseCOOP.value, responseOrigin)) {
    828855        newCOOPEnforcementResult.needsBrowsingContextGroupSwitch = true;
     856
     857        // FIXME: Add the concept of browsing context group like in the specification instead of treating the whole process as a group.
     858        if (Page::nonUtilityPageCount() > 1) {
     859            sendViolationReportWhenNavigatingToCOOPResponse(*m_frame, responseCOOP, COOPDisposition::Enforce, responseURL, m_currentCoopEnforcementResult->url, responseOrigin, m_currentCoopEnforcementResult->currentOrigin, m_request.httpReferrer(), m_request.httpUserAgent());
     860            sendViolationReportWhenNavigatingAwayFromCOOPResponse(*m_frame, m_currentCoopEnforcementResult->crossOriginOpenerPolicy, COOPDisposition::Enforce, m_currentCoopEnforcementResult->url, responseURL, m_currentCoopEnforcementResult->currentOrigin, responseOrigin, m_currentCoopEnforcementResult->isCurrentContextNavigationSource, m_request.httpUserAgent());
     861        }
     862    }
     863
     864    if (checkIfEnforcingReportOnlyCOOPWouldRequireBrowsingContextGroupSwitch(frameLoader()->stateMachine().isDisplayingInitialEmptyDocument(), m_currentCoopEnforcementResult->crossOriginOpenerPolicy, m_currentCoopEnforcementResult->currentOrigin, responseCOOP, responseOrigin)) {
     865        newCOOPEnforcementResult.needsBrowsingContextGroupSwitchDueToReportOnly = true;
     866
     867        // FIXME: Add the concept of browsing context group like in the specification instead of treating the whole process as a group.
     868        if (Page::nonUtilityPageCount() > 1) {
     869            sendViolationReportWhenNavigatingToCOOPResponse(*m_frame, responseCOOP, COOPDisposition::Reporting, responseURL, m_currentCoopEnforcementResult->url, responseOrigin, m_currentCoopEnforcementResult->currentOrigin, m_request.httpReferrer(), m_request.httpUserAgent());
     870            sendViolationReportWhenNavigatingAwayFromCOOPResponse(*m_frame, m_currentCoopEnforcementResult->crossOriginOpenerPolicy, COOPDisposition::Reporting, m_currentCoopEnforcementResult->url, responseURL, m_currentCoopEnforcementResult->currentOrigin, responseOrigin, m_currentCoopEnforcementResult->isCurrentContextNavigationSource, m_request.httpUserAgent());
     871        }
     872    }
    829873
    830874    return newCOOPEnforcementResult;
     
    9871031    if (willLoadFallback)
    9881032        return;
     1033
     1034    if (m_frame->isMainFrame()) {
     1035        if (auto reportingEndpointsCache = m_frame->page() ? m_frame->page()->reportingEndpointsCache() : nullptr)
     1036            reportingEndpointsCache->addEndPointsFromResponse(response);
     1037    }
    9891038
    9901039    ASSERT(m_identifierForLoadWithoutResourceLoader || m_mainResource);
  • trunk/Source/WebCore/loader/PingLoader.cpp

    r277865 r282305  
    175175        request.setHTTPContentType("application/json"_s);
    176176        break;
     177    case ViolationReportType::StandardReportingAPIViolation:
     178        request.setHTTPContentType("application/reports+json"_s);
     179        break;
    177180    }
    178181
     
    185188    HTTPHeaderMap originalRequestHeader = request.httpHeaderFields();
    186189
    187     frame.loader().updateRequestAndAddExtraFields(request, IsMainResource::No);
     190    if (reportType != ViolationReportType::StandardReportingAPIViolation)
     191        frame.loader().updateRequestAndAddExtraFields(request, IsMainResource::No);
    188192
    189193    String referrer = SecurityPolicy::generateReferrerHeader(document.referrerPolicy(), reportURL, frame.loader().outgoingReferrer());
     
    191195        request.setHTTPReferrer(referrer);
    192196
    193     startPingLoad(frame, request, WTFMove(originalRequestHeader), ShouldFollowRedirects::No, ContentSecurityPolicyImposition::SkipPolicyCheck, ReferrerPolicy::EmptyString);
    194 }
    195 
    196 void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request, HTTPHeaderMap&& originalRequestHeaders, ShouldFollowRedirects shouldFollowRedirects, ContentSecurityPolicyImposition policyCheck, ReferrerPolicy referrerPolicy)
     197    startPingLoad(frame, request, WTFMove(originalRequestHeader), ShouldFollowRedirects::No, ContentSecurityPolicyImposition::SkipPolicyCheck, ReferrerPolicy::EmptyString, reportType);
     198}
     199
     200void PingLoader::startPingLoad(Frame& frame, ResourceRequest& request, HTTPHeaderMap&& originalRequestHeaders, ShouldFollowRedirects shouldFollowRedirects, ContentSecurityPolicyImposition policyCheck, ReferrerPolicy referrerPolicy, std::optional<ViolationReportType> violationReportType)
    197201{
    198202    unsigned long identifier = frame.page()->progress().createUniqueIdentifier();
     
    212216    options.cache = FetchOptions::Cache::NoCache;
    213217
     218    // https://www.w3.org/TR/reporting/#try-delivery
     219    if (violationReportType == ViolationReportType::StandardReportingAPIViolation) {
     220        options.credentials = FetchOptions::Credentials::SameOrigin;
     221        options.mode = FetchOptions::Mode::Cors;
     222        options.serviceWorkersMode = ServiceWorkersMode::None;
     223        options.destination = FetchOptions::Destination::Report;
     224    }
     225
    214226    // FIXME: Deprecate the ping load code path.
    215227    if (platformStrategies()->loaderStrategy()->usePingLoad()) {
  • trunk/Source/WebCore/loader/PingLoader.h

    r244700 r282305  
    4444class ResourceRequest;
    4545
    46 enum class ViolationReportType {
     46enum class ViolationReportType : uint8_t {
    4747    ContentSecurityPolicy,
    4848    XSSAuditor,
     49    StandardReportingAPIViolation // https://www.w3.org/TR/reporting/#try-delivery
    4950};
    5051
     
    5960private:
    6061    enum class ShouldFollowRedirects { No, Yes };
    61     static void startPingLoad(Frame&, ResourceRequest&, HTTPHeaderMap&& originalRequestHeaders, ShouldFollowRedirects, ContentSecurityPolicyImposition, ReferrerPolicy);
     62    static void startPingLoad(Frame&, ResourceRequest&, HTTPHeaderMap&& originalRequestHeaders, ShouldFollowRedirects, ContentSecurityPolicyImposition, ReferrerPolicy, std::optional<ViolationReportType> = std::nullopt);
    6263};
    6364
  • trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp

    r280953 r282305  
    4646#include "ServiceWorkerGlobalScope.h"
    4747#include "ThreadableLoader.h"
     48#include "WorkerGlobalScope.h"
    4849#include "WorkerLoaderProxy.h"
    4950#include "WorkerOrWorkletGlobalScope.h"
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp

    r281110 r282305  
    359359ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestPingResource(CachedResourceRequest&& request)
    360360{
    361     ASSERT(request.options().destination == FetchOptions::Destination::EmptyString);
     361    ASSERT(request.options().destination == FetchOptions::Destination::EmptyString || request.options().destination == FetchOptions::Destination::Report);
    362362    return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::Type::Ping, WTFMove(request)));
    363363}
  • trunk/Source/WebCore/page/Page.cpp

    r282191 r282305  
    118118#include "RenderWidget.h"
    119119#include "RenderingUpdateScheduler.h"
     120#include "ReportingEndpointsCache.h"
    120121#include "ResizeObserver.h"
    121122#include "ResourceUsageOverlay.h"
     
    329330    , m_httpsUpgradeEnabled(pageConfiguration.httpsUpgradeEnabled)
    330331    , m_permissionController(WTFMove(pageConfiguration.permissionController))
     332    , m_reportingEndpointsCache(WTFMove(pageConfiguration.reportingEndpointsCache))
    331333    , m_storageProvider(WTFMove(pageConfiguration.storageProvider))
    332334{
  • trunk/Source/WebCore/page/Page.h

    r282130 r282305  
    140140class ProgressTracker;
    141141class RenderObject;
     142class ReportingEndpointsCache;
    142143class ResourceUsageOverlay;
    143144class RenderingUpdateScheduler;
     
    308309#endif
    309310
     311    ReportingEndpointsCache* reportingEndpointsCache() { return m_reportingEndpointsCache.get(); }
     312
    310313    Chrome& chrome() const { return *m_chrome; }
    311314    DragCaretController& dragCaretController() const { return *m_dragCaretController; }
     
    12011204
    12021205    Ref<PermissionController> m_permissionController;
     1206    RefPtr<ReportingEndpointsCache> m_reportingEndpointsCache;
    12031207    UniqueRef<StorageProvider> m_storageProvider;
    12041208
  • trunk/Source/WebCore/page/PageConfiguration.cpp

    r282130 r282305  
    4444#include "PluginInfoProvider.h"
    4545#include "ProgressTrackerClient.h"
     46#include "ReportingEndpointsCache.h"
    4647#include "SocketProvider.h"
    4748#include "SpeechRecognitionProvider.h"
  • trunk/Source/WebCore/page/PageConfiguration.h

    r282130 r282305  
    6363class PluginInfoProvider;
    6464class ProgressTrackerClient;
     65class ReportingEndpointsCache;
    6566class SocketProvider;
    6667class SpeechRecognitionProvider;
     
    134135    UniqueRef<SpeechRecognitionProvider> speechRecognitionProvider;
    135136    UniqueRef<MediaRecorderProvider> mediaRecorderProvider;
     137    RefPtr<ReportingEndpointsCache> reportingEndpointsCache;
    136138
    137139    // FIXME: These should be all be Settings.
  • trunk/Source/WebCore/platform/network/HTTPHeaderNames.in

    r280504 r282305  
    8484Referrer-Policy
    8585Refresh
     86Report-To
    8687Sec-WebSocket-Accept
    8788Sec-WebSocket-Extensions
  • trunk/Source/WebKit/ChangeLog

    r282295 r282305  
     12021-09-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement navigation reporting for Cross-Origin-Opener-Policy
     4        https://bugs.webkit.org/show_bug.cgi?id=230046
     5
     6        Reviewed by Alex Christensen.
     7
     8        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
     9        (WebKit::NetworkConnectionToWebProcess::didCleanupResourceLoader):
     10        Now that we may abort expired loaders that are cached on the NetworkSession
     11        (because awaiting transfer to another web process connection), we would hit
     12        this assertion because the loader is not associated with this connection
     13        anymore at the point it is adopted. For this reason, I silenced this
     14        assertion.
     15
     16        * NetworkProcess/NetworkSession.cpp:
     17        (WebKit::NetworkSession::CachedNetworkResourceLoader::expirationTimerFired):
     18        Abort the loader before destroying it to avoid hitting an assertion in the
     19        destructor (loaders cannot be loading at the point they are destroyed).
     20
    1212021-09-10  Stephan Szabo  <stephan.szabo@sony.com>
    222
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp

    r281706 r282305  
    176176    }
    177177
    178     ASSERT(m_networkResourceLoaders.get(loader.coreIdentifier()) == &loader);
    179178    m_networkResourceLoaders.remove(loader.coreIdentifier());
    180179}
  • trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp

    r282269 r282305  
    430430
    431431    auto loader = session->takeLoaderAwaitingWebProcessTransfer(m_loader->identifier());
    432     ASSERT_UNUSED(loader, loader);
     432    ASSERT(loader);
     433    if (loader)
     434        loader->abort();
    433435}
    434436
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r282191 r282305  
    232232#include <WebCore/RenderTreeAsText.h>
    233233#include <WebCore/RenderView.h>
     234#include <WebCore/ReportingEndpointsCache.h>
    234235#include <WebCore/ResourceLoadStatistics.h>
    235236#include <WebCore/ResourceRequest.h>
     
    605606    pageConfiguration.storageNamespaceProvider = WebStorageNamespaceProvider::getOrCreate(*m_pageGroup);
    606607    pageConfiguration.visitedLinkStore = VisitedLinkTableController::getOrCreate(parameters.visitedLinkTableID);
     608    pageConfiguration.reportingEndpointsCache = &WebProcess::singleton().reportingEndpointsCache();
    607609
    608610#if ENABLE(APPLE_PAY)
  • trunk/Source/WebKit/WebProcess/WebProcess.cpp

    r281832 r282305  
    127127#include <WebCore/RegistrableDomain.h>
    128128#include <WebCore/RemoteCommandListener.h>
     129#include <WebCore/ReportingEndpointsCache.h>
    129130#include <WebCore/ResourceLoadStatistics.h>
    130131#include <WebCore/RuntimeApplicationChecks.h>
     
    275276    , m_broadcastChannelRegistry(WebBroadcastChannelRegistry::create())
    276277    , m_cookieJar(WebCookieJar::create())
     278    , m_reportingEndpointsCache(ReportingEndpointsCache::create())
    277279    , m_dnsPrefetchHystereris([this](PAL::HysteresisState state) { if (state == PAL::HysteresisState::Stopped) m_dnsPrefetchedHosts.clear(); })
    278280#if ENABLE(NETSCAPE_PLUGIN_API)
  • trunk/Source/WebKit/WebProcess/WebProcess.h

    r281398 r282305  
    9595class PageGroup;
    9696class RegistrableDomain;
     97class ReportingEndpointsCache;
    9798class ResourceRequest;
    9899class UserGestureToken;
     
    341342    WebCookieJar& cookieJar() { return m_cookieJar.get(); }
    342343    WebSocketChannelManager& webSocketChannelManager() { return m_webSocketChannelManager; }
     344    WebCore::ReportingEndpointsCache& reportingEndpointsCache() { return m_reportingEndpointsCache.get(); }
    343345
    344346#if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
     
    663665    Ref<WebBroadcastChannelRegistry> m_broadcastChannelRegistry;
    664666    Ref<WebCookieJar> m_cookieJar;
     667    Ref<WebCore::ReportingEndpointsCache> m_reportingEndpointsCache;
    665668    WebSocketChannelManager m_webSocketChannelManager;
    666669
  • trunk/Tools/ChangeLog

    r282302 r282305  
     12021-09-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement navigation reporting for Cross-Origin-Opener-Policy
     4        https://bugs.webkit.org/show_bug.cgi?id=230046
     5
     6        Reviewed by Alex Christensen.
     7
     8        Fix issue where [DumpJSConsoleLogInStdErr] was not working for tests that process-swap
     9        due to COOP. Some data members on InjectedBundle such as m_dumpJSConsoleLogInStdErr
     10        were only set in didReceiveMessageToPage(), before calling beginTesting(). However, in
     11        case of process-swap, beginTesting() gets called a second time in the new process, from
     12        InjectedBundle::didCreatePage() with BegingTestingMode::Resume. As a result, the
     13        m_dumpJSConsoleLogInStdErr flag was not getting set in the new process' injected bundle
     14        after a process-swap. To address the issue, those data members now get initialized in
     15        beginTesting() instead.
     16
     17        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     18        (WTR::InjectedBundle::didReceiveMessageToPage):
     19        (WTR::InjectedBundle::beginTesting):
     20
    1212021-09-10  Jonathan Bedard  <jbedard@apple.com>
    222
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r282004 r282305  
    193193        ASSERT(messageBody);
    194194        auto messageBodyDictionary = dictionaryValue(messageBody);
    195         m_dumpPixels = booleanValue(messageBodyDictionary, "DumpPixels");
    196         m_timeout = Seconds::fromMilliseconds(uint64Value(messageBodyDictionary, "Timeout"));
    197         m_dumpJSConsoleLogInStdErr = booleanValue(messageBodyDictionary, "DumpJSConsoleLogInStdErr");
    198195        WKBundlePagePostMessage(page, toWK("Ack").get(), toWK("BeginTest").get());
    199196        beginTesting(messageBodyDictionary, BegingTestingMode::New);
     
    492489    m_state = Testing;
    493490
     491    m_dumpPixels = booleanValue(settings, "DumpPixels");
     492    m_timeout = Seconds::fromMilliseconds(uint64Value(settings, "Timeout"));
     493    m_dumpJSConsoleLogInStdErr = booleanValue(settings, "DumpJSConsoleLogInStdErr");
     494
    494495    m_pixelResult.clear();
    495496    m_repaintRects.clear();
Note: See TracChangeset for help on using the changeset viewer.