wry: [macOS] APP crash when a web custom protocol request is aborted before or during response
Describe the bug
When initiating a register_uri_scheme_protocol request from the web side, if the web aborts the request before or during the response, the macOS APP crashes.
Reproduction
- Register a
register_asynchronous_uri_scheme_protocol. - From the web side, initiate a request using this protocol and abort the request before the response.
- The APP crashes 100% of the time.
Expected behavior
- Before responding, the
respondershould check if the request has been canceled. If the request has been canceled, do not send the response. - Or, during the response, catch exceptions to prevent the APP from crashing and quitting abruptly when the request is terminated.
Full tauri info output
[✔] Environment
- OS: Mac OS 13.6.3 X64
✔ Xcode Command Line Tools: installed
✔ rustc: 1.76.0 (07dca489a 2024-02-04)
✔ cargo: 1.76.0 (c84b36747 2024-01-18)
✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
✔ Rust toolchain: stable-x86_64-apple-darwin (default)
- node: 18.17.1
- pnpm: 8.15.4
- npm: 9.6.7
[-] Packages
- tauri [RUST]: 2.0.0-beta.10
- tauri-build [RUST]: 2.0.0-beta.8
- wry [RUST]: 0.37.0
- tao [RUST]: 0.26.1
- @tauri-apps/api [NPM]: 2.0.0-beta.5
- @tauri-apps/cli [NPM]: 2.0.0-beta.9
[-] App
- build-type: bundle
- CSP: default-src x-http: x-https: blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'
- frontendDist: ../feiyu/dist
- devUrl: http://localhost:3000/
Stack trace
thread 'tokio-runtime-worker' panicked at /Users/mac/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wry-0.37.0/src/wkwebview/mod.rs:262:28:
Uncaught exception <NSException: 0x10428cf30>
Additional context
Related code:
https://github.com/tauri-apps/wry/blob/5789bf759ce94e4dad5ff26a08fe81521658a4e4/src/wkwebview/mod.rs#L272
Related issue: https://github.com/tauri-apps/tauri/issues/9177
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 17 (12 by maintainers)
Commits related to this issue
- fix(macOS): race conditions around WKURLSchemeTask Fixes two issues which could cause race conditions when navigating between pages while custom protocol requests are in progress on macOS and iOS: - ... — committed to tactile-eng/wry by alexmoon 2 years ago
- fix(macOS): race conditions around WKURLSchemeTask Fixes two issues which could cause race conditions when navigating between pages while custom protocol requests are in progress on macOS and iOS: - ... — committed to tactile-eng/wry by alexmoon 2 years ago
- fix(macOS): race conditions around WKURLSchemeTask Fixes two issues which could cause race conditions when navigating between pages while custom protocol requests are in progress on macOS and iOS: - ... — committed to tactile-eng/wry by alexmoon 2 years ago
- fix(macOS): race conditions around WKURLSchemeTask Fixes two issues which could cause race conditions when navigating between pages while custom protocol requests are in progress on macOS and iOS: - ... — committed to tactile-eng/wry by alexmoon 2 years ago
- fix(macOS): race conditions around WKURLSchemeTask Fixes two issues which could cause race conditions when navigating between pages while custom protocol requests are in progress on macOS and iOS: - ... — committed to tactile-eng/wry by alexmoon 2 years ago
- fix(macOS): race conditions around WKURLSchemeTask Fixes two issues which could cause race conditions when navigating between pages while custom protocol requests are in progress on macOS and iOS: - ... — committed to tactile-eng/wry by alexmoon 2 years ago
- fix(macOS): race conditions around WKURLSchemeTask (#1484) Fixes two issues which could cause race conditions when navigating between pages while custom protocol requests are in progress on macOS and... — committed to tauri-apps/wry by alexmoon 2 years ago
okay changed my mind 😂 let’s close this (again) and re-open (or open a new issue) if it reappears in tauri 2.3