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

Uncaught (in promise) RangeError: Maximum call stack size exceeded - 1.0.0-rc.2 #1858

Closed
pupunzi opened this issue May 29, 2019 · 6 comments · Fixed by #1862
Closed

Uncaught (in promise) RangeError: Maximum call stack size exceeded - 1.0.0-rc.2 #1858

pupunzi opened this issue May 29, 2019 · 6 comments · Fixed by #1862

Comments

@pupunzi
Copy link

pupunzi commented May 29, 2019

  • Using the latest version
  • Testing using the non-minified version of html2canvas and checked any potential issues reported in the console

Bug reports:

Updating to the latest 1.0.0-rc.2 version, DOM elements with a base64 background-image generate a blocking error (the previous 1.0.0-rc.1 didn't) :

Uncaught (in promise) RangeError: Maximum call stack size exceeded
    at Tokenizer.write (html2canvas.js:1019)
    at parse (html2canvas.js:4105)
    at new CSSParsedDeclaration (html2canvas.js:3998)
    at new ElementContainer (html2canvas.js:4138)
    at createContainer (html2canvas.js:4485)
    at parseNodeTree (html2canvas.js:4438)
    at parseTree (html2canvas.js:4490)
    at html2canvas.js:6937
    at step (html2canvas.js:83)
    at Object.next (html2canvas.js:64)

You can test yourself the issue here:
https://open-lab.com/storyboarder/test/test.html

At this page, you can also see that the image has an "object-fit: cover" CSS property that is ignored and that if you scroll the page the capture of the image is white.

Specifications:

  • html2canvas version tested with: 1.0.0-rc.2
  • Browser & version: Chrome 74.0.3729.169
  • Operating system: Mac OSX 10.14.5
@pupunzi pupunzi changed the title Uncaught (in promise) RangeError: Maximum call stack size exceeded Uncaught (in promise) RangeError: Maximum call stack size exceeded - 1.0.0-rc.2 May 29, 2019
@pupunzi
Copy link
Author

pupunzi commented May 30, 2019

@niklasvh : Thank you for the fast support!

@marshallino16
Copy link

Still happening on mobile devices

@JerryLMJ
Copy link

JerryLMJ commented Dec 2, 2019

@marshallino16 Have you solved the problem yet?

@marshallino16
Copy link

My workaround was to stop using the image as a background-image of my div and use it in an img tag.

To get rid of the object-fit CSS property I used two classes : one portrait and one landscape to alternate width or height to 100%.

ex :

.background-image.portrait {
            height: auto;
            width: 100%;
        }

@z1haze
Copy link

z1haze commented Jul 31, 2020

Can we get a fix for this on safari?

@fabiankoebel
Copy link

fabiankoebel commented Aug 3, 2021

edit: the problem still occurs in v1.1.5.

for me the issue is resolved by reducing the SLICE_STACK_SIZE from 60000 to 30000 (see https://github.com/niklasvh/html2canvas/blob/master/src/css/syntax/tokenizer.ts#L660).
Maybe @niklasvh could add some technical background regarding SLICE_STACK_SIZE.

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

Successfully merging a pull request may close this issue.

5 participants