dom/interfaces/base/nsIStructuredCloneContainer.idlScriptable
This interface acts as a container for an object serialized using the structured clone algorithm.
1.0
66
Introduced
Gecko 6.0
Inherits from: nsISupports Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3)

You can copy an object into an nsIStructuredCloneContainer using initFromVariant() or initFromBase64(). it is an error to initialize an nsIStructuredCloneContainer more than once.

Once you've initialized the container, you can get a copy of the object it stores by calling deserializeToVariant(). You can also get a base-64-encoded string containing a copy of the container's serialized data, using getDataAsBase64().

Method overview

nsIVariant deserializeToVariant();
AString getDataAsBase64();
void initFromBase64(in AString aData,in unsigned long aFormatVersion);
void initFromVariant(in nsIVariant aData);

Attributes

Attribute Type Description
formatVersion unsigned long Get the version of the structured clone algorithm which was used to generate this container's serialized buffer. Read only.
serializedNBytes unsigned long long Get the size in bytes of this container's serialized data. Read only.

Methods

deserializeToVariant()

Deserialize the object this container holds, returning it wrapped as an nsIVariant.

nsIVariant deserializeToVariant();
Parameters

None.

Return value

An nsIVariant.

getDataAsBase64()

Get this structured clone container's data as a base-64-encoded string.

AString getDataAsBase64();
Parameters

None.

Return value

A base-64-encoded string.

initFromBase64()

Initialize this structured clone container from a base-64-encoded byte stream.

void initFromBase64(
  in AString aData,
  in unsigned long aFormatVersion
);
Parameters
aData
A base-64-encoded byte stream.
aFormatVersion
The version of the structured clone algorithm which was used to generate aData.

initFromVariant()

Initialize this structured clone container so it contains a clone of the given variant.

void initFromVariant(
  in nsIVariant aData
);
Parameters
aData
A nsIVariant, must be backed by a jsval.