#include "third_party/blink/renderer/core/inspector/inspector_audits_issue.h"
#include "base/unguessable_token.h"
#include "services/network/public/mojom/blocked_by_response_reason.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/capture_source_location.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_security_policy_violation_event_init.h"
#include "third_party/blink/renderer/core/dom/dom_node_ids.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/inspector/identifiers_factory.h"
#include "third_party/blink/renderer/core/inspector/protocol/audits.h"
#include "third_party/blink/renderer/core/inspector/protocol/network.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/platform/bindings/source_location.h"
#include "third_party/blink/renderer/platform/bindings/v8_binding.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_error.h"
namespace blink {
AuditsIssue::AuditsIssue(
std::unique_ptr<protocol::Audits::InspectorIssue> issue)
: … { … }
AuditsIssue::AuditsIssue(AuditsIssue&&) = default;
AuditsIssue& AuditsIssue::operator=(AuditsIssue&&) = default;
AuditsIssue::~AuditsIssue() = default;
std::unique_ptr<protocol::Audits::InspectorIssue> AuditsIssue::TakeIssue() { … }
void AuditsIssue::ReportQuirksModeIssue(ExecutionContext* execution_context,
bool isLimitedQuirksMode,
DOMNodeId document_node_id,
String url,
String frame_id,
String loader_id) { … }
namespace {
protocol::Network::CorsError RendererCorsIssueCodeToProtocol(
RendererCorsIssueCode code) { … }
}
std::unique_ptr<protocol::Audits::SourceCodeLocation> CreateProtocolLocation(
const SourceLocation& location) { … }
protocol::Audits::GenericIssueErrorType
AuditsIssue::GenericIssueErrorTypeToProtocol(
mojom::blink::GenericIssueErrorType error_type) { … }
void AuditsIssue::ReportCorsIssue(
ExecutionContext* execution_context,
int64_t identifier,
RendererCorsIssueCode code,
String url,
String initiator_origin,
String failedParameter,
std::optional<base::UnguessableToken> issue_id) { … }
namespace {
AttributionReportingIssueType;
protocol::Audits::AttributionReportingIssueType
BuildAttributionReportingIssueType(AttributionReportingIssueType type) { … }
}
void AuditsIssue::ReportAttributionIssue(
ExecutionContext* execution_context,
AttributionReportingIssueType type,
Element* element,
const String& request_id,
const String& invalid_parameter) { … }
namespace {
protocol::Audits::SharedArrayBufferIssueType
SharedArrayBufferIssueTypeToProtocol(SharedArrayBufferIssueType issue_type) { … }
protocol::Audits::BlockedByResponseReason BlockedByResponseReasonToProtocol(
network::mojom::BlockedByResponseReason reason) { … }
protocol::Audits::MixedContentResourceType
RequestContextToMixedContentResourceType(
mojom::blink::RequestContextType request_context) { … }
protocol::Audits::MixedContentResolutionStatus
MixedContentResolutionStatusToProtocol(
MixedContentResolutionStatus resolution_type) { … }
protocol::Audits::ContentSecurityPolicyViolationType CSPViolationTypeToProtocol(
ContentSecurityPolicyViolationType violation_type) { … }
}
void AuditsIssue::ReportSharedArrayBufferIssue(
ExecutionContext* execution_context,
bool shared_buffer_transfer_allowed,
SharedArrayBufferIssueType issue_type) { … }
void AuditsIssue::ReportDeprecationIssue(ExecutionContext* execution_context,
String type) { … }
namespace {
protocol::Audits::ClientHintIssueReason ClientHintIssueReasonToProtocol(
ClientHintIssueReason reason) { … }
}
void AuditsIssue::ReportClientHintIssue(LocalDOMWindow* local_dom_window,
ClientHintIssueReason reason) { … }
AuditsIssue AuditsIssue::CreateBlockedByResponseIssue(
network::mojom::BlockedByResponseReason reason,
uint64_t identifier,
DocumentLoader* loader,
const ResourceError& error,
const base::UnguessableToken& token) { … }
void AuditsIssue::ReportMixedContentIssue(
const KURL& main_resource_url,
const KURL& insecure_url,
const mojom::blink::RequestContextType request_context,
LocalFrame* frame,
const MixedContentResolutionStatus resolution_status,
const String& devtools_id) { … }
void AuditsIssue::ReportGenericIssue(
LocalFrame* frame,
mojom::blink::GenericIssueErrorType error_type,
int violating_node_id) { … }
void AuditsIssue::ReportGenericIssue(
LocalFrame* frame,
mojom::blink::GenericIssueErrorType error_type,
int violating_node_id,
const String& violating_node_attribute) { … }
void AuditsIssue::ReportPropertyRuleIssue(
Document* document,
const KURL& url,
WTF::OrdinalNumber line,
WTF::OrdinalNumber column,
protocol::Audits::PropertyRuleIssueReason reason,
const String& propertyValue) { … }
void AuditsIssue::ReportStylesheetLoadingLateImportIssue(
Document* document,
const KURL& url,
WTF::OrdinalNumber line,
WTF::OrdinalNumber column) { … }
void AuditsIssue::ReportStylesheetLoadingRequestFailedIssue(
Document* document,
const KURL& url,
const String& request_id,
const KURL& initiator_url,
WTF::OrdinalNumber initiator_line,
WTF::OrdinalNumber initiator_column,
const String& failureMessage) { … }
AuditsIssue AuditsIssue::CreateContentSecurityPolicyIssue(
const blink::SecurityPolicyViolationEventInit& violation_data,
bool is_report_only,
ContentSecurityPolicyViolationType violation_type,
LocalFrame* frame_ancestor,
Element* element,
SourceLocation* source_location,
std::optional<base::UnguessableToken> issue_id) { … }
}