Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/api/browser-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
OS-level sandbox and disabling the Node.js engine. This is not the same as
the `nodeIntegration` option and the APIs available to the preload script
are more limited. Read more about the option [here](../tutorial/sandbox.md).
Defaults to `false` if `nodeIntegration: true` is specified or a
`preload` is specified, otherwise defaults to `true`.
* `session` [Session](session.md#class-session) (optional) - Sets the session used by the
page. Instead of passing the Session object directly, you can also choose to
use the `partition` option instead, which accepts a partition string. When
Expand Down
7 changes: 6 additions & 1 deletion shell/browser/web_contents_preferences.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ WebContentsPreferences::WebContentsPreferences(
SetDefaultBoolIfUndefined(options::kNodeIntegrationInWorker, false);
SetDefaultBoolIfUndefined(options::kDisableHtmlFullscreenWindowResize, false);
SetDefaultBoolIfUndefined(options::kWebviewTag, false);
SetDefaultBoolIfUndefined(options::kSandbox, false);
base::FilePath preload_path;
bool has_preload = GetPreloadPath(&preload_path);
bool sandbox_disabled_by_default =
IsEnabled(options::kNodeIntegration) ||
IsEnabled(options::kNodeIntegrationInWorker) || has_preload;
SetDefaultBoolIfUndefined(options::kSandbox, !sandbox_disabled_by_default);
SetDefaultBoolIfUndefined(options::kNativeWindowOpen, true);
SetDefaultBoolIfUndefined(options::kContextIsolation, true);
SetDefaultBoolIfUndefined(options::kJavaScript, true);
Expand Down