Bug 1036052 - Privatize public destructor of DOMRect. r=baku
authorAnuj Agarwal <anujagarwal464@gmail.com>
Tue, 02 Sep 2014 11:47:00 -0400
changeset 203273 2d687e266e656206c2cae6645c2e76d9e163d81d
parent 203272 d5cd910dda69067e1376da708e73d754a3a8f383
child 203274 869d64f8ab6cab793226803df56edc68e7e9ec6d
push id48650
push userryanvm@gmail.com
push dateWed, 03 Sep 2014 17:23:48 +0000
treeherdermozilla-inbound@b7d2c160e1f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1036052
milestone35.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 1036052 - Privatize public destructor of DOMRect. r=baku
content/base/src/DOMRect.h
dom/events/ScrollAreaEvent.cpp
dom/events/ScrollAreaEvent.h
--- a/content/base/src/DOMRect.h
+++ b/content/base/src/DOMRect.h
@@ -137,16 +137,19 @@ public:
   }
   void SetHeight(double aHeight)
   {
     mHeight = aHeight;
   }
 
 protected:
   double mX, mY, mWidth, mHeight;
+
+private:
+  ~DOMRect() {};
 };
 
 class DOMRectList MOZ_FINAL : public nsIDOMClientRectList,
                               public nsWrapperCache
 {
   ~DOMRectList() {}
 
 public:
@@ -205,17 +208,11 @@ public:
 
 protected:
   nsTArray<nsRefPtr<DOMRect> > mArray;
   nsCOMPtr<nsISupports> mParent;
 };
 
 }
 
-template<>
-struct HasDangerousPublicDestructor<dom::DOMRect>
-{
-  static const bool value = true;
-};
-
 }
 
 #endif /*MOZILLA_DOMRECT_H_*/
--- a/dom/events/ScrollAreaEvent.cpp
+++ b/dom/events/ScrollAreaEvent.cpp
@@ -11,19 +11,19 @@
 
 namespace mozilla {
 namespace dom {
 
 ScrollAreaEvent::ScrollAreaEvent(EventTarget* aOwner,
                                  nsPresContext* aPresContext,
                                  InternalScrollAreaEvent* aEvent)
   : UIEvent(aOwner, aPresContext, aEvent)
-  , mClientArea(nullptr)
+  , mClientArea(new DOMRect(nullptr))
 {
-  mClientArea.SetLayoutRect(aEvent ? aEvent->mArea : nsRect());
+  mClientArea->SetLayoutRect(aEvent ? aEvent->mArea : nsRect());
 }
 
 NS_IMPL_ADDREF_INHERITED(ScrollAreaEvent, UIEvent)
 NS_IMPL_RELEASE_INHERITED(ScrollAreaEvent, UIEvent)
 
 NS_INTERFACE_MAP_BEGIN(ScrollAreaEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMScrollAreaEvent)
 NS_INTERFACE_MAP_END_INHERITING(UIEvent)
@@ -52,17 +52,17 @@ ScrollAreaEvent::InitScrollAreaEvent(con
                                      float aY,
                                      float aWidth,
                                      float aHeight)
 {
   nsresult rv =
     UIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  mClientArea.SetRect(aX, aY, aWidth, aHeight);
+  mClientArea->SetRect(aX, aY, aWidth, aHeight);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP_(void)
 ScrollAreaEvent::Serialize(IPC::Message* aMsg,
                            bool aSerializeInterfaceType)
 {
@@ -83,17 +83,17 @@ ScrollAreaEvent::Deserialize(const IPC::
 {
   NS_ENSURE_TRUE(Event::Deserialize(aMsg, aIter), false);
 
   float x, y, width, height;
   NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &x), false);
   NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &y), false);
   NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &width), false);
   NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &height), false);
-  mClientArea.SetRect(x, y, width, height);
+  mClientArea->SetRect(x, y, width, height);
 
   return true;
 }
 
 } // namespace dom
 } // namespace mozilla
 
 using namespace mozilla;
--- a/dom/events/ScrollAreaEvent.h
+++ b/dom/events/ScrollAreaEvent.h
@@ -40,32 +40,32 @@ public:
 
   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
   {
     return ScrollAreaEventBinding::Wrap(aCx, this);
   }
 
   float X() const
   {
-    return mClientArea.Left();
+    return mClientArea->Left();
   }
 
   float Y() const
   {
-    return mClientArea.Top();
+    return mClientArea->Top();
   }
 
   float Width() const
   {
-    return mClientArea.Width();
+    return mClientArea->Width();
   }
 
   float Height() const
   {
-    return mClientArea.Height();
+    return mClientArea->Height();
   }
 
   void InitScrollAreaEvent(const nsAString& aType,
                            bool aCanBubble,
                            bool aCancelable,
                            nsIDOMWindow* aView,
                            int32_t aDetail,
                            float aX, float aY,
@@ -74,15 +74,15 @@ public:
   {
     aRv = InitScrollAreaEvent(aType, aCanBubble, aCancelable, aView,
                               aDetail, aX, aY, aWidth, aHeight);
   }
 
 protected:
   ~ScrollAreaEvent() {}
 
-  DOMRect mClientArea;
+  nsRefPtr<DOMRect> mClientArea;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_ScrollAreaEvent_h_