-
Notifications
You must be signed in to change notification settings - Fork 210
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
replace quickjs with other js engine #415
Conversation
This is a good idea, have you tested it with ReadComicOnline and Mangahere? They are 2 sources which evaluate JS |
public Object evaluate(String script, String fileName) { | ||
try { | ||
return engine.eval(script); | ||
} catch (Exception exception) { | ||
exception.printStackTrace(); | ||
return ""; | ||
} | ||
} | ||
|
||
public Object evaluate(String script) { | ||
try { | ||
return engine.eval(script); | ||
} catch (Exception exception) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to swallow the error? I think that the sources would just error anyway if it returns a empty string since its not the expected output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I test it with manhuagui extension and it work well. But i find Readcomiconline extension will use quickjs's compile function and i have no idea about how this function works.
And you are right, I should not swallow the error, may need to throw another runtime exception. I just want the function signature to be same with quickjs.
We are using Mozilla Rhino in Duktape implementation already, maybe it could also replace quickjs |
The Duktape implementation can be removed, but we could use Rhino in the QuickJS implementation |
I tested with manhuagui, tencentcomics and readcomiconline and all work well. But mangahere will throw NullPointerException which it's quite weird.... |
We could keep QuickJS and substitute it with Rhino whne we are missing libc++? |
That would be difficult to do, extensions instantiate QuickJS directly. We can't really do much about that unless we add a redirect like we did with SimpleDateFormat Also I think we should move this file to the AndroidCompat module, since its meant to replace a dependency like the other things there. |
I did some testing with the QuickJs sources, here are the results
You probably need to add |
quickjs could not be used in windows, also could not be load in linux system. replace it with jdk8's js engine to excute js code