summaryrefslogtreecommitdiffstats
path: root/dom/interfaces/json/nsIJSON.idl
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/interfaces/json/nsIJSON.idl
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/interfaces/json/nsIJSON.idl')
-rw-r--r--dom/interfaces/json/nsIJSON.idl61
1 files changed, 61 insertions, 0 deletions
diff --git a/dom/interfaces/json/nsIJSON.idl b/dom/interfaces/json/nsIJSON.idl
new file mode 100644
index 000000000..b09e4e069
--- /dev/null
+++ b/dom/interfaces/json/nsIJSON.idl
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "domstubs.idl"
+
+interface nsIInputStream;
+interface nsIOutputStream;
+interface nsIScriptGlobalObject;
+
+[ptr] native JSValPtr(JS::Value);
+[ptr] native JSContext(JSContext);
+
+%{C++
+#include "js/TypeDecls.h"
+%}
+
+/**
+ * Don't use this! Use JSON.parse and JSON.stringify directly.
+ */
+[scriptable, uuid(083aebb0-7790-43b2-ae81-9e404e626236)]
+interface nsIJSON : nsISupports
+{
+ /**
+ * New users should use JSON.stringify!
+ * The encode() method is only present for backward compatibility.
+ * encode() is not a conforming JSON stringify implementation!
+ */
+ [deprecated,implicit_jscontext,optional_argc]
+ AString encode([optional] in jsval value);
+
+ /**
+ * New users should use JSON.stringify.
+ * You may also want to have a look at nsIConverterOutputStream.
+ *
+ * The encodeToStream() method is only present for backward compatibility.
+ * encodeToStream() is not a conforming JSON stringify implementation!
+ */
+ [deprecated,implicit_jscontext,optional_argc]
+ void encodeToStream(in nsIOutputStream stream,
+ in string charset,
+ in boolean writeBOM,
+ [optional] in jsval value);
+
+ /**
+ * New users should use JSON.parse!
+ * The decode() method is only present for backward compatibility.
+ */
+ [deprecated,implicit_jscontext]
+ jsval decode(in AString str);
+
+ [implicit_jscontext]
+ jsval decodeFromStream(in nsIInputStream stream,
+ in long contentLength);
+
+ [noscript] AString encodeFromJSVal(in JSValPtr value, in JSContext cx);
+
+ // Make sure you GCroot the result of this function before using it.
+ [noscript] jsval decodeToJSVal(in AString str, in JSContext cx);
+};