mirror of
https://github.com/electron/electron.git
synced 2026-10-28 11:44:46 +08:00
* feat: support chrome.storage.sync in extensions Register a ValueStoreCache for the SYNC settings namespace from ElectronExtensionsAPIClient::AddAdditionalValueStoreCaches. Until now Electron never overrode that hook, so StorageFrontend only knew about LOCAL (and the in-memory SESSION area) and every chrome.storage.sync call failed with '"sync" is not available in this instance of Chrome'. ElectronSyncValueStoreCache mirrors Chromium's LocalValueStoreCache but uses settings_namespace::SYNC, which gives it its own LevelDB directory under the partition path (kSyncExtensionSettingsDirectoryName), so sync and local never alias. It enforces the chrome.storage.sync quotas from extensions/common/api/storage.json (QUOTA_BYTES 102400, QUOTA_BYTES_PER_ITEM 8192, MAX_ITEMS 512); the per-minute and per-hour write limits are already applied to kSync by storage_api.cc. There is no sync service in Electron, so the area behaves like Chrome with sync disabled: a second local store with no cross-device sync. chrome.storage.managed stays unsupported because there is no policy source to back it. This answers the question raised on #53995 about supporting chrome.storage instead of dropping sync from the test fixture. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFucMLGyVVqSUAKXrqbaUT * fix: include value_store_factory.h in ElectronExtensionsAPIClient The linux-x64 and linux-x64-ubsan builds failed compiling electron_extensions_api_client.cc: ../../base/memory/scoped_refptr.h:398:6: error: member access into incomplete type 'value_store::ValueStoreFactory' ../../base/memory/scoped_refptr.h:405:6: error: member access into incomplete type 'value_store::ValueStoreFactory' note: in instantiation of ... requested here electron_extensions_api_client.cc:97:39: new ElectronSyncValueStoreCache(factory); AddAdditionalValueStoreCaches copies the scoped_refptr<value_store::ValueStoreFactory> into the new ElectronSyncValueStoreCache, which instantiates AddRef/Release on the pointee. extensions_api_client.h and electron_sync_value_store_cache.h only forward-declare ValueStoreFactory, so the translation unit needs the full definition. Include components/value_store/value_store_factory.h the same way chrome_extensions_api_client.cc does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFucMLGyVVqSUAKXrqbaUT * test: use vitest matchers in chrome.storage.sync spec main dropped chai in favour of vitest's own matchers and now lints against chai-style chains, so convert the chrome.storage.sync spec's assertions to the equivalent vitest matchers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFucMLGyVVqSUAKXrqbaUT --------- 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)