1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xbl/nsXBLSerialize.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsXBLSerialize_h__ 1.10 +#define nsXBLSerialize_h__ 1.11 + 1.12 +#include "nsIObjectInputStream.h" 1.13 +#include "nsIObjectOutputStream.h" 1.14 +#include "nsNameSpaceManager.h" 1.15 +#include "js/TypeDecls.h" 1.16 + 1.17 +typedef uint8_t XBLBindingSerializeDetails; 1.18 + 1.19 +// A version number to ensure we don't load cached data in a different 1.20 +// file format. 1.21 +#define XBLBinding_Serialize_Version 0x00000003 1.22 + 1.23 +// Set for the first binding in a document 1.24 +#define XBLBinding_Serialize_IsFirstBinding 1 1.25 + 1.26 +// Set to indicate that nsXBLPrototypeBinding::mInheritStyle should be true 1.27 +#define XBLBinding_Serialize_InheritStyle 2 1.28 + 1.29 +// Set to indicate that nsXBLPrototypeBinding::mChromeOnlyContent should be true 1.30 +#define XBLBinding_Serialize_ChromeOnlyContent 4 1.31 + 1.32 +// Appears at the end of the serialized data to indicate that no more bindings 1.33 +// are present for this document. 1.34 +#define XBLBinding_Serialize_NoMoreBindings 0x80 1.35 + 1.36 +// Implementation member types. The serialized value for each member contains one 1.37 +// of these values, combined with the read-only flag XBLBinding_Serialize_ReadOnly. 1.38 +// Use XBLBinding_Serialize_Mask to filter out the read-only flag and check for 1.39 +// just the member type. 1.40 +#define XBLBinding_Serialize_NoMoreItems 0 // appears at the end of the members list 1.41 +#define XBLBinding_Serialize_Field 1 1.42 +#define XBLBinding_Serialize_GetterProperty 2 1.43 +#define XBLBinding_Serialize_SetterProperty 3 1.44 +#define XBLBinding_Serialize_GetterSetterProperty 4 1.45 +#define XBLBinding_Serialize_Method 5 1.46 +#define XBLBinding_Serialize_Constructor 6 1.47 +#define XBLBinding_Serialize_Destructor 7 1.48 +#define XBLBinding_Serialize_Handler 8 1.49 +#define XBLBinding_Serialize_Image 9 1.50 +#define XBLBinding_Serialize_Stylesheet 10 1.51 +#define XBLBinding_Serialize_Attribute 0xA 1.52 +#define XBLBinding_Serialize_Mask 0x0F 1.53 +#define XBLBinding_Serialize_ReadOnly 0x80 1.54 + 1.55 +// Appears at the end of the list of insertion points to indicate that there 1.56 +// are no more. 1.57 +#define XBLBinding_Serialize_NoMoreInsertionPoints 0xFFFFFFFF 1.58 + 1.59 +// When serializing content nodes, a single-byte namespace id is written out 1.60 +// first. The special values below can appear in place of a namespace id. 1.61 + 1.62 +// Indicates that this is not one of the built-in namespaces defined in 1.63 +// nsNameSpaceManager.h. The string form will be serialized immediately 1.64 +// following. 1.65 +#define XBLBinding_Serialize_CustomNamespace 0xFE 1.66 + 1.67 +// Flags to indicate a non-element node. Otherwise, it is an element. 1.68 +#define XBLBinding_Serialize_TextNode 0xFB 1.69 +#define XBLBinding_Serialize_CDATANode 0xFC 1.70 +#define XBLBinding_Serialize_CommentNode 0xFD 1.71 + 1.72 +// Indicates that there is no content to serialize/deserialize 1.73 +#define XBLBinding_Serialize_NoContent 0xFF 1.74 + 1.75 +// Appears at the end of the forwarded attributes list to indicate that there 1.76 +// are no more attributes. 1.77 +#define XBLBinding_Serialize_NoMoreAttributes 0xFF 1.78 + 1.79 +static_assert(XBLBinding_Serialize_CustomNamespace >= kNameSpaceID_LastBuiltin, 1.80 + "The custom namespace should not be in use as a real namespace"); 1.81 + 1.82 +nsresult 1.83 +XBL_SerializeFunction(nsIObjectOutputStream* aStream, 1.84 + JS::Handle<JSObject*> aFunctionObject); 1.85 + 1.86 +nsresult 1.87 +XBL_DeserializeFunction(nsIObjectInputStream* aStream, 1.88 + JS::MutableHandle<JSObject*> aFunctionObject); 1.89 + 1.90 +#endif // nsXBLSerialize_h__