From 477c88518a09ee4b8e69f4fb155b73641b75f6ab Mon Sep 17 00:00:00 2001 From: twlite <46562212+twlite@users.noreply.github.com> Date: Sun, 15 Nov 2026 16:36:07 +0545 Subject: [PATCH 1/2] fix: update Tao fork for macOS lifecycle and shadows --- packages/webview/Cargo.lock | 6 +++--- packages/webview/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/webview/Cargo.lock b/packages/webview/Cargo.lock index a1c0231..1ed9a90 100644 --- a/packages/webview/Cargo.lock +++ b/packages/webview/Cargo.lock @@ -3332,7 +3332,7 @@ dependencies = [ [[package]] name = "tao" version = "0.37.2" -source = "git+https://github.com/webviewjs/tao?rev=9bb2bdc097e430f924a69add056ae55335492ab7#9bb2bdc097e430f924a69add056ae55335492ab7" +source = "git+https://github.com/webviewjs/tao?rev=73ab3e94986f045ad379faee9b2560bffd84012c#73ab3e94986f045ad379faee9b2560bffd84012c" dependencies = [ "bitflags 2.13.2", "block2", @@ -3359,7 +3359,7 @@ dependencies = [ "parking_lot", "percent-encoding", "raw-window-handle", - "tao-macros 0.1.4 (git+https://github.com/webviewjs/tao?rev=9bb2bdc097e430f924a69add056ae55335492ab7)", + "tao-macros 0.1.4 (git+https://github.com/webviewjs/tao?rev=73ab3e94986f045ad379faee9b2560bffd84012c)", "unicode-segmentation", "url", "windows 0.62.2", @@ -3382,7 +3382,7 @@ dependencies = [ [[package]] name = "tao-macros" version = "0.1.4" -source = "git+https://github.com/webviewjs/tao?rev=9bb2bdc097e430f924a69add056ae55335492ab7#9bb2bdc097e430f924a69add056ae55335492ab7" +source = "git+https://github.com/webviewjs/tao?rev=73ab3e94986f045ad379faee9b2560bffd84012c#73ab3e94986f045ad379faee9b2560bffd84012c" dependencies = [ "proc-macro2", "quote", diff --git a/packages/webview/Cargo.toml b/packages/webview/Cargo.toml index 2e7a861..25bfc7f 100644 --- a/packages/webview/Cargo.toml +++ b/packages/webview/Cargo.toml @@ -45,7 +45,7 @@ objc2-app-kit = { version = "0.3.2", default-features = false, features = ["NSAp objc2-foundation = { version = "0.3.2", default-features = false, features = ["NSData"] } [patch.crates-io] -tao = { git = "https://github.com/webviewjs/tao", rev = "9bb2bdc097e430f924a69add056ae55335492ab7" } +tao = { git = "https://github.com/webviewjs/tao", rev = "73ab3e94986f045ad379faee9b2560bffd84012c" } [build-dependencies] napi-build = "2" From 6c23d8e1541ed2ab91151eb2baac5290f04060d2 Mon Sep 17 00:00:00 2001 From: twlite <46562212+twlite@users.noreply.github.com> Date: Sun, 15 Nov 2026 16:36:07 +0545 Subject: [PATCH 2/2] test: cover macOS pumping and shadows through native Node and Bun APIs --- .github/workflows/lint.yml | 19 +++ .../webview/__test__/integration/README.md | 42 +++++ .../__test__/integration/fixtures/macos.mjs | 145 ++++++++++++++++++ .../__test__/integration/macos.test.ts | 71 +++++++++ .../webview/__test__/manual-verification.md | 5 + packages/webview/package.json | 3 +- 6 files changed, 284 insertions(+), 1 deletion(-) create mode 100644 packages/webview/__test__/integration/README.md create mode 100644 packages/webview/__test__/integration/fixtures/macos.mjs create mode 100644 packages/webview/__test__/integration/macos.test.ts diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4019ada..6abca16 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -84,3 +84,22 @@ jobs: - name: Build static docs run: bun run build --filter=@webviewjs/docs + + macos-native: + name: macOS native Node and Bun regressions + runs-on: macos-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + with: + bun-version: 1.4.2 + - uses: actions/setup-node@v4 + with: + node-version: 24 + - uses: dtolnay/rust-toolchain@stable + - run: bun install --frozen-lockfile + - name: Build the local addon and public TypeScript API + run: bun --filter @webviewjs/webview build + - name: Run real AppKit regressions in isolated processes + run: bun --filter @webviewjs/webview test:native:macos diff --git a/packages/webview/__test__/integration/README.md b/packages/webview/__test__/integration/README.md new file mode 100644 index 0000000..39d2169 --- /dev/null +++ b/packages/webview/__test__/integration/README.md @@ -0,0 +1,42 @@ +# macOS native regressions + +Build the local addon and TypeScript API, then opt into real GUI tests: + +```sh +bun --filter @webviewjs/webview build +bun --filter @webviewjs/webview test:native:macos +``` + +Requires a logged-in macOS desktop session, Node.js 24+ and Bun on PATH. Run +without interacting with the windows. These tests use the compiled public API +and real N-API addon, never the fake binding preload used by `runtime/` tests. +They skip unless on macOS with `WEBVIEW_NATIVE_TESTS=1`. + +The parent Bun test process serves HTTP while a fresh main-thread Node or Bun +child owns AppKit. A 25-second watchdog kills a blocked child; every child is +reaped and the server is closed, including on assertion failures. Native +resources and the application pump are explicitly disposed on normal exit. + +- [Copilot CLI #5398](https://github.com/github/copilot-cli/issues/5398): adapted + from the issue's reproduction to load `dist/index.js` locally. Uses + `whenReady({ interval: 50, ref: false })`, localhost, inline HTML and `data:` + navigation, page timers, HTTP fetches, IPC, JS reads and DOM mutation. Each + page must load before another window is created or focus is requested. After + seven seconds without input, also exercises repeated manual pumps, multiple + windows, resize, focus and cleanup. Serving HTTP in the parent isolates server + availability from native pump blocking in the child. +- [WebviewJS #91](https://github.com/webviewjs/webview/issues/91): checks all 16 + combinations of decorations/resizable/minimizable/shadow after webview + creation, style mutations, explicit shadow disabling and runtime changes. + This asserts AppKit `hasShadow` state; visual compositor appearance requires + human inspection. + +Passing on one macOS version does not establish that the macOS 26 loading stall +is resolved. Retest on the affected OS before claiming that result. These tests +do not validate Windows or Linux runtime behavior. + +Known Wry 0.55.1 limitation: `data:` pages load and execute JavaScript, but their +IPC messages are discarded in Wry's macOS delegate because `http::Uri` cannot +represent opaque data URLs. The tests assert data-page timers through JavaScript +evaluation and require IPC from HTTP and inline HTML. This is separate from Tao +pump scheduling and remains unfixed by this dependency update. diff --git a/packages/webview/__test__/integration/fixtures/macos.mjs b/packages/webview/__test__/integration/fixtures/macos.mjs new file mode 100644 index 0000000..946bba6 --- /dev/null +++ b/packages/webview/__test__/integration/fixtures/macos.mjs @@ -0,0 +1,145 @@ +// Real addon only: this child must run on the AppKit main thread, outside bun:test. +import { createRequire } from 'node:module'; +import { setTimeout as delay } from 'node:timers/promises'; + +const require = createRequire(import.meta.url); +const { Application } = require('../../../dist/index.js'); +const app = new Application(); +const windows = []; +const views = []; + +function check(value, message) { + if (!value) throw new Error(message); +} + +async function until(predicate, message) { + const deadline = Date.now() + 10000; + while (!predicate()) { + check(Date.now() < deadline, message); + await delay(50); + } +} + +try { + // Match CanvasWindowManager, including the unreferenced 50ms pump. + const keepAlive = setInterval(() => {}, 1000); + try { + await app.whenReady({ interval: 50, ref: false }); + if (process.argv[2] === 'shadows') { + let combinations = 0; + for (const decorations of [false, true]) { + for (const resizable of [false, true]) { + for (const minimizable of [false, true]) { + for (const shadow of [false, true]) { + const win = app.createBrowserWindow({ decorations, resizable, minimizable, macosHasShadow: shadow }); + windows.push(win); + const view = win.createWebview({ html: '