Bug 1067568 - Fix intermittent "ASSERTION: We don't know anyting about this file handle?!: 'Error', file dom/filehandle/FileService.cpp, line 234". r=bent, a=lsblakk
authorJan Varga <jan.varga@gmail.com>
Mon, 02 Mar 2015 22:14:22 +0100
changeset 250419 199e30cb18f3
parent 250418 c8f377118985
child 250420 3eeb35bbafd2
push id4583
push userryanvm@gmail.com
push date2015-03-18 16:53 +0000
treeherdermozilla-beta@067f83e99f66 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent, lsblakk
bugs1067568
milestone37.0
Bug 1067568 - Fix intermittent "ASSERTION: We don't know anyting about this file handle?!: 'Error', file dom/filehandle/FileService.cpp, line 234". r=bent, a=lsblakk
dom/indexedDB/IDBMutableFile.cpp
--- a/dom/indexedDB/IDBMutableFile.cpp
+++ b/dom/indexedDB/IDBMutableFile.cpp
@@ -315,21 +315,23 @@ IDBMutableFile::Open(FileMode aMode, Err
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (QuotaManager::IsShuttingDown() || FileService::IsShuttingDown()) {
     aError.Throw(NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
     return nullptr;
   }
 
-  if (mInvalidated) {
+  if (mDatabase->IsClosed()) {
     aError.Throw(NS_ERROR_DOM_FILEHANDLE_NOT_ALLOWED_ERR);
     return nullptr;
   }
 
+  MOZ_ASSERT(GetOwner());
+
   nsRefPtr<IDBFileHandle> fileHandle =
     IDBFileHandle::Create(aMode, FileHandleBase::NORMAL, this);
   if (!fileHandle) {
     aError.Throw(NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
     return nullptr;
   }
 
   return fileHandle.forget();
@@ -360,21 +362,28 @@ IDBMutableFile::CreateFileObject(IDBFile
   return fileSnapshot.forget();
 }
 
 already_AddRefed<DOMRequest>
 IDBMutableFile::GetFile(ErrorResult& aError)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  // Do nothing if the window is closed
-  if (!GetOwner()) {
+  if (QuotaManager::IsShuttingDown() || FileService::IsShuttingDown()) {
+    aError.Throw(NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
     return nullptr;
   }
 
+  if (mDatabase->IsClosed()) {
+    aError.Throw(NS_ERROR_DOM_FILEHANDLE_NOT_ALLOWED_ERR);
+    return nullptr;
+  }
+
+  MOZ_ASSERT(GetOwner());
+
   nsRefPtr<IDBFileHandle> fileHandle =
     IDBFileHandle::Create(FileMode::Readonly, FileHandleBase::PARALLEL, this);
 
   nsRefPtr<IDBFileRequest> request = 
     IDBFileRequest::Create(GetOwner(),
                            fileHandle,
                            /* aWrapAsDOMRequest */ true);