mirror of
https://github.com/electron/electron.git
synced 2026-10-28 11:44:46 +08:00
* fix: report tab ids to extension webRequest and declarativeNetRequest ElectronExtensionsBrowserClient did not override GetTabAndWindowIdForWebContents, so the default of -1 reached every caller: chrome.webRequest reported details.tabId as -1 and declarativeNetRequest rules with a tabIds condition never matched. Return the WebContents id, the same id chrome.tabs uses. Co-Authored-By: Claude <noreply@anthropic.com> * fix: keep extension service workers registered when clearing storage Chrome's embedder refuses to delete or web-update the registration of an extension's background service worker and only lets the manifest's worker script register at the extension's root scope. Electron used the content defaults, so session.clearStorageData() deleted the registration and the extension stopped receiving events until it was reloaded. Override MayDeleteServiceWorkerRegistration, ShouldTryToUpdateServiceWorkerRegistration and AllowServiceWorker to match. Co-Authored-By: Claude <noreply@anthropic.com> * fix: crash in chrome.cookies.getAllCookieStores The cookies API now lives in //extensions, so extensions with the "cookies" permission can call it in Electron. Core code dereferences ExtensionsAPIClient::GetCookiesApiDelegate(), which Electron did not provide, crashing the browser process, and the CookiesAPI factory that dispatches cookies.onChanged is only built by embedders. Provide a delegate that lists the session as its own cookie store and build the factory. Co-Authored-By: Claude <noreply@anthropic.com> * fix: restore the management permission feature The "management" entry was dropped from Electron's permission features when the file was resynced with Chrome's in #44653. The management API feature depends on it, so a manifest requesting the permission lost it and chrome.management.getAll, get, onEnabled and onDisabled were unavailable. Co-Authored-By: Claude <noreply@anthropic.com> * fix: localize messages in extension stylesheets Chromium substitutes __MSG_*__ placeholders in extension CSS with a renderer URL loader throttle that only Chrome's throttle provider installs. Electron had no provider, so placeholders such as __MSG_@@extension_id__ were left as literal text. Install the throttle from RendererClientBase. Co-Authored-By: Claude <noreply@anthropic.com> * fix: let WebSocket activity keep extension service workers alive Chrome forwards ShouldNotifyServiceWorkerOnWebSocketActivity to the extensions dispatcher so traffic on a WebSocket resets an extension service worker's idle timer. Electron did not, so a worker holding an open socket was still stopped after 30 seconds. Co-Authored-By: Claude <noreply@anthropic.com> * fix: keep sandboxed extension frames out of the extension process map Chrome isolates only manifest-sandboxed extension pages (and sandboxed about:srcdoc and data: documents) in a separate process and leaves that process out of the extension ProcessMap, so it cannot be granted extension API access. Electron isolated every sandboxed extension frame and recorded each of those processes as a privileged extension process. Override ShouldAllowCrossProcessSandboxedFrameForPrecursor and skip sandboxed principals in SiteInstanceGotProcessAndSite to match. Co-Authored-By: Claude <noreply@anthropic.com> * fix: support navigator.clipboard in extension service workers Chromium exposes navigator.clipboard to extension service workers, but every piece that enables it lives in Chrome's embedder. Register chrome-extension as an extension scheme with Blink, pass --extension-process to extension renderers and turn the runtime feature on there, and answer IsClipboardAllowedForServiceWorker and AllowWorkerWriteToClipboard in the browser. Writes still require the clipboardWrite permission. Co-Authored-By: Claude <noreply@anthropic.com> * fix: run the extension service worker script on disk after a restart A service worker registration outlives the app, and Chromium trusts a stored registration as current while the extension's version is unchanged. Electron loads unpacked extensions on every launch, so an extension whose files changed without a version bump kept running the worker script from the launch that first registered it. Unregister a worker left by a previous launch before adding the extension so it is registered again from the files being loaded. Co-Authored-By: Claude <noreply@anthropic.com> * fix: persist extension alarms and dynamic content scripts ElectronExtensionSystem returned null for the state, rules and dynamic user scripts stores, so chrome.alarms and content scripts registered with persistAcrossSessions were forgotten when the app quit. Create the three StateStores as Chrome's extension system does. Co-Authored-By: Claude <noreply@anthropic.com> * fix: report webRequest proxying to the service worker loader content asks HasWebRequestAPIProxy before starting a service worker AutoPreload request, because a preload that is raced and dropped is reported to webRequest listeners as a failed request. Answer for both Electron's webRequest module and extensions that proxy requests. Co-Authored-By: Claude <noreply@anthropic.com> * fix: use the app name in extension warnings ElectronExtensionsClient::GetProductName still returned "app_shell", the name of the Chromium embedder it was copied from, which extension warning messages interpolate. Co-Authored-By: Claude <noreply@anthropic.com> * chore: remove stale extension feature entries These keys name permissions, manifest keys and API functions that Chromium has removed or that Electron's schemas do not define, so they matched nothing. Co-Authored-By: Claude <noreply@anthropic.com> * docs: update extension support notes The background key is supported for Manifest V3 service workers too, and chrome.management needs the management permission. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
Official Guides
Please make sure that you use the documents that match your Electron version. The version number should be a part of the page URL. If it's not, you are probably using the documentation of a development branch which may contain API changes that are not compatible with your Electron version. To view older versions of the documentation, you can browse by tag on GitHub by opening the "Switch branches/tags" dropdown and selecting the tag that matches your version.
FAQ
There are questions that are asked quite often. Check this out before creating an issue:
Guides and Tutorials
Getting started
Learning the basics
- Adding Features to Your App
- Notifications
- Recent Documents
- Application Progress
- Custom Dock Menu
- Custom Windows Taskbar
- Custom Linux Desktop Actions
- Keyboard Shortcuts
- Offline/Online Detection
- Represented File for macOS BrowserWindows
- Native File Drag & Drop
- Navigation History
- Window State Persistence
- Offscreen Rendering
- Dark Mode
- Web embeds in Electron
Advanced steps
- Application Architecture
- Accessibility
- Testing and Debugging
- Distribution
- Updates
- Getting Support
Detailed Tutorials
These individual tutorials expand on topics discussed in the guide above.
- Installing Electron
- Electron Releases & Developer Feedback
API References
- Process Object
- Supported Command Line Switches
- Environment Variables
- Chrome Extensions Support
- Breaking API Changes
Custom Web Features:
Modules for the Main Process:
- app
- autoUpdater
- BaseWindow
- BrowserWindow
- contentTracing
- desktopCapturer
- dialog
- globalShortcut
- inAppPurchase
- ImageView
- ipcMain
- Menu
- MenuItem
- MessageChannelMain
- MessagePortMain
- nativeTheme
- net
- netLog
- Notification
- powerMonitor
- powerSaveBlocker
- protocol
- pushNotifications
- safeStorage
- screen
- ServiceWorkerMain
- session
- ShareMenu
- systemPreferences
- TouchBar
- Tray
- utilityProcess
- View
- webContents
- webFrameMain
- WebContentsView
Modules for the Renderer Process (Web Page):
Modules for Both Processes:
- clipboard (non-sandboxed renderers only)
- crashReporter
- nativeImage
- shell (non-sandboxed renderers only)