From 96b2096dd326ea5525e7d7cc838524854de40e4d Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Mon, 21 Mar 2016 10:48:35 -0400 Subject: [PATCH] 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 99e54175118..c7fa8ef7999 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -4953,6 +4953,10 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& aWindow, double aX, EnsureTarget(); if (drawDT) { RefPtr snapshot = drawDT->Snapshot(); + if (NS_WARN_IF(!snapshot)) { + aError.Throw(NS_ERROR_FAILURE); + return; + } RefPtr data = snapshot->GetDataSurface(); DataSourceSurface::MappedSurface rawData;