You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "David Kemp (JIRA)" <ji...@apache.org> on 2013/05/21 16:19:16 UTC

[jira] [Commented] (CB-3409) FileReader.readAsText(string) is deprecated and Broken. Needs to be removed.

    [ https://issues.apache.org/jira/browse/CB-3409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13663004#comment-13663004 ] 

David Kemp commented on CB-3409:
--------------------------------

I am looking at fixing this bug, but I am unclear what the expected behavior should be when you pass in a string.
In reviewing the function, the readAsText function appears to fail silently on most errors.
It does not report any problems with the passed file parameter by throwing exceptions or firing events. I can pass other invalid objects (like an array of strings) and it does nothing.

So - should I just have this fail silently - or make all bad objects report something?
                
> FileReader.readAsText(string) is deprecated and Broken. Needs to be removed.
> ----------------------------------------------------------------------------
>
>                 Key: CB-3409
>                 URL: https://issues.apache.org/jira/browse/CB-3409
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.7.0
>            Reporter: Flavio Spezi
>            Assignee: Joe Bowser
>              Labels: patch
>
> This is an example code:
> {code:javascript}
> function readMyFile() {
>     var filename = "testFile.txt";
>     var objFile = new FileReader();
>     objFile.onloadend = function(e) {
>         console.log("Result: " + JSON.stringify(e));
>     }
>    objFile.readAsText(filename);
> }
> {code}
> Collback function returns error:
> e.target.error.code = "JSON error"

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira