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

Sergey Shakhnazarov commented on CB-10960:
------------------------------------------

Reproduced the issue, investigating.
Note that the [Blob constructor 
polyfill|https://github.com/MobileChromeApps/mobile-chrome-apps/commit/f4f884ffbf7af1c30b9da559f8afbccbca0bb151]
 is required (at least for Android 4.3) to avoid the following error:
{noformat}
I/Web Console(10809): Error in Success callbackId: File82774416 : TypeError: 
Illegal constructor:312
E/Web Console(10809): Uncaught TypeError: Illegal constructor:314
{noformat}

> Uncaught #<FileError> in write() when readyState != WRITING ?
> -------------------------------------------------------------
>
>                 Key: CB-10960
>                 URL: https://issues.apache.org/jira/browse/CB-10960
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin File
>    Affects Versions: 4.1.1
>         Environment: Android
>            Reporter: Samo Dadela
>              Labels: android
>         Attachments: code.js
>
>
> Excuse me if I did something stupid - I'm new to Cordova and JS.
> I thought that calling write() after checking readyState != WRITING would 
> work. 
> {code}
> function writeQueue(c) {
>         while ( !(logWriter.readyState === FileWriter.WRITING) ) {
>             var msg = logQueue.dequeue();
>             if (!msg) {
>                 return;
>             }
>             var blob = new Blob([msg+c], { type: 'text/plain' });
>             logWriter.write(blob);
>         }
>     }
> }
> {code}
> But I get:
> 0     277161   log      log writer: cdvfile://localhost/files/bala.log
> 1     277199   log      log writer: onwriteend
> 2     283616   log      log writer: onwriteend
> 3     283629   log      log writer: onwriteend
> 4     283651   error    Uncaught #<FileError>, 
> http://192.168.1.200:8100/plugins/cordova-plugin-file/www/FileWriter.js, 
> Line: 130
> Line 130 is:
> {code}
>     // Throw an exception if we are already writing a file
>     if (this.readyState === FileWriter.WRITING) {
>         throw new FileError(FileError.INVALID_STATE_ERR);
>     }
> {code}
> How can readyState change to WRITING ? 
> Note: Queue is pure Javascript 
> (http://code.stephenmorley.org/javascript/queues/Queue.src.js)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to