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

local.ts example doesn't work on macos #100

Closed
brandonros opened this issue Jan 27, 2022 · 24 comments
Closed

local.ts example doesn't work on macos #100

brandonros opened this issue Jan 27, 2022 · 24 comments
Labels
bug Something isn't working macos Related to macOS

Comments

@brandonros
Copy link

$ git clone git@github.com:webview/webview_deno.git
Cloning into 'webview_deno'...
cd eremote: Enumerating objects: 999, done.
remote: Counting objects: 100% (303/303), done.
remote: Compressing objects: 100% (217/217), done.
remote: Total 999 (delta 163), reused 190 (delta 71), pack-reused 696
Receiving objects: 100% (999/999), 920.60 KiB | 5.86 MiB/s, done.
Resolving deltas: 100% (530/530), done.
^R
cd Brandons-MacBook-Air:Desktop brandonros 2022-01-26 22:48:59 $ cd webview_deno/
Brandons-MacBook-Air:webview_deno brandonros 2022-01-26 22:49:04 $ make build
cargo build
    Updating crates.io index
  Downloaded once_cell v1.9.0
  Downloaded 1 crate (30.7 KB) in 0.79s
   Compiling pkg-config v0.3.18
   Compiling cc v1.0.58
   Compiling once_cell v1.9.0
   Compiling webview-official-sys v0.1.2
   Compiling webview_deno v0.7.0-pre.0 (/Users/brandonros/Desktop/webview_deno)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 15s
Brandons-MacBook-Air:webview_deno brandonros 2022-01-26 22:50:25 $ PLUGIN_URL=target/debug/  deno run --unstable -A examples/local.ts
Check file:///Users/brandonros/Desktop/webview_deno/examples/local.ts
Download target/debug/libwebview_deno.dylib

$ deno --version
deno 1.18.0 (release, aarch64-apple-darwin)
v8 9.8.177.6
typescript 4.5.2

image

just shows in the dock, click it and no window to be found anywhere

@eliassjogreen
Copy link
Member

Does the test_ffi example work from denoland/deno?

@eliassjogreen eliassjogreen added bug Something isn't working macos Related to macOS labels Jan 27, 2022
@lucsoft
Copy link

lucsoft commented Jan 27, 2022

Can confirm doesn't work.

@brandonros
Copy link
Author

@lucsoft any idea where it might be failing? Not sure if we need to beef up some logs?

cc @littledivy

@lucsoft
Copy link

lucsoft commented Jan 27, 2022

@lucsoft any idea where it might be failing? Not sure if we need to beef up some logs?

cc @littledivy

Nope no idea

@brandonros
Copy link
Author

Is it working for anybody else on

Windows

Linux

Mac Intel (non-arm64)?

@eliassjogreen
Copy link
Member

It works for me both on windows and ubuntu (WSL).

@Julli4n
Copy link

Julli4n commented Jan 28, 2022

Is it working for anybody else on

Windows

Linux

Mac Intel (non-arm64)?

Can confirm it also does not work on my Intel Mac.

@brandonros
Copy link
Author

do we have a guess on what to debug/where to add logs?

@nnmrts
Copy link

nnmrts commented Feb 1, 2022

Aw snap, I was so hyped after hearing about the latest release. Doesn't work for me as well on this system:

deno 1.18.1 (release, x86_64-apple-darwin)
v8 9.8.177.6
typescript 4.5.2

@nnmrts
Copy link

nnmrts commented Feb 1, 2022

@eliassjogreen I don't know a lot about rust so maybe I'm doing something wrong, anyways, after cloning https://github.com/denoland/deno I cd'd into to the test_ffi directory and ran cargo test, this is the output (collapsed because it's a lot):

Details
Updating crates.io index
  Downloaded futures-task v0.3.19
  Downloaded getrandom v0.2.4
  Downloaded serde v1.0.133
  Downloaded tokio-rustls v0.23.2
  Downloaded serde_json v1.0.75
  Downloaded itoa v1.0.1
  Downloaded version_check v0.9.4
  Downloaded typenum v1.15.0
  Downloaded pin-project-lite v0.2.8
  Downloaded futures-macro v0.3.19
  Downloaded futures-util v0.3.19
  Downloaded h2 v0.3.10
  Downloaded futures-sink v0.3.19
  Downloaded futures v0.3.19
  Downloaded tokio-macros v1.7.0
  Downloaded anyhow v1.0.53
  Downloaded syn v1.0.85
  Downloaded futures-io v0.3.19
  Downloaded futures-executor v0.3.19
  Downloaded futures-core v0.3.19
  Downloaded futures-channel v0.3.19
  Downloaded indexmap v1.8.0
  Downloaded ryu v1.0.9
  Downloaded proc-macro2 v1.0.36
  Downloaded smallvec v1.8.0
  Downloaded ppv-lite86 v0.2.16
  Downloaded generic-array v0.14.5
  Downloaded serde_derive v1.0.133
  Downloaded quote v1.0.14
  Downloaded once_cell v1.9.0
  Downloaded 30 crates (1.4 MB) in 1.11s
   Compiling libc v0.2.106
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling cfg-if v1.0.0
   Compiling syn v1.0.85
   Compiling memchr v2.4.1
   Compiling log v0.4.14
   Compiling autocfg v1.0.1
   Compiling pin-project-lite v0.2.8
   Compiling futures-core v0.3.19
   Compiling bytes v1.1.0
   Compiling version_check v0.9.4
   Compiling typenum v1.15.0
   Compiling futures-channel v0.3.19
   Compiling scopeguard v1.1.0
   Compiling smallvec v1.8.0
   Compiling cfg-if v0.1.10
   Compiling futures-sink v0.3.19
   Compiling futures-task v0.3.19
   Compiling futures-util v0.3.19
   Compiling cc v1.0.72
   Compiling futures-io v0.3.19
   Compiling pin-utils v0.1.0
   Compiling once_cell v1.9.0
   Compiling fnv v1.0.7
   Compiling slab v0.4.5
   Compiling tinyvec_macros v0.1.0
   Compiling itoa v0.4.8
   Compiling httparse v1.5.1
   Compiling ppv-lite86 v0.2.16
   Compiling spin v0.5.2
   Compiling untrusted v0.7.1
   Compiling matches v0.1.9
   Compiling percent-encoding v2.1.0
   Compiling unicode-bidi v0.3.7
   Compiling lazy_static v1.4.0
   Compiling serde_derive v1.0.133
   Compiling base64 v0.13.0
   Compiling cpufeatures v0.2.1
   Compiling serde v1.0.133
   Compiling opaque-debug v0.3.0
   Compiling hashbrown v0.11.2
   Compiling serde_json v1.0.75
   Compiling anyhow v1.0.53
   Compiling utf-8 v0.7.6
   Compiling try-lock v0.2.3
   Compiling byteorder v1.4.3
   Compiling ryu v1.0.9
   Compiling itoa v1.0.1
   Compiling tower-service v0.3.1
   Compiling regex-syntax v0.6.25
   Compiling remove_dir_all v0.5.3
   Compiling httpdate v1.0.2
   Compiling instant v0.1.12
   Compiling tokio v1.14.0
   Compiling indexmap v1.8.0
   Compiling generic-array v0.14.5
   Compiling lock_api v0.4.5
   Compiling tinyvec v1.5.1
   Compiling http v0.2.4
   Compiling form_urlencoded v1.0.1
   Compiling tracing-core v0.1.21
   Compiling rustls-pemfile v0.2.1
   Compiling ring v0.16.20
   Compiling tracing v0.1.29
   Compiling unicode-normalization v0.1.19
   Compiling http-body v0.4.4
   Compiling want v0.3.0
   Compiling quote v1.0.14
   Compiling aho-corasick v0.7.18
   Compiling parking_lot_core v0.8.0
   Compiling getrandom v0.2.4
   Compiling signal-hook-registry v1.4.0
   Compiling num_cpus v1.13.0
   Compiling mio v0.7.14
   Compiling errno v0.1.8
   Compiling socket2 v0.4.2
   Compiling os_pipe v0.9.2
   Compiling atty v0.2.14
   Compiling idna v0.2.3
   Compiling regex v1.5.4
   Compiling parking_lot v0.11.1
   Compiling rand_core v0.6.3
   Compiling pty v0.2.2
   Compiling block-buffer v0.9.0
   Compiling digest v0.9.0
   Compiling url v2.2.2
   Compiling rand_chacha v0.3.1
   Compiling sha-1 v0.9.8
   Compiling webpki v0.22.0
   Compiling sct v0.7.0
   Compiling rand v0.8.4
   Compiling rustls v0.20.2
   Compiling tempfile v3.2.0
   Compiling tokio-macros v1.7.0
   Compiling futures-macro v0.3.19
   Compiling thiserror-impl v1.0.30
   Compiling async-stream-impl v0.3.2
   Compiling async-stream v0.3.2
   Compiling thiserror v1.0.30
   Compiling tungstenite v0.16.0
   Compiling futures-executor v0.3.19
   Compiling futures v0.3.19
   Compiling tokio-util v0.6.9
   Compiling tokio-tungstenite v0.16.1
   Compiling tokio-rustls v0.23.2
   Compiling h2 v0.3.10
   Compiling hyper v0.14.16
   Compiling test_util v0.1.0 (/Volumes/hdd1/projects/deno/test_util)
   Compiling test_ffi v0.1.0 (/Volumes/hdd1/projects/deno/test_ffi)
    Finished test [unoptimized + debuginfo] target(s) in 3m 04s
     Running unittests (/Volumes/hdd1/projects/deno/target/debug/deps/test_ffi-b19178236f050129)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/integration_tests.rs (/Volumes/hdd1/projects/deno/target/debug/deps/integration_tests-11476d6156348c08)

running 2 tests
test symbol_types ... FAILED
test basic ... FAILED

failures:

---- symbol_types stdout ----
stdout 
stderr error: TS2345 [ERROR]: Argument of type '{ readonly method1: { readonly parameters: readonly ["usize", "usize"]; readonly result: "void"; }; readonly method2: { readonly parameters: readonly ["void"]; readonly result: "void"; }; readonly method3: { readonly parameters: readonly [...]; readonly result: "void"; }; ... 15 more ...; readonly method19: { ...; }...' is not assignable to parameter of type 'Record<string, ForeignFunction>'.
  Property 'method1' is incompatible with index signature.
    Type '{ readonly parameters: readonly ["usize", "usize"]; readonly result: "void"; }' is not assignable to type 'ForeignFunction'.
      Types of property 'parameters' are incompatible.
        The type 'readonly ["usize", "usize"]' is 'readonly' and cannot be assigned to the mutable type '(NativeType | "buffer")[]'.
  {
  ^
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:7:3

TS2694 [ERROR]: Namespace 'Deno' has no exported member 'UnsafePointer'.
remote.symbols.method15({} as Deno.UnsafePointer);
                                   ~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:91:36

TS2322 [ERROR]: Type 'unknown' is not assignable to type 'number'.
let r_1: number = result;
    ~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:96:5

TS2571 [ERROR]: Object is of type 'unknown'.
result2.then((_1: number) => {});
~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:101:1

TS2694 [ERROR]: Namespace 'Deno' has no exported member 'UnsafePointer'.
let r3_1: Deno.UnsafePointer = result3;
               ~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:106:16

TS2571 [ERROR]: Object is of type 'unknown'.
result4.then((_1: Deno.UnsafePointer) => {});
~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:111:1

TS2694 [ERROR]: Namespace 'Deno' has no exported member 'UnsafePointer'.
result4.then((_1: Deno.UnsafePointer) => {});
                       ~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:111:24

TS2339 [ERROR]: Property 'UnsafePointer' does not exist on type 'typeof Deno'.
const ptr = new Deno.UnsafePointer(0n);
                     ~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:113:22

TS2339 [ERROR]: Property 'UnsafeFnPointer' does not exist on type 'typeof Deno'.
const fnptr = new Deno.UnsafeFnPointer(
                       ~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:114:24

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:30:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid return type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:32:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:36:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:40:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:44:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:48:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:52:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:56:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:60:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:64:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:68:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:72:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:76:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:80:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:84:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:88:1

TS2578 [ERROR]: Unused '@ts-expect-error' directive.
// @ts-expect-error: Invalid argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/ffi_types.ts:121:1

Found 26 errors.

ExitStatus(unix_wait_status(256))
thread 'symbol_types' panicked at 'assertion failed: output.status.success()', test_ffi/tests/integration_tests.rs:98:3
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- basic stdout ----
stdout 
stderr error: Uncaught AssertionError: Expected error message to include "Failed to register symbol non_existent_symbol", but got "Could not obtain symbol from the library: dlsym(0x233f61240, non_existent_symbol): symbol not found".
    throw new AssertionError(msg);
          ^
    at assertIsError (file:///Volumes/hdd1/projects/deno/test_util/std/testing/asserts.ts:634:11)
    at assertThrows (file:///Volumes/hdd1/projects/deno/test_util/std/testing/asserts.ts:690:5)
    at file:///Volumes/hdd1/projects/deno/test_ffi/tests/test.js:21:1

ExitStatus(unix_wait_status(256))
thread 'basic' panicked at 'assertion failed: output.status.success()', test_ffi/tests/integration_tests.rs:44:3


failures:
    basic
    symbol_types

test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 6.34s

error: test failed, to rerun pass '--test integration_tests'

I believe that's wrong so now I ran cargo test in the main directory, but that takes a while because it is still compiling...

Copying ./target/debug/libtest_ffi.dylib to /usr/local/bin and then running deno run -A --unstable ./test_ffi/tests/test.js yields this (everything seems to be working):

something
[1, 2, 3, 4, 5, 6, 7, 8]
[1, 2, 3, 4, 5, 6, 7, 8] [9, 10]
[1, 2, 3, 4, 5, 6, 7, 8]
[ 1, 2, 3, 4, 5, 6 ]
[ 4, 5, 6 ]
[ 4, 5, 6 ]
Hello from pointer!
pointer!
false
true
false
579
true
579
579
579
579
579
579
579.9119873046875
579.912
After sleep_blocking
true
Before
true
After
true
Correct number of resources

@jcc10
Copy link
Contributor

jcc10 commented Feb 9, 2022

Ubuntu / POP!_OS 21.10 works so that pretty much confirms it's a mac-specific bug.

@eliassjogreen eliassjogreen changed the title local.ts example doesn't work local.ts example doesn't work on macos aarch64 Feb 9, 2022
@nnmrts
Copy link

nnmrts commented Feb 10, 2022

@eliassjogreen Sorry, I'm really nitpicking here but this isn't just a bug on aarch64 as I and @Julli4n have said above. I have an Intel MacBook Pro and encounter the exact same issue.

@eliassjogreen eliassjogreen changed the title local.ts example doesn't work on macos aarch64 local.ts example doesn't work on macos Feb 10, 2022
@brandonros
Copy link
Author

 $ git clone git@github.com:webview/webview_deno.git
Cloning into 'webview_deno'...
remote: Enumerating objects: 999, done.
remote: Counting objects: 100% (303/303), done.
remote: Compressing objects: 100% (217/217), done.
remote: Total 999 (delta 163), reused 190 (delta 71), pack-reused 696
Receiving objects: 100% (999/999), 920.60 KiB | 6.14 MiB/s, done.
Resolving deltas: 100% (530/530), done.
Brandons-MacBook-Air:Desktop brandonros 2022-02-10 13:20:13 $ cd webview_deno/
Brandons-MacBook-Air:webview_deno brandonros 2022-02-10 13:20:14 $ make
cargo build
   Compiling cc v1.0.58
   Compiling pkg-config v0.3.18
   Compiling once_cell v1.9.0
   Compiling webview-official-sys v0.1.2
   Compiling webview_deno v0.7.0-pre.0 (/Users/brandonros/Desktop/webview_deno)
    Finished dev [unoptimized + debuginfo] target(s) in 5.60s
Brandons-MacBook-Air:webview_deno brandonros 2022-02-10 13:20:25 $ make example
PLUGIN_URL=target/debug/ deno run \
		-A \
		--unstable \
		--no-check \
		--config examples/ssr/tsconfig.json \
		examples/ssr/ssr.jsx
Download https://crux.land/nanossr@0.0.1
Download https://deno.land/std@0.114.0/http/server.ts
Download https://deno.land/std@0.114.0/path/mod.ts
Download https://crux.land/api/get/nanossr@0.0.1
Download https://deno.land/std@0.114.0/_util/os.ts
Download https://deno.land/std@0.114.0/path/_interface.ts
Download https://deno.land/std@0.114.0/path/common.ts
Download https://deno.land/std@0.114.0/path/glob.ts
Download https://deno.land/std@0.114.0/path/posix.ts
Download https://deno.land/std@0.114.0/path/separator.ts
Download https://deno.land/std@0.114.0/path/win32.ts
Download https://deno.land/std@0.114.0/async/mod.ts
Download https://deno.land/std@0.114.0/async/deadline.ts
Download https://deno.land/std@0.114.0/async/debounce.ts
Download https://deno.land/std@0.114.0/async/deferred.ts
Download https://deno.land/std@0.114.0/async/delay.ts
Download https://deno.land/std@0.114.0/async/mux_async_iterator.ts
Download https://deno.land/std@0.114.0/async/pool.ts
Download https://deno.land/std@0.114.0/async/tee.ts
Download https://deno.land/std@0.114.0/path/_constants.ts
Download https://deno.land/std@0.114.0/path/_util.ts
Download https://deno.land/std@0.114.0/_util/assert.ts
Download https://crux.land/api/get/4cfWmS
Download https://crux.land/api/get/4cfWmS.ts
Download https://cdn.skypack.dev/@twind/typography
Download https://cdn.skypack.dev/twind
Download https://cdn.skypack.dev/twind/sheets
Download https://deno.land/x/nano_jsx/mod.ts
Warning Implicitly using latest version (v0.0.29) for https://deno.land/x/nano_jsx/mod.ts
Download https://deno.land/x/nano_jsx@v0.0.29/mod.ts
Download https://deno.land/x/nano_jsx@v0.0.29/index.ts
Download https://deno.land/x/nano_jsx@v0.0.29/component.ts
Download https://deno.land/x/nano_jsx@v0.0.29/components/index.ts
Download https://deno.land/x/nano_jsx@v0.0.29/context.ts
Download https://deno.land/x/nano_jsx@v0.0.29/core.ts
Download https://deno.land/x/nano_jsx@v0.0.29/customElementsMode.ts
Download https://deno.land/x/nano_jsx@v0.0.29/fragment.ts
Download https://deno.land/x/nano_jsx@v0.0.29/helpers.ts
Download https://deno.land/x/nano_jsx@v0.0.29/jsx.ts
Download https://deno.land/x/nano_jsx@v0.0.29/lazy.ts
Download https://deno.land/x/nano_jsx@v0.0.29/ssr.ts
Download https://deno.land/x/nano_jsx@v0.0.29/store.ts
Download https://deno.land/x/nano_jsx@v0.0.29/version.ts
Download https://deno.land/x/nano_jsx@v0.0.29/withStyles.ts
Download https://deno.land/x/nano_jsx@v0.0.29/components/helmet.ts
Download https://deno.land/x/nano_jsx@v0.0.29/core.types.ts
Download https://deno.land/x/nano_jsx@v0.0.29/regexDom.ts
Download https://deno.land/x/nano_jsx@v0.0.29/state.ts
Download https://deno.land/x/nano_jsx@v0.0.29/components/img.ts
Download https://deno.land/x/nano_jsx@v0.0.29/components/link.ts
Download https://deno.land/x/nano_jsx@v0.0.29/components/router.ts
Download https://deno.land/x/nano_jsx@v0.0.29/components/suspense.ts
Download https://deno.land/x/nano_jsx@v0.0.29/components/visible.ts
Download https://deno.land/x/nano_jsx@v0.0.29/htm.ts
Download https://cdn.skypack.dev/-/twind@v0.16.16-w4CrbhFmJLdnylzKJGoJ/dist=es2019,mode=imports/optimized/twind.js
Download https://deno.land/x/nano_jsx@v0.0.29/htm/index.ts
Download https://cdn.skypack.dev/-/twind@v0.16.16-w4CrbhFmJLdnylzKJGoJ/dist=es2019,mode=imports/optimized/twind/sheets.js
Download https://deno.land/x/nano_jsx@v0.0.29/htm/build.ts
Download https://deno.land/x/nano_jsx@v0.0.29/htm/constants.ts
Download https://cdn.skypack.dev/-/style-vendorizer@v2.1.1-tUzSdjk5lqm41ZQmAIJ1/dist=es2019,mode=imports/optimized/style-vendorizer.js
Download https://cdn.skypack.dev/-/@twind/typography@v0.0.2-8DW2vLpYlpvZxmI13GVM/dist=es2019,mode=imports/optimized/@twind/typography.js
[runner] Listening on http://localhost:8000
[runner] worker started
2022-02-10 13:20:36.748 deno[65506:2210836] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001921b41cc __exceptionPreprocess + 240
	1   libobjc.A.dylib                     0x0000000191f057b8 objc_exception_throw + 60
	2   CoreFoundation                      0x00000001921dee24 _CFBundleGetValueForInfoKey + 0
	3   AppKit                              0x0000000194cb2224 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 380
	4   AppKit                              0x0000000194c9d0cc -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 948
	5   AppKit                              0x0000000194c9cd0c -[NSWindow initWithContentRect:styleMask:backing:defer:] + 56
	6   8a8c0787f9ce488d86fdc761af81030728d 0x0000000107cbfc14 _ZN7webview22cocoa_wkwebview_engineC2EbPv + 640
	7   8a8c0787f9ce488d86fdc761af81030728d 0x0000000107cbf970 _ZN7webview7webviewC2EbPv + 72
	8   8a8c0787f9ce488d86fdc761af81030728d 0x0000000107cbe89c _ZN7webview7webviewC1EbPv + 56
	9   8a8c0787f9ce488d86fdc761af81030728d 0x0000000107cbe834 webview_create + 56
	10  8a8c0787f9ce488d86fdc761af81030728d 0x0000000107cbccf4 deno_webview_create + 28
	11  deno                                0x000000010342c04c ffi_call_SYSV + 76
	12  deno                                0x0000000103428e0c ffi_call_int + 1228
	13  deno                                0x0000000102bf7d1c _ZN8deno_ffi8ffi_call17h9d708ea02bba6a29E + 1328
	14  deno                                0x0000000102df4c28 _ZN9deno_core8ops_json7op_sync28_$u7b$$u7b$closure$u7d$$u7d$17h89895b0e40e92311E + 592
	15  deno                                0x0000000102b8517c _ZN86_$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..Fn$LT$Args$GT$$GT$4call17h6f7e6211145de192E + 64
	16  deno                                0x0000000102b7be38 _ZN9deno_core3ops7OpTable8route_op17h2a60f6529078143bE + 200
	17  deno                                0x0000000102b8b538 _ZN105_$LT$extern$u20$$u22$C$u22$$u20$fn$LP$A0$RP$$u20$.$GT$$u20$R$u20$as$u20$v8..support..CFnFrom$LT$F$GT$$GT$7mapping4c_fn17h9022fa7645b87dceE + 256
	18  deno                                0x00000001034ee1e0 _ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE + 376
	19  deno                                0x00000001034ed89c _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE + 704
	20  deno                                0x00000001034ecfcc _ZN2v88internalL26Builtin_Impl_HandleApiCallENS0_16BuiltinArgumentsEPNS0_7IsolateE + 248
	21  deno                                0x0000000104013f6c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 108
	22  ???                                 0x00000d9d000cb5c4 0x0 + 14967961859524
	23  deno                                0x0000000103f972d8 Builtins_InterpreterEntryTrampoline + 280
	24  deno                                0x0000000103f972d8 Builtins_InterpreterEntryTrampoline + 280
	25  deno                                0x0000000103f94118 construct_stub_create_deopt_addr + 340
	26  deno                                0x00000001040b288c Builtins_ConstructHandler + 716
	27  deno                                0x0000000103f972d8 Builtins_InterpreterEntryTrampoline + 280
	28  deno                                0x0000000103fcfc14 Builtins_GeneratorPrototypeNext + 148
	29  deno                                0x0000000103f94fac Builtins_JSEntryTrampoline + 172
	30  deno                                0x0000000103f94c48 Builtins_JSEntry + 168
	31  deno                                0x000000010359ca2c _ZN2v88internal12_GLOBAL__N_16InvokeEPNS0_7IsolateERKNS1_12InvokeParamsE + 2844
	32  deno                                0x000000010359cf8c _ZN2v88internal12_GLOBAL__N_118InvokeWithTryCatchEPNS0_7IsolateERKNS1_12InvokeParamsE + 88
	33  deno                                0x000000010359d11c _ZN2v88internal9Execution7TryCallEPNS0_7IsolateENS0_6HandleINS0_6ObjectEEES6_iPS6_NS1_15MessageHandlingEPNS0_11MaybeHandleIS5_EEb + 224
	34  deno                                0x000000010386cccc _ZN2v88internal16SourceTextModule13ExecuteModuleEPNS0_7IsolateENS0_6HandleIS1_EE + 296
	35  deno                                0x000000010386c6e0 _ZN2v88internal16SourceTextModule29AsyncModuleExecutionFulfilledEPNS0_7IsolateENS0_6HandleIS1_EE + 368
	36  deno                                0x00000001034f6000 _ZN2v88internal32Builtin_CallAsyncModuleFulfilledEiPmPNS0_7IsolateE + 80
	37  deno                                0x0000000104013f6c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 108
	38  deno                                0x00000001040630f8 Builtins_PromiseFulfillReactionJob + 56
	39  deno                                0x0000000103fbee28 Builtins_RunMicrotasks + 648
	40  deno                                0x0000000103f94e88 Builtins_JSRunMicrotasksEntry + 168
	41  deno                                0x000000010359c958 _ZN2v88internal12_GLOBAL__N_16InvokeEPNS0_7IsolateERKNS1_12InvokeParamsE + 2632
	42  deno                                0x000000010359cf8c _ZN2v88internal12_GLOBAL__N_118InvokeWithTryCatchEPNS0_7IsolateERKNS1_12InvokeParamsE + 88
	43  deno                                0x000000010359d178 _ZN2v88internal9Execution16TryRunMicrotasksEPNS0_7IsolateEPNS0_14MicrotaskQueueEPNS0_11MaybeHandleINS0_6ObjectEEE + 64
	44  deno                                0x00000001035c0888 _ZN2v88internal14MicrotaskQueue13RunMicrotasksEPNS0_7IsolateE + 420
	45  deno                                0x00000001035c06b0 _ZN2v88internal14MicrotaskQueue25PerformCheckpointInternalEPNS_7IsolateE + 84
	46  deno                                0x00000001035b273c _ZN2v88internal7Isolate33FireCallCompletedCallbackInternalEPNS0_14MicrotaskQueueE + 88
	47  deno                                0x00000001034ae388 _ZN2v88Function4CallENS_5LocalINS_7ContextEEENS1_INS_5ValueEEEiPS5_ + 1324
	48  deno                                0x0000000102b98978 _ZN9deno_core7runtime9JsRuntime15poll_event_loop17hed50a7726c370eadE + 2368
	49  deno                                0x0000000102d8fe50 _ZN12deno_runtime10web_worker9WebWorker15poll_event_loop17h435c8f4c193c93fcE + 216
	50  deno                                0x0000000102d8d8f4 _ZN12deno_runtime10web_worker14run_web_worker28_$u7b$$u7b$closure$u7d$$u7d$17h9b6a5805e63832b9E + 2580
	51  deno                                0x0000000102d8aa38 _ZN97_$LT$core..future..from_generator..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$4poll17h9b91a960ac469c96E + 316
	52  deno                                0x0000000102d887cc _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hd4d49fe75277b56cE + 3800
	53  deno                                0x0000000102d877e0 _ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h32cc30ecd2b27a27E + 140
	54  deno                                0x0000000103115cf0 _ZN3std3sys4unix6thread6Thread3new12thread_start17h8d5e19fc4f27caacE + 48
	55  libsystem_pthread.dylib             0x0000000192069240 _pthread_start + 148
	56  libsystem_pthread.dylib             0x0000000192064024 thread_start + 8
)
libc++abi: terminating with uncaught exception of type NSException
make: *** [example] Abort trap: 6

make example crashing

@lucsoft
Copy link

lucsoft commented Feb 10, 2022

Note on macos windows can only be created on the main thread

@brandonros
Copy link
Author

brandonros commented Feb 10, 2022

I can't find webview-official-sys dependency on GitHub.

https://docs.rs/crate/webview-official-sys/0.1.2/source/Cargo.toml

webview_create seems to return UnsafePointer find. webview_run seems to block but not create window but also not log an error/throw an exception. I will try to keep digging but I might hit brick wall as it is above my head.

Edit: found it, in here: https://github.com/webview/webview_rust/

The sample here works fine:

5 $ git clone --recurse-submodules -j8 git@github.com:webview/webview_rust.git
Cloning into 'webview_rust'...
remote: Enumerating objects: 486, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 486 (delta 19), reused 25 (delta 6), pack-reused 436
Receiving objects: 100% (486/486), 128.12 KiB | 2.07 MiB/s, done.
Resolving deltas: 100% (242/242), done.
Submodule 'webview-official' (https://github.com/webview/webview) registered for path 'webview-official-sys/webview-official'
Cloning into '/Users/brandonros/Desktop/webview_rust/webview-official-sys/webview-official'...
remote: Enumerating objects: 1736, done.        
remote: Counting objects: 100% (31/31), done.        
remote: Compressing objects: 100% (23/23), done.        
remote: Total 1736 (delta 16), reused 19 (delta 8), pack-reused 1705        
Receiving objects: 100% (1736/1736), 5.77 MiB | 4.86 MiB/s, done.
Resolving deltas: 100% (926/926), done.
Submodule path 'webview-official-sys/webview-official': checked out '7534ef6e476a1af6206ddb3d0efd3ebf131cba3c'
Brandons-MacBook-Air:Desktop brandonros 2022-02-10 13:33:32 $ cd webview_rust/
Brandons-MacBook-Air:webview_rust brandonros 2022-02-10 13:33:49 $ cargo build
    Updating crates.io index
  Downloaded pkg-config v0.3.24
  Downloaded 1 crate (16.5 KB) in 0.34s
   Compiling cc v1.0.72
   Compiling pkg-config v0.3.24
   Compiling webview-official-sys v0.1.2 (/Users/brandonros/Desktop/webview_rust/webview-official-sys)
   Compiling webview_official v0.2.0 (/Users/brandonros/Desktop/webview_rust)
    Finished dev [unoptimized + debuginfo] target(s) in 10.70s
Brandons-MacBook-Air:webview_rust brandonros 2022-02-10 13:34:09 $ cargo run --example sample
   Compiling webview_official v0.2.0 (/Users/brandonros/Desktop/webview_rust)
    Finished dev [unoptimized + debuginfo] target(s) in 0.23s
     Running `target/debug/examples/sample`
Hello World

image

@brandonros
Copy link
Author

Note on macos windows can only be created on the main thread

this is most likely the culprit. it'd be cool if webview_deno PLUGIN_URL=target/debug/ deno run -Ar --unstable examples/local.ts didn't silently hang/swallow that error somewhere, but aside from that I'm not quite sure how the new deno FFI stuff is going to allow webview_deno to create a window on Mac on the main deno thread...

@nnmrts
Copy link

nnmrts commented Feb 11, 2022

@brandonros I admit I have no clue about low-level stuff (I don't even really know what a thread is), but to me this sounds like Deno itself needs to provide some way of choosing threads or creating a new process, right? webview_deno is just the first example where we encounter this limitation, but isn't this basically an upstream issue completeley different deno projects could also face?

@littledivy
Copy link
Contributor

littledivy commented Feb 11, 2022

FYI make example spawns a webview instance inside a web worker (another thread). We need to update the example to run the webview instance on the main thread. This is not a Deno FFI bug.

@littledivy
Copy link
Contributor

Note that the local.ts example does not launch webview from a non-main thread. Only make example uses web workers (#102 should fix it)

@brandonros
Copy link
Author

@littledivy thanks for that

that gets make example in line with local.ts where it is silently failing/not actually creating a window:

$ git pull origin main
make eremote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 11 (delta 6), reused 7 (delta 3), pack-reused 0
Unpacking objects: 100% (11/11), 1.84 KiB | 171.00 KiB/s, done.
xFrom github.com:webview/webview_deno
 * branch            main       -> FETCH_HEAD
   19c1e77..d19defc  main       -> origin/main
Updating 19c1e77..d19defc
Fast-forward
 Cargo.toml                           |  1 -
 Makefile                             |  2 +-
 examples/local.ts                    |  3 ++-
 examples/ssr/main.ts                 | 13 +++++++++++++
 examples/ssr/worker.ts               | 12 ------------
 examples/ssr/{ssr.jsx => worker.tsx} | 11 +----------
 src/webview.ts                       |  4 ++--
 7 files changed, 19 insertions(+), 27 deletions(-)
 create mode 100644 examples/ssr/main.ts
 delete mode 100644 examples/ssr/worker.ts
 rename examples/ssr/{ssr.jsx => worker.tsx} (68%)
Brandons-MacBook-Air:webview_deno brandonros 2022-02-11 15:15:44 $ make example
PLUGIN_URL=target/debug/ deno run \
		-A \
		--unstable \
		--no-check \
		--config examples/ssr/tsconfig.json \
		examples/ssr/main.ts
[runner] Listening on http://localhost:8000
[runner] worker started

Any idea on what else I can do locally to turn up verbosity and figure out where we are getting stuck?

@littledivy
Copy link
Contributor

I tried debugging it, it's not stuck in deno_webview but something is not working with the NSApplication event loop inside webview. (Setting debug: c_int to 1 doesn't help either)

hoangpq added a commit to hoangpq/deno_webview that referenced this issue Feb 17, 2022
@hoangpq
Copy link
Contributor

hoangpq commented Feb 17, 2022

Hi @eliassjogreen

I created a PR to fix the issue related to WebView on Darwin
#103

First: Must explicitly call set_size method on webview_sys

sys.symbols.deno_webview_set_size(this.#handle, width, height, hint);

I'm not sure about this one return encoder.encode(value + "\n"); in other platform but we need to remove '\n' in Darwin so I do platform check for backward compatible.

image

@eliassjogreen
Copy link
Member

This issue should be closed now with #103. Thanks @hoangpq!

@lucsoft
Copy link

lucsoft commented Feb 17, 2022

image

Works great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macos Related to macOS
Development

No branches or pull requests

8 participants