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

JSON.stringify can cause "too much recursion" involving ICAL.Time.fromData #410

Closed
PaulMorris opened this issue Dec 5, 2019 · 1 comment

Comments

@PaulMorris
Copy link

See bugzilla bug 1546606 starting with comment 23. In short, an assertion in a unit test calls JSON.stringify on its arguments to log the result of the assertion, and that causes a "too much recursion" error that involves ICAL.Time.fromData. It looks like this when you add a console.trace at the top of that fromData function:

 0:19.93 pid:3758 JavaScript error: resource://calendar/modules/ical.js, line 4946: too much recursion
 0:19.93 pid:3758 console.trace: 
 0:19.93 pid:3758 resource://calendar/modules/ical.js 4946 fromData
 0:19.93 pid:3758 resource://calendar/modules/ical.js 4813 icaltime
 0:19.94 pid:3758 resource://calendar/modules/ical.js 4863 clone
 0:19.94 pid:3758 resource://calendar/modules/ical.js 5040 startOfWeek
 0:19.94 pid:3758 resource://calendar/calendar-js/calDateTime.js 165 get startOfWeek
 0:19.94 pid:3758 resource://testing-common/Assert.jsm 87 getMessage
 0:19.94 pid:3758 resource://testing-common/Assert.jsm 127 Assert.AssertionError
 0:19.94 pid:3758 resource://testing-common/Assert.jsm 220 proto.report
 0:19.94 pid:3758 resource://testing-common/Assert.jsm 354 strictEqual
 0:19.94 pid:3758 [...]/obj-artifact/_tests/xpcshell/comm/calendar/test/unit/test_caldav_requests.js 903 test_freebusy_request

Without the console.trace the error is:

0:02.87 pid:3993 JavaScript error: resource://calendar/modules/ical.js, line 5720: too much recursion
 0:03.51 pid:3993 JavaScript error: resource://calendar/modules/ical.js, line 5720: too much recursion

The 5720 line reference points to setupNormalizeAttributes > defineAttr > defineProperty > set > setTimeAttr

@kewisch
Copy link
Owner

kewisch commented May 1, 2024

I think this might be somewhat expected, the properties will contain references to parents etc, and there may be cyclic references. Let's close this one for now, but I'm open to patches that would make this less likely.

@kewisch kewisch closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
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

No branches or pull requests

2 participants