You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by daserge <gi...@git.apache.org> on 2016/04/07 12:14:27 UTC

[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

GitHub user daserge opened a pull request:

    https://github.com/apache/cordova-plugin-file/pull/177

    CB-10960 Uncaught #<FileError> in write() when readyState != WRITING ?

    [Jira issue](https://issues.apache.org/jira/browse/CB-10960)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-plugin-file CB-10960

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-file/pull/177.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #177
    
----
commit 420bf552d42ec5d958881dea6d5dc64805a06282
Author: daserge <v-...@microsoft.com>
Date:   2016-04-07T09:06:14Z

    CB-10960 Uncaught #<FileError> in write() when readyState != WRITING ?

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/177#issuecomment-207004588
  
    Please find the issue details in the [Jira](https://issues.apache.org/jira/browse/CB-10960).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-file/pull/177


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-file/pull/177#discussion_r58923252
  
    --- Diff: www/FileWriter.js ---
    @@ -107,8 +108,29 @@ FileWriter.prototype.write = function(data) {
             var fileReader = new FileReader();
             fileReader.onload = function() {
                 // Call this method again, with the arraybuffer as argument
    -            FileWriter.prototype.write.call(that, this.result);
    +            FileWriter.prototype.write.call(that, this.result, true /* isPendingBlobReadResult */);
             };
    +        fileReader.onerror = function (evt) {
    +            // DONE state
    +            that.readyState = FileWriter.DONE;
    +
    +            // Save error
    +            that.error = evt.target.error;
    --- End diff --
    
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by jasongin <gi...@git.apache.org>.
Github user jasongin commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/177#issuecomment-207042297
  
    LGTM aside from the minor issues I commented on.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by jasongin <gi...@git.apache.org>.
Github user jasongin commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-file/pull/177#discussion_r58919879
  
    --- Diff: www/FileWriter.js ---
    @@ -107,8 +108,29 @@ FileWriter.prototype.write = function(data) {
             var fileReader = new FileReader();
             fileReader.onload = function() {
                 // Call this method again, with the arraybuffer as argument
    -            FileWriter.prototype.write.call(that, this.result);
    +            FileWriter.prototype.write.call(that, this.result, true /* isPendingBlobReadResult */);
             };
    +        fileReader.onerror = function (evt) {
    +            // DONE state
    +            that.readyState = FileWriter.DONE;
    --- End diff --
    
    Do you need to check if this FileWriter is already in the DONE (cancelled) state, as in the other callbacks below?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/177#issuecomment-207044636
  
    LGTM as well aside from Jason's feedback.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/177#issuecomment-207000261
  
    @rakatyal  @jasongin Can you please review?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/177#issuecomment-207234305
  
    Thank you for the review!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by jasongin <gi...@git.apache.org>.
Github user jasongin commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-file/pull/177#discussion_r58922573
  
    --- Diff: www/FileWriter.js ---
    @@ -107,8 +108,29 @@ FileWriter.prototype.write = function(data) {
             var fileReader = new FileReader();
             fileReader.onload = function() {
                 // Call this method again, with the arraybuffer as argument
    -            FileWriter.prototype.write.call(that, this.result);
    +            FileWriter.prototype.write.call(that, this.result, true /* isPendingBlobReadResult */);
             };
    +        fileReader.onerror = function (evt) {
    +            // DONE state
    +            that.readyState = FileWriter.DONE;
    +
    +            // Save error
    +            that.error = evt.target.error;
    --- End diff --
    
    I think **evt.target** here is the same as **this** in the callback, and they both refer to the FileReader instance, right? It's a bit confusing that you use **evt.target** here, but **this** is used in the **onload** callback. (I can't actually find documentation that says **this** in a FileReader callback is set to the FileReader, though it seems like a reasonable assumption.)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-file/pull/177#discussion_r58983833
  
    --- Diff: www/FileWriter.js ---
    @@ -107,8 +108,29 @@ FileWriter.prototype.write = function(data) {
             var fileReader = new FileReader();
             fileReader.onload = function() {
                 // Call this method again, with the arraybuffer as argument
    -            FileWriter.prototype.write.call(that, this.result);
    +            FileWriter.prototype.write.call(that, this.result, true /* isPendingBlobReadResult */);
             };
    +        fileReader.onerror = function (evt) {
    +            // DONE state
    +            that.readyState = FileWriter.DONE;
    +
    +            // Save error
    +            that.error = evt.target.error;
    --- End diff --
    
    Thanks, I will update it!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request: CB-10960 Uncaught # i...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-file/pull/177#discussion_r58983822
  
    --- Diff: www/FileWriter.js ---
    @@ -107,8 +108,29 @@ FileWriter.prototype.write = function(data) {
             var fileReader = new FileReader();
             fileReader.onload = function() {
                 // Call this method again, with the arraybuffer as argument
    -            FileWriter.prototype.write.call(that, this.result);
    +            FileWriter.prototype.write.call(that, this.result, true /* isPendingBlobReadResult */);
             };
    +        fileReader.onerror = function (evt) {
    +            // DONE state
    +            that.readyState = FileWriter.DONE;
    --- End diff --
    
    I don't think so as the `DONE` state is being set in `FileReader.readSuccessCallback`, `FileReader.readFailureCallback` and `FileReader.abort` only.
    `abort` should not be called outside (and we don't call it) taking into account that fileReader is an internal variable, `readSuccessCallback` calls `onload` and `readFailureCallback` calls `onerror` so we are covering all the cases.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org