Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix: reload a macOS page whose web process died, and quit without aborting

Tw9314cd4ba48ec7
diff --git a/.claude/rules/tauri-runtime.md b/.claude/rules/tauri-runtime.md
index 5b45cc8f..d61d8e3f 100644
--- a/.claude/rules/tauri-runtime.md
+++ b/.claude/rules/tauri-runtime.md
@@ -17,8 +17,9 @@ paths:
- Windows `--password-autosave` is opt-in and disabled in private windows. Every window creation must apply both true and false through `ICoreWebView2Settings4::SetIsPasswordAutosaveEnabled`; do not treat the false case as a no-op. Legacy configs default to false. This controls new save/update prompts, not existing password autofill or general autofill, and does not share an Edge or Chrome profile. Keep the native bool, CLI/config surface, and both language docs consistent; cover all four requested/private combinations and the missing-field default in the `config.rs` Rust tests, and keep `tests/unit/password-autosave.test.ts` asserting that both values reach the native call.
- `--new-window` and `--multi-window` do not bypass every provider policy. Google OAuth and similar embedded-WebView restrictions may still require a normal browser or native client.
- macOS Basic Auth keeps only an enablement boolean in CLI/config. Usernames and passwords are runtime-only input for the target host and session; never put them in CLI arguments, config, generated artifacts, logs, or persistence. Native dialog changes need a real macOS smoke covering the icon, button alignment, label/input baselines, field width, and outer margins; compile and unit tests do not prove the layout.
-- A sized `window.open` to a sign-in URL, or to the app's own site, is a popup flow: the popup signs in, answers `window.opener` and closes itself (the Google button on TikTok and X, Notion's own redirect page, Sign in with Apple). On macOS and Windows it gets a real window under every `--new-window` setting. Navigating the opener there instead, which macOS did from 0419e982 to avoid a WebKit abort that 63863b7e's target-configuration popups later removed, left the callback page with nobody to answer: a blank window after the Google password (user reports, 2026-11-18), and a frame's popup (Google's button on X is a frame) was refused outright. `requestsPopupWindow` and `openPopupThroughBlank` in `link_policy.js` open the popup blank and send it to its address, from `event.js` and from `frame_links.js`, because the native handler builds a blank popup under every setting while one that starts at its address exists only with `--new-window`. "Sized" follows the window features as a browser reads them: commas or spaces separate, an explicit `popup` decides, `noopener` and `noreferrer` rule a popup out, since it could not be sent to its address. Every other sign-in `window.open` keeps its route through `openAuthNavigation` (no size, `noopener`, a `_self` target, a popup the engine refused): the current window on macOS and Linux, a native popup first on Windows. A sized popup of another site goes to the system browser unless its URL or its window name (`login`, `oauth` and the rest of `isAuthPopup`) marks a sign-in. WebView2 runs `event.js` in subframes too, where the app's own site is `pakeConfig.url`, not the frame's address. Linux is left out by `opensSignInPopups` until a self-closing popup has been run on a real WebKitGTK desktop: Wry destroys the web view at once there, which nobody has measured against an IPC call in flight. URL matching lives in `src-tauri/src/inject/auth.js` (`matchesAuthUrl`), covered by `tests/unit/auth-sso-patterns.test.js`; routing changes need `tests/unit/event-link-guard.test.js`, `tests/unit/frame-links.test.js` and `tests/browser/popup-routing.mjs`, whose frame cases pass on any code because Chromium never refuses a popup.
-- A popup's page closes it with `window.close()`. WKWebView closes nothing for that call unless its UI delegate implements `webViewDidClose:`, which Wry's does not; `src-tauri/src/app/popup_close.rs` closes the window, and only for windows a page opened (`page_popup`), since WebKit sends the same message for a main window whose page calls `window.close()`. WebView2 raises `WindowCloseRequested`, which Wry answers by destroying only the web view's container, so the Windows arm in `build_window` closes the window too (measured in a Windows 11 VM: the popup had answered its opener and stayed on screen titled `callback`). On Linux the window stays with its web view destroyed, as before. On macOS the timing is load-bearing twice. WebKit cancels a closing page's requests, a callback page closes in its first script, and Tauri's notification plugin has an IPC call out in every document (`is_permission_granted`); the answer to a cancelled `ipc://` request makes WebKit raise, and under the release profile's `panic = "abort"` Wry's `objc2::exception::catch` cannot hold, so the whole app quit on every sign-in (measured on macOS 26.7; with `panic = "unwind"` the same run passed, at 2.0 MB more per architecture, 11.8 to 13.8 MB). So `event.js` delays every top-level page's own `window.close()` by `WINDOW_CLOSE_DELAY_MS` (every page, because a `noopener` popup has no `window.opener` to tell it by; in the main window it is a precaution, since a self-closing first page there did not abort in three runs without it), and the native side hides the window at once and destroys it after `CLOSE_GRACE`, because destroying the web view cancels requests too. Not covered: an opener that closes a cross-origin popup calls the engine's own `close`, a page that navigates within the delay after `close()` loses the close, and the same abort is possible wherever a page with an IPC call in flight is torn down. Page-opened popups take `pake-popup-N` labels (`POPUP_WINDOW_LABEL_PREFIX`) and the window-state plugin filters them out, so a popup opens at the size its page asked for and a Cmd+N window never inherits one. Verify on a real bundle with `tests/integration/signin-popup-server.mjs`: each of its three buttons must end with the app's page in place, the answer received, the popup gone and the app still running, several times in a row, and its `/selfclose` page must leave the main window open.
+- A sized `window.open` to a sign-in URL, or to the app's own site, is a popup flow: the popup signs in, answers `window.opener` and closes itself (the Google button on TikTok and X, Notion's own redirect page, Sign in with Apple). On macOS and Windows it gets a real window under every `--new-window` setting. Navigating the opener there instead, which macOS did from 0419e982 to avoid a WebKit abort that 63863b7e's target-configuration popups later removed, left the callback page with nobody to answer: a blank window after the Google password (user reports, 2026-11-18), and a frame's popup (Google's button on X is a frame) was refused outright. `requestsPopupWindow` in `link_policy.js` decides, and `event.js` and `frame_links.js` hand such a popup to the native `window.open` at its own address; `builds_requested_popup` in `window.rs` builds any popup that asks for a size, with or without `--new-window`. The popup must start at its address, and only the engine may load it. 41e1a6f9 opened it blank and sent it there afterwards, and on a site that sets `Cross-Origin-Opener-Policy: same-origin-allow-popups` (x.com does) WebKit keeps a popup with its opener only across the popup's first navigation, so after the Google password the popup had no opener, stayed blank and could not close (the maintainer on X, 2026-11-18, while Notion, which sends no such header, signed in). The second half is `popup_build_url`: WKWebView and WebView2 load a popup's address themselves into the web view they are handed, and Tauri, given the same address, has Wry load it again as the app's own navigation, which moves the page to another process and drops `window.opener` (measured on macOS 26.7 with the fixture: a popup opened at its address reported `opener=no`), so a popup's web view is built with `about:blank`, the one address Tauri does not load. Since the native handler builds every sized popup, a frame's sized named popup to another site takes the external route in `frame_links.js` instead of reaching it. "Sized" follows the window features as a browser reads them: commas or spaces separate, an explicit `popup` decides, `noopener` and `noreferrer` rule a popup out, since it could not be sent to its address. Every other sign-in `window.open` keeps its route through `openAuthNavigation` (no size, `noopener`, a `_self` target, a popup the engine refused): the current window on macOS and Linux, a native popup first on Windows. A sized popup of another site goes to the system browser unless its URL or its window name (`login`, `oauth` and the rest of `isAuthPopup`) marks a sign-in. WebView2 runs `event.js` in subframes too, where the app's own site is `pakeConfig.url`, not the frame's address. Linux is left out by `opensSignInPopups` until a self-closing popup has been run on a real WebKitGTK desktop: Wry destroys the web view at once there, which nobody has measured against an IPC call in flight. URL matching lives in `src-tauri/src/inject/auth.js` (`matchesAuthUrl`), covered by `tests/unit/auth-sso-patterns.test.js`; routing changes need `tests/unit/event-link-guard.test.js`, `tests/unit/frame-links.test.js` and `tests/browser/popup-routing.mjs`, whose frame cases pass on any code because Chromium never refuses a popup.
+- A popup's page closes it with `window.close()`. WKWebView closes nothing for that call unless its UI delegate implements `webViewDidClose:`, which Wry's does not; `src-tauri/src/app/popup_close.rs` closes the window, and only for windows a page opened (`page_popup`), since WebKit sends the same message for a main window whose page calls `window.close()`. WebView2 raises `WindowCloseRequested`, which Wry answers by destroying only the web view's container, so the Windows arm in `build_window` closes the window too (measured in a Windows 11 VM: the popup had answered its opener and stayed on screen titled `callback`). On Linux the window stays with its web view destroyed, as before. On macOS the timing is load-bearing twice. WebKit cancels a closing page's requests, a callback page closes in its first script, and Tauri's notification plugin has an IPC call out in every document (`is_permission_granted`); the answer to a cancelled `ipc://` request makes WebKit raise, and under the release profile's `panic = "abort"` Wry's `objc2::exception::catch` cannot hold, so the whole app quit on every sign-in (measured on macOS 26.7; with `panic = "unwind"` the same run passed, at 2.0 MB more per architecture, 11.8 to 13.8 MB). So `event.js` delays every top-level page's own `window.close()` by `WINDOW_CLOSE_DELAY_MS` (every page, because a `noopener` popup has no `window.opener` to tell it by; in the main window it is a precaution, since a self-closing first page there did not abort in three runs without it), and the native side hides the window at once and destroys it after `CLOSE_GRACE`, because destroying the web view cancels requests too. Not covered: an opener that closes a cross-origin popup calls the engine's own `close`, a page that navigates within the delay after `close()` loses the close, and the same abort is possible wherever a page with an IPC call in flight is torn down. Page-opened popups take `pake-popup-N` labels (`POPUP_WINDOW_LABEL_PREFIX`) and the window-state plugin filters them out, so a popup opens at the size its page asked for and a Cmd+N window never inherits one. Verify on a real bundle with `tests/integration/signin-popup-server.mjs`, whose app pages send that opener policy: each of its three buttons must end with the app's page in place, the answer received, the popup gone and the app still running, several times in a row, and its `/selfclose` page must leave the main window open.
+- A WKWebView whose web content process dies goes white and stays white, with no URL. `recovery.rs` replaces `webViewWebContentProcessDidTerminate:` on Wry's navigation delegate (Wry implements it, Tauri 2.10 passes no handler down) and reloads, at most `MAX_RELOADS` times in `RELOAD_WINDOW` as on Windows and Linux. Never call `window.url()` directly: Wry's getter unwraps WKWebView's `URL`, which is nil for such a web view, and the panic aborts the app under `panic = "abort"`. A user's X app went white and then crashed on Cmd+Q, in `save_last_url` on `RunEvent::Exit` (2026-11-18); `page_url` in `window.rs` asks the web view first and is the only reader. Verify on a real bundle by killing the app's own `com.apple.WebKit.WebContent` process (the one that appears after launch): the page comes back twice, the third time it stays white, and quitting then leaves no crash report.
- Auth routing matches provider hostnames and endpoint-shaped paths separately, never query strings or fragments. Tracking links carrying a login URL must still open externally. Cover main-page and subframe clicks in `tests/browser/popup-routing.mjs`; classifier-only tests do not prove routing.
- Blank/two-stage popups need a real WindowProxy, not the main window. Normalize omitted/empty URLs to `about:blank` in both JS entry points: Tauri rejects WebKit's empty URL before calling `on_new_window`. The default native handler must create a managed blank popup with Pake's download delegate even without `--new-window`; `NewWindowResponse::Allow` does not provide that delegate. Verify actual macOS attachment bytes and preservation of the main URL, not only Chromium popup creation.
- `--download-dir` / `downloadDir` is embedded as trusted `pake.download_dir`, shared by native and IPC downloads through `get_download_dir`. Empty means system Downloads; quoted `~/path` expands against the runtime user home. Reject relative paths and absolute tilde suffixes, create missing directories on download, and surface directory creation plus file open/write failures without redirecting to another folder. Do not accept a directory from remote-page IPC arguments.
diff --git a/src-tauri/src/app/invoke.rs b/src-tauri/src/app/invoke.rs
index d4b168d2..2cd87eef 100644
--- a/src-tauri/src/app/invoke.rs
+++ b/src-tauri/src/app/invoke.rs
@@ -319,7 +319,10 @@ pub async fn download_file(
let path_str = output_path.to_str().ok_or("Invalid output path")?;
let url = Url::from_str(&params.url).map_err(|e| format!("Invalid URL: {}", e))?;
- let page_url = trusted_page_url(params.page_url.as_deref(), window.url().ok().as_ref());
+ let page_url = trusted_page_url(
+ params.page_url.as_deref(),
+ crate::app::window::page_url(&window).as_ref(),
+ );
let response = match download_client() {
Ok(client) => {
diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs
index c9d63915..9f5eb602 100644
--- a/src-tauri/src/app/menu.rs
+++ b/src-tauri/src/app/menu.rs
@@ -339,7 +339,7 @@ pub fn handle_menu_click(app_handle: &AppHandle, id: &str) {
if let Some(window) = focused_webview_window(app_handle) {
// Prefer the native webview URL so copy still works on error
// pages that have no document.location / clipboard API.
- if let Ok(url) = window.url() {
+ if let Some(url) = crate::app::window::page_url(&window) {
copy_text_to_pasteboard(url.as_str());
}
}
diff --git a/src-tauri/src/app/mod.rs b/src-tauri/src/app/mod.rs
index 36eca584..81a5cf20 100644
--- a/src-tauri/src/app/mod.rs
+++ b/src-tauri/src/app/mod.rs
@@ -19,7 +19,6 @@ pub mod navigation;
pub mod notification;
#[cfg(target_os = "macos")]
pub mod popup_close;
-#[cfg(any(target_os = "linux", target_os = "windows", test))]
pub mod recovery;
#[cfg(target_os = "macos")]
pub mod script_dialogs;
diff --git a/src-tauri/src/app/recovery.rs b/src-tauri/src/app/recovery.rs
index c17ec944..ad590dc1 100644
--- a/src-tauri/src/app/recovery.rs
+++ b/src-tauri/src/app/recovery.rs
@@ -3,7 +3,10 @@
//! WebKitGTK shows a bare engine message for a failed load and a dead grey view
//! after its web process exits; WebView2 has its own error page but leaves a
//! blank view after a renderer crash. Neither had a way back short of knowing
-//! Ctrl+R. macOS is not covered: Tauri 2.10 exposes neither hook for WKWebView.
+//! Ctrl+R. WKWebView is left blank as well when its web content process dies,
+//! and Wry's navigation delegate hears of it but Tauri 2.10 passes no handler
+//! down, so the macOS arm replaces that delegate method and reloads there. A
+//! failed load on macOS is still not covered.
/// A page that takes its renderer down on every load must not be reloaded for ever: after
/// `MAX_RELOADS` in `RELOAD_WINDOW` the view is left as it is.
@@ -20,7 +23,7 @@ pub(crate) fn may_reload(recent: &mut Vec<std::time::Instant>, now: std::time::I
true
}
-#[cfg(any(target_os = "linux", target_os = "windows"))]
+#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
fn reload_allowed() -> bool {
use std::cell::RefCell;
thread_local! {
@@ -106,6 +109,79 @@ pub fn install(webview: &tauri::webview::PlatformWebview) {
}
}
+/// `void webViewWebContentProcessDidTerminate:(WKWebView *)webView`.
+#[cfg(target_os = "macos")]
+const DID_TERMINATE: &std::ffi::CStr = c"webViewWebContentProcessDidTerminate:";
+
+/// Wry's own implementation, kept so its handler still runs first.
+#[cfg(target_os = "macos")]
+static WRY_DID_TERMINATE: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
+
+#[cfg(target_os = "macos")]
+type DidTerminate =
+ extern "C" fn(&objc2::runtime::AnyObject, objc2::runtime::Sel, *mut objc2::runtime::AnyObject);
+
+#[cfg(target_os = "macos")]
+extern "C" fn did_terminate(
+ this: &objc2::runtime::AnyObject,
+ cmd: objc2::runtime::Sel,
+ webview: *mut objc2::runtime::AnyObject,
+) {
+ let original = WRY_DID_TERMINATE.load(std::sync::atomic::Ordering::Relaxed);
+ if original != 0 && original != did_terminate as *const () as usize {
+ // SAFETY: the value is the method's previous implementation, which
+ // has this signature.
+ let original: DidTerminate = unsafe { std::mem::transmute(original) };
+ original(this, cmd, webview);
+ }
+ if webview.is_null() || !reload_allowed() {
+ return;
+ }
+ // SAFETY: WebKit calls this on the main thread with the live web view.
+ // Reload returns the page the dead process was showing.
+ let _: *mut objc2::runtime::AnyObject = unsafe { objc2::msg_send![webview, reload] };
+}
+
+/// Bring a page back when its web content process dies: the window went
+/// white and stayed white, and a user who then quit got a crash report on top
+/// (a user's report, 2026-11-18). Idempotent: the method is replaced once on
+/// the delegate's class, which every web view shares.
+#[cfg(target_os = "macos")]
+pub fn install(webview: &tauri::webview::PlatformWebview) {
+ use objc2::runtime::{AnyClass, AnyObject, Imp, Sel};
+ use std::sync::atomic::Ordering;
+
+ let view = webview.inner() as *mut AnyObject;
+ if view.is_null() {
+ eprintln!("[Pake] Failed to access WKWebView for its crash recovery");
+ return;
+ }
+ // SAFETY: Tauri runs this on the main thread with the live WKWebView.
+ unsafe {
+ let delegate: *mut AnyObject = objc2::msg_send![view, navigationDelegate];
+ if delegate.is_null() {
+ eprintln!("[Pake] The WKWebView has no navigation delegate for its crash recovery");
+ return;
+ }
+ let class: *const AnyClass = objc2::msg_send![delegate, class];
+ let selector = Sel::register(DID_TERMINATE);
+ let method = objc2::ffi::class_getInstanceMethod(class, selector);
+ if method.is_null() {
+ eprintln!("[Pake] The navigation delegate does not hear of a dead web process");
+ return;
+ }
+ let replacement: Imp = std::mem::transmute::<DidTerminate, Imp>(did_terminate);
+ let current = objc2::ffi::method_getImplementation(method);
+ if current.map(|imp| imp as usize) == Some(replacement as usize) {
+ return;
+ }
+ let previous = objc2::ffi::method_setImplementation(method as *mut _, replacement);
+ if let Some(previous) = previous {
+ WRY_DID_TERMINATE.store(previous as usize, Ordering::Relaxed);
+ }
+ }
+}
+
/// A self-contained page for a load that failed: what happened, the site, one way back.
#[cfg(any(target_os = "linux", test))]
pub(crate) fn error_page(host: &str, chinese: bool) -> String {
diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs
index 2cb3bb59..880c3eda 100644
--- a/src-tauri/src/app/window.rs
+++ b/src-tauri/src/app/window.rs
@@ -1118,11 +1118,11 @@ fn build_window(
}
}
- #[cfg(target_os = "windows")]
+ #[cfg(any(target_os = "windows", target_os = "macos"))]
if let Err(error) = window.with_webview(|webview| {
crate::app::recovery::install(&webview);
}) {
- eprintln!("[Pake] Failed to access WebView2 for crash recovery: {error}");
+ eprintln!("[Pake] Failed to access the web view for crash recovery: {error}");
}
// Every webview is built here (main window, Cmd+N clones, --new-window and
@@ -1284,13 +1284,46 @@ fn web_target(url: &WebviewUrl) -> Option<Url> {
matches!(target.scheme(), "http" | "https").then_some(target)
}
+/// The address a window is showing, or `None` when it shows none. On macOS a
+/// WKWebView whose web content process has died has no URL, and Wry's getter
+/// unwraps it: `window.url()` there is a panic, which the release profile
+/// turns into the app aborting (a user quit an app whose page had gone white
+/// and got a crash report, 2026-11-18). So the web view is asked first.
+pub fn page_url(window: &WebviewWindow) -> Option<Url> {
+ #[cfg(target_os = "macos")]
+ {
+ let (answer, has_url) = std::sync::mpsc::channel();
+ let asked = window.with_webview(move |webview| {
+ let view = webview.inner() as *mut objc2::runtime::AnyObject;
+ let url: *mut objc2::runtime::AnyObject = if view.is_null() {
+ std::ptr::null_mut()
+ } else {
+ // SAFETY: Tauri runs this on the main thread with the live WKWebView.
+ unsafe { objc2::msg_send![view, URL] }
+ };
+ let _ = answer.send(!url.is_null());
+ });
+ let shows_a_page = asked.is_ok()
+ && has_url
+ .recv_timeout(std::time::Duration::from_millis(500))
+ .unwrap_or(false);
+ if !shows_a_page {
+ return None;
+ }
+ }
+ window.url().ok()
+}
+
pub fn save_last_url(app: &AppHandle) {
let Some(window) = app.get_webview_window("pake") else {
return;
};
+ let Some(url) = page_url(&window) else {
+ return;
+ };
let result = (|| -> Result<(), Box<dyn std::error::Error>> {
let path = app.path().app_data_dir()?.join("last-url.txt");
- crate::util::write_last_url(&path, &window.url()?)?;
+ crate::util::write_last_url(&path, &url)?;
Ok(())
})();
if let Err(error) = result {
diff --git a/tests/unit/macos-web-process-recovery.test.ts b/tests/unit/macos-web-process-recovery.test.ts
new file mode 100644
index 00000000..4c56ced3
--- /dev/null
+++ b/tests/unit/macos-web-process-recovery.test.ts
@@ -0,0 +1,49 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import { describe, expect, it } from 'vitest';
+
+const rustRoot = path.join(process.cwd(), 'src-tauri', 'src');
+const read = (relative: string) =>
+ // A Windows checkout has CRLF line endings; the patterns below are written for LF.
+ fs.readFileSync(path.join(rustRoot, relative), 'utf8').replace(/\r\n/g, '\n');
+
+describe('a page whose web content process died on macOS', () => {
+ it('is reloaded, within the same limit as on Windows and Linux', () => {
+ const recovery = read('app/recovery.rs');
+ expect(recovery).toContain('c"webViewWebContentProcessDidTerminate:"');
+ // Wry's delegate already has the method, so it is replaced, not added.
+ expect(recovery).toContain('objc2::ffi::method_setImplementation(');
+ const start = recovery.indexOf('extern "C" fn did_terminate(');
+ const body = recovery.slice(start, recovery.indexOf('\n}\n', start));
+ const limited = body.indexOf('!reload_allowed()');
+ const reloaded = body.indexOf('objc2::msg_send![webview, reload]');
+ expect(limited).toBeGreaterThan(-1);
+ expect(reloaded).toBeGreaterThan(limited);
+
+ const window = read('app/window.rs');
+ const build = window.slice(window.indexOf('fn build_window('));
+ expect(build).toMatch(
+ /#\[cfg\(any\(target_os = "windows", target_os = "macos"\)\)\]\s+if let Err\(error\) = window\.with_webview\(\|webview\| \{\s+crate::app::recovery::install\(&webview\);/,
+ );
+ });
+
+ it('never asks Wry for the URL of a web view that has none', () => {
+ // Wry unwraps WKWebView's URL, which is nil once the process has died:
+ // quitting an app whose page had gone white aborted it.
+ const window = read('app/window.rs');
+ const start = window.indexOf('pub fn page_url(');
+ const body = window.slice(start, window.indexOf('\n}\n', start));
+ const asked = body.indexOf('objc2::msg_send![view, URL]');
+ const refused = body.indexOf('return None;');
+ const read_url = body.indexOf('window.url().ok()');
+ expect(asked).toBeGreaterThan(-1);
+ expect(refused).toBeGreaterThan(asked);
+ expect(read_url).toBeGreaterThan(refused);
+
+ // Every reader goes through it.
+ expect(window.split('window.url().ok()').length - 1).toBe(1);
+ for (const file of ['app/menu.rs', 'app/invoke.rs', 'lib.rs']) {
+ expect(read(file), file).not.toContain('window.url()');
+ }
+ });
+});
diff --git a/tests/unit/menu-focused-window.test.ts b/tests/unit/menu-focused-window.test.ts
index f9661068..231fa1ec 100644
--- a/tests/unit/menu-focused-window.test.ts
+++ b/tests/unit/menu-focused-window.test.ts
@@ -28,7 +28,8 @@ describe('macOS menu window targeting', () => {
});
it('copies the native webview URL without requiring page JS', () => {
- expect(handler).toContain('window.url()');
+ // Through page_url: Wry's own getter panics on a web view with no URL.
+ expect(handler).toContain('crate::app::window::page_url(&window)');
expect(handler).toContain('copy_text_to_pasteboard');
expect(handler).not.toContain(
'navigator.clipboard.writeText(window.location.href)',