Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] about:blank crashes on MacOS #9572

Open
bryanlarsen opened this issue Apr 25, 2024 · 0 comments
Open

[bug] about:blank crashes on MacOS #9572

bryanlarsen opened this issue Apr 25, 2024 · 0 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@bryanlarsen
Copy link

Describe the bug

Setting up a webview with "about:blank" crashes Tauri on MacOS.

Reproduction

            let window_builder = tauri::WebviewWindow::builder(
                app,
                "main",
                tauri::WebviewUrl::App("about:blank"),
            );

Expected behavior

Expected a blank window, not a crash

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.3.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.77.1 (7cf61ebde 2024-03-27)
    ✔ cargo: 1.77.1 (e52e36006 2024-03-26)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: 1.77.1-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 21.6.2
    - yarn: 1.22.21
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 2.0.0-beta.16
    - tauri-build [RUST]: 2.0.0-beta.13
    - wry [RUST]: 0.39.0
    - tao [RUST]: 0.27.0
    - tauri-cli [RUST]: 2.0.0-beta.2
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.2

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ui


### Stack trace

```text
thread 'main' panicked at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-beta.16/src/manager/webview.rs:253:27:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/std/src/panicking.rs:647:5
   1: core::panicking::panic_fmt
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/panicking.rs:144:5
   3: core::option::unwrap_failed
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/option.rs:1978:5
   4: core::option::Option<T>::unwrap
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/option.rs:931:21
   5: tauri::manager::webview::WebviewManager<R>::prepare_pending_webview
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-beta.16/src/manager/webview.rs:253:9
   6: tauri::manager::webview::WebviewManager<R>::prepare_webview
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-beta.16/src/manager/webview.rs:508:15
   7: tauri::webview::WebviewBuilder<R>::into_pending_webview
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-beta.16/src/webview/mod.rs:582:5
   8: tauri::window::WindowBuilder<R,M>::with_webview_internal
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-beta.16/src/window/mod.rs:354:7
   9: tauri::window::WindowBuilder<R,M>::with_webview
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-beta.16/src/window/mod.rs:344:5
  10: tauri::webview::webview_window::WebviewWindowBuilder<R,M>::build
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-beta.16/src/webview/webview_window.rs:313:30
  11: bowtie_ui::run::{{closure}}
             at ./src/lib.rs:127:13
  12: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/ops/function.rs:250:5
  13: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/alloc/src/boxed.rs:2015:9
  14: tauri::app::setup
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-beta.16/src/app.rs:1798:5
  15: tauri::app::App<R>::run::{{closure}}
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-beta.16/src/app.rs:935:25
  16: tauri_runtime_wry::handle_event_loop
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-2.0.0-beta.13/src/lib.rs:3208:7
  17: <tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run::{{closure}}
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-2.0.0-beta.13/src/lib.rs:2521:7
  18: <tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event::{{closure}}
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.27.0/src/platform_impl/macos/app_state.rs:105:9
  19: tao::platform_impl::platform::app_state::EventLoopHandler<T>::with_callback
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.27.0/src/platform_impl/macos/app_state.rs:79:7
  20: <tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.27.0/src/platform_impl/macos/app_state.rs:100:5
  21: tao::platform_impl::platform::app_state::Handler::handle_nonuser_event
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.27.0/src/platform_impl/macos/app_state.rs:208:11
  22: tao::platform_impl::platform::app_state::AppState::launched
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.27.0/src/platform_impl/macos/app_state.rs:299:5
  23: tao::platform_impl::platform::app_delegate::did_finish_launching
             at /Users/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.27.0/src/platform_impl/macos/app_delegate.rs:100:3


### Additional context

Replacing "about:blank" with "blank.html" fixes the problem.

The issue is webview.rs line 253, `window_url.host().unwrap()`.   I imagine replacing with `unwrap_or_default()` would fix the crash.
@bryanlarsen bryanlarsen added status: needs triage This issue needs to triage, applied to new issues type: bug labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

1 participant