Winterreisender / webview-nodejs

A Node.js binding to webview
Apache License 2.0
89 stars 10 forks source link

Some examples stopped working (for me) #17

Closed dirkk0 closed 11 months ago

dirkk0 commented 1 year ago

Hi,

I revisited this project and realized that something is not working for me in the latest version 0.2.4. When I start a new project with npm install webview-nodejs not everything seems to be installed.

Downgrading to 0.1.3 makes the examples work again. According to my tests, just the trivial hello world example works, the more sophisticated ones (which use bind like this one at the bottom) do not work for me.

I am on node 19.9.

Thanks, Dirk

Winterreisender commented 1 year ago

Thanks,I'll try to solve this.

Winterreisender commented 1 year ago

currently let user install 0.1.3 in readme, And I'll consider which ffi to use later

Winterreisender commented 1 year ago

I finally got some time, and found this is a reproducible bug related to bind in Linux (and maybe macOS, but I don't have a macOS device to check it). Further works will be done later.


How to make it crash:

  1. call webview_bind
  2. call webview_start

webview_dispatch works fine, and it seems not related to BindCallback but webview_bind it self The C++ code is OK.

That's weird ... ...


The webview_bind use init and eval internally, init works but eval crashed. This may be the reason.

Winterreisender commented 1 year ago

Sorry, I can't fix it quickly. The conclusion is that, with koffi, calling webkit_web_view_evaluate_javascript or webkit_web_view_run_javascript in webview will make the window crash. May be I should use another ffi. This is what I tried:

  1. Use koffi's async call
  2. Use older version of libwebview.so
  3. Use newer version of libwebview.so
  4. Check if the js if freed before execute.
  5. Change deprecated webkit_web_view_run_javascript to webkit_web_view_evaluate_javascript and recompile
  6. Create a simple webkit_web_view_run_javascript example and find it works with koffi
  7. Link libwebview.so with C++: OK
Winterreisender commented 12 months ago

I'll have some spare time in Friday this week, and I decided to keep developing version 0.1 instead of 0.2, the 0.1 version will be v0.3 in the next release.

Winterreisender commented 11 months ago

This is temporarily fixed by rolling back to v0.1 in v0.3. I'll try new FFI method in the feature.

Winterreisender commented 11 months ago

This is fixed in v0.4.0 with SWIG and NAPI.