151 Commits

Author SHA1 Message Date
Lucas Fernandes Nogueira
ccdf912621 fix: build without x11 feature (#1603)
* fix: build without x11 feature

* fix tests

* fix example

* fix async protocol example

* fix other examples

* pub fn
2025-08-16 13:40:47 -03:00
Lucas Fernandes Nogueira
3f978d3290 refactor: allow new_window_req_handler to create the webview on its own (#1601)
* feat(linux): craete webview on new_window_req

follow-up for #1596

ref https://github.com/tauri-apps/tauri/pull/13876

* refactor: allow new_window_req_handler to create the webview on its own

* add webview getter

* clippy regression

* macos fixes

* enhance platform support

* fix deadlock on windows

* fix mac build
2025-08-16 09:13:15 -03:00
Lucas Fernandes Nogueira
eb562ca993 fix(macos): new_window_req not firing on window.open (#1596)
* fix(macos): new_window_req not firing on window.open

currently the new_window_req_handler is fired on navigation events, which is incorrect as it calls the handler on iframe navigations and doesn't call it on window.open calls, not matching behavior on other platforms

this PR changes it to run under [`webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:`](https://developer.apple.com/documentation/webkit/wkuidelegate/webview(_:createwebviewwith:for:windowfeatures:)?language=objc) instead

I've noticed this when testing https://github.com/tauri-apps/tauri/pull/13876

* fix build

* fix coordinates

* fix features
2025-08-13 13:20:49 -03:00
Sean Wang
60dba38ddc feat: add WebView::set_cookie and WebView::delete_cookie (#1569)
* feat: add `WebView::set_cookie` and `WebView::delete_cookie`

* feat: implement for `wkwebview`

* chore: changes-files

* feat: implement SameSite cookie policy for wkwebview

* refactor: use `&` instead of `&*`

* refactor: remove `debug_assert` for `HttpOnly`

* docs: add `delete_cookie` in example

* chore: remove redundant samesite setting

---------

Co-authored-by: Jason Tsai <git@pews.dev>
2025-07-02 00:38:00 +09:00
sftse
bfebb423d7 chore(deps): Update html5ever and kuchikiki (#1566) 2025-06-23 11:47:09 +02:00
Linda_pp
92f36a3e1b fix(bench): fix building benchmarks (#1532)
* fix(bench): fix building benchmarks

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

* fix: fix clippy warning in `window_border` example

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

---------

Signed-off-by: rhysd <lin90162@yahoo.co.jp>
2025-03-26 17:25:10 +02:00
ohyfun
3bab9afafb fix examples/gtk_multiwebview.rs layout misaligned (#1504)
Co-authored-by: ohyfun <rustfun@gmail.com>
2025-02-28 07:55:52 +02:00
Amr Bashir
9df094aa79 fix(windows): calculate parent bounds accurately (#1483)
ref: https://github.com/rust-windowing/winit/pull/3712
ref: 7bddb390ca/crates/gpui/src/platform/windows/events.rs (L1418-L1454)
2025-02-12 06:14:21 +02:00
renovate[bot]
f944870801 chore(deps): update rust crate getrandom to 0.3 (#1467)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: FabianLars <github@fabianlars.de>
2025-01-27 15:04:01 +01:00
renovate[bot]
ca74176748 chore(deps): update rust crate winit to 0.30 (#1235)
Co-authored-by: nobane <2507359+nobane@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2025-01-01 21:14:33 +01:00
Integral
4740c0bf60 refactor: destruct tuples to enhance readability (#1438)
Signed-off-by: Integral <integral@member.fsf.org>
2024-12-10 14:44:18 +02:00
Amr Bashir
c1b26b9612 feat: add WebView::cookies and WebView::cookies_for_url (#1394)
* feat: add `WebView::cookies` and `WebView::cookies_for_url`

closes #518
ref: https://github.com/tauri-apps/tauri/issues/11330

* cookies -> getCookies in android

* fix macos build

* fix gtk blocking

* document why we don't use wait_for_async_operation

* change file

* implement cookies_for_url on macOS

* fmt

* fix macos impl

* actually use interval

* make it faster

* remove matching on path

* Apply suggestions from code review

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>

* Apply suggestions from code review

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-10-21 15:42:03 -03:00
Jason Tsai
0abc221ca0 refactor(macos): migrate to objc2 (#1316)
* migrate drag & drop

* refactor: migrate to `dpi` crate (#1202)

* refactor: migrate to `dpi` crate

closes #1172

* macOS

* linux

* fix doctests

* imports

* more doctests

* fix android and ios

* Update examples/winit.rs

Co-authored-by: Jason Tsai <jason@pews.dev>

* Update src/webview2/mod.rs

---------

Co-authored-by: Jason Tsai <jason@pews.dev>

* fix(windows): avoid double-free the controller (#1206)

* fix(linux): Disable deprecated applicationCache web api. (#1207)

fixes https://github.com/tauri-apps/tauri/issues/9300
ref https://github.com/WebKit/WebKit/pull/23382

* fix(wkwebview): menu shortcuts (#1208)

* fix(wkwebview): menu shortcuts

* Update wkwebview.md

* Apply Version Updates From Current Changes (#1203)

Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>

* migrate to `objc2`

* fix(macos): response body being double freed

* fix(macos): eval callback NSStrgin convertion error

* chore: remove objc dependency

* refactor(macos): migrate WebViewDelegate

* refactor(macos): migrate proxy to objc2

* refactor(macos): migrate document title change observer to objc2

* refactor(macos): move drag&drop handler to delegate

* refactor(macos): move ipc_handler into WryWebViewDelegate

* refactor(macos): migrate download handler

* fix(macos): prevent unsafe async custom protocol panic

* chore: target os import

* refactor(ios): migrate to objc2

* refactor(macos): migrate WebViewUIDelegate to objc2

* refactor(macos): migrate WryWebViewParent to objc2

* refactor(macos): move custom class to individual files

* chore: fix clippy

* refector: use reference for task. use objc2::exception::catch.

* fix(dnd): use msg_send super and impl NSDraggingDestination

* chore: call msg_send super

* fix: wrap Box<dyn FnMut(..)> with RefCell

* chore(deps): update rust crate tao to 0.29 (#1343)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* refactor: use bitflags way to handle mask bit manipulation

* WIP: refactor(ios): add wkwebview for ios

* Update Cargo.toml

Co-authored-by: Mads Marquart <mads@marquart.dk>

* fix: remove `.copy()` from RcBlock

* add change file

* lint

* fmt

---------

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
Co-authored-by: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Mads Marquart <mads@marquart.dk>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-10-11 16:11:10 -03:00
Amr Bashir
8cc2a7f657 refactor!: add webview id to protocol handlers and improve API ergonomics (#1384)
* refactor!: add webview id to protocol handlers and improve API ergonomics

* try to fix macos

* fix macos impl

* fix doctests

* generated id instead of defaulting to None

* update change file

* fix macos

* clone

* ios

* typos

* fix replace

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-10-11 15:07:57 -03:00
Amr Bashir
eafaadb9b3 chore: fix gtk_multiwebview example on wayland (#1371) 2024-09-26 10:02:26 +03:00
Jason Tsai
86faa70a70 fix(example): workaround to prevent winit crash when unfocused (#1323)
* fix(example): workaround to prevent winit crash when unfocused

* chore: remove changelog and unix resize event
2024-07-22 14:17:27 +09:00
Amr Bashir
50ec050bcf chore(examples): update custom_titlbar example with app-region: drag (#1277) 2024-05-23 10:21:48 +08:00
Lucas Fernandes Nogueira
f089964a3c fix(linux): async custom protocol crashing sending response (#1276) 2024-05-23 04:05:52 +03:00
Tony
1098ca9831 refactor: remove usage of PCWSTR::from_raw from HSTRING (#1265) 2024-05-15 18:23:17 +03:00
Amr Bashir
07c17439eb chore(examples): add streaming example (#1230) 2024-04-23 12:59:05 +09:00
Amr Bashir
34ae1ca3af refactor: migrate to dpi crate (#1202)
* refactor: migrate to `dpi` crate

closes #1172

* macOS

* linux

* fix doctests

* imports

* more doctests

* fix android and ios

* Update examples/winit.rs

Co-authored-by: Jason Tsai <jason@pews.dev>

* Update src/webview2/mod.rs

---------

Co-authored-by: Jason Tsai <jason@pews.dev>
2024-03-28 16:37:24 +02:00
Amr Bashir
ba1fa58a41 chore: fix import in bench tests (#1188) 2024-03-13 17:16:51 +02:00
Amr Bashir
5789bf759c refactor!: refactor drag and drop events (#1187) 2024-03-13 14:15:20 +02:00
Lucas Fernandes Nogueira
b8fea396c2 refactor(ipc): use http::Request on with_ipc_handler (#1183)
* refactor(ipc): introduce IpcRequest type to get source URL on supported platforms

* fix linux

* use http::Request

* leftover config

* url from webview as fallback

* docs

* docs
2024-03-06 10:56:42 -03:00
Amr Bashir
3a2026b37b refactor!: refactor windows and linux backends for better maintainability (#1182)
* refactor: backends for better maintainability

* Return rust errors before custom protocol handler

* move data_directory buffer out of closure as well

* refactor webkit2gtk

* clippy

* fix build

* fix build again

* change file

* fix android

* unwrap
2024-03-06 07:15:36 +02:00
amrbashir
8c86fbaf51 chore(examples): change simple example url 2024-02-15 17:17:07 +02:00
Amr Bashir
2ff8d9d245 refactor!: remove internal url parsing and data: url support (#1169)
* refactor!: remove internal url parsing and `data:` url support

* fix doctests

* clippy and fix linux

* fix android

* fix android
2024-02-14 07:29:08 +02:00
Amr Bashir
e50ce47ea3 feat: add reparent function (#1166)
* feat: add reparent function

* remove mut

* windows and linux impl

* update change file

* Discard changes to examples/simple.rs

* remove ns_window field

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-02-12 16:10:50 +02:00
Paweł Bis
818dc8d588 fix(docs): mention that 'transparent' feature is required in transparent example. (#1155) 2024-01-27 14:09:53 +09:00
Linda_pp
19e35a4dcc fix(deps): update raw-window-handle to v0.6 (#1144)
* support rwh 0.6 by macOS

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

* update wgpu to 0.19 for rwh 0.6

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

* support rwh 0.6 by Linux (including Android)

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

* support rwh 0.6 by Windows

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

* fix `HasRawWindowhandle` in documents to `HasWindowHandle`

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

* add changelog item for raw-window-handle v0.6 update

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

* simplify dependencies configuration in Cargo.toml

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

---------

Signed-off-by: rhysd <lin90162@yahoo.co.jp>
2024-01-22 15:40:03 +02:00
Jason Tsai
7aeb848420 chore(example): fix the hyperlink in custom protocol example page (#1135) 2024-01-04 01:11:09 +02:00
Amr Bashir
2aa96bd9ad chore: support resizing in custom titlebar example (#1134) 2024-01-03 12:01:01 +08:00
Amr Bashir
17a5129a8c feat(linux): support adding to gtk::Fixed (#1128)
* feat(linux): support adding to `gtk::Fixed`

* fix doctests

* again
2023-12-27 15:25:27 +02:00
Lucas Fernandes Nogueira
8fddbb6d51 feat: add WebView::bounds getter (#1091)
* feat: add WebView::bounds getter

* macos impl

* windows impl

* dummy android

* fix build on ios

* fix initial size on macOS, adjust bounds impl

* fallback to controller.bounds on windows

* use webview.allocated_size on linux when not a child

* cleanup windows impl

* fix wgpu example

* cleanup linux impl

---------

Co-authored-by: amrbashir <amr.bashir2015@gmail.com>
2023-11-22 15:45:12 +02:00
Amr Bashir
fee99b6d87 refactor: combine position and size into bounds (#1079)
* refactor: combine position and size into bounds

* update change file

* fix macOS build

* again

* Update src/wkwebview/mod.rs
2023-11-14 15:49:19 +09:00
Linda_pp
f41a8f07ea feat(unix): move new_gtk functions to *ExtUnix traits (#1070)
* feat(unix): move `new_gtk` functions to `*ExtUnix` traits

Signed-off-by: rhysd <lin90162@yahoo.co.jp>

* Update rwh.md

---------

Signed-off-by: rhysd <lin90162@yahoo.co.jp>
2023-11-13 15:28:49 +02:00
Ngo Iok Ui (Wu Yu Wei)
783b14239d Refactor new method entry point to rwh (#1041)
* Refactor new method entry point to rwh

* Update doc and add change file

* Fix mac and ios compile error

* Add new_as_child

* Add rhw_04, 05 06 flags

* Update android port

* Remove winit CI

* Fix android bindings

* windows implementation

* Update Cargo.toml

* Fix macOS and iOS

* Fix Android

* fix is_child on WkWebView

* x11 impl

* expose `new_gtk`

* fix winit-gtk version

* remove undecorated resizing handling

* implement set_position and set_size for child gtk in x11

* fix macos

* more fixes

* one more time

* unreachable

* update actions

* fix windows

* some clippy

* Add documentation and fix clippy

* Fix windows clippy error

* Fix android biuld

* Fix documentation test

* Fix android again

* Reduce clippy noise

* use rc?

* refine some documentation, add set_visible

* fix set_visible

* impl set_visible on Windows

* fix doctests

* more set_visible fixes

* fix windows

* unsafe

* fix set size for child webviews

* fix initial visibility with new_gtk

* refine examples

* fix wpgu example

* fix examples on windows and macos

* use a better workaround

* make set_size work on x11

* Fix size in multiwebview example

* Add visible method on macOS and iOS

* remvoe `tao` from android backend and update documentation

* fix winit example

* Add new_as_content_view on macOS

* allow using raw-window-handle v0.5 [skip ci]

* change trait name [skip ci]

* fix linux impl [skip ci]

* fix android build [skip ci]

* fix windows build

* fix(macos): do not autoresize on child webview [skip ci]

* fix macos coordinates [skip ci]

* fix example [skip ci]

* fixed child on macos [skip ci]

* fix docs typos [skip ci]

* fix webview position when it's not a child [skip ci]

* replace new_as_content_view with new_as_subview

* with_as_subview instead of constructor [skip ci]

* fix position/size when as_subview is true

* lint & fmt

* Fix ios build

* Fix cargo test

* Fix mac build

* Update macOS contrusctors

* cargo fmt

* impl drop on Windows

* fix child transparency on Windows (still needs PRs in tao and winit)

* fix winit usage in the examples, use rwh_05 only for now

* fix tests

* add webview.focus

* fix dropping on Linux

* chore clean examples

* implement focus on Linux

* macos focus

---------

Co-authored-by: amrbashir <amr.bashir2015@gmail.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-11-07 20:30:35 +09:00
Lucas Fernandes Nogueira
0582cdf4a1 fix: docs.rs macOS build failing (#1033)
* fix: docs.rs macOS build failing

* lint

* clippy lint

* fmt

---------

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2023-10-10 15:14:16 +09:00
Lucas Fernandes Nogueira
5adf9da215 refactor(android): use http scheme by default for custom protocols and add option to change it ref #994 (#1020)
* refactor(android): use http scheme by default for custom protocols and add option to change it ref #994

* update documentation

* fix example
2023-09-09 00:18:50 +03:00
Lucas Fernandes Nogueira
4bdf1c366d refactor(protocol): respond with a function call instead of return value (#1017)
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2023-09-06 10:50:05 -03:00
Jason Tsai
3cc4d79843 feat: support webview proxy (#1006)
* feat(macos): support proxy

* Added WebView2 implementation

* Update mod.rs

* Added Webkit2gtk implementation

* chore: update doc and format

* fix(macos): use TryFrom trait for nw_endpoint_t

* fix(macos): add `mac-proxy` feature flag to enable proxy feature for macOS 14.0+

* chore: fix clippy

* Change WebView2 argument construction to before async operation

* Update src/webview/mod.rs

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>

* Remove unused import

* update formatting

* Added documentation at with_additional_browser_args

* refactor: remove redundant proxy struct

* Remove redundant reference

* hide proxy module and export types needed

---------

Co-authored-by: DK Liao <dklassic@gmail.com>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2023-08-28 15:29:03 +08:00
Amr Bashir
b0a08b1652 chore: update to tao@0.22 (#997)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2023-08-13 19:25:44 -03:00
Linda_pp
5193e735a1 fix: fix all clippy warnings and enable clippy on CI (#953)
* fix all clippy warnings

* run clippy on CI

* use `Swatinem/rust-cache@v2` in fmt.yml workflow
2023-05-09 00:44:33 +08:00
Hyphrio
86988368a4 feat: Add a way to launch WebViews as incognito WebView::as_incognito, closes #908 (#916)
* impl Incognito for WebKitGTK and WebView2

* Fix broken commit

* i hate objc

* Mark Android as unsupported

* fix broken webview2 module

* better example

* example currently broken

* forgot change file

* update

* Fix WebKitGTK

* Share same code when creating context

* Cargo fmt

* Clean gitignore

* Simply more code

* Small patches to WKWebView, thank you pewsheen!

* Fix example on Windows

* Fix an oversight on WKWebView

* Fix webkit2gtk implementation

* Rename to with_incognito

* Fix WKWebView type annotations

* Fix warnings on wkwebview

* Remove examples

We can test with existing sites instead.

* Update docs

* Cargo fmt

---------

Co-authored-by: Wu Yu Wei <wusyong9104@gmail.com>
Co-authored-by: Wu Wayne <yuweiwu@pm.me>
2023-04-06 13:35:37 +08:00
Jason Tsai
2647731c1f feat: support callback function in eval (#778)
* feat: support callback fn in eval

* chore: enable javascriptcore-rs feature v2_28

* chore: add more example to eval

* feat(eval): add public fn evaluate_script_with_callback

* fix(linux): use ValueExt trait to convert JSValue to JSON

* fix(windows): return eval result directly

* chore: add changelog

* chore(eval): add exception example and doc to the function

* Update src/webview/mod.rs

Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>

* Fix typo

---------

Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>
2023-03-23 13:47:02 +08:00
Jason Tsai
c5f3b36b7a Bump gtk version 0.15 -> 0.16 (#851)
* Update to gtk 0.16 and webkit2gtk 4.1

* chore: update dependencies to fit gtk 0.16

* fix(example): menu should create after event loop created (gtk::init)

* chore: add changelog

* chore: update Cargo dependencies version

* Update CI

* Update README.md

Co-authored-by: Wu Yu Wei <wusyong9104@gmail.com>
2023-01-26 20:54:56 +08:00
DK Liao
ad168a22df Update license to 2023 (#835) 2023-01-07 14:28:40 +08:00
Linda_pp
29c3c88add fix(examples): fix WKWebView may not support WebAssembly.instantiateStreaming yet (#827)
* fix(examples): Fix WKWebView may not support `WebAssembly.instantiateStreaming` yet

* Delete fix-example-wasm.md
2022-12-28 15:10:59 +02:00
Linda_pp
ddd34614be perf: Change return type of custom protocol handler from Vec<u8> to Cow<'static, [u8]>, closes #796 (#797)
* perf: Change return type of custom protocol handler from `Vec<u8>` to `Cow<'static, [u8]>`

to allow returning static resources without heap allocation

* chore(examples): Fix some comments

following the review https://github.com/tauri-apps/wry/pull/797#pullrequestreview-1210580935

* fix(android): Change return type of response to `Cow`
2022-12-12 14:31:58 +02:00
Kasper
94256c3adb Fix beep sound, closes #799 (#801)
* Beepfix attempt

* Add changefile
2022-12-10 08:07:01 +08:00