├── .nvmrc ├── patches ├── webrtc │ └── .patches ├── ffmpeg │ └── .patches ├── Mantle │ └── .patches ├── perfetto │ └── .patches ├── README.md ├── angle │ └── .patches ├── devtools_frontend │ └── .patches ├── nan │ └── .patches ├── ReactiveObjC │ └── .patches ├── boringssl │ └── .patches └── squirrel.mac │ └── .patches ├── script ├── lib │ ├── __init__.py │ ├── electron.gitattributes │ └── npm.py ├── codesign │ ├── .gitignore │ ├── get-trusted-identity.sh │ └── codesign.cnf ├── release │ └── notes │ │ └── .gitignore ├── native-test-targets.json ├── print-version.py ├── gn-asar-hash.js ├── generate-zip-manifest.py └── run-if-exists.js ├── spec ├── fixtures │ ├── blank.png │ ├── blank.html │ ├── pages │ │ ├── blank.html │ │ ├── service-worker │ │ │ ├── empty.html │ │ │ ├── worker-no-node.js │ │ │ └── service-worker.js │ │ ├── fullscreen.html │ │ ├── save_page │ │ │ ├── test.css │ │ │ ├── test.js │ │ │ └── index.html │ │ ├── external-string.html │ │ ├── base-page.html │ │ ├── pdf-in-iframe.html │ │ ├── jquery.html │ │ ├── webview-isolated.html │ │ ├── webview-visibilitychange.html │ │ ├── theme-color.html │ │ ├── webview-no-script.html │ │ ├── webview-zoom-factor.html │ │ ├── useragent.html │ │ ├── will-navigate.html │ │ ├── b.html │ │ ├── ping.html │ │ ├── webview-stripped-preload.html │ │ ├── e.html │ │ ├── partition │ │ │ └── one.html │ │ ├── window-opener-postMessage.html │ │ ├── permissions │ │ │ ├── geolocation.html │ │ │ ├── midi.html │ │ │ ├── midi-sysex.html │ │ │ ├── media.html │ │ │ └── notification.html │ │ ├── form-with-data.html │ │ ├── ipc-message.html │ │ ├── set-global.html │ │ ├── window-open.html │ │ ├── window-open-size.html │ │ ├── base-page-security.html │ │ ├── cache-storage.html │ │ ├── storage │ │ │ ├── cookie.html │ │ │ ├── local_storage.html │ │ │ ├── session_storage.html │ │ │ ├── indexed_db.html │ │ │ └── web_sql.html │ │ ├── window-opener-node.html │ │ ├── webview-did-navigate-in-page-with-hash.html │ │ ├── window-no-javascript.html │ │ ├── webview-allowpopups.html │ │ ├── webview-did-navigate-in-page-with-history.html │ │ ├── send-after-node.html │ │ ├── onmouseup.html │ │ ├── webview-trusted-types.html │ │ ├── insecure-resources.html │ │ ├── close.html │ │ ├── history.html │ │ ├── native-module.html │ │ ├── onkeyup.html │ │ ├── zoom-factor.html │ │ ├── d.html │ │ ├── webframe-zoom.html │ │ ├── window-open-hide.html │ │ ├── window-opener-location.html │ │ ├── dom-ready.html │ │ ├── webview-will-navigate.html │ │ ├── base-page-security-onload-message.html │ │ ├── datalist-time.html │ │ ├── world-safe-preload.js │ │ ├── post.html │ │ ├── window-opener.html │ │ ├── c.html │ │ ├── window-opener-webview.html │ │ ├── webview-zoom-inherited.html │ │ ├── geolocation │ │ │ └── index.html │ │ ├── history-replace.html │ │ ├── iframe-protocol.html │ │ ├── webview-did-navigate-in-page.html │ │ ├── worker.html │ │ ├── beforeunload-false.html │ │ ├── datalist-text.html │ │ ├── media-id-reset.html │ │ ├── world-safe-preload-error.js │ │ ├── webview-opener-no-node-integration.html │ │ ├── webview-devtools.html │ │ ├── video.html │ │ ├── fetch.html │ │ ├── webframe-spell-check.html │ │ ├── window-open-postMessage-driver.html │ │ ├── a.html │ │ ├── key-events.html │ │ ├── visibilitychange.html │ │ ├── window-open-postMessage.html │ │ ├── webview-did-attach-event.html │ │ └── half-background-color.html │ ├── test.asar │ │ ├── file │ │ ├── unpack.asar.unpacked │ │ │ ├── a.txt │ │ │ └── atom.png │ │ ├── a.asar │ │ ├── echo.asar │ │ ├── logo.asar │ │ ├── empty.asar │ │ ├── script.asar │ │ ├── unpack.asar │ │ ├── video.asar │ │ ├── worker_threads.asar │ │ └── web.asar │ ├── module │ │ ├── fail.js │ │ ├── noop.js │ │ ├── test.coffee │ │ ├── preload-set-global.js │ │ ├── uv-dlopen.js │ │ ├── preload-electron.js │ │ ├── process-stdout.js │ │ ├── set-global-preload-1.js │ │ ├── set-global.js │ │ ├── preload-error-exception.js │ │ ├── preload-error-syntax.js │ │ ├── set-global-preload-2.js │ │ ├── set-global-preload-3.js │ │ ├── declare-buffer.js │ │ ├── declare-global.js │ │ ├── declare-process.js │ │ ├── isolated-ping.js │ │ ├── hello.js │ │ ├── ping.js │ │ ├── preload-node-off-wrapper.js │ │ ├── original-fs.js │ │ ├── get-global-preload.js │ │ ├── process_args.js │ │ ├── hello-child.js │ │ ├── asar.js │ │ ├── check-arguments.js │ │ ├── echo-renamed.js │ │ ├── create_socket.js │ │ ├── delay-exit.js │ │ ├── preload-webview.js │ │ ├── run-as-node.js │ │ ├── preload-sandboxæø åü.js │ │ ├── empty.js │ │ ├── preload-ipc.js │ │ ├── print-crash-parameters.js │ │ ├── send-later.js │ │ ├── echo.js │ │ ├── preload.js │ │ ├── locale-compare.js │ │ ├── preload-context.js │ │ ├── set-immediate.js │ │ ├── preload-ipc-ping-pong.js │ │ ├── preload-required-module.js │ │ ├── preload-node-off.js │ │ ├── no-asar.js │ │ ├── access-blink-apis.js │ │ └── fork_ping.js │ ├── api │ │ ├── context-bridge │ │ │ ├── empty.html │ │ │ ├── context-bridge-mutability │ │ │ │ ├── package.json │ │ │ │ ├── preload.js │ │ │ │ └── index.html │ │ │ └── can-bind-preload.js │ │ ├── utility-process │ │ │ ├── crash.js │ │ │ ├── empty.js │ │ │ ├── endless.js │ │ │ ├── exception.js │ │ │ ├── log.js │ │ │ ├── env-app │ │ │ │ ├── test.js │ │ │ │ └── package.json │ │ │ ├── custom-exit.js │ │ │ ├── post-message.js │ │ │ ├── suid.js │ │ │ ├── inherit-stderr │ │ │ │ ├── package.json │ │ │ │ ├── test.js │ │ │ │ └── main.js │ │ │ ├── inherit-stdout │ │ │ │ ├── package.json │ │ │ │ ├── test.js │ │ │ │ └── main.js │ │ │ ├── preload.js │ │ │ ├── receive-message.js │ │ │ └── post-message-queue.js │ │ ├── loaded-from-dataurl.js │ │ ├── native-window-open-child.html │ │ ├── net-log │ │ │ └── package.json │ │ ├── quit-app │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── test-menu-null │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── app-path │ │ │ ├── package.json │ │ │ └── lib │ │ │ │ └── index.js │ │ ├── command-line │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── cookie-app │ │ │ └── package.json │ │ ├── default-menu │ │ │ └── package.json │ │ ├── relaunch │ │ │ └── package.json │ │ ├── singleton │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── test-menu-visibility │ │ │ └── package.json │ │ ├── locale-check │ │ │ └── package.json │ │ ├── blank.html │ │ ├── did-fail-load-iframe.html │ │ ├── singleton-data │ │ │ └── package.json │ │ ├── window-all-closed │ │ │ └── package.json │ │ ├── ipc-main-listeners │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── mixed-sandbox-app │ │ │ ├── electron-app-mixed-sandbox-preload.js │ │ │ └── package.json │ │ ├── safe-storage │ │ │ ├── encrypt-app │ │ │ │ └── package.json │ │ │ └── decrypt-app │ │ │ │ └── package.json │ │ ├── service-workers │ │ │ ├── sw.js │ │ │ ├── sw-logs.js │ │ │ ├── index.html │ │ │ └── logs.html │ │ ├── singleton-userdata │ │ │ └── package.json │ │ ├── first-party-sets │ │ │ ├── base │ │ │ │ └── package.json │ │ │ └── command-line │ │ │ │ ├── package.json │ │ │ │ └── main.js │ │ ├── new-window-webview-preload.js │ │ ├── electron-main-module │ │ │ ├── app.asar │ │ │ └── app │ │ │ │ └── index.js │ │ ├── exit-closes-all-windows-app │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── shared-worker │ │ │ ├── shared-worker1.js │ │ │ └── shared-worker2.js │ │ ├── isolated-process.js │ │ ├── new-window-preload.js │ │ ├── localstorage.html │ │ ├── native-window-open-isolated-preload.js │ │ ├── beforeunload-undefined.html │ │ ├── window-open-location-final.html │ │ ├── isolated-fetch-preload.js │ │ ├── native-window-open-iframe.html │ │ ├── send-sync-message.html │ │ ├── window-open-location-open.html │ │ ├── unload.html │ │ ├── globals.html │ │ ├── native-window-open-noopener.html │ │ ├── close.html │ │ ├── native-window-open-no-allowpopups.html │ │ ├── new-window.html │ │ ├── native-window-open-isolated.html │ │ ├── window-open-location-change.html │ │ ├── frame-subscriber.html │ │ ├── offscreen-rendering.html │ │ ├── beforeunload-empty-string.html │ │ ├── beforeunload-false.html │ │ ├── preload.html │ │ ├── native-window-open-file.html │ │ ├── no-leak.html │ │ ├── native-window-open-blank.html │ │ └── window-open-preload.js │ ├── sub-frames │ │ ├── test.js │ │ ├── debug-frames.html │ │ ├── preload.js │ │ ├── frame.html │ │ ├── frame-container.html │ │ ├── frame-with-frame-container.html │ │ └── frame-with-frame.html │ ├── devtools-extensions │ │ ├── bad-manifest │ │ │ └── manifest.json │ │ └── foo │ │ │ ├── devtools.js │ │ │ ├── foo.html │ │ │ ├── _locales │ │ │ └── en │ │ │ │ └── messages.json │ │ │ ├── manifest.json │ │ │ └── index.html │ ├── native-addon │ │ ├── uv-dlopen │ │ │ ├── foo.cpp │ │ │ ├── package.json │ │ │ └── binding.gyp │ │ └── echo │ │ │ ├── lib │ │ │ └── echo.js │ │ │ ├── package.json │ │ │ └── binding.gyp │ ├── apps │ │ ├── crash │ │ │ ├── node-crash.js │ │ │ ├── package.json │ │ │ ├── fork.js │ │ │ ├── node-extra-args.js │ │ │ └── sandbox-preload.js │ │ ├── self-module-paths │ │ │ ├── worker.js │ │ │ ├── package.json │ │ │ ├── index.html │ │ │ └── renderer.js │ │ ├── set-path │ │ │ └── package.json │ │ ├── remote-control │ │ │ └── package.json │ │ ├── xwindow-icon │ │ │ ├── icon.png │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── open-new-window-from-link │ │ │ ├── preload.js │ │ │ ├── package.json │ │ │ ├── new-window-page.html │ │ │ └── index.html │ │ └── libuv-hang │ │ │ ├── renderer.js │ │ │ └── index.html │ ├── extensions │ │ ├── ui-page │ │ │ ├── script.js │ │ │ ├── page-script-load.html │ │ │ ├── bare-page.html │ │ │ ├── page-get-background.html │ │ │ └── manifest.json │ │ ├── missing-manifest │ │ │ └── main.js │ │ ├── mv3-service-worker │ │ │ ├── background.js │ │ │ └── manifest.json │ │ ├── persistent-background-page │ │ │ ├── background.js │ │ │ └── manifest.json │ │ ├── red-bg │ │ │ ├── main.js │ │ │ └── manifest.json │ │ ├── content-script-document-idle │ │ │ ├── idle.js │ │ │ └── manifest.json │ │ ├── content-script-document-end │ │ │ ├── end.js │ │ │ └── manifest.json │ │ ├── content-script-document-start │ │ │ ├── start.js │ │ │ └── manifest.json │ │ ├── content-script │ │ │ ├── all_frames-disabled.css │ │ │ ├── all_frames-enabled.css │ │ │ └── frame.html │ │ ├── lazy-background-page │ │ │ ├── page-get-background.html │ │ │ ├── page-runtime-get-background.html │ │ │ ├── background.js │ │ │ ├── get-background-page.js │ │ │ ├── content_script.js │ │ │ ├── runtime-get-background-page.js │ │ │ └── manifest.json │ │ ├── devtools-extension │ │ │ ├── foo.js │ │ │ ├── manifest.json │ │ │ ├── index.html │ │ │ ├── index.js │ │ │ └── foo.html │ │ ├── chrome-i18n │ │ │ ├── _locales │ │ │ │ └── en │ │ │ │ │ └── messages.json │ │ │ └── manifest.json │ │ ├── load-error │ │ │ └── manifest.json │ │ ├── chrome-webRequest │ │ │ ├── background.js │ │ │ └── manifest.json │ │ ├── chrome-webRequest-wss │ │ │ ├── manifest.json │ │ │ └── background.js │ │ ├── chrome-runtime │ │ │ ├── background.js │ │ │ └── manifest.json │ │ ├── chrome-storage │ │ │ ├── manifest.json │ │ │ └── main.js │ │ └── chrome-api │ │ │ └── manifest.json │ ├── cat.pdf │ ├── crash-cases │ │ ├── native-window-open-exit │ │ │ ├── index.html │ │ │ └── preload.js │ │ ├── js-execute-iframe │ │ │ └── page2.html │ │ ├── setimmediate-renderer-crash │ │ │ └── preload.js │ │ ├── webcontents-create-leak-exit │ │ │ └── index.js │ │ ├── webcontentsview-create-leak-exit │ │ │ └── index.js │ │ ├── early-in-memory-session-create │ │ │ └── index.js │ │ ├── in-memory-session-double-free │ │ │ └── index.js │ │ ├── webview-contents-error-on-creation │ │ │ └── index.js │ │ ├── webview-attach-destroyed │ │ │ └── index.js │ │ ├── fs-promises-renderer-crash │ │ │ └── index.html │ │ ├── transparent-window-get-background-color │ │ │ └── index.js │ │ └── setimmediate-window-open-crash │ │ │ └── index.js │ ├── assets │ │ ├── 1x1.png │ │ ├── 2x2.jpg │ │ ├── 3x3.png │ │ ├── LICENSE │ │ ├── icon.ico │ │ ├── logo.png │ │ ├── tone.wav │ │ ├── shortcut.lnk │ │ └── logo_Template.png │ ├── workers │ │ ├── worker.js │ │ ├── worker_node.js │ │ ├── shared_worker.js │ │ ├── shared_worker_node.js │ │ ├── workers.asar │ │ ├── load_worker.html │ │ └── load_shared_worker.html │ ├── certificates │ │ └── client.p12 │ ├── video-source-image.webp │ ├── snapshot-items-available │ │ └── package.json │ ├── auto-update │ │ ├── check │ │ │ └── package.json │ │ ├── update │ │ │ └── package.json │ │ ├── initial │ │ │ ├── package.json │ │ │ └── index.js │ │ ├── update-json │ │ │ └── package.json │ │ └── check-with-headers │ │ │ └── package.json │ ├── chromium │ │ ├── spellchecker.html │ │ └── other-window.js │ ├── testsnap.js │ ├── webview │ │ └── fullscreen │ │ │ └── frame.html │ └── preload-expose-ipc.js ├── .gitignore ├── ambient.d.ts ├── .eslintrc ├── api-view-spec.ts └── get-files.ts ├── .circleci ├── .gitignore └── config │ └── package.json ├── .dockerignore ├── docs ├── fiddles │ ├── windows │ │ ├── crashes-and-hangs │ │ │ └── .keep │ │ └── manage-windows │ │ │ ├── frameless-window │ │ │ └── renderer.js │ │ │ └── create-frameless-window │ │ │ └── renderer.js │ ├── ipc │ │ ├── pattern-2 │ │ │ ├── preload.js │ │ │ └── renderer.js │ │ ├── pattern-1 │ │ │ ├── preload.js │ │ │ ├── renderer.js │ │ │ └── index.html │ │ └── pattern-3 │ │ │ ├── preload.js │ │ │ ├── renderer.js │ │ │ └── index.html │ ├── system │ │ ├── system-app-user-information │ │ │ └── app-information │ │ │ │ └── main.js │ │ ├── clipboard │ │ │ ├── copy │ │ │ │ ├── preload.js │ │ │ │ └── renderer.js │ │ │ └── paste │ │ │ │ ├── preload.js │ │ │ │ └── renderer.js │ │ ├── system-information │ │ │ └── get-version-information │ │ │ │ └── renderer.js │ │ └── protocol-handler │ │ │ └── launch-app-from-URL-in-another-app │ │ │ ├── renderer.js │ │ │ └── preload.js │ ├── tutorial-preload │ │ ├── renderer.js │ │ └── preload.js │ ├── features │ │ ├── drag-and-drop │ │ │ ├── preload.js │ │ │ └── renderer.js │ │ ├── dark-mode │ │ │ ├── preload.js │ │ │ ├── styles.css │ │ │ └── renderer.js │ │ ├── keyboard-shortcuts │ │ │ ├── web-apis │ │ │ │ └── renderer.js │ │ │ ├── interception-from-main │ │ │ │ ├── index.html │ │ │ │ └── main.js │ │ │ ├── global │ │ │ │ └── index.html │ │ │ └── local │ │ │ │ └── index.html │ │ ├── online-detection │ │ │ ├── renderer.js │ │ │ └── index.html │ │ ├── web-bluetooth │ │ │ └── preload.js │ │ ├── notifications │ │ │ ├── renderer │ │ │ │ └── renderer.js │ │ │ └── main │ │ │ │ └── index.html │ │ ├── macos-dock-menu │ │ │ └── index.html │ │ └── recent-documents │ │ │ └── index.html │ ├── menus │ │ └── customize-menus │ │ │ └── renderer.js │ ├── native-ui │ │ ├── external-links-file-manager │ │ │ ├── path-in-file-manager │ │ │ │ └── renderer.js │ │ │ └── renderer.js │ │ └── notifications │ │ │ └── basic-notification │ │ │ └── renderer.js │ └── quick-start │ │ └── preload.js ├── api │ ├── structures │ │ ├── size.md │ │ ├── crash-report.md │ │ ├── extension-info.md │ │ ├── file-filter.md │ │ ├── web-source.md │ │ ├── bluetooth-device.md │ │ ├── memory-usage-details.md │ │ ├── upload-raw-data.md │ │ ├── shared-worker-info.md │ │ ├── protocol-response-upload-data.md │ │ ├── scrubber-item.md │ │ ├── file-path-with-headers.md │ │ ├── protocol-request.md │ │ ├── mime-typed-buffer.md │ │ ├── sharing-item.md │ │ ├── web-request-filter.md │ │ ├── point.md │ │ ├── product-subscription-period.md │ │ ├── segmented-control-segment.md │ │ ├── upload-data.md │ │ ├── extension.md │ │ ├── certificate-principal.md │ │ ├── keyboard-input-event.md │ │ ├── cpu-usage.md │ │ ├── user-default-types.md │ │ ├── rectangle.md │ │ ├── upload-file.md │ │ ├── ipc-main-invoke-event.md │ │ ├── service-worker-info.md │ │ ├── hid-device.md │ │ ├── process-memory-info.md │ │ ├── referrer.md │ │ ├── io-counters.md │ │ ├── memory-info.md │ │ ├── notification-response.md │ │ └── mouse-wheel-input-event.md │ └── touch-bar-group.md ├── images │ ├── dark_mode.gif │ ├── gatekeeper.png │ ├── drag-and-drop.gif │ ├── local-shortcut.png │ ├── macos-dock-menu.png │ ├── preload-example.png │ ├── chrome-processes.png │ ├── connection-status.png │ ├── dock-progress-bar.png │ ├── notification-main.png │ ├── recent-documents.png │ ├── represented-file.png │ ├── vs-tools-options.png │ ├── linux-progress-bar.png │ ├── macos-progress-bar.png │ ├── performance-cpu-prof.png │ ├── versioning-sketch-0.png │ ├── versioning-sketch-1.png │ ├── versioning-sketch-2.png │ ├── versioning-sketch-3.png │ ├── versioning-sketch-4.png │ ├── versioning-sketch-5.png │ ├── versioning-sketch-6.png │ ├── versioning-sketch-7.png │ ├── windows-progress-bar.png │ ├── notification-renderer.png │ ├── performance-heap-prof.png │ ├── simplest-electron-app.png │ ├── windows-taskbar-jumplist.png │ ├── mission-control-progress-bar.png │ ├── subpixel-rendering-screenshot.gif │ ├── vs-options-debugging-symbols.png │ ├── windows-taskbar-icon-overlay.png │ └── windows-taskbar-thumbnail-toolbar.png └── tutorial │ ├── using-pepper-flash-plugin.md │ └── support.md ├── spec-chromium └── configs │ └── browsertests.yml ├── .husky ├── pre-commit └── pre-push ├── default_app ├── icon.png └── package.json ├── shell ├── browser │ ├── ui │ │ ├── electron_gtk.fragment │ │ ├── electron_gdk_pixbuf.sigs │ │ └── tray_icon_win.cc │ ├── resources │ │ ├── mac │ │ │ └── electron.icns │ │ └── win │ │ │ ├── electron.ico │ │ │ └── resource.h │ ├── native_window_features.cc │ ├── extensions │ │ └── electron_display_info_provider.cc │ └── feature_list.h ├── app │ ├── BRANDING.json │ ├── uv_stdio_fix.h │ └── node_main.h ├── common │ └── extensions │ │ └── api │ │ └── _permission_features.json └── services │ └── node │ └── public │ └── mojom │ └── BUILD.gn ├── lib ├── asar │ └── init.ts ├── browser │ ├── api │ │ ├── content-tracing.ts │ │ ├── tray.ts │ │ ├── view.ts │ │ ├── browser-view.ts │ │ ├── safe-storage.ts │ │ ├── native-theme.ts │ │ ├── global-shortcut.ts │ │ ├── auto-updater │ │ │ └── auto-updater-native.ts │ │ ├── power-save-blocker.ts │ │ ├── push-notifications.ts │ │ ├── ipc-main.ts │ │ ├── auto-updater.ts │ │ ├── views │ │ │ └── image-view.ts │ │ ├── notification.ts │ │ ├── web-contents-view.ts │ │ ├── exports │ │ │ └── electron.ts │ │ ├── session.ts │ │ └── message-channel.ts │ └── ipc-main-internal.ts ├── common │ ├── api │ │ ├── shell.ts │ │ ├── native-image.ts │ │ └── module-list.ts │ └── webpack-globals-provider.ts ├── renderer │ ├── api │ │ ├── web-frame.ts │ │ ├── exports │ │ │ └── electron.ts │ │ ├── crash-reporter.ts │ │ └── module-list.ts │ └── .eslintrc.json ├── utility │ └── api │ │ ├── module-list.ts │ │ └── exports │ │ └── electron.ts ├── sandboxed_renderer │ ├── api │ │ └── exports │ │ │ └── electron.ts │ └── .eslintrc.json ├── worker │ └── .eslintrc.json └── isolated_renderer │ ├── .eslintrc.json │ └── init.ts ├── .markdownlint.autofix.json ├── tsconfig.spec.json ├── .remarkrc ├── .env.example ├── tsconfig.electron.json ├── .git-blame-ignore-revs ├── tsconfig.default_app.json ├── tsconfig.script.json ├── .devcontainer ├── update-content-command.sh └── docker-compose.yml ├── filenames.libcxxabi.gni ├── npm └── package.json └── .gitattributes /.nvmrc: -------------------------------------------------------------------------------- 1 | 16 2 | -------------------------------------------------------------------------------- /patches/webrtc/.patches: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /script/lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/blank.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /spec/fixtures/blank.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/pages/blank.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /script/codesign/.gitignore: -------------------------------------------------------------------------------- 1 | .working -------------------------------------------------------------------------------- /script/release/notes/.gitignore: -------------------------------------------------------------------------------- 1 | .cache -------------------------------------------------------------------------------- /spec/fixtures/test.asar/file: -------------------------------------------------------------------------------- 1 | file 2 | -------------------------------------------------------------------------------- /.circleci/.gitignore: -------------------------------------------------------------------------------- 1 | config-staging 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !tools/xvfb-init.sh 3 | -------------------------------------------------------------------------------- /docs/fiddles/windows/crashes-and-hangs/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/pages/service-worker/empty.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/module/fail.js: -------------------------------------------------------------------------------- 1 | process.exit(1); 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/noop.js: -------------------------------------------------------------------------------- 1 | process.exit(0); 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/fullscreen.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/pages/save_page/test.css: -------------------------------------------------------------------------------- 1 | h1 { } 2 | -------------------------------------------------------------------------------- /patches/ffmpeg/.patches: -------------------------------------------------------------------------------- 1 | link_with_loader_path.patch 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/context-bridge/empty.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/module/test.coffee: -------------------------------------------------------------------------------- 1 | module.exports = yes 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/save_page/test.js: -------------------------------------------------------------------------------- 1 | // do nothing 2 | -------------------------------------------------------------------------------- /spec/fixtures/sub-frames/test.js: -------------------------------------------------------------------------------- 1 | console.log('hello'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/test.asar/unpack.asar.unpacked/a.txt: -------------------------------------------------------------------------------- 1 | a 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/crash.js: -------------------------------------------------------------------------------- 1 | process.crash(); 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/empty.js: -------------------------------------------------------------------------------- 1 | process.exit(0); 2 | -------------------------------------------------------------------------------- /patches/Mantle/.patches: -------------------------------------------------------------------------------- 1 | remove_mtlmanagedobjectadapter_h.patch 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/loaded-from-dataurl.js: -------------------------------------------------------------------------------- 1 | window.ping = 'pong'; 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/native-window-open-child.html: -------------------------------------------------------------------------------- 1 |

Hello

2 | -------------------------------------------------------------------------------- /spec/fixtures/devtools-extensions/bad-manifest/manifest.json: -------------------------------------------------------------------------------- 1 | } 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-set-global.js: -------------------------------------------------------------------------------- 1 | window.foo = 'bar'; 2 | -------------------------------------------------------------------------------- /spec/fixtures/native-addon/uv-dlopen/foo.cpp: -------------------------------------------------------------------------------- 1 | extern "C" void foo() {} -------------------------------------------------------------------------------- /script/lib/electron.gitattributes: -------------------------------------------------------------------------------- 1 | *.mm diff=objc 2 | *.m diff=objc 3 | -------------------------------------------------------------------------------- /script/native-test-targets.json: -------------------------------------------------------------------------------- 1 | [ 2 | "shell_browser_ui_unittests" 3 | ] -------------------------------------------------------------------------------- /spec/fixtures/module/uv-dlopen.js: -------------------------------------------------------------------------------- 1 | require('@electron-ci/uv-dlopen'); 2 | -------------------------------------------------------------------------------- /spec-chromium/configs/browsertests.yml: -------------------------------------------------------------------------------- 1 | tests: 2 | - content_browsertests 3 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/endless.js: -------------------------------------------------------------------------------- 1 | setInterval(() => {}, 2000); 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/external-string.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /patches/perfetto/.patches: -------------------------------------------------------------------------------- 1 | define_ssize_t_to_be_intptr_t_to_match_libuv.patch 2 | -------------------------------------------------------------------------------- /spec/fixtures/apps/crash/node-crash.js: -------------------------------------------------------------------------------- 1 | process.nextTick(() => process.crash()); 2 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/ui-page/script.js: -------------------------------------------------------------------------------- 1 | document.write('script loaded ok'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-electron.js: -------------------------------------------------------------------------------- 1 | window.electron = require('electron'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/process-stdout.js: -------------------------------------------------------------------------------- 1 | process.stdout.write('pipes stdio'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/set-global-preload-1.js: -------------------------------------------------------------------------------- 1 | window.preload1 = 'preload-1'; 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/set-global.js: -------------------------------------------------------------------------------- 1 | if (!window.test) window.test = 'preload'; 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/base-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run precommit -------------------------------------------------------------------------------- /patches/README.md: -------------------------------------------------------------------------------- 1 | See [/docs/development/patches.md](/docs/development/patches.md). 2 | -------------------------------------------------------------------------------- /patches/angle/.patches: -------------------------------------------------------------------------------- 1 | fix_rename_webswapcgllayer_to_webswapcgllayerchromium.patch 2 | -------------------------------------------------------------------------------- /spec/fixtures/apps/self-module-paths/worker.js: -------------------------------------------------------------------------------- 1 | self.postMessage(self.module.paths); 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-error-exception.js: -------------------------------------------------------------------------------- 1 | throw new Error('Hello World!'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-error-syntax.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line 2 | foobar 3 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run prepack 5 | -------------------------------------------------------------------------------- /default_app/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/default_app/icon.png -------------------------------------------------------------------------------- /docs/api/structures/size.md: -------------------------------------------------------------------------------- 1 | # Size Object 2 | 3 | * `width` number 4 | * `height` number 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/exception.js: -------------------------------------------------------------------------------- 1 | nonExistingFunc(); // eslint-disable-line 2 | -------------------------------------------------------------------------------- /spec/fixtures/cat.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/cat.pdf -------------------------------------------------------------------------------- /spec/fixtures/extensions/ui-page/page-script-load.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/set-global-preload-2.js: -------------------------------------------------------------------------------- 1 | window.preload2 = window.preload1 + '-2'; 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/set-global-preload-3.js: -------------------------------------------------------------------------------- 1 | window.preload3 = window.preload2 + '-3'; 2 | -------------------------------------------------------------------------------- /patches/devtools_frontend/.patches: -------------------------------------------------------------------------------- 1 | fix_expose_globals_to_allow_patching_devtools_dock.patch 2 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/native-window-open-exit/index.html: -------------------------------------------------------------------------------- 1 | 2 | MAIN PAGE 3 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/missing-manifest/main.js: -------------------------------------------------------------------------------- 1 | console.log('oh no where is my manifest'); 2 | -------------------------------------------------------------------------------- /docs/api/structures/crash-report.md: -------------------------------------------------------------------------------- 1 | # CrashReport Object 2 | 3 | * `date` Date 4 | * `id` string 5 | -------------------------------------------------------------------------------- /docs/images/dark_mode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/dark_mode.gif -------------------------------------------------------------------------------- /docs/images/gatekeeper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/gatekeeper.png -------------------------------------------------------------------------------- /shell/browser/ui/electron_gtk.fragment: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/mv3-service-worker/background.js: -------------------------------------------------------------------------------- 1 | console.log('service worker installed'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/persistent-background-page/background.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/red-bg/main.js: -------------------------------------------------------------------------------- 1 | document.documentElement.style.backgroundColor = 'red'; 2 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/ui-page/bare-page.html: -------------------------------------------------------------------------------- 1 | 2 | ui page loaded ok 3 | -------------------------------------------------------------------------------- /lib/asar/init.ts: -------------------------------------------------------------------------------- 1 | import { wrapFsWithAsar } from './fs-wrapper'; 2 | 3 | wrapFsWithAsar(require('fs')); 4 | -------------------------------------------------------------------------------- /script/print-version.py: -------------------------------------------------------------------------------- 1 | from lib.util import get_electron_version 2 | 3 | print(get_electron_version()) 4 | -------------------------------------------------------------------------------- /spec/fixtures/assets/1x1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/assets/1x1.png -------------------------------------------------------------------------------- /spec/fixtures/assets/2x2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/assets/2x2.jpg -------------------------------------------------------------------------------- /spec/fixtures/assets/3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/assets/3x3.png -------------------------------------------------------------------------------- /spec/fixtures/extensions/ui-page/page-get-background.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/declare-buffer.js: -------------------------------------------------------------------------------- 1 | const Buffer = 'declared Buffer'; 2 | module.exports = Buffer; 3 | -------------------------------------------------------------------------------- /spec/fixtures/module/declare-global.js: -------------------------------------------------------------------------------- 1 | const global = 'declared global'; 2 | module.exports = global; 3 | -------------------------------------------------------------------------------- /docs/api/structures/extension-info.md: -------------------------------------------------------------------------------- 1 | # ExtensionInfo Object 2 | 3 | * `name` string 4 | * `version` string 5 | -------------------------------------------------------------------------------- /docs/api/structures/file-filter.md: -------------------------------------------------------------------------------- 1 | # FileFilter Object 2 | 3 | * `name` string 4 | * `extensions` string[] 5 | -------------------------------------------------------------------------------- /docs/api/structures/web-source.md: -------------------------------------------------------------------------------- 1 | # WebSource Object 2 | 3 | * `code` string 4 | * `url` string (optional) 5 | -------------------------------------------------------------------------------- /docs/images/drag-and-drop.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/drag-and-drop.gif -------------------------------------------------------------------------------- /docs/images/local-shortcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/local-shortcut.png -------------------------------------------------------------------------------- /docs/images/macos-dock-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/macos-dock-menu.png -------------------------------------------------------------------------------- /docs/images/preload-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/preload-example.png -------------------------------------------------------------------------------- /lib/browser/api/content-tracing.ts: -------------------------------------------------------------------------------- 1 | export default process._linkedBinding('electron_browser_content_tracing'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/net-log/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-net-log", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/apps/crash/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-crash", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/assets/LICENSE: -------------------------------------------------------------------------------- 1 | tone.wav 2 | http://soundbible.com/1815-A-Tone.html 3 | License: Public Domain 4 | -------------------------------------------------------------------------------- /spec/fixtures/assets/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/assets/icon.ico -------------------------------------------------------------------------------- /spec/fixtures/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/assets/logo.png -------------------------------------------------------------------------------- /spec/fixtures/assets/tone.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/assets/tone.wav -------------------------------------------------------------------------------- /spec/fixtures/extensions/content-script-document-idle/idle.js: -------------------------------------------------------------------------------- 1 | document.body.style.backgroundColor = 'red'; 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/declare-process.js: -------------------------------------------------------------------------------- 1 | const process = 'declared process'; 2 | module.exports = process; 3 | -------------------------------------------------------------------------------- /spec/fixtures/native-addon/echo/lib/echo.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../build/Release/echo.node').Print; 2 | -------------------------------------------------------------------------------- /spec/fixtures/test.asar/a.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/test.asar/a.asar -------------------------------------------------------------------------------- /spec/fixtures/workers/worker.js: -------------------------------------------------------------------------------- 1 | this.onmessage = function (msg) { 2 | this.postMessage(msg.data); 3 | }; 4 | -------------------------------------------------------------------------------- /docs/images/chrome-processes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/chrome-processes.png -------------------------------------------------------------------------------- /docs/images/connection-status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/connection-status.png -------------------------------------------------------------------------------- /docs/images/dock-progress-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/dock-progress-bar.png -------------------------------------------------------------------------------- /docs/images/notification-main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/notification-main.png -------------------------------------------------------------------------------- /docs/images/recent-documents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/recent-documents.png -------------------------------------------------------------------------------- /docs/images/represented-file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/represented-file.png -------------------------------------------------------------------------------- /docs/images/vs-tools-options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/vs-tools-options.png -------------------------------------------------------------------------------- /spec/fixtures/api/quit-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-quit-app", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/test-menu-null/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-menu", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/apps/set-path/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-set-path", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/assets/shortcut.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/assets/shortcut.lnk -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/js-execute-iframe/page2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | HELLO 4 | -------------------------------------------------------------------------------- /spec/fixtures/module/isolated-ping.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron'); 2 | ipcRenderer.send('pong'); 3 | -------------------------------------------------------------------------------- /spec/fixtures/test.asar/echo.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/test.asar/echo.asar -------------------------------------------------------------------------------- /spec/fixtures/test.asar/logo.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/test.asar/logo.asar -------------------------------------------------------------------------------- /.markdownlint.autofix.json: -------------------------------------------------------------------------------- 1 | { 2 | "default": false, 3 | "no-trailing-spaces": { 4 | "br_spaces": 0 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /default_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron", 3 | "productName": "Electron", 4 | "main": "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /docs/api/structures/bluetooth-device.md: -------------------------------------------------------------------------------- 1 | # BluetoothDevice Object 2 | 3 | * `deviceName` string 4 | * `deviceId` string 5 | -------------------------------------------------------------------------------- /docs/images/linux-progress-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/linux-progress-bar.png -------------------------------------------------------------------------------- /docs/images/macos-progress-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/macos-progress-bar.png -------------------------------------------------------------------------------- /docs/images/performance-cpu-prof.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/performance-cpu-prof.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/versioning-sketch-0.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/versioning-sketch-1.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/versioning-sketch-2.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/versioning-sketch-3.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/versioning-sketch-4.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/versioning-sketch-5.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/versioning-sketch-6.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/versioning-sketch-7.png -------------------------------------------------------------------------------- /docs/images/windows-progress-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/windows-progress-bar.png -------------------------------------------------------------------------------- /lib/browser/api/tray.ts: -------------------------------------------------------------------------------- 1 | const { Tray } = process._linkedBinding('electron_browser_tray'); 2 | 3 | export default Tray; 4 | -------------------------------------------------------------------------------- /lib/browser/api/view.ts: -------------------------------------------------------------------------------- 1 | const { View } = process._linkedBinding('electron_browser_view'); 2 | 3 | export default View; 4 | -------------------------------------------------------------------------------- /lib/common/api/shell.ts: -------------------------------------------------------------------------------- 1 | const shell = process._linkedBinding('electron_common_shell'); 2 | 3 | export default shell; 4 | -------------------------------------------------------------------------------- /spec/fixtures/api/app-path/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-app-path", 3 | "main": "lib/index.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/command-line/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-command-line", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/cookie-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-cookie-app", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/default-menu/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-default-menu", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/relaunch/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-relaunch", 3 | "main": "main.js" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/singleton/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-singleton", 3 | "main": "main.js" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/test-menu-visibility/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-menu", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/log.js: -------------------------------------------------------------------------------- 1 | console.log('hello'); 2 | process.stderr.write('world'); 3 | process.exit(0); 4 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/content-script-document-end/end.js: -------------------------------------------------------------------------------- 1 | document.documentElement.style.backgroundColor = 'red'; 2 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/content-script-document-start/start.js: -------------------------------------------------------------------------------- 1 | document.documentElement.style.backgroundColor = 'red'; 2 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/content-script/all_frames-disabled.css: -------------------------------------------------------------------------------- 1 | #all_frames_disabled { 2 | background: blue; 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/content-script/all_frames-enabled.css: -------------------------------------------------------------------------------- 1 | #all_frames_enabled { 2 | background: red; 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/lazy-background-page/page-get-background.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec/fixtures/test.asar/empty.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/test.asar/empty.asar -------------------------------------------------------------------------------- /spec/fixtures/test.asar/script.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/test.asar/script.asar -------------------------------------------------------------------------------- /spec/fixtures/test.asar/unpack.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/test.asar/unpack.asar -------------------------------------------------------------------------------- /spec/fixtures/test.asar/video.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/test.asar/video.asar -------------------------------------------------------------------------------- /docs/images/notification-renderer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/notification-renderer.png -------------------------------------------------------------------------------- /docs/images/performance-heap-prof.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/performance-heap-prof.png -------------------------------------------------------------------------------- /docs/images/simplest-electron-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/simplest-electron-app.png -------------------------------------------------------------------------------- /spec/fixtures/api/locale-check/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-locale-check", 3 | "main": "main.js" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/env-app/test.js: -------------------------------------------------------------------------------- 1 | process.parentPort.postMessage(process.env.FROM); 2 | process.exit(0); 3 | -------------------------------------------------------------------------------- /spec/fixtures/apps/remote-control/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-remote-control", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/assets/logo_Template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/assets/logo_Template.png -------------------------------------------------------------------------------- /spec/fixtures/certificates/client.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/certificates/client.p12 -------------------------------------------------------------------------------- /spec/fixtures/module/hello.js: -------------------------------------------------------------------------------- 1 | class Hello { 2 | say () { 3 | return 'hi'; 4 | } 5 | } 6 | module.exports = Hello; 7 | -------------------------------------------------------------------------------- /spec/fixtures/module/ping.js: -------------------------------------------------------------------------------- 1 | process.on('message', function (msg) { 2 | process.send(msg); 3 | process.exit(0); 4 | }); 5 | -------------------------------------------------------------------------------- /spec/fixtures/video-source-image.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/video-source-image.webp -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "spec", 5 | "typings" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /docs/images/windows-taskbar-jumplist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/windows-taskbar-jumplist.png -------------------------------------------------------------------------------- /patches/nan/.patches: -------------------------------------------------------------------------------- 1 | use_new_constructor_for_scriptorigin_when_17_x.patch 2 | chore_remove_deprecated_accessorsignatures.patch 3 | -------------------------------------------------------------------------------- /shell/browser/resources/mac/electron.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/shell/browser/resources/mac/electron.icns -------------------------------------------------------------------------------- /shell/browser/resources/win/electron.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/shell/browser/resources/win/electron.ico -------------------------------------------------------------------------------- /spec/fixtures/api/blank.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/did-fail-load-iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/singleton-data/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-singleton-data", 3 | "main": "main.js" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/window-all-closed/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-window-all-closed", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/apps/xwindow-icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/apps/xwindow-icon/icon.png -------------------------------------------------------------------------------- /spec/fixtures/apps/xwindow-icon/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-xwindow-icon", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/setimmediate-renderer-crash/preload.js: -------------------------------------------------------------------------------- 1 | setImmediate(() => { 2 | throw new Error('oh no'); 3 | }); 4 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-node-off-wrapper.js: -------------------------------------------------------------------------------- 1 | setImmediate(function () { 2 | require('./preload-required-module'); 3 | }); 4 | -------------------------------------------------------------------------------- /.remarkrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | ["remark-lint-code-block-style", "fenced"], 4 | ["remark-lint-fenced-code-flag"] 5 | ] 6 | } -------------------------------------------------------------------------------- /spec/fixtures/api/ipc-main-listeners/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-ipc-main-listeners", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/mixed-sandbox-app/electron-app-mixed-sandbox-preload.js: -------------------------------------------------------------------------------- 1 | require('electron').ipcRenderer.send('argv', process.argv); 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/mixed-sandbox-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-mixed-sandbox", 3 | "main": "main.js" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/safe-storage/encrypt-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-safe-storage", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/service-workers/sw.js: -------------------------------------------------------------------------------- 1 | self.addEventListener('install', function (event) { 2 | console.log('Installed'); 3 | }); 4 | -------------------------------------------------------------------------------- /spec/fixtures/api/singleton-userdata/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-singleton-userdata", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/apps/open-new-window-from-link/preload.js: -------------------------------------------------------------------------------- 1 | window.addEventListener('click', e => { 2 | console.log('click', e); 3 | }); 4 | -------------------------------------------------------------------------------- /spec/fixtures/apps/self-module-paths/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-self-module-paths", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/lazy-background-page/page-runtime-get-background.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/original-fs.js: -------------------------------------------------------------------------------- 1 | process.on('message', function () { 2 | process.send(typeof require('original-fs')); 3 | }); 4 | -------------------------------------------------------------------------------- /spec/fixtures/test.asar/worker_threads.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/test.asar/worker_threads.asar -------------------------------------------------------------------------------- /spec/fixtures/workers/worker_node.js: -------------------------------------------------------------------------------- 1 | self.postMessage([typeof process, typeof setImmediate, typeof global, typeof Buffer].join(' ')); 2 | -------------------------------------------------------------------------------- /docs/images/mission-control-progress-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/mission-control-progress-bar.png -------------------------------------------------------------------------------- /docs/images/subpixel-rendering-screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/subpixel-rendering-screenshot.gif -------------------------------------------------------------------------------- /docs/images/vs-options-debugging-symbols.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/vs-options-debugging-symbols.png -------------------------------------------------------------------------------- /docs/images/windows-taskbar-icon-overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/docs/images/windows-taskbar-icon-overlay.png -------------------------------------------------------------------------------- /spec/ambient.d.ts: -------------------------------------------------------------------------------- 1 | declare let standardScheme: string; 2 | declare let serviceWorkerScheme: string; 3 | 4 | declare module 'dbus-native'; 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/first-party-sets/base/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-first-party-sets-base", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/new-window-webview-preload.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron'); 2 | 3 | window.ipcRenderer = ipcRenderer; 4 | -------------------------------------------------------------------------------- /spec/fixtures/api/safe-storage/decrypt-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-safe-storage", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/custom-exit.js: -------------------------------------------------------------------------------- 1 | const arg = process.argv[2]; 2 | const code = arg.split('=')[1]; 3 | process.exit(code); 4 | -------------------------------------------------------------------------------- /spec/fixtures/devtools-extensions/foo/devtools.js: -------------------------------------------------------------------------------- 1 | /* global chrome */ 2 | chrome.devtools.panels.create('Foo', 'foo.png', 'index.html'); 3 | -------------------------------------------------------------------------------- /spec/fixtures/module/get-global-preload.js: -------------------------------------------------------------------------------- 1 | require('electron').ipcRenderer.send('vars', window.preload1, window.preload2, window.preload3); 2 | -------------------------------------------------------------------------------- /spec/fixtures/module/process_args.js: -------------------------------------------------------------------------------- 1 | process.on('message', function () { 2 | process.send(process.argv); 3 | process.exit(0); 4 | }); 5 | -------------------------------------------------------------------------------- /spec/fixtures/snapshot-items-available/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-snapshot-items-available", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /docs/api/structures/memory-usage-details.md: -------------------------------------------------------------------------------- 1 | # MemoryUsageDetails Object 2 | 3 | * `count` number 4 | * `size` number 5 | * `liveSize` number 6 | -------------------------------------------------------------------------------- /lib/renderer/api/web-frame.ts: -------------------------------------------------------------------------------- 1 | const { mainFrame } = process._linkedBinding('electron_renderer_web_frame'); 2 | 3 | export default mainFrame; 4 | -------------------------------------------------------------------------------- /shell/app/BRANDING.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_name": "electron", 3 | "product_name": "Electron", 4 | "mac_bundle_id": "com.github.Electron" 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-main-module/app.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxsen/electron/main/spec/fixtures/api/electron-main-module/app.asar -------------------------------------------------------------------------------- /spec/fixtures/api/exit-closes-all-windows-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-exit-closes-all-windows", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/env-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-utility-process-env-app", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/auto-update/check/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-check", 3 | "version": "1.0.0", 4 | "main": "./index.js" 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/auto-update/update/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-update", 3 | "version": "1.0.0", 4 | "main": "./index.js" 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/module/hello-child.js: -------------------------------------------------------------------------------- 1 | class Hello { 2 | say () { 3 | return 'hi child window'; 4 | } 5 | } 6 | module.exports = Hello; 7 | -------------------------------------------------------------------------------- /spec/fixtures/native-addon/echo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "./lib/echo.js", 3 | "name": "@electron-ci/echo", 4 | "version": "0.0.1" 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/pages/pdf-in-iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/testsnap.js: -------------------------------------------------------------------------------- 1 | // taken from https://chromium.googlesource.com/v8/v8.git/+/HEAD/test/cctest/test-serialize.cc#1127 2 | function f () { return g() * 2; } // eslint-disable-line no-unused-vars 3 | function g () { return 43; } 4 | -------------------------------------------------------------------------------- /tsconfig.script.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "noEmit": true, 6 | "skipLibCheck": true 7 | }, 8 | "include": [ 9 | "script" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /docs/fiddles/ipc/pattern-3/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron') 2 | 3 | contextBridge.exposeInMainWorld('electronAPI', { 4 | handleCounter: (callback) => ipcRenderer.on('update-counter', callback) 5 | }) 6 | -------------------------------------------------------------------------------- /spec/fixtures/devtools-extensions/foo/_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": { 3 | "message": "foo - $BAZ$ ($2)", 4 | "placeholders": { 5 | "baz": { 6 | "content": "$1" 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/base-page-security.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/api/structures/mime-typed-buffer.md: -------------------------------------------------------------------------------- 1 | # MimeTypedBuffer Object 2 | 3 | * `mimeType` string (optional) - MIME type of the buffer. 4 | * `charset` string (optional) - Charset of the buffer. 5 | * `data` Buffer - The actual Buffer content. 6 | -------------------------------------------------------------------------------- /docs/fiddles/system/clipboard/copy/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron') 2 | 3 | contextBridge.exposeInMainWorld('clipboard', { 4 | writeText: (text) => ipcRenderer.invoke('clipboard:writeText', text) 5 | }) 6 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/lazy-background-page/background.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | chrome.runtime.onMessage.addListener((message, sender, reply) => { 3 | window.receivedMessage = message; 4 | reply({ message, sender }); 5 | }); 6 | -------------------------------------------------------------------------------- /spec/fixtures/pages/cache-storage.html: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/storage/cookie.html: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/workers/shared_worker_node.js: -------------------------------------------------------------------------------- 1 | self.onconnect = function (event) { 2 | const port = event.ports[0]; 3 | port.start(); 4 | port.postMessage([typeof process, typeof setImmediate, typeof global, typeof Buffer].join(' ')); 5 | }; 6 | -------------------------------------------------------------------------------- /docs/fiddles/tutorial-preload/renderer.js: -------------------------------------------------------------------------------- 1 | const information = document.getElementById('info'); 2 | information.innerText = `This app is using Chrome (v${versions.chrome()}), Node.js (v${versions.node()}), and Electron (v${versions.electron()})`; 3 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/webcontentsview-create-leak-exit/index.js: -------------------------------------------------------------------------------- 1 | const { WebContentsView, app } = require('electron'); 2 | app.whenReady().then(function () { 3 | new WebContentsView({}) // eslint-disable-line 4 | 5 | app.quit(); 6 | }); 7 | -------------------------------------------------------------------------------- /spec/fixtures/module/locale-compare.js: -------------------------------------------------------------------------------- 1 | process.on('message', function () { 2 | process.send([ 3 | 'a'.localeCompare('a'), 4 | 'ä'.localeCompare('z', 'de'), 5 | 'ä'.localeCompare('a', 'sv', { sensitivity: 'base' }) 6 | ]); 7 | }); 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/storage/local_storage.html: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener-node.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/api/structures/sharing-item.md: -------------------------------------------------------------------------------- 1 | # SharingItem Object 2 | 3 | * `texts` string[] (optional) - An array of text to share. 4 | * `filePaths` string[] (optional) - An array of files to share. 5 | * `urls` string[] (optional) - An array of URLs to share. 6 | -------------------------------------------------------------------------------- /patches/boringssl/.patches: -------------------------------------------------------------------------------- 1 | expose_ripemd160.patch 2 | expose_aes-cfb.patch 3 | expose_des-ede3.patch 4 | fix_sync_evp_get_cipherbynid_and_evp_get_cipherbyname.patch 5 | expose_blowfish_ciphers.patch 6 | revert_track_ssl_error_zero_return_explicitly.patch 7 | -------------------------------------------------------------------------------- /spec/fixtures/api/ipc-main-listeners/main.js: -------------------------------------------------------------------------------- 1 | const { app, ipcMain } = require('electron'); 2 | 3 | app.whenReady().then(() => { 4 | process.stdout.write(JSON.stringify(ipcMain.eventNames())); 5 | process.stdout.end(); 6 | 7 | app.quit(); 8 | }); 9 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-did-navigate-in-page-with-hash.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.circleci/config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@electron/circleci-config", 3 | "version": "0.0.0", 4 | "private": true, 5 | "license": "MIT", 6 | "dependencies": { 7 | "fs-extra": "^10.1.0", 8 | "js-yaml": "^4.1.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.devcontainer/update-content-command.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | 5 | buildtools=$HOME/.electron_build_tools 6 | 7 | export PATH="$PATH:$buildtools/src" 8 | 9 | # Sync latest 10 | e d gclient sync --with_branch_heads --with_tags 11 | -------------------------------------------------------------------------------- /docs/fiddles/features/drag-and-drop/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron') 2 | 3 | contextBridge.exposeInMainWorld('electron', { 4 | startDrag: (fileName) => { 5 | ipcRenderer.send('ondragstart', fileName) 6 | } 7 | }) 8 | -------------------------------------------------------------------------------- /docs/tutorial/using-pepper-flash-plugin.md: -------------------------------------------------------------------------------- 1 | # Pepper Flash Plugin 2 | 3 | Electron no longer supports the Pepper Flash plugin, as Chrome has removed support. 4 | 5 | See [Chromium's Flash Roadmap](https://www.chromium.org/flash-roadmap) for more 6 | details. 7 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/early-in-memory-session-create/index.js: -------------------------------------------------------------------------------- 1 | const { app, session } = require('electron'); 2 | 3 | app.on('ready', () => { 4 | session.fromPartition('in-memory'); 5 | setImmediate(() => { 6 | process.exit(0); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /spec/fixtures/devtools-extensions/foo/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "foo", 4 | "permissions": [ 5 | "storage" 6 | ], 7 | "version": "1.0", 8 | "devtools_page": "foo.html", 9 | "default_locale": "en" 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/storage/session_storage.html: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-no-javascript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | CLICK 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/browser/api/views/image-view.ts: -------------------------------------------------------------------------------- 1 | import { View } from 'electron/main'; 2 | 3 | const { ImageView } = process._linkedBinding('electron_browser_image_view'); 4 | 5 | Object.setPrototypeOf(ImageView.prototype, View.prototype); 6 | 7 | export default ImageView; 8 | -------------------------------------------------------------------------------- /spec/fixtures/api/app-path/lib/index.js: -------------------------------------------------------------------------------- 1 | const { app } = require('electron'); 2 | 3 | const payload = { 4 | appPath: app.getAppPath() 5 | }; 6 | 7 | process.stdout.write(JSON.stringify(payload)); 8 | process.stdout.end(); 9 | 10 | process.exit(); 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/storage/indexed_db.html: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /lib/browser/api/notification.ts: -------------------------------------------------------------------------------- 1 | const { 2 | Notification: ElectronNotification, 3 | isSupported 4 | } = process._linkedBinding('electron_browser_notification'); 5 | 6 | ElectronNotification.isSupported = isSupported; 7 | 8 | export default ElectronNotification; 9 | -------------------------------------------------------------------------------- /spec/fixtures/api/isolated-fetch-preload.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron'); 2 | 3 | // Ensure fetch works from isolated world origin 4 | fetch('https://localhost:1234').catch(err => { 5 | ipcRenderer.send('isolated-fetch-error', err.message); 6 | }); 7 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/chrome-webRequest/background.js: -------------------------------------------------------------------------------- 1 | /* global chrome */ 2 | 3 | chrome.webRequest.onBeforeRequest.addListener( 4 | (details) => { 5 | return { cancel: true }; 6 | }, 7 | { urls: ['*://127.0.0.1:*'] }, 8 | ['blocking'] 9 | ); 10 | -------------------------------------------------------------------------------- /spec/fixtures/api/native-window-open-iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/devtools-extension/foo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | foo 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/native-window-open-exit/preload.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron'); 2 | 3 | window.addEventListener('DOMContentLoaded', () => { 4 | window.open('127.0.0.1:7001', '_blank'); 5 | setTimeout(() => ipcRenderer.send('test-done')); 6 | }); 7 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/persistent-background-page/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "persistent-background-page", 3 | "version": "1.0", 4 | "background": { 5 | "scripts": ["background.js"], 6 | "persistent": true 7 | }, 8 | "manifest_version": 2 9 | } 10 | -------------------------------------------------------------------------------- /docs/fiddles/features/dark-mode/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron') 2 | 3 | contextBridge.exposeInMainWorld('darkMode', { 4 | toggle: () => ipcRenderer.invoke('dark-mode:toggle'), 5 | system: () => ipcRenderer.invoke('dark-mode:system') 6 | }) 7 | -------------------------------------------------------------------------------- /docs/fiddles/ipc/pattern-1/renderer.js: -------------------------------------------------------------------------------- 1 | const setButton = document.getElementById('btn') 2 | const titleInput = document.getElementById('title') 3 | setButton.addEventListener('click', () => { 4 | const title = titleInput.value 5 | window.electronAPI.setTitle(title) 6 | }); 7 | -------------------------------------------------------------------------------- /spec/fixtures/api/send-sync-message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/api/window-open-location-open.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-allowpopups.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-did-navigate-in-page-with-history.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/api/structures/web-request-filter.md: -------------------------------------------------------------------------------- 1 | # WebRequestFilter Object 2 | 3 | * `urls` string[] - Array of [URL patterns](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns) that will be used to filter out the requests that do not match the URL patterns. 4 | -------------------------------------------------------------------------------- /docs/fiddles/tutorial-preload/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge } = require('electron'); 2 | 3 | contextBridge.exposeInMainWorld('versions', { 4 | node: () => process.versions.node, 5 | chrome: () => process.versions.chrome, 6 | electron: () => process.versions.electron, 7 | }); 8 | -------------------------------------------------------------------------------- /lib/browser/api/web-contents-view.ts: -------------------------------------------------------------------------------- 1 | import { View } from 'electron/main'; 2 | 3 | const { WebContentsView } = process._linkedBinding('electron_browser_web_contents_view'); 4 | 5 | Object.setPrototypeOf(WebContentsView.prototype, View.prototype); 6 | 7 | export default WebContentsView; 8 | -------------------------------------------------------------------------------- /spec/fixtures/api/unload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/devtools-extensions/foo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a custom devtools extension 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/permissions/media.html: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/pages/send-after-node.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/api/structures/point.md: -------------------------------------------------------------------------------- 1 | # Point Object 2 | 3 | * `x` number 4 | * `y` number 5 | 6 | **Note:** Both `x` and `y` must be whole integers, when providing a point object 7 | as input to an Electron API we will automatically round your `x` and `y` values 8 | to the nearest whole integer. 9 | -------------------------------------------------------------------------------- /docs/api/structures/product-subscription-period.md: -------------------------------------------------------------------------------- 1 | # ProductSubscriptionPeriod Object 2 | 3 | * `numberOfUnits` number - The number of units per subscription period. 4 | * `unit` string - The increment of time that a subscription period is specified in. Can be `day`, `week`, `month`, `year`. 5 | -------------------------------------------------------------------------------- /spec/fixtures/apps/crash/fork.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const childProcess = require('child_process'); 3 | 4 | const crashPath = path.join(__dirname, 'node-crash.js'); 5 | const child = childProcess.fork(crashPath, { silent: true }); 6 | child.on('exit', () => process.exit(0)); 7 | -------------------------------------------------------------------------------- /spec/fixtures/pages/onmouseup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-trusted-types.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/sandboxed_renderer/api/exports/electron.ts: -------------------------------------------------------------------------------- 1 | import { defineProperties } from '@electron/internal/common/define-properties'; 2 | import { moduleList } from '@electron/internal/sandboxed_renderer/api/module-list'; 3 | 4 | module.exports = {}; 5 | 6 | defineProperties(module.exports, moduleList); 7 | -------------------------------------------------------------------------------- /lib/utility/api/exports/electron.ts: -------------------------------------------------------------------------------- 1 | import { defineProperties } from '@electron/internal/common/define-properties'; 2 | import { utilityNodeModuleList } from '@electron/internal/utility/api/module-list'; 3 | 4 | module.exports = {}; 5 | 6 | defineProperties(module.exports, utilityNodeModuleList); 7 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-context.js: -------------------------------------------------------------------------------- 1 | var test = 'test' // eslint-disable-line 2 | 3 | const types = { 4 | require: typeof require, 5 | electron: typeof electron, 6 | window: typeof window, 7 | localVar: typeof window.test 8 | }; 9 | 10 | console.log(JSON.stringify(types)); 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/insecure-resources.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/fiddles/features/dark-mode/styles.css: -------------------------------------------------------------------------------- 1 | :root { 2 | color-scheme: light dark; 3 | } 4 | 5 | @media (prefers-color-scheme: dark) { 6 | body { background: #333; color: white; } 7 | } 8 | 9 | @media (prefers-color-scheme: light) { 10 | body { background: #ddd; color: black; } 11 | } 12 | -------------------------------------------------------------------------------- /spec/fixtures/api/globals.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Document 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/apps/libuv-hang/renderer.js: -------------------------------------------------------------------------------- 1 | const count = localStorage.getItem('count'); 2 | 3 | const { run, ipcRenderer } = window.api; 4 | 5 | run().then(async () => { 6 | const count = await ipcRenderer.invoke('reload-successful'); 7 | if (count < 3) location.reload(); 8 | }).catch(console.log); 9 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/mv3-service-worker/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MV3 Service Worker", 3 | "description": "Test for extension service worker support.", 4 | "version": "1.0", 5 | "manifest_version": 3, 6 | "background": { 7 | "service_worker": "background.js" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/red-bg/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "red-bg", 3 | "version": "1.0", 4 | "content_scripts": [ 5 | { 6 | "matches": [""], 7 | "js": ["main.js"], 8 | "run_at": "document_start" 9 | } 10 | ], 11 | "manifest_version": 2 12 | } 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/close.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/history.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/pages/native-module.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/onkeyup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/fiddles/ipc/pattern-2/renderer.js: -------------------------------------------------------------------------------- 1 | const btn = document.getElementById('btn') 2 | const filePathElement = document.getElementById('filePath') 3 | 4 | btn.addEventListener('click', async () => { 5 | const filePath = await window.electronAPI.openFile() 6 | filePathElement.innerText = filePath 7 | }) 8 | -------------------------------------------------------------------------------- /docs/fiddles/system/clipboard/paste/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron') 2 | 3 | contextBridge.exposeInMainWorld('clipboard', { 4 | readText: () => ipcRenderer.invoke('clipboard:readText'), 5 | writeText: (text) => ipcRenderer.invoke('clipboard:writeText', text) 6 | }) 7 | -------------------------------------------------------------------------------- /spec/fixtures/api/native-window-open-noopener.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | noopener example 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/service-worker/worker-no-node.js: -------------------------------------------------------------------------------- 1 | self.clients.matchAll({ includeUncontrolled: true }).then((clients) => { 2 | if (!clients?.length) return; 3 | 4 | const msg = [typeof process, typeof setImmediate, typeof global, typeof Buffer].join(' '); 5 | clients[0].postMessage(msg); 6 | }); 7 | -------------------------------------------------------------------------------- /spec/fixtures/pages/zoom-factor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/api/structures/segmented-control-segment.md: -------------------------------------------------------------------------------- 1 | # SegmentedControlSegment Object 2 | 3 | * `label` string (optional) - The text to appear in this segment. 4 | * `icon` NativeImage (optional) - The image to appear in this segment. 5 | * `enabled` boolean (optional) - Whether this segment is selectable. Default: true. 6 | -------------------------------------------------------------------------------- /docs/api/structures/upload-data.md: -------------------------------------------------------------------------------- 1 | # UploadData Object 2 | 3 | * `bytes` Buffer - Content being sent. 4 | * `file` string (optional) - Path of file being uploaded. 5 | * `blobUUID` string (optional) - UUID of blob data. Use [ses.getBlobData](../session.md#sesgetblobdataidentifier) method 6 | to retrieve the data. 7 | -------------------------------------------------------------------------------- /spec/fixtures/api/context-bridge/context-bridge-mutability/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron'); 2 | 3 | contextBridge.exposeInMainWorld('str', 'some-text'); 4 | contextBridge.exposeInMainWorld('obj', { prop: 'obj-prop' }); 5 | contextBridge.exposeInMainWorld('arr', [1, 2, 3, 4]); 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/service-workers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/post-message-queue.js: -------------------------------------------------------------------------------- 1 | setTimeout(() => { 2 | let called = 0; 3 | let result = ''; 4 | process.parentPort.on('message', (e) => { 5 | result += e.data; 6 | if (++called === 3) { 7 | process.parentPort.postMessage(result); 8 | } 9 | }); 10 | }, 3000); 11 | -------------------------------------------------------------------------------- /spec/fixtures/module/set-immediate.js: -------------------------------------------------------------------------------- 1 | process.on('uncaughtException', function (error) { 2 | process.send(error.message); 3 | process.exit(1); 4 | }); 5 | 6 | process.on('message', function () { 7 | setImmediate(function () { 8 | process.send('ok'); 9 | process.exit(0); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /spec/fixtures/native-addon/uv-dlopen/binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | { 4 | "target_name": "test_module", 5 | "sources": [ "main.cpp" ], 6 | }, 7 | { 8 | "target_name": "libfoo", 9 | "type": "shared_library", 10 | "sources": [ "foo.cpp" ] 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /spec/fixtures/pages/d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webframe-zoom.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-open-hide.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener-location.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/api/service-workers/logs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/dom-ready.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-will-navigate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/base-page-security-onload-message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /lib/common/webpack-globals-provider.ts: -------------------------------------------------------------------------------- 1 | // Captures original globals into a scope to ensure that userland modifications do 2 | // not impact Electron. Note that users doing: 3 | // 4 | // global.Promise.resolve = myFn 5 | // 6 | // Will mutate this captured one as well and that is OK. 7 | 8 | export const Promise = global.Promise; 9 | -------------------------------------------------------------------------------- /spec/fixtures/api/close.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/api/native-window-open-no-allowpopups.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/chrome-webRequest/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chrome-webRequest", 3 | "version": "1.0", 4 | "background": { 5 | "scripts": ["background.js"], 6 | "persistent": true 7 | }, 8 | "permissions": ["webRequest", "webRequestBlocking", ""], 9 | "manifest_version": 2 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/datalist-time.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/world-safe-preload.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer, webFrame } = require('electron'); 2 | 3 | webFrame.executeJavaScript(`(() => { 4 | return {}; 5 | })()`).then((obj) => { 6 | // Considered safe if the object is constructed in this world 7 | ipcRenderer.send('executejs-safe', obj.constructor === Object); 8 | }); 9 | -------------------------------------------------------------------------------- /docs/fiddles/features/keyboard-shortcuts/web-apis/renderer.js: -------------------------------------------------------------------------------- 1 | function handleKeyPress (event) { 2 | // You can put code here to handle the keypress. 3 | document.getElementById("last-keypress").innerText = event.key 4 | console.log(`You pressed ${event.key}`) 5 | } 6 | 7 | window.addEventListener('keyup', handleKeyPress, true) 8 | -------------------------------------------------------------------------------- /shell/browser/ui/electron_gdk_pixbuf.sigs: -------------------------------------------------------------------------------- 1 | GdkPixbuf* gdk_pixbuf_new(GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height) 2 | GdkPixbuf* gdk_pixbuf_scale_simple(const GdkPixbuf* src, int dest_width, int dest_height, GdkInterpType interp_type) 3 | guchar* gdk_pixbuf_get_pixels(const GdkPixbuf* pixbuf) 4 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/chrome-webRequest-wss/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chrome-webRequest", 3 | "version": "1.0", 4 | "background": { 5 | "scripts": ["background.js"], 6 | "persistent": true 7 | }, 8 | "permissions": ["webRequest", "webRequestBlocking", ""], 9 | "manifest_version": 2 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/content-script/frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | This is a frame, it has no children 9 |
10 |
11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/storage/web_sql.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/sub-frames/preload.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer, webFrame } = require('electron'); 2 | 3 | window.isolatedGlobal = true; 4 | 5 | ipcRenderer.send('preload-ran', window.location.href, webFrame.routingId); 6 | 7 | ipcRenderer.on('preload-ping', () => { 8 | ipcRenderer.send('preload-pong', webFrame.routingId); 9 | }); 10 | -------------------------------------------------------------------------------- /docs/api/structures/extension.md: -------------------------------------------------------------------------------- 1 | # Extension Object 2 | 3 | * `id` string 4 | * `manifest` any - Copy of the [extension's manifest data](https://developer.chrome.com/extensions/manifest). 5 | * `name` string 6 | * `path` string - The extension's file path. 7 | * `version` string 8 | * `url` string - The extension's `chrome-extension://` URL. 9 | -------------------------------------------------------------------------------- /docs/fiddles/ipc/pattern-3/renderer.js: -------------------------------------------------------------------------------- 1 | const counter = document.getElementById('counter') 2 | 3 | window.electronAPI.handleCounter((event, value) => { 4 | const oldValue = Number(counter.innerText) 5 | const newValue = oldValue + value 6 | counter.innerText = newValue 7 | event.sender.send('counter-value', newValue) 8 | }) 9 | -------------------------------------------------------------------------------- /docs/fiddles/menus/customize-menus/renderer.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | 3 | // Tell main process to show the menu when demo button is clicked 4 | const contextMenuBtn = document.getElementById('context-menu') 5 | 6 | contextMenuBtn.addEventListener('click', () => { 7 | ipcRenderer.send('show-context-menu') 8 | }) 9 | -------------------------------------------------------------------------------- /docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/renderer.js: -------------------------------------------------------------------------------- 1 | const { shell } = require('electron') 2 | const os = require('os') 3 | 4 | const fileManagerBtn = document.getElementById('open-file-manager') 5 | 6 | fileManagerBtn.addEventListener('click', (event) => { 7 | shell.showItemInFolder(os.homedir()) 8 | }) 9 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/in-memory-session-double-free/index.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | 3 | app.on('ready', async () => { 4 | const win = new BrowserWindow({ show: false, webPreferences: { partition: '123321' } }); 5 | await win.loadURL('data:text/html,'); 6 | setTimeout(() => app.quit()); 7 | }); 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/post.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

5 |
6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/fiddles/features/online-detection/renderer.js: -------------------------------------------------------------------------------- 1 | function onlineStatusIndicator () { 2 | document.getElementById('status').innerHTML = navigator.onLine ? 'online' : 'offline' 3 | } 4 | 5 | window.addEventListener('online', onlineStatusIndicator) 6 | window.addEventListener('offline', onlineStatusIndicator) 7 | 8 | onlineStatusIndicator() 9 | -------------------------------------------------------------------------------- /lib/common/api/module-list.ts: -------------------------------------------------------------------------------- 1 | // Common modules, please sort alphabetically 2 | export const commonModuleList: ElectronInternal.ModuleEntry[] = [ 3 | { name: 'clipboard', loader: () => require('./clipboard') }, 4 | { name: 'nativeImage', loader: () => require('./native-image') }, 5 | { name: 'shell', loader: () => require('./shell') } 6 | ]; 7 | -------------------------------------------------------------------------------- /spec/fixtures/api/new-window.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/fixtures/apps/crash/node-extra-args.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const childProcess = require('child_process'); 3 | 4 | process.on('message', function () { 5 | process.send(process.argv); 6 | }); 7 | 8 | // Allow time to send args, then crash the app. 9 | setTimeout(() => process.nextTick(() => process.crash()), 10000); 10 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/chrome-i18n/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "__MSG_extName__", 3 | "default_locale": "en", 4 | "version": "1.0", 5 | "content_scripts": [ 6 | { 7 | "matches": [""], 8 | "js": ["main.js"], 9 | "run_at": "document_start" 10 | } 11 | ], 12 | "manifest_version": 2 13 | } 14 | -------------------------------------------------------------------------------- /spec/fixtures/pages/c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/fiddles/system/clipboard/paste/renderer.js: -------------------------------------------------------------------------------- 1 | const pasteBtn = document.getElementById('paste-to') 2 | 3 | pasteBtn.addEventListener('click', async () => { 4 | await clipboard.writeText('What a demo!') 5 | const message = `Clipboard contents: ${await clipboard.readText()}` 6 | document.getElementById('paste-from').innerHTML = message 7 | }) 8 | -------------------------------------------------------------------------------- /shell/common/extensions/api/_permission_features.json: -------------------------------------------------------------------------------- 1 | { 2 | "resourcesPrivate": { 3 | "channel": "stable", 4 | "extension_types": [ 5 | "extension" 6 | ], 7 | "location": "component" 8 | }, 9 | "management": { 10 | "channel": "stable", 11 | "extension_types": [ 12 | "extension" 13 | ] 14 | } 15 | } -------------------------------------------------------------------------------- /spec/fixtures/api/native-window-open-isolated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/api/structures/certificate-principal.md: -------------------------------------------------------------------------------- 1 | # CertificatePrincipal Object 2 | 3 | * `commonName` string - Common Name. 4 | * `organizations` string[] - Organization names. 5 | * `organizationUnits` string[] - Organization Unit names. 6 | * `locality` string - Locality. 7 | * `state` string - State or province. 8 | * `country` string - Country or region. 9 | -------------------------------------------------------------------------------- /docs/api/structures/keyboard-input-event.md: -------------------------------------------------------------------------------- 1 | # KeyboardInputEvent Object extends `InputEvent` 2 | 3 | * `type` string - The type of the event, can be `rawKeyDown`, `keyDown`, `keyUp` or `char`. 4 | * `keyCode` string - The character that will be sent 5 | as the keyboard event. Should only use the valid key codes in 6 | [Accelerator](../accelerator.md). 7 | -------------------------------------------------------------------------------- /filenames.libcxxabi.gni: -------------------------------------------------------------------------------- 1 | libcxxabi_headers = [ 2 | "//buildtools/third_party/libc++abi/trunk/include/CMakeLists.txt", 3 | "//buildtools/third_party/libc++abi/trunk/include/__cxxabi_config.h", 4 | "//buildtools/third_party/libc++abi/trunk/include/cxxabi.h", 5 | ] 6 | 7 | libcxxabi_licenses = [ "//buildtools/third_party/libc++abi/trunk/LICENSE.TXT" ] 8 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/chrome-runtime/background.js: -------------------------------------------------------------------------------- 1 | /* global chrome */ 2 | 3 | chrome.runtime.onMessage.addListener((message, sender, reply) => { 4 | switch (message) { 5 | case 'getPlatformInfo': 6 | chrome.runtime.getPlatformInfo(reply); 7 | break; 8 | } 9 | 10 | // Respond asynchronously 11 | return true; 12 | }); 13 | -------------------------------------------------------------------------------- /docs/fiddles/features/drag-and-drop/renderer.js: -------------------------------------------------------------------------------- 1 | document.getElementById('drag1').ondragstart = (event) => { 2 | event.preventDefault() 3 | window.electron.startDrag('drag-and-drop-1.md') 4 | } 5 | 6 | document.getElementById('drag2').ondragstart = (event) => { 7 | event.preventDefault() 8 | window.electron.startDrag('drag-and-drop-2.md') 9 | } 10 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-ipc-ping-pong.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron'); 2 | 3 | ipcRenderer.on('ping', function (event, payload) { 4 | ipcRenderer.sendTo(event.senderId, 'pong', payload); 5 | }); 6 | 7 | ipcRenderer.on('ping-æøåü', function (event, payload) { 8 | ipcRenderer.sendTo(event.senderId, 'pong-æøåü', payload); 9 | }); 10 | -------------------------------------------------------------------------------- /docs/api/structures/cpu-usage.md: -------------------------------------------------------------------------------- 1 | # CPUUsage Object 2 | 3 | * `percentCPUUsage` number - Percentage of CPU used since the last call to getCPUUsage. 4 | First call returns 0. 5 | * `idleWakeupsPerSecond` number - The number of average idle CPU wakeups per second 6 | since the last call to getCPUUsage. First call returns 0. Will always return 0 on 7 | Windows. 8 | -------------------------------------------------------------------------------- /docs/api/structures/user-default-types.md: -------------------------------------------------------------------------------- 1 | # UserDefaultTypes Object 2 | 3 | * `string` string 4 | * `boolean` boolean 5 | * `integer` number 6 | * `float` number 7 | * `double` number 8 | * `url` string 9 | * `array` Array\ 10 | * `dictionary` Record\ 11 | 12 | This type is a helper alias, no object will never exist of this type. 13 | -------------------------------------------------------------------------------- /docs/fiddles/features/web-bluetooth/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron') 2 | 3 | contextBridge.exposeInMainWorld('electronAPI', { 4 | bluetoothPairingRequest: (callback) => ipcRenderer.on('bluetooth-pairing-request', callback), 5 | bluetoothPairingResponse: (response) => ipcRenderer.send('bluetooth-pairing-response', response) 6 | }) -------------------------------------------------------------------------------- /docs/tutorial/support.md: -------------------------------------------------------------------------------- 1 | # This doc has moved! 2 | 3 | * For information on supported releases, see the [Electron Releases](./electron-timelines.md) doc. 4 | * For community support on Electron, see the [Community page](https://www.electronjs.org/community). 5 | * For platform support info, see the [README](https://github.com/electron/electron/blob/main/README.md). 6 | -------------------------------------------------------------------------------- /script/codesign/get-trusted-identity.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | valid_certs=$(security find-identity -p codesigning -v) 6 | if [[ $valid_certs == *"1)"* ]]; then 7 | first_valid_cert=$(echo $valid_certs | sed 's/ \".*//' | sed 's/.* //') 8 | echo $first_valid_cert 9 | exit 0 10 | else 11 | # No Certificate 12 | exit 0 13 | fi 14 | -------------------------------------------------------------------------------- /spec/fixtures/api/context-bridge/can-bind-preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron'); 2 | 3 | console.info(contextBridge); 4 | 5 | let bound = false; 6 | try { 7 | contextBridge.exposeInMainWorld('test', {}); 8 | bound = true; 9 | } catch { 10 | // Ignore 11 | } 12 | 13 | ipcRenderer.send('context-bridge-bound', bound); 14 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener-webview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/api/quit-app/main.js: -------------------------------------------------------------------------------- 1 | const { app } = require('electron'); 2 | 3 | app.whenReady().then(function () { 4 | // This setImmediate call gets the spec passing on Linux 5 | setImmediate(function () { 6 | app.exit(123); 7 | }); 8 | }); 9 | 10 | process.on('exit', function (code) { 11 | console.log('Exit event with code: ' + code); 12 | }); 13 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/chrome-storage/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chrome-storage", 3 | "version": "1.0", 4 | "content_scripts": [ 5 | { 6 | "matches": [""], 7 | "js": ["main.js"], 8 | "run_at": "document_start" 9 | } 10 | ], 11 | "permissions": [ 12 | "storage" 13 | ], 14 | "manifest_version": 2 15 | } 16 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/content-script-document-end/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "document-end", 3 | "version": "1.0", 4 | "description": "", 5 | "content_scripts": [ 6 | { 7 | "matches": [""], 8 | "js": ["end.js"], 9 | "run_at": "document_end" 10 | } 11 | ], 12 | "manifest_version": 2 13 | } 14 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/lazy-background-page/get-background-page.js: -------------------------------------------------------------------------------- 1 | /* global chrome */ 2 | window.completionPromise = new Promise((resolve) => { 3 | window.completionPromiseResolve = resolve; 4 | }); 5 | chrome.runtime.sendMessage({ some: 'message' }, (response) => { 6 | window.completionPromiseResolve(chrome.extension.getBackgroundPage().receivedMessage); 7 | }); 8 | -------------------------------------------------------------------------------- /docs/fiddles/system/clipboard/copy/renderer.js: -------------------------------------------------------------------------------- 1 | const copyBtn = document.getElementById('copy-to') 2 | const copyInput = document.getElementById('copy-to-input') 3 | 4 | copyBtn.addEventListener('click', () => { 5 | if (copyInput.value !== '') copyInput.value = '' 6 | copyInput.placeholder = 'Copied! Paste here to see.' 7 | clipboard.writeText('Electron Demo!') 8 | }) 9 | -------------------------------------------------------------------------------- /script/gn-asar-hash.js: -------------------------------------------------------------------------------- 1 | const asar = require('@electron/asar'); 2 | const crypto = require('crypto'); 3 | const fs = require('fs'); 4 | 5 | const archive = process.argv[2]; 6 | const hashFile = process.argv[3]; 7 | 8 | const { headerString } = asar.getRawHeader(archive); 9 | fs.writeFileSync(hashFile, crypto.createHash('SHA256').update(headerString).digest('hex')); 10 | -------------------------------------------------------------------------------- /shell/app/uv_stdio_fix.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Slack Technologies, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ELECTRON_SHELL_APP_UV_STDIO_FIX_H_ 6 | #define ELECTRON_SHELL_APP_UV_STDIO_FIX_H_ 7 | 8 | void FixStdioStreams(); 9 | 10 | #endif // ELECTRON_SHELL_APP_UV_STDIO_FIX_H_ 11 | -------------------------------------------------------------------------------- /spec/fixtures/api/window-open-location-change.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | foo 9 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/content-script-document-idle/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "document-idle", 3 | "version": "1.0", 4 | "description": "", 5 | "content_scripts": [ 6 | { 7 | "matches": [""], 8 | "js": ["idle.js"], 9 | "run_at": "document_idle" 10 | } 11 | ], 12 | "manifest_version": 2 13 | } 14 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-required-module.js: -------------------------------------------------------------------------------- 1 | try { 2 | const types = { 3 | process: typeof process, 4 | setImmediate: typeof setImmediate, 5 | global: typeof global, 6 | Buffer: typeof Buffer, 7 | 'global.Buffer': typeof global.Buffer 8 | }; 9 | console.log(JSON.stringify(types)); 10 | } catch (e) { 11 | console.log(e.message); 12 | } 13 | -------------------------------------------------------------------------------- /spec/fixtures/sub-frames/frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | This is a frame, it has no children 11 | 12 | -------------------------------------------------------------------------------- /docs/api/structures/rectangle.md: -------------------------------------------------------------------------------- 1 | # Rectangle Object 2 | 3 | * `x` number - The x coordinate of the origin of the rectangle (must be an integer). 4 | * `y` number - The y coordinate of the origin of the rectangle (must be an integer). 5 | * `width` number - The width of the rectangle (must be an integer). 6 | * `height` number - The height of the rectangle (must be an integer). 7 | -------------------------------------------------------------------------------- /spec/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "mocha": true, 5 | "serviceworker": true 6 | }, 7 | "globals": { 8 | "Bindings": true, 9 | "Components": true, 10 | "UI": true, 11 | "WebView": true 12 | }, 13 | "plugins": [ 14 | "mocha" 15 | ], 16 | "rules": { 17 | "mocha/no-exclusive-tests": "error" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/content-script-document-start/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "document-start", 3 | "version": "1.0", 4 | "description": "", 5 | "content_scripts": [ 6 | { 7 | "matches": [""], 8 | "js": ["start.js"], 9 | "run_at": "document_start" 10 | } 11 | ], 12 | "manifest_version": 2 13 | } 14 | -------------------------------------------------------------------------------- /docs/api/structures/upload-file.md: -------------------------------------------------------------------------------- 1 | # UploadFile Object 2 | 3 | * `type` 'file' - `file`. 4 | * `filePath` string - Path of file to be uploaded. 5 | * `offset` Integer - Defaults to `0`. 6 | * `length` Integer - Number of bytes to read from `offset`. 7 | Defaults to `0`. 8 | * `modificationTime` Double - Last Modification time in 9 | number of seconds since the UNIX epoch. 10 | -------------------------------------------------------------------------------- /lib/renderer/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-restricted-imports": [ 4 | "error", 5 | { 6 | "paths": [ 7 | "electron", 8 | "electron/main" 9 | ], 10 | "patterns": [ 11 | "./*", 12 | "../*", 13 | "@electron/internal/browser/*" 14 | ] 15 | } 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/worker/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-restricted-imports": [ 4 | "error", 5 | { 6 | "paths": [ 7 | "electron", 8 | "electron/main" 9 | ], 10 | "patterns": [ 11 | "./*", 12 | "../*", 13 | "@electron/internal/browser/*" 14 | ] 15 | } 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spec/fixtures/module/preload-node-off.js: -------------------------------------------------------------------------------- 1 | setImmediate(function () { 2 | try { 3 | const types = { 4 | process: typeof process, 5 | setImmediate: typeof setImmediate, 6 | global: typeof global, 7 | Buffer: typeof Buffer 8 | }; 9 | console.log(JSON.stringify(types)); 10 | } catch (e) { 11 | console.log(e.message); 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-zoom-inherited.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/geolocation/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/pages/history-replace.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/iframe-protocol.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-did-navigate-in-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Click me. 4 | This is content. 5 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/worker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/fiddles/features/notifications/renderer/renderer.js: -------------------------------------------------------------------------------- 1 | const NOTIFICATION_TITLE = 'Title' 2 | const NOTIFICATION_BODY = 'Notification from the Renderer process. Click to log to console.' 3 | const CLICK_MESSAGE = 'Notification clicked!' 4 | 5 | new Notification(NOTIFICATION_TITLE, { body: NOTIFICATION_BODY }) 6 | .onclick = () => document.getElementById("output").innerText = CLICK_MESSAGE 7 | -------------------------------------------------------------------------------- /lib/isolated_renderer/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-restricted-imports": [ 4 | "error", 5 | { 6 | "paths": [ 7 | "electron", 8 | "electron/main" 9 | ], 10 | "patterns": [ 11 | "./*", 12 | "../*", 13 | "@electron/internal/browser/*" 14 | ] 15 | } 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/sandboxed_renderer/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-restricted-imports": [ 4 | "error", 5 | { 6 | "paths": [ 7 | "electron", 8 | "electron/main" 9 | ], 10 | "patterns": [ 11 | "./*", 12 | "../*", 13 | "@electron/internal/browser/*" 14 | ] 15 | } 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spec/fixtures/api/command-line/main.js: -------------------------------------------------------------------------------- 1 | const { app } = require('electron'); 2 | 3 | app.whenReady().then(() => { 4 | const payload = { 5 | hasSwitch: app.commandLine.hasSwitch('foobar'), 6 | getSwitchValue: app.commandLine.getSwitchValue('foobar') 7 | }; 8 | 9 | process.stdout.write(JSON.stringify(payload)); 10 | process.stdout.end(); 11 | 12 | app.quit(); 13 | }); 14 | -------------------------------------------------------------------------------- /spec/fixtures/api/frame-subscriber.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/api/offscreen-rendering.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/lazy-background-page/content_script.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | chrome.runtime.sendMessage({ some: 'message' }, (response) => { 3 | const script = document.createElement('script'); 4 | script.textContent = `require('electron').ipcRenderer.send('bg-page-message-response', ${JSON.stringify(response)})`; 5 | document.documentElement.appendChild(script); 6 | }); 7 | -------------------------------------------------------------------------------- /spec/fixtures/pages/beforeunload-false.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/pages/datalist-text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/fixtures/pages/media-id-reset.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/service-worker/service-worker.js: -------------------------------------------------------------------------------- 1 | self.addEventListener('fetch', function (event) { 2 | const requestUrl = new URL(event.request.url); 3 | 4 | if (requestUrl.pathname === '/echo' && 5 | event.request.headers.has('X-Mock-Response')) { 6 | const mockResponse = new Response('Hello from serviceWorker!'); 7 | event.respondWith(mockResponse); 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /docs/fiddles/quick-start/preload.js: -------------------------------------------------------------------------------- 1 | window.addEventListener('DOMContentLoaded', () => { 2 | const replaceText = (selector, text) => { 3 | const element = document.getElementById(selector) 4 | if (element) element.innerText = text 5 | } 6 | 7 | for (const type of ['chrome', 'node', 'electron']) { 8 | replaceText(`${type}-version`, process.versions[type]) 9 | } 10 | }) 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/api/beforeunload-empty-string.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/fixtures/api/beforeunload-false.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/webview-contents-error-on-creation/index.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | 3 | app.whenReady().then(() => { 4 | const mainWindow = new BrowserWindow({ 5 | show: false 6 | }); 7 | mainWindow.loadFile('about:blank'); 8 | 9 | app.on('web-contents-created', () => { 10 | throw new Error(); 11 | }); 12 | 13 | app.quit(); 14 | }); 15 | -------------------------------------------------------------------------------- /spec/fixtures/pages/permissions/notification.html: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /docs/fiddles/system/system-information/get-version-information/renderer.js: -------------------------------------------------------------------------------- 1 | const versionInfoBtn = document.getElementById('version-info') 2 | 3 | const electronVersion = process.versions.electron 4 | 5 | versionInfoBtn.addEventListener('click', () => { 6 | const message = `This app is using Electron version: ${electronVersion}` 7 | document.getElementById('got-version-info').innerHTML = message 8 | }) 9 | -------------------------------------------------------------------------------- /spec/fixtures/api/preload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spec/fixtures/apps/xwindow-icon/main.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | const path = require('path'); 3 | 4 | app.whenReady().then(() => { 5 | const w = new BrowserWindow({ 6 | show: false, 7 | icon: path.join(__dirname, 'icon.png') 8 | }); 9 | w.webContents.on('did-finish-load', () => { 10 | app.quit(); 11 | }); 12 | w.loadURL('about:blank'); 13 | }); 14 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/webview-attach-destroyed/index.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | 3 | app.whenReady().then(() => { 4 | const w = new BrowserWindow({ show: false, webPreferences: { webviewTag: true } }); 5 | w.loadURL('data:text/html,'); 6 | app.on('web-contents-created', () => { 7 | w.close(); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/chrome-storage/main.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | chrome.storage.local.set({ key: 'value' }, () => { 3 | chrome.storage.local.get(['key'], ({ key }) => { 4 | const script = document.createElement('script') 5 | script.textContent = `require('electron').ipcRenderer.send('storage-success', ${JSON.stringify(key)})` 6 | document.documentElement.appendChild(script) 7 | }) 8 | }) 9 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/chrome-webRequest-wss/background.js: -------------------------------------------------------------------------------- 1 | /* global chrome */ 2 | 3 | chrome.webRequest.onBeforeSendHeaders.addListener( 4 | (details) => { 5 | if (details.requestHeaders) { 6 | details.requestHeaders.foo = 'bar'; 7 | } 8 | return { cancel: false, requestHeaders: details.requestHeaders }; 9 | }, 10 | { urls: ['*://127.0.0.1:*'] }, 11 | ['blocking'] 12 | ); 13 | -------------------------------------------------------------------------------- /spec/fixtures/module/no-asar.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | const stats = fs.statSync(path.join(__dirname, '..', 'test.asar', 'a.asar')); 5 | 6 | const details = { 7 | isFile: stats.isFile(), 8 | size: stats.size 9 | }; 10 | 11 | if (process.send != null) { 12 | process.send(details); 13 | } else { 14 | console.log(JSON.stringify(details)); 15 | } 16 | -------------------------------------------------------------------------------- /spec/fixtures/pages/world-safe-preload-error.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer, webFrame } = require('electron'); 2 | 3 | webFrame.executeJavaScript(`(() => { 4 | return Object(Symbol('a')); 5 | })()`).catch((err) => { 6 | // Considered safe if the object is constructed in this world 7 | ipcRenderer.send('executejs-safe', err); 8 | }).then(() => { 9 | ipcRenderer.send('executejs-safe', null); 10 | }); 11 | -------------------------------------------------------------------------------- /docs/api/structures/ipc-main-invoke-event.md: -------------------------------------------------------------------------------- 1 | # IpcMainInvokeEvent Object extends `Event` 2 | 3 | * `processId` Integer - The internal ID of the renderer process that sent this message 4 | * `frameId` Integer - The ID of the renderer frame that sent this message 5 | * `sender` WebContents - Returns the `webContents` that sent the message 6 | * `senderFrame` WebFrameMain _Readonly_ - The frame that sent this message 7 | -------------------------------------------------------------------------------- /docs/fiddles/features/macos-dock-menu/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

Right click the dock icon to see the custom menu options.

11 | 12 | 13 | -------------------------------------------------------------------------------- /npm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "index.js", 3 | "types": "electron.d.ts", 4 | "bin": { 5 | "electron": "cli.js" 6 | }, 7 | "scripts": { 8 | "postinstall": "node install.js" 9 | }, 10 | "dependencies": { 11 | "@electron/get": "^2.0.0", 12 | "@types/node": "^18.11.18", 13 | "extract-zip": "^2.0.1" 14 | }, 15 | "engines": { 16 | "node": ">= 12.20.55" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spec/fixtures/apps/open-new-window-from-link/new-window-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Window From Link 7 | 8 | 9 | I'm a window opened from a link! 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/chrome-runtime/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chrome-runtime", 3 | "version": "1.0", 4 | "content_scripts": [ 5 | { 6 | "matches": [""], 7 | "js": ["main.js"], 8 | "run_at": "document_end" 9 | } 10 | ], 11 | "background": { 12 | "scripts": ["background.js"], 13 | "persistent": false 14 | }, 15 | "manifest_version": 2 16 | } 17 | -------------------------------------------------------------------------------- /shell/browser/native_window_features.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Slack Technologies, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "shell/browser/native_window_features.h" 6 | 7 | namespace features { 8 | const base::Feature kWaylandWindowDecorations{ 9 | "WaylandWindowDecorations", base::FEATURE_DISABLED_BY_DEFAULT}; 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/apps/open-new-window-from-link/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Hello World! 7 | 8 | 9 | Open New Window 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/workers/workers.asar: -------------------------------------------------------------------------------- 1 | hd_{"files":{"shared_worker.js":{"size":163,"offset":"0"},"worker.js":{"size":67,"offset":"163"}}}this.onconnect = function (event) { 2 | const port = event.ports[0]; 3 | port.start(); 4 | port.onmessage = function (event) { 5 | port.postMessage(event.data); 6 | }; 7 | }; 8 | this.onmessage = function (msg) { 9 | this.postMessage(msg.data); 10 | }; 11 | -------------------------------------------------------------------------------- /docs/fiddles/features/online-detection/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Connection status:

10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/renderer.js: -------------------------------------------------------------------------------- 1 | // This file is required by the index.html file and will 2 | // be executed in the renderer process for that window. 3 | // All APIs exposed by the context bridge are available here. 4 | 5 | // Binds the buttons to the context bridge API. 6 | document.getElementById('open-in-browser').addEventListener('click', () => { 7 | shell.open(); 8 | }); -------------------------------------------------------------------------------- /docs/fiddles/windows/manage-windows/frameless-window/renderer.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | 3 | const newWindowBtn = document.getElementById('frameless-window') 4 | 5 | newWindowBtn.addEventListener('click', () => { 6 | const url = 'data:text/html,

Hello World!

Close this Window' 7 | ipcRenderer.send('create-frameless-window', { url }) 8 | }) 9 | -------------------------------------------------------------------------------- /lib/browser/api/exports/electron.ts: -------------------------------------------------------------------------------- 1 | import { defineProperties } from '@electron/internal/common/define-properties'; 2 | import { commonModuleList } from '@electron/internal/common/api/module-list'; 3 | import { browserModuleList } from '@electron/internal/browser/api/module-list'; 4 | 5 | module.exports = {}; 6 | 7 | defineProperties(module.exports, commonModuleList); 8 | defineProperties(module.exports, browserModuleList); 9 | -------------------------------------------------------------------------------- /patches/squirrel.mac/.patches: -------------------------------------------------------------------------------- 1 | build_add_gn_config.patch 2 | fix_ensure_that_self_is_retained_until_the_racsignal_is_complete.patch 3 | fix_use_kseccschecknestedcode_kseccsstrictvalidate_in_the_sec.patch 4 | feat_add_new_squirrel_mac_bundle_installation_method_behind_flag.patch 5 | refactor_use_posix_spawn_instead_of_nstask_so_we_can_disclaim_the.patch 6 | fix_abort_installation_attempt_at_the_final_mile_if_the_app_is.patch 7 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/inherit-stderr/main.js: -------------------------------------------------------------------------------- 1 | const { app, utilityProcess } = require('electron'); 2 | const path = require('path'); 3 | 4 | app.whenReady().then(() => { 5 | const payload = app.commandLine.getSwitchValue('payload'); 6 | const child = utilityProcess.fork(path.join(__dirname, 'test.js'), [`--payload=${payload}`]); 7 | child.on('exit', () => { 8 | app.quit(); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /spec/fixtures/api/utility-process/inherit-stdout/main.js: -------------------------------------------------------------------------------- 1 | const { app, utilityProcess } = require('electron'); 2 | const path = require('path'); 3 | 4 | app.whenReady().then(() => { 5 | const payload = app.commandLine.getSwitchValue('payload'); 6 | const child = utilityProcess.fork(path.join(__dirname, 'test.js'), [`--payload=${payload}`]); 7 | child.on('exit', () => { 8 | app.quit(); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/lazy-background-page/runtime-get-background-page.js: -------------------------------------------------------------------------------- 1 | /* global chrome */ 2 | window.completionPromise = new Promise((resolve) => { 3 | window.completionPromiseResolve = resolve; 4 | }); 5 | chrome.runtime.sendMessage({ some: 'message' }, (response) => { 6 | chrome.runtime.getBackgroundPage((bgPage) => { 7 | window.completionPromiseResolve(bgPage.receivedMessage); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /spec/fixtures/sub-frames/frame-container.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | This is the root page 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/workers/load_worker.html: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /docs/fiddles/features/notifications/main/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

After launching this application, you should see the system notification.

11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/renderer/api/exports/electron.ts: -------------------------------------------------------------------------------- 1 | import { defineProperties } from '@electron/internal/common/define-properties'; 2 | import { commonModuleList } from '@electron/internal/common/api/module-list'; 3 | import { rendererModuleList } from '@electron/internal/renderer/api/module-list'; 4 | 5 | module.exports = {}; 6 | 7 | defineProperties(module.exports, commonModuleList); 8 | defineProperties(module.exports, rendererModuleList); 9 | -------------------------------------------------------------------------------- /spec/fixtures/api/native-window-open-file.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/auto-update/initial/index.js: -------------------------------------------------------------------------------- 1 | process.on('uncaughtException', (err) => { 2 | console.error(err); 3 | process.exit(1); 4 | }); 5 | 6 | const { autoUpdater } = require('electron'); 7 | 8 | const feedUrl = process.argv[1]; 9 | 10 | console.log('Setting Feed URL'); 11 | 12 | autoUpdater.setFeedURL({ 13 | url: feedUrl 14 | }); 15 | 16 | console.log('Feed URL Set:', feedUrl); 17 | 18 | process.exit(0); 19 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/fs-promises-renderer-crash/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-opener-no-node-integration.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/api/structures/service-worker-info.md: -------------------------------------------------------------------------------- 1 | # ServiceWorkerInfo Object 2 | 3 | * `scriptUrl` string - The full URL to the script that this service worker runs 4 | * `scope` string - The base URL that this service worker is active for. 5 | * `renderProcessId` number - The virtual ID of the process that this service worker is running in. This is not an OS level PID. This aligns with the ID set used for `webContents.getProcessId()`. 6 | -------------------------------------------------------------------------------- /docs/fiddles/features/keyboard-shortcuts/interception-from-main/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

Hit Ctrl+I to see a message printed to the console.

11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/fiddles/windows/manage-windows/create-frameless-window/renderer.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | 3 | const newWindowBtn = document.getElementById('frameless-window') 4 | 5 | newWindowBtn.addEventListener('click', () => { 6 | const url = 'data:text/html,

Hello World!

Close this Window' 7 | ipcRenderer.send('create-frameless-window', { url }) 8 | }) 9 | -------------------------------------------------------------------------------- /shell/app/node_main.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ELECTRON_SHELL_APP_NODE_MAIN_H_ 6 | #define ELECTRON_SHELL_APP_NODE_MAIN_H_ 7 | 8 | namespace electron { 9 | 10 | int NodeMain(int argc, char* argv[]); 11 | 12 | } // namespace electron 13 | 14 | #endif // ELECTRON_SHELL_APP_NODE_MAIN_H_ 15 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/transparent-window-get-background-color/index.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | 3 | function createWindow () { 4 | // Create the browser window. 5 | const mainWindow = new BrowserWindow({ 6 | transparent: true 7 | }); 8 | mainWindow.getBackgroundColor(); 9 | } 10 | 11 | app.on('ready', () => { 12 | createWindow(); 13 | setTimeout(() => app.quit()); 14 | }); 15 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-devtools.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spec/fixtures/sub-frames/frame-with-frame-container.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | This is the root page 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/webview/fullscreen/frame.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | WebView 4 |
5 | 6 | 13 | 14 | -------------------------------------------------------------------------------- /docs/api/structures/hid-device.md: -------------------------------------------------------------------------------- 1 | # HIDDevice Object 2 | 3 | * `deviceId` string - Unique identifier for the device. 4 | * `name` string - Name of the device. 5 | * `vendorId` Integer - The USB vendor ID. 6 | * `productId` Integer - The USB product ID. 7 | * `serialNumber` string (optional) - The USB device serial number. 8 | * `guid` string (optional) - Unique identifier for the HID interface. A device may have multiple HID interfaces. 9 | -------------------------------------------------------------------------------- /lib/isolated_renderer/init.ts: -------------------------------------------------------------------------------- 1 | /* global isolatedApi */ 2 | 3 | import type * as webViewElementModule from '@electron/internal/renderer/web-view/web-view-element'; 4 | 5 | if (isolatedApi.guestViewInternal) { 6 | // Must setup the WebView element in main world. 7 | const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element') as typeof webViewElementModule; 8 | setupWebView(isolatedApi); 9 | } 10 | -------------------------------------------------------------------------------- /script/generate-zip-manifest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import zipfile 4 | import sys 5 | 6 | def main(zip_path, manifest_out): 7 | with open(manifest_out, 'w') as manifest, \ 8 | zipfile.ZipFile(zip_path, 'r', allowZip64=True) as z: 9 | for name in sorted(z.namelist()): 10 | manifest.write(name + '\n') 11 | return 0 12 | 13 | if __name__ == '__main__': 14 | sys.exit(main(sys.argv[1], sys.argv[2])) 15 | -------------------------------------------------------------------------------- /script/lib/npm.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import sys 3 | 4 | 5 | def npm(*npm_args): 6 | call_args = [__get_executable_name()] + list(npm_args) 7 | subprocess.check_call(call_args) 8 | 9 | 10 | def __get_executable_name(): 11 | executable = 'npm' 12 | if sys.platform == 'win32': 13 | executable += '.cmd' 14 | return executable 15 | 16 | 17 | if __name__ == '__main__': 18 | npm(*sys.argv[1:]) 19 | -------------------------------------------------------------------------------- /spec/fixtures/api/first-party-sets/command-line/main.js: -------------------------------------------------------------------------------- 1 | const { app } = require('electron'); 2 | 3 | app.whenReady().then(function () { 4 | const hasSwitch = app.commandLine.hasSwitch('use-first-party-set'); 5 | const value = app.commandLine.getSwitchValue('use-first-party-set'); 6 | if (hasSwitch) { 7 | process.stdout.write(JSON.stringify(value)); 8 | process.stdout.end(); 9 | } 10 | 11 | app.quit(); 12 | }); 13 | -------------------------------------------------------------------------------- /spec/fixtures/apps/crash/sandbox-preload.js: -------------------------------------------------------------------------------- 1 | const { crashReporter } = require('electron'); 2 | 3 | const params = new URLSearchParams(location.search); 4 | if (params.get('set_extra') === '1') { 5 | crashReporter.addExtraParameter('rendererSpecific', 'rs'); 6 | crashReporter.addExtraParameter('addedThenRemoved', 'to-be-removed'); 7 | crashReporter.removeExtraParameter('addedThenRemoved'); 8 | } 9 | 10 | process.crash(); 11 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/lazy-background-page/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lazy-background-page", 3 | "version": "1.0", 4 | "background": { 5 | "scripts": ["background.js"], 6 | "persistent": false 7 | }, 8 | "content_scripts": [ 9 | { 10 | "matches": [""], 11 | "js": ["content_script.js"], 12 | "run_at": "document_start" 13 | } 14 | ], 15 | "manifest_version": 2 16 | } 17 | -------------------------------------------------------------------------------- /spec/fixtures/sub-frames/frame-with-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | This is a frame, is has one child 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/renderer/api/crash-reporter.ts: -------------------------------------------------------------------------------- 1 | const binding = process._linkedBinding('electron_renderer_crash_reporter'); 2 | 3 | export default { 4 | addExtraParameter (key: string, value: string) { 5 | binding.addExtraParameter(key, value); 6 | }, 7 | 8 | removeExtraParameter (key: string) { 9 | binding.removeExtraParameter(key); 10 | }, 11 | 12 | getParameters () { 13 | return binding.getParameters(); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /spec/fixtures/api/no-leak.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Document 5 | 6 | 7 | 16 | 17 | -------------------------------------------------------------------------------- /spec/fixtures/api/test-menu-null/main.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | 3 | let win; 4 | app.whenReady().then(function () { 5 | win = new BrowserWindow({}); 6 | win.setMenu(null); 7 | 8 | setTimeout(() => { 9 | if (win.isMenuBarVisible()) { 10 | console.log('Window has a menu'); 11 | } else { 12 | console.log('Window has no menu'); 13 | } 14 | app.quit(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /spec/fixtures/pages/video.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/fiddles/features/keyboard-shortcuts/global/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

Hit Alt+Ctrl+I on Windows or Opt+Cmd+I on Mac to see a message printed to the console.

11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/renderer/api/module-list.ts: -------------------------------------------------------------------------------- 1 | // Renderer side modules, please sort alphabetically. 2 | export const rendererModuleList: ElectronInternal.ModuleEntry[] = [ 3 | { name: 'contextBridge', loader: () => require('./context-bridge') }, 4 | { name: 'crashReporter', loader: () => require('./crash-reporter') }, 5 | { name: 'ipcRenderer', loader: () => require('./ipc-renderer') }, 6 | { name: 'webFrame', loader: () => require('./web-frame') } 7 | ]; 8 | -------------------------------------------------------------------------------- /script/codesign/codesign.cnf: -------------------------------------------------------------------------------- 1 | [req] 2 | default_bits = 4096 3 | encrypt_key = no 4 | default_md = sha512 5 | distinguished_name = req_distinguished_name 6 | prompt = no 7 | 8 | [req_distinguished_name] 9 | C = CA 10 | ST = BC 11 | L = Vancouver 12 | O = ElectronJS 13 | OU = BuildAutomation 14 | CN = codesign.electronjs.org 15 | 16 | [extended] 17 | keyUsage = critical,digitalSignature 18 | extendedKeyUsage = critical,codeSigning 19 | -------------------------------------------------------------------------------- /docs/fiddles/features/keyboard-shortcuts/local/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

Hit Alt+Shift+I on Windows, or Opt+Cmd+I on mac to see a message printed to the console.

11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/api/native-window-open-blank.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/fetch.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webframe-spell-check.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-open-postMessage-driver.html: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/preload-expose-ipc.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron'); 2 | 3 | // NOTE: Never do this in an actual app! Very insecure! 4 | contextBridge.exposeInMainWorld('ipc', { 5 | send (...args) { 6 | return ipcRenderer.send(...args); 7 | }, 8 | sendSync (...args) { 9 | return ipcRenderer.sendSync(...args); 10 | }, 11 | invoke (...args) { 12 | return ipcRenderer.invoke(...args); 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /spec/fixtures/workers/load_shared_worker.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | -------------------------------------------------------------------------------- /shell/browser/extensions/electron_display_info_provider.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "shell/browser/extensions/electron_display_info_provider.h" 6 | 7 | namespace extensions { 8 | 9 | ElectronDisplayInfoProvider::ElectronDisplayInfoProvider() = default; 10 | 11 | } // namespace extensions 12 | -------------------------------------------------------------------------------- /shell/browser/resources/win/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | 4 | #define IDR_MAINFRAME 1 5 | 6 | // Next default values for new objects 7 | // 8 | #ifdef APSTUDIO_INVOKED 9 | #ifndef APSTUDIO_READONLY_SYMBOLS 10 | #define _APS_NEXT_RESOURCE_VALUE 101 11 | #define _APS_NEXT_COMMAND_VALUE 40001 12 | #define _APS_NEXT_CONTROL_VALUE 1001 13 | #define _APS_NEXT_SYMED_VALUE 101 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /spec/fixtures/extensions/chrome-api/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chrome-api", 3 | "version": "1.0", 4 | "content_scripts": [ 5 | { 6 | "matches": [""], 7 | "js": ["main.js"], 8 | "run_at": "document_start" 9 | } 10 | ], 11 | "background": { 12 | "scripts": ["background.js"], 13 | "persistent": false 14 | }, 15 | "permissions": [ 16 | "" 17 | ], 18 | "manifest_version": 2 19 | } 20 | -------------------------------------------------------------------------------- /spec/fixtures/pages/a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
Hello World
7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/api/structures/process-memory-info.md: -------------------------------------------------------------------------------- 1 | # ProcessMemoryInfo Object 2 | 3 | * `residentSet` Integer _Linux_ _Windows_ - The amount of memory 4 | currently pinned to actual physical RAM in Kilobytes. 5 | * `private` Integer - The amount of memory not shared by other processes, such as JS heap or HTML content in Kilobytes. 6 | * `shared` Integer - The amount of memory shared between processes, typically 7 | memory consumed by the Electron code itself in Kilobytes. 8 | -------------------------------------------------------------------------------- /docs/api/touch-bar-group.md: -------------------------------------------------------------------------------- 1 | ## Class: TouchBarGroup 2 | 3 | > Create a group in the touch bar for native macOS applications 4 | 5 | Process: [Main](../glossary.md#main-process)
6 | _This class is not exported from the `'electron'` module. It is only available as a return value of other methods in the Electron API._ 7 | 8 | ### `new TouchBarGroup(options)` 9 | 10 | * `options` Object 11 | * `items` [TouchBar](touch-bar.md) - Items to display as a group. 12 | -------------------------------------------------------------------------------- /lib/browser/api/session.ts: -------------------------------------------------------------------------------- 1 | import { fetchWithSession } from '@electron/internal/browser/api/net-fetch'; 2 | const { fromPartition, Session } = process._linkedBinding('electron_browser_session'); 3 | 4 | Session.prototype.fetch = function (input: RequestInfo, init?: RequestInit) { 5 | return fetchWithSession(input, init, this); 6 | }; 7 | 8 | export default { 9 | fromPartition, 10 | get defaultSession () { 11 | return fromPartition(''); 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /shell/browser/feature_list.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef ELECTRON_SHELL_BROWSER_FEATURE_LIST_H_ 6 | #define ELECTRON_SHELL_BROWSER_FEATURE_LIST_H_ 7 | 8 | namespace electron { 9 | void InitializeFeatureList(); 10 | void InitializeFieldTrials(); 11 | } // namespace electron 12 | 13 | #endif // ELECTRON_SHELL_BROWSER_FEATURE_LIST_H_ 14 | -------------------------------------------------------------------------------- /spec/api-view-spec.ts: -------------------------------------------------------------------------------- 1 | import { closeWindow } from './lib/window-helpers'; 2 | import { BaseWindow, View } from 'electron/main'; 3 | 4 | describe('View', () => { 5 | let w: BaseWindow; 6 | afterEach(async () => { 7 | await closeWindow(w as any); 8 | w = null as unknown as BaseWindow; 9 | }); 10 | 11 | it('can be used as content view', () => { 12 | w = new BaseWindow({ show: false }); 13 | w.setContentView(new View()); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /spec/fixtures/api/singleton/main.js: -------------------------------------------------------------------------------- 1 | const { app } = require('electron'); 2 | 3 | app.whenReady().then(() => { 4 | console.log('started'); // ping parent 5 | }); 6 | 7 | const gotTheLock = app.requestSingleInstanceLock(); 8 | 9 | app.on('second-instance', (event, args, workingDirectory) => { 10 | setImmediate(() => { 11 | console.log(JSON.stringify(args)); 12 | app.exit(0); 13 | }); 14 | }); 15 | 16 | if (!gotTheLock) { 17 | app.exit(1); 18 | } 19 | -------------------------------------------------------------------------------- /spec/fixtures/pages/key-events.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/api/structures/referrer.md: -------------------------------------------------------------------------------- 1 | # Referrer Object 2 | 3 | * `url` string - HTTP Referrer URL. 4 | * `policy` string - Can be `default`, `unsafe-url`, 5 | `no-referrer-when-downgrade`, `no-referrer`, `origin`, 6 | `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`. 7 | See the [Referrer-Policy spec][1] for more details on the 8 | meaning of these values. 9 | 10 | [1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy 11 | -------------------------------------------------------------------------------- /docs/fiddles/ipc/pattern-3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Menu Counter 8 | 9 | 10 | Current value: 0 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/preload.js: -------------------------------------------------------------------------------- 1 | // All of the Node.js APIs are available in the preload process. 2 | // It has the same sandbox as a Chrome extension. 3 | const { contextBridge, ipcRenderer } = require('electron') 4 | 5 | // Set up context bridge between the renderer process and the main process 6 | contextBridge.exposeInMainWorld( 7 | 'shell', 8 | { 9 | open: () => ipcRenderer.send('shell:open'), 10 | } 11 | ) -------------------------------------------------------------------------------- /spec/fixtures/pages/visibilitychange.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/test.asar/web.asar: -------------------------------------------------------------------------------- 1 |  {"files":{"index.html":{"size":150,"offset":"0","integrity":{"algorithm":"SHA256","hash":"d0c74a69720d745496017312b205ddcc2fb0b6cd7dcf6a379a953d2d16675afd","blockSize":4194304,"blocks":["d0c74a69720d745496017312b205ddcc2fb0b6cd7dcf6a379a953d2d16675afd"]}}}} 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/api/structures/io-counters.md: -------------------------------------------------------------------------------- 1 | # IOCounters Object 2 | 3 | * `readOperationCount` number - The number of I/O read operations. 4 | * `writeOperationCount` number - The number of I/O write operations. 5 | * `otherOperationCount` number - Then number of I/O other operations. 6 | * `readTransferCount` number - The number of I/O read transfers. 7 | * `writeTransferCount` number - The number of I/O write transfers. 8 | * `otherTransferCount` number - Then number of I/O other transfers. 9 | -------------------------------------------------------------------------------- /shell/services/node/public/mojom/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022 Microsoft, Inc. 2 | # Use of this source code is governed by the MIT license that can be 3 | # found in the LICENSE file. 4 | 5 | import("//mojo/public/tools/bindings/mojom.gni") 6 | 7 | mojom("mojom") { 8 | sources = [ "node_service.mojom" ] 9 | public_deps = [ 10 | "//mojo/public/mojom/base", 11 | "//sandbox/policy/mojom", 12 | "//third_party/blink/public/mojom:mojom_core", 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-open-postMessage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # `git apply` and friends don't understand CRLF, even on windows. Force those 2 | # files to be checked out with LF endings even if core.autocrlf is true. 3 | *.patch text eol=lf 4 | patches/**/.patches merge=union 5 | 6 | # Source code and markdown files should always use LF as line ending. 7 | *.cc text eol=lf 8 | *.mm text eol=lf 9 | *.h text eol=lf 10 | *.js text eol=lf 11 | *.ts text eol=lf 12 | *.py text eol=lf 13 | *.ps1 text eol=lf 14 | *.md text eol=lf 15 | -------------------------------------------------------------------------------- /docs/api/structures/memory-info.md: -------------------------------------------------------------------------------- 1 | # MemoryInfo Object 2 | 3 | * `workingSetSize` Integer - The amount of memory currently pinned to actual physical RAM. 4 | * `peakWorkingSetSize` Integer - The maximum amount of memory that has ever been pinned 5 | to actual physical RAM. 6 | * `privateBytes` Integer (optional) _Windows_ - The amount of memory not shared by other processes, such as 7 | JS heap or HTML content. 8 | 9 | Note that all statistics are reported in Kilobytes. 10 | -------------------------------------------------------------------------------- /docs/fiddles/features/dark-mode/renderer.js: -------------------------------------------------------------------------------- 1 | document.getElementById('toggle-dark-mode').addEventListener('click', async () => { 2 | const isDarkMode = await window.darkMode.toggle() 3 | document.getElementById('theme-source').innerHTML = isDarkMode ? 'Dark' : 'Light' 4 | }) 5 | 6 | document.getElementById('reset-to-system').addEventListener('click', async () => { 7 | await window.darkMode.system() 8 | document.getElementById('theme-source').innerHTML = 'System' 9 | }) 10 | -------------------------------------------------------------------------------- /spec/fixtures/apps/libuv-hang/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Hello World! 8 | 9 | 10 |

Hello World!

11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/module/access-blink-apis.js: -------------------------------------------------------------------------------- 1 | window.delayed = true; 2 | 3 | global.getGlobalNames = () => { 4 | return Object.getOwnPropertyNames(global) 5 | .filter(key => typeof global[key] === 'function') 6 | .filter(key => key !== 'WebView') 7 | .sort(); 8 | }; 9 | 10 | const atPreload = global.getGlobalNames(); 11 | 12 | window.addEventListener('load', () => { 13 | window.test = { 14 | atPreload, 15 | atLoad: global.getGlobalNames() 16 | }; 17 | }); 18 | -------------------------------------------------------------------------------- /spec/fixtures/module/fork_ping.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | process.on('uncaughtException', function (error) { 4 | process.send(error.stack); 5 | }); 6 | 7 | const child = require('child_process').fork(path.join(__dirname, '/ping.js')); 8 | process.on('message', function (msg) { 9 | child.send(msg); 10 | }); 11 | child.on('message', function (msg) { 12 | process.send(msg); 13 | }); 14 | child.on('exit', function (code) { 15 | process.exit(code); 16 | }); 17 | -------------------------------------------------------------------------------- /spec/fixtures/apps/self-module-paths/renderer.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron'); 2 | 3 | const worker = new Worker('worker.js'); 4 | 5 | worker.onmessage = (event) => { 6 | const workerPaths = event.data.sort().toString(); 7 | const rendererPaths = self.module.paths.sort().toString(); 8 | const validModulePaths = workerPaths === rendererPaths && workerPaths !== 0; 9 | 10 | ipcRenderer.invoke('module-paths', validModulePaths); 11 | worker.terminate(); 12 | }; 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-did-attach-event.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/api/structures/notification-response.md: -------------------------------------------------------------------------------- 1 | # NotificationResponse Object 2 | 3 | * `actionIdentifier` string - The identifier string of the action that the user selected. 4 | * `date` number - The delivery date of the notification. 5 | * `identifier` string - The unique identifier for this notification request. 6 | * `userInfo` Record - A dictionary of custom information associated with the notification. 7 | * `userText` string (optional) - The text entered or chosen by the user. 8 | -------------------------------------------------------------------------------- /lib/browser/api/message-channel.ts: -------------------------------------------------------------------------------- 1 | import { MessagePortMain } from '@electron/internal/browser/message-port-main'; 2 | const { createPair } = process._linkedBinding('electron_browser_message_port'); 3 | 4 | export default class MessageChannelMain { 5 | port1: MessagePortMain; 6 | port2: MessagePortMain; 7 | constructor () { 8 | const { port1, port2 } = createPair(); 9 | this.port1 = new MessagePortMain(port1); 10 | this.port2 = new MessagePortMain(port2); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /script/run-if-exists.js: -------------------------------------------------------------------------------- 1 | const cp = require('child_process'); 2 | const fs = require('fs'); 3 | 4 | const checkPath = process.argv[2]; 5 | const command = process.argv.slice(3); 6 | 7 | if (fs.existsSync(checkPath)) { 8 | const child = cp.spawn( 9 | `${command[0]}${process.platform === 'win32' ? '.cmd' : ''}`, 10 | command.slice(1), 11 | { 12 | stdio: 'inherit', 13 | cwd: checkPath 14 | } 15 | ); 16 | child.on('exit', code => process.exit(code)); 17 | } 18 | -------------------------------------------------------------------------------- /spec/fixtures/api/window-open-preload.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer, webFrame } = require('electron'); 2 | 3 | setImmediate(function () { 4 | if (window.location.toString() === 'bar://page/') { 5 | const windowOpenerIsNull = window.opener == null; 6 | ipcRenderer.send('answer', { 7 | nodeIntegration: webFrame.getWebPreference('nodeIntegration'), 8 | typeofProcess: typeof global.process, 9 | windowOpenerIsNull 10 | }); 11 | window.close(); 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /docs/fiddles/native-ui/notifications/basic-notification/renderer.js: -------------------------------------------------------------------------------- 1 | const notification = { 2 | title: 'Basic Notification', 3 | body: 'Short message part' 4 | } 5 | 6 | const notificationButton = document.getElementById('basic-noti') 7 | 8 | notificationButton.addEventListener('click', () => { 9 | const myNotification = new window.Notification(notification.title, notification) 10 | 11 | myNotification.onclick = () => { 12 | console.log('Notification clicked') 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /spec/fixtures/chromium/other-window.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | 3 | const ints = (...args) => args.map(a => parseInt(a, 10)); 4 | 5 | const [x, y, width, height] = ints(...process.argv.slice(2)); 6 | 7 | let w; 8 | 9 | app.whenReady().then(() => { 10 | w = new BrowserWindow({ 11 | x, 12 | y, 13 | width, 14 | height 15 | }); 16 | console.log('__ready__'); 17 | }); 18 | 19 | process.on('SIGTERM', () => { 20 | process.exit(0); 21 | }); 22 | -------------------------------------------------------------------------------- /docs/api/structures/mouse-wheel-input-event.md: -------------------------------------------------------------------------------- 1 | # MouseWheelInputEvent Object extends `MouseInputEvent` 2 | 3 | * `type` string - The type of the event, can be `mouseWheel`. 4 | * `deltaX` Integer (optional) 5 | * `deltaY` Integer (optional) 6 | * `wheelTicksX` Integer (optional) 7 | * `wheelTicksY` Integer (optional) 8 | * `accelerationRatioX` Integer (optional) 9 | * `accelerationRatioY` Integer (optional) 10 | * `hasPreciseScrollingDeltas` boolean (optional) 11 | * `canScroll` boolean (optional) 12 | -------------------------------------------------------------------------------- /docs/fiddles/features/keyboard-shortcuts/interception-from-main/main.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron') 2 | 3 | app.whenReady().then(() => { 4 | const win = new BrowserWindow({ width: 800, height: 600 }) 5 | 6 | win.loadFile('index.html') 7 | win.webContents.on('before-input-event', (event, input) => { 8 | if (input.control && input.key.toLowerCase() === 'i') { 9 | console.log('Pressed Control+I') 10 | event.preventDefault() 11 | } 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /docs/fiddles/native-ui/external-links-file-manager/renderer.js: -------------------------------------------------------------------------------- 1 | const { shell } = require('electron') 2 | const os = require('os') 3 | 4 | const exLinksBtn = document.getElementById('open-ex-links') 5 | const fileManagerBtn = document.getElementById('open-file-manager') 6 | 7 | fileManagerBtn.addEventListener('click', (event) => { 8 | shell.showItemInFolder(os.homedir()) 9 | }) 10 | 11 | exLinksBtn.addEventListener('click', (event) => { 12 | shell.openExternal('https://electronjs.org') 13 | }) 14 | -------------------------------------------------------------------------------- /spec/fixtures/api/context-bridge/context-bridge-mutability/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spec/fixtures/api/exit-closes-all-windows-app/main.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | 3 | const windows = []; 4 | 5 | function createWindow (id) { 6 | const window = new BrowserWindow({ show: false }); 7 | window.loadURL(`data:,window${id}`); 8 | windows.push(window); 9 | } 10 | 11 | app.whenReady().then(() => { 12 | for (let i = 1; i <= 5; i++) { 13 | createWindow(i); 14 | } 15 | 16 | setImmediate(function () { 17 | app.exit(123); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /spec/fixtures/pages/half-background-color.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 16 | 17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /.devcontainer/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | buildtools: 5 | image: ghcr.io/electron/devcontainer:3d8d44d0f15b05bef6149e448f9cc522111847e9 6 | 7 | volumes: 8 | - ..:/workspaces/gclient/src/electron:cached 9 | 10 | - /var/run/docker.sock:/var/run/docker.sock 11 | 12 | command: /bin/sh -c "while sleep 1000; do :; done" 13 | 14 | user: builduser 15 | 16 | cap_add: 17 | - SYS_PTRACE 18 | security_opt: 19 | - seccomp:unconfined 20 | -------------------------------------------------------------------------------- /docs/fiddles/ipc/pattern-1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Hello World! 8 | 9 | 10 | Title: 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/get-files.ts: -------------------------------------------------------------------------------- 1 | import { once } from 'events'; 2 | import * as walkdir from 'walkdir'; 3 | 4 | export async function getFiles (directoryPath: string, { filter = null }: {filter?: ((file: string) => boolean) | null} = {}) { 5 | const files: string[] = []; 6 | const walker = walkdir(directoryPath, { 7 | no_recurse: true 8 | }); 9 | walker.on('file', (file) => { 10 | if (!filter || filter(file)) { files.push(file); } 11 | }); 12 | await once(walker, 'end'); 13 | return files; 14 | } 15 | -------------------------------------------------------------------------------- /docs/fiddles/features/recent-documents/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Recent Documents 6 | 7 | 8 | 9 |

Recent Documents

10 |

11 | Right click on the app icon to see recent documents. 12 | You should see `recently-used.md` added to the list of recent files 13 |

14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/crash-cases/setimmediate-window-open-crash/index.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | 3 | function createWindow () { 4 | const mainWindow = new BrowserWindow({ 5 | webPreferences: { 6 | nodeIntegration: true, 7 | contextIsolation: false 8 | } 9 | }); 10 | 11 | mainWindow.on('close', () => { 12 | app.quit(); 13 | }); 14 | 15 | mainWindow.loadFile('index.html'); 16 | } 17 | 18 | app.whenReady().then(() => { 19 | createWindow(); 20 | }); 21 | -------------------------------------------------------------------------------- /shell/browser/ui/tray_icon_win.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 GitHub, Inc. 2 | // Use of this source code is governed by the MIT license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "shell/browser/ui/win/notify_icon.h" 6 | #include "shell/browser/ui/win/notify_icon_host.h" 7 | 8 | namespace electron { 9 | 10 | // static 11 | TrayIcon* TrayIcon::Create(absl::optional guid) { 12 | static NotifyIconHost host; 13 | return host.CreateNotifyIcon(guid); 14 | } 15 | 16 | } // namespace electron 17 | --------------------------------------------------------------------------------