Bug 1041148 - Move HoldJSObjects call to XMLHttpRequest constructor to simplify the code. r=bz, a=lmandel
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 06 Aug 2014 15:23:33 -0700
changeset 217409 0a77721ad4adc1efcb2bf9904c3d83f7a9806625
parent 217408 013fd839967c666b6a19ada40625bb6afce40fda
child 217410 518ed9988257d57566bb0d6e2c726ee375574a93
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, lmandel
bugs1041148
milestone33.0a2
Bug 1041148 - Move HoldJSObjects call to XMLHttpRequest constructor to simplify the code. r=bz, a=lmandel
dom/workers/XMLHttpRequest.cpp
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -1572,16 +1572,18 @@ XMLHttpRequest::XMLHttpRequest(WorkerPri
 : mWorkerPrivate(aWorkerPrivate),
   mResponseType(XMLHttpRequestResponseType::Text), mTimeout(0),
   mRooted(false), mBackgroundRequest(false), mWithCredentials(false),
   mCanceled(false), mMozAnon(false), mMozSystem(false)
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 
   SetIsDOMBinding();
+
+  mozilla::HoldJSObjects(this);
 }
 
 XMLHttpRequest::~XMLHttpRequest()
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 
   ReleaseProxy(XHRIsGoingAway);
 
@@ -2360,12 +2362,9 @@ XMLHttpRequest::UpdateState(const StateD
     JS::Rooted<JS::Value> response(mWorkerPrivate->GetJSContext(),
                                    mStateData.mResponse);
     mStateData = aStateData;
     mStateData.mResponse = response;
   }
   else {
     mStateData = aStateData;
   }
-  if (mStateData.mResponse.isGCThing()) {
-    mozilla::HoldJSObjects(this);
-  }
 }