Skip to content

[bug] Data URI is not working when the window-data-url feature enabled #7078

@yuezk

Description

@yuezk

Describe the bug

The document says the data URL (such as data:text/html,<html>...) is supported when enabled by the window-data-url feature. But the fact is that an error occurred when loading the data URL.

Reproduction

Create a WebviewWindow in JS, and it will throw an error.

const webview = new WebviewWindow('my-label', {
      url: 'data:text/html,<h3>hello, world</h3>'
});

Expected behavior

Can create WebviewWindnow with the data URL successfully.

Platform and versions

image

Stack trace

thread 'tokio-runtime-worker' panicked at 'called `Option::unwrap()` on a `None` value', /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.3.0/src/manager.rs:485:29
stack backtrace:
   0: rust_begin_unwind
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
   1: core::panicking::panic_fmt
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
   2: core::panicking::panic
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:114:5
   3: core::option::Option<T>::unwrap
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/option.rs:942:21
   4: tauri::manager::WindowManager<R>::prepare_pending_window
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.3.0/src/manager.rs:485:11
   5: tauri::manager::WindowManager<R>::prepare_window
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.3.0/src/manager.rs:1189:15
   6: tauri::window::WindowBuilder<R>::build
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.3.0/src/window.rs:320:19
   7: tauri::endpoints::window::Cmd::create_webview::{{closure}}
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.3.0/src/endpoints/window.rs:219:5
   8: tauri::endpoints::window::Cmd::run::{{closure}}
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.3.0/src/endpoints/window.rs:200:23
   9: tauri::endpoints::Module::run::{{closure}}
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.3.0/src/endpoints.rs:151:11
  10: tauri::hooks::InvokeResolver<R>::return_task::{{closure}}
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.3.0/src/hooks.rs:242:22
  11: tauri::hooks::InvokeResolver<R>::respond_async::{{closure}}
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.3.0/src/hooks.rs:185:70
  12: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/future/future.rs:125:9
  13: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/task/core.rs:223:17
  14: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/loom/std/unsafe_cell.rs:14:9
  15: tokio::runtime::task::core::Core<T,S>::poll
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/task/core.rs:212:13
  16: tokio::runtime::task::harness::poll_future::{{closure}}
             at /home/<home>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/task/harness.rs:476:19
  17: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panic/unwind_safe.rs:271:9
  18: std::panicking::try::do_call
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40

Additional context

No response

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