Bug 1246775 - fix Canvas2D drawWindow to reacquire its DT after rendering. r=bas

This commit is contained in:
Lee Salzman 2016-02-10 13:17:56 -05:00
parent c631aefd3b
commit 42a8ea393d
3 changed files with 19 additions and 0 deletions

View File

@ -4914,6 +4914,9 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& aWindow, double aX,
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();
RefPtr<DataSourceSurface> data = snapshot->GetDataSurface();

View File

@ -0,0 +1,15 @@
<html>
<head>
<script>
function boom()
{
var canvas = document.getElementById("canvas");
var ctx = SpecialPowers.wrap(canvas.getContext("2d"));
ctx.drawWindow(window, 0, 0, canvas.width, canvas.height, "red");
}
</script>
</head>
<body onload="boom();">
<canvas id="canvas" width="10" height="10"></canvas>
</body>
</html>

View File

@ -29,4 +29,5 @@ skip-if(azureCairo) load 1229983-1.html
load 1229932-1.html
load 1233613.html
load 1244850-1.html
load 1246775-1.html
load texImage2D.html