Changeset 287693 in webkit for trunk/Source/WebCore/loader/PingLoader.cpp
- Timestamp:
- Jan 6, 2022, 9:21:06 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/loader/PingLoader.cpp
r286383 r287693 50 50 #include "PlatformStrategies.h" 51 51 #include "ProgressTracker.h" 52 #include "ReportingEndpointsCache.h"53 52 #include "ResourceError.h" 54 53 #include "ResourceHandle.h" … … 251 250 } 252 251 253 // https://www.w3.org/TR/reporting/#try-delivery254 void PingLoader::sendReportToEndpoint(Frame& frame, const SecurityOriginData& origin, const String& endpoint, const String& type, const URL& reportURL, const String& userAgent, const Function<void(JSON::Object&)>& populateReportBody)255 {256 ASSERT(!endpoint.isEmpty());257 auto reportingEndpointsCache = frame.page() ? frame.page()->reportingEndpointsCache() : nullptr;258 if (!reportingEndpointsCache)259 return;260 auto endpointURL = reportingEndpointsCache->endpointURL(origin, endpoint);261 if (!endpointURL.isValid())262 return;263 264 auto body = JSON::Object::create();265 populateReportBody(body);266 267 auto reportObject = JSON::Object::create();268 reportObject->setString("type"_s, type);269 if (reportURL.isValid())270 reportObject->setString("url"_s, reportURL.string());271 reportObject->setString("user_agent", userAgent);272 reportObject->setInteger("age", 0); // We currently do not delay sending the reports.273 reportObject->setObject("body"_s, WTFMove(body));274 275 auto reportList = JSON::Array::create();276 reportList->pushObject(reportObject);277 278 auto report = FormData::create(reportList->toJSONString().utf8());279 sendViolationReport(frame, endpointURL, WTFMove(report), ViolationReportType::StandardReportingAPIViolation);280 }281 282 252 } // namespace WebCore
Note:
See TracChangeset
for help on using the changeset viewer.