Bug 1053398 - save xbl bindtountrustedcontent to xul cache as a flag, r=bholley,smaug
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 13 Aug 2014 23:45:36 +0100
changeset 209073 0a9a9fe9853873911bcaca45859132aabe98f060
parent 209072 8ee163409ca1b297285e5dbe194bf80b73b699e9
child 209074 709185909884e096b4c7d093b83c5865d6762333
push idunknown
push userunknown
push dateunknown
reviewersbholley, smaug
bugs1053398
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1053398 - save xbl bindtountrustedcontent to xul cache as a flag, r=bholley,smaug
dom/xbl/nsXBLPrototypeBinding.cpp
dom/xbl/nsXBLPrototypeBinding.h
dom/xbl/nsXBLSerialize.h
--- a/dom/xbl/nsXBLPrototypeBinding.cpp
+++ b/dom/xbl/nsXBLPrototypeBinding.cpp
@@ -849,16 +849,18 @@ nsresult
 nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
                             nsXBLDocumentInfo* aDocInfo,
                             nsIDocument* aDocument,
                             uint8_t aFlags)
 {
   mInheritStyle = (aFlags & XBLBinding_Serialize_InheritStyle) ? true : false;
   mChromeOnlyContent =
     (aFlags & XBLBinding_Serialize_ChromeOnlyContent) ? true : false;
+  mBindToUntrustedContent =
+    (aFlags & XBLBinding_Serialize_BindToUntrustedContent) ? true : false;
 
   // nsXBLContentSink::ConstructBinding doesn't create a binding with an empty
   // id, so we don't here either.
   nsAutoCString id;
   nsresult rv = aStream->ReadCString(id);
 
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(!id.IsEmpty(), NS_ERROR_FAILURE);
@@ -1072,16 +1074,20 @@ nsXBLPrototypeBinding::Write(nsIObjectOu
   if (mAlternateBindingURI) {
     flags |= XBLBinding_Serialize_IsFirstBinding;
   }
 
   if (mChromeOnlyContent) {
     flags |= XBLBinding_Serialize_ChromeOnlyContent;
   }
 
+  if (mBindToUntrustedContent) {
+    flags |= XBLBinding_Serialize_BindToUntrustedContent;
+  }
+
   nsresult rv = aStream->Write8(flags);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString id;
   mBindingURI->GetRef(id);
   rv = aStream->WriteStringZ(id.get());
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/dom/xbl/nsXBLPrototypeBinding.h
+++ b/dom/xbl/nsXBLPrototypeBinding.h
@@ -159,16 +159,18 @@ private:
   /**
    * Read a new binding from the stream aStream into the xbl document aDocument.
    * aDocInfo should be the xbl document info for the binding document.
    * aFlags can contain XBLBinding_Serialize_InheritStyle to indicate that
    * mInheritStyle flag should be set, and XBLBinding_Serialize_IsFirstBinding
    * to indicate the first binding in a document.
    * XBLBinding_Serialize_ChromeOnlyContent indicates that
    * nsXBLPrototypeBinding::mChromeOnlyContent should be true.
+   * XBLBinding_Serialize_BindToUntrustedContent indicates that
+   * nsXBLPrototypeBinding::mBindToUntrustedContent should be true.
    */
 public:
   static nsresult ReadNewBinding(nsIObjectInputStream* aStream,
                                  nsXBLDocumentInfo* aDocInfo,
                                  nsIDocument* aDocument,
                                  uint8_t aFlags);
 
   /**
--- a/dom/xbl/nsXBLSerialize.h
+++ b/dom/xbl/nsXBLSerialize.h
@@ -10,27 +10,30 @@
 #include "nsIObjectOutputStream.h"
 #include "mozilla/dom/NameSpaceConstants.h"
 #include "js/TypeDecls.h"
 
 typedef uint8_t XBLBindingSerializeDetails;
 
 // A version number to ensure we don't load cached data in a different
 // file format.
-#define XBLBinding_Serialize_Version 0x00000003
+#define XBLBinding_Serialize_Version 0x00000004
 
 // Set for the first binding in a document
 #define XBLBinding_Serialize_IsFirstBinding 1
 
 // Set to indicate that nsXBLPrototypeBinding::mInheritStyle should be true
 #define XBLBinding_Serialize_InheritStyle 2
 
 // Set to indicate that nsXBLPrototypeBinding::mChromeOnlyContent should be true
 #define XBLBinding_Serialize_ChromeOnlyContent 4
 
+// Set to indicate that nsXBLPrototypeBinding::mBindToUntrustedContent should be true
+#define XBLBinding_Serialize_BindToUntrustedContent 8
+
 // Appears at the end of the serialized data to indicate that no more bindings
 // are present for this document.
 #define XBLBinding_Serialize_NoMoreBindings 0x80
 
 // Implementation member types. The serialized value for each member contains one
 // of these values, combined with the read-only flag XBLBinding_Serialize_ReadOnly.
 // Use XBLBinding_Serialize_Mask to filter out the read-only flag and check for
 // just the member type.