Backed out changeset c41fa4e8dfb2 (bug 1162765) for frequent mochitest-2 failures CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Fri, 08 May 2015 18:18:29 -0700
changeset 243081 673edf1e9272a9c8c92987e26f4b27fae1ca5b74
parent 243080 e6d93b374a9bc80e87553c36d6555dfa97a669b7
child 243082 5a277f82ff59abfbc05e4a92da72f5e3233661ee
push id28720
push userphilringnalda@gmail.com
push dateSat, 09 May 2015 21:17:12 +0000
treeherdermozilla-central@30bfca777090 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1162765
milestone40.0a1
backs outc41fa4e8dfb24821a25f85a33914bb5d6afeca04
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
Backed out changeset c41fa4e8dfb2 (bug 1162765) for frequent mochitest-2 failures CLOSED TREE
dom/html/nsGenericHTMLElement.cpp
dom/html/nsGenericHTMLElement.h
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1878,36 +1878,19 @@ nsGenericHTMLElement::SetUndoScopeIntern
 bool
 nsGenericHTMLElement::TouchEventsEnabled(JSContext* /* unused */, JSObject* /* unused */)
 {
   return TouchEvent::PrefEnabled();
 }
 
 //----------------------------------------------------------------------
 
-NS_IMPL_ADDREF_INHERITED(nsGenericHTMLFormElement, nsGenericHTMLElement)
-NS_IMPL_RELEASE_INHERITED(nsGenericHTMLFormElement, nsGenericHTMLElement)
-
-NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsGenericHTMLFormElement)
-  NS_INTERFACE_TABLE_INHERITED(nsGenericHTMLFormElement,
-                               nsIFormControl)
-NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement)
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericHTMLFormElement)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGenericHTMLFormElement,
-                                                  nsGenericHTMLElement)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mForm)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsGenericHTMLFormElement,
-                                                nsGenericHTMLElement)
-  tmp->ClearForm(true);
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
 nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo)
+  , mForm(nullptr)
   , mFieldSet(nullptr)
 {
   // We should add the NS_EVENT_STATE_ENABLED bit here as needed, but
   // that depends on our type, which is not initialized yet.  So we
   // have to do this in subclasses.
 }
 
 nsGenericHTMLFormElement::~nsGenericHTMLFormElement()
@@ -1915,16 +1898,20 @@ nsGenericHTMLFormElement::~nsGenericHTML
   if (mFieldSet) {
     mFieldSet->RemoveElement(this);
   }
 
   // Check that this element doesn't know anything about its form at this point.
   NS_ASSERTION(!mForm, "mForm should be null at this point!");
 }
 
+NS_IMPL_ISUPPORTS_INHERITED(nsGenericHTMLFormElement,
+                            nsGenericHTMLElement,
+                            nsIFormControl)
+
 nsINode*
 nsGenericHTMLFormElement::GetScopeChainParent() const
 {
   return mForm ? mForm : nsGenericHTMLElement::GetScopeChainParent();
 }
 
 bool
 nsGenericHTMLFormElement::IsNodeOfType(uint32_t aFlags) const
@@ -1994,18 +1981,17 @@ nsGenericHTMLFormElement::GetFieldSet()
 {
   return mFieldSet;
 }
 
 nsresult
 nsGenericHTMLFormElement::GetForm(nsIDOMHTMLFormElement** aForm)
 {
   NS_ENSURE_ARG_POINTER(aForm);
-  nsRefPtr<HTMLFormElement> copy(mForm);
-  copy.forget(aForm);
+  NS_IF_ADDREF(*aForm = mForm);
   return NS_OK;
 }
 
 nsIContent::IMEState
 nsGenericHTMLFormElement::GetDesiredIMEState()
 {
   nsIEditor* editor = GetEditorInternal();
   if (!editor)
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -1261,19 +1261,16 @@ ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPE
  * A helper class for form elements that can contain children
  */
 class nsGenericHTMLFormElement : public nsGenericHTMLElement,
                                  public nsIFormControl
 {
 public:
   explicit nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
 
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGenericHTMLFormElement,
-                                           nsGenericHTMLElement)
-
   NS_DECL_ISUPPORTS_INHERITED
 
   nsINode* GetScopeChainParent() const override;
 
   virtual bool IsNodeOfType(uint32_t aFlags) const override;
   virtual void SaveSubtreeState() override;
 
   // nsIFormControl
@@ -1411,17 +1408,17 @@ protected:
     eActiveWindow
   };
 
   // Get our focus state.  If this returns eInactiveWindow, it will set this
   // element as the focused element for that window.
   FocusTristate FocusState();
 
   /** The form that contains this control */
-  nsRefPtr<mozilla::dom::HTMLFormElement> mForm;
+  mozilla::dom::HTMLFormElement* mForm;
 
   /* This is a pointer to our closest fieldset parent if any */
   mozilla::dom::HTMLFieldSetElement* mFieldSet;
 };
 
 class nsGenericHTMLFormElementWithState : public nsGenericHTMLFormElement
 {
 public: