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

Problems with running in a worker? #149

Open
randallb opened this issue Dec 19, 2022 · 1 comment
Open

Problems with running in a worker? #149

randallb opened this issue Dec 19, 2022 · 1 comment

Comments

@randallb
Copy link

If I try to run webview in a webworker, I get:

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                      0x00000001ad8db3f8 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x00000001ad426ea8 objc_exception_throw + 60
	2   CoreFoundation                      0x00000001ad904810 _CFBundleGetValueForInfoKey + 0
	3   AppKit                              0x00000001b0b02a18 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 320
	4   AppKit                              0x00000001b0af1524 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 816
	5   AppKit                              0x00000001b0af11e8 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 48
	6   5a78a907fb3b54a23d6ec12156baa6a1009 0x0000000108904fd0 _ZN7webview6detail22cocoa_wkwebview_engineC2EbPv + 672
	7   5a78a907fb3b54a23d6ec12156baa6a1009 0x0000000108904d0c _ZN7webview7webviewC2EbPv + 72
	8   5a78a907fb3b54a23d6ec12156baa6a1009 0x0000000108903afc _ZN7webview7webviewC1EbPv + 56
	9   5a78a907fb3b54a23d6ec12156baa6a1009 0x0000000108903a50 webview_create + 56
	10  deno                                0x000000010325004c ffi_call_SYSV + 76

Presumably that's because it's not on the main thread. I'm unclear on how to make this work so I don't have to block my main thread.

Any thoughts?

@e3ndr
Copy link

e3ndr commented Dec 19, 2022

macOS requires all UI code to run on the main thread, so there's no avoiding that.

The C SDK provides webview.dispatch for executing code on the main thread, so if that got implemented here you could use that to still utilize the main thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants