cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Clelland (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-6352) FileSystem objects are not JSON-serializable
Date Wed, 26 Mar 2014 17:45:17 GMT
Ian Clelland created CB-6352:
--------------------------------

             Summary: FileSystem objects are not JSON-serializable
                 Key: CB-6352
                 URL: https://issues.apache.org/jira/browse/CB-6352
             Project: Apache Cordova
          Issue Type: Bug
          Components: Plugin File
            Reporter: Ian Clelland
            Assignee: Ian Clelland


Attempting to render a FileSystem object (or a FileEntry, or DirectoryEntry, or any other
object with a FileSystem contained it) results in the error:

{code}
TypeError: JSON.stringify cannot serialize cyclic structures.
{code}

(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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message