bug 804220 - Make IDBWrapperCache::SetScriptOwner infallible. r=khuey
authorAndrew McCreight <amccreight@mozilla.com>
Thu, 29 Nov 2012 14:54:14 -0800
changeset 115943 021a624ea78e
parent 115942 2aae75e86935
child 115944 3e3800d9e4b6
push id24034
push useremorley@mozilla.com
push dateFri, 14 Dec 2012 15:28:57 +0000
treeherdermozilla-central@50d8f411d305 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs804220
milestone20.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 804220 - Make IDBWrapperCache::SetScriptOwner infallible. r=khuey
dom/indexedDB/IDBDatabase.cpp
dom/indexedDB/IDBRequest.cpp
dom/indexedDB/IDBTransaction.cpp
dom/indexedDB/IDBWrapperCache.cpp
dom/indexedDB/IDBWrapperCache.h
--- a/dom/indexedDB/IDBDatabase.cpp
+++ b/dom/indexedDB/IDBDatabase.cpp
@@ -183,20 +183,17 @@ IDBDatabase::Create(IDBWrapperCache* aOw
   NS_ASSERTION(!aASCIIOrigin.IsEmpty(), "Empty origin!");
 
   nsRefPtr<DatabaseInfo> databaseInfo(aDatabaseInfo);
   NS_ASSERTION(databaseInfo, "Null pointer!");
 
   nsRefPtr<IDBDatabase> db(new IDBDatabase());
 
   db->BindToOwner(aOwnerCache);
-  if (!db->SetScriptOwner(aOwnerCache->GetScriptOwner())) {
-    return nullptr;
-  }
-
+  db->SetScriptOwner(aOwnerCache->GetScriptOwner());
   db->mFactory = aFactory;
   db->mDatabaseId = databaseInfo->id;
   db->mName = databaseInfo->name;
   db->mFilePath = databaseInfo->filePath;
   databaseInfo.swap(db->mDatabaseInfo);
   db->mASCIIOrigin = aASCIIOrigin;
   db->mFileManager = aFileManager;
   db->mContentParent = aContentParent;
--- a/dom/indexedDB/IDBRequest.cpp
+++ b/dom/indexedDB/IDBRequest.cpp
@@ -52,20 +52,17 @@ IDBRequest::Create(nsISupports* aSource,
                    JSContext* aCallingCx)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   nsRefPtr<IDBRequest> request(new IDBRequest());
 
   request->mSource = aSource;
   request->mTransaction = aTransaction;
   request->BindToOwner(aOwnerCache);
-  if (!request->SetScriptOwner(aOwnerCache->GetScriptOwner())) {
-    return nullptr;
-  }
-
+  request->SetScriptOwner(aOwnerCache->GetScriptOwner());
   request->CaptureCaller(aCallingCx);
 
   return request.forget();
 }
 
 void
 IDBRequest::Reset()
 {
@@ -347,20 +344,17 @@ IDBOpenDBRequest::Create(IDBFactory* aFa
                          JSContext* aCallingCx)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   NS_ASSERTION(aFactory, "Null pointer!");
 
   nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest();
 
   request->BindToOwner(aOwner);
-  if (!request->SetScriptOwner(aScriptOwner)) {
-    return nullptr;
-  }
-
+  request->SetScriptOwner(aScriptOwner);
   request->CaptureCaller(aCallingCx);
   request->mFactory = aFactory;
 
   return request.forget();
 }
 
 void
 IDBOpenDBRequest::SetTransaction(IDBTransaction* aTransaction)
--- a/dom/indexedDB/IDBTransaction.cpp
+++ b/dom/indexedDB/IDBTransaction.cpp
@@ -98,20 +98,17 @@ IDBTransaction::CreateInternal(IDBDataba
   NS_ASSERTION(!aIsVersionChangeTransactionChild ||
                (!IndexedDatabaseManager::IsMainProcess() &&
                 aMode == IDBTransaction::VERSION_CHANGE),
                "Busted logic!");
 
   nsRefPtr<IDBTransaction> transaction = new IDBTransaction();
 
   transaction->BindToOwner(aDatabase);
-  if (!transaction->SetScriptOwner(aDatabase->GetScriptOwner())) {
-    return nullptr;
-  }
-
+  transaction->SetScriptOwner(aDatabase->GetScriptOwner());
   transaction->mDatabase = aDatabase;
   transaction->mMode = aMode;
   transaction->mDatabaseInfo = aDatabase->Info();
   transaction->mObjectStoreNames.AppendElements(aObjectStoreNames);
   transaction->mObjectStoreNames.Sort();
 
   IndexedDBTransactionChild* actor = nullptr;
 
--- a/dom/indexedDB/IDBWrapperCache.cpp
+++ b/dom/indexedDB/IDBWrapperCache.cpp
@@ -40,29 +40,27 @@ NS_IMPL_RELEASE_INHERITED(IDBWrapperCach
 
 IDBWrapperCache::~IDBWrapperCache()
 {
   mScriptOwner = nullptr;
   nsContentUtils::ReleaseWrapper(this, this);
   NS_DROP_JS_OBJECTS(this, IDBWrapperCache);
 }
 
-bool
+void
 IDBWrapperCache::SetScriptOwner(JSObject* aScriptOwner)
 {
   NS_ASSERTION(aScriptOwner, "This should never be null!");
 
   mScriptOwner = aScriptOwner;
 
   nsISupports* thisSupports = NS_CYCLE_COLLECTION_UPCAST(this, IDBWrapperCache);
   nsXPCOMCycleCollectionParticipant* participant;
   CallQueryInterface(this, &participant);
   nsContentUtils::HoldJSObjects(thisSupports, participant);
-
-  return true;
 }
 
 #ifdef DEBUG
 void
 IDBWrapperCache::AssertIsRooted() const
 {
   NS_ASSERTION(nsContentUtils::AreJSObjectsHeld(const_cast<IDBWrapperCache*>(this)),
                "Why aren't we rooted?!");
--- a/dom/indexedDB/IDBWrapperCache.h
+++ b/dom/indexedDB/IDBWrapperCache.h
@@ -20,17 +20,17 @@ public:
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
                                                    IDBWrapperCache,
                                                    nsDOMEventTargetHelper)
 
   JSObject* GetScriptOwner() const
   {
     return mScriptOwner;
   }
-  bool SetScriptOwner(JSObject* aScriptOwner);
+  void SetScriptOwner(JSObject* aScriptOwner);
 
   JSObject* GetParentObject()
   {
     if (mScriptOwner) {
       return mScriptOwner;
     }
 
     // Do what nsEventTargetSH::PreCreate does.