Add --disable-features=RendererAppContainer WebView2Environment option (#30412)

This commit is contained in:
Stefan Markovic 2023-12-13 11:12:31 +01:00 committed by GitHub
parent 1daeba7e77
commit 415843f6f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 5 deletions

View File

@ -130,7 +130,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
DefaultBackgroundColor = Color.Transparent,
};
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents");
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents --disable-features=RendererAppContainer");
ConfiguredTaskAwaitable<CoreWebView2Environment>.ConfiguredTaskAwaiter
webView2EnvironmentAwaiter = CoreWebView2Environment
.CreateAsync(userDataFolder: _webView2UserDataFolder, options: webView2Options)

View File

@ -125,10 +125,13 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
InitializeIndexFileAndSelectedFile(filePath);
Logger.LogInfo("Create WebView2 environment");
var webView2Options = new CoreWebView2EnvironmentOptions("--disable-features=RendererAppContainer");
ConfiguredTaskAwaitable<CoreWebView2Environment>.ConfiguredTaskAwaiter
webView2EnvironmentAwaiter = CoreWebView2Environment
.CreateAsync(userDataFolder: System.Environment.GetEnvironmentVariable("USERPROFILE") +
"\\AppData\\LocalLow\\Microsoft\\PowerToys\\MonacoPreview-Temp")
.CreateAsync(
userDataFolder: System.Environment.GetEnvironmentVariable("USERPROFILE") +
"\\AppData\\LocalLow\\Microsoft\\PowerToys\\MonacoPreview-Temp",
options: webView2Options)
.ConfigureAwait(true).GetAwaiter();
webView2EnvironmentAwaiter.OnCompleted(async () =>
{

View File

@ -225,7 +225,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
_browser.Dock = DockStyle.Fill;
// Prevent new windows from being opened.
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents");
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents --disable-features=RendererAppContainer");
ConfiguredTaskAwaitable<CoreWebView2Environment>.ConfiguredTaskAwaiter
webView2EnvironmentAwaiter = CoreWebView2Environment
.CreateAsync(userDataFolder: _webView2UserDataFolder, options: webView2Options)

View File

@ -142,7 +142,7 @@ namespace Microsoft.PowerToys.ThumbnailHandler.Svg
thumbnailDone.Set();
};
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents");
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents --disable-features=RendererAppContainer");
ConfiguredTaskAwaitable<CoreWebView2Environment>.ConfiguredTaskAwaiter
webView2EnvironmentAwaiter = CoreWebView2Environment
.CreateAsync(userDataFolder: _webView2UserDataFolder, options: webView2Options)