Bug 1163148 - Convert HTMLFieldSetElement::mDependentElements and mFirstLegend to strong pointers; r=mccr8
☠☠ backed out by ca67ae37b611 ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 12 May 2015 17:12:38 -0400
changeset 263611 84d5d34e1445d39944d6090628e026887c2ddc42
parent 263610 b494504e80f782ba0cfbb9d0f4255ead5e9791f2
child 263612 0f3f236937943e54089ceae0a673b1b0b2f67d7c
push id8157
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:36:23 +0000
treeherdermozilla-aurora@d480e05bd276 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1163148
milestone41.0a1
Bug 1163148 - Convert HTMLFieldSetElement::mDependentElements and mFirstLegend to strong pointers; r=mccr8
dom/html/HTMLFieldSetElement.cpp
dom/html/HTMLFieldSetElement.h
--- a/dom/html/HTMLFieldSetElement.cpp
+++ b/dom/html/HTMLFieldSetElement.cpp
@@ -14,18 +14,16 @@
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet)
 
 namespace mozilla {
 namespace dom {
 
 HTMLFieldSetElement::HTMLFieldSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : nsGenericHTMLFormElement(aNodeInfo)
-  , mElements(nullptr)
-  , mFirstLegend(nullptr)
   , mInvalidElementsCount(0)
 {
   // <fieldset> is always barred from constraint validation.
   SetBarredFromConstraintValidation(true);
 
   // We start out enabled and valid.
   AddStatesSilently(NS_EVENT_STATE_ENABLED | NS_EVENT_STATE_VALID);
 }
@@ -36,17 +34,18 @@ HTMLFieldSetElement::~HTMLFieldSetElemen
   for (uint32_t i = 0; i < length; ++i) {
     mDependentElements[i]->ForgetFieldSet(this);
   }
 }
 
 // nsISupports
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLFieldSetElement, nsGenericHTMLFormElement,
-                                   mValidity, mElements)
+                                   mValidity, mElements, mDependentElements,
+                                   mFirstLegend)
 
 NS_IMPL_ADDREF_INHERITED(HTMLFieldSetElement, Element)
 NS_IMPL_RELEASE_INHERITED(HTMLFieldSetElement, Element)
 
 // QueryInterface implementation for HTMLFieldSetElement
 NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLFieldSetElement)
   NS_INTERFACE_TABLE_INHERITED(HTMLFieldSetElement,
                                nsIDOMHTMLFieldSetElement,
--- a/dom/html/HTMLFieldSetElement.h
+++ b/dom/html/HTMLFieldSetElement.h
@@ -125,19 +125,19 @@ private:
   // This function is used to generate the nsContentList (listed form elements).
   static bool MatchListedElements(nsIContent* aContent, int32_t aNamespaceID,
                                     nsIAtom* aAtom, void* aData);
 
   // listed form controls elements.
   nsRefPtr<nsContentList> mElements;
 
   // List of elements which have this fieldset as first fieldset ancestor.
-  nsTArray<nsGenericHTMLFormElement*> mDependentElements;
+  nsTArray<nsRefPtr<nsGenericHTMLFormElement>> mDependentElements;
 
-  nsIContent* mFirstLegend;
+  nsCOMPtr<nsIContent> mFirstLegend;
 
   /**
    * Number of invalid and candidate for constraint validation
    * elements in the fieldSet the last time UpdateValidity has been called.
    *
    * @note Should only be used by UpdateValidity() and IntrinsicState()!
    */
   int32_t mInvalidElementsCount;