Bug 1292786 - Don't SetFrameCapture() when CopySurface() fails. r?nical
MozReview-Commit-ID: FNNMs6N9lJF
--- a/dom/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -125,16 +125,19 @@ public:
}
RefPtr<SourceSurface> snapshot = mOwningElement->GetSurfaceSnapshot(nullptr);
if (!snapshot) {
return;
}
RefPtr<DataSourceSurface> copy = CopySurface(snapshot);
+ if (!copy) {
+ return;
+ }
mOwningElement->SetFrameCapture(copy.forget());
mOwningElement->MarkContextCleanForFrameCapture();
}
void DetachFromRefreshDriver()
{
MOZ_ASSERT(mOwningElement);