From ec00d5890eb426fd63b13ea4ba6c2d95fad76c85 Mon Sep 17 00:00:00 2001 From: Mihai Alexandru Michis Date: Thu, 15 Aug 2019 11:25:58 +0300 Subject: [PATCH] Backed out 4 changesets (bug 1570147) for causing failures in test_drawSnapshot.html Backed out changeset b5d442a2f457 (bug 1570147) Backed out changeset 7a24b9027519 (bug 1570147) Backed out changeset 4d528be8bae4 (bug 1570147) Backed out changeset 4b4feec0a4e2 (bug 1570147) --HG-- extra : rebase_source : 853ca7b91ba6973f0ca02641a58773ca2b42d113 --- .../chrome/test_drawWindow_widget_layers.html | 14 +++---- dom/canvas/test/file_drawWindow_common.js | 28 +++++++------- dom/canvas/test/mochitest.ini | 2 - dom/canvas/test/test_drawSnapshot.html | 38 ------------------- dom/canvas/test/test_drawWindow.html | 20 +++++----- .../content/SpecialPowersAPI.jsm | 32 ++++------------ .../content/SpecialPowersAPIParent.jsm | 23 ----------- 7 files changed, 37 insertions(+), 120 deletions(-) delete mode 100644 dom/canvas/test/test_drawSnapshot.html diff --git a/dom/canvas/test/chrome/test_drawWindow_widget_layers.html b/dom/canvas/test/chrome/test_drawWindow_widget_layers.html index 151c08ff1be6..c5707b786cdb 100644 --- a/dom/canvas/test/chrome/test_drawWindow_widget_layers.html +++ b/dom/canvas/test/chrome/test_drawWindow_widget_layers.html @@ -34,16 +34,12 @@ SimpleTest.waitForFocus(runTests, sourceWindow); } - async function runTests() { + function runTests() { var cxInterfaceWrap = SpecialPowers.wrap(CanvasRenderingContext2D); - - let snapshot = function(context, x, y, width, height, bg) { - var flags = cxInterfaceWrap.DRAWWINDOW_USE_WIDGET_LAYERS | - cxInterfaceWrap.DRAWWINDOW_DRAW_CARET | - cxInterfaceWrap.DRAWWINDOW_DRAW_VIEW; - context.drawWindow(sourceWindow, x, y, width, height, bg, flags); - } - await runDrawWindowTests(snapshot, true); + var flags = cxInterfaceWrap.DRAWWINDOW_USE_WIDGET_LAYERS | + cxInterfaceWrap.DRAWWINDOW_DRAW_CARET | + cxInterfaceWrap.DRAWWINDOW_DRAW_VIEW; + runDrawWindowTests(sourceWindow, flags, true); sourceWindow.close(); diff --git a/dom/canvas/test/file_drawWindow_common.js b/dom/canvas/test/file_drawWindow_common.js index 6c699decab6e..0409911b7d89 100644 --- a/dom/canvas/test/file_drawWindow_common.js +++ b/dom/canvas/test/file_drawWindow_common.js @@ -1,7 +1,7 @@ const CANVAS_WIDTH = 200; const CANVAS_HEIGHT = 100; -async function runDrawWindowTests(snapshotCallback, transparentBackground) { +function runDrawWindowTests(win, drawWindowFlags, transparentBackground) { function make_canvas() { var canvas = document.createElement("canvas"); canvas.setAttribute("height", CANVAS_HEIGHT); @@ -37,13 +37,14 @@ async function runDrawWindowTests(snapshotCallback, transparentBackground) { // Basic tests of drawing the whole document on a background clear("white"); - await snapshotCallback( - testWrapCx, + testWrapCx.drawWindow( + win, 0, 0, CANVAS_WIDTH, CANVAS_HEIGHT, - "rgb(255, 255, 255)" + "rgb(255, 255, 255)", + drawWindowFlags ); refCx.fillStyle = "fuchsia"; refCx.fillRect(10, 10, 20, 20); @@ -61,13 +62,14 @@ async function runDrawWindowTests(snapshotCallback, transparentBackground) { ); clearTest("white"); - await snapshotCallback( - testWrapCx, + testWrapCx.drawWindow( + win, 0, 0, CANVAS_WIDTH, CANVAS_HEIGHT, - "rgb(255, 255, 0)" + "rgb(255, 255, 0)", + drawWindowFlags ); assertSnapshots( testCanvas, @@ -100,7 +102,7 @@ async function runDrawWindowTests(snapshotCallback, transparentBackground) { clear("white"); testCx.translate(17, 31); - await snapshotCallback(testWrapCx, 40, 0, 40, 40, "white"); + testWrapCx.drawWindow(win, 40, 0, 40, 40, "white", drawWindowFlags); refCx.fillStyle = "aqua"; refCx.fillRect(17 + 10, 31 + 10, 20, 20); @@ -117,7 +119,7 @@ async function runDrawWindowTests(snapshotCallback, transparentBackground) { clear("blue"); testCx.translate(17, 31); - await snapshotCallback(testWrapCx, 40, 0, 35, 45, "green"); + testWrapCx.drawWindow(win, 40, 0, 35, 45, "green", drawWindowFlags); if (transparentBackground) { refCx.fillStyle = "green"; @@ -141,7 +143,7 @@ async function runDrawWindowTests(snapshotCallback, transparentBackground) { clear("blue"); testCx.translate(17, 31); - await snapshotCallback(testWrapCx, 40, 0, 35, 45, "transparent"); + testWrapCx.drawWindow(win, 40, 0, 35, 45, "transparent", drawWindowFlags); if (!transparentBackground) { refCx.fillStyle = "white"; @@ -164,12 +166,12 @@ async function runDrawWindowTests(snapshotCallback, transparentBackground) { testCx.translate(9, 3); // 5, 8 is 5, 2 from the corner of the fuchsia square - await snapshotCallback(testWrapCx, 5, 8, 30, 25, "maroon"); + testWrapCx.drawWindow(win, 5, 8, 30, 25, "maroon", drawWindowFlags); // 35, 0 is 15, 10 from the corner of the aqua square - await snapshotCallback(testWrapCx, 35, 0, 50, 40, "transparent"); + testWrapCx.drawWindow(win, 35, 0, 50, 40, "transparent", drawWindowFlags); testCx.translate(15, 0); // 85, 5 is 5, 5 from the corner of the yellow square - await snapshotCallback(testWrapCx, 85, 5, 30, 25, "transparent"); + testWrapCx.drawWindow(win, 85, 5, 30, 25, "transparent", drawWindowFlags); if (transparentBackground) { refCx.fillStyle = "maroon"; diff --git a/dom/canvas/test/mochitest.ini b/dom/canvas/test/mochitest.ini index 44c4455077ca..f8ad20993c54 100644 --- a/dom/canvas/test/mochitest.ini +++ b/dom/canvas/test/mochitest.ini @@ -226,8 +226,6 @@ support-files = captureStream_common.js [test_drawImage_edge_cases.html] [test_drawWindow.html] support-files = file_drawWindow_source.html file_drawWindow_common.js -[test_drawSnapshot.html] -support-files = file_drawWindow_source.html file_drawWindow_common.js [test_imagebitmap.html] skip-if = android_version == '19' # bug 1336581 tags = imagebitmap diff --git a/dom/canvas/test/test_drawSnapshot.html b/dom/canvas/test/test_drawSnapshot.html deleted file mode 100644 index e3019057dc7c..000000000000 --- a/dom/canvas/test/test_drawSnapshot.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Test for drawSnapshot - - - - - - - -Mozilla Bug - - - diff --git a/dom/canvas/test/test_drawWindow.html b/dom/canvas/test/test_drawWindow.html index f00d8f285d73..fd24661f8564 100644 --- a/dom/canvas/test/test_drawWindow.html +++ b/dom/canvas/test/test_drawWindow.html @@ -23,25 +23,23 @@ "width=200,height=100"); sourceWindow.addEventListener("load", runTests); } - - async function runTests(event) { + + function runTests(event) { if (event.target != sourceWindow.document) { return; } - let win = document.getElementById("source").contentWindow; - let snapshot = function(context, x, y, width, height, bg) { - context.drawWindow(win, x, y, width, height, bg, 0); - } - // Run the tests with the source document in an