Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to suspend the page with screen capture on #657

Open
sergiorussia opened this issue Feb 12, 2018 · 7 comments
Open

Failed to suspend the page with screen capture on #657

sergiorussia opened this issue Feb 12, 2018 · 7 comments

Comments

@sergiorussia
Copy link

Hi!
Steps to reproduce:

  1. goto http://en.miui.com/forum.php
  2. try to suspend the tab
  3. the tab won't suspend, Console says "Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported."

Reproducible: stable

@Firecul
Copy link

Firecul commented Feb 25, 2018

Sorry suspends fine for me.

@sergiorussia
Copy link
Author

reproduced on both my machines.
here are few more details:

chrome console log:

contentscript.js:149 canvas: [object HTMLCanvasElement]
contentscript.js:150 Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
    at Object.onrendered (chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/js/contentscript.js:150:46)
    at Object.o.complete (file:///home/sergio/.config/google-chrome/Default/Extensions/klbibkeccnjlkjkiokjodocebajanakg/6.30_0/js/html2canvas.min.js:8:2419)
    at o (file:///home/sergio/.config/google-chrome/Default/Extensions/klbibkeccnjlkjkiokjodocebajanakg/6.30_0/js/html2canvas.min.js:7:28352)
    at Image.e.onload (file:///home/sergio/.config/google-chrome/Default/Extensions/klbibkeccnjlkjkiokjodocebajanakg/6.30_0/js/html2canvas.min.js:7:29918)
onrendered @ contentscript.js:150
o.complete @ html2canvas.min.js:8
o @ html2canvas.min.js:7
e.onload @ html2canvas.min.js:7

Chrome 64, Ubuntu 16.04, adblockers were turned off for the test

@deanoemcke
Copy link
Collaborator

I have been able to reliably reproduce this.
It's important to note that it only occurs if the 'screen capturing' option is turned on.
It is an issue with the html2canvas library that I use. I have raised an issue on that project: niklasvh/html2canvas#1466

The current alpha build of TGS will not fail to suspend on this page, however, it will not be able to produce the screenshot and will just show a normal blank suspended tab page.

@deanoemcke
Copy link
Collaborator

People have suggested using https://github.com/tsayen/dom-to-image instead of html2canvas (as a solution to the above issue).
I will look into this as part of: #677

@deanoemcke
Copy link
Collaborator

I have added support for the dom-to-image screencapture library. Although it appears to be much slower, and also less reliable than html2canvas.
You can switch to the dom-to-image library by going to the extension debug.html page (chrome-extension:///debug.html) and toggling the "useAlternateScreenCaptureLib" option.

@sergiorussia
Copy link
Author

nice, thanks, will check it out

@Pascal666
Copy link

Hopefully this change also fixes suspending https://9gag.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants