Skip to content

Commit

Permalink
Merge next back to dev branch (#477)
Browse files Browse the repository at this point in the history
* refactor: remove unnecessary private mod shared (#400)

* refactor: remove unnecessary private mod shared

* chore: make fmt happy

* refactor: use eventloop proxy in `custom_titlebar` example (#401)

* Switch to tauri-webview2 (#411)

* Switch to tauri-webview2

This is a temporary fix of null pointer crash on `get_content` of web resource request. We will switch it back once upstream is updated.

* Add change file

* fix: remove clipboard property for consistency across platforms (#412)

* Remove clipboard property for consistancy across platforms

* Remove clipboard property for consistency

* feat: add inner_size for webview struct (#394)

* Add inner_size method

* Add inner_size for webview

* Fix feature flag placement

* Add feature flag on inner_size

* Cargo fmt

* feat(linux): allow resizing undecorated window using touch, closes #399 (#402)

* feat(linux): allow resizing undecorated window using touch
closes #399

* fix windows

* update custom_titlebar example

* revert windows changes

* Implement WebContextImpl on mac (#372)

* Implement WebContextImpl on mac

* Update type visibility

* Update cfg declaration

* Move WebContextImpl to wkwebview

* Fix protocol signature

* Add missing feature flag

* Cargo fmt

* Add change file

* Replace winapi with windows crate and use webview2-com instead of webview2 (#414)

* Add Windows and webview2-com  crates

* Replace winapi and webview2-sys with webview2-com

* Get all the examples working with webview2-com

* Point to the published version of webview2-com

* Add a summary in .changes

* Remove extra projects not in config.json

* Run cargo fmt --all

* Fix clippy warnings

* Update to 32-bit compatible webview2-com

* Sync with refactor in next branch of tao

* Use path prefix to prevent variable shadowing

* Fix Linux nightly/stable clippy warnings

* Update to latest review feedback in TAO

* Replace tao dependency with git+branch

* Switch to next branch of upstream tao repo

* doc: add warning doc on webcontext and ptr detections (#419)

* Add warning doc on webcontext and ptr detections

* cargo fmt

* Move Unix's webcontext implementation to webkitgtk (#421)

* chore: add `on_issue_closed.yml` (#424)

* Update webkit2gtk to 0.15 (#429)

* Update webkit2gtk

* Update webkit2gtk to 0.15

* Add changes file

* fix: add feature flags to toggle private APIs (#431)

* Add transparent feature flag

* Add flag for video fullscreen on macOS

* Add change file

* Make clippy happy

* Add clipboard field in WebViewAttributes (#432)

* fix(webview/linux): Use a workaround to fix CORS ... (#435)

... when making XHR requests inside a custom URI scheme context.

Reference: https://github.com/WebKit/WebKit/blob/9b6eae32a61d94be9963ef60d73a6d378099a97d/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp#L82-L91

* Delete on_issue_closed.yml (#436)

* Enable secure context back (#438)

* Disable all option on custom url scheme for now

* Enable secure context back

* fix link to tao repo (#439)

* fix(deps): update rust crate http to 0.2.5 (#416)

Co-authored-by: Renovate Bot <[email protected]>

* fix link to tao

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <[email protected]>

* chore: remove unused files (#440)

* Update webview2-com and windows crates (#446)

* Replace webivew2-com-sys with prebuilt windows

* Bump to latest versions

* Set file drop handler after window creation

* Point tao back to the upstream next branch

* Rerun cargo fmt and fix Windows clippy warnings

* Add changelog file

* Use aliases for webview2_com instead of windows

* Use time instead of chrono (#447)

* Use time instead of chrono

* Make clippy happy

* fix(macos): unsupported key feedback sound (#448)

* fix(macos): unsupported key feedback sound, closes #

* Fix scope of YES

Co-authored-by: Yu-Wei Wu <[email protected]>

* Revert "fix(macos): unsupported key feedback sound (#448)"

This reverts commit b8fdfd6.

* Use tao commit with windows 0.25

* Switch back to tao's next branch

* feat: enable cookie persistence on Linux (#453)

* feat: enable cookie persistence on Linux

* fmt

* Bump webkit2gtk version (#457)

* Update windows crate to 0.29.0 and webview2-com to 0.9.0 (#455)

* Update to windows 0.29.0

* Add change description

* Update tao dependency (#461)

* fix: ignore transparency on Windows 7 (#460)

* fix: ignore transparency on Windows 7

* Update Cargo.toml

Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <[email protected]>

* Remove clippy check (#462)

* chore: update PR template

* Fix: #276 - Add ability to set custom User Agent (#464)

* feat: Custom user agent attribute

Included example

* Fix setting type on Windows

Co-authored-by: Adit Sachde <[email protected]>
Co-authored-by: Wu Yu Wei <[email protected]>

* Add support of `HTTPBodyStream` (#465)

* Update to 2021 edition (#466)

* Update windows crate to 0.30.0

* change tao dep

* remove "tray" from default features and allow using "ayatana" instead (#469)

The "tray" feature enables dependency on libappindicator3.

On Debian 11 (and some other systems), libappindicator3 was
removed and replaced with libayatana-appindicator3:
  https://www.debian.org/releases/bullseye/amd64/release-notes/ch-information.en.html#noteworthy-obsolete-packages

This new library can be used by enabling the "ayatana" feature.

Depending on the system, only one of those library will usually
be available, and thus, only one of the "tray" and "ayatana"
feature would compile fine.

Having "tray" in default features did prevent building on systems
with no libappindicator3 available.

* Update tray examples (#470)

* chore: update pull request commit exmple

* feat: enable objc's exception feature [TRI-039]

* refactor: IPC handler [TRI-019]

* Feat/isolation (#5)

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <[email protected]>
Co-authored-by: Yu-Wei Wu <[email protected]>
Co-authored-by: Adit Sachde <[email protected]>
Co-authored-by: Wu Yu Wei <[email protected]>
Co-authored-by: Amr Bashir <[email protected]>
Co-authored-by: Bogdan Bivolaru <[email protected]>
Co-authored-by: Bill Avery <[email protected]>
Co-authored-by: Lucas Fernandes Nogueira <[email protected]>
Co-authored-by: Lucas Fernandes Nogueira <[email protected]>
Co-authored-by: amrbashir <[email protected]>
Co-authored-by: Chip Reed <[email protected]>
Co-authored-by: Jhonatan A <[email protected]>

* chore: fix Linux clippy warnings

* chore(audit): add report

* fix: windows build

* Update gtk to 0.15 (#472)

* chore: new `multi_window` example, closes #459 (#476)

* chore: new `multi_window` example, closes #459

* revert license change

Co-authored-by: Jason <[email protected]>
Co-authored-by: Amr Bashir <[email protected]>
Co-authored-by: Bill Avery <[email protected]>
Co-authored-by: liushuyu <[email protected]>
Co-authored-by: Bogdan Bivolaru <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Lucas Fernandes Nogueira <[email protected]>
Co-authored-by: Lucas Fernandes Nogueira <[email protected]>
Co-authored-by: amrbashir <[email protected]>
Co-authored-by: Jhonatan A <[email protected]>
Co-authored-by: Adit Sachde <[email protected]>
Co-authored-by: Michael Alyn Miller <[email protected]>
Co-authored-by: Bill Avery <[email protected]>
Co-authored-by: Aurélien Jacobs <[email protected]>
Co-authored-by: Chip Reed <[email protected]>
  • Loading branch information
17 people authored Feb 5, 2022
1 parent 3a6eefa commit 219d20c
Show file tree
Hide file tree
Showing 52 changed files with 1,711 additions and 1,547 deletions.
5 changes: 5 additions & 0 deletions .changes/15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": minor
---

Update gtk to 0.15
6 changes: 6 additions & 0 deletions .changes/clipboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"wry": patch
---

Add clipboard field in WebViewAttributes.

5 changes: 5 additions & 0 deletions .changes/fix-windows7-runtime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Ignore transparency on Windows 7 to prevent application crash.
5 changes: 5 additions & 0 deletions .changes/linux-clipboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Remove clipboard property for consistency across platforms.
5 changes: 5 additions & 0 deletions .changes/linux-cookie-storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Enable cookie persistence on Linux if the `data_directory` is provided.
6 changes: 6 additions & 0 deletions .changes/mac-exception.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"wry": patch
---

Enable objc's exception features so they can be treated as panic message.

5 changes: 5 additions & 0 deletions .changes/mac-inner-size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Add inner size method for webview. This can reflect correct size of webview on macOS.
6 changes: 6 additions & 0 deletions .changes/mac-priv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"wry": patch
---

Add "transparent" and "fullscreen" featrue flags on macOS to toggle private API.

6 changes: 6 additions & 0 deletions .changes/mac-webcontext.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"wry": patch
---

Implement WebContextImpl on mac to extend several callback lifetimes.

6 changes: 6 additions & 0 deletions .changes/remove-shared-mod.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions .changes/resizing-undecorated-window-touch.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions .changes/webkit2gtk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"wry": patch
---

Update webkit2gtk to 0.15

4 changes: 4 additions & 0 deletions .changes/webview-user-agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"wry": minor
---
Add `with_user_agent(&str)` to `WebViewBuilder`.
5 changes: 5 additions & 0 deletions .changes/webview2-com.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions .changes/webview2-null.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions .changes/windows-0.25.0.md
Original file line number Diff line number Diff line change
@@ -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`.
5 changes: 5 additions & 0 deletions .changes/windows-0.29.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Update the `windows` crate to 0.29.0 and `webview2-com` to 0.9.0.
5 changes: 5 additions & 0 deletions .changes/windows-0.30.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Update the `windows` crate to 0.30.0 and `webview2-com` to 0.10.0.
34 changes: 14 additions & 20 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
<!--
Please make sure to read the Pull Request Guidelines:
https://github.com/tauri-apps/tauri/blob/dev/.github/CONTRIBUTING.md#pull-request-guidelines
-->
Update "[ ]" to "[x]" to check a box
<!-- PULL REQUEST TEMPLATE -->
<!-- (Update "[ ]" to "[x]" to check a box) -->
Please make sure to read the Pull Request Guidelines: https://github.com/tauri-apps/tauri/blob/dev/.github/CONTRIBUTING.md#pull-request-guidelines
-->

**What kind of change does this PR introduce?** (check at least one)
### What kind of change does this PR introduce?
<!-- Check at least one. If you are introducing a new binding, you must reference an issue where this binding has been proposed, discussed and approved by the maintainers. -->

- [ ] 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)
<!--
If yes, please describe the impact and migration path for existing applications in an attached issue. Filing a PR with breaking changes that has not been discussed and approved by the maintainers in an issue will be immediately closed.
-->
### Does this PR introduce a breaking change?
<!-- If yes, please describe the impact and migration path for existing applications in an attached issue. -->

- [ ] 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
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
9 changes: 2 additions & 7 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
44 changes: 30 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file added audits/Radically_Open_Security-v1-report.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ] }
Expand Down
2 changes: 1 addition & 1 deletion bench/src/run_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions bench/tests/src/cpu_intensive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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| {
Expand All @@ -67,3 +66,4 @@ fn main() -> wry::Result<()> {
}
});
}

11 changes: 5 additions & 6 deletions bench/tests/src/custom_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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#"
<!DOCTYPE html>
Expand All @@ -46,7 +45,7 @@ fn main() -> wry::Result<()> {
<h1>Welcome to WRY!</h1>
<script>
document.addEventListener('DOMContentLoaded', () => {
rpc.call('dom-loaded')
ipc.postMessage('dom-loaded')
})
</script>
</body>
Expand Down
Loading

0 comments on commit 219d20c

Please sign in to comment.