ac4af582301a4e8a29245dbba767eba31334ddf9
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3608ed782e |
gui: WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS reaches magpie's WebView2 on Windows again (#2753, LuYquan)
The reporter's Nahimic DLL gets WebView2's renderer killed by code
integrity and the window goes black; the usual workaround,
WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--disable-features=RendererCodeIntegrity,
never reached magpie's renderer. The cause is not WebView2 skipping the
variable because magpie passes its own arguments: Wails v3.0.0-beta.24's
loader blanks the variable in its package init
(webviewloader.preventEnvAndRegistryOverrides), before any magpie code
runs. Seen on the Windows box: a debug build's windowsOptions read "".
- internal/webview2env reads the variable at init. It imports only
syscall, so by Go's init order (first ready package by import path)
it is initialized before os, and so before Wails' loader, which needs
os.
- windowsOptions sorts it into Wails' DisabledFeatures, EnabledFeatures
and AdditionalBrowserArgs. Wails writes msSmartScreenProtection plus
the user's features as one --disable-features (Chromium keeps only
the last of two), one --enable-features, and the rest as written.
A list given twice is merged, each feature once.
- Nothing is added by default: RendererCodeIntegrity stays on unless
the user asks.
ProcessFailed: not done. Wails' edge.Chromium has a ProcessFailedCallback,
but setupChromium never sets it, the package is under wails/v3/internal
(not importable) and a window's chromium is unexported; Wails has no
public event for a dead renderer. Reloading on renderer death needs a
change in Wails.
Run:
- gofmt -l: clean. go vet darwin, GOOS=linux -tags nogui, GOOS=windows:
clean. Builds for the three.
- go test ./internal/gui -run 'TestWebView2|TestWindowsOptions' on
macOS, and the windows/amd64 test binary on the Windows box (sandbox
dir, my own process name): TestWebView2ArgsSurviveWailsInit passes
there with os="" (Wails blanked it) and disabled=[RendererCodeIntegrity].
- The real app on the Windows box (portable sandbox, MAGPIE_ADDR :3481,
USERPROFILE/APPDATA/LOCALAPPDATA redirected) started with
"--disable-features=RendererCodeIntegrity --enable-features=msTestFoo
--lang=de": every msedgewebview2.exe of it carries one
--disable-features with both features, --enable-features=msTestFoo
and --lang=de. Before, the same launch showed only
--disable-features=msSmartScreenProtection and --lang=zh-CN.
Broken by hand:
- windowsOptions reading os.Getenv instead of webview2env.Args: on the
Windows box TestWebView2ArgsSurviveWailsInit goes red
(os="" disabled=[]).
- webView2Args ignoring the env (""): TestWebView2ArgsMergeTheUsers red
in "the reporter's" and "twice".
- --disable-features treated as an other argument: red in three cases,
including the one-switch count.
Full suite at origin/main
|