mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Compare commits
122 Commits
v15.0.0-al
...
v16.0.0-ni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34f1bc0e82 | ||
|
|
fb990ba1eb | ||
|
|
517b174c3c | ||
|
|
c83de755c1 | ||
|
|
aab5ea5f9d | ||
|
|
7093cd75cb | ||
|
|
2a28ca226f | ||
|
|
4820dee980 | ||
|
|
cb7c16cb2d | ||
|
|
11de995d38 | ||
|
|
ea889b423d | ||
|
|
655b614ecd | ||
|
|
cbeae20438 | ||
|
|
8699124397 | ||
|
|
ec13a0b0e6 | ||
|
|
e92d92d7eb | ||
|
|
dd16d68e96 | ||
|
|
90b5ba3bed | ||
|
|
29749f3dc6 | ||
|
|
f797159fbe | ||
|
|
b62bbfda4e | ||
|
|
db8644ee7a | ||
|
|
04aafcc5ef | ||
|
|
ff128a32d9 | ||
|
|
a9a90fa1b6 | ||
|
|
7cdd132d18 | ||
|
|
93d7968d64 | ||
|
|
cd09a54365 | ||
|
|
eaa5d372fb | ||
|
|
6669abf38d | ||
|
|
740dcc5c16 | ||
|
|
fcce2b16d5 | ||
|
|
94111c9d5c | ||
|
|
8b9d0092cb | ||
|
|
0c1f762119 | ||
|
|
a11a234eac | ||
|
|
fc9a197f6c | ||
|
|
61117a11a1 | ||
|
|
7132f36ddd | ||
|
|
d1bd9afbbf | ||
|
|
1e983e2a6e | ||
|
|
c5db7a9013 | ||
|
|
a48968c1ce | ||
|
|
d313ddbd3d | ||
|
|
6ad47322fa | ||
|
|
93b1d2d932 | ||
|
|
17615654e8 | ||
|
|
c6267d9fb0 | ||
|
|
52890e9efd | ||
|
|
7668507c9d | ||
|
|
439e83de6c | ||
|
|
08ff1c2cbf | ||
|
|
81c143318b | ||
|
|
c8f3324610 | ||
|
|
60650abf09 | ||
|
|
e11953b0e6 | ||
|
|
41646d1168 | ||
|
|
42936b07fe | ||
|
|
985f1b5c04 | ||
|
|
ac49e6af4a | ||
|
|
69f1c1b083 | ||
|
|
f17e6ae318 | ||
|
|
4f739d7837 | ||
|
|
590858a38d | ||
|
|
edb7413bae | ||
|
|
e223b4db94 | ||
|
|
08e9aea940 | ||
|
|
66c458a353 | ||
|
|
6a9cada98c | ||
|
|
d783e944d3 | ||
|
|
641260bc32 | ||
|
|
bc508c6113 | ||
|
|
ec6cd0053e | ||
|
|
8e1160fde4 | ||
|
|
320bea4c28 | ||
|
|
59ab79417d | ||
|
|
423172775e | ||
|
|
4703dc0a1d | ||
|
|
481b774fd7 | ||
|
|
acbd643e2a | ||
|
|
97929eab5f | ||
|
|
1c29734c91 | ||
|
|
8179349625 | ||
|
|
a17e48061a | ||
|
|
40e76dca07 | ||
|
|
6e43b0bcbf | ||
|
|
4519bc3cd1 | ||
|
|
2b897c8ad8 | ||
|
|
0cabff0a21 | ||
|
|
888ac65c72 | ||
|
|
c0e72bd335 | ||
|
|
ced2e8779f | ||
|
|
9693fb9a37 | ||
|
|
9a63d96e83 | ||
|
|
7b5deb2f3a | ||
|
|
8651c5d02d | ||
|
|
639f03977f | ||
|
|
9cc1b55663 | ||
|
|
3ee6326b93 | ||
|
|
39c3ff5292 | ||
|
|
4aa9455613 | ||
|
|
c5ad7ed0cd | ||
|
|
c3abbdefdd | ||
|
|
bd85b1d028 | ||
|
|
fa464286ee | ||
|
|
d63980edeb | ||
|
|
1c95d30c0f | ||
|
|
fc7ea75009 | ||
|
|
ceebae170e | ||
|
|
cce27a0961 | ||
|
|
10424c0149 | ||
|
|
a545cd3790 | ||
|
|
461db8f1ab | ||
|
|
d2989de5d9 | ||
|
|
385d0f590f | ||
|
|
64ba8feb93 | ||
|
|
a6ab702ae4 | ||
|
|
62711e23ad | ||
|
|
3cb06457c4 | ||
|
|
e3fe80e0e8 | ||
|
|
b24cfe17bc | ||
|
|
eca1098b55 |
@@ -45,7 +45,7 @@ executors:
|
||||
type: enum
|
||||
enum: ["medium", "xlarge", "2xlarge+"]
|
||||
docker:
|
||||
- image: electron.azurecr.io/build:d818f06a9b1540c7fd38f75ad5a2c493dd6843b6
|
||||
- image: ghcr.io/electron/build:27db4a3e3512bfd2e47f58cea69922da0835f1d9
|
||||
resource_class: << parameters.size >>
|
||||
|
||||
macos:
|
||||
@@ -1209,6 +1209,9 @@ steps-tests: &steps-tests
|
||||
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging)
|
||||
(cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging)
|
||||
else
|
||||
if [ "$TARGET_ARCH" == "ia32" ]; then
|
||||
npm_config_arch=x64 node electron/node_modules/dugite/script/download-git.js
|
||||
fi
|
||||
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split --split-by=timings))
|
||||
(cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split --split-by=timings))
|
||||
fi
|
||||
|
||||
59
.devcontainer/README.md
Normal file
59
.devcontainer/README.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Electron Dev on Codespaces
|
||||
|
||||
Welcome to the Codespaces Electron Developer Environment.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Upon creation of your codespace you should have [build tools](https://github.com/electron/build-tools) installed and an initialized gclient checkout of Electron. In order to build electron you'll need to run the following commands.
|
||||
|
||||
```bash
|
||||
e sync -vv
|
||||
e build
|
||||
```
|
||||
|
||||
The initial sync will take approximately ~30 minutes and the build will take ~8 minutes. Incremental syncs and incremental builds are substantially quicker.
|
||||
|
||||
## Directory Structure
|
||||
|
||||
Codespaces doesn't lean very well into gclient based checkouts, the directory structure is slightly strange. There are two locations for the `electron` checkout that both map to the same files under the hood.
|
||||
|
||||
```graphql
|
||||
# Primary gclient checkout container
|
||||
/workspaces/gclient/*
|
||||
└─ src/* - # Chromium checkout
|
||||
└─ electron - # Electron checkout
|
||||
# Symlinked Electron checkout (identical to the above)
|
||||
/workspaces/electron
|
||||
```
|
||||
|
||||
## Goma
|
||||
|
||||
If you are a maintainer [with Goma access](../docs/development/goma.md) it should be automatically configured and authenticated when you spin up a new codespaces instance. You can validate this by checking `e d goma_auth info` or by checking that your build-tools configuration has a goma mode of `cluster`.
|
||||
|
||||
## Running Electron
|
||||
|
||||
You can run Electron in a few ways. If you just want to see if it launches:
|
||||
|
||||
```bash
|
||||
# Enter an interactive JS prompt headlessly
|
||||
xvfb-run e start -i
|
||||
```
|
||||
|
||||
But if you want to actually see Electron you will need to use the built-in VNC capability. If you click "Ports" in codespaces and then open the `VNC web client` forwarded port you should see a web based VNC portal in your browser. When you are asked for a password use `builduser`.
|
||||
|
||||
Once in the VNC UI you can open `Applications -> System -> XTerm` which will open a VNC based terminal app and then you can run `e start` like normal and Electron will open in your VNC session.
|
||||
|
||||
## Running Tests
|
||||
|
||||
You run tests via build-tools and `xvfb`.
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
xvfb-run e test
|
||||
|
||||
# Run the main process tests
|
||||
xvfb-run e test --runners=main
|
||||
|
||||
# Run the old remote tests
|
||||
xvfb-run e test --runners=remote
|
||||
```
|
||||
43
.devcontainer/devcontainer.json
Normal file
43
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "buildtools",
|
||||
"onCreateCommand": ".devcontainer/on-create-command.sh",
|
||||
"workspaceFolder": "/workspaces/gclient/src/electron",
|
||||
"extensions": [
|
||||
"joeleinbinder.mojom-language",
|
||||
"rafaelmaiolla.diff",
|
||||
"surajbarkale.ninja",
|
||||
"ms-vscode.cpptools",
|
||||
"mutantdino.resourcemonitor",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"shakram02.bash-beautify",
|
||||
"marshallofsound.gnls-electron"
|
||||
],
|
||||
"settings": {
|
||||
"[gn]": {
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"editor.tabSize": 2,
|
||||
"bashBeautify.tabSize": 2
|
||||
},
|
||||
"forwardPorts": [8088, 6080, 5901],
|
||||
"portsAttributes": {
|
||||
"8088": {
|
||||
"label": "Goma Control Panel",
|
||||
"onAutoForward": "silent"
|
||||
},
|
||||
"6080": {
|
||||
"label": "VNC web client (noVNC)",
|
||||
"onAutoForward": "silent"
|
||||
},
|
||||
"5901": {
|
||||
"label": "VNC TCP port",
|
||||
"onAutoForward": "silent"
|
||||
}
|
||||
},
|
||||
"hostRequirements": {
|
||||
"storage": "32gb",
|
||||
"cpus": 8
|
||||
},
|
||||
"remoteUser": "builduser"
|
||||
}
|
||||
19
.devcontainer/docker-compose.yml
Normal file
19
.devcontainer/docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
buildtools:
|
||||
image: ghcr.io/electron/devcontainer:27db4a3e3512bfd2e47f58cea69922da0835f1d9
|
||||
|
||||
volumes:
|
||||
- ..:/workspaces/gclient/src/electron:cached
|
||||
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
command: /bin/sh -c "while sleep 1000; do :; done"
|
||||
|
||||
user: builduser
|
||||
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
74
.devcontainer/on-create-command.sh
Executable file
74
.devcontainer/on-create-command.sh
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
buildtools=$HOME/.electron_build_tools
|
||||
gclient_root=/workspaces/gclient
|
||||
buildtools_configs=/workspaces/buildtools-configs
|
||||
|
||||
export PATH="$PATH:$buildtools/src"
|
||||
|
||||
# Create the persisted buildtools config folder
|
||||
mkdir -p $buildtools_configs
|
||||
rm -f $buildtools/configs
|
||||
ln -s $buildtools_configs $buildtools/configs
|
||||
|
||||
# Write the gclient config if it does not already exist
|
||||
if [ ! -f $gclient_root/.gclient ]; then
|
||||
echo "solutions = [
|
||||
{ \"name\" : \"src/electron\",
|
||||
\"url\" : \"https://github.com/electron/electron\",
|
||||
\"deps_file\" : \"DEPS\",
|
||||
\"managed\" : False,
|
||||
\"custom_deps\" : {
|
||||
},
|
||||
\"custom_vars\": {},
|
||||
},
|
||||
]
|
||||
" >$gclient_root/.gclient
|
||||
fi
|
||||
|
||||
# Write the default buildtools config file if it does
|
||||
# not already exist
|
||||
if [ ! -f $buildtools/configs/evm.testing.json ]; then
|
||||
write_config() {
|
||||
echo "
|
||||
{
|
||||
\"root\": \"/workspaces/gclient\",
|
||||
\"goma\": \"$1\",
|
||||
\"gen\": {
|
||||
\"args\": [
|
||||
\"import(\\\"//electron/build/args/testing.gn\\\")\",
|
||||
\"import(\\\"/home/builduser/.electron_build_tools/third_party/goma.gn\\\")\"
|
||||
],
|
||||
\"out\": \"Testing\"
|
||||
},
|
||||
\"env\": {
|
||||
\"CHROMIUM_BUILDTOOLS_PATH\": \"/workspaces/gclient/src/buildtools\",
|
||||
\"GIT_CACHE_PATH\": \"/workspaces/gclient/.git-cache\"
|
||||
},
|
||||
\"remotes\": {
|
||||
\"electron\": {
|
||||
\"origin\": \"https://github.com/electron/electron.git\"
|
||||
}
|
||||
}
|
||||
}
|
||||
" >$buildtools/configs/evm.testing.json
|
||||
}
|
||||
|
||||
# Start out as cache only
|
||||
write_config cache-only
|
||||
|
||||
e use testing
|
||||
|
||||
# Attempt to auth to the goma service via codespaces tokens
|
||||
# if it works we can use the goma cluster
|
||||
export NOTGOMA_CODESPACES_TOKEN=$GITHUB_TOKEN
|
||||
if e d goma_auth login; then
|
||||
write_config cluster
|
||||
fi
|
||||
else
|
||||
# Even if the config file existed we still need to re-auth with the goma
|
||||
# cluster
|
||||
NOTGOMA_CODESPACES_TOKEN=$GITHUB_TOKEN e d goma_auth login || true
|
||||
fi
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -26,6 +26,7 @@ compile_commands.json
|
||||
# npm package
|
||||
/npm/dist
|
||||
/npm/path.txt
|
||||
/npm/checksums.json
|
||||
|
||||
.npmrc
|
||||
|
||||
|
||||
18
BUILD.gn
18
BUILD.gn
@@ -307,6 +307,23 @@ action("electron_fuses") {
|
||||
args = rebase_path(outputs)
|
||||
}
|
||||
|
||||
action("electron_generate_node_defines") {
|
||||
script = "build/generate_node_defines.py"
|
||||
|
||||
inputs = [
|
||||
"//third_party/electron_node/src/tracing/trace_event_common.h",
|
||||
"//third_party/electron_node/src/tracing/trace_event.h",
|
||||
"//third_party/electron_node/src/util.h",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
"$target_gen_dir/push_and_undef_node_defines.h",
|
||||
"$target_gen_dir/pop_node_defines.h",
|
||||
]
|
||||
|
||||
args = [ rebase_path(target_gen_dir) ] + rebase_path(inputs)
|
||||
}
|
||||
|
||||
source_set("electron_lib") {
|
||||
configs += [ "//v8:external_startup_data" ]
|
||||
configs += [ "//third_party/electron_node:node_internals" ]
|
||||
@@ -318,6 +335,7 @@ source_set("electron_lib") {
|
||||
|
||||
deps = [
|
||||
":electron_fuses",
|
||||
":electron_generate_node_defines",
|
||||
":electron_js2c",
|
||||
":electron_version_header",
|
||||
":resources",
|
||||
|
||||
2
DEPS
2
DEPS
@@ -17,7 +17,7 @@ vars = {
|
||||
'chromium_version':
|
||||
'94.0.4590.2',
|
||||
'node_version':
|
||||
'v16.5.0',
|
||||
'v16.7.0',
|
||||
'nan_version':
|
||||
# The following commit hash of NAN is v2.14.2 with *only* changes to the
|
||||
# test suite. This should be updated to a specific tag when one becomes
|
||||
|
||||
@@ -1 +1 @@
|
||||
15.0.0-alpha.9
|
||||
16.0.0-nightly.20210823
|
||||
@@ -112,7 +112,7 @@ build_script:
|
||||
}
|
||||
}
|
||||
}
|
||||
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags --ignore_locks)
|
||||
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync )
|
||||
- ps: >-
|
||||
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
|
||||
# archive current source for future use
|
||||
|
||||
34
build/generate_node_defines.py
Executable file
34
build/generate_node_defines.py
Executable file
@@ -0,0 +1,34 @@
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
DEFINE_EXTRACT_REGEX = re.compile('^ *# *define (\w*)', re.MULTILINE)
|
||||
|
||||
def main(outDir, headers):
|
||||
defines = []
|
||||
for filename in headers:
|
||||
with open(filename, 'r') as f:
|
||||
content = f.read()
|
||||
defines += read_defines(content)
|
||||
|
||||
push_and_undef = ''
|
||||
for define in defines:
|
||||
push_and_undef += '#pragma push_macro("%s")\n' % define
|
||||
push_and_undef += '#undef %s\n' % define
|
||||
with open(os.path.join(outDir, 'push_and_undef_node_defines.h'), 'w') as o:
|
||||
o.write(push_and_undef)
|
||||
|
||||
pop = ''
|
||||
for define in defines:
|
||||
pop += '#pragma pop_macro("%s")\n' % define
|
||||
with open(os.path.join(outDir, 'pop_node_defines.h'), 'w') as o:
|
||||
o.write(pop)
|
||||
|
||||
def read_defines(content):
|
||||
defines = []
|
||||
for match in DEFINE_EXTRACT_REGEX.finditer(content):
|
||||
defines.append(match.group(1))
|
||||
return defines
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1], sys.argv[2:])
|
||||
@@ -5,8 +5,8 @@ template("npm_action") {
|
||||
|
||||
action("npm_pre_flight_" + target_name) {
|
||||
inputs = [
|
||||
"package.json",
|
||||
"yarn.lock",
|
||||
"//electron/package.json",
|
||||
"//electron/yarn.lock",
|
||||
]
|
||||
script = "//electron/build/npm-run.py"
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ template("webpack_build") {
|
||||
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
"--env.mode=" + mode,
|
||||
]
|
||||
deps += [ "buildflags" ]
|
||||
deps += [ "//electron/buildflags" ]
|
||||
|
||||
outputs = [ invoker.out_file ]
|
||||
}
|
||||
|
||||
@@ -76,8 +76,11 @@ static_library("chrome") {
|
||||
"//chrome/browser/extensions/global_shortcut_listener_win.h",
|
||||
"//chrome/browser/icon_loader_win.cc",
|
||||
"//chrome/browser/media/webrtc/window_icon_util_win.cc",
|
||||
"//chrome/browser/ui/frame/window_frame_util.h",
|
||||
"//chrome/browser/ui/view_ids.h",
|
||||
"//chrome/browser/win/chrome_process_finder.cc",
|
||||
"//chrome/browser/win/chrome_process_finder.h",
|
||||
"//chrome/browser/win/titlebar_config.h",
|
||||
"//chrome/child/v8_crashpad_support_win.cc",
|
||||
"//chrome/child/v8_crashpad_support_win.h",
|
||||
]
|
||||
|
||||
@@ -213,16 +213,13 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `followWindow` - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.
|
||||
* `active` - The backdrop should always appear active.
|
||||
* `inactive` - The backdrop should always appear inactive.
|
||||
* `titleBarStyle` String (optional) - The style of window title bar.
|
||||
* `titleBarStyle` String (optional) _macOS_ _Windows_ - The style of window title bar.
|
||||
Default is `default`. Possible values are:
|
||||
* `default` - Results in the standard gray opaque Mac title
|
||||
bar.
|
||||
* `hidden` - Results in a hidden title bar and a full size content window, yet
|
||||
the title bar still has the standard window controls ("traffic lights") in
|
||||
the top left.
|
||||
* `hiddenInset` - Results in a hidden title bar with an alternative look
|
||||
* `default` - Results in the standard title bar for macOS or Windows respectively.
|
||||
* `hidden` - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with `titleBarOverlay: true` it will activate the Window Controls Overlay (see `titleBarOverlay` for more information), otherwise no window controls will be shown.
|
||||
* `hiddenInset` - Only on macOS, results in a hidden title bar with an alternative look
|
||||
where the traffic light buttons are slightly more inset from the window edge.
|
||||
* `customButtonsOnHover` - Results in a hidden title bar and a full size
|
||||
* `customButtonsOnHover` - Only on macOS, results in a hidden title bar and a full size
|
||||
content window, the traffic light buttons will display when being hovered
|
||||
over in the top left of the window. **Note:** This option is currently
|
||||
experimental.
|
||||
@@ -392,10 +389,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
contain the layout of the document—without requiring scrolling. Enabling
|
||||
this will cause the `preferred-size-changed` event to be emitted on the
|
||||
`WebContents` when the preferred size changes. Default is `false`.
|
||||
* `titleBarOverlay` Boolean (optional) - On macOS, when using a frameless window in conjunction with
|
||||
`win.setWindowButtonVisibility(true)` or using a `titleBarStyle` so that the traffic lights are visible,
|
||||
this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and
|
||||
[CSS Environment Variables][overlay-css-env-vars]. Default is `false`.
|
||||
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjuction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
|
||||
* `color` String (optional) _Windows_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
|
||||
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
|
||||
|
||||
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
|
||||
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
|
||||
|
||||
@@ -19,6 +19,9 @@ following projects:
|
||||
* [socorro](https://github.com/mozilla/socorro)
|
||||
* [mini-breakpad-server](https://github.com/electron/mini-breakpad-server)
|
||||
|
||||
> **Note:** Electron uses Crashpad, not Breakpad, to collect and upload
|
||||
> crashes, but for the time being, the [upload protocol is the same](https://chromium.googlesource.com/crashpad/crashpad/+/HEAD/doc/overview_design.md#Upload-to-collection-server).
|
||||
|
||||
Or use a 3rd party hosted solution:
|
||||
|
||||
* [Backtrace](https://backtrace.io/electron/)
|
||||
@@ -26,49 +29,12 @@ Or use a 3rd party hosted solution:
|
||||
* [BugSplat](https://www.bugsplat.com/docs/platforms/electron)
|
||||
|
||||
Crash reports are stored temporarily before being uploaded in a directory
|
||||
underneath the app's user data directory (called 'Crashpad' on Windows and Mac,
|
||||
or 'Crash Reports' on Linux). You can override this directory by calling
|
||||
`app.setPath('crashDumps', '/path/to/crashes')` before starting the crash
|
||||
reporter.
|
||||
underneath the app's user data directory, called 'Crashpad'. You can override
|
||||
this directory by calling `app.setPath('crashDumps', '/path/to/crashes')`
|
||||
before starting the crash reporter.
|
||||
|
||||
On Windows and macOS, Electron uses
|
||||
[crashpad](https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md)
|
||||
to monitor and report crashes. On Linux, Electron uses
|
||||
[breakpad](https://chromium.googlesource.com/breakpad/breakpad/+/master/). This
|
||||
is an implementation detail driven by Chromium, and it may change in future. In
|
||||
particular, crashpad is newer and will likely eventually replace breakpad on
|
||||
all platforms.
|
||||
|
||||
### Note about Node child processes on Linux
|
||||
|
||||
If you are using the Node.js `child_process` module and want to report crashes
|
||||
from those processes on Linux, there is an extra step you will need to take to
|
||||
properly initialize the crash reporter in the child process. This is not
|
||||
necessary on Mac or Windows, as those platforms use Crashpad, which
|
||||
automatically monitors child processes.
|
||||
|
||||
Since `require('electron')` is not available in Node child processes, the
|
||||
following APIs are available on the `process` object in Node child processes.
|
||||
Note that, on Linux, each Node child process has its own separate instance of
|
||||
the breakpad crash reporter. This is dissimilar to renderer child processes,
|
||||
which have a "stub" breakpad reporter which returns information to the main
|
||||
process for reporting.
|
||||
|
||||
#### `process.crashReporter.start(options)`
|
||||
|
||||
See [`crashReporter.start()`](#crashreporterstartoptions).
|
||||
|
||||
#### `process.crashReporter.getParameters()`
|
||||
|
||||
See [`crashReporter.getParameters()`](#crashreportergetparameters).
|
||||
|
||||
#### `process.crashReporter.addExtraParameter(key, value)`
|
||||
|
||||
See [`crashReporter.addExtraParameter(key, value)`](#crashreporteraddextraparameterkey-value).
|
||||
|
||||
#### `process.crashReporter.removeExtraParameter(key)`
|
||||
|
||||
See [`crashReporter.removeExtraParameter(key)`](#crashreporterremoveextraparameterkey).
|
||||
Electron uses [crashpad](https://chromium.googlesource.com/crashpad/crashpad/+/refs/heads/main/README.md)
|
||||
to monitor and report crashes.
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -186,12 +152,6 @@ names must be no longer than 39 bytes, and values must be no longer than 20320
|
||||
bytes. Keys with names longer than the maximum will be silently ignored. Key
|
||||
values longer than the maximum length will be truncated.
|
||||
|
||||
**Note:** On linux values that are longer than 127 bytes will be chunked into
|
||||
multiple keys, each 127 bytes in length. E.g. `addExtraParameter('foo', 'a'.repeat(130))`
|
||||
will result in two chunked keys `foo__1` and `foo__2`, the first will contain
|
||||
the first 127 bytes and the second will contain the remaining 3 bytes. On
|
||||
your crash reporting backend you should stitch together keys in this format.
|
||||
|
||||
### `crashReporter.removeExtraParameter(key)`
|
||||
|
||||
* `key` String - Parameter key, must be no longer than 39 bytes.
|
||||
@@ -203,6 +163,32 @@ will not include this parameter.
|
||||
|
||||
Returns `Record<String, String>` - The current 'extra' parameters of the crash reporter.
|
||||
|
||||
## In Node child processes
|
||||
|
||||
Since `require('electron')` is not available in Node child processes, the
|
||||
following APIs are available on the `process` object in Node child processes.
|
||||
|
||||
#### `process.crashReporter.start(options)`
|
||||
|
||||
See [`crashReporter.start()`](#crashreporterstartoptions).
|
||||
|
||||
Note that if the crash reporter is started in the main process, it will
|
||||
automatically monitor child processes, so it should not be started in the child
|
||||
process. Only use this method if the main process does not initialize the crash
|
||||
reporter.
|
||||
|
||||
#### `process.crashReporter.getParameters()`
|
||||
|
||||
See [`crashReporter.getParameters()`](#crashreportergetparameters).
|
||||
|
||||
#### `process.crashReporter.addExtraParameter(key, value)`
|
||||
|
||||
See [`crashReporter.addExtraParameter(key, value)`](#crashreporteraddextraparameterkey-value).
|
||||
|
||||
#### `process.crashReporter.removeExtraParameter(key)`
|
||||
|
||||
See [`crashReporter.removeExtraParameter(key)`](#crashreporterremoveextraparameterkey).
|
||||
|
||||
## Crash Report Payload
|
||||
|
||||
The crash reporter will send the following data to the `submitURL` as
|
||||
|
||||
@@ -100,6 +100,8 @@ The following methods of `chrome.tabs` are supported:
|
||||
|
||||
- `chrome.tabs.sendMessage`
|
||||
- `chrome.tabs.executeScript`
|
||||
- `chrome.tabs.update` (partial support)
|
||||
- supported properties: `url`, `muted`.
|
||||
|
||||
> **Note:** In Chrome, passing `-1` as a tab ID signifies the "currently active
|
||||
> tab". Since Electron has no such concept, passing `-1` as a tab ID is not
|
||||
|
||||
@@ -18,17 +18,17 @@ const win = new BrowserWindow({ width: 800, height: 600, frame: false })
|
||||
win.show()
|
||||
```
|
||||
|
||||
### Alternatives on macOS
|
||||
### Alternatives
|
||||
|
||||
There's an alternative way to specify a chromeless window.
|
||||
There's an alternative way to specify a chromeless window on macOS and Windows.
|
||||
Instead of setting `frame` to `false` which disables both the titlebar and window controls,
|
||||
you may want to have the title bar hidden and your content extend to the full window size,
|
||||
yet still preserve the window controls ("traffic lights") for standard window actions.
|
||||
yet still preserve the window controls ("traffic lights" on macOS) for standard window actions.
|
||||
You can do so by specifying the `titleBarStyle` option:
|
||||
|
||||
#### `hidden`
|
||||
|
||||
Results in a hidden title bar and a full size content window, yet the title bar still has the standard window controls (“traffic lights”) in the top left.
|
||||
Results in a hidden title bar and a full size content window. On macOS, the title bar still has the standard window controls (“traffic lights”) in the top left.
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
@@ -36,6 +36,8 @@ const win = new BrowserWindow({ titleBarStyle: 'hidden' })
|
||||
win.show()
|
||||
```
|
||||
|
||||
### Alternatives on macOS
|
||||
|
||||
#### `hiddenInset`
|
||||
|
||||
Results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.
|
||||
@@ -63,19 +65,33 @@ win.show()
|
||||
|
||||
## Windows Control Overlay
|
||||
|
||||
On macOS, when using a frameless window in conjuction with `win.setWindowButtonVisibility(true)` or using one of the `titleBarStyle`s described above so
|
||||
that the traffic lights are visible, you can access the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and
|
||||
[CSS Environment Variables][overlay-css-env-vars] by setting the `titleBarOverlay` option to true:
|
||||
When using a frameless window in conjuction with `win.setWindowButtonVisibility(true)` on macOS, using one of the `titleBarStyle`s as described above so
|
||||
that the traffic lights are visible, or using `titleBarStyle: hidden` on Windows, you can access the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and
|
||||
[CSS Environment Variables][overlay-css-env-vars] by setting the `titleBarOverlay` option to true. Specifying `true` will result in an overlay with default system colors.
|
||||
|
||||
On Windows, you can also specify the color of the overlay and its symbols by setting `titleBarOverlay` to an object with the options `color` and `symbolColor`. If an option is not specified, the color will default to its system color for the window control buttons:
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({
|
||||
titleBarStyle: 'hiddenInset',
|
||||
titleBarStyle: 'hidden',
|
||||
titleBarOverlay: true
|
||||
})
|
||||
win.show()
|
||||
```
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({
|
||||
titleBarStyle: 'hidden',
|
||||
titleBarOverlay: {
|
||||
color: '#2f3241',
|
||||
symbolColor: '#74b1be'
|
||||
}
|
||||
})
|
||||
win.show()
|
||||
```
|
||||
|
||||
## Transparent window
|
||||
|
||||
By setting the `transparent` option to `true`, you can also make the frameless
|
||||
|
||||
40
docs/api/safe-storage.md
Normal file
40
docs/api/safe-storage.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# safeStorage
|
||||
|
||||
> Allows access to simple encryption and decryption of strings for storage on the local machine.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
This module protects data stored on disk from being accessed by other applications or users with full disk access.
|
||||
|
||||
Note that on Mac, access to the system Keychain is required and
|
||||
these calls can block the current thread to collect user input.
|
||||
The same is true for Linux, if a password management tool is available.
|
||||
|
||||
## Methods
|
||||
|
||||
The `safeStorage` module has the following methods:
|
||||
|
||||
### `safeStorage.isEncryptionAvailable()`
|
||||
|
||||
Returns `Boolean` - Whether encryption is available.
|
||||
|
||||
On Linux, returns true if the secret key is
|
||||
available. On MacOS, returns true if Keychain is available.
|
||||
On Windows, returns true with no other preconditions.
|
||||
|
||||
### `safeStorage.encryptString(plainText)`
|
||||
|
||||
* `plainText` String
|
||||
|
||||
Returns `Buffer` - An array of bytes representing the encrypted string.
|
||||
|
||||
This function will throw an error if encryption fails.
|
||||
|
||||
### `safeStorage.decryptString(encrypted)`
|
||||
|
||||
* `encrypted` Buffer
|
||||
|
||||
Returns `String` - the decrypted string. Decrypts the encrypted buffer
|
||||
obtained with `safeStorage.encryptString` back into a string.
|
||||
|
||||
This function will throw an error if decryption fails.
|
||||
@@ -86,8 +86,8 @@ available from next tick of the process.
|
||||
const { session } = require('electron')
|
||||
session.defaultSession.on('will-download', (event, item, webContents) => {
|
||||
event.preventDefault()
|
||||
require('request')(item.getURL(), (data) => {
|
||||
require('fs').writeFileSync('/somewhere', data)
|
||||
require('got')(item.getURL()).then((response) => {
|
||||
require('fs').writeFileSync('/somewhere', response.body)
|
||||
})
|
||||
})
|
||||
```
|
||||
@@ -443,7 +443,8 @@ the original network configuration.
|
||||
* `hostname` String
|
||||
* `certificate` [Certificate](structures/certificate.md)
|
||||
* `validatedCertificate` [Certificate](structures/certificate.md)
|
||||
* `verificationResult` String - Verification result from chromium.
|
||||
* `isIssuedByKnownRoot` Boolean - `true` if Chromium recognises the root CA as a standard root. If it isn't then it's probably the case that this certificate was generated by a MITM proxy whose root has been installed locally (for example, by a corporate proxy). This should not be trusted if the `verificationResult` is not `OK`.
|
||||
* `verificationResult` String - `OK` if the certificate is trusted, otherwise an error like `CERT_REVOKED`.
|
||||
* `errorCode` Integer - Error code.
|
||||
* `callback` Function
|
||||
* `verificationResult` Integer - Value can be one of certificate error codes
|
||||
|
||||
@@ -12,6 +12,21 @@ 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 (16.0)
|
||||
|
||||
### Behavior Changed: `crashReporter` implementation switched to Crashpad on Linux
|
||||
|
||||
The underlying implementation of the `crashReporter` API on Linux has changed
|
||||
from Breakpad to Crashpad, bringing it in line with Windows and Mac. As a
|
||||
result of this, child processes are now automatically monitored, and calling
|
||||
`process.crashReporter.start` in Node child processes is no longer needed (and
|
||||
is not advisable, as it will start a second instance of the Crashpad reporter).
|
||||
|
||||
There are also some subtle changes to how annotations will be reported on
|
||||
Linux, including that long values will no longer be split between annotations
|
||||
appended with `__1`, `__2` and so on, and instead will be truncated at the
|
||||
(new, longer) annotation value limit.
|
||||
|
||||
## Planned Breaking API Changes (14.0)
|
||||
|
||||
### Removed: `app.allowRendererProcessReuse`
|
||||
|
||||
@@ -21,7 +21,7 @@ In the testing framework Spectron, you can now audit each window and `<webview>`
|
||||
tag in your application. For example:
|
||||
|
||||
```javascript
|
||||
app.client.auditAccessibility().then(function (audit) {
|
||||
app.client.auditAccessibility().then((audit) => {
|
||||
if (audit.failed) {
|
||||
console.error(audit.message)
|
||||
}
|
||||
|
||||
@@ -84,11 +84,15 @@ class TestDriver {
|
||||
In the app, you'd need to write a simple handler for the RPC calls:
|
||||
|
||||
```js
|
||||
if (process.env.APP_TEST_DRIVER) {
|
||||
process.on('message', onMessage)
|
||||
const METHODS = {
|
||||
isReady () {
|
||||
// do any setup needed
|
||||
return true
|
||||
}
|
||||
// define your RPC-able methods here
|
||||
}
|
||||
|
||||
async function onMessage ({ msgId, cmd, args }) {
|
||||
const onMessage = async ({ msgId, cmd, args }) => {
|
||||
let method = METHODS[cmd]
|
||||
if (!method) method = () => new Error('Invalid method: ' + cmd)
|
||||
try {
|
||||
@@ -104,12 +108,8 @@ async function onMessage ({ msgId, cmd, args }) {
|
||||
}
|
||||
}
|
||||
|
||||
const METHODS = {
|
||||
isReady () {
|
||||
// do any setup needed
|
||||
return true
|
||||
}
|
||||
// define your RPC-able methods here
|
||||
if (process.env.APP_TEST_DRIVER) {
|
||||
process.on('message', onMessage)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
175
docs/tutorial/creating-api.md
Normal file
175
docs/tutorial/creating-api.md
Normal file
@@ -0,0 +1,175 @@
|
||||
# Creating an Electron Browser Module API
|
||||
|
||||
Welcome to the Electron API guide! If you are unfamiliar with creating electron APIs within the `browser` module, this guide serves as a checklist for some of the necessary steps that you will need to implement.
|
||||
|
||||
This is not a comprehensive end-all guide to creating an Electron Browser API, rather an outline documenting some of the more unintuitive steps.
|
||||
|
||||
## Adding Your Files To Electron's Project Configuration
|
||||
|
||||
Electron uses [GN](https://gn.googlesource.com/gn) as a meta build system to generate files for its compiler, [Ninja](https://ninja-build.org/). This means that in order to tell Electron to compile your code, we have to add your API's code and header file names into [`filenames.gni`](https://github.com/electron/electron/blob/main/filenames.gni).
|
||||
|
||||
You will need to append your api file names alphabetically into the appropriate files like so:
|
||||
|
||||
```cpp
|
||||
lib_sources = [
|
||||
"path/to/api/api_name.cc",
|
||||
"path/to/api/api_name.h",
|
||||
]
|
||||
|
||||
lib_sources_mac = [
|
||||
"path/to/api/api_name_mac.h",
|
||||
"path/to/api/api_name_mac.mm",
|
||||
]
|
||||
|
||||
lib_sources_win = [
|
||||
"path/to/api/api_name_win.cc",
|
||||
"path/to/api/api_name_win.h",
|
||||
]
|
||||
|
||||
lib_sources_linux = [
|
||||
"path/to/api/api_name_linux.cc",
|
||||
"path/to/api/api_name_linux.h",
|
||||
]
|
||||
```
|
||||
|
||||
Note that the Windows, MacOS and Linux array additions are optional and should only be added if your API has specific platform implementations.
|
||||
|
||||
## Create API Documentation
|
||||
|
||||
Type definitions are generated by Electron using [`docs-parser`](https://github.com/electron/docs-parser) and [`typescript-definitions`](https://github.com/electron/typescript-definitions). This step is necessary to ensure consistency across Electron's API documentation. This means that for your API type definition to appear in the `electron.d.ts` file, we must create a `.md` file. Examples can be found in [this folder](https://github.com/electron/electron/tree/main/docs/api).
|
||||
|
||||
## Setting Up `ObjectTemplateBuilder` and `Wrappable`
|
||||
|
||||
Electron constructs its modules using [`object_template_builder`](https://www.electronjs.org/blog/from-native-to-js#mateobjecttemplatebuilder).
|
||||
|
||||
[`wrappable`](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/gin/wrappable.h) is a base class for C++ objects that have corresponding v8 wrapper objects.
|
||||
|
||||
Here is a basic example of code that you may need to add, in order to incorporate `object_template_builder` and `wrappable` into your API. For further reference, you can find more implementations [here](https://github.com/electron/electron/tree/main/shell/browser/api).
|
||||
|
||||
In your `api_name.h` file:
|
||||
|
||||
```cpp
|
||||
|
||||
#ifndef SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_
|
||||
#define SHELL_BROWSER_API_ELECTRON_API_{API_NAME}_H_
|
||||
|
||||
#include "gin/handle.h"
|
||||
#include "gin/wrappable.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
class ApiName : public gin::Wrappable<ApiName> {
|
||||
public:
|
||||
static gin::Handle<ApiName> Create(v8::Isolate* isolate);
|
||||
|
||||
// gin::Wrappable
|
||||
static gin::WrapperInfo kWrapperInfo;
|
||||
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) override;
|
||||
const char* GetTypeName() override;
|
||||
} // namespace api
|
||||
} // namespace electron
|
||||
```
|
||||
|
||||
In your `api_name.cc` file:
|
||||
|
||||
```cpp
|
||||
#include "shell/browser/api/electron_api_safe_storage.h"
|
||||
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/common/gin_converters/base_converter.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/object_template_builder.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/platform_util.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
gin::WrapperInfo ApiName::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
gin::ObjectTemplateBuilder ApiName::GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) {
|
||||
return gin::ObjectTemplateBuilder(isolate)
|
||||
.SetMethod("methodName", &ApiName::methodName);
|
||||
}
|
||||
|
||||
const char* ApiName::GetTypeName() {
|
||||
return "ApiName";
|
||||
}
|
||||
|
||||
// static
|
||||
gin::Handle<ApiName> ApiName::Create(v8::Isolate* isolate) {
|
||||
return gin::CreateHandle(isolate, new ApiName());
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace electron
|
||||
|
||||
namespace {
|
||||
|
||||
void Initialize(v8::Local<v8::Object> exports,
|
||||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("apiName", electron::api::ApiName::Create(isolate));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
```
|
||||
|
||||
## Link Your Electron API With Node
|
||||
|
||||
To learn about how Electron links with Node, [click here.](https://www.electronjs.org/blog/electron-internals-using-node-as-a-library#link-node-with-electron)
|
||||
|
||||
In the [`internal-ambient.d.ts`](https://github.com/electron/electron/blob/main/typings/internal-ambient.d.ts) file:
|
||||
|
||||
We need to append a new property onto the `Process` interface found in this file like so:
|
||||
|
||||
```ts
|
||||
interface Process {
|
||||
_linkedBinding(name: 'electron_browser_{api_name}', Electron.ApiName);
|
||||
}
|
||||
```
|
||||
|
||||
At the very bottom of your `api_name.cc` file:
|
||||
|
||||
```cpp
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(electron_browser_{api_name},Initialize)
|
||||
```
|
||||
|
||||
In your [`shell/common/node_bindings.cc`](https://github.com/electron/electron/blob/main/shell/common/node_bindings.cc) file:
|
||||
|
||||
Add your node binding name to Electron's built-in modules.
|
||||
|
||||
```cpp
|
||||
#define ELECTRON_BUILTIN_MODULES(V) \
|
||||
V(electron_browser_{api_name})
|
||||
```
|
||||
|
||||
## Expose Your API to TypeScript
|
||||
|
||||
### Export Your API as a module
|
||||
|
||||
We will need to create a new TypeScript file in the path that follows:
|
||||
|
||||
`"lib/browser/api/{electron_browser_{api_name}}.ts"`
|
||||
|
||||
An example of the contents of this file can be found [here](https://github.com/electron/electron/blob/main/lib/browser/api/native-image.ts).
|
||||
|
||||
### Expose Your module to TypeScript
|
||||
|
||||
Add your module to the module list found at `"lib/browser/api/module-list.ts"` like so:
|
||||
|
||||
```typescript
|
||||
export const browserModuleList: ElectronInternal.ModuleEntry[] = [
|
||||
{ name: 'apiName', loader: () => require('./api-name') },
|
||||
];
|
||||
```
|
||||
@@ -138,7 +138,7 @@ Finally, the `main.js` file represents the main process and contains the actual
|
||||
const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
function createWindow () {
|
||||
const createWindow = () => {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
|
||||
@@ -39,7 +39,7 @@ inAppPurchase.on('transactions-updated', (event, transactions) => {
|
||||
}
|
||||
|
||||
// Check each transaction.
|
||||
transactions.forEach(function (transaction) {
|
||||
transactions.forEach((transaction) => {
|
||||
const payment = transaction.payment
|
||||
|
||||
switch (transaction.transactionState) {
|
||||
|
||||
@@ -90,6 +90,11 @@ ELECTRON_CUSTOM_DIR="{{ version }}"
|
||||
The above configuration will download from URLs such as
|
||||
`https://npm.taobao.org/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip`.
|
||||
|
||||
If your mirror serves artifacts with different checksums to the official
|
||||
Electron release you may have to set `ELECTRON_USE_REMOTE_CHECKSUMS=1` to
|
||||
force Electron to use the remote `SHASUMS256.txt` file to verify the checksum
|
||||
instead of the embedded checksums.
|
||||
|
||||
#### Cache
|
||||
|
||||
Alternatively, you can override the local cache. `@electron/get` will cache
|
||||
|
||||
@@ -82,7 +82,7 @@ listen for the `keyup` and `keydown` [DOM events][dom-events] inside the
|
||||
renderer process using the [addEventListener() API][addEventListener-api].
|
||||
|
||||
```javascript fiddle='docs/fiddles/features/keyboard-shortcuts/web-apis|focus=renderer.js'
|
||||
function handleKeyPress(event) {
|
||||
const handleKeyPress = (event) => {
|
||||
// You can put code here to handle the keypress.
|
||||
document.getElementById("last-keypress").innerText = event.key;
|
||||
console.log(`You pressed ${event.key}`);
|
||||
|
||||
@@ -44,7 +44,7 @@ if (process.defaultApp) {
|
||||
We will now define the function in charge of creating our browser window and load our application's `index.html` file.
|
||||
|
||||
```js
|
||||
function createWindow () {
|
||||
const createWindow = () => {
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
@@ -112,7 +112,7 @@ Finally, we will add some additional code to handle when someone closes our appl
|
||||
// Quit when all windows are closed, except on macOS. There, it's common
|
||||
// for applications and their menu bar to stay active until the user quits
|
||||
// explicitly with Cmd + Q.
|
||||
app.on('window-all-closed', function () {
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') app.quit()
|
||||
})
|
||||
```
|
||||
|
||||
@@ -25,7 +25,7 @@ Starting with a working application from the
|
||||
```javascript fiddle='docs/fiddles/features/macos-dock-menu'
|
||||
const { app, BrowserWindow, Menu } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const createWindow = () => {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
|
||||
@@ -134,7 +134,7 @@ app.whenReady().then(async () => {
|
||||
<script>
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
function doWork(input) {
|
||||
const doWork = (input) => {
|
||||
// Something cpu-intensive.
|
||||
return input * 2
|
||||
}
|
||||
@@ -185,7 +185,7 @@ stream of data.
|
||||
```js
|
||||
// renderer.js ///////////////////////////////////////////////////////////////
|
||||
|
||||
function makeStreamingRequest (element, callback) {
|
||||
const makeStreamingRequest = (element, callback) => {
|
||||
// MessageChannels are lightweight--it's cheap to create a new one for each
|
||||
// request.
|
||||
const { port1, port2 } = new MessageChannel()
|
||||
|
||||
@@ -54,7 +54,7 @@ const { Notification } = require('electron')
|
||||
const NOTIFICATION_TITLE = 'Basic Notification'
|
||||
const NOTIFICATION_BODY = 'Notification from the Main process'
|
||||
|
||||
function showNotification () {
|
||||
const showNotification = () => {
|
||||
new Notification({ title: NOTIFICATION_TITLE, body: NOTIFICATION_BODY }).show()
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ Starting with an HTML file `index.html`, this example will demonstrate how the `
|
||||
In order to mutate the DOM, create a `renderer.js` file that adds event listeners to the `'online'` and `'offline'` `window` events. The event handler sets the content of the `<strong id='status'>` element depending on the result of `navigator.onLine`.
|
||||
|
||||
```js title='renderer.js'
|
||||
function updateOnlineStatus () {
|
||||
const updateOnlineStatus = () => {
|
||||
document.getElementById('status').innerHTML = navigator.onLine ? 'online' : 'offline'
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ Finally, create a `main.js` file for main process that creates the window.
|
||||
```js title='main.js'
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
function createWindow () {
|
||||
const createWindow = () => {
|
||||
const onlineStatusWindow = new BrowserWindow({
|
||||
width: 400,
|
||||
height: 100
|
||||
|
||||
@@ -84,7 +84,7 @@ uses `app` APIs to create a more native application window experience.
|
||||
|
||||
```js title='main.js'
|
||||
// quitting the app when no windows are open on macOS
|
||||
app.on('window-all-closed', function () {
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') app.quit()
|
||||
})
|
||||
```
|
||||
|
||||
@@ -48,7 +48,7 @@ const { app, BrowserWindow } = require('electron')
|
||||
|
||||
let progressInterval
|
||||
|
||||
function createWindow () {
|
||||
const createWindow = () => {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600
|
||||
|
||||
@@ -166,7 +166,7 @@ Then, add a `createWindow()` function that loads `index.html` into a new `Browse
|
||||
instance.
|
||||
|
||||
```js
|
||||
function createWindow () {
|
||||
const createWindow = () => {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600
|
||||
@@ -216,7 +216,7 @@ To implement this, listen for the `app` module's [`'window-all-closed'`][window-
|
||||
event, and call [`app.quit()`][app-quit] if the user is not on macOS (`darwin`).
|
||||
|
||||
```js
|
||||
app.on('window-all-closed', function () {
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') app.quit()
|
||||
})
|
||||
```
|
||||
@@ -244,7 +244,7 @@ from within your existing `whenReady()` callback.
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
app.on('activate', function () {
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
})
|
||||
@@ -295,7 +295,7 @@ to the `webPreferences.preload` option in your existing `BrowserWindow` construc
|
||||
const path = require('path')
|
||||
|
||||
// modify your existing createWindow() function
|
||||
function createWindow () {
|
||||
const createWindow = () => {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
@@ -360,7 +360,7 @@ The full code is available below:
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
function createWindow () {
|
||||
const createWindow = () => {
|
||||
// Create the browser window.
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
@@ -383,7 +383,7 @@ function createWindow () {
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
app.on('activate', function () {
|
||||
app.on('activate', () => {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
@@ -393,7 +393,7 @@ app.whenReady().then(() => {
|
||||
// Quit when all windows are closed, except on macOS. There, it's common
|
||||
// for applications and their menu bar to stay active until the user quits
|
||||
// explicitly with Cmd + Q.
|
||||
app.on('window-all-closed', function () {
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') app.quit()
|
||||
})
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ const { app, BrowserWindow } = require('electron')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
function createWindow () {
|
||||
const createWindow = () => {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600
|
||||
|
||||
@@ -24,7 +24,7 @@ To set the represented file of window, you can use the
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
const os = require('os');
|
||||
|
||||
function createWindow () {
|
||||
const createWindow = () => {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600
|
||||
|
||||
@@ -216,7 +216,7 @@ access to a `window.readConfig()` method, but no Node.js features.
|
||||
```js
|
||||
const { readFileSync } = require('fs')
|
||||
|
||||
window.readConfig = function () {
|
||||
window.readConfig = () => {
|
||||
const data = readFileSync('./config.json')
|
||||
return data
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ until the maintainers feel the maintenance burden is too high to continue doing
|
||||
|
||||
### Currently supported versions
|
||||
|
||||
* 16.x.y
|
||||
* 15.x.y
|
||||
* 14.x.y
|
||||
* 13.x.y
|
||||
* 12.x.y
|
||||
* 11.x.y
|
||||
* 13
|
||||
|
||||
### End-of-life
|
||||
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<grit-part>
|
||||
<!-- Windows Caption Buttons -->
|
||||
<message name="IDS_APP_ACCNAME_CLOSE" desc="The accessible name for the Close button.">
|
||||
Close
|
||||
</message>
|
||||
<message name="IDS_APP_ACCNAME_MINIMIZE" desc="The accessible name for the Minimize button.">
|
||||
Minimize
|
||||
</message>
|
||||
<message name="IDS_APP_ACCNAME_MAXIMIZE" desc="The accessible name for the Maximize button.">
|
||||
Maximize
|
||||
</message>
|
||||
<message name="IDS_APP_ACCNAME_RESTORE" desc="The accessible name for the Restore button.">
|
||||
Restore
|
||||
</message>
|
||||
|
||||
<!-- Printing Service -->
|
||||
<message name="IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME" desc="The name of the utility process used for printing conversions.">
|
||||
Printing Service
|
||||
|
||||
@@ -42,6 +42,7 @@ auto_filenames = {
|
||||
"docs/api/power-save-blocker.md",
|
||||
"docs/api/process.md",
|
||||
"docs/api/protocol.md",
|
||||
"docs/api/safe-storage.md",
|
||||
"docs/api/screen.md",
|
||||
"docs/api/service-workers.md",
|
||||
"docs/api/session.md",
|
||||
@@ -137,7 +138,6 @@ auto_filenames = {
|
||||
"lib/common/define-properties.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/type-utils.ts",
|
||||
"lib/common/web-view-events.ts",
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
"lib/renderer/api/crash-reporter.ts",
|
||||
@@ -213,6 +213,7 @@ auto_filenames = {
|
||||
"lib/browser/api/power-monitor.ts",
|
||||
"lib/browser/api/power-save-blocker.ts",
|
||||
"lib/browser/api/protocol.ts",
|
||||
"lib/browser/api/safe-storage.ts",
|
||||
"lib/browser/api/screen.ts",
|
||||
"lib/browser/api/session.ts",
|
||||
"lib/browser/api/share-menu.ts",
|
||||
@@ -268,7 +269,6 @@ auto_filenames = {
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/reset-search-paths.ts",
|
||||
"lib/common/type-utils.ts",
|
||||
"lib/common/web-view-events.ts",
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/common/webpack-provider.ts",
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
|
||||
@@ -90,6 +90,10 @@ filenames = {
|
||||
"shell/browser/ui/views/electron_views_delegate_win.cc",
|
||||
"shell/browser/ui/views/win_frame_view.cc",
|
||||
"shell/browser/ui/views/win_frame_view.h",
|
||||
"shell/browser/ui/views/win_caption_button.cc",
|
||||
"shell/browser/ui/views/win_caption_button.h",
|
||||
"shell/browser/ui/views/win_caption_button_container.cc",
|
||||
"shell/browser/ui/views/win_caption_button_container.h",
|
||||
"shell/browser/ui/win/dialog_thread.cc",
|
||||
"shell/browser/ui/win/dialog_thread.h",
|
||||
"shell/browser/ui/win/electron_desktop_native_widget_aura.cc",
|
||||
@@ -288,6 +292,8 @@ filenames = {
|
||||
"shell/browser/api/electron_api_printing.cc",
|
||||
"shell/browser/api/electron_api_protocol.cc",
|
||||
"shell/browser/api/electron_api_protocol.h",
|
||||
"shell/browser/api/electron_api_safe_storage.cc",
|
||||
"shell/browser/api/electron_api_safe_storage.h",
|
||||
"shell/browser/api/electron_api_screen.cc",
|
||||
"shell/browser/api/electron_api_screen.h",
|
||||
"shell/browser/api/electron_api_service_worker_context.cc",
|
||||
|
||||
@@ -143,7 +143,10 @@ export const roleList: Record<RoleId, Role> = {
|
||||
label: 'Toggle Developer Tools',
|
||||
accelerator: isMac ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
||||
nonNativeMacOSRole: true,
|
||||
windowMethod: w => w.webContents.toggleDevTools()
|
||||
webContentsMethod: wc => {
|
||||
const bw = wc.getOwnerBrowserWindow();
|
||||
if (bw) bw.webContents.toggleDevTools();
|
||||
}
|
||||
},
|
||||
togglefullscreen: {
|
||||
label: 'Toggle Full Screen',
|
||||
|
||||
@@ -24,6 +24,7 @@ export const browserModuleList: ElectronInternal.ModuleEntry[] = [
|
||||
{ name: 'powerMonitor', loader: () => require('./power-monitor') },
|
||||
{ name: 'powerSaveBlocker', loader: () => require('./power-save-blocker') },
|
||||
{ name: 'protocol', loader: () => require('./protocol') },
|
||||
{ name: 'safeStorage', loader: () => require('./safe-storage') },
|
||||
{ name: 'screen', loader: () => require('./screen') },
|
||||
{ name: 'session', loader: () => require('./session') },
|
||||
{ name: 'ShareMenu', loader: () => require('./share-menu') },
|
||||
|
||||
3
lib/browser/api/safe-storage.ts
Normal file
3
lib/browser/api/safe-storage.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
const safeStorage = process._linkedBinding('electron_browser_safe_storage');
|
||||
|
||||
module.exports = safeStorage;
|
||||
@@ -67,7 +67,7 @@ ipcMainInternal.handle(IPC_MESSAGES.INSPECTOR_CONTEXT_MENU, function (event, ite
|
||||
|
||||
const template = isEditMenu ? getEditMenuItems() : convertToMenuTemplate(items, resolve);
|
||||
const menu = Menu.buildFromTemplate(template);
|
||||
const window = event.sender.getOwnerBrowserWindow();
|
||||
const window = event.sender.getOwnerBrowserWindow()!;
|
||||
|
||||
menu.popup({ window, callback: () => resolve() });
|
||||
});
|
||||
@@ -94,7 +94,7 @@ ipcMainUtils.handleSync(IPC_MESSAGES.INSPECTOR_CONFIRM, async function (event, m
|
||||
buttons: ['OK', 'Cancel'],
|
||||
cancelId: 1
|
||||
};
|
||||
const window = event.sender.getOwnerBrowserWindow();
|
||||
const window = event.sender.getOwnerBrowserWindow()!;
|
||||
const { response } = await dialog.showMessageBox(window, options);
|
||||
return response === 0;
|
||||
});
|
||||
|
||||
@@ -8,13 +8,14 @@ import { serialize } from '@electron/internal/common/type-utils';
|
||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||
|
||||
interface GuestInstance {
|
||||
elementInstanceId?: number;
|
||||
elementInstanceId: number;
|
||||
visibilityState?: VisibilityState;
|
||||
embedder: Electron.WebContents;
|
||||
guest: Electron.WebContents;
|
||||
}
|
||||
|
||||
const webViewManager = process._linkedBinding('electron_browser_web_view_manager');
|
||||
const eventBinding = process._linkedBinding('electron_browser_event');
|
||||
|
||||
const supportedWebViewEvents = Object.keys(webViewEvents);
|
||||
|
||||
@@ -28,16 +29,73 @@ function sanitizeOptionsForGuest (options: Record<string, any>) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function makeWebPreferences (embedder: Electron.WebContents, params: Record<string, any>) {
|
||||
// parse the 'webpreferences' attribute string, if set
|
||||
// this uses the same parsing rules as window.open uses for its features
|
||||
const parsedWebPreferences =
|
||||
typeof params.webpreferences === 'string'
|
||||
? parseWebViewWebPreferences(params.webpreferences)
|
||||
: null;
|
||||
|
||||
const webPreferences: Electron.WebPreferences = {
|
||||
nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false,
|
||||
nodeIntegrationInSubFrames: params.nodeintegrationinsubframes != null ? params.nodeintegrationinsubframes : false,
|
||||
plugins: params.plugins,
|
||||
zoomFactor: embedder.zoomFactor,
|
||||
disablePopups: !params.allowpopups,
|
||||
webSecurity: !params.disablewebsecurity,
|
||||
enableBlinkFeatures: params.blinkfeatures,
|
||||
disableBlinkFeatures: params.disableblinkfeatures,
|
||||
partition: params.partition,
|
||||
...parsedWebPreferences
|
||||
};
|
||||
|
||||
if (params.preload) {
|
||||
webPreferences.preloadURL = params.preload;
|
||||
}
|
||||
|
||||
// Security options that guest will always inherit from embedder
|
||||
const inheritedWebPreferences = new Map([
|
||||
['contextIsolation', true],
|
||||
['javascript', false],
|
||||
['nativeWindowOpen', true],
|
||||
['nodeIntegration', false],
|
||||
['sandbox', true],
|
||||
['nodeIntegrationInSubFrames', false],
|
||||
['enableWebSQL', false]
|
||||
]);
|
||||
|
||||
// Inherit certain option values from embedder
|
||||
const lastWebPreferences = embedder.getLastWebPreferences()!;
|
||||
for (const [name, value] of inheritedWebPreferences) {
|
||||
if (lastWebPreferences[name as keyof Electron.WebPreferences] === value) {
|
||||
(webPreferences as any)[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
return webPreferences;
|
||||
}
|
||||
|
||||
// Create a new guest instance.
|
||||
const createGuest = function (embedder: Electron.WebContents, params: Record<string, any>) {
|
||||
const createGuest = function (embedder: Electron.WebContents, embedderFrameId: number, elementInstanceId: number, params: Record<string, any>) {
|
||||
const webPreferences = makeWebPreferences(embedder, params);
|
||||
const event = eventBinding.createWithSender(embedder);
|
||||
|
||||
embedder.emit('will-attach-webview', event, webPreferences, params);
|
||||
if (event.defaultPrevented) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const guest = (webContents as typeof ElectronInternal.WebContents).create({
|
||||
...webPreferences,
|
||||
type: 'webview',
|
||||
partition: params.partition,
|
||||
embedder
|
||||
});
|
||||
|
||||
const guestInstanceId = guest.id;
|
||||
guestInstances.set(guestInstanceId, {
|
||||
elementInstanceId,
|
||||
guest,
|
||||
embedder
|
||||
});
|
||||
@@ -51,9 +109,6 @@ const createGuest = function (embedder: Electron.WebContents, params: Record<str
|
||||
|
||||
// Init guest web view after attached.
|
||||
guest.once('did-attach' as any, function (this: Electron.WebContents, event: Electron.Event) {
|
||||
params = this.attachParams!;
|
||||
delete this.attachParams;
|
||||
|
||||
const previouslyAttached = this.viewInstanceId != null;
|
||||
this.viewInstanceId = params.instanceId;
|
||||
|
||||
@@ -81,27 +136,33 @@ const createGuest = function (embedder: Electron.WebContents, params: Record<str
|
||||
}
|
||||
};
|
||||
|
||||
// Dispatch events to embedder.
|
||||
const fn = function (event: string) {
|
||||
guest.on(event as any, function (_, ...args: any[]) {
|
||||
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, event, ...args);
|
||||
const makeProps = (eventKey: string, args: any[]) => {
|
||||
const props: Record<string, any> = {};
|
||||
webViewEvents[eventKey].forEach((prop, index) => {
|
||||
props[prop] = args[index];
|
||||
});
|
||||
return props;
|
||||
};
|
||||
|
||||
// Dispatch events to embedder.
|
||||
for (const event of supportedWebViewEvents) {
|
||||
if (event !== 'new-window') {
|
||||
fn(event);
|
||||
}
|
||||
guest.on(event as any, function (_, ...args: any[]) {
|
||||
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, event, makeProps(event, args));
|
||||
});
|
||||
}
|
||||
|
||||
guest.on('new-window', function (event, url, frameName, disposition, options, additionalFeatures, referrer) {
|
||||
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, 'new-window', url,
|
||||
frameName, disposition, sanitizeOptionsForGuest(options),
|
||||
additionalFeatures, referrer);
|
||||
guest.on('new-window', function (event, url, frameName, disposition, options) {
|
||||
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, 'new-window', {
|
||||
url,
|
||||
frameName,
|
||||
disposition,
|
||||
options: sanitizeOptionsForGuest(options)
|
||||
});
|
||||
});
|
||||
|
||||
// Dispatch guest's IPC messages to embedder.
|
||||
guest.on('ipc-message-host' as any, function (_: Electron.Event, channel: string, args: any[]) {
|
||||
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_IPC_MESSAGE, channel, ...args);
|
||||
sendToEmbedder(IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT, 'ipc-message', { channel, args });
|
||||
});
|
||||
|
||||
// Notify guest of embedder window visibility when it is ready
|
||||
@@ -113,111 +174,25 @@ const createGuest = function (embedder: Electron.WebContents, params: Record<str
|
||||
}
|
||||
});
|
||||
|
||||
return guestInstanceId;
|
||||
};
|
||||
|
||||
// Attach the guest to an element of embedder.
|
||||
const attachGuest = function (event: Electron.IpcMainInvokeEvent,
|
||||
embedderFrameId: number, elementInstanceId: number, guestInstanceId: number, params: Record<string, any>) {
|
||||
const embedder = event.sender;
|
||||
// Destroy the old guest when attaching.
|
||||
const key = `${embedder.id}-${elementInstanceId}`;
|
||||
const oldGuestInstanceId = embedderElementsMap.get(key);
|
||||
if (oldGuestInstanceId != null) {
|
||||
// Reattachment to the same guest is just a no-op.
|
||||
if (oldGuestInstanceId === guestInstanceId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const oldGuestInstance = guestInstances.get(oldGuestInstanceId);
|
||||
if (oldGuestInstance) {
|
||||
oldGuestInstance.guest.detachFromOuterFrame();
|
||||
}
|
||||
}
|
||||
|
||||
const guestInstance = guestInstances.get(guestInstanceId);
|
||||
// If this isn't a valid guest instance then do nothing.
|
||||
if (!guestInstance) {
|
||||
throw new Error(`Invalid guestInstanceId: ${guestInstanceId}`);
|
||||
}
|
||||
const { guest } = guestInstance;
|
||||
if (guest.hostWebContents !== embedder) {
|
||||
throw new Error(`Access denied to guestInstanceId: ${guestInstanceId}`);
|
||||
}
|
||||
|
||||
// If this guest is already attached to an element then remove it
|
||||
if (guestInstance.elementInstanceId) {
|
||||
const oldKey = `${guestInstance.embedder.id}-${guestInstance.elementInstanceId}`;
|
||||
embedderElementsMap.delete(oldKey);
|
||||
|
||||
// Remove guest from embedder if moving across web views
|
||||
if (guest.viewInstanceId !== params.instanceId) {
|
||||
webViewManager.removeGuest(guestInstance.embedder, guestInstanceId);
|
||||
guestInstance.embedder._sendInternal(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${guest.viewInstanceId}`);
|
||||
}
|
||||
}
|
||||
|
||||
// parse the 'webpreferences' attribute string, if set
|
||||
// this uses the same parsing rules as window.open uses for its features
|
||||
const parsedWebPreferences =
|
||||
typeof params.webpreferences === 'string'
|
||||
? parseWebViewWebPreferences(params.webpreferences)
|
||||
: null;
|
||||
|
||||
const webPreferences: Electron.WebPreferences = {
|
||||
guestInstanceId,
|
||||
nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false,
|
||||
nodeIntegrationInSubFrames: params.nodeintegrationinsubframes != null ? params.nodeintegrationinsubframes : false,
|
||||
plugins: params.plugins,
|
||||
zoomFactor: embedder.zoomFactor,
|
||||
disablePopups: !params.allowpopups,
|
||||
webSecurity: !params.disablewebsecurity,
|
||||
enableBlinkFeatures: params.blinkfeatures,
|
||||
disableBlinkFeatures: params.disableblinkfeatures,
|
||||
...parsedWebPreferences
|
||||
};
|
||||
|
||||
if (params.preload) {
|
||||
webPreferences.preloadURL = params.preload;
|
||||
}
|
||||
|
||||
// Security options that guest will always inherit from embedder
|
||||
const inheritedWebPreferences = new Map([
|
||||
['contextIsolation', true],
|
||||
['javascript', false],
|
||||
['nativeWindowOpen', true],
|
||||
['nodeIntegration', false],
|
||||
['sandbox', true],
|
||||
['nodeIntegrationInSubFrames', false],
|
||||
['enableWebSQL', false]
|
||||
]);
|
||||
|
||||
// Inherit certain option values from embedder
|
||||
const lastWebPreferences = embedder.getLastWebPreferences();
|
||||
for (const [name, value] of inheritedWebPreferences) {
|
||||
if (lastWebPreferences[name as keyof Electron.WebPreferences] === value) {
|
||||
(webPreferences as any)[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
embedder.emit('will-attach-webview', event, webPreferences, params);
|
||||
if (event.defaultPrevented) {
|
||||
if (guest.viewInstanceId == null) guest.viewInstanceId = params.instanceId;
|
||||
guest.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
guest.attachParams = params;
|
||||
embedderElementsMap.set(key, guestInstanceId);
|
||||
|
||||
guest.setEmbedder(embedder);
|
||||
guestInstance.embedder = embedder;
|
||||
guestInstance.elementInstanceId = elementInstanceId;
|
||||
|
||||
watchEmbedder(embedder);
|
||||
|
||||
webViewManager.addGuest(guestInstanceId, embedder, guest, webPreferences);
|
||||
guest.attachToIframe(embedder, embedderFrameId);
|
||||
|
||||
return guestInstanceId;
|
||||
};
|
||||
|
||||
// Remove an guest-embedder relationship.
|
||||
@@ -302,16 +277,8 @@ const handleMessageSync = function (channel: string, handler: (event: ElectronIn
|
||||
ipcMainUtils.handleSync(channel, makeSafeHandler(channel, handler));
|
||||
};
|
||||
|
||||
handleMessage(IPC_MESSAGES.GUEST_VIEW_MANAGER_CREATE_GUEST, function (event, params) {
|
||||
return createGuest(event.sender, params);
|
||||
});
|
||||
|
||||
handleMessage(IPC_MESSAGES.GUEST_VIEW_MANAGER_ATTACH_GUEST, function (event, embedderFrameId: number, elementInstanceId: number, guestInstanceId: number, params) {
|
||||
try {
|
||||
attachGuest(event, embedderFrameId, elementInstanceId, guestInstanceId, params);
|
||||
} catch (error) {
|
||||
console.error(`Guest attach failed: ${error}`);
|
||||
}
|
||||
handleMessage(IPC_MESSAGES.GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST, function (event, embedderFrameId: number, elementInstanceId: number, params) {
|
||||
return createGuest(event.sender, embedderFrameId, elementInstanceId, params);
|
||||
});
|
||||
|
||||
handleMessageSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_DETACH_GUEST, function (event, guestInstanceId: number) {
|
||||
|
||||
@@ -144,7 +144,7 @@ function emitDeprecatedNewWindowEvent ({ event, embedder, guest, windowOpenArgs,
|
||||
postData?: PostData,
|
||||
}): boolean {
|
||||
const { url, frameName } = windowOpenArgs;
|
||||
const isWebViewWithPopupsDisabled = embedder.getType() === 'webview' && embedder.getLastWebPreferences().disablePopups;
|
||||
const isWebViewWithPopupsDisabled = embedder.getType() === 'webview' && embedder.getLastWebPreferences()!.disablePopups;
|
||||
const postBody = postData ? {
|
||||
data: postData,
|
||||
...parseContentTypeFormat(postData)
|
||||
@@ -229,7 +229,7 @@ export function makeWebPreferences ({ embedder, secureOverrideWebPreferences = {
|
||||
// have unvetted prefs, use parsedWebPreferences.
|
||||
secureOverrideWebPreferences?: BrowserWindowConstructorOptions['webPreferences'],
|
||||
}) {
|
||||
const parentWebPreferences = embedder.getLastWebPreferences();
|
||||
const parentWebPreferences = embedder.getLastWebPreferences()!;
|
||||
const securityWebPreferencesFromParent = (Object.keys(securityWebPreferences).reduce((map, key) => {
|
||||
if (securityWebPreferences[key] === parentWebPreferences[key as keyof Electron.WebPreferences]) {
|
||||
(map as any)[key] = parentWebPreferences[key as keyof Electron.WebPreferences];
|
||||
|
||||
@@ -28,7 +28,7 @@ const getGuestWindow = function (guestContents: WebContents) {
|
||||
};
|
||||
|
||||
const isChildWindow = function (sender: WebContents, target: WebContents) {
|
||||
return target.getLastWebPreferences().openerId === sender.id;
|
||||
return target.getLastWebPreferences()!.openerId === sender.id;
|
||||
};
|
||||
|
||||
const isRelatedWindow = function (sender: WebContents, target: WebContents) {
|
||||
@@ -43,7 +43,7 @@ const isScriptableWindow = function (sender: WebContents, target: WebContents) {
|
||||
};
|
||||
|
||||
const isNodeIntegrationEnabled = function (sender: WebContents) {
|
||||
return sender.getLastWebPreferences().nodeIntegration === true;
|
||||
return sender.getLastWebPreferences()!.nodeIntegration === true;
|
||||
};
|
||||
|
||||
// Checks whether |sender| can access the |target|:
|
||||
@@ -65,7 +65,7 @@ ipcMainInternal.on(
|
||||
features: string
|
||||
) => {
|
||||
// This should only be allowed for senders that have nativeWindowOpen: false
|
||||
const lastWebPreferences = event.sender.getLastWebPreferences();
|
||||
const lastWebPreferences = event.sender.getLastWebPreferences()!;
|
||||
if (lastWebPreferences.nativeWindowOpen || lastWebPreferences.sandbox) {
|
||||
event.returnValue = null;
|
||||
throw new Error(
|
||||
|
||||
@@ -7,12 +7,9 @@ export const enum IPC_MESSAGES {
|
||||
|
||||
GUEST_INSTANCE_VISIBILITY_CHANGE = 'GUEST_INSTANCE_VISIBILITY_CHANGE',
|
||||
|
||||
GUEST_VIEW_INTERNAL_DESTROY_GUEST = 'GUEST_VIEW_INTERNAL_DESTROY_GUEST',
|
||||
GUEST_VIEW_INTERNAL_DISPATCH_EVENT = 'GUEST_VIEW_INTERNAL_DISPATCH_EVENT',
|
||||
GUEST_VIEW_INTERNAL_IPC_MESSAGE = 'GUEST_VIEW_INTERNAL_IPC_MESSAGE',
|
||||
|
||||
GUEST_VIEW_MANAGER_CREATE_GUEST = 'GUEST_VIEW_MANAGER_CREATE_GUEST',
|
||||
GUEST_VIEW_MANAGER_ATTACH_GUEST = 'GUEST_VIEW_MANAGER_ATTACH_GUEST',
|
||||
GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST = 'GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST',
|
||||
GUEST_VIEW_MANAGER_DETACH_GUEST = 'GUEST_VIEW_MANAGER_DETACH_GUEST',
|
||||
GUEST_VIEW_MANAGER_FOCUS_CHANGE = 'GUEST_VIEW_MANAGER_FOCUS_CHANGE',
|
||||
GUEST_VIEW_MANAGER_CALL = 'GUEST_VIEW_MANAGER_CALL',
|
||||
|
||||
@@ -12,7 +12,6 @@ export const webViewEvents: Record<string, readonly string[]> = {
|
||||
'devtools-opened': [],
|
||||
'devtools-closed': [],
|
||||
'devtools-focused': [],
|
||||
'new-window': ['url', 'frameName', 'disposition', 'options'],
|
||||
'will-navigate': ['url'],
|
||||
'did-start-navigation': ['url', 'isInPlace', 'isMainFrame', 'frameProcessId', 'frameRoutingId'],
|
||||
'did-navigate': ['url', 'httpResponseCode', 'httpStatusText'],
|
||||
|
||||
@@ -74,7 +74,7 @@ const isHiddenPage = mainFrame.getWebPreference('hiddenPage');
|
||||
const usesNativeWindowOpen = mainFrame.getWebPreference('nativeWindowOpen');
|
||||
const preloadScript = mainFrame.getWebPreference('preload');
|
||||
const preloadScripts = mainFrame.getWebPreference('preloadScripts');
|
||||
const guestInstanceId = mainFrame.getWebPreference('guestInstanceId');
|
||||
const isWebView = mainFrame.getWebPreference('isWebView');
|
||||
const openerId = mainFrame.getWebPreference('openerId');
|
||||
const appPath = hasSwitch('app-path') ? getSwitchValue('app-path') : null;
|
||||
|
||||
@@ -98,14 +98,14 @@ switch (window.location.protocol) {
|
||||
default: {
|
||||
// Override default web functions.
|
||||
const { windowSetup } = require('@electron/internal/renderer/window-setup') as typeof windowSetupModule;
|
||||
windowSetup(guestInstanceId, openerId, isHiddenPage, usesNativeWindowOpen);
|
||||
windowSetup(isWebView, openerId, isHiddenPage, usesNativeWindowOpen);
|
||||
}
|
||||
}
|
||||
|
||||
// Load webview tag implementation.
|
||||
if (process.isMainFrame) {
|
||||
const { webViewInit } = require('@electron/internal/renderer/web-view/web-view-init') as typeof webViewInitModule;
|
||||
webViewInit(contextIsolation, webviewTag, guestInstanceId);
|
||||
webViewInit(contextIsolation, webviewTag, isWebView);
|
||||
}
|
||||
|
||||
if (nodeIntegration) {
|
||||
|
||||
@@ -1,58 +1,32 @@
|
||||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
|
||||
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
||||
import { webViewEvents } from '@electron/internal/common/web-view-events';
|
||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||
|
||||
const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame');
|
||||
|
||||
export interface GuestViewDelegate {
|
||||
dispatchEvent (eventName: string, props: Record<string, any>): void;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
const DEPRECATED_EVENTS: Record<string, string> = {
|
||||
'page-title-updated': 'page-title-set'
|
||||
} as const;
|
||||
|
||||
const dispatchEvent = function (delegate: GuestViewDelegate, eventName: string, eventKey: string, ...args: Array<any>) {
|
||||
if (DEPRECATED_EVENTS[eventName] != null) {
|
||||
dispatchEvent(delegate, DEPRECATED_EVENTS[eventName], eventKey, ...args);
|
||||
}
|
||||
|
||||
const props: Record<string, any> = {};
|
||||
webViewEvents[eventKey].forEach((prop, index) => {
|
||||
props[prop] = args[index];
|
||||
});
|
||||
|
||||
delegate.dispatchEvent(eventName, props);
|
||||
};
|
||||
|
||||
export function registerEvents (viewInstanceId: number, delegate: GuestViewDelegate) {
|
||||
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${viewInstanceId}`, function () {
|
||||
delegate.reset();
|
||||
delegate.dispatchEvent('destroyed', {});
|
||||
});
|
||||
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`, function (event, eventName, props) {
|
||||
if (DEPRECATED_EVENTS[eventName] != null) {
|
||||
delegate.dispatchEvent(DEPRECATED_EVENTS[eventName], props);
|
||||
}
|
||||
|
||||
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`, function (event, eventName, ...args) {
|
||||
dispatchEvent(delegate, eventName, eventName, ...args);
|
||||
});
|
||||
|
||||
ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_IPC_MESSAGE}-${viewInstanceId}`, function (event, channel, ...args) {
|
||||
delegate.dispatchEvent('ipc-message', { channel, args });
|
||||
delegate.dispatchEvent(eventName, props);
|
||||
});
|
||||
}
|
||||
|
||||
export function deregisterEvents (viewInstanceId: number) {
|
||||
ipcRendererInternal.removeAllListeners(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${viewInstanceId}`);
|
||||
ipcRendererInternal.removeAllListeners(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`);
|
||||
ipcRendererInternal.removeAllListeners(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_IPC_MESSAGE}-${viewInstanceId}`);
|
||||
}
|
||||
|
||||
export function createGuest (params: Record<string, any>): Promise<number> {
|
||||
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CREATE_GUEST, params);
|
||||
}
|
||||
|
||||
export function attachGuest (iframe: HTMLIFrameElement, elementInstanceId: number, guestInstanceId: number, params: Record<string, any>) {
|
||||
export function createGuest (iframe: HTMLIFrameElement, elementInstanceId: number, params: Record<string, any>): Promise<number> {
|
||||
if (!(iframe instanceof HTMLIFrameElement)) {
|
||||
throw new Error('Invalid embedder frame');
|
||||
}
|
||||
@@ -62,7 +36,7 @@ export function attachGuest (iframe: HTMLIFrameElement, elementInstanceId: numbe
|
||||
throw new Error('Invalid embedder frame');
|
||||
}
|
||||
|
||||
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_ATTACH_GUEST, embedderFrameId, elementInstanceId, guestInstanceId, params);
|
||||
return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CREATE_AND_ATTACH_GUEST, embedderFrameId, elementInstanceId, params);
|
||||
}
|
||||
|
||||
export function detachGuest (guestInstanceId: number) {
|
||||
|
||||
@@ -55,8 +55,7 @@ const defineWebViewElement = (hooks: WebViewImplHooks) => {
|
||||
}
|
||||
if (!internal.elementAttached) {
|
||||
hooks.guestViewInternal.registerEvents(internal.viewInstanceId, {
|
||||
dispatchEvent: internal.dispatchEvent.bind(internal),
|
||||
reset: internal.reset.bind(internal)
|
||||
dispatchEvent: internal.dispatchEvent.bind(internal)
|
||||
});
|
||||
internal.elementAttached = true;
|
||||
(internal.attributes.get(WEB_VIEW_CONSTANTS.ATTRIBUTE_SRC) as SrcAttribute).parse();
|
||||
|
||||
@@ -115,9 +115,11 @@ export class WebViewImpl {
|
||||
}
|
||||
|
||||
createGuest () {
|
||||
this.hooks.guestViewInternal.createGuest(this.buildParams()).then(guestInstanceId => {
|
||||
this.attachGuestInstance(guestInstanceId);
|
||||
});
|
||||
this.internalInstanceId = getNextId();
|
||||
this.hooks.guestViewInternal.createGuest(this.internalElement, this.internalInstanceId, this.buildParams())
|
||||
.then(guestInstanceId => {
|
||||
this.attachGuestInstance(guestInstanceId);
|
||||
});
|
||||
}
|
||||
|
||||
dispatchEvent (eventName: string, props: Record<string, any> = {}) {
|
||||
@@ -192,20 +194,19 @@ export class WebViewImpl {
|
||||
}
|
||||
|
||||
attachGuestInstance (guestInstanceId: number) {
|
||||
if (!this.elementAttached) {
|
||||
// The element could be detached before we got response from browser.
|
||||
if (guestInstanceId === -1) {
|
||||
this.dispatchEvent('destroyed');
|
||||
return;
|
||||
}
|
||||
this.internalInstanceId = getNextId();
|
||||
|
||||
if (!this.elementAttached) {
|
||||
// The element could be detached before we got response from browser.
|
||||
// Destroy the backing webContents to avoid any zombie nodes in the frame tree.
|
||||
this.hooks.guestViewInternal.detachGuest(guestInstanceId);
|
||||
return;
|
||||
}
|
||||
|
||||
this.guestInstanceId = guestInstanceId;
|
||||
|
||||
this.hooks.guestViewInternal.attachGuest(
|
||||
this.internalElement,
|
||||
this.internalInstanceId,
|
||||
this.guestInstanceId,
|
||||
this.buildParams()
|
||||
);
|
||||
|
||||
// TODO(zcbenz): Should we deprecate the "resize" event? Wait, it is not
|
||||
// even documented.
|
||||
this.resizeObserver = new ResizeObserver(this.onElementResize.bind(this));
|
||||
|
||||
@@ -20,9 +20,9 @@ function handleFocusBlur () {
|
||||
});
|
||||
}
|
||||
|
||||
export function webViewInit (contextIsolation: boolean, webviewTag: boolean, guestInstanceId: number) {
|
||||
export function webViewInit (contextIsolation: boolean, webviewTag: boolean, isWebView: boolean) {
|
||||
// Don't allow recursive `<webview>`.
|
||||
if (webviewTag && !guestInstanceId) {
|
||||
if (webviewTag && !isWebView) {
|
||||
const guestViewInternal = require('@electron/internal/renderer/web-view/guest-view-internal') as typeof guestViewInternalModule;
|
||||
if (contextIsolation) {
|
||||
v8Util.setHiddenValue(window, 'guestViewInternal', guestViewInternal);
|
||||
@@ -36,7 +36,7 @@ export function webViewInit (contextIsolation: boolean, webviewTag: boolean, gue
|
||||
}
|
||||
}
|
||||
|
||||
if (guestInstanceId) {
|
||||
if (isWebView) {
|
||||
// Report focus/blur events of webview to browser.
|
||||
handleFocusBlur();
|
||||
}
|
||||
|
||||
@@ -243,8 +243,8 @@ class BrowserWindowProxy {
|
||||
}
|
||||
|
||||
export const windowSetup = (
|
||||
guestInstanceId: number, openerId: number, isHiddenPage: boolean, usesNativeWindowOpen: boolean) => {
|
||||
if (!process.sandboxed && !guestInstanceId) {
|
||||
isWebView: boolean, openerId: number, isHiddenPage: boolean, usesNativeWindowOpen: boolean) => {
|
||||
if (!process.sandboxed && !isWebView) {
|
||||
// Override default window.close.
|
||||
window.close = function () {
|
||||
ipcRendererInternal.send(IPC_MESSAGES.BROWSER_WINDOW_CLOSE);
|
||||
@@ -318,7 +318,7 @@ export const windowSetup = (
|
||||
});
|
||||
}
|
||||
|
||||
if (guestInstanceId) {
|
||||
if (isWebView) {
|
||||
// Webview `document.visibilityState` tracks window visibility (and ignores
|
||||
// the actual <webview> element visibility) for backwards compatibility.
|
||||
// See discussion in #9178.
|
||||
|
||||
@@ -127,7 +127,7 @@ const contextIsolation = mainFrame.getWebPreference('contextIsolation');
|
||||
const webviewTag = mainFrame.getWebPreference('webviewTag');
|
||||
const isHiddenPage = mainFrame.getWebPreference('hiddenPage');
|
||||
const usesNativeWindowOpen = true;
|
||||
const guestInstanceId = mainFrame.getWebPreference('guestInstanceId');
|
||||
const isWebView = mainFrame.getWebPreference('isWebView');
|
||||
const openerId = mainFrame.getWebPreference('openerId');
|
||||
|
||||
switch (window.location.protocol) {
|
||||
@@ -145,14 +145,14 @@ switch (window.location.protocol) {
|
||||
default: {
|
||||
// Override default web functions.
|
||||
const { windowSetup } = require('@electron/internal/renderer/window-setup') as typeof windowSetupModule;
|
||||
windowSetup(guestInstanceId, openerId, isHiddenPage, usesNativeWindowOpen);
|
||||
windowSetup(isWebView, openerId, isHiddenPage, usesNativeWindowOpen);
|
||||
}
|
||||
}
|
||||
|
||||
// Load webview tag implementation.
|
||||
if (process.isMainFrame) {
|
||||
const { webViewInit } = require('@electron/internal/renderer/web-view/web-view-init') as typeof webViewInitModule;
|
||||
webViewInit(contextIsolation, webviewTag, guestInstanceId);
|
||||
webViewInit(contextIsolation, webviewTag, isWebView);
|
||||
}
|
||||
|
||||
// Wrap the script into a function executed in global scope. It won't have
|
||||
|
||||
@@ -41,6 +41,7 @@ downloadArtifact({
|
||||
artifactName: 'electron',
|
||||
force: process.env.force_no_cache === 'true',
|
||||
cacheRoot: process.env.electron_config_cache,
|
||||
checksums: process.env.electron_use_remote_checksums ? undefined : require('./checksums.json'),
|
||||
platform,
|
||||
arch
|
||||
}).then(extractFile).catch(err => {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"postinstall": "node install.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron/get": "^1.0.1",
|
||||
"@electron/get": "^1.13.0",
|
||||
"@types/node": "^14.6.2",
|
||||
"extract-zip": "^1.0.3"
|
||||
},
|
||||
|
||||
12
package.json
12
package.json
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "electron",
|
||||
"version": "15.0.0-alpha.9",
|
||||
"version": "16.0.0-nightly.20210823",
|
||||
"repository": "https://github.com/electron/electron",
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
"@electron/docs-parser": "^0.12.1",
|
||||
"@electron/typescript-definitions": "^8.9.4",
|
||||
"@electron/typescript-definitions": "^8.9.5",
|
||||
"@octokit/auth-app": "^2.10.0",
|
||||
"@octokit/rest": "^18.0.3",
|
||||
"@primer/octicons": "^10.0.0",
|
||||
@@ -35,7 +35,7 @@
|
||||
"check-for-leaks": "^1.2.1",
|
||||
"colors": "^1.4.0",
|
||||
"dotenv-safe": "^4.0.4",
|
||||
"dugite": "^1.45.0",
|
||||
"dugite": "^1.103.0",
|
||||
"eslint": "^7.4.0",
|
||||
"eslint-config-standard": "^14.1.1",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
@@ -54,12 +54,10 @@
|
||||
"markdownlint": "^0.21.1",
|
||||
"markdownlint-cli": "^0.25.0",
|
||||
"minimist": "^1.2.5",
|
||||
"nugget": "^2.0.1",
|
||||
"null-loader": "^4.0.0",
|
||||
"pre-flight": "^1.1.0",
|
||||
"remark-cli": "^4.0.0",
|
||||
"remark-preset-lint-markdown-style-guide": "^2.1.1",
|
||||
"request": "^2.88.2",
|
||||
"remark-cli": "^10.0.0",
|
||||
"remark-preset-lint-markdown-style-guide": "^4.0.0",
|
||||
"semver": "^5.6.0",
|
||||
"shx": "^0.3.2",
|
||||
"standard-markdown": "^6.0.0",
|
||||
|
||||
@@ -15,28 +15,32 @@ This patch should not be upstreamed, and can be removed in Electron 15 and
|
||||
beyond once we identify the cause of the crash.
|
||||
|
||||
diff --git a/gin/wrappable.cc b/gin/wrappable.cc
|
||||
index fe07eb94a8e679859bba6d76ff0d6ee86bd0c67e..d0066fca501eae5be4177440b44dbecc8e34c897 100644
|
||||
index fe07eb94a8e679859bba6d76ff0d6ee86bd0c67e..ecb0aa2c4ec57e1814f4c94194e775440f4e35ee 100644
|
||||
--- a/gin/wrappable.cc
|
||||
+++ b/gin/wrappable.cc
|
||||
@@ -8,6 +8,10 @@
|
||||
@@ -8,6 +8,11 @@
|
||||
#include "gin/object_template_builder.h"
|
||||
#include "gin/per_isolate_data.h"
|
||||
|
||||
+#if !defined(MAS_BUILD)
|
||||
+#include "components/crash/core/common/crash_key.h"
|
||||
+#include "electron/shell/common/crash_keys.h"
|
||||
+#endif
|
||||
+
|
||||
namespace gin {
|
||||
|
||||
WrappableBase::WrappableBase() = default;
|
||||
@@ -36,6 +40,12 @@ void WrappableBase::FirstWeakCallback(
|
||||
@@ -36,6 +41,15 @@ void WrappableBase::FirstWeakCallback(
|
||||
void WrappableBase::SecondWeakCallback(
|
||||
const v8::WeakCallbackInfo<WrappableBase>& data) {
|
||||
WrappableBase* wrappable = data.GetParameter();
|
||||
+
|
||||
+#if !defined(MAS_BUILD)
|
||||
+ WrapperInfo* info = static_cast<WrapperInfo*>(data.GetInternalField(0));
|
||||
+ electron::crash_keys::SetCrashKeyForGinWrappable(info);
|
||||
+ WrapperInfo* wrapperInfo = static_cast<WrapperInfo*>(data.GetInternalField(0));
|
||||
+ std::string location = electron::crash_keys::GetCrashValueForGinWrappable(wrapperInfo);
|
||||
+
|
||||
+ static crash_reporter::CrashKeyString<32> crash_key("gin-wrappable-fatal.location");
|
||||
+ crash_reporter::ScopedCrashKeyString auto_clear(&crash_key, location);
|
||||
+#endif
|
||||
+
|
||||
delete wrappable;
|
||||
|
||||
@@ -8,7 +8,7 @@ WebPreferences of in-process child windows, rather than relying on
|
||||
process-level command line switches, as before.
|
||||
|
||||
diff --git a/third_party/blink/common/web_preferences/web_preferences.cc b/third_party/blink/common/web_preferences/web_preferences.cc
|
||||
index 8a1315f7f89588bb21c6d3c21a7de7c07fed9679..51cc790f7e1ba1440a6ffaa56c9e01687fc35c06 100644
|
||||
index 8a1315f7f89588bb21c6d3c21a7de7c07fed9679..c23443c7816e38836b2f4233ca3a742693888f39 100644
|
||||
--- a/third_party/blink/common/web_preferences/web_preferences.cc
|
||||
+++ b/third_party/blink/common/web_preferences/web_preferences.cc
|
||||
@@ -148,6 +148,22 @@ WebPreferences::WebPreferences()
|
||||
@@ -18,7 +18,7 @@ index 8a1315f7f89588bb21c6d3c21a7de7c07fed9679..51cc790f7e1ba1440a6ffaa56c9e0168
|
||||
+ // Begin Electron-specific WebPreferences.
|
||||
+ opener_id(0),
|
||||
+ context_isolation(false),
|
||||
+ guest_instance_id(0),
|
||||
+ is_webview(false),
|
||||
+ hidden_page(false),
|
||||
+ offscreen(false),
|
||||
+ preload(base::FilePath::StringType()),
|
||||
@@ -35,7 +35,7 @@ index 8a1315f7f89588bb21c6d3c21a7de7c07fed9679..51cc790f7e1ba1440a6ffaa56c9e0168
|
||||
accelerated_video_decode_enabled(false),
|
||||
animation_policy(
|
||||
diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
index a264ef99beb81dd6b1f55c1b0f57f6055b4ab771..ff4d5c5245ba0641b4ef02cdaf5d50be537b709e 100644
|
||||
index a264ef99beb81dd6b1f55c1b0f57f6055b4ab771..16b734cb371d22dbe99b4ae397126f240b9f686c 100644
|
||||
--- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
+++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
|
||||
@@ -23,6 +23,10 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
|
||||
@@ -56,7 +56,7 @@ index a264ef99beb81dd6b1f55c1b0f57f6055b4ab771..ff4d5c5245ba0641b4ef02cdaf5d50be
|
||||
+ // Begin Electron-specific WebPreferences.
|
||||
+ out->opener_id = data.opener_id();
|
||||
+ out->context_isolation = data.context_isolation();
|
||||
+ out->guest_instance_id = data.guest_instance_id();
|
||||
+ out->is_webview = data.is_webview();
|
||||
+ out->hidden_page = data.hidden_page();
|
||||
+ out->offscreen = data.offscreen();
|
||||
+ out->native_window_open = data.native_window_open();
|
||||
@@ -72,7 +72,7 @@ index a264ef99beb81dd6b1f55c1b0f57f6055b4ab771..ff4d5c5245ba0641b4ef02cdaf5d50be
|
||||
out->accelerated_video_decode_enabled =
|
||||
data.accelerated_video_decode_enabled();
|
||||
diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
index 4517bf43c1b80f1aa0f3ba8e67e78b8b91e19f8a..492f6c948af74bb925826a1075e6343f147f0eb2 100644
|
||||
index 4517bf43c1b80f1aa0f3ba8e67e78b8b91e19f8a..5dc73459f424ad0a01b4ea18e4de196e20d24ae5 100644
|
||||
--- a/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
+++ b/third_party/blink/public/common/web_preferences/web_preferences.h
|
||||
@@ -10,6 +10,7 @@
|
||||
@@ -91,7 +91,7 @@ index 4517bf43c1b80f1aa0f3ba8e67e78b8b91e19f8a..492f6c948af74bb925826a1075e6343f
|
||||
+ std::vector<base::FilePath> preloads;
|
||||
+ int opener_id;
|
||||
+ bool context_isolation;
|
||||
+ int guest_instance_id;
|
||||
+ bool is_webview;
|
||||
+ bool hidden_page;
|
||||
+ bool offscreen;
|
||||
+ base::FilePath preload;
|
||||
@@ -109,7 +109,7 @@ index 4517bf43c1b80f1aa0f3ba8e67e78b8b91e19f8a..492f6c948af74bb925826a1075e6343f
|
||||
// only controls whether or not the "document.cookie" field is properly
|
||||
// connected to the backing store, for instance if you wanted to be able to
|
||||
diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
index 9dbbb581a8876430c3e0a39df1ff655d3ddc6d2d..fd6cbcfa1992a75bf660fb9eb47a9099acb3834f 100644
|
||||
index 9dbbb581a8876430c3e0a39df1ff655d3ddc6d2d..98c5c4ac5ee3130581c8576e5ef810a78939f50e 100644
|
||||
--- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
+++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
|
||||
@@ -6,6 +6,7 @@
|
||||
@@ -137,8 +137,8 @@ index 9dbbb581a8876430c3e0a39df1ff655d3ddc6d2d..fd6cbcfa1992a75bf660fb9eb47a9099
|
||||
+ return r.context_isolation;
|
||||
+ }
|
||||
+
|
||||
+ static int guest_instance_id(const blink::web_pref::WebPreferences& r) {
|
||||
+ return r.guest_instance_id;
|
||||
+ static int is_webview(const blink::web_pref::WebPreferences& r) {
|
||||
+ return r.is_webview;
|
||||
+ }
|
||||
+
|
||||
+ static bool hidden_page(const blink::web_pref::WebPreferences& r) {
|
||||
@@ -190,7 +190,7 @@ index 9dbbb581a8876430c3e0a39df1ff655d3ddc6d2d..fd6cbcfa1992a75bf660fb9eb47a9099
|
||||
return r.cookie_enabled;
|
||||
}
|
||||
diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
index eaecb8c2b7dadaf7650bc8ac85cbad4383035e67..7863c865df17fa95965b5a4e543579bac22af90b 100644
|
||||
index eaecb8c2b7dadaf7650bc8ac85cbad4383035e67..64d83af36d384d2eb7fdd89a3a0d3665a40354a1 100644
|
||||
--- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
+++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
|
||||
@@ -10,6 +10,7 @@ import "third_party/blink/public/mojom/v8_cache_options.mojom";
|
||||
@@ -209,7 +209,7 @@ index eaecb8c2b7dadaf7650bc8ac85cbad4383035e67..7863c865df17fa95965b5a4e543579ba
|
||||
+ array<mojo_base.mojom.FilePath> preloads;
|
||||
+ int32 opener_id;
|
||||
+ bool context_isolation;
|
||||
+ int32 guest_instance_id;
|
||||
+ bool is_webview;
|
||||
+ bool hidden_page;
|
||||
+ bool offscreen;
|
||||
+ mojo_base.mojom.FilePath preload;
|
||||
|
||||
@@ -10,7 +10,6 @@ feat_add_new_built_with_electron_variable_to_config_gypi.patch
|
||||
feat_add_flags_for_low-level_hooks_and_exceptions.patch
|
||||
fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch
|
||||
pass_all_globals_through_require.patch
|
||||
fixme_comment_trace_event_macro.patch
|
||||
build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch
|
||||
refactor_allow_embedder_overriding_of_internal_fs_calls.patch
|
||||
chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch
|
||||
@@ -18,7 +17,6 @@ chore_add_context_to_context_aware_module_prevention.patch
|
||||
chore_read_nobrowserglobals_from_global_not_process.patch
|
||||
enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch
|
||||
fix_handle_boringssl_and_openssl_incompatibilities.patch
|
||||
fix_-wincompatible-pointer-types-discards-qualifiers_error.patch
|
||||
fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch
|
||||
fix_allow_preventing_initializeinspector_in_env.patch
|
||||
src_allow_embedders_to_provide_a_custom_pageallocator_to.patch
|
||||
@@ -26,3 +24,6 @@ fix_crypto_tests_to_run_with_bssl.patch
|
||||
fix_account_for_debugger_agent_race_condition.patch
|
||||
fix_use_new_v8_error_message_property_access_format.patch
|
||||
add_should_read_node_options_from_env_option_to_disable_node_options.patch
|
||||
repl_fix_crash_when_sharedarraybuffer_disabled.patch
|
||||
fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch
|
||||
src_remove_extra_semicolons_outside_fns.patch
|
||||
|
||||
@@ -21,10 +21,10 @@ index 1cc7da1ce15f43905ce607adcc1a23ed9d92948a..16af6aec3791df1363682f1ed024c522
|
||||
Isolate* isolate,
|
||||
const std::vector<std::string>& args,
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index 45210f074a0ca4d57f9fdc5019e8e82540b28b72..c0da6c53028bc9459065caf25c1221f556b22d68 100644
|
||||
index 0877f5b1fe2db42acf908e0e1085626fc258ef54..25a8027b9e4ab7817e5ec153ddeccb3c1438912e 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -1143,6 +1143,8 @@ class Environment : public MemoryRetainer {
|
||||
@@ -1142,6 +1142,8 @@ class Environment : public MemoryRetainer {
|
||||
inline double trigger_async_id();
|
||||
inline double get_default_trigger_async_id();
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ This adds GN build files for Node, so we don't have to build with GYP.
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bd26c3623d3314539609a978270d3ced1d167777
|
||||
index 0000000000000000000000000000000000000000..52fb22305bb67c75c9a1cf4bc39cd901420cf7a9
|
||||
--- /dev/null
|
||||
+++ b/BUILD.gn
|
||||
@@ -0,0 +1,400 @@
|
||||
@@ -0,0 +1,401 @@
|
||||
+import("//electron/build/asar.gni")
|
||||
+import("//v8/gni/v8.gni")
|
||||
+
|
||||
@@ -205,6 +205,7 @@ index 0000000000000000000000000000000000000000..bd26c3623d3314539609a978270d3ced
|
||||
+ ":node_js2c",
|
||||
+ "deps/cares",
|
||||
+ "deps/histogram",
|
||||
+ "deps/googletest:gtest",
|
||||
+ "deps/llhttp",
|
||||
+ "deps/nghttp2",
|
||||
+ "deps/uvwasi",
|
||||
@@ -413,18 +414,18 @@ index 0000000000000000000000000000000000000000..bd26c3623d3314539609a978270d3ced
|
||||
+}
|
||||
diff --git a/deps/cares/BUILD.gn b/deps/cares/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..367d537c91be1f62e161a41e737a60cb3522b0f5
|
||||
index 0000000000000000000000000000000000000000..8e0aa4b7a858ab432dca9da9ead9fcf44f6009f4
|
||||
--- /dev/null
|
||||
+++ b/deps/cares/BUILD.gn
|
||||
@@ -0,0 +1,133 @@
|
||||
+config("cares_config") {
|
||||
+ include_dirs = [ "include" ]
|
||||
+ include_dirs = [ "include", "src/lib" ]
|
||||
+}
|
||||
+static_library("cares") {
|
||||
+ defines = [ "CARES_STATICLIB" ]
|
||||
+ include_dirs = [
|
||||
+ "include",
|
||||
+ "src",
|
||||
+ "src/lib",
|
||||
+ ]
|
||||
+ public_configs = [ ":cares_config" ]
|
||||
+
|
||||
@@ -437,80 +438,80 @@ index 0000000000000000000000000000000000000000..367d537c91be1f62e161a41e737a60cb
|
||||
+
|
||||
+ sources = [
|
||||
+ "include/ares.h",
|
||||
+ "include/ares_dns.h",
|
||||
+ "include/ares_rules.h",
|
||||
+ "include/ares_version.h",
|
||||
+ "include/nameser.h",
|
||||
+ "src/ares__close_sockets.c",
|
||||
+ "src/ares__get_hostent.c",
|
||||
+ "src/ares__parse_into_addrinfo.c",
|
||||
+ "src/ares__read_line.c",
|
||||
+ "src/ares__readaddrinfo.c",
|
||||
+ "src/ares__sortaddrinfo.c",
|
||||
+ "src/ares__timeval.c",
|
||||
+ "src/ares_android.c",
|
||||
+ "src/ares_cancel.c",
|
||||
+ "src/ares_create_query.c",
|
||||
+ "src/ares_data.c",
|
||||
+ "src/ares_data.h",
|
||||
+ "src/ares_destroy.c",
|
||||
+ "src/ares_dns.h",
|
||||
+ "src/ares_expand_name.c",
|
||||
+ "src/ares_expand_string.c",
|
||||
+ "src/ares_fds.c",
|
||||
+ "src/ares_free_hostent.c",
|
||||
+ "src/ares_free_string.c",
|
||||
+ "src/ares_freeaddrinfo.c",
|
||||
+ "src/ares_getaddrinfo.c",
|
||||
+ "src/ares_getenv.h",
|
||||
+ "src/ares_gethostbyaddr.c",
|
||||
+ "src/ares_gethostbyname.c",
|
||||
+ "src/ares_getnameinfo.c",
|
||||
+ "src/ares_getopt.c",
|
||||
+ "src/ares_getopt.h",
|
||||
+ "src/ares_getsock.c",
|
||||
+ "src/ares_inet_net_pton.h",
|
||||
+ "src/ares_init.c",
|
||||
+ "src/ares_ipv6.h",
|
||||
+ "src/ares_library_init.c",
|
||||
+ "src/ares_library_init.h",
|
||||
+ "src/ares_llist.c",
|
||||
+ "src/ares_llist.h",
|
||||
+ "src/ares_mkquery.c",
|
||||
+ "src/ares_nowarn.c",
|
||||
+ "src/ares_nowarn.h",
|
||||
+ "src/ares_options.c",
|
||||
+ "src/ares_parse_a_reply.c",
|
||||
+ "src/ares_parse_aaaa_reply.c",
|
||||
+ "src/ares_parse_caa_reply.c",
|
||||
+ "src/ares_parse_mx_reply.c",
|
||||
+ "src/ares_parse_naptr_reply.c",
|
||||
+ "src/ares_parse_ns_reply.c",
|
||||
+ "src/ares_parse_ptr_reply.c",
|
||||
+ "src/ares_parse_soa_reply.c",
|
||||
+ "src/ares_parse_srv_reply.c",
|
||||
+ "src/ares_parse_txt_reply.c",
|
||||
+ "src/ares_platform.h",
|
||||
+ "src/ares_private.h",
|
||||
+ "src/ares_process.c",
|
||||
+ "src/ares_query.c",
|
||||
+ "src/ares_search.c",
|
||||
+ "src/ares_send.c",
|
||||
+ "src/ares_setup.h",
|
||||
+ "src/ares_strcasecmp.c",
|
||||
+ "src/ares_strcasecmp.h",
|
||||
+ "src/ares_strdup.c",
|
||||
+ "src/ares_strdup.h",
|
||||
+ "src/ares_strerror.c",
|
||||
+ "src/ares_strsplit.c",
|
||||
+ "src/ares_timeout.c",
|
||||
+ "src/ares_version.c",
|
||||
+ "src/ares_writev.c",
|
||||
+ "src/ares_writev.h",
|
||||
+ "src/bitncmp.c",
|
||||
+ "src/bitncmp.h",
|
||||
+ "src/inet_net_pton.c",
|
||||
+ "src/inet_ntop.c",
|
||||
+ "src/setup_once.h",
|
||||
+ "src/lib/ares_android.c",
|
||||
+ "src/lib/ares_cancel.c",
|
||||
+ "src/lib/ares__close_sockets.c",
|
||||
+ "src/lib/ares_create_query.c",
|
||||
+ "src/lib/ares_data.c",
|
||||
+ "src/lib/ares_data.h",
|
||||
+ "src/lib/ares_destroy.c",
|
||||
+ "src/lib/ares_expand_name.c",
|
||||
+ "src/lib/ares_expand_string.c",
|
||||
+ "src/lib/ares_fds.c",
|
||||
+ "src/lib/ares_free_hostent.c",
|
||||
+ "src/lib/ares_free_string.c",
|
||||
+ "src/lib/ares_freeaddrinfo.c",
|
||||
+ "src/lib/ares_getenv.h",
|
||||
+ "src/lib/ares_getaddrinfo.c",
|
||||
+ "src/lib/ares_gethostbyaddr.c",
|
||||
+ "src/lib/ares_gethostbyname.c",
|
||||
+ "src/lib/ares__get_hostent.c",
|
||||
+ "src/lib/ares_getnameinfo.c",
|
||||
+ "src/lib/ares_getsock.c",
|
||||
+ "src/lib/ares_init.c",
|
||||
+ "src/lib/ares_ipv6.h",
|
||||
+ "src/lib/ares_library_init.c",
|
||||
+ "src/lib/ares_library_init.h",
|
||||
+ "src/lib/ares_llist.c",
|
||||
+ "src/lib/ares_llist.h",
|
||||
+ "src/lib/ares_mkquery.c",
|
||||
+ "src/lib/ares_nameser.h",
|
||||
+ "src/lib/ares_nowarn.c",
|
||||
+ "src/lib/ares_nowarn.h",
|
||||
+ "src/lib/ares_options.c",
|
||||
+ "src/lib/ares__parse_into_addrinfo.c",
|
||||
+ "src/lib/ares_parse_aaaa_reply.c",
|
||||
+ "src/lib/ares_parse_a_reply.c",
|
||||
+ "src/lib/ares_parse_caa_reply.c",
|
||||
+ "src/lib/ares_parse_mx_reply.c",
|
||||
+ "src/lib/ares_parse_naptr_reply.c",
|
||||
+ "src/lib/ares_parse_ns_reply.c",
|
||||
+ "src/lib/ares_parse_ptr_reply.c",
|
||||
+ "src/lib/ares_parse_soa_reply.c",
|
||||
+ "src/lib/ares_parse_srv_reply.c",
|
||||
+ "src/lib/ares_parse_txt_reply.c",
|
||||
+ "src/lib/ares_platform.h",
|
||||
+ "src/lib/ares_private.h",
|
||||
+ "src/lib/ares_process.c",
|
||||
+ "src/lib/ares_query.c",
|
||||
+ "src/lib/ares__read_line.c",
|
||||
+ "src/lib/ares__readaddrinfo.c",
|
||||
+ "src/lib/ares_search.c",
|
||||
+ "src/lib/ares_send.c",
|
||||
+ "src/lib/ares_setup.h",
|
||||
+ "src/lib/ares__sortaddrinfo.c",
|
||||
+ "src/lib/ares_strcasecmp.c",
|
||||
+ "src/lib/ares_strcasecmp.h",
|
||||
+ "src/lib/ares_strdup.c",
|
||||
+ "src/lib/ares_strdup.h",
|
||||
+ "src/lib/ares_strerror.c",
|
||||
+ "src/lib/ares_strsplit.c",
|
||||
+ "src/lib/ares_timeout.c",
|
||||
+ "src/lib/ares__timeval.c",
|
||||
+ "src/lib/ares_version.c",
|
||||
+ "src/lib/ares_writev.c",
|
||||
+ "src/lib/ares_writev.h",
|
||||
+ "src/lib/bitncmp.c",
|
||||
+ "src/lib/bitncmp.h",
|
||||
+ "src/lib/inet_net_pton.c",
|
||||
+ "src/lib/inet_ntop.c",
|
||||
+ "src/lib/ares_inet_net_pton.h",
|
||||
+ "src/lib/setup_once.h",
|
||||
+ "src/tools/ares_getopt.c",
|
||||
+ "src/tools/ares_getopt.h",
|
||||
+ ]
|
||||
+
|
||||
+ if (!is_win) {
|
||||
@@ -526,11 +527,11 @@ index 0000000000000000000000000000000000000000..367d537c91be1f62e161a41e737a60cb
|
||||
+ defines += [ "CARES_PULL_WS2TCPIP_H=1" ]
|
||||
+ include_dirs += [ "config/win32" ]
|
||||
+ sources += [
|
||||
+ "src/ares_getenv.c",
|
||||
+ "src/ares_iphlpapi.h",
|
||||
+ "src/ares_platform.c",
|
||||
+ "src/config-win32.h",
|
||||
+ "src/windows_port.c",
|
||||
+ "src/lib/ares_getenv.c",
|
||||
+ "src/lib/ares_iphlpapi.h",
|
||||
+ "src/lib/ares_platform.c",
|
||||
+ "src/lib/config-win32.h",
|
||||
+ "src/lib/windows_port.c",
|
||||
+ ]
|
||||
+ libs += [
|
||||
+ "ws2_32.lib",
|
||||
@@ -550,18 +551,89 @@ index 0000000000000000000000000000000000000000..367d537c91be1f62e161a41e737a60cb
|
||||
+ sources += [ "config/darwin/ares_config.h" ]
|
||||
+ }
|
||||
+}
|
||||
diff --git a/deps/googletest/BUILD.gn b/deps/googletest/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..34c4289eb35af910a470db6ef40abc91954ed848
|
||||
--- /dev/null
|
||||
+++ b/deps/googletest/BUILD.gn
|
||||
@@ -0,0 +1,63 @@
|
||||
+config("gtest_config") {
|
||||
+ include_dirs = [ "include" ]
|
||||
+ defines = [ "UNIT_TEST" ]
|
||||
+}
|
||||
+
|
||||
+static_library("gtest") {
|
||||
+ include_dirs = [
|
||||
+ "include",
|
||||
+ "." # src
|
||||
+ ]
|
||||
+
|
||||
+ public_configs = [ ":gtest_config" ]
|
||||
+
|
||||
+ cflags_cc = [
|
||||
+ "-Wno-c++98-compat-extra-semi",
|
||||
+ "-Wno-unused-const-variable"
|
||||
+ ]
|
||||
+
|
||||
+ defines = [
|
||||
+ "GTEST_HAS_POSIX_RE=0",
|
||||
+ "GTEST_LANG_CXX11=1",
|
||||
+ ]
|
||||
+
|
||||
+ sources = [
|
||||
+ "include/gtest/gtest_pred_impl.h",
|
||||
+ "include/gtest/gtest_prod.h",
|
||||
+ "include/gtest/gtest-death-test.h",
|
||||
+ "include/gtest/gtest-matchers.h",
|
||||
+ "include/gtest/gtest-message.h",
|
||||
+ "include/gtest/gtest-param-test.h",
|
||||
+ "include/gtest/gtest-printers.h",
|
||||
+ "include/gtest/gtest-spi.h",
|
||||
+ "include/gtest/gtest-test-part.h",
|
||||
+ "include/gtest/gtest-typed-test.h",
|
||||
+ "include/gtest/gtest.h",
|
||||
+ "include/gtest/internal/gtest-death-test-internal.h",
|
||||
+ "include/gtest/internal/gtest-filepath.h",
|
||||
+ "include/gtest/internal/gtest-internal.h",
|
||||
+ "include/gtest/internal/gtest-param-util.h",
|
||||
+ "include/gtest/internal/gtest-port-arch.h",
|
||||
+ "include/gtest/internal/gtest-port.h",
|
||||
+ "include/gtest/internal/gtest-string.h",
|
||||
+ "include/gtest/internal/gtest-type-util.h",
|
||||
+ "include/gtest/internal/custom/gtest-port.h",
|
||||
+ "include/gtest/internal/custom/gtest-printers.h",
|
||||
+ "include/gtest/internal/custom/gtest.h",
|
||||
+ "src/gtest-all.cc",
|
||||
+ "src/gtest-death-test.cc",
|
||||
+ "src/gtest-filepath.cc",
|
||||
+ "src/gtest-internal-inl.h",
|
||||
+ "src/gtest-matchers.cc",
|
||||
+ "src/gtest-port.cc",
|
||||
+ "src/gtest-printers.cc",
|
||||
+ "src/gtest-test-part.cc",
|
||||
+ "src/gtest-typed-test.cc",
|
||||
+ "src/gtest.cc",
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
+static_library("gtest_main") {
|
||||
+ deps = [ ":gtest" ]
|
||||
+ sources = [ "src/gtest_main.cc" ]
|
||||
+}
|
||||
diff --git a/deps/histogram/BUILD.gn b/deps/histogram/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e741a2a9c238a782a674ddcb9a1f98de5b36db79
|
||||
index 0000000000000000000000000000000000000000..8ba89a379fa2937b4b2fa5092f18727c7d0788a6
|
||||
--- /dev/null
|
||||
+++ b/deps/histogram/BUILD.gn
|
||||
@@ -0,0 +1,17 @@
|
||||
@@ -0,0 +1,19 @@
|
||||
+config("histogram_config") {
|
||||
+ include_dirs = [ "src" ]
|
||||
+
|
||||
+ cflags = [
|
||||
+ "-Wno-implicit-function-declaration",
|
||||
+ "-Wno-incompatible-pointer-types",
|
||||
+ "-Wno-unused-function",
|
||||
+ "-Wno-atomic-alignment",
|
||||
+ ]
|
||||
+}
|
||||
+
|
||||
@@ -650,10 +722,10 @@ index 0000000000000000000000000000000000000000..58eb2f87990d2cbad711aa39f2a73b20
|
||||
+}
|
||||
diff --git a/deps/uv/BUILD.gn b/deps/uv/BUILD.gn
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6f30ab169f24e2d8b1c4ec4e927451d82194018c
|
||||
index 0000000000000000000000000000000000000000..11a65c2334acc653614577fa1f95791dad72e9e3
|
||||
--- /dev/null
|
||||
+++ b/deps/uv/BUILD.gn
|
||||
@@ -0,0 +1,192 @@
|
||||
@@ -0,0 +1,193 @@
|
||||
+config("libuv_config") {
|
||||
+ include_dirs = [ "include" ]
|
||||
+
|
||||
@@ -826,6 +898,7 @@ index 0000000000000000000000000000000000000000..6f30ab169f24e2d8b1c4ec4e927451d8
|
||||
+ if (is_linux) {
|
||||
+ defines += [ "_GNU_SOURCE" ]
|
||||
+ sources += [
|
||||
+ "src/unix/epoll.c",
|
||||
+ "src/unix/linux-core.c",
|
||||
+ "src/unix/linux-inotify.c",
|
||||
+ "src/unix/linux-syscalls.c",
|
||||
@@ -892,10 +965,10 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636
|
||||
+}
|
||||
diff --git a/filenames.json b/filenames.json
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6ce2f7899ffc39e145a767685a51597fa4473e50
|
||||
index 0000000000000000000000000000000000000000..4f5588c17cf9720dab05a82ee64ba56b1860ab78
|
||||
--- /dev/null
|
||||
+++ b/filenames.json
|
||||
@@ -0,0 +1,544 @@
|
||||
@@ -0,0 +1,548 @@
|
||||
+// This file is automatically generated by generate_gn_filenames_json.py
|
||||
+// DO NOT EDIT
|
||||
+{
|
||||
@@ -913,12 +986,6 @@ index 0000000000000000000000000000000000000000..6ce2f7899ffc39e145a767685a51597f
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "dest_dir": "include/node//cppgc/",
|
||||
+ "files": [
|
||||
+ "//v8/include/cppgc/common.h"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "dest_dir": "include/node//",
|
||||
+ "files": [
|
||||
+ "//v8/include/v8-internal.h",
|
||||
@@ -938,6 +1005,18 @@ index 0000000000000000000000000000000000000000..6ce2f7899ffc39e145a767685a51597f
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "dest_dir": "include/node//cppgc/",
|
||||
+ "files": [
|
||||
+ "//v8/include/cppgc/common.h"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "dest_dir": "include/node//",
|
||||
+ "files": [
|
||||
+ "deps/uv/include/uv.h"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "dest_dir": "include/node//uv/",
|
||||
+ "files": [
|
||||
+ "deps/uv/include/uv/aix.h",
|
||||
@@ -956,12 +1035,6 @@ index 0000000000000000000000000000000000000000..6ce2f7899ffc39e145a767685a51597f
|
||||
+ "deps/uv/include/uv/version.h",
|
||||
+ "deps/uv/include/uv/win.h"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "dest_dir": "include/node//",
|
||||
+ "files": [
|
||||
+ "deps/uv/include/uv.h"
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "library_files": [
|
||||
@@ -1025,6 +1098,7 @@ index 0000000000000000000000000000000000000000..6ce2f7899ffc39e145a767685a51597f
|
||||
+ "lib/timers/promises.js",
|
||||
+ "lib/path/win32.js",
|
||||
+ "lib/path/posix.js",
|
||||
+ "lib/stream/consumers.js",
|
||||
+ "lib/stream/promises.js",
|
||||
+ "lib/stream/web.js",
|
||||
+ "lib/internal/constants.js",
|
||||
@@ -1100,6 +1174,7 @@ index 0000000000000000000000000000000000000000..6ce2f7899ffc39e145a767685a51597f
|
||||
+ "lib/internal/webstreams/writablestream.js",
|
||||
+ "lib/internal/webstreams/readablestream.js",
|
||||
+ "lib/internal/webstreams/queuingstrategies.js",
|
||||
+ "lib/internal/webstreams/encoding.js",
|
||||
+ "lib/internal/webstreams/transformstream.js",
|
||||
+ "lib/internal/webstreams/transfer.js",
|
||||
+ "lib/internal/bootstrap/loaders.js",
|
||||
@@ -1155,7 +1230,7 @@ index 0000000000000000000000000000000000000000..6ce2f7899ffc39e145a767685a51597f
|
||||
+ "lib/internal/child_process/serialization.js",
|
||||
+ "lib/internal/debugger/inspect_repl.js",
|
||||
+ "lib/internal/debugger/inspect_client.js",
|
||||
+ "lib/internal/debugger/_inspect.js",
|
||||
+ "lib/internal/debugger/inspect.js",
|
||||
+ "lib/internal/worker/io.js",
|
||||
+ "lib/internal/worker/js_transferable.js",
|
||||
+ "lib/internal/main/repl.js",
|
||||
@@ -1193,6 +1268,8 @@ index 0000000000000000000000000000000000000000..6ce2f7899ffc39e145a767685a51597f
|
||||
+ "lib/internal/fs/dir.js",
|
||||
+ "lib/internal/fs/streams.js",
|
||||
+ "lib/internal/fs/utils.js",
|
||||
+ "lib/internal/fs/cp/cp.js",
|
||||
+ "lib/internal/fs/cp/cp-sync.js",
|
||||
+ "lib/internal/perf/nodetiming.js",
|
||||
+ "lib/internal/perf/usertiming.js",
|
||||
+ "lib/internal/perf/performance_entry.js",
|
||||
@@ -1646,7 +1723,7 @@ index 0000000000000000000000000000000000000000..d1d6b51e8c0c5bc6a5d09e217eb30483
|
||||
+ args = rebase_path(inputs + outputs, root_build_dir)
|
||||
+}
|
||||
diff --git a/src/node_version.h b/src/node_version.h
|
||||
index 0523885212d429ee5c4142137524cb127d8adc97..116815364055a01f0c0619f0f22e9a387c2f2e2e 100644
|
||||
index ee1263b8eaaab696b213b308d4aeb01359a289c8..5c4bda9aa24ee8f5db89d20772c28e66d574bcaa 100644
|
||||
--- a/src/node_version.h
|
||||
+++ b/src/node_version.h
|
||||
@@ -89,7 +89,10 @@
|
||||
@@ -1679,7 +1756,7 @@ index 0000000000000000000000000000000000000000..01f62d4ae6e3b9d539444e3dff069f00
|
||||
+ main(sys.argv[1:])
|
||||
diff --git a/tools/generate_gn_filenames_json.py b/tools/generate_gn_filenames_json.py
|
||||
new file mode 100755
|
||||
index 0000000000000000000000000000000000000000..ece315d915f0a7b2c8e823caccba7ffec8420fdf
|
||||
index 0000000000000000000000000000000000000000..8f884a41f57630ac432eb85ebfc9b8bc82cddaca
|
||||
--- /dev/null
|
||||
+++ b/tools/generate_gn_filenames_json.py
|
||||
@@ -0,0 +1,75 @@
|
||||
@@ -1689,16 +1766,17 @@ index 0000000000000000000000000000000000000000..ece315d915f0a7b2c8e823caccba7ffe
|
||||
+import sys
|
||||
+
|
||||
+import install
|
||||
+import subprocess
|
||||
+
|
||||
+from utils import SearchFiles
|
||||
+
|
||||
+def LoadPythonDictionary(path):
|
||||
+ file_string = open(path).read()
|
||||
+ try:
|
||||
+ file_data = eval(file_string, {'__builtins__': None}, None)
|
||||
+ except SyntaxError, e:
|
||||
+ except SyntaxError as e:
|
||||
+ e.filename = path
|
||||
+ raise
|
||||
+ except Exception, e:
|
||||
+ except Exception as e:
|
||||
+ raise Exception("Unexpected error while reading %s: %s" % (path, str(e)))
|
||||
+
|
||||
+ assert isinstance(file_data, dict), "%s does not eval to a dictionary" % path
|
||||
@@ -1732,8 +1810,7 @@ index 0000000000000000000000000000000000000000..ece315d915f0a7b2c8e823caccba7ffe
|
||||
+ files = [f.replace('deps/v8/', '//v8/', 1) for f in files]
|
||||
+ return files
|
||||
+
|
||||
+ cwd = os.path.join(os.getcwd(), 'tools/search_files.py')
|
||||
+ lib_files = subprocess.check_output('{} {} --ext js lib'.format('python3', cwd), shell=True).split()
|
||||
+ lib_files = SearchFiles('lib', 'js')
|
||||
+ out['library_files'] = filter_v8_files(lib_files)
|
||||
+ out['library_files'] += filter_v8_files(node_gyp['variables']['deps_files'])
|
||||
+
|
||||
|
||||
@@ -35,7 +35,7 @@ index b45af42d12ff7df8a9e125e87f51af3456811c23..c84ff7feb07aebf656ada7e37d812d9d
|
||||
async function* watch(filename, options = {}) {
|
||||
const path = toNamespacedPath(getValidatedPath(filename));
|
||||
diff --git a/src/node_native_module.cc b/src/node_native_module.cc
|
||||
index 2642982330e8cff166d10682af3d847105dc5c2e..f5491b416203877b89db69bde44f4ff50901ed8b 100644
|
||||
index c4fd96c75c1862289d9cabccfbc9bfc3a5ee523d..3c9e5498e6b9c62813ef93ca77558ead753ac797 100644
|
||||
--- a/src/node_native_module.cc
|
||||
+++ b/src/node_native_module.cc
|
||||
@@ -20,6 +20,7 @@ NativeModuleLoader NativeModuleLoader::instance_;
|
||||
|
||||
@@ -8,7 +8,7 @@ modules from being used in the renderer process. This should be upstreamed as
|
||||
a customizable error message.
|
||||
|
||||
diff --git a/src/node_binding.cc b/src/node_binding.cc
|
||||
index 3c05e553c8e61456205a1f632c903055650a3fc6..292204024f64e6457f1344db1c74d006b7233c82 100644
|
||||
index 8b8389ae53608afedc9cc0ad2a6c8461b7aa893e..e79ddab7d73c6297ef1dc74b2a0ce469bf49e37c 100644
|
||||
--- a/src/node_binding.cc
|
||||
+++ b/src/node_binding.cc
|
||||
@@ -4,6 +4,7 @@
|
||||
@@ -19,7 +19,7 @@ index 3c05e553c8e61456205a1f632c903055650a3fc6..292204024f64e6457f1344db1c74d006
|
||||
#include "util.h"
|
||||
|
||||
#include <string>
|
||||
@@ -465,7 +466,12 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -466,7 +467,12 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
|
||||
if (mp->nm_context_register_func == nullptr) {
|
||||
if (env->force_context_aware()) {
|
||||
dlib->Close();
|
||||
|
||||
@@ -8,10 +8,10 @@ they use themselves as the entry point. We should try to upstream some form
|
||||
of this.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
|
||||
index c90a19d5eed72a55cb9ee89dd2471a32a30c1377..68a52e1ce1f0a2bf4fc2b19ea735948cf6586e06 100644
|
||||
index 076eb528af016b9143985685bc6d1e7c14fa80e6..40370102a2f0b6e692761626653c232a77810fbc 100644
|
||||
--- a/lib/internal/bootstrap/pre_execution.js
|
||||
+++ b/lib/internal/bootstrap/pre_execution.js
|
||||
@@ -103,10 +103,12 @@ function patchProcessObject(expandArgv1) {
|
||||
@@ -104,10 +104,12 @@ function patchProcessObject(expandArgv1) {
|
||||
if (expandArgv1 && process.argv[1] &&
|
||||
!StringPrototypeStartsWith(process.argv[1], '-')) {
|
||||
// Expand process.argv[1] into a full path.
|
||||
@@ -29,10 +29,10 @@ index c90a19d5eed72a55cb9ee89dd2471a32a30c1377..68a52e1ce1f0a2bf4fc2b19ea735948c
|
||||
|
||||
// TODO(joyeecheung): most of these should be deprecated and removed,
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index afb1eca73a2d91b76d098114de18ad7e29846e5c..01070c214e961d31ac508cfca669df2733abbff6 100644
|
||||
index 40655b66fd2a50dac01f88d38457de4602022381..95147ec8a95761b0654e8403578c2c67191834ad 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -1069,6 +1069,13 @@ Module.prototype._compile = function(content, filename) {
|
||||
@@ -1075,6 +1075,13 @@ Module.prototype._compile = function(content, filename) {
|
||||
if (getOptionValue('--inspect-brk') && process._eval == null) {
|
||||
if (!resolvedArgv) {
|
||||
// We enter the repl if we're not given a filename argument.
|
||||
|
||||
@@ -8,7 +8,7 @@ node modules will have different (wrong) ideas about how v8 structs are laid
|
||||
out in memory on 64-bit machines, and will summarily fail to work.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index 65729132b233dc5801f142f05a00253ac951e66a..e717a0b76513401daee6910502ea580485a20612 100644
|
||||
index df463864778a30b2d2fd769a82ab3c066730b559..ae3f2d69f76f46cbb8cb3f8b32da592160b66009 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
@@ -9,10 +9,10 @@ modules to sandboxed renderers.
|
||||
TODO(codebytere): remove and replace with a public facing API.
|
||||
|
||||
diff --git a/src/node_binding.cc b/src/node_binding.cc
|
||||
index b5e42af79510b690a1687d4d32a2a583704a397f..3c05e553c8e61456205a1f632c903055650a3fc6 100644
|
||||
index 3c9776e655d0e458cdd3ab7c3adafff7de339cc5..8b8389ae53608afedc9cc0ad2a6c8461b7aa893e 100644
|
||||
--- a/src/node_binding.cc
|
||||
+++ b/src/node_binding.cc
|
||||
@@ -607,6 +607,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
@@ -608,6 +608,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
|
||||
args.GetReturnValue().Set(exports);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: feat: add uv_loop watcher_queue code
|
||||
Electron's Node Integration works by listening to Node's backend file descriptor in a separate thread; when an event is ready the backend file descriptor will trigger a new event for it, and the main thread will then iterate the libuv loop. For certain operations (ex. adding a timeout task) the backend file descriptor isn't informed, & as a result the main thread doesn't know it needs to iterate the libuv loop so the timeout task will never execute until something else trigger a new event. This commit should be removed when https://github.com/libuv/libuv/pull/1921 is merged
|
||||
|
||||
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
|
||||
index 1e1fc94bfcc3dca90620d09fab1fe60060e17056..253f23e14d09a8c8d5c51545f71b7f03f064dbd6 100644
|
||||
index 77503bde9f28e4769ae3832fb2117e632e9c9268..49930027bdad013d8fcbc375c534d67cc5201bc7 100644
|
||||
--- a/deps/uv/include/uv.h
|
||||
+++ b/deps/uv/include/uv.h
|
||||
@@ -1789,6 +1789,8 @@ union uv_any_req {
|
||||
@@ -1802,6 +1802,8 @@ union uv_any_req {
|
||||
struct uv_loop_s {
|
||||
/* User data - use this for whatever. */
|
||||
void* data;
|
||||
@@ -19,10 +19,10 @@ index 1e1fc94bfcc3dca90620d09fab1fe60060e17056..253f23e14d09a8c8d5c51545f71b7f03
|
||||
unsigned int active_handles;
|
||||
void* handle_queue[2];
|
||||
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c
|
||||
index 63f268f795f10072fe1c430d1242e3774bf9eea9..2811f063eef7329f87fbe43b28729c6b25f0a75b 100644
|
||||
index 71e9c525c4a77b8b5322e8516c58329100a8d951..a6425294086ff2f1435fdd6866380d3aaaf68200 100644
|
||||
--- a/deps/uv/src/unix/core.c
|
||||
+++ b/deps/uv/src/unix/core.c
|
||||
@@ -897,8 +897,11 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
||||
@@ -906,8 +906,11 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -35,7 +35,7 @@ index 63f268f795f10072fe1c430d1242e3774bf9eea9..2811f063eef7329f87fbe43b28729c6b
|
||||
|
||||
if (loop->watchers[w->fd] == NULL) {
|
||||
loop->watchers[w->fd] = w;
|
||||
@@ -933,8 +936,11 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
||||
@@ -942,8 +945,11 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
|
||||
loop->nfds--;
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ index 63f268f795f10072fe1c430d1242e3774bf9eea9..2811f063eef7329f87fbe43b28729c6b
|
||||
}
|
||||
|
||||
|
||||
@@ -951,6 +957,8 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) {
|
||||
@@ -960,6 +966,8 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) {
|
||||
void uv__io_feed(uv_loop_t* loop, uv__io_t* w) {
|
||||
if (QUEUE_EMPTY(&w->pending_queue))
|
||||
QUEUE_INSERT_TAIL(&loop->pending_queue, &w->pending_queue);
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: feat: initialize asar support
|
||||
This patch initializes asar support in Node.js.
|
||||
|
||||
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
|
||||
index 3b69844dc4ea0c4e17a74ea514c4f0dc390e3a61..c90a19d5eed72a55cb9ee89dd2471a32a30c1377 100644
|
||||
index 0906b35edc5ff38fb7730eba9cebcc0e472fe56c..076eb528af016b9143985685bc6d1e7c14fa80e6 100644
|
||||
--- a/lib/internal/bootstrap/pre_execution.js
|
||||
+++ b/lib/internal/bootstrap/pre_execution.js
|
||||
@@ -75,6 +75,7 @@ function prepareMainThreadExecution(expandArgv1 = false) {
|
||||
@@ -76,6 +76,7 @@ function prepareMainThreadExecution(expandArgv1 = false) {
|
||||
assert(!CJSLoader.hasLoadedAnyUserCJSModule);
|
||||
loadPreloadModules();
|
||||
initializeFrozenIntrinsics();
|
||||
@@ -17,7 +17,7 @@ index 3b69844dc4ea0c4e17a74ea514c4f0dc390e3a61..c90a19d5eed72a55cb9ee89dd2471a32
|
||||
}
|
||||
|
||||
function patchProcessObject(expandArgv1) {
|
||||
@@ -475,6 +476,10 @@ function loadPreloadModules() {
|
||||
@@ -482,6 +483,10 @@ function loadPreloadModules() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Tue, 1 Sep 2020 10:17:37 -0700
|
||||
Subject: fix: -Wincompatible-pointer-types-discards-qualifiers error
|
||||
|
||||
Fixes an 'assigment to 'char *' from 'const char *'' error in libuv.
|
||||
|
||||
This will be upstreamed.
|
||||
|
||||
diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c
|
||||
index a083b5e82c8c4294d45a65ab4d01fa3ceb650cdd..5eaaee3b0c6a5f52e10b5749eae4b21c5c059322 100644
|
||||
--- a/deps/uv/src/win/fs.c
|
||||
+++ b/deps/uv/src/win/fs.c
|
||||
@@ -1237,8 +1237,8 @@ void fs__mktemp(uv_fs_t* req, uv__fs_mktemp_func func) {
|
||||
size_t len;
|
||||
uint64_t v;
|
||||
char* path;
|
||||
-
|
||||
- path = req->path;
|
||||
+
|
||||
+ path = (char*) req->path;
|
||||
len = wcslen(req->file.pathw);
|
||||
ep = req->file.pathw + len;
|
||||
if (len < num_x || wcsncmp(ep - num_x, L"XXXXXX", num_x)) {
|
||||
@@ -7,7 +7,7 @@ common.gypi is a file that's included in the node header bundle, despite
|
||||
the fact that we do not build node with gyp.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index 71862791dae3be5f05fbe00b91df6240473debb1..65729132b233dc5801f142f05a00253ac951e66a 100644
|
||||
index fcd1cebeb560079b8b3b520e85c6c53bd1e779e0..df463864778a30b2d2fd769a82ab3c066730b559 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -81,6 +81,23 @@
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: fix: add v8_enable_reverse_jsargs defines in common.gypi
|
||||
This can be removed once node upgrades V8 and inevitably has to do this exact same thing. Also hi node people if you are looking at this.
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index e717a0b76513401daee6910502ea580485a20612..e7c50b5e46624b537de3ffed51fc21a15b666dc8 100644
|
||||
index ae3f2d69f76f46cbb8cb3f8b32da592160b66009..9e25bbed1802c9531701235c438fe33076c3f326 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -65,6 +65,7 @@
|
||||
@@ -25,7 +25,7 @@ index e717a0b76513401daee6910502ea580485a20612..e7c50b5e46624b537de3ffed51fc21a1
|
||||
##### end V8 defaults #####
|
||||
|
||||
# When building native modules using 'npm install' with the system npm,
|
||||
@@ -381,6 +383,9 @@
|
||||
@@ -384,6 +386,9 @@
|
||||
['v8_enable_pointer_compression == 1 or v8_enable_31bit_smis_on_64bit_arch == 1', {
|
||||
'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'],
|
||||
}],
|
||||
|
||||
@@ -51,10 +51,10 @@ index b3b1ea908253b9240cc37931f34b2a8c8c9fa3ab..dc37298aa0e13bb79030123f38070d02
|
||||
return emit_filehandle_warning_;
|
||||
}
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index e1b89261fcb1e94220424aae2273db9fba010331..45210f074a0ca4d57f9fdc5019e8e82540b28b72 100644
|
||||
index 24b4a48b5f9657cc115aaa50e0f7354534ed5484..0877f5b1fe2db42acf908e0e1085626fc258ef54 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -1199,6 +1199,7 @@ class Environment : public MemoryRetainer {
|
||||
@@ -1198,6 +1198,7 @@ class Environment : public MemoryRetainer {
|
||||
inline bool owns_process_state() const;
|
||||
inline bool owns_inspector() const;
|
||||
inline bool tracks_unmanaged_fds() const;
|
||||
|
||||
@@ -489,12 +489,12 @@ index af2146982c7a3bf7bd7527f44e4b17a3b605026e..f6b91f675cfea367c608892dee078b56
|
||||
// Non-XOF hash functions should accept valid outputLength options as well.
|
||||
assert.strictEqual(crypto.createHash('sha224', { outputLength: 28 })
|
||||
diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js
|
||||
index 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede5658ac1bc0 100644
|
||||
index aa03a0379a291a4632b68d428d4e1875d60166a3..a6862ace1fa73473b406fe4513b9e7a99296d365 100644
|
||||
--- a/test/parallel/test-crypto-key-objects.js
|
||||
+++ b/test/parallel/test-crypto-key-objects.js
|
||||
@@ -310,11 +310,11 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
@@ -307,11 +307,11 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
}, common.hasOpenSSL3 ? {
|
||||
message: 'Failed to read private key',
|
||||
message: 'error:1E08010C:DECODER routines::unsupported',
|
||||
} : {
|
||||
- message: 'error:0909006C:PEM routines:get_name:no start line',
|
||||
- code: 'ERR_OSSL_PEM_NO_START_LINE',
|
||||
@@ -509,7 +509,7 @@ index 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede56
|
||||
});
|
||||
|
||||
// This should not abort either: https://github.com/nodejs/node/issues/29904
|
||||
@@ -337,8 +337,8 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
@@ -334,8 +334,8 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
message: /error:1E08010C:DECODER routines::unsupported/,
|
||||
library: 'DECODER routines'
|
||||
} : {
|
||||
@@ -520,7 +520,7 @@ index 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede56
|
||||
});
|
||||
}
|
||||
|
||||
@@ -352,6 +352,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
@@ -349,6 +349,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
d: 'wVK6M3SMhQh3NK-7GRrSV-BVWQx1FO5pW8hhQeu_NdA',
|
||||
kty: 'OKP'
|
||||
} },
|
||||
@@ -528,7 +528,7 @@ index 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede56
|
||||
{ private: fixtures.readKey('ed448_private.pem', 'ascii'),
|
||||
public: fixtures.readKey('ed448_public.pem', 'ascii'),
|
||||
keyType: 'ed448',
|
||||
@@ -383,6 +384,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
@@ -380,6 +381,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
'S0jlSYJk',
|
||||
kty: 'OKP'
|
||||
} },
|
||||
@@ -536,7 +536,7 @@ index 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede56
|
||||
].forEach((info) => {
|
||||
const keyType = info.keyType;
|
||||
|
||||
@@ -424,7 +426,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
@@ -421,7 +423,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -545,7 +545,7 @@ index 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede56
|
||||
[
|
||||
{ private: fixtures.readKey('ec_p256_private.pem', 'ascii'),
|
||||
public: fixtures.readKey('ec_p256_public.pem', 'ascii'),
|
||||
@@ -517,7 +519,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
@@ -514,7 +516,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -554,16 +554,16 @@ index 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede56
|
||||
{
|
||||
// Reading an encrypted key without a passphrase should fail.
|
||||
assert.throws(() => createPrivateKey(privateDsa), common.hasOpenSSL3 ? {
|
||||
@@ -550,7 +552,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
@@ -546,7 +548,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
}), {
|
||||
message: common.hasOpenSSL3 ?
|
||||
'error:07880109:common libcrypto routines::interrupted or cancelled' :
|
||||
'error:1E08010C:DECODER routines::unsupported' :
|
||||
- /bad decrypt/
|
||||
+ /bad decrypt|BAD_DECRYPT/
|
||||
+ /bad decrypt|error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT/
|
||||
});
|
||||
|
||||
const publicKey = createPublicKey(publicDsa);
|
||||
@@ -573,7 +575,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
@@ -569,7 +571,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
() => privateKey.export({ format: 'jwk' }),
|
||||
{ code: 'ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE' });
|
||||
}
|
||||
@@ -572,7 +572,7 @@ index 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede56
|
||||
{
|
||||
// Test RSA-PSS.
|
||||
{
|
||||
@@ -719,7 +721,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
@@ -715,7 +717,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -582,28 +582,28 @@ index 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede56
|
||||
// Exporting an encrypted private key requires a cipher
|
||||
const privateKey = createPrivateKey(privatePem);
|
||||
diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js
|
||||
index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed989991473 100644
|
||||
index ed5986e6bfd4211a1cc22fa94aaf68fc1013133f..08986a6793a39b275277c8bf188316f669a53c63 100644
|
||||
--- a/test/parallel/test-crypto-keygen.js
|
||||
+++ b/test/parallel/test-crypto-keygen.js
|
||||
@@ -300,6 +300,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -297,6 +297,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
}));
|
||||
}
|
||||
|
||||
+ /*
|
||||
+/*
|
||||
{
|
||||
// Test RSA-PSS.
|
||||
generateKeyPair('rsa-pss', {
|
||||
@@ -342,7 +343,9 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -339,7 +340,9 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
testSignVerify(publicKey, privateKey);
|
||||
}));
|
||||
}
|
||||
+*/
|
||||
|
||||
+ /*
|
||||
+/*
|
||||
{
|
||||
const privateKeyEncoding = {
|
||||
type: 'pkcs8',
|
||||
@@ -412,6 +415,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -409,6 +412,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
});
|
||||
}));
|
||||
}
|
||||
@@ -611,7 +611,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
|
||||
{
|
||||
// Test async elliptic curve key generation, e.g. for ECDSA, with a SEC1
|
||||
@@ -436,6 +440,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -433,6 +437,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
testSignVerify(publicKey, privateKey);
|
||||
}));
|
||||
|
||||
@@ -619,7 +619,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
// Test async elliptic curve key generation, e.g. for ECDSA, with a SEC1
|
||||
// private key with paramEncoding explicit.
|
||||
generateKeyPair('ec', {
|
||||
@@ -457,6 +462,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -454,6 +459,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
|
||||
testSignVerify(publicKey, privateKey);
|
||||
}));
|
||||
@@ -627,7 +627,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
|
||||
// Do the same with an encrypted private key.
|
||||
generateKeyPair('ec', {
|
||||
@@ -492,6 +498,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -489,6 +495,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
testSignVerify(publicKey, { key: privateKey, passphrase: 'secret' });
|
||||
}));
|
||||
|
||||
@@ -635,7 +635,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
// Do the same with an encrypted private key with paramEncoding explicit.
|
||||
generateKeyPair('ec', {
|
||||
namedCurve: 'prime256v1',
|
||||
@@ -525,6 +532,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -522,6 +529,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
|
||||
testSignVerify(publicKey, { key: privateKey, passphrase: 'secret' });
|
||||
}));
|
||||
@@ -643,7 +643,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
}
|
||||
|
||||
{
|
||||
@@ -566,6 +574,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -562,6 +570,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -651,15 +651,31 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
// Test async elliptic curve key generation, e.g. for ECDSA, with an encrypted
|
||||
// private key with paramEncoding explicit.
|
||||
generateKeyPair('ec', {
|
||||
@@ -603,6 +612,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
passphrase: 'top secret'
|
||||
});
|
||||
}));
|
||||
@@ -686,6 +695,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
}
|
||||
}
|
||||
});
|
||||
+ */
|
||||
}
|
||||
|
||||
// Test invalid parameter encoding.
|
||||
@@ -951,6 +961,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -709,6 +719,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
message: "The property 'options.paramEncoding' is invalid. " +
|
||||
"Received 'otherEncoding'"
|
||||
});
|
||||
+ /*
|
||||
assert.throws(() => generateKeyPairSync('dsa', {
|
||||
modulusLength: 4096,
|
||||
publicKeyEncoding: {
|
||||
@@ -722,6 +733,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
code: 'ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE',
|
||||
message: 'Unsupported JWK Key Type.'
|
||||
});
|
||||
+ */
|
||||
assert.throws(() => generateKeyPairSync('ec', {
|
||||
namedCurve: 'secp224r1',
|
||||
publicKeyEncoding: {
|
||||
@@ -1060,6 +1072,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,7 +683,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
// Test DSA parameters.
|
||||
{
|
||||
// Test invalid modulus lengths.
|
||||
@@ -978,6 +989,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -1087,6 +1100,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -675,7 +691,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
|
||||
// Test EC parameters.
|
||||
{
|
||||
@@ -1022,13 +1034,13 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -1131,13 +1145,13 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
}));
|
||||
|
||||
generateKeyPair('ec', {
|
||||
@@ -692,7 +708,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
});
|
||||
}));
|
||||
}
|
||||
@@ -1036,7 +1048,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -1145,7 +1159,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
// Test EdDSA key generation.
|
||||
{
|
||||
if (!/^1\.1\.0/.test(process.versions.openssl)) {
|
||||
@@ -701,7 +717,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
generateKeyPair(keyType, common.mustSucceed((publicKey, privateKey) => {
|
||||
assert.strictEqual(publicKey.type, 'public');
|
||||
assert.strictEqual(publicKey.asymmetricKeyType, keyType);
|
||||
@@ -1050,6 +1062,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -1159,6 +1173,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,7 +725,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
// Test classic Diffie-Hellman key generation.
|
||||
{
|
||||
generateKeyPair('dh', {
|
||||
@@ -1162,6 +1175,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
@@ -1271,6 +1286,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -717,7 +733,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
|
||||
// Test invalid key encoding types.
|
||||
{
|
||||
@@ -1362,6 +1376,7 @@ if (!common.hasOpenSSL3) {
|
||||
@@ -1471,6 +1487,7 @@ if (!common.hasOpenSSL3) {
|
||||
}, common.mustSucceed((publicKey, privateKey) => {
|
||||
assert.strictEqual(publicKey.type, 'public');
|
||||
|
||||
@@ -725,7 +741,7 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
|
||||
for (const passphrase of ['', Buffer.alloc(0)]) {
|
||||
const privateKeyObject = createPrivateKey({
|
||||
passphrase,
|
||||
@@ -1369,6 +1384,7 @@ if (!common.hasOpenSSL3) {
|
||||
@@ -1478,6 +1495,7 @@ if (!common.hasOpenSSL3) {
|
||||
});
|
||||
assert.strictEqual(privateKeyObject.asymmetricKeyType, 'rsa');
|
||||
}
|
||||
@@ -799,10 +815,10 @@ index 1785f5eef3d202976666081d09850ed744d83446..e88227a215ba4f7fa196f7642ae694a5
|
||||
});
|
||||
|
||||
diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js
|
||||
index 567d8650c5a1772ce8d4e0901f41a07918f3f661..979d372a32723a492c85da91ca127da77f9c08e2 100644
|
||||
index 9afcb38616dafd6da1ab7b5843d68f4f796ca9a6..00d3381056a5a40c549f06d74c130149ba4abc8c 100644
|
||||
--- a/test/parallel/test-crypto-rsa-dsa.js
|
||||
+++ b/test/parallel/test-crypto-rsa-dsa.js
|
||||
@@ -31,12 +31,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem');
|
||||
@@ -28,12 +28,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem');
|
||||
const ec = new TextEncoder();
|
||||
|
||||
const openssl1DecryptError = {
|
||||
@@ -820,7 +836,7 @@ index 567d8650c5a1772ce8d4e0901f41a07918f3f661..979d372a32723a492c85da91ca127da7
|
||||
};
|
||||
|
||||
const decryptError = common.hasOpenSSL3 ?
|
||||
@@ -400,7 +399,7 @@ assert.throws(() => {
|
||||
@@ -397,7 +396,7 @@ assert.throws(() => {
|
||||
assert.strictEqual(verify2.verify(publicKey, signature, 'hex'), true);
|
||||
}
|
||||
|
||||
@@ -829,16 +845,16 @@ index 567d8650c5a1772ce8d4e0901f41a07918f3f661..979d372a32723a492c85da91ca127da7
|
||||
//
|
||||
// Test DSA signing and verification
|
||||
//
|
||||
@@ -475,3 +474,4 @@ const input = 'I AM THE WALRUS';
|
||||
@@ -472,3 +471,4 @@ const input = 'I AM THE WALRUS';
|
||||
|
||||
assert.strictEqual(verify.verify(dsaPubPem, signature, 'hex'), true);
|
||||
}
|
||||
+*/
|
||||
diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
|
||||
index 15fa3db4a69f191d0d4458bb01c1d23508f07754..27f7d15103276e68b5c73061d0abd11d52b66c9c 100644
|
||||
index 444135538ccff8a705806941843717be954ed143..fe07bbbf0b18ae4ff344cb972600d5ee3bd8ede3 100644
|
||||
--- a/test/parallel/test-crypto-sign-verify.js
|
||||
+++ b/test/parallel/test-crypto-sign-verify.js
|
||||
@@ -32,6 +32,7 @@ const keySize = 2048;
|
||||
@@ -29,6 +29,7 @@ const keySize = 2048;
|
||||
'instance when called without `new`');
|
||||
}
|
||||
|
||||
@@ -846,7 +862,7 @@ index 15fa3db4a69f191d0d4458bb01c1d23508f07754..27f7d15103276e68b5c73061d0abd11d
|
||||
// Test handling of exceptional conditions
|
||||
{
|
||||
const library = {
|
||||
@@ -72,6 +73,7 @@ const keySize = 2048;
|
||||
@@ -69,6 +70,7 @@ const keySize = 2048;
|
||||
|
||||
delete Object.prototype.opensslErrorStack;
|
||||
}
|
||||
@@ -854,7 +870,7 @@ index 15fa3db4a69f191d0d4458bb01c1d23508f07754..27f7d15103276e68b5c73061d0abd11d
|
||||
|
||||
assert.throws(
|
||||
() => crypto.createVerify('SHA256').verify({
|
||||
@@ -345,15 +347,17 @@ assert.throws(
|
||||
@@ -342,15 +344,17 @@ assert.throws(
|
||||
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING
|
||||
});
|
||||
}, common.hasOpenSSL3 ? {
|
||||
@@ -876,7 +892,7 @@ index 15fa3db4a69f191d0d4458bb01c1d23508f07754..27f7d15103276e68b5c73061d0abd11d
|
||||
});
|
||||
}
|
||||
|
||||
@@ -423,10 +427,12 @@ assert.throws(
|
||||
@@ -420,10 +424,12 @@ assert.throws(
|
||||
public: fixtures.readKey('ed25519_public.pem', 'ascii'),
|
||||
algo: null,
|
||||
sigLen: 64 },
|
||||
@@ -889,7 +905,7 @@ index 15fa3db4a69f191d0d4458bb01c1d23508f07754..27f7d15103276e68b5c73061d0abd11d
|
||||
{ private: fixtures.readKey('rsa_private_2048.pem', 'ascii'),
|
||||
public: fixtures.readKey('rsa_public_2048.pem', 'ascii'),
|
||||
algo: 'sha1',
|
||||
@@ -497,7 +503,7 @@ assert.throws(
|
||||
@@ -494,7 +500,7 @@ assert.throws(
|
||||
|
||||
{
|
||||
const data = Buffer.from('Hello world');
|
||||
@@ -1192,10 +1208,10 @@ index ee48a61f4ac8f5e8e4cec96eb03d75cb1c45f56a..5108bbf7499f29bafffda76f3c5270aa
|
||||
// Test PBKDF2 bit derivation
|
||||
{
|
||||
diff --git a/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js b/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js
|
||||
index e01152c07f294d834f70d94bc105b77ea008c017..177bfdf4702afbbbede15e0ae37c144cfabeae46 100644
|
||||
index 151eebd36c9765df086a020ba42920b2442b1b77..efe97ff2499cba909ac5500d827364fa389a0469 100644
|
||||
--- a/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js
|
||||
+++ b/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js
|
||||
@@ -130,7 +130,7 @@ async function testEncryptionLongPlaintext({ algorithm,
|
||||
@@ -127,7 +127,7 @@ async function testEncryptionLongPlaintext({ algorithm,
|
||||
|
||||
return assert.rejects(
|
||||
subtle.encrypt(algorithm, publicKey, newplaintext), {
|
||||
@@ -1205,10 +1221,10 @@ index e01152c07f294d834f70d94bc105b77ea008c017..177bfdf4702afbbbede15e0ae37c144c
|
||||
}
|
||||
|
||||
diff --git a/test/parallel/test-webcrypto-wrap-unwrap.js b/test/parallel/test-webcrypto-wrap-unwrap.js
|
||||
index 54a5a782a09586ff7e02ab23d8c8ca984106f036..8624d1fcf77254bb256a6f4bbde2ff20e148a02b 100644
|
||||
index 1094845c73e14313860ad476fb7baba2a11b5af4..51972b4b34b191ac59145889dbf2da5c0d407dbe 100644
|
||||
--- a/test/parallel/test-webcrypto-wrap-unwrap.js
|
||||
+++ b/test/parallel/test-webcrypto-wrap-unwrap.js
|
||||
@@ -21,14 +21,15 @@ const kWrappingData = {
|
||||
@@ -18,14 +18,15 @@ const kWrappingData = {
|
||||
wrap: { label: new Uint8Array(8) },
|
||||
pair: true
|
||||
},
|
||||
@@ -1228,7 +1244,7 @@ index 54a5a782a09586ff7e02ab23d8c8ca984106f036..8624d1fcf77254bb256a6f4bbde2ff20
|
||||
pair: false
|
||||
},
|
||||
'AES-GCM': {
|
||||
@@ -45,6 +46,7 @@ const kWrappingData = {
|
||||
@@ -42,6 +43,7 @@ const kWrappingData = {
|
||||
wrap: { },
|
||||
pair: false
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: fix: don't create console window when creating process
|
||||
This commit prevents console windows from being spawned when creating processes to better align with what Windows users expect and should be removed when upgrading to a version that includes https://github.com/nodejs/node/pull/21316
|
||||
|
||||
diff --git a/deps/uv/src/win/process.c b/deps/uv/src/win/process.c
|
||||
index 73543c6ed987ceed517e8d1ce8135c1ad233795d..249336d0a23cf32e25c93d917ffb1626119c624f 100644
|
||||
index 4038fbfd290d1acc91a27ad38e248a2deb06eb68..1ebc0f50e3f0cccb4d8887322b75e61c5284ba2f 100644
|
||||
--- a/deps/uv/src/win/process.c
|
||||
+++ b/deps/uv/src/win/process.c
|
||||
@@ -1098,6 +1098,9 @@ int uv_spawn(uv_loop_t* loop,
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 18 Aug 2021 11:25:39 +0200
|
||||
Subject: fix: _ReadBarrier undefined symbol error on WOA arm64
|
||||
|
||||
The _ReadBarrier compiler intrinsic isn't present on WOA arm64 devices
|
||||
and as such is crashing in CI. This fixes the issue by defining them
|
||||
if they're missing.
|
||||
|
||||
We should upstream or otherwise handle this.
|
||||
|
||||
diff --git a/deps/histogram/src/hdr_atomic.h b/deps/histogram/src/hdr_atomic.h
|
||||
index ae1056a83612af5e370ce12fea82f334fce0c62c..9acc5c2d78d7f3d718e8b0f69e9a5e17d9609835 100644
|
||||
--- a/deps/histogram/src/hdr_atomic.h
|
||||
+++ b/deps/histogram/src/hdr_atomic.h
|
||||
@@ -14,6 +14,13 @@
|
||||
#include <intrin.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
+#if !defined(_ReadBarrier) || !defined(_WriteBarrier)
|
||||
+
|
||||
+#define _ReadBarrier() __asm__ __volatile__("" ::: "memory")
|
||||
+#define _WriteBarrier() __asm__ __volatile__("" ::: "memory")
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
static void __inline * hdr_atomic_load_pointer(void** pointer)
|
||||
{
|
||||
_ReadBarrier();
|
||||
@@ -1,26 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nitish Sakhawalkar <nitsakh@icloud.com>
|
||||
Date: Tue, 26 Mar 2019 11:28:05 -0700
|
||||
Subject: fixme: Comment trace event macro
|
||||
|
||||
This broke the build at some point. Does it still? We should probably remove
|
||||
this patch and find out!
|
||||
|
||||
diff --git a/src/node_internals.h b/src/node_internals.h
|
||||
index 8f7929994f3243fbd58b47374dfcadafb1feda8f..c333dc3464d2a23437fa22659d38dd17b6678112 100644
|
||||
--- a/src/node_internals.h
|
||||
+++ b/src/node_internals.h
|
||||
@@ -386,10 +386,11 @@ class TraceEventScope {
|
||||
TraceEventScope(const char* category,
|
||||
const char* name,
|
||||
void* id) : category_(category), name_(name), id_(id) {
|
||||
- TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(category_, name_, id_);
|
||||
+ // TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(category_, name_, id_);
|
||||
+ (void) category_; (void)name_; (void)id_;
|
||||
}
|
||||
~TraceEventScope() {
|
||||
- TRACE_EVENT_NESTABLE_ASYNC_END0(category_, name_, id_);
|
||||
+ // TRACE_EVENT_NESTABLE_ASYNC_END0(category_, name_, id_);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -8,10 +8,10 @@ load libraries from embedded applications without modifications of
|
||||
node's module code.
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index d969a6449cf545c4bb313450dce3940a47be40a2..51bcfe1a4130e5c95f86daad2b2543f9a6fec0a3 100644
|
||||
index 3f1dac356b81f437503422a8fb69df792db9c523..8258a46076d1d4905298016cb52247e2cf8432c5 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -1222,7 +1222,7 @@ Module._initPaths = function() {
|
||||
@@ -1251,7 +1251,7 @@ Module._initPaths = function() {
|
||||
modulePaths = paths;
|
||||
|
||||
// Clone as a shallow copy, for introspection.
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: Pass all globals through "require"
|
||||
(cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62)
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index 51bcfe1a4130e5c95f86daad2b2543f9a6fec0a3..9a304f05cf4e09038531007efff28c4f57218c1d 100644
|
||||
index 8258a46076d1d4905298016cb52247e2cf8432c5..71059956705d1299a19cc9c940a998d9e9717a21 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -121,6 +121,13 @@ const {
|
||||
@@ -127,6 +127,13 @@ const {
|
||||
CHAR_COLON
|
||||
} = require('internal/constants');
|
||||
|
||||
@@ -23,7 +23,7 @@ index 51bcfe1a4130e5c95f86daad2b2543f9a6fec0a3..9a304f05cf4e09038531007efff28c4f
|
||||
const {
|
||||
isProxy
|
||||
} = require('internal/util/types');
|
||||
@@ -1090,10 +1097,12 @@ Module.prototype._compile = function(content, filename) {
|
||||
@@ -1096,10 +1103,12 @@ Module.prototype._compile = function(content, filename) {
|
||||
if (requireDepth === 0) statCache = new SafeMap();
|
||||
if (inspectorWrapper) {
|
||||
result = inspectorWrapper(compiledWrapper, thisValue, exports,
|
||||
|
||||
@@ -22,10 +22,10 @@ index 58f7396990dddb7dd4cf3d23fcdcc1d48f52623e..ef06d0563fa7452348754418867a56c9
|
||||
const nativeModule = internalBinding('native_module');
|
||||
|
||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
||||
index 9a304f05cf4e09038531007efff28c4f57218c1d..afb1eca73a2d91b76d098114de18ad7e29846e5c 100644
|
||||
index 71059956705d1299a19cc9c940a998d9e9717a21..40655b66fd2a50dac01f88d38457de4602022381 100644
|
||||
--- a/lib/internal/modules/cjs/loader.js
|
||||
+++ b/lib/internal/modules/cjs/loader.js
|
||||
@@ -84,7 +84,7 @@ const fs = require('fs');
|
||||
@@ -86,7 +86,7 @@ const fs = require('fs');
|
||||
const internalFS = require('internal/fs/utils');
|
||||
const path = require('path');
|
||||
const { sep } = path;
|
||||
@@ -34,7 +34,7 @@ index 9a304f05cf4e09038531007efff28c4f57218c1d..afb1eca73a2d91b76d098114de18ad7e
|
||||
const packageJsonReader = require('internal/modules/package_json_reader');
|
||||
const { safeGetenv } = internalBinding('credentials');
|
||||
const {
|
||||
@@ -155,7 +155,7 @@ function stat(filename) {
|
||||
@@ -161,7 +161,7 @@ function stat(filename) {
|
||||
const result = statCache.get(filename);
|
||||
if (result !== undefined) return result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 9 Aug 2021 18:42:15 +0200
|
||||
Subject: repl: fix crash when SharedArrayBuffer disabled
|
||||
|
||||
It's possible for SharedArrayBuffers to be disabled with
|
||||
--no-harmony-sharedarraybuffer so we first need to check that this
|
||||
isn't the case before attempting to use them in the repl or a crash occurs.
|
||||
|
||||
Upstreamed at https://github.com/nodejs/node/pull/39718.
|
||||
|
||||
diff --git a/benchmark/worker/atomics-wait.js b/benchmark/worker/atomics-wait.js
|
||||
index a771b1813731edf4f0dd60f3505799e389f1d876..b9461677e2d7d1df192e752496e62cca837717b5 100644
|
||||
--- a/benchmark/worker/atomics-wait.js
|
||||
+++ b/benchmark/worker/atomics-wait.js
|
||||
@@ -7,6 +7,10 @@ const bench = common.createBenchmark(main, {
|
||||
});
|
||||
|
||||
function main({ n }) {
|
||||
+ if (typeof SharedArrayBuffer === 'undefined') {
|
||||
+ throw new Error('SharedArrayBuffers must be enabled to run this benchmark');
|
||||
+ }
|
||||
+
|
||||
const i32arr = new Int32Array(new SharedArrayBuffer(4));
|
||||
bench.start();
|
||||
for (let i = 0; i < n; i++)
|
||||
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
|
||||
index 71a07a63a3636ab211746004ebab24a0058b08fc..e3ce67987ee3185a93750ebad72beab304c71e3a 100644
|
||||
--- a/lib/internal/main/worker_thread.js
|
||||
+++ b/lib/internal/main/worker_thread.js
|
||||
@@ -9,7 +9,7 @@ const {
|
||||
ArrayPrototypeSplice,
|
||||
ObjectDefineProperty,
|
||||
PromisePrototypeCatch,
|
||||
- globalThis: { Atomics },
|
||||
+ globalThis: { Atomics, SharedArrayBuffer },
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
@@ -142,6 +142,9 @@ port.on('message', (message) => {
|
||||
const originalCwd = process.cwd;
|
||||
|
||||
process.cwd = function() {
|
||||
+ // SharedArrayBuffers can be disabled with --no-harmony-sharedarraybuffer.
|
||||
+ if (typeof SharedArrayBuffer === 'undefined') return originalCwd();
|
||||
+
|
||||
const currentCounter = Atomics.load(cwdCounter, 0);
|
||||
if (currentCounter === lastCounter)
|
||||
return cachedCwd;
|
||||
diff --git a/lib/internal/worker.js b/lib/internal/worker.js
|
||||
index 931bce0c518fc3355a9f94a7760556b6f0b75b96..99baa3e7f747bb3b351cb13c6ed512f2bb88812a 100644
|
||||
--- a/lib/internal/worker.js
|
||||
+++ b/lib/internal/worker.js
|
||||
@@ -92,7 +92,8 @@ let cwdCounter;
|
||||
|
||||
const environmentData = new SafeMap();
|
||||
|
||||
-if (isMainThread) {
|
||||
+// SharedArrayBuffers can be disabled with --no-harmony-sharedarraybuffer.
|
||||
+if (isMainThread && typeof SharedArrayBuffer !== 'undefined') {
|
||||
cwdCounter = new Uint32Array(new SharedArrayBuffer(4));
|
||||
const originalChdir = process.chdir;
|
||||
process.chdir = function(path) {
|
||||
21
patches/node/src_remove_extra_semicolons_outside_fns.patch
Normal file
21
patches/node/src_remove_extra_semicolons_outside_fns.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 18 Aug 2021 18:06:28 +0200
|
||||
Subject: src: remove extra semicolons outside fns
|
||||
|
||||
Fixes several -Wc++98-compat-extra-semi issues.
|
||||
|
||||
Upstreamed at https://github.com/nodejs/node/pull/39800.
|
||||
|
||||
diff --git a/src/node_blob.cc b/src/node_blob.cc
|
||||
index c583d5e0a93791ae5ca42e3a6474790b7a43f824..4643da4c17496c7bc16bcde4b481e17f6f7de185 100644
|
||||
--- a/src/node_blob.cc
|
||||
+++ b/src/node_blob.cc
|
||||
@@ -497,5 +497,5 @@ void Blob::RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
|
||||
} // namespace node
|
||||
|
||||
-NODE_MODULE_CONTEXT_AWARE_INTERNAL(blob, node::Blob::Initialize);
|
||||
-NODE_MODULE_EXTERNAL_REFERENCE(blob, node::Blob::RegisterExternalReferences);
|
||||
+NODE_MODULE_CONTEXT_AWARE_INTERNAL(blob, node::Blob::Initialize)
|
||||
+NODE_MODULE_EXTERNAL_REFERENCE(blob, node::Blob::RegisterExternalReferences)
|
||||
@@ -1,52 +1,23 @@
|
||||
const args = require('minimist')(process.argv.slice(2));
|
||||
const nugget = require('nugget');
|
||||
const request = require('request');
|
||||
const fs = require('fs');
|
||||
const got = require('got');
|
||||
const stream = require('stream');
|
||||
const { promisify } = require('util');
|
||||
|
||||
async function makeRequest (requestOptions, parseResponse) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request(requestOptions, (err, res, body) => {
|
||||
if (!err && res.statusCode >= 200 && res.statusCode < 300) {
|
||||
if (parseResponse) {
|
||||
const build = JSON.parse(body);
|
||||
resolve(build);
|
||||
} else {
|
||||
resolve(body);
|
||||
}
|
||||
} else {
|
||||
if (args.verbose) {
|
||||
console.error('Error occurred while requesting:', requestOptions.url);
|
||||
if (parseResponse) {
|
||||
try {
|
||||
console.log('Error: ', `(status ${res.statusCode})`, err || JSON.parse(res.body), requestOptions);
|
||||
} catch (err) {
|
||||
console.log('Error: ', `(status ${res.statusCode})`, err || res.body, requestOptions);
|
||||
}
|
||||
} else {
|
||||
console.log('Error: ', `(status ${res.statusCode})`, err || res.body, requestOptions);
|
||||
}
|
||||
}
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
const pipeline = promisify(stream.pipeline);
|
||||
|
||||
async function downloadArtifact (name, buildNum, dest) {
|
||||
const circleArtifactUrl = `https://circleci.com/api/v1.1/project/github/electron/electron/${args.buildNum}/artifacts?circle-token=${process.env.CIRCLE_TOKEN}`;
|
||||
const artifacts = await makeRequest({
|
||||
method: 'GET',
|
||||
url: circleArtifactUrl,
|
||||
const responsePromise = got(circleArtifactUrl, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json'
|
||||
}
|
||||
}, true).catch(err => {
|
||||
if (args.verbose) {
|
||||
console.log('Error calling CircleCI:', err);
|
||||
} else {
|
||||
console.error('Error calling CircleCI to get artifact details');
|
||||
}
|
||||
});
|
||||
const [response, artifacts] = await Promise.all([responsePromise, responsePromise.json()]);
|
||||
if (response.statusCode !== 200) {
|
||||
console.error('Could not fetch circleci artifact list, got status code:', response.statusCode);
|
||||
}
|
||||
const artifactToDownload = artifacts.find(artifact => {
|
||||
return (artifact.path === name);
|
||||
});
|
||||
@@ -86,19 +57,10 @@ async function downloadWithRetry (url, directory) {
|
||||
}
|
||||
|
||||
function downloadFile (url, directory) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const nuggetOpts = {
|
||||
dir: directory,
|
||||
quiet: args.verbose
|
||||
};
|
||||
nugget(url, nuggetOpts, (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
return pipeline(
|
||||
got.stream(url),
|
||||
fs.createWriteStream(directory)
|
||||
);
|
||||
}
|
||||
|
||||
if (!args.name || !args.buildNum || !args.dest) {
|
||||
|
||||
@@ -3,7 +3,14 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Fallback to blow away old cache keys
|
||||
const HASH_VERSION = 3;
|
||||
const FALLBACK_HASH_VERSION = 3;
|
||||
|
||||
// Per platform hash versions to bust the cache on different platforms
|
||||
const HASH_VERSIONS = {
|
||||
darwin: 3,
|
||||
win32: 4,
|
||||
linux: 3
|
||||
};
|
||||
|
||||
// Base files to hash
|
||||
const filesToHash = [
|
||||
@@ -28,7 +35,7 @@ addAllFiles(path.resolve(__dirname, '../patches'));
|
||||
|
||||
// Create Hash
|
||||
const hasher = crypto.createHash('SHA256');
|
||||
hasher.update(`HASH_VERSION:${HASH_VERSION}`);
|
||||
hasher.update(`HASH_VERSION:${HASH_VERSIONS[process.platform] || FALLBACK_HASH_VERSION}`);
|
||||
for (const file of filesToHash) {
|
||||
hasher.update(fs.readFileSync(file));
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
"parallel/test-child-process-fork-exec-path",
|
||||
"parallel/test-child-process-stdio-overlapped",
|
||||
"parallel/test-cli-node-print-help",
|
||||
"parallel/test-code-cache",
|
||||
"parallel/test-cluster-bind-privileged-port",
|
||||
"parallel/test-cluster-shared-handle-bind-privileged-port",
|
||||
"parallel/test-code-cache",
|
||||
"parallel/test-crypto-aes-wrap",
|
||||
"parallel/test-crypto-authenticated-stream",
|
||||
"parallel/test-crypto-async-sign-verify",
|
||||
"parallel/test-crypto-authenticated-stream",
|
||||
"parallel/test-crypto-certificate",
|
||||
"parallel/test-crypto-des3-wrap",
|
||||
"parallel/test-crypto-dh-stateless",
|
||||
@@ -145,12 +145,12 @@
|
||||
"parallel/test-webcrypto-derivebits-node-dh",
|
||||
"parallel/test-webcrypto-ed25519-ed448",
|
||||
"parallel/test-webcrypto-encrypt-decrypt",
|
||||
"parallel/test-webcrypto-encrypt-decrypt-rsa",
|
||||
"parallel/test-webcrypto-rsa-pss-params",
|
||||
"parallel/test-webcrypto-x25519-x448",
|
||||
"parallel/test-webcrypto-sign-verify-node-dsa",
|
||||
"parallel/test-webcrypto-keygen",
|
||||
"parallel/test-webcrypto-encrypt-decrypt-aes",
|
||||
"parallel/test-webcrypto-encrypt-decrypt-rsa",
|
||||
"parallel/test-webcrypto-keygen",
|
||||
"parallel/test-webcrypto-rsa-pss-params",
|
||||
"parallel/test-webcrypto-sign-verify-node-dsa",
|
||||
"parallel/test-webcrypto-x25519-x448",
|
||||
"parallel/test-whatwg-encoding-custom-textdecoder",
|
||||
"parallel/test-worker-message-channel",
|
||||
"parallel/test-worker-message-port",
|
||||
@@ -179,5 +179,6 @@
|
||||
"sequential/test-tls-connect",
|
||||
"sequential/test-vm-timeout-rethrow",
|
||||
"sequential/test-worker-prof",
|
||||
"wpt/test-encoding"
|
||||
"wpt/test-encoding",
|
||||
"wpt/test-webcrypto"
|
||||
]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
if (!process.env.CI) require('dotenv-safe').load();
|
||||
|
||||
const assert = require('assert');
|
||||
const request = require('request');
|
||||
const got = require('got');
|
||||
|
||||
const BUILD_APPVEYOR_URL = 'https://ci.appveyor.com/api/builds';
|
||||
const CIRCLECI_PIPELINE_URL = 'https://circleci.com/api/v2/project/gh/electron/electron/pipeline';
|
||||
@@ -35,31 +35,24 @@ const vstsArmJobs = [
|
||||
|
||||
let jobRequestedCount = 0;
|
||||
|
||||
async function makeRequest (requestOptions, parseResponse) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request(requestOptions, (err, res, body) => {
|
||||
if (!err && res.statusCode >= 200 && res.statusCode < 300) {
|
||||
if (parseResponse) {
|
||||
const build = JSON.parse(body);
|
||||
resolve(build);
|
||||
} else {
|
||||
resolve(body);
|
||||
}
|
||||
} else {
|
||||
console.error('Error occurred while requesting:', requestOptions.url);
|
||||
if (parseResponse) {
|
||||
try {
|
||||
console.log('Error: ', `(status ${res.statusCode})`, err || JSON.parse(res.body));
|
||||
} catch (err) {
|
||||
console.log('Error: ', `(status ${res.statusCode})`, res.body);
|
||||
}
|
||||
} else {
|
||||
console.log('Error: ', `(status ${res.statusCode})`, err || res.body);
|
||||
}
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
async function makeRequest ({ auth, url, headers, body, method }) {
|
||||
const clonedHeaders = {
|
||||
...(headers || {})
|
||||
};
|
||||
if (auth && auth.bearer) {
|
||||
clonedHeaders.Authorization = `Bearer ${auth.bearer}`;
|
||||
}
|
||||
const response = await got(url, {
|
||||
headers: clonedHeaders,
|
||||
body,
|
||||
method,
|
||||
auth: auth && (auth.username || auth.password) ? `${auth.username}:${auth.password}` : undefined
|
||||
});
|
||||
if (response.statusCode < 200 || response.statusCode >= 300) {
|
||||
console.error('Error: ', `(status ${response.statusCode})`, response.body);
|
||||
throw new Error(`Unexpected status code ${response.statusCode} from ${url}`);
|
||||
}
|
||||
return JSON.parse(response.body);
|
||||
}
|
||||
|
||||
async function circleCIcall (targetBranch, workflowName, options) {
|
||||
|
||||
43
script/release/get-asset.js
Normal file
43
script/release/get-asset.js
Normal file
@@ -0,0 +1,43 @@
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
const got = require('got');
|
||||
|
||||
const octokit = new Octokit({
|
||||
userAgent: 'electron-asset-fetcher',
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
});
|
||||
|
||||
async function getAssetContents (repo, assetId) {
|
||||
const requestOptions = octokit.repos.getReleaseAsset.endpoint({
|
||||
owner: 'electron',
|
||||
repo,
|
||||
asset_id: assetId,
|
||||
headers: {
|
||||
Accept: 'application/octet-stream'
|
||||
}
|
||||
});
|
||||
|
||||
const { url, headers } = requestOptions;
|
||||
headers.authorization = `token ${process.env.ELECTRON_GITHUB_TOKEN}`;
|
||||
|
||||
const response = await got(url, {
|
||||
followRedirect: false,
|
||||
method: 'HEAD',
|
||||
headers
|
||||
});
|
||||
if (!response.headers.location) {
|
||||
console.error(response.headers, `${response.body}`.slice(0, 300));
|
||||
throw new Error(`cannot find asset[${assetId}], asset download did not redirect`);
|
||||
}
|
||||
|
||||
const fileResponse = await got(response.headers.location);
|
||||
if (fileResponse.statusCode !== 200) {
|
||||
console.error(fileResponse.headers, `${fileResponse.body}`.slice(0, 300));
|
||||
throw new Error(`cannot download asset[${assetId}] from ${response.headers.location}, got status: ${fileResponse.status}`);
|
||||
}
|
||||
|
||||
return fileResponse.body;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAssetContents
|
||||
};
|
||||
@@ -109,9 +109,6 @@ const getPreviousStabilizationBranch = async (current) => {
|
||||
if (newestMatch && semver.lte(semverify(branch), semverify(newestMatch))) {
|
||||
continue;
|
||||
}
|
||||
if ((await getTagsOnBranch(branch)).filter(tag => tagIsStable(tag)).length === 0) {
|
||||
continue;
|
||||
}
|
||||
newestMatch = branch;
|
||||
}
|
||||
return newestMatch;
|
||||
|
||||
@@ -2,12 +2,14 @@ const temp = require('temp');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const childProcess = require('child_process');
|
||||
const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils');
|
||||
const request = require('request');
|
||||
const got = require('got');
|
||||
const semver = require('semver');
|
||||
|
||||
const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils');
|
||||
const rootPackageJson = require('../../package.json');
|
||||
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
const { getAssetContents } = require('./get-asset');
|
||||
const octokit = new Octokit({
|
||||
userAgent: 'electron-npm-publisher',
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
@@ -86,27 +88,41 @@ new Promise((resolve, reject) => {
|
||||
}
|
||||
return release;
|
||||
})
|
||||
.then((release) => {
|
||||
.then(async (release) => {
|
||||
const tsdAsset = release.assets.find((asset) => asset.name === 'electron.d.ts');
|
||||
if (!tsdAsset) {
|
||||
throw new Error(`cannot find electron.d.ts from v${rootPackageJson.version} release assets`);
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
request.get({
|
||||
url: tsdAsset.url,
|
||||
headers: {
|
||||
accept: 'application/octet-stream',
|
||||
'user-agent': 'electron-npm-publisher'
|
||||
}
|
||||
}, (err, response, body) => {
|
||||
if (err || response.statusCode !== 200) {
|
||||
reject(err || new Error('Cannot download electron.d.ts'));
|
||||
} else {
|
||||
fs.writeFileSync(path.join(tempDir, 'electron.d.ts'), body);
|
||||
resolve(release);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const typingsContent = await getAssetContents(
|
||||
rootPackageJson.version.indexOf('nightly') > 0 ? 'nightlies' : 'electron',
|
||||
tsdAsset.id
|
||||
);
|
||||
|
||||
fs.writeFileSync(path.join(tempDir, 'electron.d.ts'), typingsContent);
|
||||
|
||||
return release;
|
||||
})
|
||||
.then(async (release) => {
|
||||
const checksumsAsset = release.assets.find((asset) => asset.name === 'SHASUMS256.txt');
|
||||
if (!checksumsAsset) {
|
||||
throw new Error(`cannot find SHASUMS256.txt from v${rootPackageJson.version} release assets`);
|
||||
}
|
||||
|
||||
const checksumsContent = await getAssetContents(
|
||||
rootPackageJson.version.indexOf('nightly') > 0 ? 'nightlies' : 'electron',
|
||||
checksumsAsset.id
|
||||
);
|
||||
|
||||
const checksumsObject = {};
|
||||
for (const line of checksumsContent.trim().split('\n')) {
|
||||
const [checksum, file] = line.split(' *');
|
||||
checksumsObject[file] = checksum;
|
||||
}
|
||||
|
||||
fs.writeFileSync(path.join(tempDir, 'checksums.json'), JSON.stringify(checksumsObject, null, 2));
|
||||
|
||||
return release;
|
||||
})
|
||||
.then(async (release) => {
|
||||
const currentBranch = await getCurrentBranch();
|
||||
@@ -150,10 +166,26 @@ new Promise((resolve, reject) => {
|
||||
// test that the package can install electron prebuilt from github release
|
||||
const tarballPath = path.join(tempDir, `${rootPackageJson.name}-${rootPackageJson.version}.tgz`);
|
||||
return new Promise((resolve, reject) => {
|
||||
childProcess.execSync(`npm install ${tarballPath} --force --silent`, {
|
||||
const result = childProcess.spawnSync('npm', ['install', tarballPath, '--force', '--silent'], {
|
||||
env: Object.assign({}, process.env, { electron_config_cache: tempDir }),
|
||||
cwd: tempDir
|
||||
cwd: tempDir,
|
||||
stdio: 'inherit'
|
||||
});
|
||||
if (result.status !== 0) {
|
||||
return reject(new Error(`npm install failed with status ${result.status}`));
|
||||
}
|
||||
try {
|
||||
const electronPath = require(path.resolve(tempDir, 'node_modules', rootPackageJson.name));
|
||||
if (typeof electronPath !== 'string') {
|
||||
return reject(new Error(`path to electron binary (${electronPath}) returned by the ${rootPackageJson.name} module is not a string`));
|
||||
}
|
||||
if (!fs.existsSync(electronPath)) {
|
||||
return reject(new Error(`path to electron binary (${electronPath}) returned by the ${rootPackageJson.name} module does not exist on disk`));
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return reject(new Error(`loading the generated ${rootPackageJson.name} module failed with an error`));
|
||||
}
|
||||
resolve(tarballPath);
|
||||
});
|
||||
})
|
||||
@@ -186,6 +218,6 @@ new Promise((resolve, reject) => {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(`Error: ${err}`);
|
||||
console.error('Error:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@@ -384,7 +384,7 @@ async function verifyDraftGitHubReleaseAssets (release) {
|
||||
console.log('Fetching authenticated GitHub artifact URLs to verify shasums');
|
||||
|
||||
const remoteFilesToHash = await Promise.all(release.assets.map(async asset => {
|
||||
const requestOptions = await octokit.repos.getReleaseAsset.endpoint({
|
||||
const requestOptions = octokit.repos.getReleaseAsset.endpoint({
|
||||
owner: 'electron',
|
||||
repo: targetRepo,
|
||||
asset_id: asset.id,
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#elif defined(OS_LINUX) // defined(OS_WIN)
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include "base/base_switches.h"
|
||||
#include "base/command_line.h"
|
||||
#include "content/public/app/content_main.h"
|
||||
#include "shell/app/electron_main_delegate.h" // NOLINT
|
||||
#else // defined(OS_LINUX)
|
||||
@@ -304,9 +306,14 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
electron::ElectronMainDelegate delegate;
|
||||
content::ContentMainParams params(&delegate);
|
||||
electron::ElectronCommandLine::Init(argc, argv);
|
||||
params.argc = argc;
|
||||
params.argv = const_cast<const char**>(argv);
|
||||
electron::ElectronCommandLine::Init(argc, argv);
|
||||
base::CommandLine::Init(params.argc, params.argv);
|
||||
// TODO(https://crbug.com/1176772): Remove when Chrome Linux is fully migrated
|
||||
// to Crashpad.
|
||||
base::CommandLine::ForCurrentProcess()->AppendSwitch(
|
||||
::switches::kEnableCrashpad);
|
||||
return content::ContentMain(params);
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ int NodeMain(int argc, char* argv[]) {
|
||||
|
||||
env = node::CreateEnvironment(isolate_data, gin_env.context(),
|
||||
result.args, result.exec_args);
|
||||
CHECK_NOT_NULL(env);
|
||||
CHECK_NE(nullptr, env);
|
||||
|
||||
node::IsolateSettings is;
|
||||
node::SetIsolateUpForNode(isolate, is);
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
enum RecordingMode { "record-until-full", "record-continuously", "record-as-much-as-possible", "trace-to-console" };
|
||||
|
||||
dictionary TraceConfig {
|
||||
Recordingmode recording_mode;
|
||||
unsigned long trace_buffer_size_in_kb;
|
||||
unsigned long trace_buffer_size_in_events;
|
||||
boolean enable_argument_filter;
|
||||
sequence<DOMString> included_categories;
|
||||
sequence<DOMString> excluded_categories;
|
||||
sequence<unsigned short> included_process_ids;
|
||||
sequence<DOMString> histogram_names;
|
||||
object memory_dump_config;
|
||||
};
|
||||
|
||||
dictionary TraceCategoriesAndOptions {
|
||||
DOMString categoryFilter;
|
||||
DOMString traceOptions;
|
||||
};
|
||||
|
||||
interface ContentTracing {
|
||||
Promise<sequence<DOMString>> getCategories();
|
||||
Promise<void> startRecording(TraceConfig config);
|
||||
Promise<void> startRecording(TraceCategoriesAndOptions categoriesAndOptions);
|
||||
Promise<DOMString> stopRecording(optional DOMString resultFilePath);
|
||||
Promise<TraceBufferUsage> getTraceBufferUsage();
|
||||
};
|
||||
@@ -369,8 +369,7 @@ void BrowserWindow::SetBackgroundColor(const std::string& color_name) {
|
||||
auto* web_preferences =
|
||||
WebContentsPreferences::From(api_web_contents_->web_contents());
|
||||
if (web_preferences) {
|
||||
web_preferences->preference()->SetStringKey(options::kBackgroundColor,
|
||||
color_name);
|
||||
web_preferences->SetBackgroundColor(ParseHexColor(color_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user