From 8e594d69d806abf6bda8057ba87ce92f68f5f306 Mon Sep 17 00:00:00 2001 From: Texot Date: Mon, 14 Oct 2019 21:17:46 +0800 Subject: [PATCH 1/3] Fix dom-to-image: illegal symbols in data-uri --- src/js/dom-to-image.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/dom-to-image.js b/src/js/dom-to-image.js index fa750ca7..7c86cdc1 100644 --- a/src/js/dom-to-image.js +++ b/src/js/dom-to-image.js @@ -1,6 +1,7 @@ // dom-to-image-2.6.0 // patched to add toCanvas public function (line 111) // patched to fix uncaught in promise (line 741) +// patched to fix illegal symbols in data-uri (line 349, 358) (function (global) { 'use strict'; @@ -345,7 +346,7 @@ node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); return new XMLSerializer().serializeToString(node); }) - .then(util.escapeXhtml) + // .then(util.escapeXhtml) .then(function (xhtml) { return '' + xhtml + ''; }) @@ -354,7 +355,7 @@ foreignObject + ''; }) .then(function (svg) { - return 'data:image/svg+xml;charset=utf-8,' + svg; + return 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg); }); } From fa874c854d4bdce72ca05bb80474e0cf60df08ac Mon Sep 17 00:00:00 2001 From: Texot Date: Tue, 15 Oct 2019 00:51:56 +0800 Subject: [PATCH 2/3] Adjust line numbers in comments --- src/js/dom-to-image.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/dom-to-image.js b/src/js/dom-to-image.js index 7c86cdc1..80516311 100644 --- a/src/js/dom-to-image.js +++ b/src/js/dom-to-image.js @@ -1,6 +1,6 @@ // dom-to-image-2.6.0 -// patched to add toCanvas public function (line 111) -// patched to fix uncaught in promise (line 741) +// patched to add toCanvas public function (line 112) +// patched to fix uncaught in promise (line 742) // patched to fix illegal symbols in data-uri (line 349, 358) (function (global) { 'use strict'; From 2eea3a5ec8c45870683c5a2f9773c3d42a4b60eb Mon Sep 17 00:00:00 2001 From: Texot Date: Tue, 15 Oct 2019 01:22:22 +0800 Subject: [PATCH 3/3] Allowing capturing youtube.com --- src/js/gsTabSuspendManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/gsTabSuspendManager.js b/src/js/gsTabSuspendManager.js index c10a3ebe..b912ccc3 100644 --- a/src/js/gsTabSuspendManager.js +++ b/src/js/gsTabSuspendManager.js @@ -560,7 +560,7 @@ var gsTabSuspendManager = (function() { if (useAlternateScreenCaptureLib) { // console.log('Generating via dom-to-image..'); generateCanvas = () => { - return domtoimage.toCanvas(document.body, {}).then(canvas => { + return domtoimage.toCanvas(document.body, {width: width, height: height}).then(canvas => { const croppedCanvas = document.createElement('canvas'); const context = croppedCanvas.getContext('2d'); croppedCanvas.width = width;