зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1272203 (part 3) - Use NotNull in nsContentUtils::GetSurfaceData(). r=froydnj.
This might not look compelling in isolation, but this use of NotNull would have prevented the null dereference crash in bug 1268721.
This commit is contained in:
Родитель
19c16a645a
Коммит
62f0bd3e33
|
@ -7424,7 +7424,8 @@ nsContentUtils::TransferableToIPCTransferable(nsITransferable* aTransferable,
|
|||
size_t length;
|
||||
int32_t stride;
|
||||
mozilla::UniquePtr<char[]> surfaceData =
|
||||
nsContentUtils::GetSurfaceData(dataSurface, &length, &stride);
|
||||
nsContentUtils::GetSurfaceData(WrapNotNull(dataSurface), &length,
|
||||
&stride);
|
||||
|
||||
IPCDataTransferItem* item = aIPCDataTransfer->items().AppendElement();
|
||||
item->flavor() = flavorStr;
|
||||
|
@ -7528,8 +7529,9 @@ nsContentUtils::TransferableToIPCTransferable(nsITransferable* aTransferable,
|
|||
}
|
||||
|
||||
mozilla::UniquePtr<char[]>
|
||||
nsContentUtils::GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
|
||||
size_t* aLength, int32_t* aStride)
|
||||
nsContentUtils::GetSurfaceData(
|
||||
NotNull<mozilla::gfx::DataSourceSurface*> aSurface,
|
||||
size_t* aLength, int32_t* aStride)
|
||||
{
|
||||
mozilla::gfx::DataSourceSurface::MappedSurface map;
|
||||
if (NS_WARN_IF(!aSurface->Map(mozilla::gfx::DataSourceSurface::MapType::READ, &map))) {
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/net/ReferrerPolicy.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/NotNull.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
@ -2432,8 +2433,9 @@ public:
|
|||
* Get the pixel data from the given source surface and return it as a buffer.
|
||||
* The length and stride will be assigned from the surface.
|
||||
*/
|
||||
static mozilla::UniquePtr<char[]> GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
|
||||
size_t* aLength, int32_t* aStride);
|
||||
static mozilla::UniquePtr<char[]> GetSurfaceData(
|
||||
mozilla::NotNull<mozilla::gfx::DataSourceSurface*> aSurface,
|
||||
size_t* aLength, int32_t* aStride);
|
||||
|
||||
// Helpers shared by the implementations of nsContentUtils methods and
|
||||
// nsIDOMWindowUtils methods.
|
||||
|
|
|
@ -990,7 +990,7 @@ PuppetWidget::SetCursor(imgIContainer* aCursor,
|
|||
size_t length;
|
||||
int32_t stride;
|
||||
mozilla::UniquePtr<char[]> surfaceData =
|
||||
nsContentUtils::GetSurfaceData(dataSurface, &length, &stride);
|
||||
nsContentUtils::GetSurfaceData(WrapNotNull(dataSurface), &length, &stride);
|
||||
|
||||
nsDependentCString cursorData(surfaceData.get(), length);
|
||||
mozilla::gfx::IntSize size = dataSurface->GetSize();
|
||||
|
|
|
@ -55,7 +55,8 @@ nsDragServiceProxy::InvokeDragSessionImpl(nsISupportsArray* aArrayTransferables,
|
|||
size_t length;
|
||||
int32_t stride;
|
||||
mozilla::UniquePtr<char[]> surfaceData =
|
||||
nsContentUtils::GetSurfaceData(dataSurface, &length, &stride);
|
||||
nsContentUtils::GetSurfaceData(WrapNotNull(dataSurface), &length,
|
||||
&stride);
|
||||
nsDependentCString dragImage(surfaceData.get(), length);
|
||||
|
||||
mozilla::Unused <<
|
||||
|
|
Загрузка…
Ссылка в новой задаче