Bug 1363640 Part 3 - Strip whitespaces for files under dom/xbl. draft
authorTing-Yu Lin <tlin@mozilla.com>
Tue, 09 May 2017 20:45:11 -0700
changeset 583792 1c06b80333984576a92f32289a68160ca54f0cea
parent 583791 aea94616d571fa3726c52bf026d222b4ef7ea6ac
child 583793 c0ccbbb66db3b47f0ab170fa175826cd1f5970c1
push id60548
push userbmo:tlin@mozilla.com
push dateWed, 24 May 2017 17:00:28 +0000
bugs1363640
milestone55.0a1
Bug 1363640 Part 3 - Strip whitespaces for files under dom/xbl. MozReview-Commit-ID: 3WBsFIgFZU9
dom/xbl/nsBindingManager.cpp
dom/xbl/nsXBLContentSink.cpp
dom/xbl/nsXBLContentSink.h
dom/xbl/nsXBLDocumentInfo.cpp
dom/xbl/nsXBLProtoImpl.cpp
dom/xbl/nsXBLProtoImplField.cpp
dom/xbl/nsXBLProtoImplField.h
dom/xbl/nsXBLProtoImplProperty.cpp
dom/xbl/nsXBLProtoImplProperty.h
dom/xbl/nsXBLPrototypeHandler.cpp
dom/xbl/nsXBLPrototypeHandler.h
dom/xbl/nsXBLResourceLoader.cpp
dom/xbl/nsXBLResourceLoader.h
dom/xbl/nsXBLSerialize.h
dom/xbl/nsXBLWindowKeyHandler.cpp
--- a/dom/xbl/nsBindingManager.cpp
+++ b/dom/xbl/nsBindingManager.cpp
@@ -359,17 +359,17 @@ nsBindingManager::PostProcessAttachedQue
     mDocument->BlockOnload();
   }
 }
 
 // static
 void
 nsBindingManager::PostPAQEventCallback(nsITimer* aTimer, void* aClosure)
 {
-  RefPtr<nsBindingManager> mgr = 
+  RefPtr<nsBindingManager> mgr =
     already_AddRefed<nsBindingManager>(static_cast<nsBindingManager*>(aClosure));
   mgr->PostProcessAttachedQueueEvent();
   NS_RELEASE(aTimer);
 }
 
 void
 nsBindingManager::DoProcessAttachedQueue()
 {
--- a/dom/xbl/nsXBLContentSink.cpp
+++ b/dom/xbl/nsXBLContentSink.cpp
@@ -161,17 +161,17 @@ nsXBLContentSink::FlushText(bool aReleas
       }
     }
   }
 
   return nsXMLContentSink::FlushText(aReleaseTextNode);
 }
 
 NS_IMETHODIMP
-nsXBLContentSink::ReportError(const char16_t* aErrorText, 
+nsXBLContentSink::ReportError(const char16_t* aErrorText,
                               const char16_t* aSourceText,
                               nsIScriptError *aError,
                               bool *_retval)
 {
   NS_PRECONDITION(aError && aSourceText && aErrorText, "Check arguments!!!");
 
   // XXX FIXME This function overrides and calls on
   // nsXMLContentSink::ReportError, and probably should die.  See bug 347826.
@@ -186,18 +186,18 @@ nsXBLContentSink::ReportError(const char
   fprintf(stderr,
           "\n%s\n%s\n\n",
           NS_LossyConvertUTF16toASCII(aErrorText).get(),
           NS_LossyConvertUTF16toASCII(aSourceText).get());
 #endif
 
   // Most of what this does won't be too useful, but whatever...
   // nsXMLContentSink::ReportError will handle the console logging.
-  return nsXMLContentSink::ReportError(aErrorText, 
-                                       aSourceText, 
+  return nsXMLContentSink::ReportError(aErrorText,
+                                       aSourceText,
                                        aError,
                                        _retval);
 }
 
 nsresult
 nsXBLContentSink::ReportUnexpectedElement(nsIAtom* aElementName,
                                           uint32_t aLineNumber)
 {
@@ -240,40 +240,40 @@ nsXBLContentSink::AddField(nsXBLProtoImp
   if (mImplField)
     mImplField->SetNext(aField); // Already have a chain. Just append to the end.
   else
     mImplementation->SetFieldList(aField); // We're the first member in the chain.
 
   mImplField = aField; // Adjust our pointer to point to the new last field in the chain.
 }
 
-NS_IMETHODIMP 
-nsXBLContentSink::HandleStartElement(const char16_t *aName, 
-                                     const char16_t **aAtts, 
-                                     uint32_t aAttsCount, 
+NS_IMETHODIMP
+nsXBLContentSink::HandleStartElement(const char16_t *aName,
+                                     const char16_t **aAtts,
+                                     uint32_t aAttsCount,
                                      uint32_t aLineNumber)
 {
   nsresult rv = nsXMLContentSink::HandleStartElement(aName, aAtts, aAttsCount,
                                                      aLineNumber);
   if (NS_FAILED(rv))
     return rv;
 
   if (mState == eXBL_InBinding && !mBinding) {
     rv = ConstructBinding(aLineNumber);
     if (NS_FAILED(rv))
       return rv;
-    
+
     // mBinding may still be null, if the binding had no id.  If so,
     // we'll deal with that later in the sink.
   }
 
   return rv;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsXBLContentSink::HandleEndElement(const char16_t *aName)
 {
   FlushText();
 
   if (mState != eXBL_InDocument) {
     int32_t nameSpaceID;
     nsCOMPtr<nsIAtom> prefix, localName;
     nsContentUtils::SplitExpatName(aName, getter_AddRefs(prefix),
@@ -329,17 +329,17 @@ nsXBLContentSink::HandleEndElement(const
                  localName == nsGkAtoms::body)
           mSecondaryState = eXBL_InMethod;
         return NS_OK;
       }
       else if (mState == eXBL_InBindings &&
                localName == nsGkAtoms::bindings) {
         mState = eXBL_InDocument;
       }
-      
+
       nsresult rv = nsXMLContentSink::HandleEndElement(aName);
       if (NS_FAILED(rv))
         return rv;
 
       if (mState == eXBL_InBinding && localName == nsGkAtoms::binding) {
         mState = eXBL_InBindings;
         if (mBinding) {  // See comment in HandleStartElement()
           mBinding->Initialize();
@@ -349,41 +349,41 @@ nsXBLContentSink::HandleEndElement(const
 
       return NS_OK;
     }
   }
 
   return nsXMLContentSink::HandleEndElement(aName);
 }
 
-NS_IMETHODIMP 
-nsXBLContentSink::HandleCDataSection(const char16_t *aData, 
+NS_IMETHODIMP
+nsXBLContentSink::HandleCDataSection(const char16_t *aData,
                                      uint32_t aLength)
 {
   if (mState == eXBL_InHandlers || mState == eXBL_InImplementation)
     return AddText(aData, aLength);
   return nsXMLContentSink::HandleCDataSection(aData, aLength);
 }
 
 #define ENSURE_XBL_STATE(_cond)                                                       \
   PR_BEGIN_MACRO                                                                      \
     if (!(_cond)) { ReportUnexpectedElement(aTagName, aLineNumber); return true; } \
   PR_END_MACRO
 
-bool 
-nsXBLContentSink::OnOpenContainer(const char16_t **aAtts, 
-                                  uint32_t aAttsCount, 
-                                  int32_t aNameSpaceID, 
+bool
+nsXBLContentSink::OnOpenContainer(const char16_t **aAtts,
+                                  uint32_t aAttsCount,
+                                  int32_t aNameSpaceID,
                                   nsIAtom* aTagName,
                                   uint32_t aLineNumber)
 {
   if (mState == eXBL_Error) {
     return true;
   }
-  
+
   if (aNameSpaceID != kNameSpaceID_XBL) {
     // Construct non-XBL nodes
     return true;
   }
 
   bool ret = true;
   if (aTagName == nsGkAtoms::bindings) {
     ENSURE_XBL_STATE(mState == eXBL_InDocument);
@@ -444,17 +444,17 @@ nsXBLContentSink::OnOpenContainer(const 
     ConstructImplementation(aAtts);
     // Note that this mState will cause us to return false, so no need
     // to set ret to false.
   }
   else if (aTagName == nsGkAtoms::constructor) {
     ENSURE_XBL_STATE(mState == eXBL_InImplementation &&
                      mSecondaryState == eXBL_None);
     NS_ASSERTION(mBinding, "Must have binding here");
-      
+
     mSecondaryState = eXBL_InConstructor;
     nsAutoString name;
     if (!mCurrentBindingID.IsEmpty()) {
       name.Assign(mCurrentBindingID);
       name.AppendLiteral("_XBL_Constructor");
     } else {
       name.AppendLiteral("XBL_Constructor");
     }
@@ -695,17 +695,17 @@ nsXBLContentSink::ConstructResource(cons
 }
 
 void
 nsXBLContentSink::ConstructImplementation(const char16_t **aAtts)
 {
   mImplementation = nullptr;
   mImplMember = nullptr;
   mImplField = nullptr;
-  
+
   if (!mBinding)
     return;
 
   const char16_t* name = nullptr;
 
   nsCOMPtr<nsIAtom> prefix, localName;
   for (; *aAtts; aAtts += 2) {
     int32_t nameSpaceID;
@@ -875,30 +875,30 @@ nsXBLContentSink::CreateElement(const ch
 
   Element* result;
   nsresult rv = nsXULElement::Create(prototype, mDocument, false, false, &result);
   *aResult = result;
   return rv;
 #endif
 }
 
-nsresult 
+nsresult
 nsXBLContentSink::AddAttributes(const char16_t** aAtts,
                                 nsIContent* aContent)
 {
   if (aContent->IsXULElement())
     return NS_OK; // Nothing to do, since the proto already has the attrs.
 
   return nsXMLContentSink::AddAttributes(aAtts, aContent);
 }
 
 #ifdef MOZ_XUL
 nsresult
-nsXBLContentSink::AddAttributesToXULPrototype(const char16_t **aAtts, 
-                                              uint32_t aAttsCount, 
+nsXBLContentSink::AddAttributesToXULPrototype(const char16_t **aAtts,
+                                              uint32_t aAttsCount,
                                               nsXULPrototypeElement* aElement)
 {
   // Add tag attributes to the element
   nsresult rv;
 
   // Create storage for the attributes
   nsXULPrototypeAttribute* attrs = nullptr;
   if (aAttsCount > 0) {
@@ -906,32 +906,32 @@ nsXBLContentSink::AddAttributesToXULProt
   }
 
   aElement->mAttributes    = attrs;
   aElement->mNumAttributes = aAttsCount;
 
   // Copy the attributes into the prototype
   nsCOMPtr<nsIAtom> prefix, localName;
 
-  uint32_t i;  
+  uint32_t i;
   for (i = 0; i < aAttsCount; ++i) {
     int32_t nameSpaceID;
     nsContentUtils::SplitExpatName(aAtts[i * 2], getter_AddRefs(prefix),
                                    getter_AddRefs(localName), &nameSpaceID);
 
     if (nameSpaceID == kNameSpaceID_None) {
       attrs[i].mName.SetTo(localName);
     }
     else {
       RefPtr<NodeInfo> ni;
       ni = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID,
                                          nsIDOMNode::ATTRIBUTE_NODE);
       attrs[i].mName.SetTo(ni);
     }
-    
+
     rv = aElement->SetAttrAt(i, nsDependentString(aAtts[i * 2 + 1]),
-                             mDocumentURI); 
+                             mDocumentURI);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 #endif
--- a/dom/xbl/nsXBLContentSink.h
+++ b/dom/xbl/nsXBLContentSink.h
@@ -48,90 +48,90 @@ class nsXULPrototypeElement;
 class nsXBLProtoImplMember;
 class nsXBLProtoImplProperty;
 class nsXBLProtoImplMethod;
 class nsXBLProtoImplField;
 class nsXBLPrototypeBinding;
 
 // The XBL content sink overrides the XML content sink to
 // builds its own lightweight data structures for the <resources>,
-// <handlers>, <implementation>, and 
+// <handlers>, <implementation>, and
 
 class nsXBLContentSink : public nsXMLContentSink {
 public:
   nsXBLContentSink();
   ~nsXBLContentSink();
 
   nsresult Init(nsIDocument* aDoc,
                 nsIURI* aURL,
                 nsISupports* aContainer);
 
   // nsIContentSink overrides
-  NS_IMETHOD HandleStartElement(const char16_t *aName, 
-                                const char16_t **aAtts, 
-                                uint32_t aAttsCount, 
+  NS_IMETHOD HandleStartElement(const char16_t *aName,
+                                const char16_t **aAtts,
+                                uint32_t aAttsCount,
                                 uint32_t aLineNumber) override;
 
   NS_IMETHOD HandleEndElement(const char16_t *aName) override;
-  
-  NS_IMETHOD HandleCDataSection(const char16_t *aData, 
+
+  NS_IMETHOD HandleCDataSection(const char16_t *aData,
                                 uint32_t aLength) override;
 
 protected:
     // nsXMLContentSink overrides
     virtual void MaybeStartLayout(bool aIgnorePendingSheets) override;
 
-    bool OnOpenContainer(const char16_t **aAtts, 
-                           uint32_t aAttsCount, 
-                           int32_t aNameSpaceID, 
+    bool OnOpenContainer(const char16_t **aAtts,
+                           uint32_t aAttsCount,
+                           int32_t aNameSpaceID,
                            nsIAtom* aTagName,
                            uint32_t aLineNumber) override;
 
     bool NotifyForDocElement() override { return false; }
 
     nsresult CreateElement(const char16_t** aAtts, uint32_t aAttsCount,
                            mozilla::dom::NodeInfo* aNodeInfo, uint32_t aLineNumber,
                            nsIContent** aResult, bool* aAppendContent,
                            mozilla::dom::FromParser aFromParser) override;
-    
-    nsresult AddAttributes(const char16_t** aAtts, 
+
+    nsresult AddAttributes(const char16_t** aAtts,
                            nsIContent* aContent) override;
 
-#ifdef MOZ_XUL    
-    nsresult AddAttributesToXULPrototype(const char16_t **aAtts, 
-                                         uint32_t aAttsCount, 
+#ifdef MOZ_XUL
+    nsresult AddAttributesToXULPrototype(const char16_t **aAtts,
+                                         uint32_t aAttsCount,
                                          nsXULPrototypeElement* aElement);
 #endif
 
     // Our own helpers for constructing XBL prototype objects.
     nsresult ConstructBinding(uint32_t aLineNumber);
     void ConstructHandler(const char16_t **aAtts, uint32_t aLineNumber);
     void ConstructResource(const char16_t **aAtts, nsIAtom* aResourceType);
     void ConstructImplementation(const char16_t **aAtts);
     void ConstructProperty(const char16_t **aAtts, uint32_t aLineNumber);
     void ConstructMethod(const char16_t **aAtts);
     void ConstructParameter(const char16_t **aAtts);
     void ConstructField(const char16_t **aAtts, uint32_t aLineNumber);
-  
+
 
   // nsXMLContentSink overrides
   nsresult FlushText(bool aReleaseTextNode = true) override;
 
   // nsIExpatSink overrides
   NS_IMETHOD ReportError(const char16_t* aErrorText,
                          const char16_t* aSourceText,
                          nsIScriptError *aError,
                          bool *_retval) override;
 
 protected:
   nsresult ReportUnexpectedElement(nsIAtom* aElementName, uint32_t aLineNumber);
 
   void AddMember(nsXBLProtoImplMember* aMember);
   void AddField(nsXBLProtoImplField* aField);
-  
+
   XBLPrimaryState mState;
   XBLSecondaryState mSecondaryState;
   nsXBLDocumentInfo* mDocInfo;
   bool mIsChromeOrResource; // For bug #45989
   bool mFoundFirstBinding;
 
   nsString mCurrentBindingID;
 
--- a/dom/xbl/nsXBLDocumentInfo.cpp
+++ b/dom/xbl/nsXBLDocumentInfo.cpp
@@ -205,17 +205,17 @@ nsXBLDocumentInfo::ReadPrototypeBindings
     return rv;
 
   nsCOMPtr<nsIObjectInputStream> stream;
   rv = NewObjectInputStreamFromBuffer(Move(buf), len, getter_AddRefs(stream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // The file compatibility.ini stores the build id. This is checked in
   // nsAppRunner.cpp and will delete the cache if a different build is
-  // present. However, we check that the version matches here to be safe. 
+  // present. However, we check that the version matches here to be safe.
   uint32_t version;
   rv = stream->Read32(&version);
   NS_ENSURE_SUCCESS(rv, rv);
   if (version != XBLBinding_Serialize_Version) {
     // The version that exists is different than expected, likely created with a
     // different build, so invalidate the cache.
     startupCache->InvalidateCache();
     return NS_ERROR_NOT_AVAILABLE;
--- a/dom/xbl/nsXBLProtoImpl.cpp
+++ b/dom/xbl/nsXBLProtoImpl.cpp
@@ -173,19 +173,19 @@ nsXBLProtoImpl::InstallImplementation(ns
   for (nsXBLProtoImplField* curr = mFields;
        curr;
        curr = curr->GetNext())
     curr->InstallAccessors(cx, targetClassObject);
 
   return NS_OK;
 }
 
-nsresult 
+nsresult
 nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
-                                  nsIContent* aBoundElement, 
+                                  nsIContent* aBoundElement,
                                   JS::MutableHandle<JSObject*> aTargetClassObject,
                                   bool* aTargetIsNew)
 {
   nsresult rv = NS_OK;
 
   if (!mPrecompiledMemberHolder) {
     rv = CompilePrototypeMembers(aBinding); // This is the first time we've ever installed this binding on an element.
                                  // We need to go ahead and compile all methods and properties on a class
@@ -234,18 +234,18 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLP
   aBoundElement->PreserveWrapper(aBoundElement);
 
   return rv;
 }
 
 nsresult
 nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding)
 {
-  // We want to pre-compile our implementation's members against a "prototype context". Then when we actually 
-  // bind the prototype to a real xbl instance, we'll clone the pre-compiled JS into the real instance's 
+  // We want to pre-compile our implementation's members against a "prototype context". Then when we actually
+  // bind the prototype to a real xbl instance, we'll clone the pre-compiled JS into the real instance's
   // context.
   AutoJSAPI jsapi;
   if (NS_WARN_IF(!jsapi.Init(xpc::CompilationScope())))
     return NS_ERROR_FAILURE;
   JSContext* cx = jsapi.cx();
 
   mPrecompiledMemberHolder = JS_NewObjectWithGivenProto(cx, nullptr, nullptr);
   if (!mPrecompiledMemberHolder)
@@ -509,18 +509,18 @@ nsXBLProtoImpl::Write(nsIObjectOutputStr
     }
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return aStream->Write8(XBLBinding_Serialize_NoMoreItems);
 }
 
 void
-NS_NewXBLProtoImpl(nsXBLPrototypeBinding* aBinding, 
-                   const char16_t* aClassName, 
+NS_NewXBLProtoImpl(nsXBLPrototypeBinding* aBinding,
+                   const char16_t* aClassName,
                    nsXBLProtoImpl** aResult)
 {
   nsXBLProtoImpl* impl = new nsXBLProtoImpl();
   if (aClassName) {
     impl->mClassName = aClassName;
   } else {
     nsCString spec;
     nsresult rv = aBinding->BindingURI()->GetSpec(spec);
--- a/dom/xbl/nsXBLProtoImplField.cpp
+++ b/dom/xbl/nsXBLProtoImplField.cpp
@@ -31,17 +31,17 @@ using namespace mozilla::dom;
 nsXBLProtoImplField::nsXBLProtoImplField(const char16_t* aName, const char16_t* aReadOnly)
   : mNext(nullptr),
     mFieldText(nullptr),
     mFieldTextLength(0),
     mLineNumber(0)
 {
   MOZ_COUNT_CTOR(nsXBLProtoImplField);
   mName = NS_strdup(aName);  // XXXbz make more sense to use a stringbuffer?
-  
+
   mJSAttributes = JSPROP_ENUMERATE;
   if (aReadOnly) {
     nsAutoString readOnly; readOnly.Assign(aReadOnly);
     if (readOnly.LowerCaseEqualsLiteral("true"))
       mJSAttributes |= JSPROP_READONLY;
   }
 }
 
@@ -63,17 +63,17 @@ nsXBLProtoImplField::~nsXBLProtoImplFiel
 {
   MOZ_COUNT_DTOR(nsXBLProtoImplField);
   if (mFieldText)
     free(mFieldText);
   free(mName);
   NS_CONTENT_DELETE_LIST_MEMBER(nsXBLProtoImplField, this, mNext);
 }
 
-void 
+void
 nsXBLProtoImplField::AppendFieldText(const nsAString& aText)
 {
   if (mFieldText) {
     nsDependentString fieldTextStr(mFieldText, mFieldTextLength);
     nsAutoString newFieldText = fieldTextStr + aText;
     char16_t* temp = mFieldText;
     mFieldText = ToNewUnicode(newFieldText);
     mFieldTextLength = newFieldText.Length();
--- a/dom/xbl/nsXBLProtoImplField.h
+++ b/dom/xbl/nsXBLProtoImplField.h
@@ -23,17 +23,17 @@ public:
   nsXBLProtoImplField(const char16_t* aName, const char16_t* aReadOnly);
   explicit nsXBLProtoImplField(const bool aIsReadOnly);
   ~nsXBLProtoImplField();
 
   void AppendFieldText(const nsAString& aText);
   void SetLineNumber(uint32_t aLineNumber) {
     mLineNumber = aLineNumber;
   }
-  
+
   nsXBLProtoImplField* GetNext() const { return mNext; }
   void SetNext(nsXBLProtoImplField* aNext) { mNext = aNext; }
 
   nsresult InstallField(JS::Handle<JSObject*> aBoundNode,
                         nsIURI* aBindingDocURI,
                         bool* aDidInstall) const;
 
   nsresult InstallAccessors(JSContext* aCx,
--- a/dom/xbl/nsXBLProtoImplProperty.cpp
+++ b/dom/xbl/nsXBLProtoImplProperty.cpp
@@ -78,26 +78,26 @@ nsXBLProtoImplProperty::~nsXBLProtoImplP
 void nsXBLProtoImplProperty::EnsureUncompiledText(PropertyOp& aPropertyOp)
 {
   if (!aPropertyOp.GetUncompiled()) {
     nsXBLTextWithLineNumber* text = new nsXBLTextWithLineNumber();
     aPropertyOp.SetUncompiled(text);
   }
 }
 
-void 
+void
 nsXBLProtoImplProperty::AppendGetterText(const nsAString& aText)
 {
   NS_PRECONDITION(!mIsCompiled,
                   "Must not be compiled when accessing getter text");
   EnsureUncompiledText(mGetter);
   mGetter.GetUncompiled()->AppendText(aText);
 }
 
-void 
+void
 nsXBLProtoImplProperty::AppendSetterText(const nsAString& aText)
 {
   NS_PRECONDITION(!mIsCompiled,
                   "Must not be compiled when accessing setter text");
   EnsureUncompiledText(mSetter);
   mSetter.GetUncompiled()->AppendText(aText);
 }
 
@@ -205,33 +205,33 @@ nsXBLProtoImplProperty::CompileMember(Au
       JS::AutoObjectVector emptyVector(cx);
       rv = nsJSUtils::CompileFunction(jsapi, emptyVector, options, name, 0,
                                       nullptr, getter, getterObject.address());
 
       delete getterText;
       deletedGetter = true;
 
       mGetter.SetJSFunction(getterObject);
-    
+
       if (mGetter.GetJSFunction() && NS_SUCCEEDED(rv)) {
         mJSAttributes |= JSPROP_GETTER | JSPROP_SHARED;
       }
       if (NS_FAILED(rv)) {
         mGetter.SetJSFunction(nullptr);
         mJSAttributes &= ~JSPROP_GETTER;
         /*chaining to return failure*/
       }
     }
   } // if getter is not empty
 
   if (!deletedGetter) {  // Empty getter
     delete getterText;
     mGetter.SetJSFunction(nullptr);
   }
-  
+
   if (NS_FAILED(rv)) {
     // We failed to compile our getter.  So either we've set it to null, or
     // it's still set to the text object.  In either case, it's safe to return
     // the error here, since then we'll be cleaned up as uncompiled and that
     // will be ok.  Going on and compiling the setter and _then_ returning an
     // error, on the other hand, will try to clean up a compiled setter as
     // uncompiled and crash.
     return rv;
--- a/dom/xbl/nsXBLProtoImplProperty.h
+++ b/dom/xbl/nsXBLProtoImplProperty.h
@@ -14,23 +14,23 @@
 #include "nsXBLSerialize.h"
 #include "nsXBLMaybeCompiled.h"
 #include "nsXBLProtoImplMember.h"
 
 class nsXBLProtoImplProperty: public nsXBLProtoImplMember
 {
 public:
   nsXBLProtoImplProperty(const char16_t* aName,
-                         const char16_t* aGetter, 
+                         const char16_t* aGetter,
                          const char16_t* aSetter,
                          const char16_t* aReadOnly,
                          uint32_t aLineNumber);
 
   nsXBLProtoImplProperty(const char16_t* aName, const bool aIsReadOnly);
- 
+
   virtual ~nsXBLProtoImplProperty();
 
   void AppendGetterText(const nsAString& aGetter);
   void AppendSetterText(const nsAString& aSetter);
 
   void SetGetterLineNumber(uint32_t aLineNumber);
   void SetSetterLineNumber(uint32_t aLineNumber);
 
@@ -50,17 +50,17 @@ protected:
 
   void EnsureUncompiledText(PropertyOp& aPropertyOp);
 
   // The raw text for the getter, or the JS object (after compilation).
   PropertyOp mGetter;
 
   // The raw text for the setter, or the JS object (after compilation).
   PropertyOp mSetter;
-  
+
   unsigned mJSAttributes;  // A flag for all our JS properties (getter/setter/readonly/shared/enum)
 
 #ifdef DEBUG
   bool mIsCompiled;
 #endif
 };
 
 #endif // nsXBLProtoImplProperty_h__
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -143,17 +143,17 @@ nsXBLPrototypeHandler::GetHandlerElement
     nsCOMPtr<nsIContent> element = do_QueryReferent(mHandlerElement);
     return element.forget();
   }
 
   return nullptr;
 }
 
 void
-nsXBLPrototypeHandler::AppendHandlerText(const nsAString& aText) 
+nsXBLPrototypeHandler::AppendHandlerText(const nsAString& aText)
 {
   if (mHandlerText) {
     // Append our text to the existing text.
     char16_t* temp = mHandlerText;
     mHandlerText = ToNewUnicode(nsDependentString(temp) + aText);
     free(temp);
   }
   else {
@@ -211,29 +211,29 @@ nsXBLPrototypeHandler::ExecuteHandler(Ev
   // events.
   if (isXULKey || isXBLCommand) {
     bool trustedEvent = false;
     aEvent->GetIsTrusted(&trustedEvent);
 
     if (!trustedEvent)
       return NS_OK;
   }
-    
+
   if (isXBLCommand) {
     return DispatchXBLCommand(aTarget, aEvent);
   }
 
   // If we're executing on a XUL key element, just dispatch a command
   // event at the element.  It will take care of retargeting it to its
   // command element, if applicable, and executing the event handler.
   if (isXULKey) {
     return DispatchXULKeyCommand(aEvent);
   }
 
-  // Look for a compiled handler on the element. 
+  // Look for a compiled handler on the element.
   // Should be compiled and bound with "on" in front of the name.
   nsCOMPtr<nsIAtom> onEventAtom = NS_Atomize(NS_LITERAL_STRING("onxbl") +
                                              nsDependentAtomString(mEventName));
 
   // Compile the handler and bind it to the element.
   nsCOMPtr<nsIScriptGlobalObject> boundGlobal;
   nsCOMPtr<nsPIWindowRoot> winRoot = do_QueryInterface(aTarget);
   if (winRoot) {
@@ -488,17 +488,17 @@ nsXBLPrototypeHandler::DispatchXBLComman
     // If the focus is in a form control, don't scroll.
     for (nsIContent* c = focusedContent; c; c = c->GetParent()) {
       nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(c);
       if (formControl) {
         return NS_OK;
       }
     }
   }
-  
+
   if (controller)
     controller->DoCommand(command.get());
 
   return NS_OK;
 }
 
 nsresult
 nsXBLPrototypeHandler::DispatchXULKeyCommand(nsIDOMEvent* aEvent)
@@ -719,24 +719,24 @@ void
 nsXBLPrototypeHandler::GetEventType(nsAString& aEvent)
 {
   nsCOMPtr<nsIContent> handlerElement = GetHandlerElement();
   if (!handlerElement) {
     aEvent.Truncate();
     return;
   }
   handlerElement->GetAttr(kNameSpaceID_None, nsGkAtoms::event, aEvent);
-  
+
   if (aEvent.IsEmpty() && (mType & NS_HANDLER_TYPE_XUL))
     // If no type is specified for a XUL <key> element, let's assume that we're "keypress".
     aEvent.AssignLiteral("keypress");
 }
 
 void
-nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement, 
+nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
                                           const char16_t* aEvent,
                                           const char16_t* aPhase,
                                           const char16_t* aAction,
                                           const char16_t* aCommand,
                                           const char16_t* aKeyCode,
                                           const char16_t* aCharCode,
                                           const char16_t* aModifiers,
                                           const char16_t* aButton,
@@ -785,28 +785,28 @@ nsXBLPrototypeHandler::ConstructPrototyp
     const nsDependentString phase(aPhase);
     if (phase.EqualsLiteral("capturing"))
       mPhase = NS_PHASE_CAPTURING;
     else if (phase.EqualsLiteral("target"))
       mPhase = NS_PHASE_TARGET;
   }
 
   // Button and clickcount apply only to XBL handlers and don't apply to XUL key
-  // handlers.  
+  // handlers.
   if (aButton && *aButton)
     mDetail = *aButton - '0';
 
   if (aClickCount && *aClickCount)
     mMisc = *aClickCount - '0';
 
-  // Modifiers are supported by both types of handlers (XUL and XBL).  
+  // Modifiers are supported by both types of handlers (XUL and XBL).
   nsAutoString modifiers(aModifiers);
   if (mType & NS_HANDLER_TYPE_XUL)
     aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::modifiers, modifiers);
-  
+
   if (!modifiers.IsEmpty()) {
     mKeyMask = cAllModifiers;
     char* str = ToNewCString(modifiers);
     char* newStr;
     char* token = nsCRT::strtok( str, ", \t", &newStr );
     while( token != nullptr ) {
       if (PL_strcmp(token, "shift") == 0)
         mKeyMask |= cShift | cShiftMask;
@@ -819,28 +819,28 @@ nsXBLPrototypeHandler::ConstructPrototyp
       else if (PL_strcmp(token, "control") == 0)
         mKeyMask |= cControl | cControlMask;
       else if (PL_strcmp(token, "accel") == 0)
         mKeyMask |= AccelKeyMask();
       else if (PL_strcmp(token, "access") == 0)
         mKeyMask |= KeyToMask(kMenuAccessKey);
       else if (PL_strcmp(token, "any") == 0)
         mKeyMask &= ~(mKeyMask << 5);
-    
+
       token = nsCRT::strtok( newStr, ", \t", &newStr );
     }
 
     free(str);
   }
 
   nsAutoString key(aCharCode);
   if (key.IsEmpty()) {
     if (mType & NS_HANDLER_TYPE_XUL) {
       aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::key, key);
-      if (key.IsEmpty()) 
+      if (key.IsEmpty())
         aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::charcode, key);
     }
   }
 
   if (!key.IsEmpty()) {
     if (mKeyMask == 0)
       mKeyMask = cAllModifiers;
     ToLowerCase(key);
@@ -861,17 +861,17 @@ nsXBLPrototypeHandler::ConstructPrototyp
         (('A' <= mDetail && mDetail <= 'Z') ||
          ('a' <= mDetail && mDetail <= 'z')))
       ReportKeyConflict(key.get(), modifiers.get(), aKeyElement, "WinConflict2");
   }
   else {
     key.Assign(aKeyCode);
     if (mType & NS_HANDLER_TYPE_XUL)
       aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, key);
-    
+
     if (!key.IsEmpty()) {
       if (mKeyMask == 0)
         mKeyMask = cAllModifiers;
       mDetail = GetMatchingKeyCode(key);
     }
   }
 
   if (aGroup && nsDependentString(aGroup).EqualsLiteral("system"))
@@ -964,17 +964,17 @@ nsXBLPrototypeHandler::Read(nsIObjectInp
   NS_ENSURE_SUCCESS(rv, rv);
   rv = aStream->Read8(&mType);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = aStream->Read8(&mMisc);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = aStream->Read32(reinterpret_cast<uint32_t*>(&mKeyMask));
   NS_ENSURE_SUCCESS(rv, rv);
-  uint32_t detail; 
+  uint32_t detail;
   rv = aStream->Read32(&detail);
   NS_ENSURE_SUCCESS(rv, rv);
   mDetail = detail;
 
   nsAutoString name;
   rv = aStream->ReadString(name);
   NS_ENSURE_SUCCESS(rv, rv);
   mEventName = NS_Atomize(name);
--- a/dom/xbl/nsXBLPrototypeHandler.h
+++ b/dom/xbl/nsXBLPrototypeHandler.h
@@ -211,32 +211,32 @@ protected:
     nsIWeakReference* mHandlerElement;  // For XUL <key> element handlers. [STRONG]
     char16_t*        mHandlerText;     // For XBL handlers (we don't build an
                                         // element for the <handler>, and instead
                                         // we cache the JS text or command name
                                         // that we should use.
   };
 
   uint32_t mLineNumber;  // The line number we started at in the XBL file
-  
+
   // The following four values make up 32 bits.
   uint8_t mPhase;            // The phase (capturing, bubbling)
   uint8_t mType;             // The type of the handler.  The handler is either a XUL key
                              // handler, an XBL "command" event, or a normal XBL event with
                              // accompanying JavaScript.  The high bit is used to indicate
                              // whether this handler should prevent the default action.
   uint8_t mMisc;             // Miscellaneous extra information.  For key events,
                              // stores whether or not we're a key code or char code.
                              // For mouse events, stores the clickCount.
 
   bool mReserved;            // <key> is reserved for chrome. Not used by handlers.
 
   int32_t mKeyMask;          // Which modifier keys this event handler expects to have down
                              // in order to be matched.
- 
+
   // The primary filter information for mouse/key events.
   int32_t mDetail;           // For key events, contains a charcode or keycode. For
                              // mouse events, stores the button info.
 
   // Prototype handlers are chained. We own the next handler in the chain.
   nsXBLPrototypeHandler* mNextHandler;
   nsCOMPtr<nsIAtom> mEventName; // The type of the event, e.g., "keypress"
   RefPtr<nsXBLEventHandler> mHandler;
--- a/dom/xbl/nsXBLResourceLoader.cpp
+++ b/dom/xbl/nsXBLResourceLoader.cpp
@@ -110,17 +110,17 @@ nsXBLResourceLoader::LoadResources(bool*
 
     if (NS_FAILED(NS_NewURI(getter_AddRefs(url), curr->mSrc,
                             doc->GetDocumentCharacterSet().get(), docURL)))
       continue;
 
     if (curr->mType == nsGkAtoms::image) {
       // Now kick off the image load...
       // Passing nullptr for pretty much everything -- cause we don't care!
-      // XXX: initialDocumentURI is nullptr! 
+      // XXX: initialDocumentURI is nullptr!
       RefPtr<imgRequestProxy> req;
       nsContentUtils::LoadImage(url, doc, doc, docPrincipal, docURL,
                                 doc->GetReferrerPolicy(), nullptr,
                                 nsIRequest::LOAD_BACKGROUND, EmptyString(),
                                 getter_AddRefs(req));
     }
     else if (curr->mType == nsGkAtoms::stylesheet) {
       // Kick off the load of the stylesheet.
@@ -151,63 +151,63 @@ nsXBLResourceLoader::LoadResources(bool*
         if (NS_SUCCEEDED(rv))
           ++mPendingSheets;
       }
     }
   }
 
   *aResult = (mPendingSheets == 0);
   mInLoadResourcesFunc = false;
-  
+
   // Destroy our resource list.
   delete mResourceList;
   mResourceList = nullptr;
 }
 
 // nsICSSLoaderObserver
 NS_IMETHODIMP
 nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet,
                                       bool aWasAlternate,
                                       nsresult aStatus)
 {
   if (!mResources) {
     // Our resources got destroyed -- just bail out
     return NS_OK;
   }
-   
+
   mResources->AppendStyleSheet(aSheet);
 
   if (!mInLoadResourcesFunc)
     mPendingSheets--;
-  
+
   if (mPendingSheets == 0) {
-    // All stylesheets are loaded.  
+    // All stylesheets are loaded.
     mResources->GatherRuleProcessor();
 
     // XXX Check for mPendingScripts when scripts also come online.
     if (!mInLoadResourcesFunc)
       NotifyBoundElements();
   }
   return NS_OK;
 }
 
-void 
+void
 nsXBLResourceLoader::AddResource(nsIAtom* aResourceType, const nsAString& aSrc)
 {
   nsXBLResource* res = new nsXBLResource(aResourceType, aSrc);
   if (!mResourceList)
     mResourceList = res;
   else
     mLastResource->mNext = res;
 
   mLastResource = res;
 }
 
 void
-nsXBLResourceLoader::AddResourceListener(nsIContent* aBoundElement) 
+nsXBLResourceLoader::AddResourceListener(nsIContent* aBoundElement)
 {
   if (aBoundElement) {
     mBoundElements.AppendObject(aBoundElement);
   }
 }
 
 void
 nsXBLResourceLoader::NotifyBoundElements()
--- a/dom/xbl/nsXBLResourceLoader.h
+++ b/dom/xbl/nsXBLResourceLoader.h
@@ -46,17 +46,17 @@ public:
   nsresult Write(nsIObjectOutputStream* aStream);
 
 // MEMBER VARIABLES
   nsXBLPrototypeBinding* mBinding; // A pointer back to our binding.
   nsXBLPrototypeResources* mResources; // A pointer back to our resources
                                        // information.  May be null if the
                                        // resources have already been
                                        // destroyed.
-  
+
   nsXBLResource* mResourceList; // The list of resources we need to load.
   nsXBLResource* mLastResource;
 
   bool mLoadingResources;
   // We need mInLoadResourcesFunc because we do a mixture of sync and
   // async loads.
   bool mInLoadResourcesFunc;
   int16_t mPendingSheets; // The number of stylesheets that have yet to load.
--- a/dom/xbl/nsXBLSerialize.h
+++ b/dom/xbl/nsXBLSerialize.h
@@ -49,28 +49,28 @@ typedef uint8_t XBLBindingSerializeDetai
 #define XBLBinding_Serialize_Handler 8
 #define XBLBinding_Serialize_Image 9
 #define XBLBinding_Serialize_Stylesheet 10
 #define XBLBinding_Serialize_Attribute 0xA
 #define XBLBinding_Serialize_Mask 0x0F
 #define XBLBinding_Serialize_ReadOnly 0x80
 
 // Appears at the end of the list of insertion points to indicate that there
-// are no more. 
+// are no more.
 #define XBLBinding_Serialize_NoMoreInsertionPoints 0xFFFFFFFF
 
 // When serializing content nodes, a single-byte namespace id is written out
 // first. The special values below can appear in place of a namespace id.
 
-// Indicates that this is not one of the built-in namespaces defined in 
+// Indicates that this is not one of the built-in namespaces defined in
 // nsNameSpaceManager.h. The string form will be serialized immediately
 // following.
 #define XBLBinding_Serialize_CustomNamespace 0xFE
 
-// Flags to indicate a non-element node. Otherwise, it is an element. 
+// Flags to indicate a non-element node. Otherwise, it is an element.
 #define XBLBinding_Serialize_TextNode 0xFB
 #define XBLBinding_Serialize_CDATANode 0xFC
 #define XBLBinding_Serialize_CommentNode 0xFD
 
 // Indicates that there is no content to serialize/deserialize
 #define XBLBinding_Serialize_NoContent 0xFF
 
 // Appears at the end of the forwarded attributes list to indicate that there
--- a/dom/xbl/nsXBLWindowKeyHandler.cpp
+++ b/dom/xbl/nsXBLWindowKeyHandler.cpp
@@ -103,46 +103,46 @@ void nsXBLSpecialDocInfo::LoadDocInfo()
   nsCOMPtr<nsIURI> bindingURI;
   NS_NewURI(getter_AddRefs(bindingURI), sHTMLBindingStr);
   if (!bindingURI) {
     return;
   }
   xblService->LoadBindingDocumentInfo(nullptr, nullptr,
                                       bindingURI,
                                       nullptr,
-                                      true, 
+                                      true,
                                       getter_AddRefs(mHTMLBindings));
 
   const nsAdoptingCString& userHTMLBindingStr =
     Preferences::GetCString("dom.userHTMLBindings.uri");
   if (!userHTMLBindingStr.IsEmpty()) {
     NS_NewURI(getter_AddRefs(bindingURI), userHTMLBindingStr);
     if (!bindingURI) {
       return;
     }
 
     xblService->LoadBindingDocumentInfo(nullptr, nullptr,
                                         bindingURI,
                                         nullptr,
-                                        true, 
+                                        true,
                                         getter_AddRefs(mUserHTMLBindings));
   }
 }
 
 //
 // GetHandlers
 //
-// 
+//
 void
 nsXBLSpecialDocInfo::GetHandlers(nsXBLDocumentInfo* aInfo,
                                  const nsACString& aRef,
                                  nsXBLPrototypeHandler** aResult)
 {
   nsXBLPrototypeBinding* binding = aInfo->GetPrototypeBinding(aRef);
-  
+
   NS_ASSERTION(binding, "No binding found for the XBL window key handler.");
   if (!binding)
     return;
 
   *aResult = binding->GetPrototypeHandlers();
 }
 
 void
@@ -221,17 +221,17 @@ BuildHandlerChain(nsIContent* aContent, 
       handler->SetNextHandler(*aResult);
       *aResult = handler;
     }
   }
 }
 
 //
 // EnsureHandlers
-//    
+//
 // Lazily load the XBL handlers. Overridden to handle being attached
 // to a particular element rather than the document
 //
 nsresult
 nsXBLWindowKeyHandler::EnsureHandlers()
 {
   nsCOMPtr<Element> el = GetElement();
   NS_ENSURE_STATE(!mWeakPtrForElement || el);
@@ -597,17 +597,17 @@ nsXBLWindowKeyHandler::IsHTMLEditableFie
 //
 // Given a particular DOM event and a pointer to the first handler in the list,
 // scan through the list to find something to handle the event. If aExecute = true,
 // the handler will be executed; otherwise just return an answer telling if a handler
 // for that event was found.
 //
 bool
 nsXBLWindowKeyHandler::WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent,
-                                            nsIAtom* aEventType, 
+                                            nsIAtom* aEventType,
                                             nsXBLPrototypeHandler* aHandler,
                                             bool aExecute,
                                             bool* aOutReservedForChrome)
 {
   WidgetKeyboardEvent* nativeKeyboardEvent =
     aKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
   MOZ_ASSERT(nativeKeyboardEvent);