Bug 1256515 - bail out in CanvasRenderingContext2D::DrawWindow if snapshotting draw target fails. r=bas.schouten a=lizzard
authorLee Salzman <lsalzman@mozilla.com>
Mon, 21 Mar 2016 10:48:35 -0400
changeset 325560 912b16ab7c907a05699720eea3c154c2cc303191
parent 325559 559ec5c54ac6293ed68625130cc6f7ab78ae61ab
child 325561 8996aca3a0059565159bad5053358df3541c95b1
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas, lizzard
bugs1256515
milestone47.0a2
Bug 1256515 - bail out in CanvasRenderingContext2D::DrawWindow if snapshotting draw target fails. r=bas.schouten a=lizzard MozReview-Commit-ID: LxQ3v8zqXI
dom/canvas/CanvasRenderingContext2D.cpp
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -4948,16 +4948,20 @@ CanvasRenderingContext2D::DrawWindow(nsG
 
   nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
   Unused << shell->RenderDocument(r, renderDocFlags, backgroundColor, thebes);
   // If this canvas was contained in the drawn window, the pre-transaction callback
   // may have returned its DT. If so, we must reacquire it here.
   EnsureTarget();
   if (drawDT) {
     RefPtr<SourceSurface> snapshot = drawDT->Snapshot();
+    if (NS_WARN_IF(!snapshot)) {
+      aError.Throw(NS_ERROR_FAILURE);
+      return;
+    }
     RefPtr<DataSourceSurface> data = snapshot->GetDataSurface();
 
     DataSourceSurface::MappedSurface rawData;
     if (NS_WARN_IF(!data->Map(DataSourceSurface::READ, &rawData))) {
         aError.Throw(NS_ERROR_FAILURE);
         return;
     }
     RefPtr<SourceSurface> source =