Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / chrome-webidl / StructuredCloneHolder.webidl
blob4487b2f58eaf14f34c5534abb7b906ef8444f048
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  */
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);
31   /**
32    * Deserializes the structured clone data in the scope of the given global,
33    * and returns the result.
34    *
35    * If `keepData` is true, the structured clone data is preserved, and can be
36    * deserialized repeatedly. Otherwise, it is immediately discarded.
37    */
38   [Throws]
39   any deserialize(object global, optional boolean keepData = false);