Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
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/. */
8 #include "nsISupports.idl"
10 interface nsIVariant;
11 interface nsIDocument;
13 %{C++
14 #include "js/TypeDecls.h"
15 %}
17 /**
18 * This interface acts as a container for an object serialized using the
19 * structured clone algorithm.
20 *
21 * You can copy an object into an nsIStructuredCloneContainer using
22 * initFromVariant or initFromBase64. It's an error to initialize an
23 * nsIStructuredCloneContainer more than once.
24 *
25 * Once you've initialized the container, you can get a copy of the object it
26 * stores by calling deserializeToVariant. You can also get a base-64-encoded
27 * string containing a copy of the container's serialized data, using
28 * getDataAsBase64.
29 */
30 [scriptable, uuid(c8852f01-4c05-47c3-acca-253a958f39f6)]
31 interface nsIStructuredCloneContainer : nsISupports
32 {
33 /**
34 * Initialize this structured clone container so it contains a clone of the
35 * given jsval.
36 */
37 [noscript, implicit_jscontext]
38 void initFromJSVal(in jsval aData);
40 /**
41 * Initialize this structured clone container from a base-64-encoded byte
42 * stream, stored in aData. aFormatVersion should be the version of the
43 * structured clone algorithm which was used to generate aData.
44 */
45 [implicit_jscontext]
46 void initFromBase64(in AString aData,in unsigned long aFormatVersion);
48 /**
49 * Deserialize the object this conatiner holds, returning it wrapped as
50 * an nsIVariant.
51 */
52 [implicit_jscontext]
53 nsIVariant deserializeToVariant();
55 /**
56 * Get this structured clone container's data as a base-64-encoded string.
57 */
58 AString getDataAsBase64();
60 /**
61 * Get the size in bytes of this container's serialized data.
62 */
63 readonly attribute unsigned long long serializedNBytes;
65 /**
66 * Get the version of the structured clone algorithm which was used to
67 * generate this container's serialized buffer.
68 */
69 readonly attribute unsigned long formatVersion;
70 };