diff --git a/.changes/15.md b/.changes/15.md new file mode 100644 index 0000000..deb2855 --- /dev/null +++ b/.changes/15.md @@ -0,0 +1,5 @@ +--- +"wry": minor +--- + +Update gtk to 0.15 diff --git a/.changes/clipboard.md b/.changes/clipboard.md new file mode 100644 index 0000000..7471ebb --- /dev/null +++ b/.changes/clipboard.md @@ -0,0 +1,6 @@ +--- +"wry": patch +--- + +Add clipboard field in WebViewAttributes. + diff --git a/.changes/fix-windows7-runtime.md b/.changes/fix-windows7-runtime.md new file mode 100644 index 0000000..2e39a95 --- /dev/null +++ b/.changes/fix-windows7-runtime.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Ignore transparency on Windows 7 to prevent application crash. diff --git a/.changes/linux-clipboard.md b/.changes/linux-clipboard.md new file mode 100644 index 0000000..966418a --- /dev/null +++ b/.changes/linux-clipboard.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Remove clipboard property for consistency across platforms. diff --git a/.changes/linux-cookie-storage.md b/.changes/linux-cookie-storage.md new file mode 100644 index 0000000..f45a207 --- /dev/null +++ b/.changes/linux-cookie-storage.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Enable cookie persistence on Linux if the `data_directory` is provided. diff --git a/.changes/mac-exception.md b/.changes/mac-exception.md new file mode 100644 index 0000000..23ea412 --- /dev/null +++ b/.changes/mac-exception.md @@ -0,0 +1,6 @@ +--- +"wry": patch +--- + +Enable objc's exception features so they can be treated as panic message. + diff --git a/.changes/mac-inner-size.md b/.changes/mac-inner-size.md new file mode 100644 index 0000000..a22e111 --- /dev/null +++ b/.changes/mac-inner-size.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Add inner size method for webview. This can reflect correct size of webview on macOS. diff --git a/.changes/mac-priv.md b/.changes/mac-priv.md new file mode 100644 index 0000000..c9b10dc --- /dev/null +++ b/.changes/mac-priv.md @@ -0,0 +1,6 @@ +--- +"wry": patch +--- + +Add "transparent" and "fullscreen" featrue flags on macOS to toggle private API. + diff --git a/.changes/mac-webcontext.md b/.changes/mac-webcontext.md new file mode 100644 index 0000000..920d43f --- /dev/null +++ b/.changes/mac-webcontext.md @@ -0,0 +1,6 @@ +--- +"wry": patch +--- + +Implement WebContextImpl on mac to extend several callback lifetimes. + diff --git a/.changes/remove-shared-mod.md b/.changes/remove-shared-mod.md new file mode 100644 index 0000000..7370215 --- /dev/null +++ b/.changes/remove-shared-mod.md @@ -0,0 +1,6 @@ +--- +"wry": patch +--- + +The only thing that private mod shared does is re-export http mod to public, +we can just pub mod http. diff --git a/.changes/resizing-undecorated-window-touch.md b/.changes/resizing-undecorated-window-touch.md new file mode 100644 index 0000000..660fcd0 --- /dev/null +++ b/.changes/resizing-undecorated-window-touch.md @@ -0,0 +1,6 @@ +--- +"wry": patch +--- + +* Fix hovering over an edge of undecorated window on Linux won't change cursor. +* Undecorated window can be resized using touch on Linux. \ No newline at end of file diff --git a/.changes/webkit2gtk.md b/.changes/webkit2gtk.md new file mode 100644 index 0000000..d5bb720 --- /dev/null +++ b/.changes/webkit2gtk.md @@ -0,0 +1,6 @@ +--- +"wry": patch +--- + +Update webkit2gtk to 0.15 + diff --git a/.changes/webview-user-agent.md b/.changes/webview-user-agent.md new file mode 100644 index 0000000..95119f6 --- /dev/null +++ b/.changes/webview-user-agent.md @@ -0,0 +1,4 @@ +--- +"wry": minor +--- +Add `with_user_agent(&str)` to `WebViewBuilder`. diff --git a/.changes/webview2-com.md b/.changes/webview2-com.md new file mode 100644 index 0000000..8717564 --- /dev/null +++ b/.changes/webview2-com.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +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. \ No newline at end of file diff --git a/.changes/webview2-null.md b/.changes/webview2-null.md new file mode 100644 index 0000000..1296c7a --- /dev/null +++ b/.changes/webview2-null.md @@ -0,0 +1,6 @@ +--- +"wry": patch +--- + +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. \ No newline at end of file diff --git a/.changes/windows-0.25.0.md b/.changes/windows-0.25.0.md new file mode 100644 index 0000000..9bbc762 --- /dev/null +++ b/.changes/windows-0.25.0.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +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`. \ No newline at end of file diff --git a/.changes/windows-0.29.0.md b/.changes/windows-0.29.0.md new file mode 100644 index 0000000..0ebc298 --- /dev/null +++ b/.changes/windows-0.29.0.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Update the `windows` crate to 0.29.0 and `webview2-com` to 0.9.0. \ No newline at end of file diff --git a/.changes/windows-0.30.0.md b/.changes/windows-0.30.0.md new file mode 100644 index 0000000..df73b36 --- /dev/null +++ b/.changes/windows-0.30.0.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Update the `windows` crate to 0.30.0 and `webview2-com` to 0.10.0. \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3a2675c..7cb3c1f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,36 +1,30 @@ - - - -**What kind of change does this PR introduce?** (check at least one) +### What kind of change does this PR introduce? + - [ ] Bugfix - [ ] Feature +- [ ] Docs +- [ ] New Binding issue #___ - [ ] Code style update - [ ] Refactor -- [ ] Documentation - [ ] Build-related changes - [ ] Other, please describe: -**Does this PR introduce a breaking change?** (check one) - +### Does this PR introduce a breaking change? + -- [ ] Yes. Issue #___ +- [ ] Yes, and the changes were approved in issue #___ - [ ] No - -**The PR fulfills these requirements:** - -- [ ] When resolving a specific issue, it's referenced in the PR's title (e.g. `fix: #xxx[,#xxx]`, where "xxx" is the issue number) +### Checklist +- [ ] When resolving issues, they are referenced in the PR's title (e.g `fix: remove a typo, closes #___, #___`) - [ ] A change file is added if any packages will require a version bump due to this PR per [the instructions in the readme](https://github.com/tauri-apps/tauri/blob/dev/.changes/readme.md). +- [ ] I have added a convincing reason for adding this feature, if necessary -If adding a **new feature**, the PR's description includes: -- [ ] A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it) - -**Other information:** +### Other information diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7300afd..2fbd4b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,12 +74,12 @@ jobs: ${{ matrix.platform }}-stable-cargo-core- - name: build wry - run: cargo build --target ${{ matrix.platform.target }} + run: cargo build --features tray --target ${{ matrix.platform.target }} - name: build tests and examples shell: bash - run: cargo test --no-run --verbose --target ${{ matrix.platform.target }} + run: cargo test --no-run --verbose --features tray --target ${{ matrix.platform.target }} - name: run tests if: (!contains(matrix.platform.target, 'ios')) - run: cargo test --verbose --target ${{ matrix.platform.target }} + run: cargo test --verbose --features tray --target ${{ matrix.platform.target }} diff --git a/.github/workflows/fmt.yml b/.github/workflows/fmt.yml index 25b0126..7185736 100644 --- a/.github/workflows/fmt.yml +++ b/.github/workflows/fmt.yml @@ -15,14 +15,9 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true - components: rustfmt, clippy - - name: clippy check - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-targets -- -D warnings + components: rustfmt - name: fmt uses: actions-rs/cargo@v1 with: diff --git a/Cargo.toml b/Cargo.toml index b1a23e0..482ea85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ workspace = { } name = "wry" version = "0.12.2" authors = [ "Tauri Programme within The Commons Conservancy" ] -edition = "2018" +edition = "2021" license = "Apache-2.0 OR MIT" description = "Cross-platform WebView rendering library" readme = "README.md" @@ -22,11 +22,14 @@ targets = [ ] [features] -default = [ "file-drop", "protocol", "tray" ] +default = [ "file-drop", "protocol" ] file-drop = [ ] protocol = [ ] dox = [ "tao/dox" ] tray = [ "tao/tray" ] +ayatana = [ "tao/ayatana" ] +transparent = [ ] +fullscreen = [ ] [dependencies] libc = "0.2" @@ -36,30 +39,43 @@ serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" thiserror = "1.0" url = "2.2" -tao = { version = "0.5.2", default-features = false, features = [ "serde" ] } +tao = { version = "0.6", default-features = false, features = [ "serde" ] } http = "0.2.5" [dev-dependencies] anyhow = "1.0.43" -chrono = "0.4.19" tempfile = "3.2.0" http-range = "0.1.4" [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] -webkit2gtk = { version = "0.14", features = [ "v2_18" ] } -webkit2gtk-sys = "0.14" -gio = "0.14" -glib = "0.14" -gtk = "0.14" -gdk = "0.14" +webkit2gtk = { version = "0.17", features = [ "v2_22" ] } +webkit2gtk-sys = "0.17" +gio = "0.15" +glib = "0.15" +gtk = "0.15" +gdk = "0.15" [target."cfg(target_os = \"windows\")".dependencies] -webview2 = "0.1" -webview2-sys = "0.1" -winapi = { version = "0.3", features = [ "libloaderapi", "oleidl" ] } +webview2-com = "0.10.0" +windows_macros = "0.30.0" +sys-info = "0.9" + +[target."cfg(target_os = \"windows\")".dependencies.windows] +version = "0.30.0" +features = [ + "alloc", + "Win32_Foundation", + "Win32_Graphics_Gdi", + "Win32_System_Com", + "Win32_System_Com_StructuredStorage", + "Win32_System_Ole", + "Win32_System_SystemServices", + "Win32_UI_Shell", + "Win32_UI_WindowsAndMessaging", +] [target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies] cocoa = "0.24" core-graphics = "0.22" -objc = "0.2" +objc = { version = "0.2", features = ["exception"] } objc_id = "0.1" diff --git a/README.md b/README.md index 45e7fc9..03feaa8 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ For more information, please read the documentation below. ## Platform-specific notes -All platforms uses [tao](https://github.com/rust-windowing/tao) to build the window, and wry re-export it as application module. Here are the underlying web engine each platform uses, and some dependencies you might need to install. +All platforms uses [tao](https://github.com/tauri-apps/tao) to build the window, and wry re-export it as application module. Here are the underlying web engine each platform uses, and some dependencies you might need to install. ### Linux diff --git a/audits/Radically_Open_Security-v1-report.pdf b/audits/Radically_Open_Security-v1-report.pdf new file mode 100644 index 0000000..743d8be Binary files /dev/null and b/audits/Radically_Open_Security-v1-report.pdf differ diff --git a/bench/Cargo.toml b/bench/Cargo.toml index b41edcd..c2d3abc 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/tauri-apps/wry" [dependencies] anyhow = "1.0.43" -chrono = "0.4.19" +time = "0.3" tempfile = "3.2.0" serde_json = "1.0" serde = { version = "1.0", features = [ "derive" ] } diff --git a/bench/src/run_benchmark.rs b/bench/src/run_benchmark.rs index 8b54196..0c8806e 100644 --- a/bench/src/run_benchmark.rs +++ b/bench/src/run_benchmark.rs @@ -259,7 +259,7 @@ fn main() -> Result<()> { env::set_current_dir(&utils::bench_root_path())?; let mut new_data = utils::BenchResult { - created_at: chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true), + created_at: format!("{}", time::OffsetDateTime::now_utc()), sha1: utils::run_collect(&["git", "rev-parse", "HEAD"]) .0 .trim() diff --git a/bench/tests/src/cpu_intensive.rs b/bench/tests/src/cpu_intensive.rs index da0073a..c90c53a 100644 --- a/bench/tests/src/cpu_intensive.rs +++ b/bench/tests/src/cpu_intensive.rs @@ -12,17 +12,16 @@ fn main() -> wry::Result<()> { window::{Window, WindowBuilder}, }, http::ResponseBuilder, - webview::{RpcRequest, WebViewBuilder}, + webview::WebViewBuilder, }; let event_loop = EventLoop::new(); let window = WindowBuilder::new().build(&event_loop).unwrap(); - let handler = |_window: &Window, req: RpcRequest| { - if &req.method == "process-complete" { + let handler = |_window: &Window, req: String| { + if &req == "process-complete" { exit(0); } - None }; let webview = WebViewBuilder::new(window) .unwrap() @@ -50,7 +49,7 @@ fn main() -> wry::Result<()> { ResponseBuilder::new().mimetype(mimetype).body(data) }) .with_url("wry.bench://")? - .with_rpc_handler(handler) + .with_ipc_handler(handler) .build()?; event_loop.run(move |event, _, control_flow| { @@ -67,3 +66,4 @@ fn main() -> wry::Result<()> { } }); } + diff --git a/bench/tests/src/custom_protocol.rs b/bench/tests/src/custom_protocol.rs index a5e6b22..f8b555c 100644 --- a/bench/tests/src/custom_protocol.rs +++ b/bench/tests/src/custom_protocol.rs @@ -18,21 +18,20 @@ fn main() -> wry::Result<()> { window::{Window, WindowBuilder}, }, http::ResponseBuilder, - webview::{RpcRequest, WebViewBuilder}, + webview::WebViewBuilder, }; let event_loop = EventLoop::new(); let window = WindowBuilder::new().build(&event_loop).unwrap(); - let handler = |_window: &Window, req: RpcRequest| { - if &req.method == "dom-loaded" { + let handler = |_window: &Window, req: String| { + if &req == "dom-loaded" { exit(0); } - None }; let webview = WebViewBuilder::new(window) .unwrap() - .with_rpc_handler(handler) + .with_ipc_handler(handler) .with_custom_protocol("wry.bench".into(), move |_request| { let index_html = r#" @@ -46,7 +45,7 @@ fn main() -> wry::Result<()> {