#include "third_party/blink/renderer/modules/eventsource/event_source.h"
#include <memory>
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value_factory.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_event_source_init.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/event_target_names.h"
#include "third_party/blink/renderer/core/events/message_event.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.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/console_message.h"
#include "third_party/blink/renderer/core/loader/threadable_loader.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_error.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_request.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h"
#include "third_party/blink/renderer/platform/network/http_names.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
namespace blink {
namespace {
bool IsCorsUnsafeRequestHeaderByte(char c) { … }
void ReportUMA(ExecutionContext& context,
const std::string& value,
network::mojom::FetchResponseType response_type) { … }
}
const uint64_t EventSource::kDefaultReconnectDelay = …;
inline EventSource::EventSource(ExecutionContext* context,
const KURL& url,
const EventSourceInit* event_source_init)
: … { … }
EventSource* EventSource::Create(ExecutionContext* context,
const String& url,
const EventSourceInit* event_source_init,
ExceptionState& exception_state) { … }
EventSource::~EventSource() { … }
void EventSource::ScheduleInitialConnect() { … }
void EventSource::Connect() { … }
void EventSource::NetworkRequestEnded() { … }
void EventSource::ScheduleReconnect() { … }
void EventSource::ConnectTimerFired(TimerBase*) { … }
String EventSource::url() const { … }
bool EventSource::withCredentials() const { … }
EventSource::State EventSource::readyState() const { … }
void EventSource::close() { … }
const AtomicString& EventSource::InterfaceName() const { … }
ExecutionContext* EventSource::GetExecutionContext() const { … }
void EventSource::DidReceiveResponse(uint64_t identifier,
const ResourceResponse& response) { … }
void EventSource::DidReceiveData(base::span<const char> data) { … }
void EventSource::DidFinishLoading(uint64_t) { … }
void EventSource::DidFail(uint64_t, const ResourceError& error) { … }
void EventSource::DidFailRedirectCheck(uint64_t) { … }
void EventSource::OnMessageEvent(const AtomicString& event_type,
const String& data,
const AtomicString& last_event_id) { … }
void EventSource::OnReconnectionTimeSet(uint64_t reconnection_time) { … }
void EventSource::AbortConnectionAttempt() { … }
void EventSource::ContextDestroyed() { … }
bool EventSource::HasPendingActivity() const { … }
void EventSource::Trace(Visitor* visitor) const { … }
}