Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal Constructor (Blob) when working with Jelly Bean Android (Cordova) #49

Closed
nhunzaker opened this issue Feb 22, 2014 · 3 comments
Closed

Comments

@nhunzaker
Copy link

I've had a lot of success using this library with Cordova on iOS and newer versions of Android, however I've noticed an error is thrown in older versions of Chromium (the web view used by Cordova). I've had to (more or less) add this work around in all cases:

try {
    blob = new Blob([buffer], { type: mime });
} catch(e) {
    if (window.BlobBuilder){
        blob = new BlobBuilder();
        blob.append(buffer);
        blob = blob.getBlob();
    } else {
        throw "No Blob or BlobBuilder constructor.";
    }
}

In particular, this is a problem for me here in filer.js:794-795

I'm not really sure how fantastic this solution is. Do you know of a better method of approaching this?

@nhunzaker
Copy link
Author

I went ahead and made the modifications in a fork. https://github.com/nhunzaker/filer.js/compare/ebidel:master...master

Preliminary tests pass in modern Chrome and Chrome for Android, but I'm pretty sure the version of Chrome I'm on is more modern than the web view. Regardless, this definitely resolved the issue I was having.

screenshot_2014-02-21-20-50-55

@shenzhuxi
Copy link

It will be great to have filer.js work with org.apache.cordova.file.
Cordova uses a new URL scheme cdvfile://localhost// now http://cordova.apache.org/news/2014/02/10/plugins-release.html.

@nhunzaker
Copy link
Author

I'm going to close this out. I'm not really sure if there is anything actionable at this point and I don't have anything new to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants