Compare commits

..

54 Commits

Author SHA1 Message Date
Shelley Vohr
15151c6853 fix: EventSource undefined in Renderer/Worker (#44475) 2024-10-31 15:24:44 -04:00
John Kleinschmidt
8be4ae4bab build: handle out of disk space on source cache (#44490)
* build: handle out of disk space on source cache

* build: add cron job to free up source cache disk space
2024-10-31 15:03:28 -04:00
Sam Maddock
31f8e7553b fix: flaky utility and BrowserView tests (#44451)
* fix: flake wait for crash with specific serviceName

* fix: flake when unrelated WebContents exists during BrowserView tests

* fix: wait for crash before forking

* use name
2024-10-30 20:29:01 -05:00
Charles Kerr
7cdf1a01b8 docs: fix win.setContentView() arg type (#44478)
fix: setContentView type
2024-10-30 15:56:10 -04:00
Charles Kerr
a720c8daf6 perf: remove isolate scope from DidProcessTask() (#44439) 2024-10-29 23:25:40 -05:00
Charles Kerr
fb959f8d30 build: enable -Wunsafe-buffer-usage warnings (#44056) 2024-10-29 17:28:34 -05:00
Alice Zhao
de04fc3b90 fix: update shell.openExternal to correctly focus on external window (#44408)
* fix: Use openURL:configuration:completionHandler instead of openUrl

* test: add a test

* fix: add dispatch_async to replace GetUIThreadTaskRunner

* refactor: remove unused import

* fix: update to use BindPostTaskToCurrentDefault

* test: add regression test for window focus

* refactor: update to explicit task runner
2024-10-29 15:10:10 -07:00
Shelley Vohr
7ff7160135 docs: fix win.getContentView() return type (#44430)
docs: fix win.getContentView() return type
2024-10-29 21:41:44 +01:00
Shelley Vohr
9fc94a162b build: fix python util verbose mode logic (#44431)
build: fix verbose mode logic
2024-10-29 11:35:57 -04:00
Devin Binnie
53458da01e docs: Fix powerMonitor docs for type generation of speed-limit-change (#44391)
Fix `powerMonitor` docs for type generation of `speed-limit-change`
2024-10-29 10:16:29 -05:00
Charles Kerr
dffe00b232 fix: -Wunsafe-buffer-usage warnings with argc, argv (#44366)
* refactor: move uv_setup_args() calls to startup

* refactor: call base::CommandLine::Init() before ContentMain()

* feat: add ElectronCommandLine::AsUtf8()

* refactor: call base::CommandLine::Init() before NodeMain()

* refactor: use ElectronCommandLine::AsUtf8() in NodeMain()

* fix: -Wunsafe-buffer-usage warning in ElectronCommandLine::Init()

* chore: add a DCHECK to confirm ElectronCommandLine was initialized before AsUtf8() is called

* chore: const correctness in ElectronCommandLine::Init() args

* chore: add ElectronCommandLine to macOS Electron Helper app

* chore: move argc, argvc setup into electron_library_main on macOS

* chore: revert BUILD.gn changes

* fix: WideToUTF8() call in ElectronCommandLine::AsUtf8()

* build: add uv to the include paths for app/electron_main_linux

* build: add uv to the include paths for app/electron_library_main.mm

* chore: revert unrelated changes

these were intended for another branch
2024-10-29 13:23:08 +01:00
Shelley Vohr
39b24aed92 refactor: move node ofs script to electron (#44425)
* refactor: move node ofs script to electron

* chore: remove empty file
2024-10-29 13:22:26 +01:00
dependabot[bot]
f7ead785cd build(deps): bump actions/setup-node from 4.0.4 to 4.1.0 (#44433)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.0.4 to 4.1.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](0a44ba7841...39370e3970)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-29 13:21:09 +01:00
Charles Kerr
b3c2e83243 refactor: prefer inline constexpr string_view for string constants (#44405)
* refactor: BaseWindow::OnExecuteAppCommand() now takes a std::string_view

* refactor: NativeWindow::NotifyWindowExecuteAppCommand() takes a std::string_view

* refactor: AppCommandToString() returns a std::string_view, is now constexpr

* refactor: make kBrowserBackward, kBrowserForward inline constexpr std::string_view

Xref: https://abseil.io/tips/140

https://groups.google.com/a/chromium.org/g/chromium-dev/c/jROTxMo_m2Q/m/HgciN2KsAgAJ

* refactor: use inline constexpr string_view for kDevice*Key constants

Xref: https://abseil.io/tips/140

https://groups.google.com/a/chromium.org/g/chromium-dev/c/jROTxMo_m2Q/m/HgciN2KsAgAJ

* refactor: IsEnvSet now takes a base::cstring_view

* refactor: use inline constexpr cstring_view for kRunAsNode

* refactor: use inline constexpr string_view for kPDF*PluginName

* refactor: use base::FilePath::FromASCII() since "internal-pdf-viewer" is ascii

* chore: remove unused shell/common/electron_constants.cc

* fixup! refactor: IsEnvSet now takes a base::cstring_view
2024-10-29 10:30:12 +01:00
dependabot[bot]
cc3359f126 build(deps): bump actions/checkout from 4.2.1 to 4.2.2 (#44435)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](eef61447b9...11bd71901b)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-29 09:59:22 +01:00
Shelley Vohr
46561fc5bc build: improve gen-libc++-filenames output (#44424)
build: improve gen-libc++-filenames output
2024-10-29 09:59:10 +01:00
dependabot[bot]
214c8228ed build(deps): bump github/codeql-action from 3.26.13 to 3.27.0 (#44434)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.13 to 3.27.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](f779452ac5...662472033e)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-29 01:05:46 -05:00
Robo
739688214b fix: keep gdk_pixbuf a dynamic dependency (#44423) 2024-10-29 09:44:20 +09:00
Charles Kerr
5d0d15a0b3 perf: prefer NewFromUtf8Literal() over NewFromUtf8() for string literals (#44412)
* perf: prefer NewFromUtf8Literal() over NewFromUtf8() for string literals

the string length is known at compile time and no need to call ToLocalChecked()

* perf: string length is known when calling NewFromUtf8(), so use it

* perf: remove unnecessary calls to c_str()

these just force the code being called to have to recalculate the string length
2024-10-28 14:12:32 +01:00
Sam Maddock
348801b20e fix: crash on netlog connection error (#44406)
* fix: crash on netlog connection error

* refactor: remove default PromiseBase constructor

* Revert "refactor: remove default PromiseBase constructor"

This reverts commit 9292324a0d.

* remove dcheck
2024-10-28 10:24:54 +01:00
John Kleinschmidt
57920e7747 test: deflake flaky tests on linux (#44383) 2024-10-24 20:47:17 -04:00
John Kleinschmidt
a0f51d816e build: update linux container (#44392) 2024-10-24 16:58:36 -04:00
Charles Kerr
83d7040096 fix: -Wunsafe-buffer-usage warning in didRegisterForRemoteNotificationsWithDeviceToken (#44348)
* chore: move as_byte_span() to new shell/common/mac_util.h

this way it can be used by multiple mm files

* fix: -Wunsafe-buffer-usage warnings in UNNotificationResponseToNSDictionary

* refactor: use base::HexEncode() instead of rolling our own

* fixup! chore: move as_byte_span() to new shell/common/mac_util.h

* fixup! chore: move as_byte_span() to new shell/common/mac_util.h

fix: move mac_util to the right place in filenames.gni
2024-10-23 14:18:22 -05:00
John Kleinschmidt
c42fb09fc9 test: fixup flaky tests (#44349)
* test: fixup flaky test

* test: disable flaky protocol speed test on macOS

* test: fixup flaky test in api-browser-window-spec.ts
2024-10-23 15:14:50 -04:00
Shelley Vohr
fd500477ac docs: clarify utilityProcess child.pid value (#44339) 2024-10-22 13:09:33 -04:00
electron-appveyor-updater[bot]
d60d526df6 build: update appveyor image to latest version (#44334)
Co-authored-by: electron-appveyor-updater[bot] <161660339+electron-appveyor-updater[bot]@users.noreply.github.com>
2024-10-22 10:40:00 -04:00
Charles Kerr
e3e94d45ee fix: silence -Wunsafe-buffer-usage warning in GetPreferredLanguages() (#44333)
fix: use UNSAFE_BUFFERS macro in GetPreferredLanguages()
2024-10-21 18:20:00 -05:00
Sam Maddock
fff6ea438a fix: software compositing infinite loop (#44318)
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
2024-10-21 18:56:03 -04:00
Robo
3e77faf2f7 fix: crash when generating shortcut text for super accelerator (#44341) 2024-10-22 03:26:38 +09:00
John Kleinschmidt
cc9d85d3ca build: fixup reclient use for prod builds (#44340) 2024-10-21 14:07:02 -04:00
electron-roller[bot]
d3d02ef111 chore: bump chromium to 132.0.6789.0 (main) (#44337)
chore: bump chromium in DEPS to 132.0.6789.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-10-21 10:48:59 -04:00
electron-roller[bot]
e70f70f5b4 chore: bump chromium to 132.0.6788.0 (main) (#44331)
chore: bump chromium in DEPS to 132.0.6788.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
2024-10-20 23:54:06 -05:00
electron-roller[bot]
0d948da4b9 chore: bump chromium to 132.0.6787.0 (main) (#44329)
* chore: bump chromium in DEPS to 132.0.6785.0

* chore: bump chromium in DEPS to 132.0.6787.0

* 5837702: mac fullscreen: always show traffic lights

https://chromium-review.googlesource.com/c/chromium/src/+/5837702

* 5892572: Move SimpleMenuModel out of ui/base

https://chromium-review.googlesource.com/c/chromium/src/+/5892572

* 5938185: Remove lacros code from //ui/base/clipboard

https://chromium-review.googlesource.com/c/chromium/src/+/5938185

* chore: fixup patch indices

* 5939514: Wire up the preference of overlay scrollbars to the ChromeOS settings

https://chromium-review.googlesource.com/c/chromium/src/+/5939514

* chore: fixup patch indices

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-10-20 19:02:21 -05:00
dependabot[bot]
2cf59b3885 build(deps-dev): bump webpack from 5.94.0 to 5.95.0 (#44309)
Bumps [webpack](https://github.com/webpack/webpack) from 5.94.0 to 5.95.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.94.0...v5.95.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-20 10:40:03 +02:00
Sam Maddock
87bd665e41 feat: expose frame & move properties to console-message event object (#43617)
* feat: expose frame on console-message event

refactor: use property names similar to ServiceWorker's console-message event

refactor: don't use deprecated params in tests

doc: console-message breaking change

chore: add deprecation warning

docs: restore deprecated argument descriptions

* move console-message deprecations to v34

---------

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-18 16:07:06 -04:00
John Beutner
35aeab6ecd fix: respect setAlwaysOnTop before showInactive on Linux under X11 (#44078)
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-18 14:29:52 -04:00
electron-roller[bot]
738533dec7 chore: bump chromium to 132.0.6783.0 (main) (#44307)
* chore: bump chromium in DEPS to 132.0.6782.0

* chore: bump chromium in DEPS to 132.0.6783.0

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-18 12:06:33 -04:00
electron-appveyor-updater[bot]
456aac1f94 build: update appveyor image to latest version (#44311)
Co-authored-by: electron-appveyor-updater[bot] <161660339+electron-appveyor-updater[bot]@users.noreply.github.com>
2024-10-18 11:24:24 -04:00
dependabot[bot]
6c6e5c002a build(deps): bump actions/upload-artifact from 4.4.0 to 4.4.3 (#44173)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.4.0 to 4.4.3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](50769540e7...b4b15b8c7c)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-18 15:39:55 +02:00
electron-roller[bot]
089f233054 chore: bump chromium to 132.0.6781.0 (main) (#44301)
* chore: bump chromium in DEPS to 132.0.6781.0

* chore: update patches

* 5933789: [MappableSI] Remove kill-switch from RenderableGpuMemoryBufferVideoFramePool.

https://chromium-review.googlesource.com/c/chromium/src/+/5933789

* 5938992: Reland: Remove `force_guest_profile` param from context getters.

https://chromium-review.googlesource.com/c/chromium/src/+/5938992

* 5928743: spanification: Add WTF::String::FromUTF8(span<>) overloads

https://chromium-review.googlesource.com/c/chromium/src/+/5928743

* 5898835: Update windows SDK version to 10.0.26100.1742

https://chromium-review.googlesource.com/c/chromium/src/+/5898835

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-17 20:00:59 -04:00
dependabot[bot]
2b0624f2f1 build(deps-dev): bump remark-cli from 10.0.0 to 12.0.1 (#44258)
Bumps [remark-cli](https://github.com/remarkjs/remark) from 10.0.0 to 12.0.1.
- [Release notes](https://github.com/remarkjs/remark/releases)
- [Changelog](https://github.com/remarkjs/remark/blob/main/changelog.md)
- [Commits](https://github.com/remarkjs/remark/compare/10.0.0...remark-cli@12.0.1)

---
updated-dependencies:
- dependency-name: remark-cli
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-17 15:15:48 -04:00
Keeley Hammond
ac09d11ed1 build: fix main printing patch conflict (#44302)
build: update patches
2024-10-17 11:29:04 -04:00
John Kleinschmidt
9280add5b4 chore: fixup reclient read only access on forks (#44280) 2024-10-17 11:17:54 -04:00
Mayur
44c398fedb docs: removed AngularJS Batarang from the Devtool Extension Support (#44261)
docs: update Devtool Extension Support
2024-10-17 10:55:05 -04:00
David Sanders
cbc12d6675 ci: use Node.js 20 in Bake AppVeyor Image workflow (#44290)
* ci: use Node.js 20 in Bake AppVeyor Image workflow

* chore: add bake workflow to CODEOWNERS
2024-10-17 10:35:50 -04:00
electron-roller[bot]
d801bad5d2 chore: bump chromium to 132.0.6779.0 (main) (#44273)
* chore: bump chromium in DEPS to 132.0.6779.0

* chore: update patches

* 5904951: controlledframe: Disable File System Access for <controlledframe>

https://chromium-review.googlesource.com/c/chromium/src/+/5904951

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-16 21:41:31 -04:00
Shelley Vohr
d386664900 build: use new Issue Template types in templates (#44224)
* build: use new Issue Template types in templates

* build: restore existing labels for now
2024-10-16 15:34:35 -04:00
David Sanders
67775d19ec build: remove dead code in prepare release script (#44256) 2024-10-16 15:05:09 -04:00
Shelley Vohr
cbe3cb770a fix: Linux crash after webContents.print() with no parent window (#44246)
fix: Linux crash after print with no parent window
2024-10-16 13:15:21 -04:00
Shelley Vohr
bd4ea5ba72 fix: use proper PDF save approach (#44248) 2024-10-16 11:33:21 -04:00
Robo
af6e2fb257 fix: trace-startup crashing child process on macOS (#44257) 2024-10-16 11:03:00 -04:00
Shelley Vohr
df45474b58 fix: ensure utilityProcess only emits one 'exit' event (#44243)
fix: ensure utilityProcess only emits one exit
2024-10-16 10:47:12 +02:00
Charles Kerr
b5acebf3ba fix: -Wunsafe-buffer-usage warnings in TaskbarHost::SetThumbarButtons() (#44238)
* fix: -Wunsafe-buffer-usage warnings in TaskbarHost::SetThumbarButtons()

* fixup! fix: -Wunsafe-buffer-usage warning in ChunkedDataPipeReadableStream (#44211)
2024-10-15 18:31:44 -05:00
electron-roller[bot]
ef84f13650 chore: bump chromium to 131.0.6778.0 (main) (#44251)
* chore: bump chromium in DEPS to 131.0.6778.0

* 5803393: [UI] Add alias for mojo version of `MenuSourceType`

https://chromium-review.googlesource.com/c/chromium/src/+/5803393

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2024-10-15 16:41:14 -04:00
74 changed files with 1211 additions and 544 deletions

1
.github/CODEOWNERS vendored
View File

@@ -8,6 +8,7 @@
DEPS @electron/wg-upgrades
# Releases WG
/.github/workflows/update_appveyor_image.yml @electron/wg-releases
/docs/breaking-changes.md @electron/wg-releases
/npm/ @electron/wg-releases
/script/release @electron/wg-releases

View File

@@ -1,6 +1,6 @@
name: Bug Report
description: Report an Electron bug
title: "[Bug]: "
description: Report a bug in Electron
type: 'bug'
labels: "bug :beetle:"
body:
- type: checkboxes

View File

@@ -1,6 +1,6 @@
name: Feature Request
description: Suggest an idea for Electron
title: "[Feature Request]: "
type: 'enhancement'
labels: "enhancement :sparkles:"
body:
- type: checkboxes

View File

@@ -57,13 +57,26 @@ runs:
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
echo "Using cache key: $DEPSHASH"
echo "Checking for cache in: $cache_path"
if [ ! -f "$cache_path" ]; then
if [ ! -f "$cache_path" ] || [ `du $cache_path | cut -f1` = "0" ]; then
echo "cache_exists=false" >> $GITHUB_OUTPUT
echo "Cache Does Not Exist for $DEPSHASH"
else
echo "cache_exists=true" >> $GITHUB_OUTPUT
echo "Cache Already Exists for $DEPSHASH, Skipping.."
fi
- name: Check cross instance cache disk space
if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash
run: |
# if there is less than 20 GB free space then creating the cache might fail so exit early
freespace=`df -m /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
freespace_human=`df -h /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
if [ $freespace -le 20000 ]; then
echo "The cross mount cache has $freespace_human free space which is not enough - exiting"
exit 1
else
echo "The cross mount cache has $freespace_human free space - continuing"
fi
- name: Gclient Sync
if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash

View File

@@ -17,6 +17,11 @@ runs:
fi
echo "Persisted cache is $(du -sh $cache_path | cut -f1)"
if [ `du $cache_path | cut -f1` = "0" ]; then
echo "Cache is empty - exiting"
exit 1
fi
mkdir temp-cache
tar -xf $cache_path -C temp-cache
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"

View File

@@ -44,6 +44,11 @@ runs:
shell: bash
run: |
echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)"
if [ `du $DEPSHASH.tar | cut -f1` = "0" ]; then
echo "Cache is empty - exiting"
exit 1
fi
mkdir temp-cache
tar -xf $DEPSHASH.tar -C temp-cache
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"

View File

@@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.0.2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2
with:
fetch-depth: 0
- name: Setup Node.js/npm
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: 20.11.x
- name: Setting Up Dig Site
@@ -41,7 +41,7 @@ jobs:
sha-file: .dig-old
filename: electron.old.d.ts
- name: Upload artifacts
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3
with:
name: artifacts
path: electron/artifacts

View File

@@ -40,7 +40,7 @@ jobs:
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
docs-only: ${{ steps.set-output.outputs.docs-only }}
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.0.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
@@ -94,7 +94,7 @@ jobs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
@@ -120,7 +120,7 @@ jobs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0

21
.github/workflows/clean-src-cache.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Clean Source Cache
on:
schedule:
- cron: "0 0 * * SUN" # Run at midnight every Sunday
jobs:
clean-src-cache:
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
options: --user root
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
steps:
- name: Cleanup Source Cache
shell: bash
run: |
df -h /mnt/cross-instance-cache
find /mnt/cross-instance-cache -type f -mtime +30 -delete
df -h /mnt/cross-instance-cache

View File

@@ -30,7 +30,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0

View File

@@ -31,7 +31,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0

View File

@@ -20,7 +20,7 @@ jobs:
container: ${{ fromJSON(inputs.container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0

View File

@@ -20,7 +20,7 @@ jobs:
container: ${{ fromJSON(inputs.container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0

View File

@@ -83,7 +83,7 @@ jobs:
- name: Create src dir
run: mkdir src
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
@@ -95,7 +95,7 @@ jobs:
run: df -h
- name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'macos' }}
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: 20.11.x
cache: yarn
@@ -156,7 +156,7 @@ jobs:
if: ${{ inputs.target-platform == 'linux' }}
uses: ./src/electron/.github/actions/restore-cache-aks
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0

View File

@@ -50,7 +50,7 @@ jobs:
TARGET_ARCH: ${{ inputs.target-arch }}
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
@@ -128,7 +128,7 @@ jobs:
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0

View File

@@ -91,7 +91,7 @@ jobs:
fi
done
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
@@ -203,7 +203,7 @@ jobs:
if: always() && !cancelled()
- name: Upload Test Artifacts
if: always() && !cancelled()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: test_artifacts_${{ env.ARTIFACT_KEY }}
path: src/electron/spec/artifacts

View File

@@ -45,7 +45,7 @@ jobs:
container: ${{ fromJSON(inputs.test-container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
@@ -108,7 +108,7 @@ jobs:
container: ${{ fromJSON(inputs.test-container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0

View File

@@ -22,7 +22,7 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
@@ -42,7 +42,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: SARIF file
path: results.sarif
@@ -50,6 +50,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13
uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
with:
sarif_file: results.sarif

View File

@@ -19,10 +19,14 @@ jobs:
with:
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20.11.x
- name: Yarn install
run: |
node script/yarn.js install --frozen-lockfile

View File

@@ -865,6 +865,7 @@ if (is_mac) {
":electron_framework_resources",
":electron_swiftshader_library",
":electron_xibs",
"//third_party/electron_node:node_lib",
]
if (!is_mas_build) {
deps += [ ":electron_crashpad_helper" ]
@@ -920,7 +921,6 @@ if (is_mac) {
"shell/app/electron_main_mac.cc",
"shell/app/uv_stdio_fix.cc",
"shell/app/uv_stdio_fix.h",
"shell/common/electron_constants.cc",
]
include_dirs = [ "." ]
info_plist = "shell/renderer/resources/mac/Info.plist"
@@ -1189,6 +1189,7 @@ if (is_mac) {
"//components/crash/core/app",
"//content:sandbox_helper_win",
"//electron/buildflags",
"//third_party/electron_node:node_lib",
"//ui/strings",
]
@@ -1535,7 +1536,7 @@ copy("node_gypi_headers") {
action("node_version_header") {
inputs = [ "$node_dir/src/node_version.h" ]
outputs = [ "$node_headers_dir/include/node/node_version.h" ]
script = "script/generate_node_version_header.py"
script = "script/node/generate_node_version_header.py"
args = rebase_path(inputs) + rebase_path(outputs)
if (node_module_version != "") {
args += [ "$node_module_version" ]

2
DEPS
View File

@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
vars = {
'chromium_version':
'132.0.6789.1',
'132.0.6789.0',
'node_version':
'v20.18.0',
'nan_version':

View File

@@ -77,3 +77,6 @@ enterprise_cloud_content_analysis = false
# TODO: remove dependency on legacy ipc
# https://issues.chromium.org/issues/40943039
content_enable_legacy_ipc = true
# Electron has its own unsafe-buffers enforcement directories.
clang_unsafe_buffers_paths = "//electron/electron_unsafe_buffers_paths.txt"

View File

@@ -512,7 +512,7 @@ Sets the content view of the window.
#### `win.getContentView()`
Returns [View](view.md) - The content view of the window.
Returns [`View`](view.md) - The content view of the window.
#### `win.destroy()`

View File

@@ -42,6 +42,8 @@ See https://developer.apple.com/library/archive/documentation/Performance/Concep
### Event: 'speed-limit-change' _macOS_ _Windows_
Returns:
* `limit` number - The operating system's advertised speed limit for CPUs, in percent.
Notification of a change in the operating system's advertised speed limit for

View File

@@ -955,11 +955,17 @@ Emitted when a `<webview>` has been attached to this web contents.
Returns:
* `event` Event
* `level` Integer - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
* `message` string - The actual console message
* `line` Integer - The line number of the source that triggered this console message
* `sourceId` string
* `details` Event\<\>
* `message` string - Message text
* `level` string - Message severity
Possible values include `info`, `warning`, `error`, and `debug`.
* `lineNumber` Integer - Line number in the log source
* `sourceId` string - URL of the log source
* `frame` WebFrameMain - Frame that logged the message
* `level` Integer _Deprecated_ - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
* `message` string _Deprecated_ - The actual console message
* `line` Integer _Deprecated_ - The line number of the source that triggered this console message
* `sourceId` string _Deprecated_
Emitted when the associated window logs a console message.

View File

@@ -12,6 +12,23 @@ This document uses the following convention to categorize breaking changes:
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
## Planned Breaking API Changes (34.0)
### Deprecated: `level`, `message`, `line`, and `sourceId` arguments in `console-message` event on `WebContents`
The `console-message` event on `WebContents` has been updated to provide details on the `Event`
argument.
```js
// Deprecated
webContents.on('console-message', (event, level, message, line, sourceId) => {})
// Replace with:
webContents.on('console-message', ({ level, message, lineNumber, sourceId, frame }) => {})
```
Additionally, `level` is now a string with possible values of `info`, `warning`, `error`, and `debug`.
## Planned Breaking API Changes (33.0)
### Behavior Changed: frame properties may retrieve detached WebFrameMain instances or none at all

View File

@@ -78,7 +78,6 @@ The following Devtools extensions have been tested to work in Electron:
* [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi)
* [Backbone Debugger](https://chrome.google.com/webstore/detail/backbone-debugger/bhljhndlimiafopmmhjlgfpnnchjjbhd)
* [jQuery Debugger](https://chrome.google.com/webstore/detail/jquery-debugger/dbhhnnnpaeobfddmlalhnehgclcmjimi)
* [AngularJS Batarang](https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk)
* [Vue.js devtools](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)
* [Cerebral Debugger](https://cerebraljs.com/docs/introduction/devtools.html)
* [Redux DevTools Extension](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd)

View File

@@ -0,0 +1,34 @@
# Copyright 2024 The Electron Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# The set of path prefixes that should be checked for unsafe buffer usage (see
# -Wunsafe-buffer-usage in Clang).
#
# ***
# Paths should be written as relative to the root of the source tree with
# unix-style path separators. Directory prefixes should end with `/`, such
# as `base/`.
# ***
#
# Files in this set are known to not use pointer arithmetic/subscripting, and
# make use of constructs like base::span or containers like std::vector instead.
#
# See `docs/unsafe_buffers.md`.
# These directories are excluded because they come from outside Electron and
# we don't have control over their contents.
-base/
-chrome/
-components/
-device/
-extensions/
-google_apis/
-net/
-services/
-skia/
-third_party/
-tools/
-ui/
-url/
-v8/

View File

@@ -582,7 +582,6 @@ filenames = {
"shell/common/crash_keys.h",
"shell/common/electron_command_line.cc",
"shell/common/electron_command_line.h",
"shell/common/electron_constants.cc",
"shell/common/electron_constants.h",
"shell/common/electron_paths.h",
"shell/common/gin_converters/accelerator_converter.cc",

View File

@@ -549,6 +549,8 @@ WebContents.prototype.goToOffset = function (index: number) {
return this._goToOffset(index);
};
const consoleMessageDeprecated = deprecate.warnOnceMessage('\'console-message\' arguments are deprecated and will be removed. Please use Event<WebContentsConsoleMessageEventParams> object instead.');
// Add JavaScript wrappers for WebContents class.
WebContents.prototype._init = function () {
const prefs = this.getLastWebPreferences() || {};
@@ -909,6 +911,15 @@ WebContents.prototype._init = function () {
openDialogs.clear();
});
// TODO(samuelmaddock): remove deprecated 'console-message' arguments
this.on('-console-message' as any, (event: Electron.Event<Electron.WebContentsConsoleMessageEventParams>) => {
const hasDeprecatedListener = this.listeners('console-message').some(listener => listener.length > 1);
if (hasDeprecatedListener) {
consoleMessageDeprecated();
}
this.emit('console-message', event, (event as any)._level, event.message, event.lineNumber, event.sourceId);
});
app.emit('web-contents-created', { sender: this, preventDefault () {}, get defaultPrevented () { return false; } }, this);
// Properties

View File

@@ -6,7 +6,7 @@ wrapFsWithAsar(require('fs'));
// See ElectronRendererClient::DidCreateScriptContext.
if ((globalThis as any).blinkfetch) {
const keys = ['fetch', 'Response', 'FormData', 'Request', 'Headers'];
const keys = ['fetch', 'Response', 'FormData', 'Request', 'Headers', 'EventSource'];
for (const key of keys) {
(globalThis as any)[key] = (globalThis as any)[`blink${key}`];
}

View File

@@ -19,7 +19,7 @@ global.require = makeRequireFunction(global.module);
// See WebWorkerObserver::WorkerScriptReadyForEvaluation.
if ((globalThis as any).blinkfetch) {
const keys = ['fetch', 'Response', 'FormData', 'Request', 'Headers'];
const keys = ['fetch', 'Response', 'FormData', 'Request', 'Headers', 'EventSource'];
for (const key of keys) {
(globalThis as any)[key] = (globalThis as any)[`blink${key}`];
}

View File

@@ -46,7 +46,7 @@
"null-loader": "^4.0.1",
"pre-flight": "^2.0.0",
"process": "^0.11.10",
"remark-cli": "^10.0.0",
"remark-cli": "^12.0.1",
"remark-preset-lint-markdown-style-guide": "^4.0.0",
"semver": "^7.6.3",
"shx": "^0.3.4",
@@ -58,7 +58,7 @@
"ts-node": "6.2.0",
"typescript": "^5.6.2",
"url": "^0.11.4",
"webpack": "^5.94.0",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
"wrapper-webpack-plugin": "^2.2.0"
},

View File

@@ -132,5 +132,5 @@ build_expose_webplugininfo_interface_to_electron.patch
osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch
feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch
chore_partial_revert_of.patch
ui_add_missing_shortcut_text_for_vkey_command_on_linux.patch
fix_software_compositing_infinite_loop.patch
ui_add_missing_shortcut_text_for_vkey_command_on_linux.patch

View File

@@ -11,7 +11,7 @@ really in 20/21. We have to wait until 22 is released to be able to
build with upstream GN files.
diff --git a/BUILD.gn b/BUILD.gn
index 1ed186b597eece7c34cb69c8e1e20870555a040d..2ce1e8a7dcca2ba153d387d11970c72b5f43c167 100644
index 1ed186b597eece7c34cb69c8e1e20870555a040d..e36168f0a051ca2fa2fc024aadcf5375b860105e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1,14 +1,406 @@
@@ -113,7 +113,7 @@ index 1ed186b597eece7c34cb69c8e1e20870555a040d..2ce1e8a7dcca2ba153d387d11970c72b
+}
+
+action("node_js2c_original_fs") {
+ script = "tools/generate_original_fs.py"
+ script = "//electron/script/node/generate_original_fs.py"
+ inputs = fs_files
+ outputs = []
+ foreach(file, fs_files + original_fs_files) {
@@ -2384,30 +2384,6 @@ index 0000000000000000000000000000000000000000..37c16859003e61636fe2f1a4040b1e90
+ f.write(FILENAMES_JSON_HEADER)
+ f.write(json.dumps(out, sort_keys=True, indent=2, separators=(',', ': ')))
+ f.write('\n')
diff --git a/tools/generate_original_fs.py b/tools/generate_original_fs.py
new file mode 100644
index 0000000000000000000000000000000000000000..5259e6a7a1fd6b21df69dc461dee67d95800c2c8
--- /dev/null
+++ b/tools/generate_original_fs.py
@@ -0,0 +1,18 @@
+import os
+import sys
+
+node_root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+out_dir = sys.argv[1]
+fs_files = sys.argv[2:]
+
+for fs_file in fs_files:
+ with open(os.path.join(node_root_dir, fs_file), 'r') as f:
+ contents = f.read()
+ original_fs_file = fs_file.replace('internal/fs/', 'internal/original-fs/').replace('lib/fs.js', 'lib/original-fs.js').replace('lib/fs/', 'lib/original-fs/')
+
+ with open(os.path.join(out_dir, fs_file), 'w') as original_f:
+ original_f.write(contents)
+
+ with open(os.path.join(out_dir, original_fs_file), 'w') as transformed_f:
+ transformed_contents = contents.replace('internal/fs/', 'internal/original-fs/').replace('require(\'fs', 'require(\'original-fs')
+ transformed_f.write(transformed_contents)
diff --git a/tools/install.py b/tools/install.py
index b132c7bf26c02886a7ab341a1973bf449744ba0f..757e3e60a7be01fac55c5fbb010dbbae00b1bfca 100755
--- a/tools/install.py

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env python3
import re
import sys
node_version_file = sys.argv[1]
out_file = sys.argv[2]
NMV = None
if len(sys.argv) > 3:
NMV = sys.argv[3]
with open(node_version_file, 'r', encoding='utf-8') as in_file, \
open(out_file, 'w', encoding='utf-8') as out_file:
changed = False
contents = in_file.read()
new_contents = re.sub(
r'^#define NODE_MODULE_VERSION [0-9]+$',
'#define NODE_MODULE_VERSION ' + NMV,
contents,
flags=re.MULTILINE)
changed = contents != new_contents
if not changed and NMV is not None:
raise Exception("Did not modify the NMV from nodes value, this value MUST "
"differ from node")
out_file.writelines(new_contents)

View File

@@ -0,0 +1,25 @@
#!/usr/bin/python3
import re
import sys
node_version_file = sys.argv[1]
out_file = sys.argv[2]
NMV = None
if len(sys.argv) > 3:
NMV = sys.argv[3]
with open(node_version_file, 'r', encoding='utf-8') as in_file:
with open(out_file, 'w', encoding='utf-8') as out_file:
changed = False
contents = in_file.read()
new_contents = re.sub(r'^#define NODE_MODULE_VERSION [0-9]+$',
'#define NODE_MODULE_VERSION ' + NMV,
contents, flags=re.MULTILINE)
changed = contents != new_contents
if not changed and NMV is not None:
raise Exception('NMV must differ from current value in Node.js')
out_file.writelines(new_contents)

View File

@@ -0,0 +1,28 @@
#!/usr/bin/python3
import os
import sys
NODE_ROOT_DIR = "../../third_party/electron_node"
out_dir = sys.argv[1]
fs_files = sys.argv[2:]
for fs_file in fs_files:
with open(os.path.join(NODE_ROOT_DIR, fs_file), 'r',
encoding='utf-8') as f:
contents = f.read()
original_fs_file = fs_file.replace('internal/fs/',
'internal/original-fs/').replace('lib/fs.js',
'lib/original-fs.js').replace('lib/fs/',
'lib/original-fs/')
with open(os.path.join(out_dir, fs_file), 'w', encoding='utf-8'
) as original_f:
original_f.write(contents)
with open(os.path.join(out_dir, original_fs_file), 'w',
encoding='utf-8') as transformed_f:
transformed_contents = contents.replace('internal/fs/',
'internal/original-fs/').replace('require(\'fs',
'require(\'original-fs')
transformed_f.write(transformed_contents)

View File

@@ -187,7 +187,8 @@ void ElectronContentClient::AddPlugins(
pdf_info.name = kPDFInternalPluginName;
pdf_info.description = kPDFPluginDescription;
// This isn't a real file path; it's just used as a unique identifier.
pdf_info.path = base::FilePath(kPdfPluginPath);
static constexpr std::string_view kPdfPluginPath = "internal-pdf-viewer";
pdf_info.path = base::FilePath::FromASCII(kPdfPluginPath);
content::WebPluginMimeType pdf_mime_type(
pdf::kInternalPluginMimeType, kPDFPluginExtension, kPDFPluginDescription);
pdf_info.mime_types.push_back(pdf_mime_type);

View File

@@ -9,6 +9,7 @@
#include "base/apple/bundle_locations.h"
#include "base/apple/scoped_nsautorelease_pool.h"
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
#include "content/public/app/content_main.h"
#include "electron/fuses.h"
@@ -16,21 +17,22 @@
#include "shell/app/node_main.h"
#include "shell/common/electron_command_line.h"
#include "shell/common/mac/main_application_bundle.h"
#include "uv.h"
int ElectronMain(int argc, char* argv[]) {
electron::ElectronMainDelegate delegate;
content::ContentMainParams params(&delegate);
params.argc = argc;
params.argv = const_cast<const char**>(argv);
argv = uv_setup_args(argc, argv);
base::CommandLine::Init(argc, argv);
electron::ElectronCommandLine::Init(argc, argv);
electron::ElectronMainDelegate delegate;
// Ensure that Bundle Id is set before ContentMain.
// Refs https://chromium-review.googlesource.com/c/chromium/src/+/5581006
delegate.OverrideChildProcessPath();
delegate.OverrideFrameworkBundlePath();
delegate.SetUpBundleOverrides();
return content::ContentMain(std::move(params));
return content::ContentMain(content::ContentMainParams{&delegate});
}
int ElectronInitializeICUandStartNode(int argc, char* argv[]) {
@@ -39,6 +41,10 @@ int ElectronInitializeICUandStartNode(int argc, char* argv[]) {
return 1;
}
argv = uv_setup_args(argc, argv);
base::CommandLine::Init(argc, argv);
electron::ElectronCommandLine::Init(argc, argv);
base::AtExitManager atexit_manager;
base::apple::ScopedNSAutoreleasePool pool;
base::apple::SetOverrideFrameworkBundlePath(
@@ -47,5 +53,5 @@ int ElectronInitializeICUandStartNode(int argc, char* argv[]) {
.Append("Frameworks")
.Append(ELECTRON_PRODUCT_NAME " Framework.framework"));
base::i18n::InitializeICU();
return electron::NodeMain(argc, argv);
return electron::NodeMain();
}

View File

@@ -8,6 +8,7 @@
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
#include "base/strings/cstring_view.h"
#include "content/public/app/content_main.h"
#include "electron/fuses.h"
#include "shell/app/electron_main_delegate.h" // NOLINT
@@ -15,12 +16,13 @@
#include "shell/app/uv_stdio_fix.h"
#include "shell/common/electron_command_line.h"
#include "shell/common/electron_constants.h"
#include "uv.h"
namespace {
bool IsEnvSet(const char* name) {
char* indicator = getenv(name);
return indicator && indicator[0] != '\0';
[[nodiscard]] bool IsEnvSet(const base::cstring_view name) {
const char* const indicator = getenv(name.c_str());
return indicator && *indicator;
}
} // namespace
@@ -28,17 +30,16 @@ bool IsEnvSet(const char* name) {
int main(int argc, char* argv[]) {
FixStdioStreams();
argv = uv_setup_args(argc, argv);
base::CommandLine::Init(argc, argv);
electron::ElectronCommandLine::Init(argc, argv);
if (electron::fuses::IsRunAsNodeEnabled() && IsEnvSet(electron::kRunAsNode)) {
base::i18n::InitializeICU();
base::AtExitManager atexit_manager;
return electron::NodeMain(argc, argv);
return electron::NodeMain();
}
electron::ElectronMainDelegate delegate;
content::ContentMainParams params(&delegate);
electron::ElectronCommandLine::Init(argc, argv);
params.argc = argc;
params.argv = const_cast<const char**>(argv);
base::CommandLine::Init(params.argc, params.argv);
return content::ContentMain(std::move(params));
return content::ContentMain(content::ContentMainParams{&delegate});
}

View File

@@ -5,10 +5,12 @@
#include <cstdlib>
#include <memory>
#include "base/strings/cstring_view.h"
#include "electron/fuses.h"
#include "electron/mas.h"
#include "shell/app/electron_library_main.h"
#include "shell/app/uv_stdio_fix.h"
#include "shell/common/electron_constants.h"
#if defined(HELPER_EXECUTABLE) && !IS_MAS_BUILD()
#include <mach-o/dyld.h>
@@ -27,9 +29,9 @@ void abort_report_np(const char* fmt, ...);
namespace {
bool IsEnvSet(const char* name) {
char* indicator = getenv(name);
return indicator && indicator[0] != '\0';
[[nodiscard]] bool IsEnvSet(const base::cstring_view name) {
const char* const indicator = getenv(name.c_str());
return indicator && *indicator;
}
#if defined(HELPER_EXECUTABLE) && !IS_MAS_BUILD()
@@ -51,8 +53,7 @@ bool IsEnvSet(const char* name) {
int main(int argc, char* argv[]) {
FixStdioStreams();
if (electron::fuses::IsRunAsNodeEnabled() &&
IsEnvSet("ELECTRON_RUN_AS_NODE")) {
if (electron::fuses::IsRunAsNodeEnabled() && IsEnvSet(electron::kRunAsNode)) {
return ElectronInitializeICUandStartNode(argc, argv);
}

View File

@@ -21,6 +21,7 @@
#include "base/i18n/icu_util.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/process/launch.h"
#include "base/strings/cstring_view.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/dark_mode_support.h"
#include "chrome/app/exit_code_watcher_win.h"
@@ -45,9 +46,9 @@ namespace {
const char kUserDataDir[] = "user-data-dir";
const char kProcessType[] = "type";
bool IsEnvSet(const char* name) {
size_t required_size;
getenv_s(&required_size, nullptr, 0, name);
[[nodiscard]] bool IsEnvSet(const base::cstring_view name) {
size_t required_size = 0;
getenv_s(&required_size, nullptr, 0, name.c_str());
return required_size != 0;
}
@@ -126,20 +127,19 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
// If we are already a fiber then continue normal execution.
#endif // defined(ARCH_CPU_32_BITS)
struct Arguments {
{
int argc = 0;
RAW_PTR_EXCLUSION wchar_t** argv =
::CommandLineToArgvW(::GetCommandLineW(), &argc);
~Arguments() { LocalFree(argv); }
} arguments;
if (!arguments.argv)
return -1;
wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
if (!argv)
return -1;
base::CommandLine::Init(0, nullptr); // args ignored on Windows
electron::ElectronCommandLine::Init(argc, argv);
LocalFree(argv);
}
#ifdef _DEBUG
// Don't display assert dialog boxes in CI test runs
static const char kCI[] = "CI";
static constexpr base::cstring_view kCI = "CI";
if (IsEnvSet(kCI)) {
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
@@ -158,18 +158,12 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
if (run_as_node || !IsEnvSet("ELECTRON_NO_ATTACH_CONSOLE"))
base::RouteStdioToConsole(false);
std::vector<char*> argv(arguments.argc);
std::transform(arguments.argv, arguments.argv + arguments.argc, argv.begin(),
[](auto& a) { return _strdup(base::WideToUTF8(a).c_str()); });
if (run_as_node) {
base::AtExitManager atexit_manager;
base::i18n::InitializeICU();
auto ret = electron::NodeMain(argv.size(), argv.data());
std::ranges::for_each(argv, free);
return ret;
return electron::NodeMain();
}
base::CommandLine::Init(argv.size(), argv.data());
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
@@ -234,6 +228,5 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
content::ContentMainParams params(&delegate);
params.instance = instance;
params.sandbox_info = &sandbox_info;
electron::ElectronCommandLine::Init(arguments.argc, arguments.argv);
return content::ContentMain(std::move(params));
}

View File

@@ -27,6 +27,7 @@
#include "shell/app/uv_task_runner.h"
#include "shell/browser/javascript_environment.h"
#include "shell/common/api/electron_bindings.h"
#include "shell/common/electron_command_line.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_bindings.h"
#include "shell/common/node_includes.h"
@@ -115,12 +116,8 @@ v8::Local<v8::Value> GetParameters(v8::Isolate* isolate) {
namespace electron {
int NodeMain(int argc, char* argv[]) {
bool initialized = base::CommandLine::Init(argc, argv);
if (!initialized) {
LOG(ERROR) << "Failed to initialize CommandLine";
exit(1);
}
int NodeMain() {
DCHECK(base::CommandLine::InitializedForCurrentProcess());
auto os_env = base::Environment::Create();
bool node_options_enabled = electron::fuses::IsNodeOptionsEnabled();
@@ -182,11 +179,8 @@ int NodeMain(int argc, char* argv[]) {
// Explicitly register electron's builtin bindings.
NodeBindings::RegisterBuiltinBindings();
// Hack around with the argv pointer. Used for process.title = "blah".
argv = uv_setup_args(argc, argv);
// Parse Node.js cli flags and strip out disallowed options.
std::vector<std::string> args(argv, argv + argc);
const std::vector<std::string> args = ElectronCommandLine::AsUtf8();
ExitIfContainsDisallowedFlags(args);
std::unique_ptr<node::InitializationResult> result =

View File

@@ -7,7 +7,7 @@
namespace electron {
int NodeMain(int argc, char* argv[]);
int NodeMain();
} // namespace electron

View File

@@ -285,7 +285,7 @@ void BaseWindow::OnWindowAlwaysOnTopChanged() {
Emit("always-on-top-changed", IsAlwaysOnTop());
}
void BaseWindow::OnExecuteAppCommand(const std::string& command_name) {
void BaseWindow::OnExecuteAppCommand(const std::string_view command_name) {
Emit("app-command", command_name);
}

View File

@@ -84,7 +84,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
void OnWindowEnterHtmlFullScreen() override;
void OnWindowLeaveHtmlFullScreen() override;
void OnWindowAlwaysOnTopChanged() override;
void OnExecuteAppCommand(const std::string& command_name) override;
void OnExecuteAppCommand(std::string_view command_name) override;
void OnTouchBarItemResult(const std::string& item_id,
const base::Value::Dict& details) override;
void OnNewWindowForTab() override;

View File

@@ -1068,14 +1068,31 @@ void WebContents::Close(std::optional<gin_helper::Dictionary> options) {
}
}
bool WebContents::DidAddMessageToConsole(
content::WebContents* source,
void WebContents::OnDidAddMessageToConsole(
content::RenderFrameHost* source_frame,
blink::mojom::ConsoleMessageLevel level,
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id) {
return Emit("console-message", static_cast<int32_t>(level), message, line_no,
source_id);
const std::u16string& source_id,
const std::optional<std::u16string>& untrusted_stack_trace) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::HandleScope handle_scope(isolate);
gin::Handle<gin_helper::internal::Event> event =
gin_helper::internal::Event::New(isolate);
v8::Local<v8::Object> event_object = event.ToV8().As<v8::Object>();
gin_helper::Dictionary dict(isolate, event_object);
dict.SetGetter("frame", source_frame);
dict.Set("level", level);
dict.Set("message", message);
dict.Set("lineNumber", line_no);
dict.Set("sourceId", source_id);
// TODO(samuelmaddock): Delete when deprecated arguments are fully removed.
dict.Set("_level", static_cast<int32_t>(level));
EmitWithoutEvent("-console-message", event);
}
void WebContents::OnCreateWindow(

View File

@@ -530,11 +530,6 @@ class WebContents final : public ExclusiveAccessContext,
#endif
// content::WebContentsDelegate:
bool DidAddMessageToConsole(content::WebContents* source,
blink::mojom::ConsoleMessageLevel level,
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id) override;
bool IsWebContentsCreationOverridden(
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
@@ -680,6 +675,13 @@ class WebContents final : public ExclusiveAccessContext,
content::RenderWidgetHost* render_widget_host) override;
void OnWebContentsLostFocus(
content::RenderWidgetHost* render_widget_host) override;
void OnDidAddMessageToConsole(
content::RenderFrameHost* source_frame,
blink::mojom::ConsoleMessageLevel level,
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id,
const std::optional<std::u16string>& untrusted_stack_trace) override;
// InspectableWebContentsDelegate:
void DevToolsReloadPage() override;

View File

@@ -17,7 +17,6 @@ void MicrotasksRunner::WillProcessTask(const base::PendingTask& pending_task,
bool was_blocked_or_low_priority) {}
void MicrotasksRunner::DidProcessTask(const base::PendingTask& pending_task) {
v8::Isolate::Scope scope(isolate_);
// In the browser process we follow Node.js microtask policy of kExplicit
// and let the MicrotaskRunner which is a task observer for chromium UI thread
// scheduler run the microtask checkpoint. This worked fine because Node.js

View File

@@ -665,9 +665,10 @@ void NativeWindow::NotifyWindowAlwaysOnTopChanged() {
observer.OnWindowAlwaysOnTopChanged();
}
void NativeWindow::NotifyWindowExecuteAppCommand(const std::string& command) {
void NativeWindow::NotifyWindowExecuteAppCommand(
const std::string_view command_name) {
for (NativeWindowObserver& observer : observers_)
observer.OnExecuteAppCommand(command);
observer.OnExecuteAppCommand(command_name);
}
void NativeWindow::NotifyTouchBarItemInteraction(const std::string& item_id,

View File

@@ -326,7 +326,7 @@ class NativeWindow : public base::SupportsUserData,
void NotifyWindowEnterHtmlFullScreen();
void NotifyWindowLeaveHtmlFullScreen();
void NotifyWindowAlwaysOnTopChanged();
void NotifyWindowExecuteAppCommand(const std::string& command);
void NotifyWindowExecuteAppCommand(std::string_view command_name);
void NotifyTouchBarItemInteraction(const std::string& item_id,
base::Value::Dict details);
void NotifyNewWindowForTab();

View File

@@ -6,6 +6,7 @@
#define ELECTRON_SHELL_BROWSER_NATIVE_WINDOW_OBSERVER_H_
#include <string>
#include <string_view>
#include "base/observer_list_types.h"
#include "base/values.h"
@@ -102,7 +103,7 @@ class NativeWindowObserver : public base::CheckedObserver {
// Called on Windows when App Commands arrive (WM_APPCOMMAND)
// Some commands are implemented on on other platforms as well
virtual void OnExecuteAppCommand(const std::string& command_name) {}
virtual void OnExecuteAppCommand(std::string_view command_name) {}
virtual void UpdateWindowControlsOverlay(const gfx::Rect& bounding_rect) {}
};

View File

@@ -28,7 +28,7 @@ namespace electron {
namespace {
// Convert Win32 WM_APPCOMMANDS to strings.
const char* AppCommandToString(int command_id) {
constexpr std::string_view AppCommandToString(int command_id) {
switch (command_id) {
case APPCOMMAND_BROWSER_BACKWARD:
return kBrowserBackward;
@@ -227,8 +227,8 @@ void NativeWindowViews::Maximize() {
}
bool NativeWindowViews::ExecuteWindowsCommand(int command_id) {
std::string command = AppCommandToString(command_id);
NotifyWindowExecuteAppCommand(command);
const auto command_name = AppCommandToString(command_id);
NotifyWindowExecuteAppCommand(command_name);
return false;
}

View File

@@ -5,7 +5,8 @@
#include "shell/common/electron_command_line.h"
#include "base/command_line.h"
#include "uv.h" // NOLINT(build/include_directory)
#include "base/containers/to_vector.h"
#include "base/strings/utf_string_conversions.h"
namespace electron {
@@ -13,17 +14,25 @@ namespace electron {
base::CommandLine::StringVector ElectronCommandLine::argv_;
// static
void ElectronCommandLine::Init(int argc, base::CommandLine::CharType** argv) {
void ElectronCommandLine::Init(int argc,
base::CommandLine::CharType const* const* argv) {
DCHECK(argv_.empty());
// NOTE: uv_setup_args does nothing on Windows, so we don't need to call it.
// Otherwise we'd have to convert the arguments from UTF16.
#if !BUILDFLAG(IS_WIN)
// Hack around with the argv pointer. Used for process.title = "blah"
argv = uv_setup_args(argc, argv);
#endif
// Safety: as is normal in command lines, argc and argv must correspond
// to one another. Otherwise there will be out-of-bounds accesses.
argv_.assign(argv, UNSAFE_BUFFERS(argv + argc));
}
argv_.assign(argv, argv + argc);
// static
std::vector<std::string> ElectronCommandLine::AsUtf8() {
DCHECK(!argv_.empty());
#if BUILDFLAG(IS_WIN)
return base::ToVector(
argv_, [](const auto& wstr) { return base::WideToUTF8(wstr); });
#else
return argv_;
#endif
}
#if BUILDFLAG(IS_LINUX)

View File

@@ -20,7 +20,9 @@ class ElectronCommandLine {
static const base::CommandLine::StringVector& argv() { return argv_; }
static void Init(int argc, base::CommandLine::CharType** argv);
static std::vector<std::string> AsUtf8();
static void Init(int argc, base::CommandLine::CharType const* const* argv);
#if BUILDFLAG(IS_LINUX)
// On Linux the command line has to be read from base::CommandLine since

View File

@@ -1,25 +0,0 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/common/electron_constants.h"
namespace electron {
const char kBrowserForward[] = "browser-forward";
const char kBrowserBackward[] = "browser-backward";
const char kDeviceVendorIdKey[] = "vendorId";
const char kDeviceProductIdKey[] = "productId";
const char kDeviceSerialNumberKey[] = "serialNumber";
const char kRunAsNode[] = "ELECTRON_RUN_AS_NODE";
#if BUILDFLAG(ENABLE_PDF_VIEWER)
const char kPDFExtensionPluginName[] = "Chromium PDF Viewer";
const char kPDFInternalPluginName[] = "Chromium PDF Plugin";
const base::FilePath::CharType kPdfPluginPath[] =
FILE_PATH_LITERAL("internal-pdf-viewer");
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
} // namespace electron

View File

@@ -5,26 +5,29 @@
#ifndef ELECTRON_SHELL_COMMON_ELECTRON_CONSTANTS_H_
#define ELECTRON_SHELL_COMMON_ELECTRON_CONSTANTS_H_
#include "base/files/file_path.h"
#include <string_view>
#include "base/strings/cstring_view.h"
#include "electron/buildflags/buildflags.h"
namespace electron {
// The app-command in NativeWindow.
extern const char kBrowserForward[];
extern const char kBrowserBackward[];
inline constexpr std::string_view kBrowserForward = "browser-forward";
inline constexpr std::string_view kBrowserBackward = "browser-backward";
// Keys for Device APIs
extern const char kDeviceVendorIdKey[];
extern const char kDeviceProductIdKey[];
extern const char kDeviceSerialNumberKey[];
inline constexpr std::string_view kDeviceVendorIdKey = "vendorId";
inline constexpr std::string_view kDeviceProductIdKey = "productId";
inline constexpr std::string_view kDeviceSerialNumberKey = "serialNumber";
extern const char kRunAsNode[];
inline constexpr base::cstring_view kRunAsNode = "ELECTRON_RUN_AS_NODE";
#if BUILDFLAG(ENABLE_PDF_VIEWER)
extern const char kPDFExtensionPluginName[];
extern const char kPDFInternalPluginName[];
extern const base::FilePath::CharType kPdfPluginPath[];
inline constexpr std::string_view kPDFExtensionPluginName =
"Chromium PDF Viewer";
inline constexpr std::string_view kPDFInternalPluginName =
"Chromium PDF Plugin";
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
} // namespace electron

View File

@@ -28,6 +28,7 @@
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
#include "third_party/blink/public/common/widget/device_emulation_params.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
#include "third_party/blink/public/mojom/loader/referrer.mojom.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/events/blink/blink_event_util.h"
@@ -699,4 +700,18 @@ bool Converter<blink::CloneableMessage>::FromV8(v8::Isolate* isolate,
return electron::SerializeV8Value(isolate, val, out);
}
// static
v8::Local<v8::Value> Converter<blink::mojom::ConsoleMessageLevel>::ToV8(
v8::Isolate* isolate,
const blink::mojom::ConsoleMessageLevel& in) {
using Val = blink::mojom::ConsoleMessageLevel;
static constexpr auto Lookup = base::MakeFixedFlatMap<Val, std::string_view>({
{Val::kVerbose, "debug"},
{Val::kInfo, "info"},
{Val::kWarning, "warning"},
{Val::kError, "error"},
});
return StringToV8(isolate, Lookup.at(in));
}
} // namespace gin

View File

@@ -10,6 +10,7 @@
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/messaging/cloneable_message.h"
#include "third_party/blink/public/common/web_cache/web_cache_resource_type_stats.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom-forward.h"
#include "third_party/blink/public/mojom/loader/referrer.mojom-forward.h"
namespace blink {
@@ -126,6 +127,12 @@ struct Converter<blink::CloneableMessage> {
blink::CloneableMessage* out);
};
template <>
struct Converter<blink::mojom::ConsoleMessageLevel> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const blink::mojom::ConsoleMessageLevel& in);
};
v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags);
v8::Local<v8::Value> MediaFlagsToV8(v8::Isolate* isolate, int mediaFlags);

View File

@@ -22,7 +22,10 @@ std::vector<std::string> GetPreferredLanguages() {
DCHECK(languages); // A valid pointer is guaranteed.
DCHECK(*languages); // At least one entry, "C", is guaranteed.
for (; *languages; ++languages) {
// SAFETY: |g_get_language_names()| returns a glib-owned array
// of const C strings, terminated by an empty string.
// This loop is the correct way to walk through its return values.
for (; *languages; UNSAFE_BUFFERS(++languages)) {
if (strcmp(*languages, "C") != 0) {
preferredLanguages.push_back(base::i18n::GetCanonicalLocale(*languages));
}

View File

@@ -799,15 +799,8 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
v8::Local<v8::Context> context,
node::MultiIsolatePlatform* platform,
std::optional<base::RepeatingCallback<void()>> on_app_code_ready) {
#if BUILDFLAG(IS_WIN)
auto& electron_args = ElectronCommandLine::argv();
std::vector<std::string> args(electron_args.size());
std::ranges::transform(electron_args, args.begin(),
[](auto& a) { return base::WideToUTF8(a); });
#else
auto args = ElectronCommandLine::argv();
#endif
return CreateEnvironment(context, platform, args, {}, on_app_code_ready);
return CreateEnvironment(context, platform, ElectronCommandLine::AsUtf8(), {},
on_app_code_ready);
}
void NodeBindings::LoadEnvironment(node::Environment* env) {

View File

@@ -118,8 +118,8 @@ void ElectronRendererClient::DidCreateScriptContext(
v8::Isolate* isolate = env->isolate();
v8::Local<v8::Object> global = renderer_context->Global();
std::vector<std::string> keys = {"fetch", "Response", "FormData", "Request",
"Headers"};
std::vector<std::string> keys = {"fetch", "Response", "FormData",
"Request", "Headers", "EventSource"};
for (const auto& key : keys) {
v8::MaybeLocal<v8::Value> value =
global->Get(renderer_context, gin::StringToV8(isolate, key));

View File

@@ -71,8 +71,8 @@ void WebWorkerObserver::WorkerScriptReadyForEvaluation(
// is loaded. See corresponding change in node/init.ts.
v8::Local<v8::Object> global = worker_context->Global();
std::vector<std::string> keys = {"fetch", "Response", "FormData", "Request",
"Headers"};
std::vector<std::string> keys = {"fetch", "Response", "FormData",
"Request", "Headers", "EventSource"};
for (const auto& key : keys) {
v8::MaybeLocal<v8::Value> value =
global->Get(worker_context, gin::StringToV8(isolate, key.c_str()));

View File

@@ -1,4 +1,4 @@
import { BrowserView, BrowserWindow, screen, webContents } from 'electron/main';
import { BrowserView, BrowserWindow, screen, session, webContents } from 'electron/main';
import { expect } from 'chai';
@@ -11,24 +11,29 @@ import { closeWindow } from './lib/window-helpers';
describe('BrowserView module', () => {
const fixtures = path.resolve(__dirname, 'fixtures');
const ses = session.fromPartition(crypto.randomUUID());
let w: BrowserWindow;
let view: BrowserView;
const getSessionWebContents = () =>
webContents.getAllWebContents().filter(wc => wc.session === ses);
beforeEach(() => {
expect(webContents.getAllWebContents().length).to.equal(0, 'expected no webContents to exist');
expect(getSessionWebContents().length).to.equal(0, 'expected no webContents to exist');
w = new BrowserWindow({
show: false,
width: 400,
height: 400,
webPreferences: {
backgroundThrottling: false
backgroundThrottling: false,
session: ses
}
});
});
afterEach(async () => {
if (!w.isDestroyed()) {
if (w && !w.isDestroyed()) {
const p = once(w.webContents, 'destroyed');
await closeWindow(w);
w = null as any;
@@ -42,7 +47,7 @@ describe('BrowserView module', () => {
await p;
}
expect(webContents.getAllWebContents().length).to.equal(0, 'expected no webContents to exist');
expect(getSessionWebContents().length).to.equal(0, 'expected no webContents to exist');
});
it('sets the correct class name on the prototype', () => {
@@ -50,7 +55,7 @@ describe('BrowserView module', () => {
});
it('can be created with an existing webContents', async () => {
const wc = (webContents as typeof ElectronInternal.WebContents).create({ sandbox: true });
const wc = (webContents as typeof ElectronInternal.WebContents).create({ session: ses, sandbox: true });
await wc.loadURL('about:blank');
view = new BrowserView({ webContents: wc } as any);

View File

@@ -977,7 +977,7 @@ describe('protocol module', () => {
contextIsolation: false
});
const consoleMessages: string[] = [];
newContents.on('console-message', (e, level, message) => consoleMessages.push(message));
newContents.on('console-message', (e) => consoleMessages.push(e.message));
try {
newContents.loadURL(standardScheme + '://fake-host');
const [, response] = await once(ipcMain, 'response');
@@ -1631,7 +1631,7 @@ describe('protocol module', () => {
defer(() => { protocol.unhandle('cors'); });
await contents.loadFile(path.resolve(fixturesPath, 'pages', 'base-page.html'));
contents.on('console-message', (e, level, message) => console.log(message));
contents.on('console-message', (e) => console.log(e.message));
const ok = await contents.executeJavaScript(`(async () => {
function wait(milliseconds) {
return new Promise((resolve) => setTimeout(resolve, milliseconds));

View File

@@ -144,21 +144,36 @@ describe('utilityProcess module', () => {
});
describe('app \'child-process-gone\' event', () => {
const waitForCrash = (name: string) => {
return new Promise<Electron.Details>((resolve) => {
app.on('child-process-gone', function onCrash (_event, details) {
if (details.name === name) {
app.off('child-process-gone', onCrash);
resolve(details);
}
});
});
};
ifit(!isWindows32Bit)('with default serviceName', async () => {
const name = 'Node Utility Process';
const crashPromise = waitForCrash(name);
utilityProcess.fork(path.join(fixturesPath, 'crash.js'));
const [, details] = await once(app, 'child-process-gone') as [any, Electron.Details];
const details = await crashPromise;
expect(details.type).to.equal('Utility');
expect(details.serviceName).to.equal('node.mojom.NodeService');
expect(details.name).to.equal('Node Utility Process');
expect(details.name).to.equal(name);
expect(details.reason).to.be.oneOf(['crashed', 'abnormal-exit']);
});
ifit(!isWindows32Bit)('with custom serviceName', async () => {
utilityProcess.fork(path.join(fixturesPath, 'crash.js'), [], { serviceName: 'Hello World!' });
const [, details] = await once(app, 'child-process-gone') as [any, Electron.Details];
const name = crypto.randomUUID();
const crashPromise = waitForCrash(name);
utilityProcess.fork(path.join(fixturesPath, 'crash.js'), [], { serviceName: name });
const details = await crashPromise;
expect(details.type).to.equal('Utility');
expect(details.serviceName).to.equal('node.mojom.NodeService');
expect(details.name).to.equal('Hello World!');
expect(details.name).to.equal(name);
expect(details.reason).to.be.oneOf(['crashed', 'abnormal-exit']);
});
});

View File

@@ -1965,9 +1965,9 @@ describe('webContents module', () => {
afterEach(closeAllWindows);
it('is triggered with correct log message', (done) => {
const w = new BrowserWindow({ show: true });
w.webContents.on('console-message', (e, level, message) => {
w.webContents.on('console-message', (e) => {
// Don't just assert as Chromium might emit other logs that we should ignore.
if (message === 'a') {
if (e.message === 'a') {
done();
}
});

View File

@@ -379,7 +379,7 @@ describe('web security', () => {
console.log(e.message)
}
</script>`);
const [,, message] = await once(w.webContents, 'console-message');
const [{ message }] = await once(w.webContents, 'console-message');
expect(message).to.match(/Refused to evaluate a string/);
});
@@ -399,7 +399,7 @@ describe('web security', () => {
console.log(e.message)
}
</script>`);
const [,, message] = await once(w.webContents, 'console-message');
const [{ message }] = await once(w.webContents, 'console-message');
expect(message).to.equal('true');
});
@@ -1028,6 +1028,43 @@ describe('chromium features', () => {
expect(code).to.equal(0);
});
itremote('Worker with nodeIntegrationInWorker has access to EventSource', () => {
const es = new EventSource('https://example.com');
expect(es).to.have.property('url').that.is.a('string');
expect(es).to.have.property('readyState').that.is.a('number');
expect(es).to.have.property('withCredentials').that.is.a('boolean');
});
itremote('Worker with nodeIntegrationInWorker has access to fetch-dependent interfaces', async (fixtures: string) => {
const file = require('node:path').join(fixtures, 'hello.txt');
expect(() => {
fetch('file://' + file);
}).to.not.throw();
expect(() => {
const formData = new FormData();
formData.append('username', 'Groucho');
}).not.to.throw();
expect(() => {
const request = new Request('https://example.com', {
method: 'POST',
body: JSON.stringify({ foo: 'bar' })
});
expect(request.method).to.equal('POST');
}).not.to.throw();
expect(() => {
const response = new Response('Hello, world!');
expect(response.status).to.equal(200);
}).not.to.throw();
expect(() => {
const headers = new Headers();
headers.append('Content-Type', 'text/xml');
}).not.to.throw();
}, [path.join(__dirname, 'fixtures')]);
it('Worker can work', async () => {
const w = new BrowserWindow({ show: false });
await w.loadURL(`file://${fixturesPath}/pages/blank.html`);
@@ -1428,7 +1465,7 @@ describe('chromium features', () => {
w.loadURL('about:blank');
w.webContents.executeJavaScript('window.child = window.open(); child.opener = null');
const [, { webContents }] = await once(app, 'browser-window-created');
const [,, message] = await once(webContents, 'console-message');
const [{ message }] = await once(webContents, 'console-message');
expect(message).to.equal('{"require":"function","module":"object","exports":"object","process":"object","Buffer":"function"}');
});

View File

@@ -111,7 +111,7 @@ describe('chrome extensions', () => {
const message = { method: 'query' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.have.lengthOf(1);
@@ -434,7 +434,7 @@ describe('chrome extensions', () => {
const message = { method: 'executeScript', args: ['1 + 2'] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal(3);
@@ -448,7 +448,7 @@ describe('chrome extensions', () => {
const message = { method: 'connectTab', args: [portName] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = responseString.split(',');
expect(response[0]).to.equal(portName);
expect(response[1]).to.equal('howdy');
@@ -461,7 +461,7 @@ describe('chrome extensions', () => {
const message = { method: 'sendMessage', args: ['Hello World!'] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response.message).to.equal('Hello World!');
@@ -480,7 +480,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [w2.webContents.id, { url }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
await w2Navigated;
@@ -801,7 +801,7 @@ describe('chrome extensions', () => {
w.webContents.executeJavaScript('window.postMessage(\'fetch-confirmation\', \'*\')');
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { message } = JSON.parse(responseString);
expect(message).to.equal('Hello from background.js');
@@ -834,7 +834,7 @@ describe('chrome extensions', () => {
const message = { method: 'getAcceptLanguages' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.be.an('array').that.is.not.empty('languages array is empty');
@@ -846,7 +846,7 @@ describe('chrome extensions', () => {
const message = { method: 'getUILanguage' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.be.a('string');
@@ -858,7 +858,7 @@ describe('chrome extensions', () => {
const message = { method: 'getMessage' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal('Hola mundo!!');
@@ -877,7 +877,7 @@ describe('chrome extensions', () => {
const message = { method: 'detectLanguage', args: [greetings] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.be.an('array');
@@ -925,7 +925,7 @@ describe('chrome extensions', () => {
const message = { method: 'isEnabled' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal(false);
@@ -937,7 +937,7 @@ describe('chrome extensions', () => {
const message = { method: 'setIcon' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal(null);
@@ -949,7 +949,7 @@ describe('chrome extensions', () => {
const message = { method: 'getBadgeText' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal('');
@@ -982,7 +982,7 @@ describe('chrome extensions', () => {
const message = { method: 'getZoom' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal(1);
@@ -994,7 +994,7 @@ describe('chrome extensions', () => {
const message = { method: 'setZoom', args: [2] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.deep.equal(2);
@@ -1006,7 +1006,7 @@ describe('chrome extensions', () => {
const message = { method: 'getZoomSettings' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.deep.equal({
@@ -1022,7 +1022,7 @@ describe('chrome extensions', () => {
const message = { method: 'setZoomSettings', args: [{ mode: 'disabled' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.deep.equal({
@@ -1039,7 +1039,7 @@ describe('chrome extensions', () => {
const message = { method: 'get' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.have.property('url').that.is.a('string');
@@ -1065,7 +1065,7 @@ describe('chrome extensions', () => {
await w.loadURL(url);
w.webContents.executeJavaScript('window.postMessage(\'{}\', \'*\')');
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).not.to.have.property('url');
expect(response).not.to.have.property('title');
@@ -1092,7 +1092,7 @@ describe('chrome extensions', () => {
const consoleMessage = once(w.webContents, 'console-message');
const finish = once(w.webContents, 'did-finish-load');
await Promise.all([consoleMessage, finish]).then(([[,, responseString]]) => {
await Promise.all([consoleMessage, finish]).then(([[{ message: responseString }]]) => {
const response = JSON.parse(responseString);
expect(response.status).to.equal('reloaded');
});
@@ -1105,7 +1105,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ muted: true }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.have.property('mutedInfo').that.is.a('object');
@@ -1122,7 +1122,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ url: 'chrome://crash' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { error } = JSON.parse(responseString);
expect(error).to.eq('I\'m sorry. I\'m afraid I can\'t do that.');
});
@@ -1133,7 +1133,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ url: 'chrome://crash' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { error } = JSON.parse(responseString);
expect(error).to.eq('I\'m sorry. I\'m afraid I can\'t do that.');
});
@@ -1144,7 +1144,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ url: 'devtools://blah' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { error } = JSON.parse(responseString);
expect(error).to.eq('Cannot navigate to a devtools:// page without either the devtools or debugger permission.');
});
@@ -1155,7 +1155,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ url: 'chrome-untrusted://blah' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { error } = JSON.parse(responseString);
expect(error).to.eq('Cannot navigate to a chrome-untrusted:// page.');
});
@@ -1166,7 +1166,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ url: 'file://blah' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { error } = JSON.parse(responseString);
expect(error).to.eq('Cannot navigate to a file URL without local file access.');
});
@@ -1183,7 +1183,7 @@ describe('chrome extensions', () => {
const message = { method: 'query', args: [{ muted: true }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.have.lengthOf(1);
@@ -1220,7 +1220,7 @@ describe('chrome extensions', () => {
const message = { method: 'query', args: [{ muted: true }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.have.lengthOf(2);
for (const tab of response) {
@@ -1270,7 +1270,7 @@ describe('chrome extensions', () => {
const message = { method: 'registerContentScripts' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.be.an('array').with.lengthOf(1);
expect(response[0]).to.deep.equal({
@@ -1290,7 +1290,7 @@ describe('chrome extensions', () => {
const message = { method: 'globalParams' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.deep.equal({ changed: true });
});
@@ -1304,7 +1304,7 @@ describe('chrome extensions', () => {
const message = { method: 'insertCSS' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response.success).to.be.true();

View File

@@ -13,8 +13,8 @@ app.whenReady().then(function () {
win.loadFile('index.html');
win.webContents.on('console-message', (event, level, message) => {
console.log(message);
win.webContents.on('console-message', (event) => {
console.log(event.message);
});
win.webContents.on('did-finish-load', () => app.quit());

View File

@@ -162,6 +162,15 @@ describe('node feature', () => {
});
});
describe('EventSource', () => {
itremote('works correctly when nodeIntegration is enabled in the renderer', () => {
const es = new EventSource('https://example.com');
expect(es).to.have.property('url').that.is.a('string');
expect(es).to.have.property('readyState').that.is.a('number');
expect(es).to.have.property('withCredentials').that.is.a('boolean');
});
});
describe('fetch', () => {
itremote('works correctly when nodeIntegration is enabled in the renderer', async (fixtures: string) => {
const file = require('node:path').join(fixtures, 'hello.txt');

View File

@@ -75,7 +75,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('Node.js Integration with Remote Content');
});
@@ -88,7 +88,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security-onload-message.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', isLoaded);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', isLoaded);
expect(message).to.not.include('Node.js Integration with Remote Content');
});
@@ -104,7 +104,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('Disabled webSecurity');
});
@@ -116,7 +116,7 @@ describe('security warnings', () => {
useCsp = false;
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('Insecure Content-Security-Policy');
});
@@ -146,7 +146,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('allowRunningInsecureContent');
});
@@ -160,7 +160,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('experimentalFeatures');
});
@@ -174,7 +174,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('enableBlinkFeatures');
});
@@ -185,7 +185,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/webview-allowpopups.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('allowpopups');
});
@@ -196,7 +196,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/insecure-resources.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('Insecure Resources');
});
@@ -207,7 +207,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/insecure-resources.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.not.include('insecure-resources.html');
});
});

963
yarn.lock

File diff suppressed because it is too large Load Diff