Bug 867459 - Fix storage rooting hazards r=terrence
authorDavid Zbarsky <dzbarsky@gmail.com>
Thu, 02 May 2013 22:02:40 -0400
changeset 130716 ec1fb05b0095f8d744b35e605527f3a2d2886fd2
parent 130715 164a107f22027a5c75c534cd4549faf9f93d2609
child 130717 354940bc7ff8fb0fad4172547e4a7959e9641409
push id1579
push userphilringnalda@gmail.com
push dateSat, 04 May 2013 04:38:04 +0000
treeherderfx-team@a56432a42a41 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs867459
milestone23.0a1
Bug 867459 - Fix storage rooting hazards r=terrence
storage/src/mozStorageAsyncStatementJSHelper.cpp
storage/src/mozStorageStatementJSHelper.cpp
--- a/storage/src/mozStorageAsyncStatementJSHelper.cpp
+++ b/storage/src/mozStorageAsyncStatementJSHelper.cpp
@@ -50,18 +50,18 @@ AsyncStatementJSHelper::getParams(AsyncS
       ::JS_GetGlobalForObject(aCtx, aScopeObj),
       params,
       NS_GET_IID(mozIStorageStatementParams),
       getter_AddRefs(aStatement->mStatementParamsHolder)
     );
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  JSObject *obj = nullptr;
-  rv = aStatement->mStatementParamsHolder->GetJSObject(&obj);
+  JS::Rooted<JSObject*> obj(aCtx);
+  rv = aStatement->mStatementParamsHolder->GetJSObject(obj.address());
   NS_ENSURE_SUCCESS(rv, rv);
 
   *_params = OBJECT_TO_JSVAL(obj);
   return NS_OK;
 }
 
 NS_IMETHODIMP_(nsrefcnt) AsyncStatementJSHelper::AddRef() { return 2; }
 NS_IMETHODIMP_(nsrefcnt) AsyncStatementJSHelper::Release() { return 1; }
--- a/storage/src/mozStorageStatementJSHelper.cpp
+++ b/storage/src/mozStorageStatementJSHelper.cpp
@@ -103,18 +103,18 @@ StatementJSHelper::getRow(Statement *aSt
       ::JS_GetGlobalForObject(aCtx, aScopeObj),
       row,
       NS_GET_IID(mozIStorageStatementRow),
       getter_AddRefs(aStatement->mStatementRowHolder)
     );
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  JSObject *obj = nullptr;
-  rv = aStatement->mStatementRowHolder->GetJSObject(&obj);
+  JS::Rooted<JSObject*> obj(aCtx);
+  rv = aStatement->mStatementRowHolder->GetJSObject(obj.address());
   NS_ENSURE_SUCCESS(rv, rv);
 
   *_row = OBJECT_TO_JSVAL(obj);
   return NS_OK;
 }
 
 nsresult
 StatementJSHelper::getParams(Statement *aStatement,
@@ -142,18 +142,18 @@ StatementJSHelper::getParams(Statement *
       ::JS_GetGlobalForObject(aCtx, aScopeObj),
       params,
       NS_GET_IID(mozIStorageStatementParams),
       getter_AddRefs(aStatement->mStatementParamsHolder)
     );
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  JSObject *obj = nullptr;
-  rv = aStatement->mStatementParamsHolder->GetJSObject(&obj);
+  JS::Rooted<JSObject*> obj(aCtx);
+  rv = aStatement->mStatementParamsHolder->GetJSObject(obj.address());
   NS_ENSURE_SUCCESS(rv, rv);
 
   *_params = OBJECT_TO_JSVAL(obj);
   return NS_OK;
 }
 
 NS_IMETHODIMP_(nsrefcnt) StatementJSHelper::AddRef() { return 2; }
 NS_IMETHODIMP_(nsrefcnt) StatementJSHelper::Release() { return 1; }