Bug 1292786 - Don't SetFrameCapture() when CopySurface() fails. r=nical
authorAndreas Pehrson <pehrsons@gmail.com>
Wed, 17 Aug 2016 15:54:56 +0200
changeset 309915 828e9a557da41456e19186491dc9f0d46edb23a4
parent 309914 6e47ce14d2b8ccbc1adfcfd6a0b984d7f2993ebb
child 309916 e6b28b84c2cb280bd508661013849b6b15813629
push id31478
push userpehrsons@gmail.com
push dateThu, 18 Aug 2016 10:11:26 +0000
treeherderautoland@828e9a557da4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1292786
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1292786 - Don't SetFrameCapture() when CopySurface() fails. r=nical MozReview-Commit-ID: FNNMs6N9lJF
dom/html/HTMLCanvasElement.cpp
--- 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);