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

jsevaluator seems not to run if script is over a certain size #24

Open
reality opened this issue Mar 29, 2016 · 3 comments
Open

jsevaluator seems not to run if script is over a certain size #24

reality opened this issue Mar 29, 2016 · 3 comments

Comments

@reality
Copy link

reality commented Mar 29, 2016

Thanks for the cool library - I have been using it to utitlise cryptojs to encrypt images, but it seems the jsevaluator doesn't initialise properly if the file is large enough (though it is hard to tell exactly what the issue is).

Here is how I'm using it: https://github.com/reality/alsuti/blob/master/android/app/src/main/java/rehab/reality/alsuti/Encrypter.java - First it grabs the base64 of an image, and builds a JS script with this, cryptojs and a short encryption function.

It works fine if the image is small, but if it's large (I've been testing with 0.9MB), it just doesn't return, and there are no errors. I have tried passing the data to the script in a few ways - currently it builds a 'plain' variable with the base64, but I have also tried passing the base64 directly to the encrypt function as a parameter, which causes the same behaviour.

I do not think it is a fault of the script itself, since if I replace the encrypt function with 'return "apples";' the behaviour is the same, which indicates that the function is not actually being called. Please let me know if I can provide more information!

@evgenyneu
Copy link
Owner

Hi @reality, I think your code is correct. As you suspected, the problem is probably the size of the JavaScript text you are evaluating. I had one person reporting similar issue before when he could not evaluate very long strings but was able to evaluate shorter ones. As you probably know, this library uses the web view to evaluate the JavaScript. I suspect that web view is choking on the large data (sorry for the horror analogy).

It looks like this library is not suitable for evaluating big things. I am putting a message on the readme about that.

@reality
Copy link
Author

reality commented Mar 29, 2016

Thank you! You may want to note that this library seems to work for more intensive applications: https://github.com/ericwlange/AndroidJSCore

@evgenyneu
Copy link
Owner

Thanks for the reference, added it to the readme as well.

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