From 57747b0f517790a5d52e0e1e4124b0e7d0fc0016 Mon Sep 17 00:00:00 2001 From: deanoemcke Date: Thu, 1 Jun 2017 10:57:01 -0400 Subject: [PATCH] Fix bug when trying to capture very long page --- src/js/contentscript.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/contentscript.js b/src/js/contentscript.js index 3c6b7a63..d4878ada 100644 --- a/src/js/contentscript.js +++ b/src/js/contentscript.js @@ -125,13 +125,15 @@ } }, 30000); - //if preview quality is high then capture the whole screen + //check where we need to capture the whole screen if (screenCapture === '2') { height = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight); + // cap the max height otherwise it fails to convert to a data url + height = Math.min(height, 10000); } else { height = Math.min(document.body.offsetHeight, window.innerHeight); } @@ -144,7 +146,9 @@ if (processing) { processing = false; timer = (new Date() - timer) / 1000; + console.log('canvas: ' + canvas); var dataUrl = canvas.toDataURL('image/webp', 0.8); + console.log('dataUrl: ' + dataUrl); chrome.runtime.sendMessage({ action: 'savePreviewData', previewUrl: dataUrl,