From 1903289616743ec0626e9a456c52926ad8257bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 4 Jan 2021 17:27:24 +0000 Subject: [PATCH] Bug 1684689 - Fix usage of createImageData in devtools. r=jdescottes This fixes the DAMP failures and effectively preserves behavior. Differential Revision: https://phabricator.services.mozilla.com/D100623 --- .../client/netmonitor/src/widgets/WaterfallBackground.js | 6 ++++-- devtools/client/performance/modules/waterfall-ticks.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/devtools/client/netmonitor/src/widgets/WaterfallBackground.js b/devtools/client/netmonitor/src/widgets/WaterfallBackground.js index f0b365a2586f..cfa735812c8a 100644 --- a/devtools/client/netmonitor/src/widgets/WaterfallBackground.js +++ b/devtools/client/netmonitor/src/widgets/WaterfallBackground.js @@ -59,8 +59,10 @@ class WaterfallBackground { } // Nuke the context. - const canvasWidth = (this.canvas.width = - state.waterfallWidth - REQUESTS_WATERFALL.LABEL_WIDTH); + const canvasWidth = (this.canvas.width = Math.max( + state.waterfallWidth - REQUESTS_WATERFALL.LABEL_WIDTH, + 1 + )); // Awww yeah, 1px, repeats on Y axis. const canvasHeight = (this.canvas.height = 1); diff --git a/devtools/client/performance/modules/waterfall-ticks.js b/devtools/client/performance/modules/waterfall-ticks.js index a2ba5bfe427b..efc88001f3f1 100644 --- a/devtools/client/performance/modules/waterfall-ticks.js +++ b/devtools/client/performance/modules/waterfall-ticks.js @@ -22,7 +22,7 @@ function drawWaterfallBackground(doc, dataScale, waterfallWidth) { const ctx = canvas.getContext("2d"); // Nuke the context. - const canvasWidth = (canvas.width = waterfallWidth); + const canvasWidth = (canvas.width = Math.max(waterfallWidth, 1)); // Awww yeah, 1px, repeats on Y axis. const canvasHeight = (canvas.height = 1);