OpenWebView2Loader icon indicating copy to clipboard operation
OpenWebView2Loader copied to clipboard

Loading preference: Machine-User or User-Machine?

Open stffabi opened this issue 3 years ago • 2 comments

During porting of the loader to Go for Wails, I've encountered some inconsistency between the implementation and the official documentation.

In the official docs of CreateCoreWebView2EnvironmentWithOptions Microsoft states:

pass a null or empty string to browserExecutableFolder. In this scenario, the API tries to find a compatible version of the WebView2 Runtime that is installed on the user machine (first at the machine level, and then per user) using the selected channel preference.

But currently OpenWebView2Loader first tries to load at user level and then machine level: https://github.com/jchv/OpenWebView2Loader/blob/fb3a1687029b986b235dc64d98b395d0cd581494/Source/WebView2Loader.cpp#L751-L761

https://github.com/jchv/OpenWebView2Loader/blob/fb3a1687029b986b235dc64d98b395d0cd581494/Source/WebView2Loader.cpp#L708-L718

@jchv do you possibly remember what the behaviour of the original loader was?

stffabi avatar Sep 27 '22 07:09 stffabi

I've tested the original Microsoft implementation. The loader first searches at the machine level and if there's a WebView2 installed that one will be used, if not then per user is searched.

So the following exempt from the official docs is correct and the current OpenWebView2Loader behaves currently the other way around:

pass a null or empty string to browserExecutableFolder. In this scenario, the API tries to find a compatible version of the WebView2 Runtime that is installed on the user machine (first at the machine level, and then per user) using the selected channel preference.

stffabi avatar Oct 12 '22 07:10 stffabi

This could've been a mistake on my part, or potentially just a bug in an older version of WebView2Loader. I'm not sure anymore. Sorry, I've been wanting to look into this, but just haven't really found the time lately.

jchv avatar Oct 15 '22 00:10 jchv