wry Documentation

Cross-platform WebView library in Rust for Tauri.

5,021 stars Rust Rust 2 files ยท ~49,407 tokens
RAW Doc

File: README.md






Wry is a cross-platform WebView rendering library.

The webview requires a running event loop and a window type that implements [HasWindowHandle],
or a gtk container widget if you need to support X11 and Wayland.
You can use a windowing library like tao or winit.

Examples

This example leverages the [HasWindowHandle] and supports Windows, macOS, iOS, Android and Linux (X11 Only).
See the following example using winit:

rust
#[derive(Default)]
struct App {
  window: Option<Window>,
  webview: Option<wry::WebView>,
}

impl ApplicationHandler for App {
  fn resumed(&mut self, event_loop: &ActiveEventLoop) {
    let window = event_loop.create_window(Window::default_attributes()).unwrap();
    let webview = WebViewBuilder::new()
      .with_url("https://tauri.app")
      .build(&window)
      .unwrap();

    self.window = Some(window);
    self.webview = Some(webview);
  }

  fn window_event(&mut self, _event_loop: &ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {}
}

let event_loop = EventLoop::new().unwrap();
let mut app = App::default();
event_loop.run_app(&mut app).unwrap();

If you also want to support Wayland too, then we recommend you use [WebViewBuilderExtUnix::build_gtk] on Linux.
See the following example using tao:

rust
let event_loop = EventLoop::new();
let window = WindowBuilder::new().build(&event_loop).unwrap();

let builder = WebViewBuilder::new().with_url("https://tauri.app");

#[cfg(not(target_os = "linux"))]
let webview = builder.build(&window).unwrap();
#[cfg(target_os = "linux")]
let webview = builder.build_gtk(window.gtk_window()).unwrap();

Child webviews

You can use [WebViewBuilder::build_as_child] to create the webview as a child inside another window. This is supported on
macOS, Windows and Linux (X11 Only).

rust
#[derive(Default)]
struct App {
  window: Option<Window>,
  webview: Option<wry::WebView>,
}

impl ApplicationHandler for App {
  fn resumed(&mut self, event_loop: &ActiveEventLoop) {
    let window = event_loop.create_window(Window::default_attributes()).unwrap();
    let webview = WebViewBuilder::new()
      .with_url("https://tauri.app")
      .with_bounds(Rect {
        position: LogicalPosition::new(100, 100).into(),
        size: LogicalSize::new(200, 200).into(),
      })
      .build_as_child(&window)
      .unwrap();

    self.window = Some(window);
    self.webview = Some(webview);
  }

  fn window_event(&mut self, _event_loop: &ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {}
}

let event_loop = EventLoop::new().unwrap();
let mut app = App::default();
event_loop.run_app(&mut app).unwrap();

If you want to support X11 and Wayland at the same time, we recommend using
[WebViewExtUnix::new_gtk] or [WebViewBuilderExtUnix::build_gtk] with [gtk::Fixed].

rust
let event_loop = EventLoop::new();
let window = WindowBuilder::new().build(&event_loop).unwrap();

let builder = WebViewBuilder::new()
  .with_url("https://tauri.app")
  .with_bounds(Rect {
    position: LogicalPosition::new(100, 100).into(),
    size: LogicalSize::new(200, 200).into(),
  });

#[cfg(not(target_os = "linux"))]
let webview = builder.build_as_child(&window).unwrap();
#[cfg(target_os = "linux")]
let webview = {
  let vbox = window.default_vbox().unwrap(); // tao adds a gtk::Box by default
  let fixed = gtk::Fixed::new();
  fixed.show_all();
  vbox.pack_start(&fixed, true, true, 0);
  builder.build_gtk(&fixed).unwrap()
};

Platform Considerations

Here is the underlying web engine each platform uses, and some dependencies you might need to install.

Linux

WebKitGTK is used to provide webviews on Linux which requires GTK,
so if the windowing library doesn't support GTK (as in winit)
you'll need to call [gtk::init] before creating the webview and then call [gtk::main_iteration_do] alongside
your windowing library event loop.

rust
#[derive(Default)]
struct App {
  webview_window: Option<(Window, WebView)>,
}

impl ApplicationHandler for App {
  fn resumed(&mut self, event_loop: &ActiveEventLoop) {
    let window = event_loop.create_window(Window::default_attributes()).unwrap();
    let webview = WebViewBuilder::new()
      .with_url("https://tauri.app")
      .build(&window)
      .unwrap();

    self.webview_window = Some((window, webview));
  }

  fn window_event(&mut self, _event_loop: &ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {}

  // Advance GTK event loop <!----- IMPORTANT
  fn about_to_wait(&mut self, _event_loop: &ActiveEventLoop) {
    #[cfg(target_os = "linux")]
    while gtk::events_pending() {
      gtk::main_iteration_do(false);
    }
  }
}

let event_loop = EventLoop::new().unwrap();
let mut app = App::default();
event_loop.run_app(&mut app).unwrap();

Linux Dependencies

Arch Linux / Manjaro:

bash
sudo pacman -S webkit2gtk-4.1

Debian / Ubuntu:

bash
sudo apt install libwebkit2gtk-4.1-dev

Fedora

bash
sudo dnf install gtk3-devel webkit2gtk4.1-devel

Nix & NixOS

nix
# shell.nix

let
   # Unstable Channel | Rolling Release
   pkgs = import (fetchTarball("channel:nixpkgs-unstable")) { };
   packages = with pkgs; [
     pkg-config
     webkitgtk_4_1
   ];
 in
 pkgs.mkShell {
   buildInputs = packages;
 }
sh
nix-shell shell.nix

GUIX

scheme
;; manifest.scm

(specifications->manifest
  '("pkg-config"                ; Helper tool used when compiling
    "webkitgtk"                 ; Web content engine fot GTK+
 ))
bash
guix shell -m manifest.scm

macOS

WebKit is native on macOS so everything should be fine.

If you are cross-compiling for macOS using osxcross and encounter a runtime panic like Class with name WKWebViewConfiguration could not be found it's possible that WebKit.framework has not been linked correctly, to fix this set the RUSTFLAGS environment variable:

bash
RUSTFLAGS="-l framework=WebKit" cargo build --target=x86_64-apple-darwin --release

Windows

WebView2 provided by Microsoft Edge Chromium is used. So wry supports Windows 7, 8, 10 and 11.

Android

In order for wry to be able to create webviews on Android, there are a few requirements that your application needs to uphold:

  1. You need to set a few environment variables that will be used to generate the necessary kotlin
    files that you need to include in your Android application for wry to function properly.
    • WRY_ANDROID_PACKAGE: which is the reversed domain name of your android project and the app name in snake_case, for example, com.wry.example.wry_app
    • WRY_ANDROID_LIBRARY: for example, if your cargo project has a lib name wry_app, it will generate libwry_app.so so you set this env var to wry_app
    • WRY_ANDROID_KOTLIN_FILES_OUT_DIR: for example, path/to/app/src/main/kotlin/com/wry/example
  2. Your main Android Activity needs to inherit AppCompatActivity, preferably it should use the generated WryActivity or inherit it.
  3. Your Rust app needs to call wry::android_setup function to setup the necessary logic to be able to create webviews later on.
  4. Your Rust app needs to call wry::android_binding! macro to setup the JNI functions that will be called by WryActivity and various other places.

It is recommended to use the tao crate as it provides maximum compatibility with wry.

rust
#[cfg(target_os = "android")]
{
  tao::android_binding!(
      com_example,
      wry_app,
      WryActivity,
      wry::android_setup, // pass the wry::android_setup function to tao which will be invoked when the event loop is created
      _start_app
  );
  wry::android_binding!(com_example, ttt);
}

If this feels overwhelming, you can just use the preconfigured template from cargo-mobile2.

For more information, check out MOBILE.md.

Feature flags

Wry uses a set of feature flags to toggle several advanced features.

  • os-webview (default): Enables the default WebView framework on the platform. This must be enabled
    for the crate to work. This feature was added in preparation of other ports like cef and servo.
  • x11 (default): Enables x11 support and dependencies on Linux.
  • serde: Enables dpi's serde feature.
  • devtools: Enables devtools on release builds. Devtools are always enabled in debug builds.
    On macOS, enabling devtools, requires calling private APIs so you should not enable this flag in release
    build if your app needs to publish to App Store.
  • mac-proxy: Enables WebViewBuilder::with_proxy_config on macOS.
  • linux-body: Enables body support of custom protocol request on Linux. Requires
    WebKit2GTK v2.40 or above.
  • tracing: enables tracing for evaluate_script, ipc_handler, and custom_protocols.

Partners

For the complete list of sponsors please visit our website and Open Collective.

License

Apache-2.0/MIT


File: CHANGELOG.md

Changelog

[0.57.0]

[0.56.1]

  • 62080fa (#1811 by @gimenete) On Android, cache the asset-loader setting in RustWebViewClient so intercepted requests avoid repeated JNI calls into Rust state.
  • a5612a8 (#1812 by @Legend-Master) On Android, removed unused withAssetLoader binding and assetLoaderDomain can now return null.
  • 5ce72b0 (#1772 by @degant) Don't panic in the IPC handler when the webview's current document URL is not a valid http::Uri (for example a file:// URL, or one containing a raw space or non-ASCII characters). Such invalid IPC requests are now logged (under the tracing feature) and dropped instead of aborting the process, matching the existing behavior of the WKWebView backend.
  • b95a7f8 (#1799 by @Legend-Master) On Windows, ignore set webview focus error on create as it fails if the hosting window is minimized.
  • aff28ef (#1781 by @FabianLars) On macOS in debug mode, don't register requestMediaCapturePermissionForOrigin:initiatedByFrame:type:decisionHandler: delegate method on macOS 11 or older to prevent a debug_assertion startup panic.
  • be729e3 (#1804 by @velocitysystems) Override getDefaultVideoPoster() on Android to return a transparent bitmap instead of null, preventing Chromium from painting its default gray play-button placeholder on <video> elements.
  • 3fbf592 (#1795 by @qwerfunch) Fix a Windows crash when the WebView2 parent subclass is re-entered after its controller reference data is cleared during teardown.

\[0.56.0]

  • affbb3c (#1720) Updated Android lifecycle JNI calls in WryActivity for Tao 0.36's renames:

    • create to onFirstActivityCreate
    • onActivityCreate to onCreate
    • start to onStart
    • resume to onResume
    • pause to onPause
    • stop to onStop
    • Removed onActivitySaveInstanceState
    • onActivityDestroy to onDestroy
    • onActivityLowMemory to onLowMemory

    onLowMemory no longer takes any parameters.
    onFirstActivityCreate no longer takes any parameters.

    and also emitting them as window-specific events.

  • 145b36f (#1736) Remove Send, Sync bounds from NewWindowOpener.

  • 871497a (#1748) Add back/forward navigation APIs (go_back, go_forward, can_go_back, and can_go_forward) to WebView.

  • fe52ff9 (#1715) On Android, release REQUEST_HANDLER mutex sooner by cloning the underlying Send + Sync handler.

  • 9d0a9fe (#1712) On Windows, Add WebViewExtWindows::hwnd getter to access the child HWND containing the webview.

  • 4ee8c38 (#1779) Enable WebView element fullscreen support on macOS 12.3+ and iOS 15.4+ without using private APIs.

  • 5bdda32 (#1719) On macOS, avoid an extra copy for owned custom protocol response bodies by transferring the body buffer into NSData.

  • 6ef93b3 (#1737) On macOS, updated objc2-* dependencies to 0.3.2

  • 9f9a237 (#1654) Add an expanded permission handling API for WebView2, WKWebView, WebKitGTK, and Android.
    This includes:

    • PermissionKind expansion: DisplayCapture, Midi, Sensors, MediaKeySystemAccess, LocalFonts, WindowManagement, PointerLock, AutomaticDownloads, FileSystemAccess, Autoplay.
    • Support for PermissionResponse::Prompt to trigger native system dialogs.
    • Android support via JNI bridge (onPermissionRequest in RustWebChromeClient).
    • macOS: Split camera/microphone requests; CameraAndMicrophone resolved from individual responses.
    • Linux: DisplayCapture detection for WebKitGTK < 2.42 (getDisplayMedia fix).
    • Windows: Full coverage of all 12 COREWEBVIEW2_PERMISSION_KIND values.
  • bd1decc (#1780) Breaking Change: Removed the macOS/iOS specific transparent and fullscreen feature flags. The functionalities are now always enabled. Please reach out immediatly if you see issues in the App Store submission process.

  • d29cd57 (#1787) Removed protocol feature, previously gated WebViewBuilder::with_custom_protocol, WebViewBuilder::with_asynchronous_custom_protocol and WebViewBuilder::with_asset_loader are now always available

  • 86ac6e8 (#1732) Updated dom_query dependency to 0.28.0

  • 10fdf73 (#1738) On Windows, add WebViewBuilderExtWindows::with_profile_name to opt the webview into a named WebView2 profile. Webviews with different profile names within the same environment have isolated cookies, storage, IndexedDB, and cache while sharing the runtime โ€” matching WebView2's documented multi-profile pattern.

\[0.55.1]

\[0.55.0]

  • a535fd9 (#1699 by @FabianLars) On Android, fixed panics on custom protocol timeouts. Increased timeout for non-internal requests to 30 seconds.
  • 781f371 (#1633 by @lucasfernog) Update to latest tao to support multi-window on Android and iOS.
  • 848aff7 (#1660 by @Legend-Master) Run new_window_req_handler on main thread and remove the Send + Sync restriction on it
  • 92114b2 (#1634 by @lucasfernog) Call onNewIntent for tao's 0.35 Opened event.
  • 05440b8 (#1688 by @Legend-Master) Removed drag-drop feature, previously gated WebViewAttributes::drag_drop_handler and WebViewBuilder::with_drag_drop_handler are now always available
  • 222c63d (#1698 by @FabianLars) Remove WebViewAttributes, WebView::new and WebView::new_as_child from public API. Use WebViewBuilder instead.

\[0.54.4]

  • 47d9470 (#1693 by @Legend-Master) Updated dependency dom_query to 0.27.0, this fixed a bug where initialization scripts were escaped incorrectly on Android
  • 1540788 (#1692 by @Sbenazar) fix(webkitgtk): normalize background color values to 0.0โ€“1.0

\[0.54.3]

  • 40a7032 (#1677 by @russellmcc) Fix bug where wry would crash when loaded by multiple dylibs in the same process on macOS.

Dependencies

enhance

bug

\[0.54.2]

  • 1d1b870 (#1662 by @JSKitty) On macOS, implement background_color support for WKWebView behind the transparent feature. Disables the default white background via the drawsBackground KVC key at init and applies underPageBackgroundColor on macOS 12+ for both initial creation and runtime set_background_color calls.
  • e3761e5 (#1668 by @zeta-gundam) Fixed an issue that caused "Symbol not found: _NSHTTPCookieSameSite..." panics on macOS 10.13 & 10.14.
  • e3761e5 (#1668 by @zeta-gundam) Fixed an issue that caused "[<WKWebViewConfiguration 0x6000003f4d00> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key drawsBackground." panics on macOS 10.13

\[0.54.1]

\[0.54.0]

  • 5fdd1a9 (#1625) Use OnBackPressedCallback instead of the deprecated onKeyDown for back navigation on Android.

  • 51d06d0 (#1646) Remove redundant clones in WebView and download handling. No user facing changes.

  • 7b77322 (#1647) Fix clippy io_other_error. No user facing changes.

  • ff8876d (#1652) Improve wkwebview performance. No user-facing changes.

  • 27ba73f Add handler for web content process termination.

  • 4fcff14 (#1547) Set WebsiteDataManagerBuilder::base_cache_directory with the same path as base_data_directory.

    This change allows the cache directory to be changed instead of using the default one from WebKitGTK.

  • 64d9296 (#1640) Update webkit2gtk-rs crates to 2.0.2.

\[0.53.5]

  • #1622 Fixed an issue that caused docs.rs builds to fail. No user facing changes.

\[0.53.4]

  • 093856a (#1622 by @lucasfernog) Add flag to opt out of automatic back navigation handling on Android via WryActivity#handleBackNavigation.
  • 0f51d67 (#1605 by @dgerhardt) On Linux, removed a workaround which forced inital requests for multiple webviews to be handled sequentially.
    The workaround was intended to fix a concurrency bug with loading multiple URIs at the same time on WebKitGTK.
    But it prevented parallelization and could cause a deadlock in certain situations.
    It is no longer needed with newer WebKitGTK versions.

\[0.53.3]

\[0.53.2]

  • 1743e7f (#1608 by @lucasfernog) Fix new_window_req_handler craashing when creating new window for webview that has a custom data_store_identifier.

\[0.53.1]

\[0.53.0]

  • 1456f8e (#1602 by @FabianLars) Enabled all downloads by default to match WebView2 and browser behavior on all platforms. To disable this, provide a custom download_started_handler.
  • 43e78ff (#1588 by @zphrs) Add WebViewBuilder::with_limit_navigations_to_app_bound_domains only on iOS.
    Function is a no-op if iOS version is less than iOS 14.
  • 60dba38 (#1569 by @WSH032) Add WebView::set_cookie and WebView::delete_cookie APIs.
  • 88cbb01 (#1561 by @dgerhardt) On Linux, fix a deadlock, which could occur when destroying a WebView before loading has finished.
  • eb562ca (#1596 by @lucasfernog) Do not fire new_window_req_handler on navigation events on macOS and iOS.
  • 78634b3 (#1594 by @FabianLars) On Linux, macOS and iOS, the download_started_handler will now get the correct suggested destination path.
  • 5399823 (#1600 by @lucasfernog) Fixes new_window_req_handler not creating the webview on Linux when executing window.open().
  • eb562ca (#1596 by @lucasfernog) Fixes new_window_req_handler not fired on macOS when executing window.open().
  • 3f978d3 (#1601 by @lucasfernog) Refactor WebViewBuilder::with_new_window_req_handler to allow creating the webview manually.
  • 3f978d3 (#1601 by @lucasfernog) Disable new window creation by default on Windows to match behavior of other platforms. Use WebViewBuilder::with_new_window_req_handler to enable.

\[0.52.1]

\[0.52.0]

  • 5e6b0e6 (#1555 by @FabianLars) Added iOS support for set_background_color.
  • 99dab51 (#1570 by @renovate) Updated webview2-com to 0.38.
  • 41f4a3a (#1572 by @FabianLars) On Windows on systems running WebView2 v137+ wry now uses a new default background color API which should reduce white flashes. The use of the RemoveRedirectionBitmap browser flag (v134+) was removed due to crashes on Insider builds.
  • eb40ac8 (#1528 by @aurelj) Added x11 feature flag (enabled by default).

breaking

  • 1567635 (#1558 by @amrbashir) Rename WebViewBuilder methods for consistency and clarity:

    • Renamed WebViewBuilder::with_web_context to WebViewBuilder::new_with_web_context
    • Renamed WebViewBuilder::with_attributes to WebViewBuilder::new_with_attributes
  • f868658 (#1556 by @Legend-Master) WebContext::is_custom_protocol_registered now takes &str instead of String

\[0.51.2]

  • f7781a7 (#1544 by @lucasfernog) Allow modifying or removing the input accessory view on iOS via WebViewBuilderExtIos::with_input_accessory_view_builder.

\[0.51.1]

\[0.51.0]

feat

  • ecbced2 (#1534 by @Simon-Laux) macOS/iOS: add option to disable link previews when building a webview (the webkit API has it enabled by default)

    • WebViewBuilderExtDarwin.with_allow_link_preview(bool)

\[0.50.5]

enhance

bug

  • 4f4ade3 (#1520 by @lucasfernog) Fix crash setting macOS traffic light buttons inset when window is undecorated or buttons have been removed.

\[0.50.4]

  • 349dfe3 (#1512 by @Simon-Laux) Added WebViewExtDarwin to expose WebView functions available to both macOS and iOS.
  • 349dfe3 (#1512 by @Simon-Laux) fix: crash when using WebViewBuilderExtDarwin.with_data_store_identifier
  • 349dfe3 (#1512 by @Simon-Laux) feat: macOS: add WebViewExtDarwin::fetch_data_store_identifiers and WebViewExtDarwin::remove_data_store.
  • d0b16a7 (#1491 by @neilmcguire) On Windows, Add support for iframe requests in custom protocols. Requires WebView2 1.0.2365.46 or higher.
  • 148d7cd (#1513 by @FabianLars) Wry by default now passes --enable-features=RemoveRedirectionBitmap to WebView2 to hide the initial white flash of newly created webviews. Only takes effect on WebView2 Runtime versions 134 and above.

\[0.50.3]

\[0.50.2]

\[0.50.1]

\[0.50.0]

\[0.49.0]

enhance

  • 0185644 (#1452 by @mzdk100) Allow the use of TAB to cycle through focus elements in an HTML document.

\[0.48.1]

  • cbbcccc (#1446 by @FabianLars) Add functionality to set the traffic light inset on macOS. This is required to prevent flickers if the WebView is injected via build() instead of build_as_child().

enhance

\[0.48.0]

\[0.47.2]

\[0.47.1]

\[0.47.0]

  • 7221256 (#1365 by @Norbiros) Add WebViewBuilder::with_initialization_script_for_main_only to enable injecting JavaScript code into main frame only or all subframes.
  • c1b26b9 (#1394 by @amrbashir) Add WebView::cookies and WebView::cookies_for_url APIs.
  • c193e2a (#1408 by @amrbashir) Fix DragDropEvent::Drop event never fired on Wayland (and sometimes on X11).
  • 1d63fa3 (#1403 by @SpikeHD) Add WebViewBuilder::with_extension_path API to Windows and Linux.
  • 0c192f4 (#1414 by @lucasfernog) Fix Android static handlers not being replaced when the application UI is relaunched while still running in the foreground.
  • 9a2a2d4 (#1412 by @amrbashir) Fix icons of dragged items getting stuck when using WebViewBuilder::with_drag_drop_handler on some distros like Gnome.
  • fa9875b (#1409 by @amrbashir) On Windows, disable Webview2's file drop when using WebViewBuilder::with_drag_drop_handler which fix drag events for files from "Recent files" view.
  • 6007608 (#1400 by @amrbashir) On Windows, fix webview slightly larger than the window inner size, which resulted in a hidden 1px in the right and bottom borders of the webview

\[0.46.3]

\[0.46.2]

\[0.46.1]

bug

\[0.46.0]

  • 8cc2a7f (#1384 by @amrbashir) This release contains quite the breaking changes, because even though [email protected], ignored duplicate custom protocols, On Linux when using a shared web context, the custom protocol handler can only be registered once so we are bringing the duplicate custom protocols on Linux again, Windows and macOS are not affected. If using a shared web context, make sure to register a protocol only once on Linux (other platforms should be registed multiple times), use WebContext::is_custom_protocol_registered with #[cfg(target_os = "linux")].

    We also noticed that it is hard to know which webview made a request to the custom protocol so we added a method to attach an ID to a webview, and changed relevant custom protocol APIs to take a new argument that passes the specified id back to protocol handler.

    We also made a few changes to the builder, specifically WebViewBuilder::new and WebViewBuilder::build methods to make them more ergonomic to work with.

    • Added Error::DuplicateCustomProtocol enum variant.
    • Added Error::ContextDuplicateCustomProtocol enum variant.
    • On Linux, return an error in WebViewBuilder::build if registering a custom protocol multiple times.
    • Added WebContext::is_custom_protocol_registered to check if a protocol has been regsterd for this web context.
    • Added WebViewId alias type.
    • Breaking Changed WebViewAttributes to have a lifetime parameter.
    • Added WebViewAttributes.id field to specify an id for the webview.
    • Added WebViewBuilder::with_id method to specify an id for the webview.
    • Added WebViewAttributes.context field to specify a shared context for the webview.
    • Breaking Changed WebViewAttributes.custom_protocols field,WebViewBuilder::with_custom_protocol method and WebViewBuilder::with_asynchronous_custom_protocol method handler function to take WebViewId as the first argument to check which webview made the request to the protocol.
    • Breaking Changed WebViewBuilder::with_web_context to be a static method to create a builder with a webcontext, instead of it being a setter method. It is now an alternative to WebviewBuilder::new
    • Added WebViewBuilder::with_attributes to create a webview builder with provided attributes.
    • Breaking Changed WebViewBuilder::new to take no arguments.
    • Breaking Changed WebViewBuilder::build method to take a reference to a window to create the webview in it.
    • Breaking Removed WebViewBuilder::new_as_child.
    • Added WebViewBuilder::build_as_child method, which takes a reference to a window to create the webview in it.
    • Breaking Removed WebViewBuilderExtUnix::new_gtk.
    • Added WebViewBuilderExtUnix::build_gtk.
  • 0abc221 (#1316 by @pewsheen) Migrate to obj2.

  • b01eac3 (#1386 by @lucasfernog) Use unescaped Android package identifier for the proguard rules.

\[0.45.0]

\[0.44.1]

\[0.44.0]

  • b863d38 (#1356 by @SpikeHD) Expose ability to enable browser extensions in WebView2
  • 9220793 (#1361 by @amrbashir) Ignore duplicate custom protocols in WebviewBuilder::with_custom_protocol and WebviewBuilder::with_async_custom_protocol and use the last registered one.
  • 9220793 (#1361 by @amrbashir) Removed Error::DuplicateCustomProtocol variant.
  • 5915341 (#1354 by @millermk) Fixes Android webview error page flashing when a redirect to the app is performed.
  • 170095b (#1360 by @Steve-xmh) Fix web resource loading in android binding by skip duplicate Content-Type/Content-Length headers.
  • 5915341 (#1354 by @millermk) Fix navigation error handling to trigger custom protocol on Android.

\[0.43.1]

\[0.43.0]

  • 7b1c26a (#1344 by @Themayu) Windows: Implement WebViewBuilderExtWindows::with_scroll_bar_style to allow opting into Fluent Overlay style scrollbars.
  • 98d1a83 (#1326 by @ollpu) Fix Linux IPC handler and initialization scripts when sharing a WebContext between multiple WebViews.

\[0.42.0]

  • 556a359 (#1301 by @pewsheen) On macOS, emit an error when the URL scheme registration fails.
  • 19d83d7 (#1332 by @lucasfernog) Fixes a crash on the Android custom protocol handler when the request URL is invalid.
  • 38abcb9 (#1340 by @lucasfernog) Fixes custom protocols not triggered on Android on external redirects.
  • d1f1e7e (#1299 by @kanatapple) Fix Webview::bounds returning logical values where it should have been physical.
  • 03cdf93 (#1311 by @bukowa) Handle webkit2gtk close signal (when window.close is called from js)
  • 68413e8 (#1296 by @MarijnS95) Breaking change: Upgrade ndk crate to 0.9 and delete unused ndk-sys and ndk-context dependencies. Types from the ndk crate are used in public API surface.
    Breaking change: The public android_setup() function now takes &ThreadLooper instead of &ForeignLooper, signifying that the setup function must be called on the thread where the looper is attached (and the JNIEnv argument is already thread-local as well).
  • 39fc82c (#1306 by @Legend-Master) Support WebView2 version older than 101.0.1210.39 and document incognito and theme will not work for versions before it
  • 5231a37 (#1322 by @Legend-Master) Support WebView2 version older than 86.0.616.0 and document version requirements for back_forward_navigation_gestures, with_user_agent, with_hotkeys_zoom, with_browser_accelerator_keys
  • a23a28d (#1341 by @amrbashir) Updated windows to 0.58.

\[0.41.0]

\[0.40.1]

  • b6863ed(#1275) On Android, set RustWebViewClient.currentUrl field early in onPageStarted method instead of onPageFinished
  • f089964(#1276) Fixes with_asynchronous_custom_protocol crashing when sending the response on Linux.
  • 637289d(#1272) On Android, make WryActivity.setWebview method public to prevent JNI crashes.

\[0.40.0]

  • a424a0b(#1270) On Windows, fix child webview invisible after creation because it was created with 0,0 size
  • d6f8dd7(#1271) On Windows, create child webview at the top of z-order to align with other platforms.
  • 03d2535(#1269) On macOS, disable initialization script injection into subframes.
  • 1e65049(#1267) On macOS, fixed a crash when sending empty body by IPC.
  • 0f3c886(#1260) On macOS, fixed an issue of not being able to listen to the cmd+key event in javascript in single WebView.
  • 0f14e2a(#1259) Default the margin when printing on MacOS to 0 so it is closer to the behavior of when printing on the web.
  • 0f14e2a(#1259) Add WebViewExtMacOS::print_with_options which allows to modify the margins that will be used on the print dialog.
  • f516122(#1262) On Windows, enable webview2 non client region support which allows using app-region CSS style.

\[0.39.5]

  • 4c88c66(#1247) Force the IPC and custom protocol tracing spans to have no parent.
  • 2d43d62(#1254) On Windows, fix webview having a bigger size than the actual window size after creation and until the window is resized.

\[0.39.4]

  • 8bbc2bf(#1237) Fix WebviewBuilder::with_transparent, WebviewBuilder::with_background_color, and Webview::set_background_color always failing and causing the webview to fail to load.
  • 130c469(#1238) Add WebViewBuilderExtDarwin::with_data_store_identifier.
  • 203604c(#1233) On Windows, fix the webview not filling up the whole window if the parent window was resized during the webview initialization.

\[0.39.3]

  • c7ca3db(#1221) On Windows, fix data directory created next to the executable with a gibberish name even if it was explicitly provided in WebConext::new

\[0.39.2]

  • 3e3d59c(#1215) On macOS, prevent NSExceptions and invalid memory access panics when dropping the WebView while custom protocols handlers may still be running.
  • ca6b5fb(#1224) Update windows crate to 0.56

\[0.39.1]

  • f0e82d3(#1217) Fix target detection on build script to enhance cross compiling capabilities.
  • ed9fa9b(#1210) On iOS, allows media plays inline.

\[0.39.0]

  • ddda455(#1207) Disable deprecated applicationCache web api. This api was completely removed upstream in webkitgtk 2.44.
  • d7031ae(#1206) On Windows, fix a crash due to a double-free when the host window is destroyed before the webview is dropped.
  • 34ae1ca(#1202) Add dpi module which is a re-export of dpi crate.
  • fdbd3d3(#1081) Update http dependency to 1
  • 34ae1ca(#1202) Breaking Change: Removed x, y, with and height fields from Rect struct and replaced it with size and position fields.
  • c033bd2(#1156) On macOS, fix menu keyboard shortcuts when added webview as child.

\[0.38.2]

\[0.38.1]

  • 7c9e71f(#1192) Fixes compilation failing on Windows with the tracing feature enabled.

\[0.38.0]

  • e6f0fbd(#1180) Fixes a null pointer exception when running window.ipc.postMessage(null) on Android.

  • 5789bf7(#1187) Breaking change: Refactored the file-drop handling on the webview for better representation of the actual drag and drop operation:

    • Renamed file-drop cargo feature flag to drag-drop.
    • Removed FileDropEvent enum and replaced with a new DragDropEvent enum.
    • Renamed WebViewAttributes::file_drop_handler field to WebViewAttributes::drag_drop_handler.
    • Renamed WebViewAttributes::with_file_drop_handler method to WebViewAttributes::with_drag_drop_handler.
  • b8fea39(#1183) Changed WebViewBuilder::with_ipc_handler closure to take http::Request instead of String so the request URL is available.

  • 3a2026b(#1182) Breaking changes: Changed a few methods on WebView type to return a Result:

    • Webview::url
    • Webview::zoom
    • Webview::load_url
    • Webview::load_url_with_headers
    • Webview::bounds
    • Webview::set_bounds
    • Webview::set_visible
    • WebviewExtWindows::set_theme
    • WebviewExtWindows::set_memory_usage_level
    • WebviewExtWindows::reparent
    • WebviewExtUnix::reparent
    • WebviewExtMacOS::reparent
  • e1e2e07(#1190) Update webview2-com crate to 0.29

  • e1e2e07(#1190) Update windows crate to 0.54

  • 00bc96d(#1179) Added WryActivity::onWebViewCreate(android.webkit.WebView) on Android.

\[0.37.0]

  • 8c86fba Breaking change: Removed data: url support, as its native support in Windows and macOS are buggy and unreliable, use Webview::with_html instead.

  • 8c86fba On Linux, decode FilDropEvent paths before emitting them to make it consistent across all platforms.

  • 8c86fba Added WebViewExtMacOS::reparent,WebViewExtWindows::reparent and WebViewExtUnix::reparent.

  • 8c86fba Revert global keys shortcuts (wry#1156)

  • 8c86fba Breaking change: Removed internal url parsing which had a few side-effects such as encoded url content, now it is up to the user to pass a valid URL as a string. This also came with a few breaking changes:

    • Removed Url struct re-export
    • Removed Error::UrlError variant.
    • Changed WebviewAttributes::url field type to String.
    • Changed WebviewBuilder::with_url and WebviewBuilder::with_url_and_headers return type to WebviewBuilder instead of Result<WebviewBuilder>.
    • Changed Webview::url getter to return a String instead of Url.

\[0.36.0]

  • 8646120(#1159) On android, fix no non-static method ".evalScript(ILjava/lang/String;)" when calling Window::eval.

  • 8646120(#1159) On macOS, fix a release build crashes with SEGV when calling WebView::evaluate_script. This crash bug was introduced at v0.35.2.

  • 8646120(#1159) Breaking change Update raw-window-handle crate to v0.6.

    • HasWindowHandle trait is required for window types instead of HasRawWindowHandle.
    • wry::raw_window_handle now re-exports v0.6.
  • 8646120(#1159) On macOS, fix menu keyboard shortcuts. This issue bug was introduced in v2 when added webview as child.

\[0.35.2]

  • 0ef041f(#1133) On Linux, apply passed webview bounds when using WebView::new_gtk or WebViewBuilder::new_gtk with gtk::Fixed widget. This allows to create multiple webviews inside gtk::Fixed in the same window.
  • 0ef041f(#1133) Added tracing spans for evaluate_script, ipc_handler and custom_protocols behind the tracing feature flag.

\[0.35.1]

  • a4a39b9(#1098) Fix the API documentation cannot be built on docs.rs.
  • e116d42(#1111) Fix screen share permissions dialog not showing up on macOS 14.0+
  • a8c0d38(#1097) Fix IPC crash on wkwebview if receiving invalid types.
  • 8fddbb6(#1091) Add WebView::bounds getter.
  • 30a85f3(#1122) On Windows, fix file drop handler.

\[0.35.0]

  • e61e7f8(#1090) Breaking change Consistently use WebView in API names. The following APIs were renamed:

    • WebviewExtWindows โ†’ WebViewExtWindows
    • WebviewExtUnix โ†’ WebViewExtUnix
    • WebviewExtMacOS โ†’ WebViewExtMacOS
    • WebviewExtIOS โ†’ WebViewExtIOS
    • WebviewExtAndroid โ†’ WebViewExtAndroid
    • WebviewUriLoader โ†’ WebViewUriLoader
  • e61e7f8(#1090) Add WebViewExtWindows::set_memory_usage_level API to set the memory usage target level on Windows. Setting 'Low' memory usage target level when an application is going to inactive can significantly reduce the memory consumption. Please read the guide for WebView2 for more details.

  • e61e7f8(#1090) - Add cfg_aliases for easier feature configuration. And add os-webview as default feature.

  • e61e7f8(#1090) Enhance initalization script implementation on Android supporting any kind of URL.

  • e61e7f8(#1090) Fix wkwebview crashed when received invalid UTF8 string from IPC.

  • e61e7f8(#1090) Refactor new method to take raw window handle instead. Following are APIs got affected:

    • application module is removed, and webivew module is moved to root module.
    • WebViewBuilder::new, WebView::new now take RawWindowHandle instead.
    • Add WebViewBuilder::new_as_child, WebView::new_as_child to crate a webview as a child inside a parent window.
    • Webview::inner_size is removed.
    • Add WebViewBuilderExtUnix trait to extend WebViewBuilder on Unix platforms.
    • Add new_gtk functions to WebViewBuilderExtUnix and WebviewExtUnix.
    • raw-window-handle crate is re-exported as wry::raw_window_handle.

    This also means that we removed tao as a dependency completely which required some changes to the public APIs and to the Android backend:

    • Webview attributes ipc_handler, file_drop_handler, document_change_handler don't take the Window as first parameter anymore.
      Users should use closure to capture the types they want to use.
    • Position field in FileDrop event is now a tuple of (x, y) physical position instead of PhysicalPosition. Users need to handle scale factor
    • We exposed the android_setup function that needs to be called once to setup necessary logic.
    • Previously the android_binding! had internal call to tao::android_binding but now that tao has been removed,
      the macro signature has changed and you now need to call tao::android_binding yourself, checkout the crate documentation for more information.

\[0.34.2]

  • c2e6980(#1047) Fix doc building by removing dox feature requirement from webkit2gtk.
  • 82908d4(#1045) Fix docs.rs build.

\[0.34.1]

  • 3de68e7(#1043) Fix compilation with the linux-body feature.

\[0.34.0]

  • ce95730(#1036) Upgrade gtk to 0.18 and bump MSRV to 1.70.0.
  • 591fda8(#1042) Use gtk's re-exported modules instead.
  • b22a19e(#1037) Update windows and windows-implement crate to 0.51

\[0.33.1]

  • 0582cdf(#1033) Fix documentation for macOS target not being generated on docs.rs.

\[0.33.0]

  • 5adf9da(#994) Breaking change Wry now defaults to http://<scheme>.localhost/ for custom protocols on Android.
  • 844d95a(#1023) Fixes async custom protocol resolver on Windows.
  • 5adf9da(#994) Add WebViewBuilderExtAndroid::with_https_scheme to be able to choose between http and https for custom protocols on Android.
  • c5c3731(#1024) Add winit-gtk to support winit feature flag on Linux.

\[0.32.0]

  • 4bdf1c3(#1017) Added WebViewBuilder::with_asynchronous_custom_protocol to allow implementing a protocol handler that resolves asynchronously.
  • 70d8ae0(#1009) Fixes Android freezing when handling request due to endless iteration when reading request headers.
  • b5e1875(#994) Breaking change Wry now defaults to http://<scheme>.localhost/ for custom protocols on Windows.
  • b5e1875(#994) Add WebViewBuilderExtWindows::with_https_scheme to be able to choose between http and https for custom protocols on Windows.
  • fa15076(#163) Add winit and tao feature flag with tao as default.
  • 4bdf1c3(#1017) Breaking change: WebViewBuidler::with_custom_protocol closure now returns http::Response instead of Result<http::Response>.
  • ebc4a20(#1015) Add WebViewAtrributes.focused and WebViewBuilder::with_focused to control whether to focus the webview upon creation or not. Supported on Windows and Linux only.

\[0.31.0]

  • e47562f(#993) Update the unmaintained kuchiki crate to the maintained kuchikiki crate.
  • 7a353c7(#980) Add WebViewBuilder::with_on_page_load_handler for providing a callback for handling various page loading events.
  • b0a08b1(#997) Update tao to version 0.22 which has removed the global-shortcut, menus and tray features, see [email protected] release.

\[0.30.0]

  • 17e04e2(#985) Make WebViewBuilder::with_navigation_handler apply to Android loadUrl calls.
  • 17e04e2(#985) Add support for WebViewBuilder::with_navigation_handler on Android.
  • 87b331a(#978) On Windows, avoid resizing the webview when the window gets minimized to avoid unnecessary resize event on JS side.
  • 17e04e2(#985) Update tao to 0.21.

\[0.29.0]

  • c09dd7b(#968) Remove ActionBar handling from wry. If you want to hide the action bar, hide it using the themes.xml file in your android project or inherit WryActivity class and use getSupportActionBar()?.hide() in the onCreate method.

  • 2b56bfa(#966) Add support for WebViewBuilder::with_html and WebViewAttributes.html on Android.

  • d2c1819(#969) On Linux, replace linux-header flag with linux-body flag. Request headers are enabled by default. Add request body on custom protocol but it's behind the flag.

  • f7dded4(#955) The bug was reported in tauri repo: https://github.com/tauri-apps/tauri/issues/5986

    With input method preedit disabled,fcitx can anchor at edit cursor position.
    the pre-edit text will not disappear,instead it shows in the fcitx selection window below the input area.

  • 2b56bfa(#966) Set base url and origin to null for WebViewBuilder::with_html and WebViewAttributes.html for consistency on all platforms.

\[0.28.3]

  • On iOS, fix panic at runtime due to setting webview ivar.
    • c9002c1 fix(macos): remove webview ivar in WryWebView (#943) on 2023-04-26

\[0.28.2]

  • Adjust cargo:rerun-if-changed instruction for Android files.
    • cc934fe refactor(build): adjust rerun-if-changed instruction for Android files (#940) on 2023-04-24

\[0.28.1]

  • Fix unresolved reference in kotlin files when building for android.
    • ed36c0b fix(android): fix unresolved reference in kotlin files (#932) on 2023-04-19
  • Support modifying user agent string on Android.
    • 4a320b0 feat(android): add support modifying user agent string (#933) on 2023-04-20
  • On Linux and macOS, add synthesized event for mouse backward and forward buttons.
    • 6ef820b feat: synthesize forward/backward mouse button on Linux and macOS (#900) on 2023-04-18

\[0.28.0]

  • Add Webview::clear_browsing_data method.
    • 5f0c9e4 feat: add Webview::clear_browsing_data (#915) on 2023-04-18
  • On Android, generate a proguard-wry.pro file that could be used to keep the necessary symbols for wry when using minification.
    • ced4c0b feat: generate proguard rule file for android (#927) on 2023-04-17
  • Update tao to 0.19
    • d560981 refactor: rename TauriActivity to WryActivity (#926) on 2023-04-17

\[0.27.3]

  • Adds a way to launch a WebView as incognito through a new API at WebViewBuilder named as with_incognito.
    • 8698836 feat: Add a way to launch WebViews as incognito WebView::as_incognito, closes #908 (#916) on 2023-04-06
  • On macOS and iOS, remove webcontext implementation since we don't actually use it. This also fix segfault if users drop webcontext early.
    • 3cc45cb Remove webcontext implementation on wkwebview (#922) on 2023-04-07
  • Use the new WKWebView inspectable property if available (iOS 16.4, macOS 13.3).
    • c3f7304 feat(macos): use WKWebView's inspectable property (#923) on 2023-04-08

\[0.27.2]

  • On Android, Add support for native back button navigation.
    • fc232a3 feat(android): add support for native back navigation (#918) on 2023-04-03
  • Fix WebView::url getter on Android.
    • 427cf92 Unify custom porotocol across Android/iOS (#546) on 2022-04-11
    • b89398a Publish New Versions (#547) on 2022-04-26
    • c22744a fix(android): use correct method signature (#917) on 2023-03-31
  • Add Webview attribute to enable/disable autoplay. Enabled by default.
    • 6a523cc feat: Add setting to enable autoplay (#913) on 2023-04-04
  • Fix the WebViewBuilder::with_url when the projet use mimalloc
    • c22744a fix(android): use correct method signature (#917) on 2023-03-31
  • Revert 51b49c54 which hid the webview when minimized on Windows.
    • f76568a fix(windows): Ignore resize event when minimizing frameless windows (#909) on 2023-03-24

\[0.27.1]

  • On Windows, Linux and macOS, add method evaluate_script_with_callback to execute javascipt with a callback.
    Evaluated result will be serialized into JSON string and pass to the callback.
    • 2647731 feat: support callback function in eval (#778) on 2023-03-23
  • On iOS, set webview scroll bounce default to NO.
    • 4d61cf1 fix(ios): set scroll bounce default to NO (#907) on 2023-03-20
  • Update the value returned on a None value of ClassDecl::new("WryDownloadDelegate", class!(NSObject))
    from UIViewController to WryDownloadDelegate.
    • 7795356 fix: WryDownloadDelegate call after first time on 2023-02-20
  • On Linux, disable system appearance for scrollbars.
    • 530a8b7 fix(linux): disable system appearance for scrollbars (#897) on 2023-03-08
  • On Windows and Linux, implement WebviewBuilder::with_back_forward_navigation_gestures and WebviewAttributes::back_forward_navigation_gestures to control swipe navigation. Disabled by default.
    • 15b4ddf feat(win&linux): implement the option to control gesture navigation (#896) on 2023-03-07

\[0.27.0]

  • Add function to dispatch closure with the Android context.
    • a9e186c feat(android): add function to dispatch closure to the Android context (#864) on 2023-02-06
  • On macOS, fix crash when getting dragging position.
    • a8f7cef Fix crash when getting drag position (#867) on 2023-02-04
  • On Android, wry can again load assets from the apk's asset folder via a custom protocol. This is set by WebViewBuilder's method with_asset_loader, which is exclusive to Android (by virtue of existing within WebViewBuilderExtAndroid).
    • 077eb3a fix(android): restore asset loading functionality to android (fix: #846) (#854) on 2023-02-07
  • Update webview2-com to 0.22 and windows-rs to 0.44 which bumps the MSRV of this crate on Windows to 1.64.
    • 496bfb5 chore(deps): update to windows-rs 0.44 and webview2-com 0.22 (#871) on 2023-02-06

\[0.26.0]

  • Added WebViewBuilderExtAndroid trait and with on_webview_created hook.
    • 08c0156 feat(android): add on_webview_created hook, expose find_class (#855) on 2023-01-30
  • Enable dox feature when building docs.
    • c6e53c6 Enable dox feature when building docs (#861) on 2023-01-31
  • Expose wry::webview::prelude::find_class function to find an Android class in the app project scope.
    • 08c0156 feat(android): add on_webview_created hook, expose find_class (#855) on 2023-01-30
  • Added WebviewExtIOS trait to access the WKWebView and userContentController references.
    • f546c44 feat(ios): add WebviewExtIOS (#859) on 2023-01-30

\[0.25.0]

  • Breaking Change: Bump webkit2gtk to 0.19. This will use webkit2gtk-4.1 as dependency from now on. Also Bump gtk version: 0.15 -> 0.16.
    • c5f3b36 Bump gtk version 0.15 -> 0.16 (#851) on 2023-01-26
  • Breaking Add position of the drop to FileDropEvent struct.
    • bce39e2 feat: add file drop position (#847) on 2023-01-17
  • On Android, fix the injection of intialization_scripts for devServers where the Content-Type header includes more information than just "text/plain".
    • 87216c7 fix: make the Content-Type check spec compliant (#844) on 2023-01-14

\[0.24.1]

  • Update tao to 0.16.0
    • a27a66b chore: update tao to 0.16.0 on 2023-01-11

\[0.24.0]

  • Changed env vars used when building for Android; changed WRY_ANDROID_REVERSED_DOMAIN to WRY_ANDROID_PACKAGE and WRY_ANDROID_APP_NAME_SNAKE_CASE to WRY_ANDROID_LIBRARY.
    • dfe6a5e refactor: improve android env vars naming (#829) on 2022-12-30
  • Fixes Android initialization scripts order.
    • 7f819c0 fix(android): initialization scripts order (#808) on 2022-12-12
  • Remove redundant .clone() calls and avoid unnecessary heap allocations.
    • 45f2b21 perf: remove redundant .clone() calls and avoid unnecessary heap allocations (#812) on 2022-12-14
  • Change return type of custom protocol handlers from Result<Response<Vec>> to Result<Response<Cow<'static, [u8]>>>. This allows the handlers to return static resources without heap allocations. This is effective when you embed some large files like bundled JavaScript source as &'static [u8] using include_bytes!.
    • ddd3461 perf: Change return type of custom protocol handler from Vec to Cow<'static, [u8]>, closes #796 (#797) on 2022-12-12
  • Ensures that the script passed to .with_initialization_script("here") is not empty.
  • Add APIs to process webview document title change.
    • 14a0ee3 feat: add document title changed handler, closes #804 (#825) on 2022-12-30
  • Evaluate scripts after the page load starts on Linux and macOS.
    • ca7c8e4 fix(unix): race condition on script eval (#815) on 2022-12-14
  • Improve panic error messages on the build script.
    • 5b9f21d feat: improve build script panic messages (#807) on 2022-12-12
  • Add WebViewBuilder::with_url_and_headers and WebView::load_url_with_headers to navigate to urls with headers.
    • 8ae93b9 feat: add headers when loading URLs, closes #816 (#826) on 2023-01-01
    • e246bd1 chore: update headers change file on 2023-01-01
  • Change class declare name from UIViewController to WryNavigationDelegate to avoid class name conflict on iOS.
    • fca42a0 fix(ios): navigation delegate class name conflict (#824) on 2022-12-27
  • Rerun build script if the WRY_ANDROID_KOTLIN_FILES_OUT_DIR directory changes.
    • 1cf92e2 feat(build): rerun if kotlin out directory changes (#839) on 2023-01-10
  • On Windows, Add WebviewBuilderExtWindows::with_theme and WebviewExtWindows::set_theme to change webview2 theme.

\[0.23.4]

  • Fixes Android initialization scripts order.
    • 800cc48 fix(android): initialization scripts order (#808) on 2022-12-12
  • Improve panic error messages on the build script.
    • 4ec7386 feat: improve build script panic messages (#807) on 2022-12-12

\[0.23.3]

  • Fix the beep sound on macOS

\[0.23.2]

  • On macOS, remove all custom keydown implementations. This will bring back keydown regression but should allow all accelerator working.
    • fee4bf2 Remove all keydown implementations (#798) on 2022-12-10
  • Suppress unused_variables warning reported only in release build.
    • 4e23c0f fix(macos): suppress unused_variables warning reported only in release build (#790) on 2022-12-07
  • Add WebViewBuilderExtWindows::with_browser_accelerator_keys method to allow disabling browser-specific accelerator keys enabled in WebView2 by default. When false is passed, it disables all accelerator keys that access features specific to a web browser. See the official WebView2 document for more details.
    • 6e622ff feat(windows): Allow disabling browser-specific accelerator keys (#792) on 2022-12-07

\[0.23.1]

  • Fixes usage of the linux-headers feature.
    • 64a72ff fix(wry): correctly use the linux-headers feature on 2022-12-05

\[0.23.0]

  • Properly parse the content type header for the android.webkit.WebResourceResponse mime type.
    • 1db5ea6 fix(android): properly parse content-type for response mime type (#772) on 2022-11-27
  • Change typo in WebViewBuilderExtWindows::with_additionl_browser_args. to WebViewBuilderExtWindows::with_additional_browser_args.
    • db1c290 fix(windows): Fix typo in method name of WebViewBuilderExtWindows (#781) on 2022-12-02
  • Add Webiew::load_url.
    • a2b9531 feat: add Webiew::navigate_to_url, closes #776 (#777) on 2022-11-30
  • Change the type of WebViewBuilderExtWindows::with_additional_browser_args argument from AsRef<str> to Into<String> to reduce extra allocation.
    • b0ff06a perf: reduce extra allocation at WebViewBuilderExtWindows::with_additional_browser_args argument (#783) on 2022-12-03
  • Validate custom protocol response status code on Android.
    • 7f585c7 feat(android): validate custom protocol response status code (#779) on 2022-11-30
  • [https://github.com/tauri-apps/wry/commit/04422bc1b579d9388ce03c2388b8f415dbc0747b] On macOS, revert content view to native NSView ([#782])(https://github.com/tauri-apps/wry/pull/782)

\[0.22.6]

  • Fixes usage of the linux-headers feature.
    • 14c5ae7 fix(wry): correctly use the linux-headers feature on 2022-12-05

\[0.22.5]

  • On macOS, fix arrow keys misprint text on textarea.
    • 3005e54 On macOS, fix arrow keys misprint texts (#769) on 2022-11-25

\[0.22.4]

  • On Linux, add linux-headers feature flag to fix version regression. The minimum webkit2gtk version remains v2.22.
    • cf447f6 On Linux, add header feature flag to fix version regression (#766) on 2022-11-24

\[0.22.3]

  • On macOS, fix keyinput missing by calling superclass methods.
    • e40e55a On macOS, fix keyinput missing by calling super class methods (#764) on 2022-11-21

\[0.22.2]

  • On macOS, add an API to enable or disable backward and forward navigation gestures.
    • 487dff0 Add the ability to navigate with swipe gesture (#757) on 2022-11-16
    • 1a0ec19 Update gesture change file to patch (#763) on 2022-11-21
  • On macOS, pass key event to menu if we have one on key press.
    • 2e5e138 On macOS, pass key event to menu on key press (#760) on 2022-11-21

\[0.22.1]

  • Fix WebViewBuilder::with_accept_first_mouse taking behavior of first initalized webview.
    • 0647c0e fix(macos): fix acceptFirstMouse for subsequent webviews, closes #751 (#752) on 2022-11-13
  • Fix download implementation on macOS older than 11.3.
    • e69ddc6 fix(macos): download breaking app on macOS older than 11.3, closes #755 (#756) on 2022-11-15
  • On macOS, remove webview from window's NSView before dropping.
    • 3d3ea80 On macOS, remove webview from window's NSView before dropping (#754) on 2022-11-14

\[0.22.0]

  • Added WebViewAttributes::with_accept_first_mouse method for macOS.
    • 2c23440 feat(macos): add accept_first_mouse option, closes #714 (#715) on 2022-10-04
  • Breaking change Custom protocol now takes Request and returns Response types from http crate.
    • 1510e45 refactor: use http crate primitives instead of a custom impl (#706) on 2022-09-29
  • Enabled devtools in debug mode by default.
    • fea0638 feat: enable devtools in debug mode by default (#741) on 2022-10-27
  • On Desktop, add download_started_handler and download_completed_handler. See blob_download and download_event example for their usages.
    • 3691c4f feat: Add download started and download completed callbacks (#530) on 2022-10-19
  • Fix double permission dialog on macOS 12+ and iOS 15+.
    • 8aa7d61 Fix: Remove extra soft prompt asking for media permission on every app launch in macOS (#694) on 2022-09-29
  • Focus webview when window starts moving or resizing on Windows to automatically close <select> dropdowns. Also notify webview2 whenever the window position/size changes which fixes the <select> dropdown position
    • a1001dd fix(windows): focus webview on WM_ENTERSIZEMOVE and call NotifyParentChanged on WM_WINDOWPOSCHANGED. (#695) on 2022-09-16
  • On Windows, hide the webview when the window is minimized to reduce memory and cpu usage.
    • 51b49c5 feat(webview2): hide the webview when the window is minimized (#702) on 2022-09-27
  • Internally return with error from custom protocol if an invalid uri was requseted such as wry:// which doesn't contain a host.
    • 818ce99 fix: don't panic on invalid uri (#712) on 2022-09-30
  • Support cross compiling ios on a non macos host.
  • On Linux, Improve custom protocol with http headers / method added to request, and status code / http headers added to response. This feature is 2.36 only, version below it will fallback to previous implementation.
    • 2944d91 feat(linux): add headers to URL scheme request (#721) on 2022-10-17
  • On macOS, add WKWebview as subview of existing NSView directly.
    • 008eca8 On macOS, add WKWebview as subview of existing NSView directly (#745) on 2022-11-07
  • Keypress on non-input element no longer triggers unsupported key feedback sound.
    • 51c7f12 fix(macos): do not trigger unsupported key feedback sound on keypress (#742) on 2022-10-30
  • Remove the IPC script message handler when the WebView is dropped on macOS.
    • 818ce99 fix: don't panic on invalid uri (#712) on 2022-09-30
  • Breaking change Removed http error variants from wry::Error and replaced with generic HttpError variant that can be used to convert http crate errors.
    • 1510e45 refactor: use http crate primitives instead of a custom impl (#706) on 2022-09-29
  • Disabled Microsoft SmartScreen by default on Windows.
    • a617c5b feat(webview2): disable smartscreen & allow disabling internal webview2 args, closes #704 (#705) on 2022-09-28
  • Add WebView::url to get the current url.
    • 38e49bd feat: add WebView::url() to access the current url (#732) on 2022-10-25
  • Breaking change Removed http module and replaced with re-export of http crate.
    • 1510e45 refactor: use http crate primitives instead of a custom impl (#706) on 2022-09-29
  • Add WebviewBuilderExtWindows::with_additionl_browser_args method to pass additional browser args to Webview2 On Windows. By default wry passes --disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection so if you use this method, you also need to disable these components by yourself if you want.
    • 683f866 feat(webview2): add method to pass additional args, closes #415 (#711) on 2022-09-29
  • On Windows, fix canonical reason for custom protocol response.
    • 9d5595c fix(webview2): set response reason correctly, closes #733 (#734) on 2022-10-24
  • On macOS, make the webview first responder.
    • e64ad21 fix(wkwebview): make webview first responder (#740) on 2022-10-28

\[0.21.1]

  • Fix transparency on Windows
    • e31cd0a fix: fix transparency on Windows, closes #692 on 2022-09-16

\[0.21.0]

  • Implement `` on Android.
    • bf39d9d feat(android): implement dialogs and permissions (#685) on 2022-09-05
  • Add WebviewExtAndroid::handle which can be used to execute some code using JNI context.
    • 2bfc6c3 feat(android): JNI execution handle (#689) on 2022-09-07
  • Enable JS alert, confirm, prompt on Android.
    • bf39d9d feat(android): implement dialogs and permissions (#685) on 2022-09-05
  • Prompt for permissions on Android when needed.
    • bf39d9d feat(android): implement dialogs and permissions (#685) on 2022-09-05
  • Implement webview_version on Android.
    • 9183de4 feat(android): implement webview_version (#687) on 2022-09-05
  • Enable storage, geolocation, media playback, window.open.
    • 9dfffcf feat(android): enable storage, geolocation, media playback, window.open (#684) on 2022-09-04
  • Improve Android initialization script implementation.
    • 1b26d60 feat(android): improve initialization scripts implementation (#670) on 2022-08-24
  • WRY will now generate the needed kotlin files at build time but you need to set WRY_ANDROID_REVERSED_DOMAIN, WRY_ANDROID_APP_NAME_SNAKE_CASE and WRY_ANDROID_KOTLIN_FILES_OUT_DIR env vars.
    • b478903 feat(android): generate kotlin files at build time (#671) on 2022-08-24
    • 103f255 chore: change bump to patch on 2022-08-25
  • Breaking change Removed WebView::focus.
    • f338df7 feat(windows): auto-focus the webview (#676) on 2022-08-27
  • Updated tao to 0.14
  • Allow setting the webview background color.
    • eb1b723 feat: allow setting webview bg color, closes #197 (#682) on 2022-09-05
  • Added the RustWebView class on Android.
    • b1e8560 feat(android): define WebView class in kotlin (#672) on 2022-08-24
  • Update the windows crate to the latest 0.39.0 release and webview2-com to 0.19.1 to match.
    • c7d7e1f Update windows to 0.39.0 and webview2-com to 0.19.1 to match (#679) on 2022-08-31
  • On Windows, automatically focus the webview when the window gains focus to match other platforms.
    • f338df7 feat(windows): auto-focus the webview (#676) on 2022-08-27

\[0.20.2]

  • Implement custom protocol on Android.
    • dc68289 feat(android): implement custom protocol (#656) on 2022-08-13
  • Implement WebView::eval on Android.
    • 690fd26 feat(android): implement eval (#658) on 2022-08-13
  • On iOS, add webview as subview instead of replacing original view.
    • 74391e0 fix(ios): addSubview instead of setContentView (#655) on 2022-08-13
  • Move WebView logic from tao to wry.
    • aba1ae5 refactor(android): move WebView logic from tao to wry (#659) on 2022-08-14

\[0.20.1]

  • Add android support
  • Enable private picture-in-picture on macos.
    • 3cfd8c9 fix: add feature flag to enable private picture-in-picture flag on macos (#645) on 2022-08-05
  • On macOS, fix devtool warning
    • 2eba8c9 fix: devtool warning by adding parent view

\[0.20.0]

  • Add WebViewBuilder::with_clipboard.
    • c798700 fix: Add WebViewBuilder::with_clipboard(#631) on 2022-07-05
  • Fix typos in several files.
  • Set webview2 language to match the OS language. This makes i18n functions like new Date().toLocaleStrin() behave correctly.
    • e9f04d7 fix: set system language to webview on windows, closes #442 (#640) on 2022-07-26
  • Update tao to 0.13.0.

\[0.19.0]

    • Automatically resize the webview on Windows to align with other platforms.
  • Breaking change: Removed WebView::resize
  • d7c9097 feat: auto resize webview on Windows (#628) on 2022-06-27
  • Implement new window requested handler
    • fa5456c feat: Implement new window requested event, closes #527 (#526) on 2022-06-19
  • Re-export url::Url.
  • Update tao to 0.12

\[0.18.3]

  • Update tao to 0.11

\[0.18.2]

  • Fix NSString can not be released.
    • 95ca52f fix: NSString isn't released (#604) on 2022-06-07

\[0.18.1]

  • Remove unused tray from doc features.
    • 5eecb00 Remove unused tray from doc features (#602) on 2022-05-31

\[0.18.0]

  • Remove trivial tray features.
    • a3fea48 Remove trivial tray features (#599) on 2022-05-31

\[0.17.0]

  • Add option to enable/disable zoom shortcuts for WebView2, disabled by default.
    • 494a110 WebView2: Enable/disable platform default zooming shortcuts, closes #569 (#574) on 2022-05-15
  • Prevent memory leak on macOS.
    • 16d1924 fix: prevent memory leak on macOS, closes #536 (#587) on 2022-05-20
  • Update the windows crate to the latest 0.37.0 release and webview2-com to 0.16.0 to match.

The #[implement] macro in windows-implement and the implement feature in windows depend on some const generic features which stabilized in rustc 1.61. The MSRV on Windows targets is effectively 1.61, but other targets do not require these features.

The webview2-com crate specifies rust-version = "1.61", so wry will inherit that MSRV and developers on Windows should get a clear error message telling them to update their toolchain when building wry or anything that depends on wry. Developers targeting other platforms should be able to continue using whatever toolchain they were using before.

  • 9d9d9d8 Update windows-rs to 0.37.0 and webview2-com to 0.16.0 to match (#592) on 2022-05-23

\[0.16.2]

  • Fixed build on macos.

\[0.16.1]

  • Fixes a crash on macOS below Big Sur due to titlebarSeparatorStyle (11+ API) usage.
    • eb2dddb fix(macos): only use APIs when supported on 2022-05-08
  • Only run WebView::print on macOS on v11+. This prevents a crash on older versions.
    • eb2dddb fix(macos): only use APIs when supported on 2022-05-08

\[0.16.0]

  • Fixes a typo in the WebviewExtMacOS conditional compilation.
    • 10d7f03 fix(macos): typo in the WebviewExtMacOS conditional compilation (#568) on 2022-05-02
  • Fixes a crash when the custom protocol response is empty on macOS.
    • 67809f4 fix(macos): crash when custom protocol response is empty (#567) on 2022-05-01
  • Add WebView::zoom method.
    • 34b6cbc feat: add feature to zoom webview contents, closes #388 (#564) on 2022-05-02
  • Set the titlebar separator style in macOS to none.
    • 9776fc4 fix(macos): set titlebar style to none (#566) on 2022-05-01
  • Disable webview2 mini menu
    • ed0b223 fix: disable WebView2 mini menu ("OOUI"), closes #535 (#559) on 2022-04-29

\[0.15.1]

  • Update how android handles url
    • 427cf92 Unify custom protocol across Android/iOS (#546) on 2022-04-11
  • Add devtools support on Android/iOS.
    • 1c5d77a Add devtools support on Android/iOS (#548) on 2022-04-11
  • Fix to reset process on MacOS when webview is closed, closes #536.
    • fd1dcc3 fix: reset background process when webview is closed, closes #536 (#556) on 2022-04-24

\[0.15.0]

  • On Windows and Linux, disable resizing maximized borderless windows.
    • 313eaea fix(win,linux): disable resizing maximized borderless windows (#533) on 2022-03-30
  • Fixes a memory leak on the custom protocol response body on macOS.
    • 36b985e fix(macos): custom protocol memory leak (#539) on 2022-04-03
  • Update tao to v0.8.0.
    • 1c540b0 feat: update tao to 0.8, refactor tray features (#541) on 2022-04-07
  • The tray and ayatana-tray Cargo features are not enabled by default.
    • 1c540b0 feat: update tao to 0.8, refactor tray features (#541) on 2022-04-07
  • Breaking change: Renamed the ayatana Cargo feature to ayatana-tray and added the gtk-tray feature. The default tray on Linux is now libayatana-appindicator.
    • 1c540b0 feat: update tao to 0.8, refactor tray features (#541) on 2022-04-07

\[0.14.0]

  • Added close_devtools function to Webview.
    • bf3b710 feat: add function to close the devtool and check if it is opened (#529) on 2022-03-28
  • Hide the devtool functions behind the any(debug_assertions, feature = "devtools") flag.
    • bf3b710 feat: add function to close the devtool and check if it is opened (#529) on 2022-03-28
  • Breaking change: Renamed the devtool function to open_devtools.
    • bf3b710 feat: add function to close the devtool and check if it is opened (#529) on 2022-03-28
  • Enable tab navigation on macOS.
    • 28ebedc fix(macOS): enable tab navigation on all elements, fixes #406 (#512) on 2022-03-03
  • Added is_devtools_open function to Webview.
    • bf3b710 feat: add function to close the devtool and check if it is opened (#529) on 2022-03-28
    • Expose methods to access the underlying native handles of the webview.
  • Breaking change: WebviewExtWindows::controller now returns the controller directly and not wrapped in an Option
  • e54afec feat: expose webview native handles, closes #495 (#513) on 2022-03-03
  • Add navigation handler to decide if an url is allowed to navigate.
    • aa8af02 feat: Implement navigation event and cancellation, closes #456 (#519) on 2022-03-18
  • Breaking change: Renamed the devtool feature to devtools.
    • bf3b710 feat: add function to close the devtool and check if it is opened (#529) on 2022-03-28
  • Breaking change: Renamed the with_dev_tool function to with_devtools.
    • bf3b710 feat: add function to close the devtool and check if it is opened (#529) on 2022-03-28

\[0.13.3]

  • Fix rustdoc generation of Windows and Mac on docs.rs.
    • 327a019 Fix rustdoc generation of Windows and Mac on docs.rs, fix #503 (#507) on 2022-02-27

\[0.13.2]

  • Fix cross compilation from macOS.
    • c97499f fix: cross compilation from macOS (#498) on 2022-02-15
  • Update webview2-com to 0.13.0, which bumps the WebView2 SDK to 1.0.1108.44 and improves cross-compilation support.

Targeting *-pc-windows-gnu works now, but it has some limitations.

  • 24a443c Add /.changes/webview2-com-0.13.0.md on 2022-02-14

\[0.13.1]

  • Add devtool feature flag and configuration option.

  • Update the webview2-com crate 0.11.0:

  • Fix silent build script errors related to unconfigured nuget in https://github.com/wravery/webview2-rs/pull/4

  • Update the WebView2 SDK (not the runtime, just the API bindings) to the latest 1.0.1072.54 version

  • 7d4eeb7 Update webview2-com to 0.11.0 (#488) on 2022-02-06

\[0.13.0]

  • Update gtk to 0.15
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Add clipboard field in WebViewAttributes.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Ignore transparency on Windows 7 to prevent application crash.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Remove clipboard property for consistency across platforms.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Enable cookie persistence on Linux if the data_directory is provided.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Enable objc's exception features so they can be treated as panic message.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Add inner size method for webview. This can reflect correct size of webview on macOS.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Add "transparent" and "fullscreen" feature flags on macOS to toggle private API.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Implement WebContextImpl on mac to extend several callback lifetimes.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • The only thing that private mod shared does is re-export http mod to public,
    we can just pub mod http.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
    • Fix hovering over an edge of undecorated window on Linux won't change cursor.
  • Undecorated window can be resized using touch on Linux.
  • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Update webkit2gtk to 0.15
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Add with_user_agent(&str) to WebViewBuilder.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Replace all of the winapi crate references with the windows crate, and replace webview2 and webview2-sys with webview2-com and webview2-com-sys built with the windows crate. The replacement bindings are in the webview2-com-sys crate, with pub use in the webview2-com crate. They can be shared with TAO.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Fix null pointer crash on get_content of web resource request. This is a temporary fix.
    We will switch it back once upstream is updated.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Update the windows crate to 0.25.0, which comes with pre-built libraries. WRY and Tao can both reference the same types directly from the windows crate instead of sharing bindings in webview2-com-sys.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Update the windows crate to 0.29.0 and webview2-com to 0.9.0.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05
  • Update the windows crate to 0.30.0 and webview2-com to 0.10.0.
    • 219d20c Merge next back to dev branch (#477) on 2022-02-05

\[0.12.2]

  • Fixed a Linux multi-window issue where the internal url loader didn't unlock when flushed while empty

    • 5377821 Fix async multiwindow deadlock (#382) on 2021-08-16
  • The custom protocol now returns a Request and expects a Response.

  • This allows us to get the complete request from the Webview. (Method, GET, POST, PUT etc..)
    Read the complete header.

  • And allow us to be more flexible in the future without bringing breaking changes.

  • d202573 refactor: Custom protocol request/response (#387) on 2021-08-22

  • On Linux, automation callbacks now use the first created webview as the return value

    • f9d7049 Use the first created webview for webkit2gtk automation callbacks (#383) on 2021-08-16

\[0.12.1]

  • Add html attributes as another method to load the page. This can provide some other origin header and make CORS request
    possible.
    • 02ad372 feat: html string attributes (#368) on 2021-08-12
  • Shorter protocol name on Windows. This can make origin be shorter too.
    • 2d9f5c9 Shorter protocol name on Windows (#367) on 2021-08-12

\[0.12.0]

  • Custom Protocol handlers no longer take a &Window parameter.
    • 0e2574c Remove &Window parameter from Custom Protocol handlers (#361) on 2021-07-28
  • Update gtk to version 0.14. This also remove requirement of clang.
    • 251a80b Update gtk to version 0.14 (#364) on 2021-08-06
  • Update tao to v0.5. Please see release notes on tao for more information.
  • Add flags to support all other possible unix systems.
    • c0d0a78 Add flags to support all other unix systems. (#352) on 2021-07-21
  • Support having multiple webkit2gtk WebViews on a single WebContext.
    • 3f03d6b Support multiple webviews on a single WebContext (webkit2gtk) (#359) on 2021-07-28
  • On Windows, Fix cursor flickering when Tao window is without decorations
    • e28bcce fix(windows): fix mouse style flicker when decorations: false (#350) on 2021-07-20
  • Remove winrt support since it's outdated for a long time. We will reimplement it again once windws-rs is stable!
    • c37973e chore(windows): remove winrt support (#356) on 2021-07-24

\[0.11.0]

  • Allow resizing of borderless window on Windows
    • bd10b8e feat(Windows): resize borderless window (#333) on 2021-07-15
  • Mark enums as #[non_exhaustive] to prevent breaking changes on enum update.
    • f07ae14 refactor: add #[non_exhaustive] attributes to enums (#304) on 2021-07-08
  • Bump tao to 0.4. Please refer to tao changelog for more details.
    • 6eb10d4 bump tao to 0.4 and fix examples (#329) on 2021-07-14
    • Add focus method to Webview
  • Add WebviewExtWindows trait with controller method
  • 621ed1f feat: add .focus() to Webview (#325) on 2021-07-05
  • 96b7b94 Add controller method instead (#326) on 2021-07-07
  • macOS: Remove handler in the webview as it should be handled with the menu.
    • 5a9df15 fix(macos): Remove keypress handler in the webview for copy/paste/cut (#328) on 2021-07-07
  • Fixes multiple custom protocols registration on Windows.
    • 923d346 fix(windows): multiple custom protocols, closes #323 (#324) on 2021-07-02

\[0.10.3]

  • #315 fixed Webview2 runtime performance issues.
    • d3c9b16 Fix Webview2 runtime performance issues (#316) on 2021-06-29

\[0.10.2]

  • Fix file explorer getting blocked by automation.
    • 0c5cdd8 Fix file explorer getting blocked by automation (#310) on 2021-06-23

\[0.10.1]

  • WebContext::set_allows_automation is now available to specify if the context should allow automation (e.g. WebDriver).
    It is only enforced on Linux, but may expand platforms in the future.
    • 4ad0bf1 move set_allows_automation to WebContext method (#302) on 2021-06-21

\[0.10.0]

  • Add WebViewAttributes
  • Add with_web_context method that can work well with builder pattern.
    • 48f53a3 Add with_web_context method (#292) on 2021-06-13
  • Change the custom protocol handler on macOS so it returns a response on error and a status code on success.
    • 6b869b1 fix(macos): custom protocol response with status code + error response (#279) on 2021-05-20
  • Update signature of custom protocol closure. It should return a mime type string now.
    • cc9fc4b Add mimetype to return type of custom protocol (#296) on 2021-06-13
  • Fix webview creation when using new_any_thread of event loop.
    • 4d62cf5 Fix webview creation when using new_any_thread on Windows (#298) on 2021-06-18
  • Remove Dispatcher, dispatch_script and dispatcher in the webview module and add a js parameter to evaluate_script.
    • de4a5fa refactor: remove Dispatcher and related methods, closes #290 (#291) on 2021-06-09
  • Removes the image dependency.
    • 1d5cc59 chore(deps): remove image dependency (#274) on 2021-05-19
  • Bump tao to 0.3 and add more examples.

For more details, please refer to tao changelog.

  • cd4697e bump tao to 0.3 with examples (#294) on 2021-06-21
  • Add wry::webview::WebContext. It's now a required argument on WebViewBuilder::build.

\[0.9.4]

  • Update tao to v0.2.6

\[0.9.3]

  • Expose webview_version function in the webview module.
    • 4df310e feat: get webview version (#259) on 2021-05-12
  • Add print method on Linux and Windows.
    • 54c5ec7 Implement print method on Linux and Windows (#264) on 2021-05-17
  • Disable smooth scrolling on Linux to match behaviour on browsers.
    • 3e786bb Disable smooth scrolling on Linux (#268) on 2021-05-17

\[0.9.2]

  • Add tray feature flag from tao.
    • 093c25e feat: expose tray feature flag (#256) on 2021-05-10

\[0.9.1]

  • Correctly set visibility when building Window on gtk-backend
    • 4395ad1 fix: only call show_all when needed (#227) on 2021-05-02
  • Fix macOS cursors and other minors UI glitch.
    • d550b2f fix(macOS): Window layers (#220) on 2021-04-28
  • Expose print() function to the webview. Work only on macOS for now.
  • Fix macOS windows order for tray (statusbar) applications.
    • 229275f fix: macOS windows order (#242) on 2021-05-07
  • Add request_redraw method of Window on Linux
    • 03abfa0 Add request_redraw method on Linux (#222) on 2021-04-30
  • Add tao as window dependency.
    • 483bad0 feat: tao as window dependency (#230) on 2021-05-03
  • Close the window when the instance is dropped on Linux and Windows.
    • 3f2cc28 fix: close window when the instance is dropped (#228) on 2021-05-02
  • Remove winit dependency on Linux
    • fa15076 feat: winit interface for gtk (#163) on 2021-04-19
    • 39d6f59 publish new versions (#166) on 2021-04-29
    • 4ef8330 Remove winit dependency on Linux (#226) on 2021-04-30

\[0.9.0]

  • Refactor signatures of most closure types
    • b8823fe refactor: signature of closure types (#167) on 2021-04-19
  • Drop handler closures properly on macOS.
  • Fix history.pushState in webview2.
    • dd0fa46 Use http instead of file for windows custom protocol workaround (#173) on 2021-04-20
  • The data_directory field now affects the IndexedDB and LocalStorage directories on Linux.
    • 1a6c821 feat(linux): implement custom user data path (#188) on 2021-04-22
  • Fix runtime panic on macOS, when no file handler are defined.
    • 22a4991 bug(macOS): Runtime panic when no file_drop_handler (#177) on 2021-04-20
  • Add position field on WindowAttribute
    • 2b3be7a Add position field on WindowAttribute (#219) on 2021-04-28
  • Fix panic on multiple custom protocols registration.
    • 01647a2 Fix custom protocol registry on mac (#205) on 2021-04-26
  • Fix SVG render with the custom protocol.
    • 890cfe5 fix(custom-protocol): SVG mime type - close #168 (#169) on 2021-04-19
  • Initial custom WindowExtWindows trait.
    • 1ef1f58 feat: custom WindowExtWindow trait (#191) on 2021-04-23
  • Fix transparency on Windows
    • e278556 fix: transparency on Windows (#217) on 2021-04-28
  • Add platform module and WindowExtUnix trait on Linux
    • 004e298 feat: WindowExtUnix trait (#192) on 2021-04-23
  • Make sure custom protocol on Windows is over HTTPS.
    • c36db35 fix(custom-protocol): Make sure custom protocol on Windows is over HTTPS. (#179) on 2021-04-20
  • Initial winit interface for gtk backend
    • fa15076 feat: winit interface for gtk (#163) on 2021-04-19

\[0.8.0]

  • Wry now accepts multiple custom protocol registrations.
  • Apply license header for SPDX compliance.
  • Remove bindings crate and use windows-webview2 as dependency instead.
    • c2156a4 Move to windows-webview2 as dependency for winrt impl (#144) on 2021-04-03

\[0.7.0]

  • Add old win32 implementation on windows as default feature flag.
    • 1a88cd2 refactor: Add win32 implementation and feature flag for both backends (#139) on 2021-04-02
  • Adds a WindowProxy to the file drop handler closure - WindowFileDropHandler.
    • 20cb051 feat: add WindowProxy to file drop handler closure (#140) on 2021-04-01

\[0.6.2]

  • Add pipe back to version check for covector config. This prevents the CI failure on publish if it exists already. The issue was patched in covector (and tests in place so it doesn't break in the future).
    • a32829c chore: add pipe for publish check back in (#131) on 2021-03-28
  • Fix messages to the webview from the backend being delayed on Linux/GTK when the user is not actively engaged with the UI.
    • d2a2a9f fix: spawn async event loop on gtk to prevent delayed messages (#135) on 2021-03-31
  • Add draggable regions, just add drag-region class to the html element.
    • b2a0bfc feat/ draggable-region (#92) on 2021-03-25
  • Add event listener in application proxy
  • Better result error handling
    • 485035f chore: better result error handling (#124) on 2021-03-21
  • Fix visibility on webview2 when window was invisible previously and then shown.
    • 6d31706 Fix visibility on webview2 when window was invisible previously (#128) on 2021-03-24

\[0.6.1]

  • Add attribute option to allow WebView on Windows use user_data folder
    • 8dd58ee feat/ allow webview2 (windows) to use optional user_data folder provided by the attributes (#120) on 2021-03-21

\[0.6.0]

  • Initialize covector!
    • 33b64ed chore: covector init (#55) on 2021-02-21
  • Support Windows 7, 8, and 10
    • fbf0d17 Adopt Webview2 on Windows (#48) on 2021-02-20
  • Dev tools are enabled on debug build
  • Add skip task bar option
    • 395b6fb feat: skip_taskbar for windows (#49) on 2021-02-20
  • Add custom protocol option
  • Add transparent option to mac and linux
  • Error type has Send/Sync traits
    • 3536b83 Add .changes file in prepare of v0.6 on 2021-02-24
  • Replace Callback with RPC handler
    • e215157 Implement draft RPC API (#95) on 2021-03-04
  • Add File drop handlers

File: MOBILE.md

Mobile Setup for Wry

We use cargo-mobile2 to create a mobile project for both Xcode and Android studio.

Prerequisite

  • Works on Linux, Windows, macOS, and WSL(Windows subsystem for Linux).
  • Xcode and Android Studio installed properly. This is the most difficult part IMHO. This means all toolchains and SDK are all installed. Please report an issue with comprehensive steps if you encounter any problem.

Setting up Android Environment

1. Installing JDK

Using Android Studio:

If you have Android Studio installed, it ships with a version of JDK so you don't have to install it manually. It is usually at /jre. It will be used for JAVA_HOME env var.

On macOS, it can be found at /Applications/Android\ Studio.app/Contents/jbr/Contents/Home
On Windows, it can be found at C:\Program Files\Android\Android Studio\jre

Using the terminal:

Linux/WSL

  • Install it by running the following command based on your distro to install JDK:

    • debian-based
      text
      sudo apt install default-jdk
    • arch-based
      text
      sudo pacman -S jdk-openjdk
  • Set the JAVA_HOME env variable for this current shell (we will make it permanent later on)

    bash
    export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

macOS

  • Install openjdk from Homebrew:
text
brew install openjdk
  • Link to system Java wrapper and set the JAVA_HOME env:
text
sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
export JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home"

Windows

  • Download openjdk-11
    powershell
    cd $HOME\downloads
    Invoke-WebRequest https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_windows-x64_bin.zip -o openjdk-11.zip
    Expand-Archive openjdk-11.zip -d .
    mkdir $env:LocalAppData\Java
    mv jdk-11.0.2 $env:LocalAppData\Java
  • Set the JAVA_HOME env variable for this current shell (we will make it permanent later on)
    powershell
    $env:JAVA_HOME="$env:LocalAppData\Java\jdk-11.0.2"

2. Installing Android SDK and NDK

There are two ways to install the sdk and ndk.

Using Android Studio:

You can use the SDK Manager in Android Studio to install:

  1. Android Sdk Platform 33
  2. Android SDK Platform-Tools
  3. NDK (Side by side) 25.0.8775105
  4. Android SDK Build-Tools 33.0.
  5. Android SDK Command-line Tools

Note: you may need to tick Show Package Details in the right bottom corner to be able to see some of these components

Using the terminal:

If you don't want or can't use Android Studio you can still get the SDK Manager cli quite easily and use it to install other components.

Note: The SDK Manager is part of the "Command line tools only" that can be downloaded from here

Linux/WSL/macOS

Download the cmdline-tools

bash
cd ~/Downloads

# if you are on Linux/WSL:
wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip -O
# if you are on macos:
wget https://dl.google.com/android/repository/commandlinetools-mac-8512546_latest.zip -O

unzip cmdline-tools.zip
cd cmdline-tools
mkdir latest
mv bin latest/
mv lib latest/
mv NOTICE.txt latest/
mv source.properties latest/
cd ..
mkdir ~/.android # You can use another location for your SDK but I prefer using ~/.android
mv cmdline-tools ~/.android

Install required SDK and NDK components

bash
export ANDROID_HOME="$HOME/.android"
~/.android/cmdline-tools/latest/bin/sdkmanager "platforms;android-33" "platform-tools" "ndk;25.0.8775105" "build-tools;33.0.0"
# Install the emulator if you plan on using a virtual device later
~/.android/cmdline-tools/latest/bin/sdkmanager "emulator"

Windows

Download the cmdline-tools

powershell
cd $HOME\downloads
Invoke-WebRequest https://dl.google.com/android/repository/commandlinetools-win-8512546_latest.zip -o cmdline-tools.zip
Expand-Archive cmdline-tools.zip -d .
cd cmdline-tools
mkdir latest
mv bin latest/
mv lib latest/
mv NOTICE.txt latest/
mv source.properties latest/
cd ..
mkdir $HOME\.android # You can use another location for your SDK but I prefer using $HOME\.android
mv cmdline-tools $HOME\.android

Install required SDK and NDK components

powershell
$env:ANDROID_HOME="$HOME\.android"
&"$env:ANDROID_HOME\cmdline-tools\latest\bin\sdkmanager.exe" "platforms;android-33" "platform-tools" "ndk;25.0.8775105" "build-tools;33.0.0"
# Install the emulator if you plan on using a virtual device later
&"$env:ANDROID_HOME\cmdline-tools\latest\bin\sdkmanager.exe" "emulator"

Note: the location you moved the cmdline-tools directory into will be the location of your android SDK.

3. Setting up Environment Variables

You'll need to set up some environment variables to get everything to work properly. The environment variables below should be all the ones your need to be able to use cargo-mobile2 to build/run your android app.

Linux/WSL/macOS

  • Setting JAVA_HOME:
bash
# In .bashrc or .zshrc:
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
# If you are using Android studio, on Linux, it is:
export JAVA_HOME=/opt/android-studio/jre
# And on macOS, it is:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home
  • Setting ANDROID_HOME:
bash
export ANDROID_HOME="$HOME/.android"
# If you are using Android studio, on Linux, it is:
export ANDROID_HOME="$HOME/Android/Sdk"
# And on macOS, it is:
export ANDROID_HOME="$HOME/Library/Android/sdk"
  • Setting PATH:
bash
export NDK_HOME="$ANDROID_HOME/ndk/25.0.8775105" # The patch version might be different
export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin"
export PATH="$PATH:$ANDROID_HOME/platform-tools"

For WSL:
you also need to get ADB to connect to your emulator that is running on Windows

bash
export WSL_HOST="192.168.1.2" # Run `ipconfig` in windows to get your computer IP
export ADB_SERVER_SOCKET=tcp:$WSL_HOST:5037

After updating .bashrc either run source ~/.bashrc or reopen your terminal to apply the changes.

Windows

Open a powershell instance and run the following commands in order

powershell
Function Add-EnvVar($name, $value) { [System.Environment]::SetEnvironmentVariable("$name", "$value", "User") }
Function Add-PATHEntry($path) { $newPath = [System.Environment]::GetEnvironmentVariable("Path", "User") + ";" + $path; [System.Environment]::SetEnvironmentVariable("Path", "$newPath", "User") }

Add-EnvVar JAVA_HOME "$env:LocalAppData\Java\jdk-11.0.2" # if you are using Android studio, the location is different, see the section above about JDK
$env:SDK_ROOT="$HOME\.android"# if you are using Android studio, the sdk location will be at `$env:LocalAppData\Android\Sdk`
Add-EnvVar ANDROID_HOME "$env:SDK_ROOT"
Add-EnvVar NDK_HOME "$env:SDK_ROOT\ndk\25.0.8775105"

Add-PATHEntry "$env:SDK_ROOT\cmdline-tools\latest\bin"
Add-PATHEntry "$env:SDK_ROOT\platform-tools"

IMPORTANT: you need to reboot your Windows machine in order for the environement variables to be loaded correctly.

You should now have all the environment variables required and the cmdline-tools available in your PATH. You can verify this by running sdkmanager which should now be showing its help info.

4. Install Rust android targets:

shell
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android

Getting Started

Now lets bootstrap a project to develop a tauri or wry project for mobile.

  • Install cargo-mobile2 CLI by running:
    bash
    cargo install --git  https://github.com/tauri-apps/cargo-mobile2
  • Create a directory and init the project.
    bash
    mkdir hello
    cd hello
    cargo mobile init
    # Project name (hello):
    # Stylized name (Hello):
    # Domain (example.com): tauri.app
    # Detected template packs:
    #   [0] bevy
    #   [1] bevy-demo
    #   [2] wgpu
    #   [3] winit
    #   [4] wry
    #   Enter an index for a template pack above.
    # Template pack (0): 4

Build and Run on Device

Android

Make sure you're device is connected to adb
you can check by running cargo android list or adb devices

  • cargo android run

iOS

  • cargo build --target aarch64-apple-ios
  • cargo apple run

First time running the app will be blocked. Go to your phone's Settings > Privacy & Security > Developer Mode to enable developer mode. And then go to Settings -> General -> VPN and device management -> From "Developer App" section to press "Apple Development: APPLE_ID" -> Trust.

Build and Run on Emulator

Android

Using Android Studio

  • Open the project in Android Studio cargo android open
  • Click Trust Project, Use Embedded JDK
  • Choose an emulator. I usually choose Pixel 4 API 32
  • (optional) if you face this error Device supports x86, but APK only supports armeabi-v7a then check this Stack Overflow answer to fix it.
  • Press run button.

Without Android Studio

If you don't have access to Android Studio or don't want or when running in WSL, you can build and run the generated project directly from the terminal

  1. List available emulators
    • Linux/WSL/macOS:
      bash
      $ANDROID_HOME/emulator/emulator -list-avds
    • Windows:
      powershell
      &"$env:ANDROID_HOME\emulator\emulator" -list-avds
      you should now see a list of available emulators like the following, you'll need one of them for the next step:
    text
    Resizable_API_33
    Pixel_5_API_33
  2. Start the emulator with the name of the desired emulator:
    • Linux/WSL/macOS:
      bash
      $ANDROID_HOME/emulator/emulator -avd Resizable_API_33
    • Windows:
      powershell
      &"$env:ANDROID_HOME\emulator\emulator" -avd Resizable_API_33
  3. In a new terminal window, run:
    bash
    cargo android run

iOS

  • If you are on x86_64: cargo build --target x86_64-apple-ios
  • If you are on M1: cargo build --target aarch64-apple-ios-sim
  • cargo apple open
  • Choose a simulator.
  • Press run button.

Devtools

Set devtools attribute to true when building webview.

Android

Open chrome://inspect/#devices in Chrome to get the devtools window.

iOS

Open Safari > Develop > [Your Device Name] > [Your WebView].


File: renovate.json

{
"extends": ["config:recommended"],
"rangeStrategy": "replace",
"packageRules": [
{
"semanticCommitType": "chore",
"matchPackageNames": ["*"]
}
]
}


File: SECURITY.md

Security Policy

Supported Versions

Version Supported
> 1.0 :white_check_mark:
< 1.0 :x:

Reporting a Vulnerability

If you have found a potential security threat, vulnerability or exploit in Tauri
or one of its upstream dependencies, please DONโ€™T create a pull-request, DONโ€™T
file an issue on GitHub, DONโ€™T mention it on Discord and DONโ€™T create a forum thread.

We will be adding contact information to this page very soon.

At the current time we do not have the financial ability to reward bounties,
but in extreme cases will at our discretion consider a reward.


File: .changes/readme.md

Changes

via https://github.com/jbolda/covector

As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version number, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a .md, but we recommend that it represents the overall change for organizational purposes.

When you select the version bump required, you do not need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.

Use the following format:

md
---
"wry": patch
---

Change summary goes here

Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed.

Changes will be designated as a major, minor or patch as further described in semver.

Given a version number MAJOR.MINOR.PATCH, increment the:

  • MAJOR version when you make incompatible API changes,
  • MINOR version when you add functionality in a backwards compatible manner, and
  • PATCH version when you make backwards compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing).


File: .changes/android-activity-id-extras.md


wry: patch

On Android, read __wryActivityId only when the intent or saved state contains it.


File: .changes/android-init-scripts-once.md


wry: patch

On Android, run initialization scripts once on URLs that are not intercepted by a custom protocol when the WebView supports DOCUMENT_START_SCRIPT, instead of a second time from onPageStarted.


File: .changes/android-inline-html-ipc.md


"wry": patch:bug

On Android, load with_html and load_html content at about:blank so IPC messages reach the handler.


File: .changes/android-range-requests.md


wry: patch

On Android, stop the WebView from applying the Range header a second time to a custom protocol 206 response, and serve ranges past 2 GiB.


File: .changes/conditional-linux-ipc-bridge.md


"wry": patch:bug

Only inject the Linux WebKitGTK window.ipc bridge when an IPC handler is configured.


File: .changes/config.json

{
"gitSiteUrl": "https://github.com/tauri-apps/wry/",
"timeout": 3600000,
"additionalBumpTypes": ["housekeeping"],
"pkgManagers": {
"rust": {
"version": true,
"getPublishedVersion": {
"use": "fetch:check",
"options": {
"url": "https://crates.io/api/v1/crates/${ pkg.pkg }/${ pkg.pkgFile.version }"
}
},
"prepublish": [
{
"command": "cargo install cargo-audit --features=fix",
"dryRunCommand": true
},
{
"command": "echo '\n*

Cargo Audit

\n\n'", "dryRunCommand": true, "pipe": true }, { "command": "cargo generate-lockfile", "dryRunCommand": true, "runFromRoot": true, "pipe": true }, { "command": "cargo audit ${ process.env.CARGO_AUDIT_OPTIONS || '' }", "dryRunCommand": true, "runFromRoot": true, "pipe": true }, { "command": "echo '\n\n\n'",
"dryRunCommand": true,
"pipe": true
}
],
"publish": [
{
"command": "echo '\n

Cargo Publish

*\n\n'", "dryRunCommand": true, "pipe": true }, { "command": "cargo publish --no-verify --allow-dirty", "dryRunCommand": "cargo publish --no-verify --allow-dirty --dry-run", "pipe": true }, { "command": "echo '\n\n\n'",
"dryRunCommand": true,
"pipe": true
}
],
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
"git push --tags -f"
]
}
},
"packages": {
"wry": {
"path": "./",
"manager": "rust"
}
}
}


File: .changes/edition-2024.md


wry: patch

Moved to edition 2024


File: .changes/linux-download-failure-isolation.md


"wry": patch

On Linux, isolate download failure state per download so a canceled or failed download does not make later successful downloads report failure.


File: .changes/log-eval-errors.md


wry: patch

Log eval exceptions when tracing feature's enabled at debug level.


File: .changes/macos-background-activation.md


"wry": patch

On macOS, only activate the application and request initial keyboard focus when the new webview is both visible and focused. Creating hidden or unfocused webviews no longer steals focus.


File: .changes/macos-shared-config-child-webview.md


wry: patch

On macOS, a webview built on its opener's configuration (NewWindowResponse::Create with WebViewBuilderExtMacos::with_webview_configuration) shares the opener's WKUserContentController, so it no longer adds its own initialization scripts and IPC handler to it: the opener's scripts and ipc handler already serve it. This stops every opened window from growing the opener's script set, and stops dropping the new webview from removing the opener's ipc handler.


File: .github/CODE_OF_CONDUCT.md

Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the Contributor Covenant, version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/


File: .github/FUNDING.yml

These are supported funding model platforms

github: #
patreon: #
open_collective: tauri
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: # Replace with a single custom sponsorship URL


File: .github/PULL_REQUEST_TEMPLATE.md


File: .github/ISSUE_TEMPLATE/bug_report.md


name: Bug report
about: Create a report to help us improve wry
title: ''
labels: 'type: bug'
assignees: ''


Describe the bug
A clear and concise description of what the bug is.

Steps To Reproduce
Steps to reproduce the behavior. It must use wry directly instead of tauri.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform and Versions (please complete the following information):
OS:
Rustc:

Additional context
Add any other context about the problem here.


File: .github/ISSUE_TEMPLATE/feature_request.md


name: Feature request
about: Suggest an idea for Tauri
title: ''
labels: feature request
assignees: ''


Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.


File: .github/workflows/audit.yml

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: MIT

name: audit

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- dev
paths:
- 'Cargo.lock'
- 'Cargo.toml'
pull_request:
paths:
- 'Cargo.lock'
- 'Cargo.toml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
issues: write
checks: write

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}


File: .github/workflows/bench.yml

name: benches

on:
push:
branches:
- dev
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/bench.yml'
- 'bench/**'

env:
RUST_BACKTRACE: 1
CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency.
LC_ALL: en_US.UTF-8 # This prevents strace from changing its number format to use commas.

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
bench:
strategy:
fail-fast: false
matrix:
rust: [nightly]
platform:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, runner: 'xvfb-run --auto-servernum ' }
- { target: x86_64-pc-windows-msvc, os: windows-latest, runner: '' }
- { target: aarch64-apple-darwin, os: macos-latest, runner: '' }

text
runs-on: ${{ matrix.platform.os }}

steps:
  - uses: actions/checkout@v6

  - name: install Rust ${{ matrix.rust }}
    uses: dtolnay/rust-toolchain@master
    with:
      toolchain: ${{ matrix.rust }}
      components: rust-src
      targets: ${{ matrix.platform.target }}

  - name: install webkit2gtk and xvfb (ubuntu only)
    if: contains(matrix.platform.target, 'gnu')
    run: |
      sudo apt-get update
      sudo apt-get install -y --no-install-recommends \
        libwebkit2gtk-4.1-dev libayatana-appindicator3-dev \
        xvfb \
        at-spi2-core

  - name: Setup python
    uses: actions/setup-python@v6
    with:
      python-version: '3.13'

  - name: install memory_profiler
    run: |
      python -m pip install --upgrade pip
      pip install memory_profiler

  - name: Install cargo-binstall
    uses: cargo-bins/[email protected]

  - name: Install hyperfine
    run: cargo binstall [email protected] --no-confirm

  - uses: Swatinem/rust-cache@v2
    with:
      workspaces: |
        .
        bench/tests

  - name: build benchmark binaries
    env:
      RUSTFLAGS: "-Zunstable-options -Cpanic=immediate-abort"
    run: cargo +nightly build --release -Z build-std=std,panic_abort -Z build-std-features= --target ${{ matrix.platform.target }} --manifest-path bench/tests/Cargo.toml

  - name: run benchmarks
    run: ${{ matrix.platform.runner }}cargo run --manifest-path ./bench/Cargo.toml --bin run_benchmark

  - name: clone benchmarks_results
    if: github.repository == 'tauri-apps/wry' && github.ref == 'refs/heads/dev'
    uses: actions/checkout@v4
    with:
      token: ${{ secrets.ORG_TAURI_BOT_PAT }}
      path: gh-pages
  - name: push new benchmarks
    if: github.repository == 'tauri-apps/wry' && github.ref == 'refs/heads/dev'
    run: |
      cargo run --manifest-path ./bench/Cargo.toml --bin build_benchmark_jsons
      cd gh-pages
      git pull
      git config user.name "tauri-bot"
      git config user.email "[email protected]"
      git add .
      git commit --message "Update WRY benchmarks"
      git push origin gh-pages

  - name: Print worker info
    # TODO: How to print this info on macOS and Windows
    if: contains(matrix.platform.target, 'gnu')
    run: |
      cat /proc/cpuinfo
      cat /proc/meminfo

File: .github/workflows/build.yml

name: test

on:
push:
branches:
- dev
pull_request:

permissions:
contents: read

jobs:
test:
strategy:
fail-fast: false
matrix:
platform:
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: aarch64-apple-darwin, os: macos-latest }
- { target: aarch64-apple-ios, os: macos-latest }
- { target: x86_64-apple-darwin, os: macos-latest }
- { target: aarch64-linux-android, os: ubuntu-latest }
features:
- {
args: --no-default-features --features os-webview,
key: no-default,
}
- { args: --all-features, key: all }

text
runs-on: ${{ matrix.platform.os }}

steps:
  - uses: actions/checkout@v4
  - name: install stable
    uses: dtolnay/[email protected]
    with:
      targets: ${{ matrix.platform.target }}

  - name: install webkit2gtk (ubuntu only)
    if: contains(matrix.platform.target, 'gnu')
    run: |
      sudo apt-get update
      sudo apt-get install -y libwebkit2gtk-4.1-dev

  - name: install webview2 (windows only)
    if: contains(matrix.platform.target, 'windows')
    shell: pwsh
    run: |
      Invoke-WebRequest https://go.microsoft.com/fwlink/p/?LinkId=2124703 -OutFile installwebview.exe -UseBasicParsing
      cmd /C start /wait installwebview.exe /silent /install

  - uses: Swatinem/rust-cache@v2
    with:
      save-if: ${{ matrix.features.key == 'all' }}

  - name: build wry
    run: cargo build --target ${{ matrix.platform.target }} ${{ matrix.features.args }}

  - name: build tests and examples
    shell: bash
    if: (!contains(matrix.platform.target, 'android') && !contains(matrix.platform.target, 'ios'))
    run: cargo test --no-run --verbose --target ${{ matrix.platform.target }} ${{ matrix.features.args }}

  - name: run tests
    if: (!contains(matrix.platform.target, 'android') && !contains(matrix.platform.target, 'ios'))
    run: cargo test --verbose --target ${{ matrix.platform.target }} --features linux-body ${{ matrix.features.args }}

  - name: install nightly
    uses: dtolnay/rust-toolchain@nightly
    with:
      targets: ${{ matrix.platform.target }}
      components: miri

  - name: Run tests with miri
    if: (!contains(matrix.platform.target, 'android') && !contains(matrix.platform.target, 'ios'))
    run: cargo +nightly miri test --verbose --target ${{ matrix.platform.target }} --features linux-body ${{ matrix.features.args }}

doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install nightly
uses: dtolnay/rust-toolchain@nightly
- name: install webkit2gtk
run: |
sudo apt-get update -y -q
sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev
- name: Run cargo doc with each targets
env:
DOCS_RS: true
run: |
set -ex

text
md="$(cargo metadata --format-version=1 | jq '.packages[] | select(.name=="wry") | .metadata.docs.rs')"

      export RUSTDOCFLAGS="$(echo "$md" | jq -r '.["rustdoc-args"] | join(" ")')"
      export RUSTFLAGS="$(echo "$md" | jq -r '.["rustc-args"] | join(" ")')"

      features="$(echo "$md" | jq -r '.features | join(",")')"
      no_default_features=
      if [ "$(echo "$md" | jq '.["no-default-features"]')" = true ]; then
        no_default_features="--no-default-features"
      fi

      for target in $(echo "$md" | jq -r '.targets | join(" ")')
      do
        rustup target add "$target"
        cargo doc -p wry "$no_default_features" "--features=$features" "--target=$target"
      done

File: .github/workflows/clippy-fmt.yml

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: MIT

name: clippy & fmt

on:
push:
branches:
- dev
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
clippy:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]

text
runs-on: ${{ matrix.platform }}

steps:
  - uses: actions/checkout@v4
  - name: install system deps
    if: matrix.platform == 'ubuntu-latest'
    run: |
      sudo apt-get update
      sudo apt-get install -y libwebkit2gtk-4.1-dev

  - uses: dtolnay/rust-toolchain@stable
    with:
      components: clippy

  - run: cargo clippy --all-targets

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

text
- run: cargo fmt --all -- --check

File: .github/workflows/covector-comment-on-fork.yml

name: covector comment
on:
workflow_run:
workflows: [covector status] # the name of the workflow run on pull_request running status with comment: true
types:
- completed

note all other permissions are set to none if not specified

and these set the permissions for `secrets.GITHUB_TOKEN`

permissions:

to read the action artifacts on `covector status` workflows

actions: read

to write the comment

pull-requests: write

jobs:
download:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' &&
(github.event.workflow_run.head_repository.full_name != github.repository || github.actor == 'dependabot[bot]')
steps:
- name: covector status
uses: jbolda/covector/packages/action@covector-v0
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: "status"


File: .github/workflows/covector-status.yml

name: covector status
on: [pull_request]

permissions:
contents: read

jobs:
covector:
runs-on: ubuntu-latest

text
steps:
  - uses: actions/checkout@v4
    with:
      fetch-depth: 0
  - name: covector status
    uses: jbolda/covector/packages/action@covector-v0
    with:
      command: "status"
      token: ${{ secrets.GITHUB_TOKEN }}
      comment: true

File: .github/workflows/covector-version-or-publish.yml

name: covector version or publish

on:
push:
branches:
- dev

permissions:

required to create the GitHub Release

contents: write

required for creating the Version Packages Release

pull-requests: write

jobs:
version-or-publish:
runs-on: ubuntu-latest
timeout-minutes: 65
outputs:
change: ${{ steps.covector.outputs.change }}
commandRan: ${{ steps.covector.outputs.commandRan }}
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}

text
steps:
  - uses: actions/checkout@v4
    with:
      fetch-depth: 0 # required for use of git history

  - name: cargo login
    run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }}

  - name: git config
    run: |
      git config --global user.name "${{ github.event.pusher.name }}"
      git config --global user.email "${{ github.event.pusher.email }}"

  - name: covector version or publish (publish when no change files present)
    uses: jbolda/covector/packages/action@covector-v0
    id: covector
    env:
      NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
      CARGO_AUDIT_OPTIONS: ${{ secrets.CARGO_AUDIT_OPTIONS }}
    with:
      token: ${{ secrets.GITHUB_TOKEN }}
      command: "version-or-publish"
      createRelease: true
      recognizeContributors: true

  - name: install cargo-readme
    if: steps.covector.outputs.commandRan == 'version'
    run: cargo install cargo-readme --locked

  - run: cargo readme --no-title --no-license > README.md
    if: steps.covector.outputs.commandRan == 'version'

  - name: Sync Cargo.lock
    if: steps.covector.outputs.commandRan == 'version'
    run: cargo tree --depth 0

  - name: Create Pull Request With Versions Bumped
    id: cpr
    uses: peter-evans/[email protected]
    if: steps.covector.outputs.commandRan == 'version'
    with:
      token: ${{ secrets.GITHUB_TOKEN }}
      title: Apply Version Updates From Current Changes
      commit-message: "apply version updates"
      labels: "version updates"
      branch: "ci/pending-release"
      body: ${{ steps.covector.outputs.change }}
      sign-commits: true