Skip to content

Bun/Deno crash: webui_show and webui_is_shown not returning correct values #615

@wesleycoder

Description

@wesleycoder

With this Bun wrapper (tested also with Deno) the window crashes after the timeout for not receiving is_shown as true even though the window is displayed correctly after launch.
When debugging I found that in WebUI.show and WebUI.showBrowser the calls to webui_show and webui_show_browser respectively also on isShow the webui_is_shown don't return true correctly when the window is displayed.

Test code:

import { WebUI } from "@webui-dev/bun-webui";

const app = new WebUI();
await app.show("<html><body><h1>Hello World</h1></body></html>");
await WebUI.wait();

I have tried increasing the timeout with WebUI.setTimeout but in any case the app crashes with the following error after roughly 1 minute regardles of a higher timeout.

I believe this is not Bun specific as my tests with Deno came with the same results

While investigating I have commented the checks under show and showBrowser in webui.ts to see if that would allow the app to continue running, but after the ~1min mark it still closes regardless of a highter timeout.

$ ~/dev/webui-test
> bun run index.ts
215 |       toCString(content),
216 |     );
217 |     if (!this.#isFileHandler) {
218 |       // Check if window is launched
219 |       if (!status) {
220 |         throw new WebUIError(`unable to start the browser`);
                            ^
error: unable to start the browser
      at new WebUIError (1:23)
      at show (/Users/wesleycoder/dev/webui-test/node_modules/@webui-dev/bun-webui/src/webui.ts:220:15)
      at show (/Users/wesleycoder/dev/webui-test/node_modules/@webui-dev/bun-webui/src/webui.ts:212:14)
      at /Users/wesleycoder/dev/webui-test/index.ts:4:11

Bun v1.2.18 (macOS arm64)
System info:
$ ~/dev/webui-test
> sw_vers
ProductName:            macOS
ProductVersion:         26.0
BuildVersion:           25A5306g
$ ~/dev/webui-test
> sysctl -n hw.model
MacBookPro18,3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions