Index: chrome/content/ui/sendReport.js |
=================================================================== |
--- a/chrome/content/ui/sendReport.js |
+++ b/chrome/content/ui/sendReport.js |
@@ -354,36 +354,43 @@ var screenshotDataSource = |
setData: function(screenshot) |
{ |
let canvas = E("screenshotCanvas"); |
// Do not resize canvas any more (no idea why Gecko requires both to be set) |
canvas.parentNode.style.MozBoxAlign = "center"; |
canvas.parentNode.align = "center"; |
- // Init canvas settings |
let context = canvas.getContext("2d"); |
- context.fillStyle = "rgb(0, 0, 0)"; |
- context.strokeStyle = "rgba(255, 0, 0, 0.7)"; |
- context.lineWidth = 3; |
- context.lineJoin = "round"; |
- |
this._canvas = canvas; |
this._context = context; |
- if (screenshot) |
- { |
- let image = new Image(); |
- image.src = screenshot; |
- image.addEventListener("load", () => { |
- canvas.width = image.width + this.imageOffset * 2; |
- canvas.height = image.height + this.imageOffset * 2; |
- context.drawImage(image, this.imageOffset, this.imageOffset); |
- }); |
- } |
+ let drawScreenshot = new Promise((resolve, reject) => { |
+ if (screenshot) |
+ { |
+ let image = new Image(); |
+ image.src = screenshot; |
+ image.addEventListener("load", () => { |
+ canvas.width = image.width + this.imageOffset * 2; |
+ canvas.height = image.height + this.imageOffset * 2; |
+ context.drawImage(image, this.imageOffset, this.imageOffset); |
+ resolve(); |
+ }); |
+ } |
+ else |
+ resolve(); |
+ }); |
+ |
+ drawScreenshot.then(() => { |
+ // Init canvas settings, this has to be done after the canvas size is set |
+ context.fillStyle = "rgb(0, 0, 0)"; |
+ context.strokeStyle = "rgba(255, 0, 0, 0.7)"; |
+ context.lineWidth = 3; |
+ context.lineJoin = "round"; |
+ }); |
}, |
get enabled() |
{ |
return this._enabled |
}, |
set enabled(enabled) |
{ |