liquidplayer / liquidcore Goto Github PK
View Code? Open in Web Editor NEWNode.js virtual machine for Android and iOS
License: MIT License
Node.js virtual machine for Android and iOS
License: MIT License
Hi,
This is just a FYI, feel free to close.
I am not familiar to the native linking, compiling techniques in bringing Node to android, so find it hard to choose between options. To not waste your time, I first created a SO question with some of the approaches I found.
Here is the link: Approaches to running NodeJS on Android
When calling a method using the following code:
List jsParameters = new ArrayList<>();
for (Object parameter : paramaters) {
JSValue jsParameter = parameter).toJSValue(jsContext);
jsParameters.add(jsParameter);
}
JSValue value = jsFunction.call(null, jsParameters.toArray());
I get what looks like a stack overflow error:
Maximum call stack size exceeded
Unknown Error
at org.liquidplayer.javascript.JSFunction.apply(JSFunction.java:469)
at org.liquidplayer.javascript.JSFunction.call(JSFunction.java:425)
We are not using any recursion in any of our code, so I don't understand why I am seeing a stack overflow error. (We are passing in large arrays though in other calls). It seems to me though that looking at how stack overflow messages are used in the code, it could be any number of issues that is causing this.
I am assuming that isolate->StackOverflow(); is generating these messages, and happens in a lot of places for many different reasons.
Could we get a bit more clarity on the stack overflow error messages? The current message is too generic to be of much use when identifying where the errors are coming from.
I try to using Promise but nothing works out. The following code doesn't work:
var promise = new Promise(function(resolve, reject) {
resolve(123);
});
promise.then(function(result) {
console.log(result);
});
This code will work fine if I execute it in a browser.
With the risk of being really annoying I would just like to ask: What's the status for the iOS port of this project?
Hi,
I'm very new to LiquidPlayer, and to get started, I want to achieve a simple thing:
As simple as that. This should proof that a simple communication between Java and Javascript is possible and continuous.
I've encountered some issues though:
MicroService.ServiceErrorListener
to the MicroService
constructor, it's onExit
callback gets called with an exitCode
of 0. Why is that, and does that mean that the MicroService
instance is exited just after its been created?onStart
callback of the MicroService.ServiceStartListener
instance. Can I register more events instead of just one?Additionaly, sending and receiving events doesn't seem to work well. Here is the code
// register the event, which will be sent from the JS side
mMainService.addEventListener("event_receive_timestamp", new MicroService.EventListener() {
@Override
public void onEvent(MicroService service, String event, JSONObject payload) {
Log.d(TAG, "onEvent: — " + event + " — " + payload);
// update textview etc
}
});
private void sendEvent() {
JSONObject payload = new JSONObject();
try {
payload.put("hallo", "die Weld");
} catch (JSONException e) {
e.printStackTrace();
}
mMainService.emit("event_request_timestamp", payload);
}
// JS SIDE
LiquidCore.on('event_request_timestamp', function(msg) {
LiquidCore.emit('event_receive_timestamp', {timestamp: new Date().toLocaleString()})
})
// the callback for "event_receive_timestamp" never gets called!
There is a lot of cut-and-paste between JNI/
and JSC/
. JSC has been debugged to conform to WebKit tests. Ideally use that.
Hi,
Scenario:
This happens with JSFunction and JSObject references also.
Without any thread i am able to access the JSContext refence.
Thanks ,
Ayush
The commented out code is supposed to check to see if we are currently running in the node thread, and if so, just execute the code. If we are not, it should queue the code to run in the correct thread and block until it does. This deadlocks fairly quickly in tests.
dependencies {
...
compile 'com.github.LiquidPlayer.LiquidCore:0.2.2'
}
should read like:
dependencies {
...
compile 'com.github.liquidplayer.LiquidCore:0.2.2'
}
Is there an existing of planned interface to pass logging information from javascript back to the android log so we can see it in logcat?
Its difficult to trace errors that cross the javascript/java divide without some sort of shared logging.
Hello,
I am new to the android development world and am currently working on a pet project. The problem I currently face is that I need to include a Javascript library called BigNumber in my project. And since this does not have any supported jar files, the only thing I can think of is to go for library like LiquidCore that lets me access Javascript functionalities in android.
My question : Is it possible to load external api for JavaScrpit libraries like , and if so, how?
Fingers crossed!!!
Node requires some flags to be set prior to calling V8::Initialize()
. If you start by running a node process and then subsequently create some contexts using raw v8, everything works fine. If you swap the order, the app will crash on node initialization.
My team is currently trying to develop Android App with nonWebView JS execution. We've decided to try out your library and all seems fine, aside one frequent error, that crush our app. Our project require of existing multiple JSContext's for a long period of time, so we hold it by executing simple JS:
setInterval(function() {}, 1000);
Here is stack trace for the crush:
art/runtime/indirect_reference_table.cc:128] JNI ERROR (app bug): global reference table overflow (max=51200)
art/runtime/indirect_reference_table.cc:128] global reference table dump:
art/runtime/indirect_reference_table.cc:128] Last 10 entries (of 51200):
art/runtime/indirect_reference_table.cc:128] 51199: 0x1447d0f0 org.liquidplayer.javascript.JSValue$19
art/runtime/indirect_reference_table.cc:128] 51198: 0x12f9c060 org.liquidplayer.node.Process$ProcessContext
art/runtime/indirect_reference_table.cc:128] 51197: 0x1447d0b0 org.liquidplayer.javascript.JSValue$19
art/runtime/indirect_reference_table.cc:128] 51196: 0x12f9c060 org.liquidplayer.node.Process$ProcessContext
art/runtime/indirect_reference_table.cc:128] 51195: 0x1447d0a0 org.liquidplayer.javascript.JSValue$19
art/runtime/indirect_reference_table.cc:128] 51194: 0x131d7fb0 org.liquidplayer.node.Process$ProcessContext
art/runtime/indirect_reference_table.cc:128] 51193: 0x1447d060 org.liquidplayer.javascript.JSValue$19
art/runtime/indirect_reference_table.cc:128] 51192: 0x12c29510 org.liquidplayer.node.Process$ProcessContext
art/runtime/indirect_reference_table.cc:128] 51191: 0x1447d050 org.liquidplayer.javascript.JSValue$19
art/runtime/indirect_reference_table.cc:128] 51190: 0x12f9c060 org.liquidplayer.node.Process$ProcessContext
art/runtime/indirect_reference_table.cc:128] Summary:
art/runtime/indirect_reference_table.cc:128] 25212 of org.liquidplayer.javascript.JSValue$19 (25212 unique instances)
art/runtime/indirect_reference_table.cc:128] 25215 of org.liquidplayer.node.Process$ProcessContext (3 unique instances)
Obviously, the proble is with the amount of JSValues and the fact that each JSValue contains a reference of JSContext, 3 other JSContext references is we create and hold with our code. Can you point us in the direction of the problem and how to solve it? Is there a way to gc this objects?
Many web apis support variable number of arguments. For example: https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D.
LiquidCore doesn't support var args for such APIs (Unless I am mistaken)
Hi there,
and thank you for the great work you published here!
I am currently tinkering around with the LiquidCore for a projekt and it seems very promising.
While testing on a bunch of devices i run into a libc error which where fixed with the last release.
Since the project targets devices with sdkVersion >= 16 i am not able to update to the current version.
In the change log i can't find a change in LiquidCoreAndroid that requires minSdkVersion 17:
78edf66
Any chance to decrement the minSdkVersion for LiquidCoreAndroid only?
Best regards
Martin
Hi there,
When using the LiquidCore lib while proguard is activated will fail.
To solve one just need to add a simple proguard keep rule:
-keep class org.liquidplayer.javascript.** { *; }
May this could be part of the Library itself
Sample stacktrace for one running into the same issue:
03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] JNI DETECTED ERROR IN APPLICATION: JNI GetMethodID called with pending exception java.lang.ClassNotFoundException: Didn't find class "org.liquidplayer.javascript.JSValue$JNIReturnObject" on path: DexPathList[[zip file "/data/app/packagename.of.the.app-2/base.apk"],nativeLibraryDirectories=[/data/app/packagename.of.the.app-2/lib/x86, /data/app/packagename.of.the.app-2/base.apk!/lib/x86, /system/lib, /vendor/lib]] 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at org.liquidplayer.javascript.JSValue$b org.liquidplayer.javascript.JSObject.setProperty(long, long, java.lang.String, long, int) (JSObject.java:-2) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void org.liquidplayer.javascript.JSObject$5.run() (JSObject.java:337) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void org.liquidplayer.javascript.JSContext.a(java.lang.Runnable) (JSContext.java:66) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void org.liquidplayer.javascript.JSObject.a(java.lang.String, java.lang.Object, int) (JSObject.java:345) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void org.liquidplayer.javascript.JSObject.a(java.lang.String, java.lang.Object) (JSObject.java:360) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void packagename.of.the.app.wrapper.a.c.<init>(android.content.Context) (RiveScriptWrapper.java:51) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void packagename.of.the.app.wrapper.d.<init>(android.content.Context) (Wrapper.java:20) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Integer packagename.of.the.app.wrapper.d.b.d$a.a(java.net.URL[]) (SampleClass.java:384) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Object packagename.of.the.app..b.d$a.doInBackground(java.lang.Object[]) (AFragment.java:375) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at java.lang.Object android.os.AsyncTask$2.call() (AsyncTask.java:305) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void java.util.concurrent.FutureTask.run() (FutureTask.java:237) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void android.os.AsyncTask$SerialExecutor$1.run() (AsyncTask.java:243) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1133) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:607) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427] at void java.lang.Thread.run() (Thread.java:761) 03-29 11:13:15.861 6806-6828/packagename.of.the.app A/art: art/runtime/runtime.cc:427]
Hey,
me again, when building the app with the library included the download size (size of the packed apk) and the usage on device increase dramatically:
Since we have to deal with small devices (from a memory perspective) every megabyte counts. Is there a way to reduce the usage of the native libraries?
I am not in to native libraries yet but may we could have a "common" library instead of increasing the size by 4 when including the native libs for every system architecture.
If i can support in any way just let me know!
Best regards
Martin
Add copyright notices on modified files, and add references to the nodedroid project. Add license files as per any license requirements.
In my app I was running a rendering loop which was creating/destroying many JSValue objects. It quickly resulted into "global weak reference table overflow". I fixed the issue with attached patch
liquidcorepatch.log
LiquidCore:0.4.4
LiquidCore:0.2.2
Pending exception java.lang.NoSuchMethodError: no non-static method "Lorg/liquidplayer/javascript/JNIJSContextGroup;.<init>(J)V"
at org.liquidplayer.javascript.JNIJSContextGroup org.liquidplayer.javascript.JNIJSContextGroup.create() (JNIJSContextGroup.java:-2)
at void org.liquidplayer.javascript.JSContextGroup.<init>() (JSContextGroup.java:71)
at void org.liquidplayer.javascript.JSContext.<init>() (JSContext.java:125)
at void yapl.js.fusion.JavaScriptCore.JavascriptEngine.<init>() (JavascriptEngine.java:32)
at yapl.js.fusion.FusionEngine yapl.js.fusion.FusionEngine.getJSEngine() (FusionEngine.java:15)
The last segment of log when app crashes.
Complete log of the app runtime.
Background of App:
06-24 07:33:04.513 24171-1946/org.loklak.android.wok E/art: ashmem_create_region failed for 'indirect ref table': Too many open files
.Is it possible to start Microservice with local node module with dependencies? For example: I have app.js file in raw directory with the following: var express = require('express');
How to include express module in project?
Adding the --harmony-instanceof
flag has caused a regression in testJSFunctionConstructors()
Hi 👋
I'm currently in the process of rolling out LiquidCore as a replacement for an old JS engine we're using (jv8). The problem I'm encountering is that LiquidCore is slower compared to the other JS engine. I've compared the two engines using the below script:
for (var i=0; i < 1024; i++) { nativeFunction(i + 0.0); }
on the native side nativeFunction
is only keeping the sum of all the indexes. Below are my test results:
I've created a public GH repo with the test project I've built in order to run the tests https://github.com/capezzbr/JSEnginesPlayground/ (feel free to have a look).
I'm wondering if there is any way we could improve LiquidCore to be more performant. My first guess is that LiquidCore is slower since it's using reflection to obtain the native call JS wants to invoke. Ideas?
I am trying to find a way to invoke functions written in javascript and located in .js file on the server. Is there a way LiquidCore can work directly with .js file and its methods?
None of the object finalizers get called (in the JSC code). Ever. This suggests a memory leak somewhere.
I've asked the following question on stackoverflow, I was wondering if you could help.
I'm really sorry for asking here, is there another way to ask questions such as this, or improve this method (Would asking the same question here be appropriate?)
Which docs are the best these days for looking something like this up?
LiquidCore version: 0.1.0
Android version: 7.0
AppCompat version: 25.0.1
It appears that running any JavaScript will cause a fatal error. I'm trying to run the following code:
// jsContext is injected
jsContext.evaluateScript("function factorial(x) { let f = 1; for (; x > 1; x--) { f *=x; } return f; }");
JSFunction factorial = jsContext.property("factorial").toFunction();
Integer result = factorial.call(JSObject(), 10).toNumber().toInt();
System.out.println(result)
Which is effectively the same code as in the example, but every time it gets run the following error occurs:
E/WVMExtractor: Failed to open libwvm.so: dlopen failed: library "libwvm.so" not found
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdeadbeef in tid 3325 (t.android.debug)
[ 02-09 13:59:05.510 1203: 1203 W/ ]
debuggerd: handling request: pid=3325 uid=10071 gid=10071 tid=3325
is there a way to have the JS evaluator accept single line comments in the java script where the developer is using '//' to mark his/her comments? Thx.
Hello,
Thanks for developing such an awesome library! I had one question around the initialization time, specifically the time it takes from calling start on a micro service to getting the onStart callback and then getting my "READY" callback after my js file has loaded. On average from the time I call start on the micro service to the time I get the onStart callback I see about a 500 ms overhead. Then from onStart to the time I get my "READY" callback at the end of my js file (which is fairly large at about 3mb) its about another 2 seconds. I was wondering if anyone else has experienced anything like this and found a way to reduce this overhead.
Thanks,
Tyler
can you make "peerflix" demo
From java to js works fine:
class Test extends JSObject implements TestImpl {
@jsexport public Property<JSValue> x;
Test() {
x.set(new JSValue(getContext(), "123"));
}
}
If now I input in js test.x = "test";
nothing will happen. x
in java will be equal 123
.
I connected Stetho to LiquidCore. this
and other code works fine in chrome debugger if I use Microservice. But if I use raw JSContext without running Microservice I periodically get JSException "Maximum call stack size exceeded" in chrome debugger. This problem disappears if I close debugger and open again, close and open again and again many times (random number of repetitions).
Is there idea what's wrong?
Is it possible to call constructors from within the javascript. For Example if I have a PageDefinition which extends JSObject with the supporting JSContext constructor, should I be able to do the following in javascript: "var createPageDef = function() { var pageDefinition = PageDefinition("My Page Def"); return pageDefinition; }; ");
Thx, appreciate the assist
Example dump:
12-07 08:53:03.001 12436-12453/org.liquidplayer.node.test A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x500000038 in tid 12453 (roidJUnitRunner)
12-07 08:53:03.105 7173-7173/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-07 08:53:03.106 7173-7173/? I/DEBUG: Build fingerprint: 'Lenovo/YT3_10_row_lte/YT3:5.1/LMY47I/YT3-X90L_USR_S100139_1601281130_:user/release-keys'
12-07 08:53:03.106 7173-7173/? I/DEBUG: Revision: '0'
12-07 08:53:03.106 7173-7173/? I/DEBUG: ABI: 'x86_64'
12-07 08:53:03.106 7173-7173/? I/DEBUG: pid: 12436, tid: 12453, name: roidJUnitRunner >>> org.liquidplayer.node.test <<<
12-07 08:53:03.106 7173-7173/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x500000038
12-07 08:53:03.129 7173-7173/? I/DEBUG: rax 0000000500000000 rbx 00007f2545fe1000 rcx 0000000000000002 rdx 00007f2536ff3030
12-07 08:53:03.130 7173-7173/? I/DEBUG: rsi 0000000500000000 rdi 000012e44941c881
12-07 08:53:03.130 7173-7173/? I/DEBUG: r8 0000000000000001 r9 0000000000000000 r10 000000000000002a r11 00007f2536ff3030
12-07 08:53:03.130 7173-7173/? I/DEBUG: r12 00007f2545fe1000 r13 00007f2536ff3010 r14 00007f2536ff3018 r15 00007f2536ff3008
12-07 08:53:03.131 7173-7173/? I/DEBUG: cs 0000000000000033 ss 000000000000002b
12-07 08:53:03.131 7173-7173/? I/DEBUG: rip 00007f25378d7aca rbp 00007f25478696a0 rsp 00007f2547869670 eflags 0000000000010206
12-07 08:53:03.131 7173-7173/? I/DEBUG: backtrace:
12-07 08:53:03.132 7173-7173/? I/DEBUG: #00 pc 00000000006e5aca /data/app/org.liquidplayer.node.test-2/lib/x86_64/libnode.so (v8::UnboundScript::BindToCurrentContext()+106)
12-07 08:53:03.133 7173-7173/? I/DEBUG: #01 pc 0000000000705d23 /data/app/org.liquidplayer.node.test-2/lib/x86_64/libnode.so (v8::ScriptCompiler::Compile(v8::Local<v8::Context>, v8::ScriptCompiler::Source*, v8::ScriptCompiler::CompileOptions)+67)
12-07 08:53:03.134 7173-7173/? I/DEBUG: #02 pc 0000000000705dc1 /data/app/org.liquidplayer.node.test-2/lib/x86_64/libnode.so (v8::Script::Compile(v8::Local<v8::Context>, v8::Local<v8::String>, v8::ScriptOrigin*)+81)
12-07 08:53:03.134 7173-7173/? I/DEBUG: #03 pc 0000000000034ccd /data/app/org.liquidplayer.node.test-2/lib/x86_64/libnodedroid.so (Java_org_liquidplayer_javascript_JSObject_makeFunction+877)
12-07 08:53:03.134 7173-7173/? I/DEBUG: #04 pc 000000000031d07c /data/dalvik-cache/x86_64/data@[email protected]@[email protected]
12-07 08:53:03.292 7173-7173/? I/DEBUG: Tombstone written to: /data/tombstones/tombstone_06
12-07 08:53:03.293 7680-12521/? W/ActivityManager: Error in app org.liquidplayer.node.test running instrumentation ComponentInfo{org.liquidplayer.node.test/android.support.test.runner.AndroidJUnitRunner}:
12-07 08:53:03.293 7680-12521/? W/ActivityManager: Native crash
12-07 08:53:03.293 7680-12521/? W/ActivityManager: Native crash: Segmentation fault
12-07 08:53:03.294 12424-12424/? D/AndroidRuntime: Shutting down VM
Device: Nexus 5X with 7.1.1
Emulator: Nexus 5 API 24
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 19475 (roidJUnitRunner)
Build fingerprint: 'google/bullhead/bullhead:7.1.1/N4F26O/3582057:user/release-keys'
02-15 15:10:32.694 19491-19491/? A/DEBUG: Revision: 'rev_1.0'
02-15 15:10:32.694 19491-19491/? A/DEBUG: ABI: 'arm64'
It looks like this is an inner wrapper class to assist with maps. If I set a map in context as follows:
Map<String, Object> pageContext = new HashMap<String, Object>();
JSObject oPageContext = new JSObject(this.jsContext, pageContext);
jsContext.property("pageContext", oPageContext);
Is this the proper way to then reference that map in the context (after running evaluate script and associated call function):
JSValue _pageContext = jsContext.property("pageContext");
Map<String, Object> map = (Map<String, Object> _pageContext.toObject();
thx, appreciate the assist.
I'm running an emulator and have been trying to make network calls from Node using request and have also tried axios. So far I've run into these two issues with both:
W/dcorehelloworld: type=1400 audit(0.0:59): avc: denied { ioctl } for path="/sys/kernel/debug/tracing/trace_marker" dev="debugfs" ino=3080 ioctlcmd=5451 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:debugfs_trace_marker:s0 tclass=file permissive=0
W/dcorehelloworld: type=1400 audit(0.0:60): avc: denied { ioctl } for path="socket:[181434]" dev="sockfs" ino=181434 ioctlcmd=5451 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:surfaceflinger:s0 tclass=unix_stream_socket permissive=0
I've also tried this on a physical Nexus 6p and I'm not seeing the errors but none of my callbacks in Java are being called, so I'm assuming the request is not going through.
Hi Erik, I've a big problem with memory using liquid core.
I've an android app that have a timer that executes code.
If I attach profiler I can see that native memory consumption is always growing but there is no place where this memory is became free and this causes an app restart
Have you some tricks for this issue?
Nice work! And i want to kown how to debug javascript file?
Thanks.
0.4.4
0.2.2
context.evaluateScript(src, name, 0);
where src
is the content of a javascript file I'm evaluating in order to boot my JS environment.
Exception details
JNI ERROR (app bug): local reference table overflow (max=512)
local reference table dump:
Last 10 entries (of 512):
511: 0x12c41d00 java.lang.String "org/liquidplayer... (38 chars)
510: 0x12c9dd60 org.liquidplayer.javascript.JNIReturnObject
509: 0x12cbca00 java.lang.Class<org.liquidplayer.javascript.JNIReturnObject>
508: 0x12cfcbf0 java.lang.String "org/liquidplayer... (43 chars)
507: 0x12cbdf00 java.lang.Class<org.liquidplayer.javascript.JNIObject>
506: 0x12c41d60 java.lang.String "org/liquidplayer... (37 chars)
505: 0x12c71a10 org.liquidplayer.javascript.JNIJSValue
504: 0x12ca9820 java.lang.Class<org.liquidplayer.javascript.JNIJSValue>
503: 0x12c3ce80 java.lang.String "org/liquidplayer... (38 chars)
502: 0x12c71a20 org.liquidplayer.javascript.JNIJSValue
Summary:
26 of org.liquidplayer.javascript.JNIJSObject (13 unique instances)
102 of org.liquidplayer.javascript.JNIJSValue (84 unique instances)
36 of org.liquidplayer.javascript.JNIReturnObject (36 unique instances)
1 of org.liquidplayer.javascript.JNIJSValue[] (2 elements)
174 of java.lang.String (174 unique instances)
172 of java.lang.Class (5 unique instances)
1 of java.lang.String[] (3 elements)
Runtime aborting...
Aborting thread:
how to make "webtorrent_cli.js"
I have found that native objects are destroyed only if I set null on a JSContext's reference and manually init GC from IDE.
I want to check that js's objects without references was destroyed.
The JSC bridge is written using the Retainer
class in jni/common.h
. That class expects the developer to clean up any references. When the subclass is created, it is created with a reference count of 1. Any subsequent holders must retain()
the object and then release()
it when done. Newly created or returned objects are assumed to have been retained and it is up to the caller to release.
The way the JavaScriptCore API is designed is slightly different. It allows lazy usage of references. For example, you can create a new JSValueRef
, use it and then ignore it. It will get cleaned up when the garbage collector runs unless it has been explicitly retained. Only when an explicit JSValueRetain
is used is a parallel JSValueRelease
required.
Confusingly, though, it seems this is only the case with JSValueRef
and JSObjectRef
. JSClassRef
, JSContextRef
, JSContextGroupRef
, JSPropertyNameArrayRef
and JSStringRef
all operate the same as is designed in Retainer
.
Need to build a wrapper around JSValue<Value>
that manages the value references the way JavaScriptCore expects, and stores them in a map which gets cleaned up upon garbage collection.
Thanks for the library,
I was trying to replace it with AndroidJSCore but I was not able to run the app cause my device is an arm64 and during runtime, I get couldn't find "libnode.so"
error.
I checked the repo and "libnode.so" is missing in node prebuild deps folder for arm64:
https://github.com/LiquidPlayer/LiquidCore/tree/master/deps/node-8.9.3/prebuilt
any solution?
Update: I downgraded to v0.2.2 and it was there before!! any reason for removing it?
When using process.chdir()
in one Node.js VM, the current working directory changes in all VMs. Should change only for the called process.
There are two useful functions in nodejs process._getActiveRequests
and process._getActiveHandles
, they can be used to see what prevents node process to exit, it would be handy to have them in LiquidCore.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.