chromium/third_party/blink/renderer/modules/websockets/dom_websocket.cc

/*
 * Copyright (C) 2011 Google 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:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * 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.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
 * OWNER OR 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 "third_party/blink/renderer/modules/websockets/dom_websocket.h"

#include <optional>
#include <string>
#include <utility>

#include "base/feature_list.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/frame/lifecycle.mojom-shared.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_string_stringsequence.h"
#include "third_party/blink/renderer/core/dom/document.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/execution_context/security_context.h"
#include "third_party/blink/renderer/core/fileapi/blob.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/mixed_content_checker.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer_view.h"
#include "third_party/blink/renderer/modules/websockets/close_event.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/source_location.h"
#include "third_party/blink/renderer/platform/blob/blob_data.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/weborigin/known_ports.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/hash_set.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h"
#include "third_party/blink/renderer/platform/wtf/wtf_size_t.h"

namespace blink {

DOMWebSocket::EventQueue::EventQueue(EventTarget* target)
    :{}

void DOMWebSocket::EventQueue::Dispatch(Event* event) {}

bool DOMWebSocket::EventQueue::IsEmpty() const {}

void DOMWebSocket::EventQueue::Pause() {}

void DOMWebSocket::EventQueue::Unpause() {}

void DOMWebSocket::EventQueue::ContextDestroyed() {}

bool DOMWebSocket::EventQueue::IsPaused() {}

void DOMWebSocket::EventQueue::DispatchQueuedEvents() {}

void DOMWebSocket::EventQueue::UnpauseTask() {}

void DOMWebSocket::EventQueue::Trace(Visitor* visitor) const {}

static void SetInvalidStateErrorForSendMethod(ExceptionState& exception_state) {}

constexpr WebSocketCommon::State DOMWebSocket::kConnecting;
constexpr WebSocketCommon::State DOMWebSocket::kOpen;
constexpr WebSocketCommon::State DOMWebSocket::kClosing;
constexpr WebSocketCommon::State DOMWebSocket::kClosed;

DOMWebSocket::DOMWebSocket(ExecutionContext* context)
    :{}

DOMWebSocket::~DOMWebSocket() {}

void DOMWebSocket::LogError(const String& message) {}

DOMWebSocket* DOMWebSocket::Create(ExecutionContext* context,
                                   const String& url,
                                   ExceptionState& exception_state) {}

DOMWebSocket* DOMWebSocket::Create(
    ExecutionContext* context,
    const String& url,
    const V8UnionStringOrStringSequence* protocols,
    ExceptionState& exception_state) {}

void DOMWebSocket::Connect(const String& url,
                           const Vector<String>& protocols,
                           ExceptionState& exception_state) {}

void DOMWebSocket::UpdateBufferedAmountAfterClose(uint64_t payload_size) {}

void DOMWebSocket::PostBufferedAmountUpdateTask() {}

void DOMWebSocket::BufferedAmountUpdateTask() {}

void DOMWebSocket::ReflectBufferedAmountConsumption() {}

void DOMWebSocket::ReleaseChannel() {}

void DOMWebSocket::send(const String& message,
                        ExceptionState& exception_state) {}

void DOMWebSocket::send(DOMArrayBuffer* binary_data,
                        ExceptionState& exception_state) {}

void DOMWebSocket::send(NotShared<DOMArrayBufferView> array_buffer_view,
                        ExceptionState& exception_state) {}

void DOMWebSocket::send(Blob* binary_data, ExceptionState& exception_state) {}

void DOMWebSocket::close(uint16_t code,
                         const String& reason,
                         ExceptionState& exception_state) {}

void DOMWebSocket::close(ExceptionState& exception_state) {}

void DOMWebSocket::close(uint16_t code, ExceptionState& exception_state) {}

void DOMWebSocket::CloseInternal(std::optional<uint16_t> code,
                                 const String& reason,
                                 ExceptionState& exception_state) {}

const KURL& DOMWebSocket::url() const {}

WebSocketCommon::State DOMWebSocket::readyState() const {}

uint64_t DOMWebSocket::bufferedAmount() const {}

String DOMWebSocket::protocol() const {}

String DOMWebSocket::extensions() const {}

String DOMWebSocket::binaryType() const {}

void DOMWebSocket::setBinaryType(const String& binary_type) {}

const AtomicString& DOMWebSocket::InterfaceName() const {}

ExecutionContext* DOMWebSocket::GetExecutionContext() const {}

void DOMWebSocket::ContextDestroyed() {}

bool DOMWebSocket::HasPendingActivity() const {}

void DOMWebSocket::ContextLifecycleStateChanged(
    mojom::FrameLifecycleState state) {}

void DOMWebSocket::DidConnect(const String& subprotocol,
                              const String& extensions) {}

void DOMWebSocket::DidReceiveTextMessage(const String& msg) {}

void DOMWebSocket::DidReceiveBinaryMessage(
    const Vector<base::span<const char>>& data) {}

void DOMWebSocket::DidError() {}

void DOMWebSocket::DidConsumeBufferedAmount(uint64_t consumed) {}

void DOMWebSocket::DidStartClosingHandshake() {}

void DOMWebSocket::DidClose(
    ClosingHandshakeCompletionStatus closing_handshake_completion,
    uint16_t code,
    const String& reason) {}

void DOMWebSocket::NotifyWebSocketActivity() {}

void DOMWebSocket::Trace(Visitor* visitor) const {}

}  // namespace blink