Bumping manifests a=b2g-bump
[gecko.git] / dom / xbl / nsXBLSerialize.h
blob6cef7a9a382638a095f9dc058a45a567e727fc8d
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsXBLSerialize_h__
7 #define nsXBLSerialize_h__
9 #include "nsIObjectInputStream.h"
10 #include "nsIObjectOutputStream.h"
11 #include "mozilla/dom/NameSpaceConstants.h"
12 #include "js/TypeDecls.h"
14 typedef uint8_t XBLBindingSerializeDetails;
16 // A version number to ensure we don't load cached data in a different
17 // file format.
18 #define XBLBinding_Serialize_Version 0x00000004
20 // Set for the first binding in a document
21 #define XBLBinding_Serialize_IsFirstBinding 1
23 // Set to indicate that nsXBLPrototypeBinding::mInheritStyle should be true
24 #define XBLBinding_Serialize_InheritStyle 2
26 // Set to indicate that nsXBLPrototypeBinding::mChromeOnlyContent should be true
27 #define XBLBinding_Serialize_ChromeOnlyContent 4
29 // Set to indicate that nsXBLPrototypeBinding::mBindToUntrustedContent should be true
30 #define XBLBinding_Serialize_BindToUntrustedContent 8
32 // Appears at the end of the serialized data to indicate that no more bindings
33 // are present for this document.
34 #define XBLBinding_Serialize_NoMoreBindings 0x80
36 // Implementation member types. The serialized value for each member contains one
37 // of these values, combined with the read-only flag XBLBinding_Serialize_ReadOnly.
38 // Use XBLBinding_Serialize_Mask to filter out the read-only flag and check for
39 // just the member type.
40 #define XBLBinding_Serialize_NoMoreItems 0 // appears at the end of the members list
41 #define XBLBinding_Serialize_Field 1
42 #define XBLBinding_Serialize_GetterProperty 2
43 #define XBLBinding_Serialize_SetterProperty 3
44 #define XBLBinding_Serialize_GetterSetterProperty 4
45 #define XBLBinding_Serialize_Method 5
46 #define XBLBinding_Serialize_Constructor 6
47 #define XBLBinding_Serialize_Destructor 7
48 #define XBLBinding_Serialize_Handler 8
49 #define XBLBinding_Serialize_Image 9
50 #define XBLBinding_Serialize_Stylesheet 10
51 #define XBLBinding_Serialize_Attribute 0xA
52 #define XBLBinding_Serialize_Mask 0x0F
53 #define XBLBinding_Serialize_ReadOnly 0x80
55 // Appears at the end of the list of insertion points to indicate that there
56 // are no more.
57 #define XBLBinding_Serialize_NoMoreInsertionPoints 0xFFFFFFFF
59 // When serializing content nodes, a single-byte namespace id is written out
60 // first. The special values below can appear in place of a namespace id.
62 // Indicates that this is not one of the built-in namespaces defined in
63 // nsNameSpaceManager.h. The string form will be serialized immediately
64 // following.
65 #define XBLBinding_Serialize_CustomNamespace 0xFE
67 // Flags to indicate a non-element node. Otherwise, it is an element.
68 #define XBLBinding_Serialize_TextNode 0xFB
69 #define XBLBinding_Serialize_CDATANode 0xFC
70 #define XBLBinding_Serialize_CommentNode 0xFD
72 // Indicates that there is no content to serialize/deserialize
73 #define XBLBinding_Serialize_NoContent 0xFF
75 // Appears at the end of the forwarded attributes list to indicate that there
76 // are no more attributes.
77 #define XBLBinding_Serialize_NoMoreAttributes 0xFF
79 static_assert(XBLBinding_Serialize_CustomNamespace >= kNameSpaceID_LastBuiltin,
80 "The custom namespace should not be in use as a real namespace");
82 nsresult
83 XBL_SerializeFunction(nsIObjectOutputStream* aStream,
84 JS::Handle<JSObject*> aFunctionObject);
86 nsresult
87 XBL_DeserializeFunction(nsIObjectInputStream* aStream,
88 JS::MutableHandle<JSObject*> aFunctionObject);
90 #endif // nsXBLSerialize_h__