From b8437c8f7031c676349cd8f6597d28376c76e059 Mon Sep 17 00:00:00 2001 From: Kilian Valkhof Date: Mon, 2 Jun 2025 17:04:32 +0200 Subject: [PATCH 1/2] add note about requiring sandbox --- packages/electron-chrome-extensions/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/electron-chrome-extensions/README.md b/packages/electron-chrome-extensions/README.md index cfa26254..a02ec12a 100644 --- a/packages/electron-chrome-extensions/README.md +++ b/packages/electron-chrome-extensions/README.md @@ -79,8 +79,9 @@ app.whenReady().then(() => { webPreferences: { // Same session given to Extensions class session: browserSession, - // Recommended options for loading remote content + // required for extensions to work sandbox: true, + // Recommended for loading remote content contextIsolation: true, }, }) @@ -491,6 +492,7 @@ See [Electron's Notification tutorial](https://www.electronjs.org/docs/tutorial/ - Usage of Electron's `webRequest` API will prevent `chrome.webRequest` listeners from being called. - Chrome extensions are not supported in non-persistent/incognito sessions. - `chrome.webNavigation.onDOMContentLoaded` is only emitted for the top frame until [support for iframes](https://github.com/electron/electron/issues/27344) is added. +- Extensions will only work if Electrons sandbox is enabled. This is the default behavior but might be overridden by the `--no-sandbox` flag or `sandbox: false` in the `webPreferences` of a `BrowserWindow`. Check for the `--no-sandbox` flag using `ps -eaf | grep `. ## License From 823844ea78b4de52320d3a90a79791e55f726f22 Mon Sep 17 00:00:00 2001 From: Samuel Maddock Date: Mon, 16 Jun 2025 22:52:20 -0400 Subject: [PATCH 2/2] clarify --- packages/electron-chrome-extensions/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/electron-chrome-extensions/README.md b/packages/electron-chrome-extensions/README.md index a02ec12a..81afbf46 100644 --- a/packages/electron-chrome-extensions/README.md +++ b/packages/electron-chrome-extensions/README.md @@ -77,9 +77,9 @@ app.whenReady().then(() => { const browserWindow = new BrowserWindow({ webPreferences: { - // Same session given to Extensions class + // Use same session given to Extensions class session: browserSession, - // required for extensions to work + // Required for extension preload scripts sandbox: true, // Recommended for loading remote content contextIsolation: true, @@ -492,7 +492,7 @@ See [Electron's Notification tutorial](https://www.electronjs.org/docs/tutorial/ - Usage of Electron's `webRequest` API will prevent `chrome.webRequest` listeners from being called. - Chrome extensions are not supported in non-persistent/incognito sessions. - `chrome.webNavigation.onDOMContentLoaded` is only emitted for the top frame until [support for iframes](https://github.com/electron/electron/issues/27344) is added. -- Extensions will only work if Electrons sandbox is enabled. This is the default behavior but might be overridden by the `--no-sandbox` flag or `sandbox: false` in the `webPreferences` of a `BrowserWindow`. Check for the `--no-sandbox` flag using `ps -eaf | grep `. +- Service worker preload scripts require Electron's sandbox to be enabled. This is the default behavior, but might be overridden by the `--no-sandbox` flag or `sandbox: false` in the `webPreferences` of a `BrowserWindow`. Check for the `--no-sandbox` flag using `ps -eaf | grep `. ## License