Bug 1615851 - layer::Image::GetAsSourceSurface is fallible. r=lsalzman

This fixes a crash, where we expected it to be infallible.

Differential Revision: https://phabricator.services.mozilla.com/D63005

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Gilbert 2020-02-16 04:07:20 +00:00
Родитель 839d86eece
Коммит cc0f990650
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -615,6 +615,12 @@ UniquePtr<ImageBitmapCloneData> ImageBitmap::ToCloneData() const {
result->mPictureRect = mPictureRect;
result->mAlphaType = mAlphaType;
RefPtr<SourceSurface> surface = mData->GetAsSourceSurface();
if (!surface) {
// It might just not be possible to get/map the surface. (e.g. from another
// process)
return nullptr;
}
result->mSurface = surface->GetDataSurface();
MOZ_ASSERT(result->mSurface);
result->mWriteOnly = mWriteOnly;