Bug 1362303 - Don't use a Shmem we failed to allocate in nsContentUtils. r=Bas

This commit is contained in:
Nicolas Silva
2017-05-15 12:15:48 +02:00
parent dfa37f98c7
commit 70f7fd76f9
3 changed files with 34 additions and 24 deletions

View File

@@ -55,9 +55,16 @@ nsDragServiceProxy::InvokeDragSessionImpl(nsIArray* aArrayTransferables,
if (dataSurface) {
size_t length;
int32_t stride;
Shmem surfaceData;
nsContentUtils::GetSurfaceData(dataSurface, &length, &stride, child,
&surfaceData);
Maybe<Shmem> maybeShm = nsContentUtils::GetSurfaceData(dataSurface,
&length,
&stride,
child);
if (maybeShm.isNothing()) {
return NS_ERROR_FAILURE;
}
auto surfaceData = maybeShm.value();
// Save the surface data to shared memory.
if (!surfaceData.IsReadable() || !surfaceData.get<char>()) {
NS_WARNING("Failed to create shared memory for drag session.");