Skip to content

[macOS] APP crash when a web custom protocol request is aborted before or during response #1189

@idootop

Description

@idootop

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 responder should 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:

let () = msg_send![task, didReceiveResponse: response];

图片

Related issue: tauri-apps/tauri#9177

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions