├── script ├── lib │ ├── __init__.py │ ├── electron.gitattributes │ ├── npm.py │ └── npx.py ├── codesign │ ├── .gitignore │ ├── get-trusted-identity.sh │ └── codesign.cnf ├── release │ └── notes │ │ └── .gitignore ├── native-test-targets.json ├── generate-zip-manifest.py ├── run-if-exists.js ├── start.js └── start-goma.ps1 ├── spec-main ├── fixtures │ ├── blank.png │ ├── blank.html │ ├── api │ │ ├── context-bridge │ │ │ ├── empty.html │ │ │ ├── context-bridge-mutability │ │ │ │ ├── package.json │ │ │ │ ├── preload.js │ │ │ │ └── index.html │ │ │ └── can-bind-preload.js │ │ ├── net-log │ │ │ └── package.json │ │ ├── test-menu-null │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── test-menu-visibility │ │ │ └── package.json │ │ ├── ipc-main-listeners │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── service-workers │ │ │ ├── sw.js │ │ │ ├── sw-logs.js │ │ │ ├── index.html │ │ │ └── logs.html │ │ ├── beforeunload-undefined.html │ │ ├── send-sync-message.html │ │ ├── beforeunload-empty-string.html │ │ ├── beforeunload-false.html │ │ ├── beforeunload-false-prevent3.html │ │ └── native-window-open-native-addon.html │ ├── module │ │ ├── test.coffee │ │ ├── uv-dlopen.js │ │ ├── declare-buffer.js │ │ ├── declare-global.js │ │ ├── declare-process.js │ │ ├── echo-renamed.js │ │ ├── echo.js │ │ └── print-crash-parameters.js │ ├── sub-frames │ │ ├── test.js │ │ ├── debug-frames.html │ │ ├── preload.js │ │ ├── frame.html │ │ ├── frame-container.html │ │ ├── frame-with-frame.html │ │ ├── frame-with-frame-container.html │ │ ├── frame-with-frame-container-webview.html │ │ └── frame-container-webview.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 │ │ │ └── index.js │ │ └── echo │ │ │ ├── lib │ │ │ └── echo.js │ │ │ ├── package.json │ │ │ └── binding.gyp │ ├── extensions │ │ ├── ui-page │ │ │ ├── script.js │ │ │ ├── page-script-load.html │ │ │ ├── bare-page.html │ │ │ ├── page-get-background.html │ │ │ └── manifest.json │ │ ├── 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 │ │ │ ├── frame-with-frame.html │ │ │ └── manifest.json │ │ ├── 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 │ ├── apps │ │ ├── crash │ │ │ ├── package.json │ │ │ ├── node-crash.js │ │ │ └── sandbox-preload.js │ │ ├── xwindow-icon │ │ │ ├── package.json │ │ │ ├── icon.png │ │ │ └── main.js │ │ ├── remote-control │ │ │ └── package.json │ │ └── libuv-hang │ │ │ ├── renderer.js │ │ │ ├── index.html │ │ │ └── preload.js │ ├── crash-cases │ │ ├── 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-attach-destroyed │ │ │ └── index.js │ │ ├── transparent-window-get-background-color │ │ │ └── index.js │ │ └── quit-on-crashed-event │ │ │ └── index.js │ ├── auto-update │ │ ├── update │ │ │ └── package.json │ │ ├── update-json │ │ │ └── package.json │ │ ├── check │ │ │ ├── package.json │ │ │ └── index.js │ │ ├── initial │ │ │ ├── package.json │ │ │ └── index.js │ │ └── check-with-headers │ │ │ └── package.json │ ├── pages │ │ ├── pdf-in-iframe.html │ │ ├── datalist.html │ │ └── webview-devtools.html │ └── chromium │ │ ├── spellchecker.html │ │ └── other-window.js ├── .gitignore ├── ambient.d.ts ├── .eslintrc ├── api-view-spec.ts ├── types-spec.ts └── api-power-save-blocker-spec.ts ├── docs ├── fiddles │ ├── native-ui │ │ ├── tray │ │ │ └── .keep │ │ ├── dialogs │ │ │ ├── .keep │ │ │ └── error-dialog │ │ │ │ └── renderer.js │ │ ├── drag-and-drop │ │ │ └── .keep │ │ ├── notifications │ │ │ ├── .keep │ │ │ └── basic-notification │ │ │ │ └── renderer.js │ │ └── external-links-file-manager │ │ │ ├── .keep │ │ │ ├── path-in-file-manager │ │ │ └── renderer.js │ │ │ └── renderer.js │ ├── media │ │ └── screenshot │ │ │ └── .keep │ ├── menus │ │ ├── shortcuts │ │ │ └── .keep │ │ └── customize-menus │ │ │ ├── .keep │ │ │ └── renderer.js │ ├── system │ │ ├── clipboard │ │ │ ├── .keep │ │ │ ├── paste │ │ │ │ ├── renderer.js │ │ │ │ └── main.js │ │ │ └── copy │ │ │ │ ├── renderer.js │ │ │ │ └── main.js │ │ ├── protocol-handler │ │ │ └── .keep │ │ ├── system-app-user-information │ │ │ ├── .keep │ │ │ └── app-information │ │ │ │ └── main.js │ │ └── system-information │ │ │ └── get-version-information │ │ │ └── renderer.js │ ├── windows │ │ ├── manage-windows │ │ │ ├── .keep │ │ │ ├── frameless-window │ │ │ │ └── renderer.js │ │ │ ├── create-frameless-window │ │ │ │ └── renderer.js │ │ │ └── new-window │ │ │ │ └── renderer.js │ │ └── crashes-and-hangs │ │ │ └── .keep │ ├── communication │ │ └── two-processes │ │ │ ├── .keep │ │ │ ├── synchronous-messages │ │ │ └── renderer.js │ │ │ └── asynchronous-messages │ │ │ └── renderer.js │ ├── features │ │ ├── macos-dark-mode │ │ │ ├── styles.css │ │ │ └── renderer.js │ │ ├── notifications │ │ │ ├── renderer │ │ │ │ └── renderer.js │ │ │ └── main │ │ │ │ └── index.html │ │ ├── online-detection │ │ │ ├── renderer │ │ │ │ ├── renderer.js │ │ │ │ └── main.js │ │ │ └── main │ │ │ │ └── renderer.js │ │ ├── drag-and-drop │ │ │ └── renderer.js │ │ ├── keyboard-shortcuts │ │ │ └── interception-from-main │ │ │ │ ├── main.js │ │ │ │ └── index.html │ │ ├── offscreen-rendering │ │ │ └── index.html │ │ ├── macos-dock-menu │ │ │ └── index.html │ │ ├── progress-bar │ │ │ └── index.html │ │ ├── recent-documents │ │ │ └── index.html │ │ └── represented-file │ │ │ └── index.html │ └── quick-start │ │ ├── preload.js │ │ └── index.html ├── api │ ├── structures │ │ ├── size.md │ │ ├── crash-report.md │ │ ├── event.md │ │ ├── extension-info.md │ │ ├── file-filter.md │ │ ├── bluetooth-device.md │ │ ├── memory-usage-details.md │ │ ├── upload-raw-data.md │ │ ├── new-window-web-contents-event.md │ │ ├── web-source.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 │ │ ├── point.md │ │ ├── segmented-control-segment.md │ │ ├── upload-data.md │ │ ├── extension.md │ │ ├── keyboard-input-event.md │ │ ├── input-event.md │ │ ├── certificate-principal.md │ │ ├── cpu-usage.md │ │ ├── user-default-types.md │ │ ├── rectangle.md │ │ ├── upload-file.md │ │ ├── ipc-main-invoke-event.md │ │ ├── service-worker-info.md │ │ ├── process-memory-info.md │ │ ├── referrer.md │ │ ├── io-counters.md │ │ ├── memory-info.md │ │ ├── notification-response.md │ │ ├── mouse-wheel-input-event.md │ │ ├── mouse-input-event.md │ │ └── custom-scheme.md │ └── touch-bar-group.md ├── images │ ├── dark_mode.gif │ ├── gatekeeper.png │ ├── drag-and-drop.gif │ ├── local-shortcut.png │ ├── macos-dock-menu.png │ ├── recent-documents.png │ ├── represented-file.png │ ├── dock-progress-bar.png │ ├── linux-progress-bar.png │ ├── macos-progress-bar.png │ ├── notification-main.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 │ ├── notification-renderer.png │ ├── performance-cpu-prof.png │ ├── performance-heap-prof.png │ ├── simplest-electron-app.png │ ├── online-event-detection.png │ ├── message-notification-renderer.png │ ├── mission-control-progress-bar.png │ └── subpixel-rendering-screenshot.gif └── tutorial │ └── using-pepper-flash-plugin.md ├── spec ├── fixtures │ ├── pages │ │ ├── blank.html │ │ ├── save_page │ │ │ ├── test.css │ │ │ ├── test.js │ │ │ └── index.html │ │ ├── fullscreen.html │ │ ├── external-string.html │ │ ├── base-page.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 │ │ ├── storage │ │ │ ├── cookie.html │ │ │ ├── local_storage.html │ │ │ ├── session_storage.html │ │ │ ├── indexed_db.html │ │ │ └── web_sql.html │ │ ├── window-opener-node.html │ │ ├── cache-storage.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 │ │ ├── onkeyup.html │ │ ├── native-module.html │ │ ├── zoom-factor.html │ │ ├── d.html │ │ ├── webframe-zoom.html │ │ ├── window-open-hide.html │ │ ├── window-opener-location.html │ │ ├── webview-will-navigate.html │ │ ├── base-page-security-onload-message.html │ │ ├── world-safe-preload.js │ │ ├── post.html │ │ ├── window-opener.html │ │ ├── c.html │ │ ├── dom-ready.html │ │ ├── window-opener-webview.html │ │ ├── worker.html │ │ ├── webview-zoom-inherited.html │ │ ├── geolocation │ │ │ └── index.html │ │ ├── history-replace.html │ │ ├── webview-did-navigate-in-page.html │ │ ├── beforeunload-false.html │ │ ├── media-id-reset.html │ │ ├── service-worker │ │ │ └── service-worker.js │ │ ├── target-name.html │ │ ├── world-safe-preload-error.js │ │ ├── a.html │ │ ├── webview-opener-no-node-integration.html │ │ ├── video.html │ │ ├── shared_worker.html │ │ ├── webframe-spell-check.html │ │ ├── window-open-postMessage-driver.html │ │ ├── key-events.html │ │ ├── visibilitychange.html │ │ ├── window-open-postMessage.html │ │ ├── webview-did-attach-event.html │ │ ├── window-opener-no-node-integration.html │ │ ├── window-opener-no-webview-tag.html │ │ └── webview-opener-postMessage.html │ ├── test.asar │ │ ├── file │ │ ├── unpack.asar.unpacked │ │ │ ├── a.txt │ │ │ └── atom.png │ │ ├── empty.asar │ │ ├── echo.asar │ │ ├── logo.asar │ │ ├── video.asar │ │ ├── unpack.asar │ │ ├── web.asar │ │ └── script.asar │ ├── module │ │ ├── noop.js │ │ ├── preload-set-global.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 │ │ ├── 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 │ │ ├── create_socket.js │ │ ├── delay-exit.js │ │ ├── preload-webview.js │ │ ├── run-as-node.js │ │ ├── preload-sandboxæø åü.js │ │ ├── empty.js │ │ ├── preload-ipc.js │ │ ├── send-later.js │ │ ├── preload-pdf-loaded.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 │ │ ├── preload-pdf-loaded-in-subframe.js │ │ ├── access-blink-apis.js │ │ └── fork_ping.js │ ├── api │ │ ├── electron-module-app │ │ │ ├── .gitignore │ │ │ ├── node_modules │ │ │ │ ├── electron │ │ │ │ │ ├── index.js │ │ │ │ │ └── package.json │ │ │ │ └── foo │ │ │ │ │ ├── index.js │ │ │ │ │ └── package.json │ │ │ └── index.html │ │ ├── loaded-from-dataurl.js │ │ ├── native-window-open-child.html │ │ ├── electron-main-module │ │ │ ├── app │ │ │ │ ├── node_modules │ │ │ │ │ └── some-module │ │ │ │ │ │ ├── main2.js │ │ │ │ │ │ └── package.json │ │ │ │ └── index.js │ │ │ └── app.asar │ │ ├── quit-app │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── cookie-app │ │ │ └── package.json │ │ ├── app-path │ │ │ ├── package.json │ │ │ └── lib │ │ │ │ └── index.js │ │ ├── command-line │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── default-menu │ │ │ └── package.json │ │ ├── relaunch │ │ │ └── package.json │ │ ├── singleton │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── locale-check │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── blank.html │ │ ├── did-fail-load-iframe.html │ │ ├── mixed-sandbox-app │ │ │ ├── package.json │ │ │ └── electron-app-mixed-sandbox-preload.js │ │ ├── window-all-closed │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── new-window-webview-preload.js │ │ ├── exit-closes-all-windows-app │ │ │ ├── package.json │ │ │ └── main.js │ │ ├── shared-worker │ │ │ ├── shared-worker1.js │ │ │ └── shared-worker2.js │ │ ├── isolated-process.js │ │ ├── localstorage.html │ │ ├── native-window-open-isolated-preload.js │ │ ├── window-open-location-final.html │ │ ├── new-window-preload.js │ │ ├── native-window-open-argv.html │ │ ├── isolated-fetch-preload.js │ │ ├── native-window-open-iframe.html │ │ ├── window-open-location-open.html │ │ ├── unload.html │ │ ├── globals.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 │ │ ├── preload.html │ │ ├── native-window-open-file.html │ │ ├── no-leak.html │ │ ├── native-window-open-blank.html │ │ └── new-window-webview.html │ ├── zip │ │ └── a.zip │ ├── assets │ │ ├── LICENSE │ │ ├── 1x1.png │ │ ├── 2x2.jpg │ │ ├── 3x3.png │ │ ├── icon.ico │ │ ├── logo.png │ │ ├── tone.wav │ │ ├── shortcut.lnk │ │ └── logo_Template.png │ ├── workers │ │ ├── worker.js │ │ ├── worker_node.js │ │ ├── shared_worker.js │ │ └── shared_worker_node.js │ ├── certificates │ │ └── client.p12 │ ├── video-source-image.webp │ ├── snapshot-items-available │ │ └── package.json │ └── testsnap.js ├── configs │ └── browsertests.yml ├── spec-helpers.js ├── .eslintrc ├── static │ └── get-files.js ├── expect-helpers.js └── ts-smoke │ └── tsconfig.json ├── .dockerignore ├── ELECTRON_VERSION ├── patches ├── nan │ └── .patches ├── Mantle │ └── .patches ├── depot_tools │ └── .patches ├── README.md ├── ReactiveObjC │ └── .patches ├── boringssl │ └── .patches ├── squirrel.mac │ └── .patches └── v8 │ └── .patches ├── default_app ├── icon.png └── package.json ├── .github └── semantic.yml ├── lib ├── asar │ └── init.ts ├── browser │ ├── api │ │ ├── content-tracing.ts │ │ ├── tray.ts │ │ ├── view.ts │ │ ├── browser-view.ts │ │ ├── native-image.ts │ │ ├── native-theme.ts │ │ ├── global-shortcut.ts │ │ ├── auto-updater │ │ │ └── auto-updater-native.ts │ │ ├── power-save-blocker.ts │ │ ├── auto-updater.ts │ │ ├── session.ts │ │ ├── desktop-capturer.ts │ │ ├── views │ │ │ └── image-view.ts │ │ ├── notification.ts │ │ ├── ipc-main.ts │ │ ├── web-contents-view.ts │ │ ├── exports │ │ │ └── electron.ts │ │ ├── message-channel.ts │ │ └── share-menu.ts │ ├── ipc-main-internal.ts │ └── .eslintrc.json ├── common │ ├── api │ │ ├── shell.ts │ │ └── module-list.ts │ └── webpack-globals-provider.ts ├── renderer │ └── api │ │ ├── web-frame.ts │ │ ├── exports │ │ └── electron.ts │ │ └── crash-reporter.ts ├── sandboxed_renderer │ └── api │ │ └── exports │ │ └── electron.ts └── isolated_renderer │ └── init.ts ├── .markdownlint.autofix.json ├── .remarkrc ├── shell ├── browser │ ├── resources │ │ ├── win │ │ │ ├── electron.ico │ │ │ ├── resource.h │ │ │ └── dpi_aware.manifest │ │ └── mac │ │ │ └── electron.icns │ ├── feature_list.h │ ├── extensions │ │ └── electron_display_info_provider.cc │ ├── ui │ │ ├── tray_icon_win.cc │ │ ├── run_all_unittests.cc │ │ └── inspectable_web_contents_view_delegate.cc │ ├── child_web_contents_tracker.cc │ └── font_defaults.h ├── app │ ├── BRANDING.json │ ├── electron_main.h │ ├── node_main.h │ ├── command_line_args.h │ ├── electron_main_delegate_mac.h │ └── resources │ │ └── mac │ │ └── loginhelper-Info.plist ├── common │ ├── extensions │ │ └── api │ │ │ └── _permission_features.json │ ├── gin_helper │ │ └── locker.cc │ ├── heap_snapshot.h │ └── language_util_linux.cc └── renderer │ └── resources │ └── mac │ └── Info.plist ├── .env.example ├── tsconfig.electron.json ├── tsconfig.spec.json ├── tsconfig.default_app.json ├── tsconfig.script.json ├── npm └── package.json ├── vsts-arm32v7.yml ├── vsts-arm64v8.yml ├── .gitattributes └── tsconfig.json /script/lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec-main/fixtures/blank.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/native-ui/tray/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec-main/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /spec-main/fixtures/blank.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/pages/blank.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/media/screenshot/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/menus/shortcuts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/native-ui/dialogs/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/system/clipboard/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /script/codesign/.gitignore: -------------------------------------------------------------------------------- 1 | .working -------------------------------------------------------------------------------- /script/release/notes/.gitignore: -------------------------------------------------------------------------------- 1 | .cache -------------------------------------------------------------------------------- /spec/fixtures/test.asar/file: -------------------------------------------------------------------------------- 1 | file 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !tools/xvfb-init.sh 3 | -------------------------------------------------------------------------------- /ELECTRON_VERSION: -------------------------------------------------------------------------------- 1 | 14.0.0-nightly.20210426 -------------------------------------------------------------------------------- /docs/fiddles/menus/customize-menus/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/native-ui/drag-and-drop/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/native-ui/notifications/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/system/protocol-handler/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/windows/manage-windows/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/communication/two-processes/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/windows/crashes-and-hangs/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/fiddles/system/system-app-user-information/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/module/noop.js: -------------------------------------------------------------------------------- 1 | process.exit(0); 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/save_page/test.css: -------------------------------------------------------------------------------- 1 | h1 { } 2 | -------------------------------------------------------------------------------- /docs/fiddles/native-ui/external-links-file-manager/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /patches/nan/.patches: -------------------------------------------------------------------------------- 1 | api_simplify_scriptorigin.patch 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/fullscreen.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec/fixtures/pages/save_page/test.js: -------------------------------------------------------------------------------- 1 | // do nothing 2 | -------------------------------------------------------------------------------- /spec/fixtures/test.asar/unpack.asar.unpacked/a.txt: -------------------------------------------------------------------------------- 1 | a 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/api/context-bridge/empty.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec-main/fixtures/module/test.coffee: -------------------------------------------------------------------------------- 1 | module.exports = yes 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/sub-frames/test.js: -------------------------------------------------------------------------------- 1 | console.log('hello'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-module-app/.gitignore: -------------------------------------------------------------------------------- 1 | !node_modules -------------------------------------------------------------------------------- /patches/Mantle/.patches: -------------------------------------------------------------------------------- 1 | remove_mtlmanagedobjectadapter_h.patch 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/module/uv-dlopen.js: -------------------------------------------------------------------------------- 1 | require('uv-dlopen'); 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-module-app/node_modules/electron/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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/module/preload-set-global.js: -------------------------------------------------------------------------------- 1 | window.foo = 'bar'; 2 | -------------------------------------------------------------------------------- /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-main/fixtures/devtools-extensions/bad-manifest/manifest.json: -------------------------------------------------------------------------------- 1 | } 2 | -------------------------------------------------------------------------------- /spec/configs/browsertests.yml: -------------------------------------------------------------------------------- 1 | tests: 2 | - content_browsertests 3 | -------------------------------------------------------------------------------- /spec-main/fixtures/native-addon/uv-dlopen/foo.cpp: -------------------------------------------------------------------------------- 1 | extern "C" 2 | void foo() { } -------------------------------------------------------------------------------- /spec/fixtures/pages/external-string.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /patches/depot_tools/.patches: -------------------------------------------------------------------------------- 1 | remove_some_deps_that_do_not_work_on_arm64.patch 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 | -------------------------------------------------------------------------------- /patches/README.md: -------------------------------------------------------------------------------- 1 | See [/docs/development/patches.md](/docs/development/patches.md). 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/ui-page/script.js: -------------------------------------------------------------------------------- 1 | document.write('script loaded ok'); 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 | -------------------------------------------------------------------------------- /docs/api/structures/size.md: -------------------------------------------------------------------------------- 1 | # Size Object 2 | 3 | * `width` Number 4 | * `height` Number 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /default_app/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/default_app/icon.png -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/ui-page/page-script-load.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-module-app/node_modules/foo/index.js: -------------------------------------------------------------------------------- 1 | exports.bar = function () {}; 2 | -------------------------------------------------------------------------------- /spec/fixtures/test.asar/empty.asar: -------------------------------------------------------------------------------- 1 | 40+{"files":{"file1":{"size":0,"offset":"0"}}} -------------------------------------------------------------------------------- /.github/semantic.yml: -------------------------------------------------------------------------------- 1 | # Always validate the PR title, and ignore the commits 2 | titleOnly: true 3 | -------------------------------------------------------------------------------- /docs/api/structures/crash-report.md: -------------------------------------------------------------------------------- 1 | # CrashReport Object 2 | 3 | * `date` Date 4 | * `id` String 5 | -------------------------------------------------------------------------------- /patches/ReactiveObjC/.patches: -------------------------------------------------------------------------------- 1 | build_conditionally_import_ext_headers_from_framework_or_from.patch 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-main-module/app/node_modules/some-module/main2.js: -------------------------------------------------------------------------------- 1 | // Nothing to do here 2 | -------------------------------------------------------------------------------- /docs/images/dark_mode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/dark_mode.gif -------------------------------------------------------------------------------- /lib/asar/init.ts: -------------------------------------------------------------------------------- 1 | import { wrapFsWithAsar } from './fs-wrapper'; 2 | 3 | wrapFsWithAsar(require('fs')); 4 | -------------------------------------------------------------------------------- /patches/boringssl/.patches: -------------------------------------------------------------------------------- 1 | expose_ripemd160.patch 2 | expose_aes-cfb.patch 3 | expose_des-ede3.patch 4 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/mv3-service-worker/background.js: -------------------------------------------------------------------------------- 1 | console.log('service worker installed'); 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/persistent-background-page/background.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/red-bg/main.js: -------------------------------------------------------------------------------- 1 | document.documentElement.style.backgroundColor = 'red'; 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/ui-page/bare-page.html: -------------------------------------------------------------------------------- 1 | 2 | ui page loaded ok 3 | -------------------------------------------------------------------------------- /spec/fixtures/zip/a.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/zip/a.zip -------------------------------------------------------------------------------- /docs/api/structures/event.md: -------------------------------------------------------------------------------- 1 | # Event Object extends `GlobalEvent` 2 | 3 | * `preventDefault` VoidFunction 4 | -------------------------------------------------------------------------------- /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/images/gatekeeper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/gatekeeper.png -------------------------------------------------------------------------------- /lib/browser/api/content-tracing.ts: -------------------------------------------------------------------------------- 1 | export default process._linkedBinding('electron_browser_content_tracing'); 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/cat.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec-main/fixtures/cat.pdf -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/ui-page/page-get-background.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/module/declare-buffer.js: -------------------------------------------------------------------------------- 1 | const Buffer = 'declared Buffer'; 2 | module.exports = Buffer; 3 | -------------------------------------------------------------------------------- /spec-main/fixtures/module/declare-global.js: -------------------------------------------------------------------------------- 1 | const global = 'declared global'; 2 | module.exports = global; 3 | -------------------------------------------------------------------------------- /spec/fixtures/api/quit-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-quit-app", 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/workers/worker.js: -------------------------------------------------------------------------------- 1 | this.onmessage = function (msg) { 2 | this.postMessage(msg.data); 3 | }; 4 | -------------------------------------------------------------------------------- /docs/images/drag-and-drop.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/drag-and-drop.gif -------------------------------------------------------------------------------- /docs/images/local-shortcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/local-shortcut.png -------------------------------------------------------------------------------- /spec-main/fixtures/api/net-log/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-net-log", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec-main/fixtures/apps/crash/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-crash", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/content-script-document-idle/idle.js: -------------------------------------------------------------------------------- 1 | document.body.style.backgroundColor = 'red'; 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/module/declare-process.js: -------------------------------------------------------------------------------- 1 | const process = 'declared process'; 2 | module.exports = process; 3 | -------------------------------------------------------------------------------- /spec-main/fixtures/native-addon/echo/lib/echo.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../build/Release/echo.node').Print; 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/cookie-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-cookie-app", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/assets/1x1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/assets/1x1.png -------------------------------------------------------------------------------- /spec/fixtures/assets/2x2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/assets/2x2.jpg -------------------------------------------------------------------------------- /spec/fixtures/assets/3x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/assets/3x3.png -------------------------------------------------------------------------------- /spec/fixtures/assets/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/assets/icon.ico -------------------------------------------------------------------------------- /spec/fixtures/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/assets/logo.png -------------------------------------------------------------------------------- /spec/fixtures/assets/tone.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/assets/tone.wav -------------------------------------------------------------------------------- /spec/fixtures/module/isolated-ping.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron'); 2 | ipcRenderer.send('pong'); 3 | -------------------------------------------------------------------------------- /.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/macos-dock-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/macos-dock-menu.png -------------------------------------------------------------------------------- /docs/images/recent-documents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/recent-documents.png -------------------------------------------------------------------------------- /docs/images/represented-file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/represented-file.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-main/fixtures/api/test-menu-null/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-menu", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /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/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-app-relaunch", 3 | "main": "main.js" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/api/singleton/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-app-singleton", 3 | "main": "main.js" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /docs/images/dock-progress-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/dock-progress-bar.png -------------------------------------------------------------------------------- /docs/images/linux-progress-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/linux-progress-bar.png -------------------------------------------------------------------------------- /docs/images/macos-progress-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/macos-progress-bar.png -------------------------------------------------------------------------------- /docs/images/notification-main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/notification-main.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/versioning-sketch-0.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/versioning-sketch-1.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/versioning-sketch-2.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/versioning-sketch-3.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/versioning-sketch-4.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/versioning-sketch-5.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/versioning-sketch-6.png -------------------------------------------------------------------------------- /docs/images/versioning-sketch-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/versioning-sketch-7.png -------------------------------------------------------------------------------- /spec-main/fixtures/api/test-menu-visibility/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-menu", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec-main/fixtures/apps/xwindow-icon/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-xwindow-icon", 3 | "main": "main.js" 4 | } -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/content-script-document-end/end.js: -------------------------------------------------------------------------------- 1 | document.documentElement.style.backgroundColor = 'red'; 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/content-script-document-start/start.js: -------------------------------------------------------------------------------- 1 | document.documentElement.style.backgroundColor = 'red'; 2 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/content-script/all_frames-disabled.css: -------------------------------------------------------------------------------- 1 | #all_frames_disabled { 2 | background: blue; 3 | } 4 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/content-script/all_frames-enabled.css: -------------------------------------------------------------------------------- 1 | #all_frames_enabled { 2 | background: red; 3 | } 4 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/lazy-background-page/page-get-background.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-module-app/node_modules/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "main": "index.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/api/locale-check/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-locale-check", 3 | "main": "main.js" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /spec/fixtures/assets/shortcut.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/assets/shortcut.lnk -------------------------------------------------------------------------------- /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/test.asar/echo.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/test.asar/echo.asar -------------------------------------------------------------------------------- /spec/fixtures/test.asar/logo.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/test.asar/logo.asar -------------------------------------------------------------------------------- /spec/fixtures/test.asar/video.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/test.asar/video.asar -------------------------------------------------------------------------------- /docs/images/notification-renderer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/notification-renderer.png -------------------------------------------------------------------------------- /docs/images/performance-cpu-prof.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/performance-cpu-prof.png -------------------------------------------------------------------------------- /docs/images/performance-heap-prof.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/performance-heap-prof.png -------------------------------------------------------------------------------- /docs/images/simplest-electron-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/simplest-electron-app.png -------------------------------------------------------------------------------- /spec-main/fixtures/apps/remote-control/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-remote-control", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /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/mixed-sandbox-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-app-mixed-sandbox", 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/certificates/client.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/certificates/client.p12 -------------------------------------------------------------------------------- /spec/fixtures/module/preload-node-off-wrapper.js: -------------------------------------------------------------------------------- 1 | setImmediate(function () { 2 | require('./preload-required-module'); 3 | }); 4 | -------------------------------------------------------------------------------- /spec/fixtures/video-source-image.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/video-source-image.webp -------------------------------------------------------------------------------- /.remarkrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | ["remark-lint-code-block-style", "fenced"], 4 | ["remark-lint-fenced-code-flag"] 5 | ] 6 | } -------------------------------------------------------------------------------- /docs/images/online-event-detection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/online-event-detection.png -------------------------------------------------------------------------------- /patches/squirrel.mac/.patches: -------------------------------------------------------------------------------- 1 | build_add_gn_config.patch 2 | fix_ensure_that_self_is_retained_until_the_racsignal_is_complete.patch 3 | -------------------------------------------------------------------------------- /shell/browser/resources/win/electron.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/shell/browser/resources/win/electron.ico -------------------------------------------------------------------------------- /spec-main/fixtures/crash-cases/setimmediate-renderer-crash/preload.js: -------------------------------------------------------------------------------- 1 | setImmediate(() => { 2 | throw new Error('oh no'); 3 | }); 4 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-module-app/node_modules/electron/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron", 3 | "main": "index.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/assets/logo_Template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec/fixtures/assets/logo_Template.png -------------------------------------------------------------------------------- /spec/fixtures/module/original-fs.js: -------------------------------------------------------------------------------- 1 | process.on('message', function () { 2 | process.send(typeof require('original-fs')); 3 | }); 4 | -------------------------------------------------------------------------------- /spec/fixtures/workers/worker_node.js: -------------------------------------------------------------------------------- 1 | self.postMessage([typeof process, typeof setImmediate, typeof global, typeof Buffer].join(' ')); 2 | -------------------------------------------------------------------------------- /shell/browser/resources/mac/electron.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/shell/browser/resources/mac/electron.icns -------------------------------------------------------------------------------- /spec-main/fixtures/api/ipc-main-listeners/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-ipc-main-listeners", 3 | "main": "main.js" 4 | } 5 | -------------------------------------------------------------------------------- /spec-main/fixtures/api/service-workers/sw.js: -------------------------------------------------------------------------------- 1 | self.addEventListener('install', function (event) { 2 | console.log('Installed'); 3 | }); 4 | -------------------------------------------------------------------------------- /spec-main/fixtures/auto-update/update/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "initial-app", 3 | "version": "1.0.0", 4 | "main": "./index.js" 5 | } -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/lazy-background-page/page-runtime-get-background.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spec/fixtures/api/electron-main-module/app/node_modules/some-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "some-module", 3 | "main": "./main2.js" 4 | } -------------------------------------------------------------------------------- /spec/fixtures/api/new-window-webview-preload.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron'); 2 | 3 | window.ipcRenderer = ipcRenderer; 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/test.asar/unpack.asar: -------------------------------------------------------------------------------- 1 | d`Y{"files":{"a.txt":{"size":2,"unpacked":true},"atom.png":{"size":643183,"unpacked":true}}} -------------------------------------------------------------------------------- /docs/api/structures/memory-usage-details.md: -------------------------------------------------------------------------------- 1 | # MemoryUsageDetails Object 2 | 3 | * `count` Number 4 | * `size` Number 5 | * `liveSize` Number 6 | -------------------------------------------------------------------------------- /docs/images/message-notification-renderer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/message-notification-renderer.png -------------------------------------------------------------------------------- /docs/images/mission-control-progress-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/mission-control-progress-bar.png -------------------------------------------------------------------------------- /docs/images/subpixel-rendering-screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/docs/images/subpixel-rendering-screenshot.gif -------------------------------------------------------------------------------- /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-main/fixtures/apps/xwindow-icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/postmanlabs/electron/master/spec-main/fixtures/apps/xwindow-icon/icon.png -------------------------------------------------------------------------------- /spec-main/fixtures/auto-update/update-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "initial-app", 3 | "version": "1.0.0", 4 | "main": "./index.js" 5 | } -------------------------------------------------------------------------------- /spec-main/fixtures/devtools-extensions/foo/devtools.js: -------------------------------------------------------------------------------- 1 | /* global chrome */ 2 | chrome.devtools.panels.create('Foo', 'foo.png', 'index.html'); 3 | -------------------------------------------------------------------------------- /spec-main/fixtures/native-addon/echo/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "main": "./lib/echo.js", 4 | "name": "echo", 5 | "version": "0.0.1" 6 | } 7 | -------------------------------------------------------------------------------- /spec-main/fixtures/native-addon/uv-dlopen/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uv-dlopen", 3 | "version": "0.0.1", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /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/module/hello-child.js: -------------------------------------------------------------------------------- 1 | class Hello { 2 | say () { 3 | return 'hi child window'; 4 | } 5 | } 6 | module.exports = Hello; 7 | -------------------------------------------------------------------------------- /docs/api/structures/upload-raw-data.md: -------------------------------------------------------------------------------- 1 | # UploadRawData Object 2 | 3 | * `type` 'rawData' - `rawData`. 4 | * `bytes` Buffer - Data to be uploaded. 5 | -------------------------------------------------------------------------------- /lib/browser/api/browser-view.ts: -------------------------------------------------------------------------------- 1 | const { BrowserView } = process._linkedBinding('electron_browser_browser_view'); 2 | 3 | export default BrowserView; 4 | -------------------------------------------------------------------------------- /lib/browser/api/native-image.ts: -------------------------------------------------------------------------------- 1 | const { nativeImage } = process._linkedBinding('electron_common_native_image'); 2 | 3 | export default nativeImage; 4 | -------------------------------------------------------------------------------- /spec-main/fixtures/auto-update/check/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-test-initial-app", 3 | "version": "1.0.0", 4 | "main": "./index.js" 5 | } -------------------------------------------------------------------------------- /spec-main/fixtures/pages/pdf-in-iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/features/macos-dark-mode/styles.css: -------------------------------------------------------------------------------- 1 | @media (prefers-color-scheme: dark) { 2 | body { background: #333; color: white; } 3 | } 4 | 5 | @media (prefers-color-scheme: light) { 6 | body { background: #ddd; color: black; } 7 | } 8 | -------------------------------------------------------------------------------- /lib/browser/api/desktop-capturer.ts: -------------------------------------------------------------------------------- 1 | import { getSourcesImpl } from '@electron/internal/browser/desktop-capturer'; 2 | 3 | export async function getSources (options: Electron.SourcesOptions) { 4 | return getSourcesImpl(null, options); 5 | } 6 | -------------------------------------------------------------------------------- /spec-main/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/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 | -------------------------------------------------------------------------------- /spec-main/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/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 | -------------------------------------------------------------------------------- /spec/spec-helpers.js: -------------------------------------------------------------------------------- 1 | exports.ifit = (condition) => (condition ? it : it.skip); 2 | exports.ifdescribe = (condition) => (condition ? describe : describe.skip); 3 | 4 | exports.delay = (time = 0) => new Promise(resolve => setTimeout(resolve, time)); 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec-main/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/pages/cache-storage.html: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-did-navigate-in-page-with-hash.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/fiddles/features/notifications/renderer/renderer.js: -------------------------------------------------------------------------------- 1 | const myNotification = new Notification('Title', { 2 | body: 'Notification from the Renderer process' 3 | }) 4 | 5 | myNotification.onclick = () => { 6 | console.log('Notification clicked') 7 | } 8 | -------------------------------------------------------------------------------- /spec-main/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/api/new-window-preload.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer, webFrame } = require('electron'); 2 | 3 | ipcRenderer.send('answer', { 4 | nativeWindowOpen: webFrame.getWebPreference('nativeWindowOpen'), 5 | argv: process.argv 6 | }); 7 | window.close(); 8 | -------------------------------------------------------------------------------- /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-main/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-main/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/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/api/native-window-open-argv.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/pages/storage/indexed_db.html: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /docs/tutorial/using-pepper-flash-plugin.md: -------------------------------------------------------------------------------- 1 | # Using 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 | -------------------------------------------------------------------------------- /lib/browser/api/notification.ts: -------------------------------------------------------------------------------- 1 | const { 2 | Notification: ElectronNotification, 3 | isSupported 4 | } = process._linkedBinding('electron_common_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-main/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/test.asar/web.asar: -------------------------------------------------------------------------------- 1 | <82{"files":{"index.html":{"size":150,"offset":"0"}}} 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/browser/api/ipc-main.ts: -------------------------------------------------------------------------------- 1 | import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl'; 2 | 3 | const ipcMain = new IpcMainImpl(); 4 | 5 | // Do not throw exception when channel name is "error". 6 | ipcMain.on('error', () => {}); 7 | 8 | export default ipcMain; 9 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/devtools-extension/foo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | foo 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/test.asar/script.asar: -------------------------------------------------------------------------------- 1 | `\V{"files":{"index.html":{"size":63,"offset":"0"},"index.js":{"size":54,"offset":"63"}}} 2 | 3 | 4 | 5 | 6 | require('electron').ipcRenderer.send('ping', 'pong'); 7 | -------------------------------------------------------------------------------- /spec-main/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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-main/fixtures/api/send-sync-message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/api/unload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec-main/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/onmouseup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-trusted-types.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/fiddles/features/online-detection/renderer/renderer.js: -------------------------------------------------------------------------------- 1 | const alertOnlineStatus = () => { window.alert(navigator.onLine ? 'online' : 'offline') } 2 | 3 | window.addEventListener('online', alertOnlineStatus) 4 | window.addEventListener('offline', alertOnlineStatus) 5 | 6 | alertOnlineStatus() 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/api/globals.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Document 5 | 6 | 7 | 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/onkeyup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /lib/browser/ipc-main-internal.ts: -------------------------------------------------------------------------------- 1 | import { IpcMainImpl } from '@electron/internal/browser/ipc-main-impl'; 2 | 3 | export const ipcMainInternal = new IpcMainImpl() as ElectronInternal.IpcMainInternal; 4 | 5 | // Do not throw exception when channel name is "error". 6 | ipcMainInternal.on('error', () => {}); 7 | -------------------------------------------------------------------------------- /spec-main/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-main/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/native-module.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /patches/v8/.patches: -------------------------------------------------------------------------------- 1 | add_realloc.patch 2 | build_gn.patch 3 | expose_mksnapshot.patch 4 | dcheck.patch 5 | export_symbols_needed_for_windows_build.patch 6 | workaround_an_undefined_symbol_error.patch 7 | do_not_export_private_v8_symbols_on_windows.patch 8 | fix_build_deprecated_attirbute_for_older_msvc_versions.patch 9 | -------------------------------------------------------------------------------- /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/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-main/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-main/fixtures/api/service-workers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /spec-main/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/webview-will-navigate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec-main/fixtures/api/service-workers/logs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/pages/base-page-security-onload-message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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 | 7 | ### `new TouchBarGroup(options)` 8 | 9 | * `options` Object 10 | * `items` [TouchBar](touch-bar.md) - Items to display as a group. 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/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 | -------------------------------------------------------------------------------- /spec-main/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/api/electron-module-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/fixtures/pages/storage/web_sql.html: -------------------------------------------------------------------------------- 1 | 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/api/structures/keyboard-input-event.md: -------------------------------------------------------------------------------- 1 | # KeyboardInputEvent Object extends `InputEvent` 2 | 3 | * `type` String - The type of the event, can be `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 | -------------------------------------------------------------------------------- /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-main/ambient.d.ts: -------------------------------------------------------------------------------- 1 | declare let standardScheme: string; 2 | 3 | declare namespace Electron { 4 | interface WebContents { 5 | getOwnerBrowserWindow(): BrowserWindow; 6 | getWebPreferences(): any; 7 | } 8 | 9 | interface Session { 10 | destroy(): void; 11 | } 12 | } 13 | 14 | declare module 'dbus-native'; 15 | -------------------------------------------------------------------------------- /spec-main/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-main/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-main/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 | -------------------------------------------------------------------------------- /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/api/structures/input-event.md: -------------------------------------------------------------------------------- 1 | # InputEvent Object 2 | 3 | * `modifiers` String[] (optional) - An array of modifiers of the event, can 4 | be `shift`, `control`, `ctrl`, `alt`, `meta`, `command`, `cmd`, `isKeypad`, 5 | `isAutoRepeat`, `leftButtonDown`, `middleButtonDown`, `rightButtonDown`, 6 | `capsLock`, `numLock`, `left`, `right`. 7 | -------------------------------------------------------------------------------- /spec-main/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-main/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 | "permissions": ["scripting"] 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/api/new-window.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/fixtures/pages/c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/pages/dom-ready.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /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-main/fixtures/apps/crash/node-crash.js: -------------------------------------------------------------------------------- 1 | if (process.platform === 'linux') { 2 | process.crashReporter.start({ 3 | submitURL: process.argv[2], 4 | productName: 'Zombies', 5 | compress: false, 6 | globalExtra: { 7 | _version: process.argv[3] 8 | } 9 | }); 10 | } 11 | process.nextTick(() => process.crash()); 12 | -------------------------------------------------------------------------------- /spec-main/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/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 | -------------------------------------------------------------------------------- /shell/app/electron_main.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 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 SHELL_APP_ELECTRON_MAIN_H_ 6 | #define SHELL_APP_ELECTRON_MAIN_H_ 7 | 8 | #include "content/public/app/content_main.h" 9 | 10 | #endif // SHELL_APP_ELECTRON_MAIN_H_ 11 | -------------------------------------------------------------------------------- /spec-main/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/pages/window-opener-webview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec-main/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/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 | -------------------------------------------------------------------------------- /docs/fiddles/features/online-detection/main/renderer.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | const updateOnlineStatus = () => { ipcRenderer.send('online-status-changed', navigator.onLine ? 'online' : 'offline') } 3 | 4 | window.addEventListener('online', updateOnlineStatus) 5 | window.addEventListener('offline', updateOnlineStatus) 6 | 7 | updateOnlineStatus() 8 | -------------------------------------------------------------------------------- /spec-main/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-main/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 | -------------------------------------------------------------------------------- /spec/fixtures/api/window-open-location-change.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | foo 9 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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-main/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-main/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 | -------------------------------------------------------------------------------- /spec/fixtures/pages/worker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec-main/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-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 | -------------------------------------------------------------------------------- /docs/fiddles/system/clipboard/paste/renderer.js: -------------------------------------------------------------------------------- 1 | const { clipboard } = require('electron') 2 | 3 | const pasteBtn = document.getElementById('paste-to') 4 | 5 | pasteBtn.addEventListener('click', () => { 6 | clipboard.writeText('What a demo!') 7 | const message = `Clipboard contents: ${clipboard.readText()}` 8 | document.getElementById('paste-from').innerHTML = message 9 | }) 10 | -------------------------------------------------------------------------------- /spec-main/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 | -------------------------------------------------------------------------------- /spec/fixtures/pages/geolocation/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/pages/history-replace.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-did-navigate-in-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Click me. 4 | This is content. 5 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs/fiddles/features/drag-and-drop/renderer.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | const fs = require('fs') 3 | 4 | document.getElementById('drag').ondragstart = (event) => { 5 | const fileName = 'drag-and-drop.md' 6 | fs.writeFileSync(fileName, '# Test drag and drop'); 7 | event.preventDefault() 8 | ipcRenderer.send('ondragstart', process.cwd() + `/${fileName}`) 9 | } 10 | -------------------------------------------------------------------------------- /spec/fixtures/api/offscreen-rendering.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/pages/beforeunload-false.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/pages/target-name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | link 4 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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": "^1.0.1", 12 | "@types/node": "^14.6.2", 13 | "extract-zip": "^1.0.3" 14 | }, 15 | "engines": { 16 | "node": ">= 8.6" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /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 SHELL_APP_NODE_MAIN_H_ 6 | #define SHELL_APP_NODE_MAIN_H_ 7 | 8 | namespace electron { 9 | 10 | int NodeMain(int argc, char* argv[]); 11 | 12 | } // namespace electron 13 | 14 | #endif // SHELL_APP_NODE_MAIN_H_ 15 | -------------------------------------------------------------------------------- /spec-main/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/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "mocha": true, 5 | "jquery": true, 6 | "serviceworker": true 7 | }, 8 | "globals": { 9 | "Bindings": true, 10 | "Components": true, 11 | "UI": true, 12 | "WebView": true 13 | }, 14 | "plugins": [ 15 | "mocha" 16 | ], 17 | "rules": { 18 | "mocha/no-exclusive-tests": "error" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /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-main/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "mocha": true, 5 | "jquery": true, 6 | "serviceworker": true 7 | }, 8 | "globals": { 9 | "Bindings": true, 10 | "Components": true, 11 | "UI": true, 12 | "WebView": true 13 | }, 14 | "plugins": [ 15 | "mocha" 16 | ], 17 | "rules": { 18 | "mocha/no-exclusive-tests": "error" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spec-main/fixtures/api/beforeunload-empty-string.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec-main/fixtures/api/beforeunload-false.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/fixtures/api/preload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec-main/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-main/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-main/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-main/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-main/fixtures/pages/datalist.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec-main/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 | -------------------------------------------------------------------------------- /spec-main/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/module/preload-pdf-loaded-in-subframe.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron'); 2 | 3 | document.addEventListener('DOMContentLoaded', (event) => { 4 | const subframe = document.querySelector('#pdf-frame'); 5 | if (subframe) { 6 | subframe.contentWindow.addEventListener('pdf-loaded', (event) => { 7 | ipcRenderer.send('pdf-loaded', event.detail); 8 | }); 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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: 'shell', loader: () => require('./shell') }, 5 | // The internal modules, invisible unless you know their names. 6 | { name: 'deprecate', loader: () => require('./deprecate'), private: true } 7 | ]; 8 | -------------------------------------------------------------------------------- /spec/fixtures/pages/a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /script/generate-zip-manifest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 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:])) 15 | -------------------------------------------------------------------------------- /spec-main/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-main/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 | -------------------------------------------------------------------------------- /spec/fixtures/api/native-window-open-file.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-opener-no-node-integration.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /vsts-arm32v7.yml: -------------------------------------------------------------------------------- 1 | resources: 2 | containers: 3 | - container: arm32v7-test-container 4 | image: electron.azurecr.io/build:arm32v7-6555a80939fb4c3ddf9343b3f140e573f40de225 5 | options: --shm-size 128m 6 | 7 | jobs: 8 | - job: Test_Arm32v7 9 | container: arm32v7-test-container 10 | displayName: Test Arm on Arm32v7 hardware 11 | timeoutInMinutes: 30 12 | steps: 13 | - template: vsts-arm-test-steps.yml 14 | -------------------------------------------------------------------------------- /vsts-arm64v8.yml: -------------------------------------------------------------------------------- 1 | resources: 2 | containers: 3 | - container: arm64v8-test-container 4 | image: electron.azurecr.io/build:arm64v8-6555a80939fb4c3ddf9343b3f140e573f40de225 5 | options: --shm-size 128m 6 | 7 | jobs: 8 | - job: Test_Arm64 9 | container: arm64v8-test-container 10 | displayName: Test Arm64 on Arm64 hardware 11 | timeoutInMinutes: 30 12 | steps: 13 | - template: vsts-arm-test-steps.yml 14 | -------------------------------------------------------------------------------- /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/communication/two-processes/synchronous-messages/renderer.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | 3 | const syncMsgBtn = document.getElementById('sync-msg') 4 | 5 | syncMsgBtn.addEventListener('click', () => { 6 | const reply = ipcRenderer.sendSync('synchronous-message', 'ping') 7 | const message = `Synchronous message reply: ${reply}` 8 | document.getElementById('sync-reply').innerHTML = message 9 | }) -------------------------------------------------------------------------------- /docs/fiddles/system/clipboard/copy/renderer.js: -------------------------------------------------------------------------------- 1 | const { clipboard } = require('electron') 2 | 3 | const copyBtn = document.getElementById('copy-to') 4 | const copyInput = document.getElementById('copy-to-input') 5 | 6 | copyBtn.addEventListener('click', () => { 7 | if (copyInput.value !== '') copyInput.value = '' 8 | copyInput.placeholder = 'Copied! Paste here to see.' 9 | clipboard.writeText('Electron Demo!') 10 | }) 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec-main/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 | -------------------------------------------------------------------------------- /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-main/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-main/fixtures/pages/webview-devtools.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spec-main/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 | -------------------------------------------------------------------------------- /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-main/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-main/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/api/no-leak.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Document 5 | 6 | 7 | 16 | 17 | -------------------------------------------------------------------------------- /spec/fixtures/pages/video.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 SHELL_BROWSER_FEATURE_LIST_H_ 6 | #define SHELL_BROWSER_FEATURE_LIST_H_ 7 | 8 | namespace electron { 9 | void InitializeFeatureList(); 10 | void InitializeFieldTrials(); 11 | } // namespace electron 12 | 13 | #endif // SHELL_BROWSER_FEATURE_LIST_H_ 14 | -------------------------------------------------------------------------------- /spec-main/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/api/native-window-open-blank.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /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) => { 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/shared_worker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webframe-spell-check.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-open-postMessage-driver.html: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec-main/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-main/api-view-spec.ts: -------------------------------------------------------------------------------- 1 | import { closeWindow } from './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/pages/key-events.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/static/get-files.js: -------------------------------------------------------------------------------- 1 | async function getFiles (directoryPath, { filter = null } = {}) { 2 | const files = []; 3 | const walker = require('walkdir').walk(directoryPath, { 4 | no_recurse: true 5 | }); 6 | walker.on('file', (file) => { 7 | if (!filter || filter(file)) { 8 | files.push(file); 9 | } 10 | }); 11 | await new Promise((resolve) => walker.on('end', resolve)); 12 | return files; 13 | } 14 | 15 | module.exports = getFiles; 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/fixtures/pages/visibilitychange.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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-main/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/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 | -------------------------------------------------------------------------------- /docs/fiddles/communication/two-processes/asynchronous-messages/renderer.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | 3 | const asyncMsgBtn = document.getElementById('async-msg') 4 | 5 | asyncMsgBtn.addEventListener('click', () => { 6 | ipcRenderer.send('asynchronous-message', 'ping') 7 | }) 8 | 9 | ipcRenderer.on('asynchronous-reply', (event, arg) => { 10 | const message = `Asynchronous message reply: ${arg}` 11 | document.getElementById('async-reply').innerHTML = message 12 | }) 13 | -------------------------------------------------------------------------------- /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/api/locale-check/main.js: -------------------------------------------------------------------------------- 1 | const { app } = require('electron'); 2 | 3 | const locale = process.argv[2].substr(11); 4 | if (locale.length !== 0) { 5 | app.commandLine.appendSwitch('lang', locale); 6 | } 7 | 8 | app.whenReady().then(() => { 9 | if (process.argv[3] === '--print-env') { 10 | process.stdout.write(String(process.env.LC_ALL)); 11 | } else { 12 | process.stdout.write(app.getLocale()); 13 | } 14 | process.stdout.end(); 15 | 16 | app.quit(); 17 | }); 18 | -------------------------------------------------------------------------------- /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/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-main/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 | -------------------------------------------------------------------------------- /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-main/fixtures/api/context-bridge/context-bridge-mutability/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spec-main/fixtures/crash-cases/quit-on-crashed-event/index.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | 3 | app.once('ready', () => { 4 | const w = new BrowserWindow({ 5 | show: false, 6 | webPreferences: { 7 | contextIsolation: false, 8 | nodeIntegration: true 9 | } 10 | }); 11 | w.webContents.once('crashed', () => { 12 | app.quit(); 13 | }); 14 | w.webContents.loadURL('about:blank'); 15 | w.webContents.executeJavaScript('process.crash()'); 16 | }); 17 | -------------------------------------------------------------------------------- /shell/app/command_line_args.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 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 SHELL_APP_COMMAND_LINE_ARGS_H_ 6 | #define SHELL_APP_COMMAND_LINE_ARGS_H_ 7 | 8 | #include "base/command_line.h" 9 | 10 | namespace electron { 11 | 12 | bool CheckCommandLineArguments(int argc, base::CommandLine::CharType** argv); 13 | 14 | } // namespace electron 15 | 16 | #endif // SHELL_APP_COMMAND_LINE_ARGS_H_ 17 | -------------------------------------------------------------------------------- /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(base::Optional guid) { 12 | static NotifyIconHost host; 13 | return host.CreateNotifyIcon(guid); 14 | } 15 | 16 | } // namespace electron 17 | -------------------------------------------------------------------------------- /spec/expect-helpers.js: -------------------------------------------------------------------------------- 1 | function resolveSingleObjectGetters (object) { 2 | if (object && typeof object === 'object') { 3 | const newObject = {}; 4 | for (const key in object) { // eslint-disable-line guard-for-in 5 | newObject[key] = resolveGetters(object[key])[0]; 6 | } 7 | return newObject; 8 | } 9 | return object; 10 | } 11 | 12 | function resolveGetters (...args) { 13 | return args.map(resolveSingleObjectGetters); 14 | } 15 | 16 | module.exports = { 17 | resolveGetters 18 | }; 19 | -------------------------------------------------------------------------------- /lib/browser/api/share-menu.ts: -------------------------------------------------------------------------------- 1 | import { BrowserWindow, Menu, SharingItem, PopupOptions } from 'electron/main'; 2 | 3 | class ShareMenu { 4 | private menu: Menu; 5 | 6 | constructor (sharingItem: SharingItem) { 7 | this.menu = new (Menu as any)({ sharingItem }); 8 | } 9 | 10 | popup (options?: PopupOptions) { 11 | this.menu.popup(options); 12 | } 13 | 14 | closePopup (browserWindow?: BrowserWindow) { 15 | this.menu.closePopup(browserWindow); 16 | } 17 | } 18 | 19 | export default ShareMenu; 20 | -------------------------------------------------------------------------------- /lib/isolated_renderer/init.ts: -------------------------------------------------------------------------------- 1 | /* global nodeProcess, isolatedWorld */ 2 | 3 | process._linkedBinding = nodeProcess._linkedBinding; 4 | 5 | const v8Util = process._linkedBinding('electron_common_v8_util'); 6 | 7 | const webViewImpl = v8Util.getHiddenValue(isolatedWorld, 'web-view-impl'); 8 | 9 | if (webViewImpl) { 10 | // Must setup the WebView element in main world. 11 | const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element'); 12 | setupWebView(v8Util, webViewImpl); 13 | } 14 | -------------------------------------------------------------------------------- /shell/app/electron_main_delegate_mac.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Slack Technologies, Inc. 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 | #ifndef SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_ 6 | #define SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_ 7 | 8 | namespace electron { 9 | 10 | // Initializes NSApplication. 11 | void RegisterAtomCrApp(); 12 | 13 | } // namespace electron 14 | 15 | #endif // SHELL_APP_ELECTRON_MAIN_DELEGATE_MAC_H_ 16 | -------------------------------------------------------------------------------- /shell/common/gin_helper/locker.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.chromium file. 4 | 5 | #include "shell/common/gin_helper/locker.h" 6 | 7 | namespace gin_helper { 8 | 9 | Locker::Locker(v8::Isolate* isolate) { 10 | if (IsBrowserProcess()) 11 | locker_ = std::make_unique(isolate); 12 | } 13 | 14 | Locker::~Locker() = default; 15 | 16 | } // namespace gin_helper 17 | -------------------------------------------------------------------------------- /shell/common/heap_snapshot.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 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 SHELL_COMMON_HEAP_SNAPSHOT_H_ 6 | #define SHELL_COMMON_HEAP_SNAPSHOT_H_ 7 | 8 | #include "base/files/file.h" 9 | #include "v8/include/v8.h" 10 | 11 | namespace electron { 12 | 13 | bool TakeHeapSnapshot(v8::Isolate* isolate, base::File* file); 14 | 15 | } // namespace electron 16 | 17 | #endif // SHELL_COMMON_HEAP_SNAPSHOT_H_ 18 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/content-script/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 |
14 | 15 | -------------------------------------------------------------------------------- /docs/fiddles/quick-start/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

11 | We are using Node.js , 12 | Chromium , 13 | and Electron . 14 |

15 | 16 | 17 | -------------------------------------------------------------------------------- /spec-main/fixtures/native-addon/uv-dlopen/index.js: -------------------------------------------------------------------------------- 1 | const testLoadLibrary = require('./build/Release/test_module'); 2 | 3 | const lib = (() => { 4 | switch (process.platform) { 5 | case 'linux': 6 | return `${__dirname}/build/Release/foo.so`; 7 | case 'darwin': 8 | return `${__dirname}/build/Release/foo.dylib`; 9 | case 'win32': 10 | return `${__dirname}/build/Release/libfoo.dll`; 11 | default: 12 | throw new Error('unsupported os'); 13 | } 14 | })(); 15 | 16 | testLoadLibrary(lib); 17 | -------------------------------------------------------------------------------- /spec-main/fixtures/sub-frames/frame-with-frame-container-webview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | This is the root page with a webview 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener-no-node-integration.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/ts-smoke/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "lib": [ 5 | "es6", 6 | "dom" 7 | ], 8 | "typeRoots" : ["../../node_modules/@types"], 9 | "noImplicitAny": true, 10 | "noImplicitThis": true, 11 | "strictNullChecks": false, 12 | "noEmit": true, 13 | "forceConsistentCasingInFileNames": true 14 | }, 15 | "files": [ 16 | "electron/main.ts", 17 | "electron/renderer.ts", 18 | "../../electron.d.ts" 19 | ] 20 | } -------------------------------------------------------------------------------- /lib/browser/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-restricted-imports": [ 4 | "error", 5 | { 6 | "paths": [ 7 | "electron", 8 | "electron/renderer" 9 | ], 10 | "patterns": [ 11 | "./*", 12 | "../*", 13 | "@electron/internal/isolated_renderer/*", 14 | "@electron/internal/renderer/*", 15 | "@electron/internal/sandboxed_worker/*", 16 | "@electron/internal/worker/*" 17 | ] 18 | } 19 | ] 20 | } 21 | } -------------------------------------------------------------------------------- /script/lib/npx.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | 6 | def npx(*npx_args): 7 | npx_env = os.environ.copy() 8 | npx_env['npm_config_yes'] = 'true' 9 | call_args = [__get_executable_name()] + list(npx_args) 10 | subprocess.check_call(call_args, env=npx_env) 11 | 12 | 13 | def __get_executable_name(): 14 | executable = 'npx' 15 | if sys.platform == 'win32': 16 | executable += '.cmd' 17 | return executable 18 | 19 | 20 | if __name__ == '__main__': 21 | npx(*sys.argv[1:]) 22 | -------------------------------------------------------------------------------- /spec-main/fixtures/apps/libuv-hang/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron'); 2 | 3 | contextBridge.exposeInMainWorld('api', { 4 | ipcRenderer, 5 | run: async () => { 6 | const { promises: fs } = require('fs'); 7 | for (let i = 0; i < 10; i++) { 8 | const list = await fs.readdir('.', { withFileTypes: true }); 9 | for (const file of list) { 10 | if (file.isFile()) { 11 | await fs.readFile(file.name, 'utf-8'); 12 | } 13 | } 14 | } 15 | } 16 | }); 17 | -------------------------------------------------------------------------------- /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, webPreferences: { nodeIntegration: true } }) 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 | -------------------------------------------------------------------------------- /spec-main/fixtures/auto-update/check/index.js: -------------------------------------------------------------------------------- 1 | process.on('uncaughtException', (err) => { 2 | console.error(err); 3 | process.exit(1); 4 | }); 5 | 6 | const { autoUpdater } = require('electron'); 7 | 8 | autoUpdater.on('error', (err) => { 9 | console.error(err); 10 | process.exit(1); 11 | }); 12 | 13 | const feedUrl = process.argv[1]; 14 | 15 | autoUpdater.setFeedURL({ 16 | url: feedUrl 17 | }); 18 | 19 | autoUpdater.checkForUpdates(); 20 | 21 | autoUpdater.on('update-not-available', () => { 22 | process.exit(0); 23 | }); 24 | -------------------------------------------------------------------------------- /spec-main/fixtures/extensions/content-script/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "content-script-test", 3 | "version": "1.0", 4 | "content_scripts": [ 5 | { 6 | "matches": [""], 7 | "css": ["all_frames-enabled.css"], 8 | "run_at": "document_start", 9 | "all_frames": true 10 | }, 11 | { 12 | "matches": [""], 13 | "css": ["all_frames-disabled.css"], 14 | "run_at": "document_start", 15 | "all_frames": false 16 | } 17 | ], 18 | "manifest_version": 2 19 | } 20 | -------------------------------------------------------------------------------- /spec-main/types-spec.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | 3 | describe('bundled @types/node', () => { 4 | it('should match the major version of bundled node', () => { 5 | expect(require('../npm/package.json').dependencies).to.have.property('@types/node'); 6 | const range = require('../npm/package.json').dependencies['@types/node']; 7 | expect(range).to.match(/^\^.+/, 'should allow any type dep in a major range'); 8 | expect(range.slice(1).split('.')[0]).to.equal(process.versions.node.split('.')[0]); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /spec/fixtures/pages/window-opener-no-webview-tag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec-main/fixtures/api/beforeunload-false-prevent3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /spec-main/fixtures/sub-frames/frame-container-webview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | This is the root page with a webview 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /script/start.js: -------------------------------------------------------------------------------- 1 | const cp = require('child_process'); 2 | const utils = require('./lib/utils'); 3 | const electronPath = utils.getAbsoluteElectronExec(); 4 | 5 | const child = cp.spawn(electronPath, process.argv.slice(2), { stdio: 'inherit' }); 6 | child.on('close', (code) => process.exit(code)); 7 | 8 | const handleTerminationSignal = (signal) => 9 | process.on(signal, () => { 10 | if (!child.killed) { 11 | child.kill(signal); 12 | } 13 | }); 14 | 15 | handleTerminationSignal('SIGINT'); 16 | handleTerminationSignal('SIGTERM'); 17 | -------------------------------------------------------------------------------- /docs/api/structures/mouse-input-event.md: -------------------------------------------------------------------------------- 1 | # MouseInputEvent Object extends `InputEvent` 2 | 3 | * `type` String - The type of the event, can be `mouseDown`, 4 | `mouseUp`, `mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`. 5 | * `x` Integer 6 | * `y` Integer 7 | * `button` String (optional) - The button pressed, can be `left`, `middle`, `right`. 8 | * `globalX` Integer (optional) 9 | * `globalY` Integer (optional) 10 | * `movementX` Integer (optional) 11 | * `movementY` Integer (optional) 12 | * `clickCount` Integer (optional) 13 | -------------------------------------------------------------------------------- /shell/browser/child_web_contents_tracker.cc: -------------------------------------------------------------------------------- 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 | #include "shell/browser/child_web_contents_tracker.h" 6 | 7 | namespace electron { 8 | 9 | ChildWebContentsTracker::ChildWebContentsTracker( 10 | content::WebContents* web_contents) {} 11 | 12 | ChildWebContentsTracker::~ChildWebContentsTracker() {} 13 | 14 | WEB_CONTENTS_USER_DATA_KEY_IMPL(ChildWebContentsTracker) 15 | 16 | } // namespace electron 17 | -------------------------------------------------------------------------------- /spec/fixtures/pages/webview-opener-postMessage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/fiddles/features/macos-dark-mode/renderer.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | 3 | document.getElementById('toggle-dark-mode').addEventListener('click', async () => { 4 | const isDarkMode = await ipcRenderer.invoke('dark-mode:toggle') 5 | document.getElementById('theme-source').innerHTML = isDarkMode ? 'Dark' : 'Light' 6 | }) 7 | 8 | document.getElementById('reset-to-system').addEventListener('click', async () => { 9 | await ipcRenderer.invoke('dark-mode:system') 10 | document.getElementById('theme-source').innerHTML = 'System' 11 | }) 12 | -------------------------------------------------------------------------------- /shell/browser/resources/win/dpi_aware.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | true/pm 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec-main/fixtures/api/native-window-open-native-addon.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /spec/fixtures/api/new-window-webview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es2020", 5 | "lib": [ 6 | "es2019", 7 | "esnext.weakref", 8 | "dom", 9 | "dom.iterable" 10 | ], 11 | "sourceMap": true, 12 | "experimentalDecorators": true, 13 | "strict": true, 14 | "baseUrl": ".", 15 | "allowJs": true, 16 | "noUnusedLocals": true, 17 | "outDir": "ts-gen", 18 | "paths": { 19 | "@electron/internal/*": ["lib/*"] 20 | } 21 | }, 22 | "exclude": [ 23 | "electron.d.ts" 24 | ], 25 | } 26 | -------------------------------------------------------------------------------- /docs/api/structures/custom-scheme.md: -------------------------------------------------------------------------------- 1 | # CustomScheme Object 2 | 3 | * `scheme` String - Custom schemes to be registered with options. 4 | * `privileges` Object (optional) 5 | * `standard` Boolean (optional) - Default false. 6 | * `secure` Boolean (optional) - Default false. 7 | * `bypassCSP` Boolean (optional) - Default false. 8 | * `allowServiceWorkers` Boolean (optional) - Default false. 9 | * `supportFetchAPI` Boolean (optional) - Default false. 10 | * `corsEnabled` Boolean (optional) - Default false. 11 | * `stream` Boolean (optional) - Default false. 12 | -------------------------------------------------------------------------------- /shell/common/language_util_linux.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 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/common/language_util.h" 6 | 7 | #include "ui/base/l10n/l10n_util.h" 8 | 9 | namespace electron { 10 | 11 | std::vector GetPreferredLanguages() { 12 | // Return empty as there's no API to use. You may be able to use 13 | // GetApplicationLocale() of a browser process. 14 | return std::vector{}; 15 | } 16 | 17 | } // namespace electron 18 | -------------------------------------------------------------------------------- /shell/renderer/resources/mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | ${ELECTRON_BUNDLE_ID} 7 | CFBundleName 8 | ${PRODUCT_NAME} 9 | CFBundlePackageType 10 | APPL 11 | LSUIElement 12 | 13 | NSSupportsAutomaticGraphicsSwitching 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/fiddles/windows/manage-windows/new-window/renderer.js: -------------------------------------------------------------------------------- 1 | const { shell, ipcRenderer } = require('electron') 2 | 3 | const newWindowBtn = document.getElementById('new-window') 4 | const link = document.getElementById('browser-window-link') 5 | 6 | newWindowBtn.addEventListener('click', (event) => { 7 | const url = 'https://electronjs.org' 8 | ipcRenderer.send('new-window', { url, width: 400, height: 320 }); 9 | }) 10 | 11 | link.addEventListener('click', (e) => { 12 | e.preventDefault() 13 | shell.openExternal("https://electronjs.org/docs/api/browser-window") 14 | }) 15 | -------------------------------------------------------------------------------- /shell/app/resources/mac/loginhelper-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | ${ELECTRON_BUNDLE_ID} 7 | CFBundleName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${PRODUCT_NAME} 11 | CFBundlePackageType 12 | APPL 13 | LSBackgroundOnly 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /shell/browser/ui/run_all_unittests.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 GitHub, Inc. 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 "base/bind.h" 6 | #include "base/test/launcher/unit_test_launcher.h" 7 | #include "base/test/test_suite.h" 8 | #include "build/build_config.h" 9 | 10 | int main(int argc, char** argv) { 11 | base::TestSuite test_suite(argc, argv); 12 | return base::LaunchUnitTests( 13 | argc, argv, 14 | base::BindOnce(&base::TestSuite::Run, base::Unretained(&test_suite))); 15 | } 16 | -------------------------------------------------------------------------------- /docs/fiddles/features/offscreen-rendering/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World! 5 | 6 | 7 | 8 |

Hello World!

9 |

10 | We are using node , 11 | Chrome , 12 | and Electron . 13 |

14 | 15 | 16 | -------------------------------------------------------------------------------- /shell/browser/ui/inspectable_web_contents_view_delegate.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Copyright (c) 2013 Adam Roben . All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE-CHROMIUM file. 5 | 6 | #include "shell/browser/ui/inspectable_web_contents_view_delegate.h" 7 | 8 | namespace electron { 9 | 10 | gfx::ImageSkia InspectableWebContentsViewDelegate::GetDevToolsWindowIcon() { 11 | return gfx::ImageSkia(); 12 | } 13 | 14 | } // namespace electron 15 | -------------------------------------------------------------------------------- /docs/fiddles/features/keyboard-shortcuts/interception-from-main/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 | We are using node , 11 | Chrome , 12 | and Electron . 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/fiddles/features/online-detection/renderer/main.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron') 2 | 3 | let onlineStatusWindow 4 | 5 | app.whenReady().then(() => { 6 | onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false }) 7 | onlineStatusWindow.loadURL(`file://${__dirname}/index.html`) 8 | }) 9 | 10 | app.on('window-all-closed', () => { 11 | if (process.platform !== 'darwin') { 12 | app.quit() 13 | } 14 | }) 15 | 16 | app.on('activate', () => { 17 | if (BrowserWindow.getAllWindows().length === 0) { 18 | createWindow() 19 | } 20 | }) 21 | -------------------------------------------------------------------------------- /docs/fiddles/system/clipboard/copy/main.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron') 2 | 3 | let mainWindow = null 4 | 5 | function createWindow () { 6 | const windowOptions = { 7 | width: 600, 8 | height: 400, 9 | title: 'Clipboard copy', 10 | webPreferences: { 11 | nodeIntegration: true 12 | } 13 | } 14 | 15 | mainWindow = new BrowserWindow(windowOptions) 16 | mainWindow.loadFile('index.html') 17 | 18 | mainWindow.on('closed', () => { 19 | mainWindow = null 20 | }) 21 | } 22 | 23 | app.whenReady().then(() => { 24 | createWindow() 25 | }) 26 | -------------------------------------------------------------------------------- /spec/fixtures/api/window-all-closed/main.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron'); 2 | 3 | let handled = false; 4 | 5 | if (app.commandLine.hasSwitch('handle-event')) { 6 | app.on('window-all-closed', () => { 7 | handled = true; 8 | app.quit(); 9 | }); 10 | } 11 | 12 | app.on('quit', () => { 13 | process.stdout.write(JSON.stringify(handled)); 14 | process.stdout.end(); 15 | }); 16 | 17 | app.whenReady().then(() => { 18 | const win = new BrowserWindow({ 19 | webPreferences: { 20 | contextIsolation: true 21 | } 22 | }); 23 | win.close(); 24 | }); 25 | -------------------------------------------------------------------------------- /docs/fiddles/features/macos-dock-menu/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

11 | We are using node , 12 | Chrome , 13 | and Electron . 14 |

15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/fiddles/features/progress-bar/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

11 | We are using node , 12 | Chrome , 13 | and Electron . 14 |

15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/fiddles/system/clipboard/paste/main.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron') 2 | 3 | let mainWindow = null 4 | 5 | function createWindow () { 6 | const windowOptions = { 7 | width: 600, 8 | height: 400, 9 | title: 'Clipboard paste', 10 | webPreferences: { 11 | nodeIntegration: true 12 | } 13 | } 14 | 15 | mainWindow = new BrowserWindow(windowOptions) 16 | mainWindow.loadFile('index.html') 17 | 18 | mainWindow.on('closed', () => { 19 | mainWindow = null 20 | }) 21 | } 22 | 23 | app.whenReady().then(() => { 24 | createWindow() 25 | }) 26 | -------------------------------------------------------------------------------- /shell/browser/font_defaults.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 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 SHELL_BROWSER_FONT_DEFAULTS_H_ 6 | #define SHELL_BROWSER_FONT_DEFAULTS_H_ 7 | 8 | namespace blink { 9 | namespace web_pref { 10 | struct WebPreferences; 11 | } // namespace web_pref 12 | } // namespace blink 13 | 14 | namespace electron { 15 | 16 | void SetFontDefaults(blink::web_pref::WebPreferences* prefs); 17 | 18 | } // namespace electron 19 | 20 | #endif // SHELL_BROWSER_FONT_DEFAULTS_H_ 21 | -------------------------------------------------------------------------------- /docs/fiddles/features/notifications/main/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

11 | We are using node , 12 | Chrome , 13 | and Electron . 14 |

15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/fiddles/features/recent-documents/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

11 | We are using node , 12 | Chrome , 13 | and Electron . 14 |

15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/fiddles/features/represented-file/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello World! 6 | 7 | 8 | 9 |

Hello World!

10 |

11 | We are using node , 12 | Chrome , 13 | and Electron . 14 |

15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/fiddles/native-ui/dialogs/error-dialog/renderer.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer, shell } = require('electron') 2 | 3 | const links = document.querySelectorAll('a[href]') 4 | const errorBtn = document.getElementById('error-dialog') 5 | 6 | errorBtn.addEventListener('click', event => { 7 | ipcRenderer.send('open-error-dialog') 8 | }) 9 | 10 | Array.prototype.forEach.call(links, (link) => { 11 | const url = link.getAttribute('href') 12 | if (url.indexOf('http') === 0) { 13 | link.addEventListener('click', (e) => { 14 | e.preventDefault() 15 | shell.openExternal(url) 16 | }) 17 | } 18 | }) -------------------------------------------------------------------------------- /script/start-goma.ps1: -------------------------------------------------------------------------------- 1 | param([string]$gomaDir=$PWD) 2 | $cmdPath = Join-Path -Path $gomaDir -ChildPath "goma_ctl.py" 3 | Start-Process -FilePath cmd -ArgumentList "/C", "python", "$cmdPath", "ensure_start" 4 | $timedOut = $false; $waitTime = 0; $waitIncrement = 5; $timeout=120; 5 | Do { sleep $waitIncrement; $timedOut = (($waitTime+=$waitIncrement) -gt $timeout); iex "$gomaDir\gomacc.exe port 2" > $null; } Until(($LASTEXITCODE -eq 0) -or $timedOut) 6 | if ($timedOut) { 7 | write-error 'Timed out waiting for goma to start'; exit 1; 8 | } else { 9 | Write-Output "Successfully started goma!" 10 | } 11 | -------------------------------------------------------------------------------- /spec-main/api-power-save-blocker-spec.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import { powerSaveBlocker } from 'electron/main'; 3 | 4 | describe('powerSaveBlocker module', () => { 5 | it('can be started and stopped', () => { 6 | expect(powerSaveBlocker.isStarted(-1)).to.be.false('is started'); 7 | const id = powerSaveBlocker.start('prevent-app-suspension'); 8 | expect(id).to.to.be.a('number'); 9 | expect(powerSaveBlocker.isStarted(id)).to.be.true('is started'); 10 | powerSaveBlocker.stop(id); 11 | expect(powerSaveBlocker.isStarted(id)).to.be.false('is started'); 12 | }); 13 | }); 14 | --------------------------------------------------------------------------------