Bug 821116 - Track line numbers for XBL properties (r=bz)
authorBill McCloskey <wmccloskey@mozilla.com>
Mon, 17 Dec 2012 12:22:38 -0800
changeset 116311 5a71c5b130c60f78c409cf6151c9411b49c2e069
parent 116310 9c21138d9e9ab3616a850948f7e3334886bd6dff
child 116312 4c40426150f3b7f74c2c4804723d5e9446a40bf6
push id24046
push useremorley@mozilla.com
push dateTue, 18 Dec 2012 09:32:10 +0000
treeherdermozilla-central@dd277d439d31 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs821116
milestone20.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 821116 - Track line numbers for XBL properties (r=bz)
content/xbl/src/nsXBLContentSink.cpp
content/xbl/src/nsXBLContentSink.h
content/xbl/src/nsXBLProtoImplProperty.cpp
content/xbl/src/nsXBLProtoImplProperty.h
--- a/content/xbl/src/nsXBLContentSink.cpp
+++ b/content/xbl/src/nsXBLContentSink.cpp
@@ -482,17 +482,17 @@ nsXBLContentSink::OnOpenContainer(const 
     mSecondaryState = eXBL_InField;
     ConstructField(aAtts, aLineNumber);
   }
   else if (aTagName == nsGkAtoms::property) {
     ENSURE_XBL_STATE(mState == eXBL_InImplementation &&
                      mSecondaryState == eXBL_None);
     NS_ASSERTION(mBinding, "Must have binding here");
     mSecondaryState = eXBL_InProperty;
-    ConstructProperty(aAtts);
+    ConstructProperty(aAtts, aLineNumber);
   }
   else if (aTagName == nsGkAtoms::getter) {
     ENSURE_XBL_STATE(mSecondaryState == eXBL_InProperty && mProperty);
     NS_ASSERTION(mState == eXBL_InImplementation, "Unexpected state");
     mProperty->SetGetterLineNumber(aLineNumber);
     mSecondaryState = eXBL_InGetter;
   }
   else if (aTagName == nsGkAtoms::setter) {
@@ -765,17 +765,17 @@ nsXBLContentSink::ConstructField(const P
     if (mField) {
       mField->SetLineNumber(aLineNumber);
       AddField(mField);
     }
   }
 }
 
 void
-nsXBLContentSink::ConstructProperty(const PRUnichar **aAtts)
+nsXBLContentSink::ConstructProperty(const PRUnichar **aAtts, uint32_t aLineNumber)
 {
   const PRUnichar* name     = nullptr;
   const PRUnichar* readonly = nullptr;
   const PRUnichar* onget    = nullptr;
   const PRUnichar* onset    = nullptr;
 
   nsCOMPtr<nsIAtom> prefix, localName;
   for (; *aAtts; aAtts += 2) {
@@ -800,17 +800,17 @@ nsXBLContentSink::ConstructProperty(cons
     else if (localName == nsGkAtoms::onset) {
       onset = aAtts[1];
     }
   }
 
   if (name) {
     // All of our pointers are now filled in. Construct our property with all of
     // these parameters.
-    mProperty = new nsXBLProtoImplProperty(name, onget, onset, readonly);
+    mProperty = new nsXBLProtoImplProperty(name, onget, onset, readonly, aLineNumber);
     if (mProperty) {
       AddMember(mProperty);
     }
   }
 }
 
 void
 nsXBLContentSink::ConstructMethod(const PRUnichar **aAtts)
--- a/content/xbl/src/nsXBLContentSink.h
+++ b/content/xbl/src/nsXBLContentSink.h
@@ -102,17 +102,17 @@ protected:
                                          nsXULPrototypeElement* aElement);
 #endif
 
     // Our own helpers for constructing XBL prototype objects.
     nsresult ConstructBinding(uint32_t aLineNumber);
     void ConstructHandler(const PRUnichar **aAtts, uint32_t aLineNumber);
     void ConstructResource(const PRUnichar **aAtts, nsIAtom* aResourceType);
     void ConstructImplementation(const PRUnichar **aAtts);
-    void ConstructProperty(const PRUnichar **aAtts);
+    void ConstructProperty(const PRUnichar **aAtts, uint32_t aLineNumber);
     void ConstructMethod(const PRUnichar **aAtts);
     void ConstructParameter(const PRUnichar **aAtts);
     void ConstructField(const PRUnichar **aAtts, uint32_t aLineNumber);
   
 
   // nsXMLContentSink overrides
   nsresult FlushText(bool aReleaseTextNode = true);
 
--- a/content/xbl/src/nsXBLProtoImplProperty.cpp
+++ b/content/xbl/src/nsXBLProtoImplProperty.cpp
@@ -13,37 +13,42 @@
 #include "nsIScriptContext.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsXBLPrototypeBinding.h"
 #include "nsXBLSerialize.h"
 
 nsXBLProtoImplProperty::nsXBLProtoImplProperty(const PRUnichar* aName,
                                                const PRUnichar* aGetter, 
                                                const PRUnichar* aSetter,
-                                               const PRUnichar* aReadOnly) :
+                                               const PRUnichar* aReadOnly,
+                                               uint32_t aLineNumber) :
   nsXBLProtoImplMember(aName), 
   mGetterText(nullptr),
   mSetterText(nullptr),
   mJSAttributes(JSPROP_ENUMERATE)
 #ifdef DEBUG
   , mIsCompiled(false)
 #endif
 {
   MOZ_COUNT_CTOR(nsXBLProtoImplProperty);
 
   if (aReadOnly) {
     nsAutoString readOnly; readOnly.Assign(*aReadOnly);
     if (readOnly.LowerCaseEqualsLiteral("true"))
       mJSAttributes |= JSPROP_READONLY;
   }
 
-  if (aGetter)
+  if (aGetter) {
     AppendGetterText(nsDependentString(aGetter));
-  if (aSetter)
+    SetGetterLineNumber(aLineNumber);
+  }
+  if (aSetter) {
     AppendSetterText(nsDependentString(aSetter));
+    SetSetterLineNumber(aLineNumber);
+  }
 }
 
 nsXBLProtoImplProperty::nsXBLProtoImplProperty(const PRUnichar* aName,
                                                const bool aIsReadOnly)
   : nsXBLProtoImplMember(aName),
     mGetterText(nullptr),
     mSetterText(nullptr),
     mJSAttributes(JSPROP_ENUMERATE)
--- a/content/xbl/src/nsXBLProtoImplProperty.h
+++ b/content/xbl/src/nsXBLProtoImplProperty.h
@@ -15,17 +15,18 @@
 #include "nsXBLProtoImplMember.h"
 
 class nsXBLProtoImplProperty: public nsXBLProtoImplMember
 {
 public:
   nsXBLProtoImplProperty(const PRUnichar* aName,
                          const PRUnichar* aGetter, 
                          const PRUnichar* aSetter,
-                         const PRUnichar* aReadOnly);
+                         const PRUnichar* aReadOnly,
+                         uint32_t aLineNumber);
 
   nsXBLProtoImplProperty(const PRUnichar* aName, const bool aIsReadOnly);
  
   virtual ~nsXBLProtoImplProperty();
 
   void AppendGetterText(const nsAString& aGetter);
   void AppendSetterText(const nsAString& aSetter);