tor-browser

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

nsIStructuredCloneContainer.idl (2178B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
      2 * vim: set ts=8 sw=2 et tw=80:
      3 *
      4 * This Source Code Form is subject to the terms of the Mozilla Public
      5 * License, v. 2.0. If a copy of the MPL was not distributed with this
      6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      7 
      8 #include "nsISupports.idl"
      9 
     10 interface nsIVariant;
     11 
     12 %{C++
     13 #include "js/TypeDecls.h"
     14 %}
     15 
     16 /**
     17 * This interface acts as a container for an object serialized using the
     18 * structured clone algorithm.
     19 *
     20 * You can copy an object into an nsIStructuredCloneContainer using
     21 * initFromJSVal or initFromBase64.  It's an error to initialize an
     22 * nsIStructuredCloneContainer more than once.
     23 *
     24 * Once you've initialized the container, you can get a copy of the object it
     25 * stores by calling deserializeToVariant.  You can also get a base-64-encoded
     26 * string containing a copy of the container's serialized data, using
     27 * getDataAsBase64.
     28 */
     29 [scriptable, uuid(c664aae7-0d67-4155-a2dd-a3861778626f)]
     30 interface nsIStructuredCloneContainer : nsISupports
     31 {
     32  /**
     33   * Initialize this structured clone container so it contains a clone of the
     34   * given jsval.
     35   */
     36  [noscript, implicit_jscontext]
     37  void initFromJSVal(in jsval aData);
     38 
     39  /**
     40   * Initialize this structured clone container from a base-64-encoded byte
     41   * stream, stored in aData.  aFormatVersion should be the version of the
     42   * structured clone algorithm which was used to generate aData.
     43   */
     44  void initFromBase64(in AString aData, in unsigned long aFormatVersion);
     45 
     46  /**
     47   * Deserializes this structured clone container returning it as a jsval.
     48   * Can be called on main and worker threads.
     49   */
     50  [implicit_jscontext]
     51  jsval deserializeToJsval();
     52 
     53  /**
     54   * Get this structured clone container's data as a base-64-encoded string.
     55   */
     56  AString getDataAsBase64();
     57 
     58  /**
     59   * Get the size in bytes of this container's serialized data.
     60   */
     61  readonly attribute unsigned long long serializedNBytes;
     62 
     63  /**
     64   * Get the version of the structured clone algorithm which was used to
     65   * generate this container's serialized buffer.
     66   */
     67  readonly attribute unsigned long formatVersion;
     68 };