tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

StructuredCloneHolder.webidl (1857B)


      1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      4 * You can obtain one at http://mozilla.org/MPL/2.0/.
      5 */
      6 
      7 /**
      8 * A holder for structured-clonable data which can itself be cloned with
      9 * little overhead, and deserialized into an arbitrary global.
     10 */
     11 [ChromeOnly, Exposed=*]
     12 interface StructuredCloneHolder {
     13  /**
     14   * Serializes the given value to an opaque structured clone blob, and
     15   * returns the result.
     16   *
     17   * The serialization happens in the compartment of the given global or, if no
     18   * global is provided, the compartment of the data value.
     19   *
     20   * The name argument is added to the path of the object in
     21   * memory reports, to make it easier to determine the source of leaks. In
     22   * anonymized memory reports, the anonymized name is used instead. If
     23   * anonymizedName is null, name is used in anonymized reports as well.
     24   * Anonymized names should not contain any potentially private information,
     25   * such as web URLs or user-provided data.
     26   */
     27  [Throws]
     28  constructor(UTF8String name, UTF8String? anonymizedName,
     29              any data, optional object? global = null);
     30 
     31  /**
     32   * Returns the size of serialized data in bytes. Note that this is smaller
     33   * than the actual size of the object in memory, because of buffer sizes etc.
     34   */
     35  readonly attribute unsigned long long dataSize;
     36 
     37  /**
     38   * Deserializes the structured clone data in the scope of the given global,
     39   * and returns the result.
     40   *
     41   * If `keepData` is true, the structured clone data is preserved, and can be
     42   * deserialized repeatedly. Otherwise, it is immediately discarded.
     43   */
     44  [Throws]
     45  any deserialize(object global, optional boolean keepData = false);
     46 };