Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Attempting to render a FileSystem object (or a FileEntry, or DirectoryEntry, or any other object with a FileSystem contained it) results in the error:
TypeError: JSON.stringify cannot serialize cyclic structures.
(This is new behaviour with File 1.0.0)
This happens because of a cycle in the FileSystem object structure: FileSystem contains a 'root' property, which is a DirectoryEntry. The DirectoryEntry contains a 'filesystem' property, which is the original FileSystem.
I think that we can solve this with a .toJSON() method on the FileSystem object. This is supported (tested) on iOS and Android, and appears to be present in all versions of WebKit back to 2009. I don't believe that the presence of this method should have any side effects on webviews (if there are any) which do not support it.