EdgeHTML: webview.eval inconsistent during startup
- Dominant language
- JavaScript
- Stars
- 2k
- Forks
- 179
- PR merge metrics
- No merged PRs in 30d
Description
Executing webview.eval during startup is inconsistent, the js code may or may not run.
We are discussing this issue on tauri [here](https://github.com/tauri-apps/tauri/issues/212). Test code below: expect 1000 `
` nodes to be added, but node 0 is not reliably inserted.
This was tested in 0.5.4 and 0.6.0. This may or may not be related to c++ async code handling [here](https://github.com/Boscop/web-view/blob/master/webview-sys/webview_edge.cpp#L308)
```rs
use web_view::*;
fn main() {
let webview = web_view::builder()
.title("Example")
.content(Content::Html(HTML))
.size(800, 600)
.resizable(true)
.debug(true)
.user_data(0)
.invoke_handler(|_webview, _arg| {
Ok(())
})
.build()
.unwrap();
let handle = webview.handle();
for i in 0..1000 {
handle.dispatch(move |webview| {
webview.eval(&format!("document.body.appendChild(document.createElement('p')).appendChild(document.createTextNode('Item {}'))", i))
}).unwrap();
}
webview.run().unwrap();
}
const HTML: &str = r#"
Hello World!
"#;
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the supplied Rust program with the EdgeHTML backend and check whether all 1,000 paragraph nodes are inserted during startup. Then inspect webview-sys/webview_edge.cpp around line 308, including the referenced C++ async handling; done means node 0 and the remaining nodes are inserted reliably.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rust
- Domain
- desktop, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100