dom/xbl/nsXBLSerialize.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:015cc89de69f
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/. */
5
6 #ifndef nsXBLSerialize_h__
7 #define nsXBLSerialize_h__
8
9 #include "nsIObjectInputStream.h"
10 #include "nsIObjectOutputStream.h"
11 #include "nsNameSpaceManager.h"
12 #include "js/TypeDecls.h"
13
14 typedef uint8_t XBLBindingSerializeDetails;
15
16 // A version number to ensure we don't load cached data in a different
17 // file format.
18 #define XBLBinding_Serialize_Version 0x00000003
19
20 // Set for the first binding in a document
21 #define XBLBinding_Serialize_IsFirstBinding 1
22
23 // Set to indicate that nsXBLPrototypeBinding::mInheritStyle should be true
24 #define XBLBinding_Serialize_InheritStyle 2
25
26 // Set to indicate that nsXBLPrototypeBinding::mChromeOnlyContent should be true
27 #define XBLBinding_Serialize_ChromeOnlyContent 4
28
29 // Appears at the end of the serialized data to indicate that no more bindings
30 // are present for this document.
31 #define XBLBinding_Serialize_NoMoreBindings 0x80
32
33 // Implementation member types. The serialized value for each member contains one
34 // of these values, combined with the read-only flag XBLBinding_Serialize_ReadOnly.
35 // Use XBLBinding_Serialize_Mask to filter out the read-only flag and check for
36 // just the member type.
37 #define XBLBinding_Serialize_NoMoreItems 0 // appears at the end of the members list
38 #define XBLBinding_Serialize_Field 1
39 #define XBLBinding_Serialize_GetterProperty 2
40 #define XBLBinding_Serialize_SetterProperty 3
41 #define XBLBinding_Serialize_GetterSetterProperty 4
42 #define XBLBinding_Serialize_Method 5
43 #define XBLBinding_Serialize_Constructor 6
44 #define XBLBinding_Serialize_Destructor 7
45 #define XBLBinding_Serialize_Handler 8
46 #define XBLBinding_Serialize_Image 9
47 #define XBLBinding_Serialize_Stylesheet 10
48 #define XBLBinding_Serialize_Attribute 0xA
49 #define XBLBinding_Serialize_Mask 0x0F
50 #define XBLBinding_Serialize_ReadOnly 0x80
51
52 // Appears at the end of the list of insertion points to indicate that there
53 // are no more.
54 #define XBLBinding_Serialize_NoMoreInsertionPoints 0xFFFFFFFF
55
56 // When serializing content nodes, a single-byte namespace id is written out
57 // first. The special values below can appear in place of a namespace id.
58
59 // Indicates that this is not one of the built-in namespaces defined in
60 // nsNameSpaceManager.h. The string form will be serialized immediately
61 // following.
62 #define XBLBinding_Serialize_CustomNamespace 0xFE
63
64 // Flags to indicate a non-element node. Otherwise, it is an element.
65 #define XBLBinding_Serialize_TextNode 0xFB
66 #define XBLBinding_Serialize_CDATANode 0xFC
67 #define XBLBinding_Serialize_CommentNode 0xFD
68
69 // Indicates that there is no content to serialize/deserialize
70 #define XBLBinding_Serialize_NoContent 0xFF
71
72 // Appears at the end of the forwarded attributes list to indicate that there
73 // are no more attributes.
74 #define XBLBinding_Serialize_NoMoreAttributes 0xFF
75
76 static_assert(XBLBinding_Serialize_CustomNamespace >= kNameSpaceID_LastBuiltin,
77 "The custom namespace should not be in use as a real namespace");
78
79 nsresult
80 XBL_SerializeFunction(nsIObjectOutputStream* aStream,
81 JS::Handle<JSObject*> aFunctionObject);
82
83 nsresult
84 XBL_DeserializeFunction(nsIObjectInputStream* aStream,
85 JS::MutableHandle<JSObject*> aFunctionObject);
86
87 #endif // nsXBLSerialize_h__

mercurial