Bug 1054598 - Don't assert when invalid file descriptor received. r=jduell
authorShian-Yow Wu <swu@mozilla.com>
Fri, 19 Sep 2014 15:29:36 +0800
changeset 206222 3473082f0de437f4b1711de524bfb64c10a5112f
parent 206221 ff5190310b3c9f815216f4c2fbc4217f6fbcdb2f
child 206223 c3173fa1200bef8d50a7a8b4874900fcf0b2a286
push id8859
push userryanvm@gmail.com
push dateFri, 19 Sep 2014 18:19:29 +0000
treeherderfx-team@42f7ab962b31 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs1054598
milestone35.0a1
Bug 1054598 - Don't assert when invalid file descriptor received. r=jduell
ipc/glue/FileDescriptor.cpp
--- a/ipc/glue/FileDescriptor.cpp
+++ b/ipc/glue/FileDescriptor.cpp
@@ -37,17 +37,17 @@ FileDescriptor::FileDescriptor(PlatformH
   mHandleCreatedByOtherProcessWasUsed(false)
 {
   DuplicateInCurrentProcess(aHandle);
 }
 
 void
 FileDescriptor::DuplicateInCurrentProcess(PlatformHandleType aHandle)
 {
-  MOZ_ASSERT_IF(mHandleCreatedByOtherProcess,
+  MOZ_ASSERT_IF(mHandleCreatedByOtherProcess && IsValid(),
                 mHandleCreatedByOtherProcessWasUsed);
 
   if (IsValid(aHandle)) {
     PlatformHandleType newHandle;
 #ifdef XP_WIN
     if (DuplicateHandle(GetCurrentProcess(), aHandle, GetCurrentProcess(),
                         &newHandle, 0, FALSE, DUPLICATE_SAME_ACCESS)) {
 #else // XP_WIN
@@ -60,17 +60,17 @@ FileDescriptor::DuplicateInCurrentProces
   }
 
   mHandle = INVALID_HANDLE;
 }
 
 void
 FileDescriptor::CloseCurrentProcessHandle()
 {
-  MOZ_ASSERT_IF(mHandleCreatedByOtherProcess,
+  MOZ_ASSERT_IF(mHandleCreatedByOtherProcess && IsValid(),
                 mHandleCreatedByOtherProcessWasUsed);
 
   // Don't actually close handles created by another process.
   if (mHandleCreatedByOtherProcess) {
     return;
   }
 
   if (IsValid()) {