nsXBLSerialize.h 3.6 KB

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