From d4679107402e5a7c061b7cea12b2ea7bd4604cb9 Mon Sep 17 00:00:00 2001 From: James Graham Date: Wed, 13 Mar 2019 13:10:02 +0000 Subject: [PATCH] Bug 1532580 - Fix wpt reftest window dimensions, r=gsnedders The wpt reftest window was mixing up width and height for initial opening, meaining that it would be the wrong shape for non-square configurations. This caused us to go down a path where we weren't passing DRAWWINDOW_USE_WIDGET_LAYERS which turns out to be broken and result in frequent blank screenshots. Fix the window dimensions and make the broken path an error instead. Differential Revision: https://phabricator.services.mozilla.com/D23323 --- testing/marionette/reftest.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/testing/marionette/reftest.js b/testing/marionette/reftest.js index 3309289b1263..9a2802361d4e 100644 --- a/testing/marionette/reftest.js +++ b/testing/marionette/reftest.js @@ -128,7 +128,7 @@ reftest.Runner = class { let reftestWin = this.parentWindow.open( "chrome://marionette/content/reftest.xul", "reftest", - `chrome,height=${width},width=${height}`); + `chrome,height=${height},width=${width}`); await new Promise(resolve => { reftestWin.addEventListener("load", resolve, {once: true}); @@ -460,16 +460,21 @@ max-width: ${width}px; max-height: ${height}px`; let ctxInterface = win.CanvasRenderingContext2D; let flags = ctxInterface.DRAWWINDOW_DRAW_CARET | - ctxInterface.DRAWWINDOW_DRAW_VIEW; + ctxInterface.DRAWWINDOW_DRAW_VIEW | + ctxInterface.DRAWWINDOW_USE_WIDGET_LAYERS; - if (0 <= browserRect.left && - 0 <= browserRect.top && - win.innerWidth >= browserRect.width && - win.innerHeight >= browserRect.height) { - logger.debug("Using DRAWWINDOW_USE_WIDGET_LAYERS"); - flags |= ctxInterface.DRAWWINDOW_USE_WIDGET_LAYERS; - } else { - logger.debug("Not using DRAWWINDOW_USE_WIDGET_LAYERS"); + if (!(0 <= browserRect.left && + 0 <= browserRect.top && + win.innerWidth >= browserRect.width && + win.innerHeight >= browserRect.height)) { + logger.error(`Invalid window dimensions: +browserRect.left: ${browserRect.left} +browserRect.top: ${browserRect.top} +win.innerWidth: ${win.innerWidth} +browserRect.width: ${browserRect.width} +win.innerHeight: ${win.innerHeight} +browserRect.height: ${browserRect.height}`); + throw new Error("Window has incorrect dimensions"); } url = new URL(url).href; // normalize the URL