IDEA-284121: windows sandbox initialization in JBCefApp

GitOrigin-RevId: 020e2a25658eea58f6aea4d2ba1bd604c1f73be8
This commit is contained in:
artem.bochkarev
2023-01-17 15:25:37 +00:00
committed by intellij-monorepo-bot
parent a684c7c39f
commit 099b26f082
@@ -153,8 +153,23 @@ public final class JBCefApp {
settings.cache_path = ApplicationManager.getApplication().getService(JBCefAppCache.class).getPath().toString();
if (Registry.is("ide.browser.jcef.sandbox.enable")) {
LOG.debug("enabled JCEF-sandbox");
LOG.info("JCEF-sandbox is enabled");
settings.no_sandbox = false;
if (SystemInfoRt.isWindows) {
String sandboxPtr = System.getProperty("jcef.sandbox.ptr");
if (sandboxPtr != null && !sandboxPtr.trim().isEmpty()) {
if (isSandboxSupported())
settings.browser_subprocess_path = "";
else {
LOG.info("JCEF-sandbox was disabled because current jcef version doesn't support sandbox");
settings.no_sandbox = true;
}
} else {
LOG.info("JCEF-sandbox was disabled because java-process initialized without sandbox");
settings.no_sandbox = true;
}
}
}
String[] argsFromProviders = JBCefAppRequiredArgumentsProvider
@@ -224,6 +239,18 @@ public final class JBCefApp {
};
}
private static boolean isSandboxSupported() {
JCefVersionDetails version;
try {
version = JCefAppConfig.getVersionDetails();
}
catch (Throwable e) {
LOG.error("JCEF runtime version is not supported");
return false;
}
return version.cefVersion.major >= 104 && version.apiVersion.minor >= 9;
}
@NotNull
Disposable getDisposable() {
return myDisposable;