Bug 1034913 - Don't manually delete nsHTMLURIRefObject and enforce it. r=ehsan
authorAndrew McCreight <continuation@gmail.com>
Tue, 08 Jul 2014 13:46:24 -0700
changeset 192976 38ef35020b3479c093d3829700e90035ac32fd4c
parent 192975 72c27a72f8a86f44636eb2f5d8b70d2b0beeca89
child 192977 fdbf7d256b43901bfbbeda452b541699350e594c
push id27103
push usercbook@mozilla.com
push dateWed, 09 Jul 2014 13:55:18 +0000
treeherdermozilla-central@f945d50e50fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1034913
milestone33.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 1034913 - Don't manually delete nsHTMLURIRefObject and enforce it. r=ehsan
editor/libeditor/html/nsHTMLURIRefObject.cpp
editor/libeditor/html/nsHTMLURIRefObject.h
--- a/editor/libeditor/html/nsHTMLURIRefObject.cpp
+++ b/editor/libeditor/html/nsHTMLURIRefObject.cpp
@@ -277,19 +277,18 @@ nsHTMLURIRefObject::SetNode(nsIDOMNode *
   // If there weren't any URIs in the attributes,
   // then don't accept this node.
   mNode = 0;
   return NS_ERROR_INVALID_ARG;
 }
 
 nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsIDOMNode* aNode)
 {
-  nsHTMLURIRefObject* refObject = new nsHTMLURIRefObject();
+  nsRefPtr<nsHTMLURIRefObject> refObject = new nsHTMLURIRefObject();
   nsresult rv = refObject->SetNode(aNode);
   if (NS_FAILED(rv)) {
     *aResult = 0;
-    delete refObject;
     return rv;
   }
   return refObject->QueryInterface(NS_GET_IID(nsIURIRefObject),
                                    (void**)aResult);
 }
 
--- a/editor/libeditor/html/nsHTMLURIRefObject.h
+++ b/editor/libeditor/html/nsHTMLURIRefObject.h
@@ -16,38 +16,31 @@ class nsIDOMNode;
 #define nsHTMLURIRefObject_h__
 
 #define NS_URI_REF_OBJECT_CID                          \
 { /* {bdd79df6-1dd1-11b2-b29c-c3d63a58f1d2} */         \
     0xbdd79df6, 0x1dd1, 0x11b2,                        \
     { 0xb2, 0x9c, 0xc3, 0xd6, 0x3a, 0x58, 0xf1, 0xd2 } \
 }
 
-class nsHTMLURIRefObject : public nsIURIRefObject
+class nsHTMLURIRefObject MOZ_FINAL : public nsIURIRefObject
 {
 public:
   nsHTMLURIRefObject();
-  virtual ~nsHTMLURIRefObject();
 
   // Interfaces for addref and release and queryinterface
   NS_DECL_ISUPPORTS
 
   NS_DECL_NSIURIREFOBJECT
 
 protected:
+  virtual ~nsHTMLURIRefObject();
+
   nsCOMPtr<nsIDOMNode> mNode;
   nsCOMPtr<nsIDOMMozNamedAttrMap> mAttributes;
   uint32_t mCurAttrIndex;
   uint32_t mAttributeCnt;
 };
 
-namespace mozilla {
-template<>
-struct HasDangerousPublicDestructor<nsHTMLURIRefObject>
-{
-  static const bool value = true;
-};
-}
-
 nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsIDOMNode* aNode);
 
 #endif /* nsHTMLURIRefObject_h__ */