Bug 1171614 - Remove the special path for data-URI images from the server inspector actor r=jdescottes
MozReview-Commit-ID: 2tWleM1wH1G
--- a/devtools/server/actors/inspector.js
+++ b/devtools/server/actors/inspector.js
@@ -3023,32 +3023,25 @@ var imageToImageData = Task.async(functi
let imgWidth = node.naturalWidth || node.width;
let imgHeight = node.naturalHeight || node.height;
let imgMax = Math.max(imgWidth, imgHeight);
if (maxDim && imgMax > maxDim) {
resizeRatio = maxDim / imgMax;
}
// Extract the image data
- let imageData;
- // The image may already be a data-uri, in which case, save ourselves the
- // trouble of converting via the canvas.drawImage.toDataURL method
- if (isImg && node.src.startsWith("data:")) {
- imageData = node.src;
- } else {
- // Create a canvas to copy the rawNode into and get the imageData from
- let canvas = node.ownerDocument.createElementNS(XHTML_NS, "canvas");
- canvas.width = imgWidth * resizeRatio;
- canvas.height = imgHeight * resizeRatio;
- let ctx = canvas.getContext("2d");
-
- // Copy the rawNode image or canvas in the new canvas and extract data
- ctx.drawImage(node, 0, 0, canvas.width, canvas.height);
- imageData = canvas.toDataURL("image/png");
- }
+ // Create a canvas to copy the rawNode into and get the imageData from
+ let canvas = node.ownerDocument.createElementNS(XHTML_NS, "canvas");
+ canvas.width = imgWidth * resizeRatio;
+ canvas.height = imgHeight * resizeRatio;
+ let ctx = canvas.getContext("2d");
+
+ // Copy the rawNode image or canvas in the new canvas and extract data
+ ctx.drawImage(node, 0, 0, canvas.width, canvas.height);
+ let imageData = canvas.toDataURL("image/png");
return {
data: imageData,
size: {
naturalWidth: imgWidth,
naturalHeight: imgHeight,
resized: resizeRatio !== 1
}