chromium/third_party/blink/public/mojom/messaging/cloneable_message.mojom

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module blink.mojom;

import "mojo/public/mojom/base/big_buffer.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "third_party/blink/public/mojom/blob/serialized_blob.mojom";
import "third_party/blink/public/mojom/file_system_access/file_system_access_transfer_token.mojom";
import "url/mojom/origin.mojom";

// This struct represents the cloneable part of messages that are sent across
// postMessage style APIs. In particular this is used for BroadcastChannel.
struct CloneableMessage {
  mojo_base.mojom.BigBuffer encoded_message;
  // Blob handles for any blobs being sent in this message.
  array<SerializedBlob> blobs;
  // Populated by message senders to prevent remote origins from accessing
  // |file_system_access_tokens|. Tokens from a remote origin must fail by
  // dispatching a 'messageerror' event instead of a 'message' event. If
  // somehow a compromised process bypasses this origin check, the
  // FileSystemAccessManager in the browser process performs another origin
  // check that will prevent the use of remote origin FileSystemAccessHandles.
  //
  // The message sender may leave |sender_origin| null. When |sender_origin| is
  // null, the message receiver must handle the message like it is from an
  // unknown remote origin by dispatching the 'messageerror' event when
  // |file_system_access_tokens| is not an empty array.
  url.mojom.Origin? sender_origin;
  // Stack trace captured by sender.
  // For more details see v8_inspector::V8StackTraceId.
  // TODO(kozyatinskiy): move this to separate headers as soon as we get
  // separate inspector folder.
  uint64 stack_trace_id;
  int64 stack_trace_debugger_id_first;
  int64 stack_trace_debugger_id_second;
  bool stack_trace_should_pause;
  // The sender's agent cluster ID.
  // See https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-agent-cluster-formalism
  mojo_base.mojom.UnguessableToken sender_agent_cluster_id;
  // If true, this message is locked to the sender agent cluster ID.
  bool locked_to_sender_agent_cluster;
  // Tokens required to clone FileSystemFileHandles and/or
  // FileSystemDirectoryHandles.
  array<pending_remote<FileSystemAccessTransferToken>> file_system_access_tokens;
};