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

Reloading webview crashes in an edge case [macOS] #1142

Open
morajabi opened this issue Jan 21, 2024 · 2 comments · May be fixed by #1214
Open

Reloading webview crashes in an edge case [macOS] #1142

morajabi opened this issue Jan 21, 2024 · 2 comments · May be fixed by #1214

Comments

@morajabi
Copy link
Contributor

morajabi commented Jan 21, 2024

Describe the bug
I have a custom menu item to reload webview contents (in tauri). It uses following code:

window.with_webview(|webview| {
          #[cfg(target_os = "macos")]
          unsafe {
            let () = msg_send![webview.inner(), reload];
          }
        });

This worked fine until ~last month which started to cause a panic with this message:
CleanShot 2024-01-21 at 13 20 46@2x

Steps To Reproduce
I tried doing the same thing in custom_protocol example, but I can't reproduce this. Can you guide me through debugging what might cause this based on the stack trace, I'd be happy to help narrow down the issue and provide a Wry example / or move the issue to tauri.

more context: I added this code to wry example to trigger reloads which didn't panic:

  event_loop.run(move |event, _, control_flow| {
    *control_flow = ControlFlow::Wait;

    match event {
      Event::WindowEvent { window_id, ref event, .. } => match event {
        WindowEvent::Focused(_) => {
          #[cfg(target_os = "macos")]
          unsafe {
            let webview = _webview.webview();
            let () = msg_send![webview, reload];
          };
        }
        _ => {}
      }
      _ => {}
    }

Expected behavior
To reload the app without panic.

Screenshots
N/A

Platform and Versions (please complete the following information):
OS: macOS 14.2.1 (23C71)
Rustc: rustc 1.73.0 (cc66ad468 2023-10-03)

Additional context
N/A

@morajabi morajabi changed the title Reloading webview crashes [macOS] Reloading webview crashes in an edge case [macOS] Jan 21, 2024
@pewsheen
Copy link
Contributor

pewsheen commented Jan 24, 2024

Did you register any custom protocol by register_uri_scheme_protocol or register_asynchronous_uri_scheme_protocol?

Since it crash at

let () = msg_send![task, didReceiveResponse: response];
.. I'm suspecting the response is not exist, but I can't reproduce it either :\

@morajabi
Copy link
Contributor Author

Did you register any custom protocol by register_uri_scheme_protocol or register_asynchronous_uri_scheme_protocol?

I haven't, but tauri registers two of them that we use I think: ipc:// and asset://.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants