Bug 939789, call nsJSContext::LikelyShortLivingObjectCreated() only in the main thread, r=mccr8
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Mon, 18 Nov 2013 18:58:02 +0200
changeset 170712 f921dc945f7b8850aed6accb1c5f4c1856e33eb7
parent 170711 3fd86b311a5aa656694ab0306af39ce658e336cd
child 170713 0ed8a5d6395c0c502f69ab3568fe71aa6da53a34
push idunknown
push userunknown
push dateunknown
reviewersmccr8
bugs939789
milestone28.0a1
Bug 939789, call nsJSContext::LikelyShortLivingObjectCreated() only in the main thread, r=mccr8
content/events/src/nsDOMEvent.cpp
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -49,16 +49,19 @@ nsDOMEvent::nsDOMEvent(nsPIDOMWindow* aP
 
 void
 nsDOMEvent::ConstructorInit(mozilla::dom::EventTarget* aOwner,
                             nsPresContext* aPresContext, WidgetEvent* aEvent)
 {
   SetIsDOMBinding();
   SetOwner(aOwner);
   mIsMainThreadEvent = mOwner || NS_IsMainThread();
+  if (mIsMainThreadEvent) {
+    nsJSContext::LikelyShortLivingObjectCreated();
+  }
 
   mPrivateDataDuplicated = false;
 
   if (aEvent) {
     mEvent = aEvent;
     mEventIsInternal = false;
   }
   else {
@@ -87,17 +90,16 @@ nsDOMEvent::ConstructorInit(mozilla::dom
           ...
         }
      */
     mEvent = new WidgetEvent(false, 0);
     mEvent->time = PR_Now();
   }
 
   InitPresContextData(aPresContext);
-  nsJSContext::LikelyShortLivingObjectCreated();
 }
 
 void
 nsDOMEvent::InitPresContextData(nsPresContext* aPresContext)
 {
   mPresContext = aPresContext;
   // Get the explicit original target (if it's anonymous make it null)
   {