mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
329 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8faf8a3535 | ||
|
|
331125d35a | ||
|
|
7316ebde79 | ||
|
|
c3340ad21c | ||
|
|
1e84816c96 | ||
|
|
58c6ea5de8 | ||
|
|
34be80602c | ||
|
|
ce40be475b | ||
|
|
5f7bd36119 | ||
|
|
0f19193afd | ||
|
|
06b3b0ea15 | ||
|
|
32f973b010 | ||
|
|
ad2c2a055b | ||
|
|
3069ef3827 | ||
|
|
d70b1c68fe | ||
|
|
3ba4a35c9c | ||
|
|
2c4c1a3dd9 | ||
|
|
a4d8974556 | ||
|
|
b7d4759c19 | ||
|
|
d6ecc65df3 | ||
|
|
98b67cdb69 | ||
|
|
eb37822e03 | ||
|
|
8751f485c5 | ||
|
|
bfef6a54f0 | ||
|
|
5fd403b571 | ||
|
|
abe8c7168a | ||
|
|
5c32d18248 | ||
|
|
c1da7b5238 | ||
|
|
5b75a4a4be | ||
|
|
57e36afc7e | ||
|
|
a4ea27de36 | ||
|
|
7ba879711a | ||
|
|
f057b0e494 | ||
|
|
fa01a20f9b | ||
|
|
579f7a1899 | ||
|
|
920a82a4de | ||
|
|
b501c40bd6 | ||
|
|
672aa1c67f | ||
|
|
b305784aa3 | ||
|
|
c4efeef92c | ||
|
|
96b41d0930 | ||
|
|
1f652f08f8 | ||
|
|
d12c157242 | ||
|
|
68873fbadb | ||
|
|
526d748b7e | ||
|
|
54109cb04d | ||
|
|
542f30b54b | ||
|
|
07ea340314 | ||
|
|
524d6a5d79 | ||
|
|
a0431e1265 | ||
|
|
647299fa9f | ||
|
|
ee5d52440b | ||
|
|
d4a79bc4c0 | ||
|
|
e37f69c467 | ||
|
|
df6faec72e | ||
|
|
691ddb3f67 | ||
|
|
b4e1b840cd | ||
|
|
6f12b67582 | ||
|
|
33f5fa3c56 | ||
|
|
6f88108132 | ||
|
|
05a7f5f492 | ||
|
|
b878a5ea4c | ||
|
|
8756ff0349 | ||
|
|
20c5a3b9e1 | ||
|
|
ddb62e8d7c | ||
|
|
077e35c576 | ||
|
|
eb63062889 | ||
|
|
cac6db76a0 | ||
|
|
9257c315ac | ||
|
|
031480c3db | ||
|
|
9f9d3e98bf | ||
|
|
ae639186e3 | ||
|
|
6e4690574d | ||
|
|
c83dc5be92 | ||
|
|
63cb360df0 | ||
|
|
b311235165 | ||
|
|
6cd2623a87 | ||
|
|
9aa81de83d | ||
|
|
0f246b6be7 | ||
|
|
5be76fd4ea | ||
|
|
a315283f88 | ||
|
|
b741cbf3d7 | ||
|
|
031c0d6951 | ||
|
|
3639a82915 | ||
|
|
7fe2cad354 | ||
|
|
de2e12343e | ||
|
|
69598ae5c6 | ||
|
|
0f0a7e6b1e | ||
|
|
a0dcb55d6c | ||
|
|
ee35482d97 | ||
|
|
8317553cd4 | ||
|
|
ebf98e8af4 | ||
|
|
cfe350a534 | ||
|
|
854dcb3247 | ||
|
|
882ce295ee | ||
|
|
1ac31e18b7 | ||
|
|
957717e483 | ||
|
|
d1ccfea882 | ||
|
|
232ca04edd | ||
|
|
2888e46b7a | ||
|
|
4464a04f35 | ||
|
|
37baff1e31 | ||
|
|
dde19b0583 | ||
|
|
e2b9cd7b7c | ||
|
|
ecd398f8bd | ||
|
|
21f544392b | ||
|
|
5c93682a89 | ||
|
|
1db64c9e51 | ||
|
|
3a747eddbb | ||
|
|
51504aee64 | ||
|
|
360e8a2eb8 | ||
|
|
4447a63f20 | ||
|
|
ceb3b0cf54 | ||
|
|
89607e647d | ||
|
|
c8e2a6261e | ||
|
|
e9814e016b | ||
|
|
dc9654c03c | ||
|
|
fce3426675 | ||
|
|
637cf8a02b | ||
|
|
daab432fb6 | ||
|
|
50dac1d908 | ||
|
|
d4f915e428 | ||
|
|
72bccd1305 | ||
|
|
9439388b7b | ||
|
|
b0fee4b067 | ||
|
|
7c33fc0c5c | ||
|
|
f263a3f755 | ||
|
|
1af3a71fdb | ||
|
|
9f2371fc4e | ||
|
|
f658c1aeb4 | ||
|
|
c196121467 | ||
|
|
133ac9a323 | ||
|
|
a326408bce | ||
|
|
2085111c43 | ||
|
|
7ae8d54265 | ||
|
|
c5574c8667 | ||
|
|
6cf8abc3b3 | ||
|
|
46a4864b08 | ||
|
|
7956b45323 | ||
|
|
63bcbd4ff5 | ||
|
|
3b5ca91a40 | ||
|
|
80282ba972 | ||
|
|
7ddb3dd184 | ||
|
|
0cee5cc1c1 | ||
|
|
048d770a0e | ||
|
|
b3fdb242f0 | ||
|
|
38d908ee6a | ||
|
|
416b850dd2 | ||
|
|
714e068cba | ||
|
|
0a0689587a | ||
|
|
83c4633b21 | ||
|
|
a33063c8a7 | ||
|
|
c478d45713 | ||
|
|
74686a9cb3 | ||
|
|
473a90f99f | ||
|
|
15e9f22fda | ||
|
|
ee44155f7a | ||
|
|
bf64b34475 | ||
|
|
26dbd2218e | ||
|
|
38e46abf0b | ||
|
|
67f7bf4a23 | ||
|
|
02f040c765 | ||
|
|
9b841e4594 | ||
|
|
a40957f2bc | ||
|
|
a6121f527c | ||
|
|
71a31d553f | ||
|
|
1a309fd55f | ||
|
|
73527e54c5 | ||
|
|
2ef0827767 | ||
|
|
76bcab07e6 | ||
|
|
5a5b6abd2c | ||
|
|
4ce5a48076 | ||
|
|
7b61e6044a | ||
|
|
048f06c7f5 | ||
|
|
06868c938f | ||
|
|
22e8fc6379 | ||
|
|
427c139eff | ||
|
|
6a881520ee | ||
|
|
5a2c451c0b | ||
|
|
f47fbccf1a | ||
|
|
eb419946ad | ||
|
|
1b204a4369 | ||
|
|
ee2de310f5 | ||
|
|
e81aa83a14 | ||
|
|
96cae44f32 | ||
|
|
757e7a91a9 | ||
|
|
6faef05095 | ||
|
|
ee65a190fa | ||
|
|
da45f0341a | ||
|
|
c6517c0b7f | ||
|
|
2c92573978 | ||
|
|
fa7326af64 | ||
|
|
aca96553fc | ||
|
|
37592cdaee | ||
|
|
64e48ad0e6 | ||
|
|
68566583f0 | ||
|
|
6a56aa2240 | ||
|
|
7e8c1108e0 | ||
|
|
f5ce5f8218 | ||
|
|
28e44b31ca | ||
|
|
606ca98df0 | ||
|
|
acd2eabdfd | ||
|
|
07972c2892 | ||
|
|
70079d1c8a | ||
|
|
4def69876f | ||
|
|
61a2c7bd16 | ||
|
|
f53262d58f | ||
|
|
8c15619905 | ||
|
|
4a66bed930 | ||
|
|
8dabb3fe33 | ||
|
|
3f88934025 | ||
|
|
296dcc3405 | ||
|
|
5f6de7053a | ||
|
|
6c1eb46f68 | ||
|
|
05cde0d945 | ||
|
|
696c94c08a | ||
|
|
4284691cb3 | ||
|
|
2ab56802cb | ||
|
|
353d12b231 | ||
|
|
cbd734faf9 | ||
|
|
cf282c177f | ||
|
|
e8c8afb1b4 | ||
|
|
dd0d06448c | ||
|
|
3527fdc291 | ||
|
|
a6b9d68897 | ||
|
|
e1e7ec737f | ||
|
|
4fd03f59f4 | ||
|
|
e64e0f00ca | ||
|
|
1bfead2f6b | ||
|
|
c79f1ee720 | ||
|
|
e18c369e4a | ||
|
|
1953ab3bf2 | ||
|
|
d998bf9fed | ||
|
|
40eff3a778 | ||
|
|
9dd089fc56 | ||
|
|
5e2bd0e55f | ||
|
|
95b8be4cc4 | ||
|
|
d48f99fd6e | ||
|
|
3a9b934cc5 | ||
|
|
768f372675 | ||
|
|
9e3f0d5190 | ||
|
|
5a297f409f | ||
|
|
57335cea69 | ||
|
|
3331f51571 | ||
|
|
f122268ca8 | ||
|
|
bfc817fd28 | ||
|
|
2bd83d0e89 | ||
|
|
f29f3418ed | ||
|
|
c87a0077dd | ||
|
|
23c1dcea46 | ||
|
|
41e64d2469 | ||
|
|
5fdc24d3bf | ||
|
|
64dc86c8c2 | ||
|
|
9d1ec6b0eb | ||
|
|
8919480ebc | ||
|
|
bb9e68beee | ||
|
|
88c1f2caf7 | ||
|
|
88375be2b2 | ||
|
|
2aa69505f9 | ||
|
|
e78fe7c8da | ||
|
|
7a7b944c74 | ||
|
|
09f5a2b741 | ||
|
|
cbf50eabd9 | ||
|
|
90a74139c1 | ||
|
|
3a6cc1b786 | ||
|
|
f5fde13b14 | ||
|
|
c6d429d533 | ||
|
|
73df925241 | ||
|
|
269f4ba2bb | ||
|
|
9b304beb54 | ||
|
|
5ffad09e91 | ||
|
|
b694315cd3 | ||
|
|
8566315902 | ||
|
|
cd94ab9de3 | ||
|
|
09ebadaf5b | ||
|
|
990189ab35 | ||
|
|
049e536c5f | ||
|
|
7fe2f25341 | ||
|
|
c79809ddb9 | ||
|
|
b3edf86914 | ||
|
|
7044122f5d | ||
|
|
b7bcce9576 | ||
|
|
2560776888 | ||
|
|
d5d5fef931 | ||
|
|
6b158872fc | ||
|
|
a4ef2d4356 | ||
|
|
14cc902ad8 | ||
|
|
a62a367b9f | ||
|
|
8d67f16512 | ||
|
|
59cb78e9aa | ||
|
|
032552df57 | ||
|
|
1913926ebc | ||
|
|
dc979388ba | ||
|
|
bcabc25b93 | ||
|
|
ab6d22c958 | ||
|
|
806925ee79 | ||
|
|
a46b50fc7b | ||
|
|
517a5915d7 | ||
|
|
1de38af8cc | ||
|
|
66a95db3df | ||
|
|
7b779c6e6a | ||
|
|
429dfd7054 | ||
|
|
03f7a85cfb | ||
|
|
2d2a753dd9 | ||
|
|
028e3889f0 | ||
|
|
47eb123649 | ||
|
|
45ab098079 | ||
|
|
6cfc05ded2 | ||
|
|
40e0e8e499 | ||
|
|
beff8b8b51 | ||
|
|
311723396a | ||
|
|
d39d75321a | ||
|
|
55201d7db6 | ||
|
|
ac46d5b16e | ||
|
|
a1fb069624 | ||
|
|
3aa33dd220 | ||
|
|
9b74d0d54a | ||
|
|
018fc2ca46 | ||
|
|
e286b78df7 | ||
|
|
f77bd19a70 | ||
|
|
cff63d32a0 | ||
|
|
a8e7696674 | ||
|
|
5fc689dc4e | ||
|
|
895bdc0ee0 | ||
|
|
c99f1d317e | ||
|
|
315e3e325d | ||
|
|
8acce4279b | ||
|
|
c8943cdc3c | ||
|
|
f74f009648 |
1747
.circleci/config.yml
1747
.circleci/config.yml
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,3 @@
|
||||
*
|
||||
!tools/xvfb-init.sh
|
||||
!build/install-build-deps.sh
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
APPVEYOR_CLOUD_TOKEN=
|
||||
CIRCLE_TOKEN=
|
||||
ELECTRON_GITHUB_TOKEN=
|
||||
VSTS_TOKEN=
|
||||
@@ -8,19 +8,18 @@
|
||||
"rules": {
|
||||
"semi": ["error", "always"],
|
||||
"no-var": "error",
|
||||
"no-unused-vars": "off",
|
||||
"no-global-assign": "off",
|
||||
"guard-for-in": "error",
|
||||
"no-unused-vars": 0,
|
||||
"no-global-assign": 0,
|
||||
"guard-for-in": 2,
|
||||
"@typescript-eslint/no-unused-vars": ["error", {
|
||||
"vars": "all",
|
||||
"args": "after-used",
|
||||
"ignoreRestSiblings": true
|
||||
"ignoreRestSiblings": false
|
||||
}],
|
||||
"prefer-const": ["error", {
|
||||
"destructuring": "all"
|
||||
}],
|
||||
"standard/no-callback-literal": "off",
|
||||
"node/no-deprecated-api": "off"
|
||||
"node/no-deprecated-api": 0
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
@@ -30,23 +29,7 @@
|
||||
{
|
||||
"files": "*.js",
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": "*.ts",
|
||||
"rules": {
|
||||
"no-undef": "off",
|
||||
"no-redeclare": "off",
|
||||
"@typescript-eslint/no-redeclare": ["error"],
|
||||
"no-use-before-define": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": "*.d.ts",
|
||||
"rules": {
|
||||
"no-useless-constructor": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
10
.gitattributes
vendored
10
.gitattributes
vendored
@@ -2,13 +2,3 @@
|
||||
# files to be checked out with LF endings even if core.autocrlf is true.
|
||||
*.patch text eol=lf
|
||||
patches/**/.patches merge=union
|
||||
|
||||
# Source code and markdown files should always use LF as line ending.
|
||||
*.cc text eol=lf
|
||||
*.mm text eol=lf
|
||||
*.h text eol=lf
|
||||
*.js text eol=lf
|
||||
*.ts text eol=lf
|
||||
*.py text eol=lf
|
||||
*.ps1 text eol=lf
|
||||
*.md text eol=lf
|
||||
|
||||
18
.github/CODEOWNERS
vendored
18
.github/CODEOWNERS
vendored
@@ -3,16 +3,20 @@
|
||||
# https://help.github.com/articles/about-codeowners
|
||||
# https://git-scm.com/docs/gitignore
|
||||
|
||||
# Most stuff in here is owned by the Community & Safety WG...
|
||||
/.github/* @electron/wg-community
|
||||
|
||||
# ...except the Admin WG maintains this file.
|
||||
/.github/CODEOWNERS @electron/wg-admin
|
||||
|
||||
# Upgrades WG
|
||||
/patches/ @electron/wg-upgrades
|
||||
DEPS @electron/wg-upgrades
|
||||
|
||||
# Docs & Tooling WG
|
||||
/default_app/ @electron/wg-docs-tools
|
||||
/docs/ @electron/wg-docs-tools
|
||||
|
||||
# Releases WG
|
||||
/npm/ @electron/wg-releases
|
||||
/script/release @electron/wg-releases
|
||||
|
||||
# Security WG
|
||||
/lib/browser/devtools.ts @electron/wg-security
|
||||
/lib/browser/guest-view-manager.ts @electron/wg-security
|
||||
/lib/browser/guest-window-proxy.ts @electron/wg-security
|
||||
/lib/browser/rpc-server.ts @electron/wg-security
|
||||
/script/release @electron/wg-releases
|
||||
58
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
Normal file
58
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve Electron
|
||||
|
||||
---
|
||||
|
||||
<!-- As an open source project with a dedicated but small maintainer team, it can sometimes take a long time for issues to be addressed so please be patient and we will get back to you as soon as we can.
|
||||
-->
|
||||
|
||||
### Preflight Checklist
|
||||
<!-- Please ensure you've completed the following steps by replacing [ ] with [x]-->
|
||||
|
||||
* [ ] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
|
||||
* [ ] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
|
||||
* [ ] I have searched the issue tracker for an issue that matches the one I want to file, without success.
|
||||
|
||||
### Issue Details
|
||||
|
||||
* **Electron Version:**
|
||||
* <!-- (output of `node_modules/.bin/electron --version`) e.g. 4.0.3 -->
|
||||
* **Operating System:**
|
||||
* <!-- (Platform and Version) e.g. macOS 10.13.6 / Windows 10 (1803) / Ubuntu 18.04 x64 -->
|
||||
* **Last Known Working Electron version:**
|
||||
* <!-- (if applicable) e.g. 3.1.0 -->
|
||||
|
||||
### Expected Behavior
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
### Actual Behavior
|
||||
<!-- A clear and concise description of what actually happened. -->
|
||||
|
||||
### To Reproduce
|
||||
<!--
|
||||
Your best chance of getting this bug looked at quickly is to provide an example.
|
||||
-->
|
||||
|
||||
<!--
|
||||
For bugs that can be encapsulated in a small experiment, you can use Electron Fiddle (https://github.com/electron/fiddle) to publish your example to a GitHub Gist and link it your bug report.
|
||||
-->
|
||||
|
||||
<!--
|
||||
If Fiddle is insufficient to produce an example, please provide an example REPOSITORY that can be cloned and run. You can fork electron-quick-start (https://github.com/electron/electron-quick-start) and include a link to the branch with your changes.
|
||||
-->
|
||||
|
||||
<!--
|
||||
If you provide a URL, please list the commands required to clone/setup/run your repo e.g.
|
||||
```sh
|
||||
$ git clone $YOUR_URL -b $BRANCH
|
||||
$ npm install
|
||||
$ npm start || electron .
|
||||
```
|
||||
-->
|
||||
|
||||
### Screenshots
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
|
||||
### Additional Information
|
||||
<!-- Add any other context about the problem here. -->
|
||||
27
.github/ISSUE_TEMPLATE/Feature_request.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/Feature_request.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for Electron
|
||||
|
||||
---
|
||||
|
||||
<!-- As an open source project with a dedicated but small maintainer team, it can sometimes take a long time for issues to be addressed so please be patient and we will get back to you as soon as we can.
|
||||
-->
|
||||
|
||||
### Preflight Checklist
|
||||
<!-- Please ensure you've completed the following steps by replacing [ ] with [x]-->
|
||||
|
||||
* [ ] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
|
||||
* [ ] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
|
||||
* [ ] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
|
||||
|
||||
### Problem Description
|
||||
<!-- Is your feature request related to a problem? Please add a clear and concise description of what the problem is. -->
|
||||
|
||||
### Proposed Solution
|
||||
<!-- Describe the solution you'd like in a clear and concise manner -->
|
||||
|
||||
### Alternatives Considered
|
||||
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
||||
|
||||
### Additional Information
|
||||
<!-- Add any other context about the problem here. -->
|
||||
77
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
77
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -1,77 +0,0 @@
|
||||
name: Bug Report
|
||||
description: Report an Electron bug
|
||||
title: "[Bug]: "
|
||||
labels: "bug :beetle:"
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Preflight Checklist
|
||||
description: Please ensure you've completed all of the following.
|
||||
options:
|
||||
- label: I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
|
||||
required: true
|
||||
- label: I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
|
||||
required: true
|
||||
- label: I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Electron Version
|
||||
description: What version of Electron are you using?
|
||||
placeholder: 12.0.0
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: What operating system are you using?
|
||||
options:
|
||||
- Windows
|
||||
- macOS
|
||||
- Ubuntu
|
||||
- Other Linux
|
||||
- Other (specify below)
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Operating System Version
|
||||
description: What operating system version are you using? On Windows, click Start button > Settings > System > About. On macOS, click the Apple Menu > About This Mac. On Linux, use lsb_release or uname -a.
|
||||
placeholder: "e.g. Windows 10 version 1909, macOS Catalina 10.15.7, or Ubuntu 20.04"
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: What arch are you using?
|
||||
options:
|
||||
- x64
|
||||
- ia32
|
||||
- arm64 (including Apple Silicon)
|
||||
- Other (specify below)
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Last Known Working Electron version
|
||||
description: What is the last version of Electron this worked in, if applicable?
|
||||
placeholder: 11.0.0
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Actual Behavior
|
||||
description: A clear description of what actually happens.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Testcase Gist URL
|
||||
description: If you can reproduce the issue in a standalone test case, please use [Electron Fiddle](https://github.com/electron/fiddle) to create one and to publish it as a [GitHub gist](https://gist.github.com) and put the gist URL here. This is **the best way** to ensure this issue is triaged quickly.
|
||||
placeholder: https://gist.github.com/...
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Information
|
||||
description: If your problem needs further explanation, or if the issue you're seeing cannot be reproduced in a gist, please add more information here.
|
||||
40
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
40
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@@ -1,40 +0,0 @@
|
||||
name: Feature Request
|
||||
description: Suggest an idea for Electron
|
||||
title: "[Feature Request]: "
|
||||
labels: "enhancement :sparkles:"
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Preflight Checklist
|
||||
description: Please ensure you've completed all of the following.
|
||||
options:
|
||||
- label: I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
|
||||
required: true
|
||||
- label: I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
|
||||
required: true
|
||||
- label: I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Problem Description
|
||||
description: Please add a clear and concise description of the problem you are seeking to solve with this feature request.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Proposed Solution
|
||||
description: Describe the solution you'd like in a clear and concise manner.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Alternatives Considered
|
||||
description: A clear and concise description of any alternative solutions or features you've considered.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Information
|
||||
description: Add any other context about the problem here.
|
||||
validations:
|
||||
required: true
|
||||
25
.github/ISSUE_TEMPLATE/mac_app_store_private_api_rejection.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/mac_app_store_private_api_rejection.md
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
name: Mac App Store Private API Rejection
|
||||
about: Your app was rejected from the Mac App Store for using private API's
|
||||
|
||||
---
|
||||
|
||||
<!-- As an open source project with a dedicated but small maintainer team, it can sometimes take a long time for issues to be addressed so please be patient and we will get back to you as soon as we can.
|
||||
-->
|
||||
|
||||
### Preflight Checklist
|
||||
<!-- Please ensure you've completed the following steps by replacing [ ] with [x]-->
|
||||
|
||||
* [ ] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
|
||||
* [ ] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
|
||||
|
||||
### Issue Details
|
||||
|
||||
* **Electron Version:**
|
||||
* <!-- (output of `node_modules/.bin/electron --version`) e.g. 4.0.3 -->
|
||||
|
||||
### Rejection Email
|
||||
<!-- Paste the contents of your rejection email here, censoring any private information such as app names.-->
|
||||
|
||||
### Additional Information
|
||||
<!-- Add any other context about the problem here. -->
|
||||
@@ -1,30 +0,0 @@
|
||||
name: Report Mac App Store Private API Rejection
|
||||
description: Your app was rejected from the Mac App Store for using private API's
|
||||
title: "[MAS Rejection]: "
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Preflight Checklist
|
||||
description: Please ensure you've completed all of the following.
|
||||
options:
|
||||
- label: I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
|
||||
required: true
|
||||
- label: I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Electron Version
|
||||
description: What version of Electron are you using?
|
||||
placeholder: 12.0.0
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Rejection Email
|
||||
description: Paste the contents of your rejection email here, censoring any private information such as app names.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Information
|
||||
description: Add any other context about the problem here.
|
||||
10
.github/ISSUE_TEMPLATE/security_report.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/security_report.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: Security report
|
||||
about: Do not create an issue for security reports, send an email to security@electronjs.org
|
||||
|
||||
---
|
||||
|
||||
### Notice
|
||||
|
||||
**DO NOT** create an issue for security reports.
|
||||
Send an email to: **security@electronjs.org**.
|
||||
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -13,8 +13,9 @@ Contributors guide: https://github.com/electron/electron/blob/master/CONTRIBUTIN
|
||||
- [ ] `npm test` passes
|
||||
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/master/docs/development/testing.md)
|
||||
- [ ] relevant documentation is changed or added
|
||||
- [ ] PR title follows semantic [commit guidelines](https://github.com/electron/electron/blob/master/docs/development/pull-requests.md#commit-message-guidelines)
|
||||
- [ ] [PR release notes](https://github.com/electron/clerk/blob/master/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/master/README.md#examples).
|
||||
|
||||
#### Release Notes
|
||||
|
||||
Notes: <!-- Please add a one-line description for app developers to read in the release notes, or 'none' if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/master/README.md#examples -->
|
||||
Notes: <!-- Please add a one-line description for app developers to read in the release notes, or `no-notes` if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/master/README.md#examples -->
|
||||
|
||||
2
.github/config.yml
vendored
2
.github/config.yml
vendored
@@ -33,9 +33,7 @@ authorizedUsers:
|
||||
- codebytere
|
||||
- deepak1556
|
||||
- jkleinsc
|
||||
- loc
|
||||
- MarshallOfSound
|
||||
- miniak
|
||||
- mlaurencin
|
||||
- nornagon
|
||||
- zcbenz
|
||||
|
||||
2
.github/semantic.yml
vendored
2
.github/semantic.yml
vendored
@@ -1,2 +0,0 @@
|
||||
# Always validate the PR title, and ignore the commits
|
||||
titleOnly: true
|
||||
26
.gitignore
vendored
26
.gitignore
vendored
@@ -17,6 +17,24 @@
|
||||
*.xcodeproj
|
||||
/.idea/
|
||||
/dist/
|
||||
/external_binaries/
|
||||
/out/
|
||||
/vendor/.gclient
|
||||
/vendor/debian_jessie_mips64-sysroot/
|
||||
/vendor/debian_stretch_amd64-sysroot/
|
||||
/vendor/debian_stretch_arm-sysroot/
|
||||
/vendor/debian_stretch_arm64-sysroot/
|
||||
/vendor/debian_stretch_i386-sysroot/
|
||||
/vendor/gcc-4.8.3-d197-n64-loongson/
|
||||
/vendor/readme-gcc483-loongson.txt
|
||||
/vendor/download/
|
||||
/vendor/llvm-build/
|
||||
/vendor/llvm/
|
||||
/vendor/npm/
|
||||
/vendor/python_26/
|
||||
/vendor/native_mksnapshot
|
||||
/vendor/LICENSES.chromium.html
|
||||
/vendor/pyyaml
|
||||
node_modules/
|
||||
SHASUMS256.txt
|
||||
**/package-lock.json
|
||||
@@ -37,7 +55,7 @@ electron.d.ts
|
||||
spec/.hash
|
||||
|
||||
# Eslint Cache
|
||||
.eslintcache*
|
||||
.eslintcache
|
||||
|
||||
# Generated native addon files
|
||||
/spec-main/fixtures/native-addon/echo/build/
|
||||
@@ -47,9 +65,3 @@ ts-gen
|
||||
|
||||
# Used to accelerate CI builds
|
||||
.depshash
|
||||
.depshash-target
|
||||
|
||||
# Used to accelerate builds after sync
|
||||
patches/mtime-cache.json
|
||||
|
||||
spec/fixtures/logo.png
|
||||
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
[submodule "vendor/requests"]
|
||||
path = vendor/requests
|
||||
url = https://github.com/kennethreitz/requests
|
||||
[submodule "vendor/boto"]
|
||||
path = vendor/boto
|
||||
url = https://github.com/boto/boto.git
|
||||
1
.husky/.gitignore
vendored
1
.husky/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
_
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npm run precommit
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npm run prepack
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"default": false,
|
||||
"no-trailing-spaces": {
|
||||
"br_spaces": 0
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"commands-show-output": false,
|
||||
"first-line-h1": false,
|
||||
"header-increment": false,
|
||||
"line-length": {
|
||||
"code_blocks": false,
|
||||
"tables": false,
|
||||
"stern": true,
|
||||
"line_length": -1
|
||||
},
|
||||
"no-bare-urls": false,
|
||||
"no-blanks-blockquote": false,
|
||||
"no-duplicate-header": {
|
||||
"allow_different_nesting": true
|
||||
},
|
||||
"no-emphasis-as-header": false,
|
||||
"no-hard-tabs": {
|
||||
"code_blocks": false
|
||||
},
|
||||
"no-space-in-emphasis": false,
|
||||
"no-trailing-punctuation": false,
|
||||
"no-trailing-spaces": {
|
||||
"br_spaces": 0
|
||||
},
|
||||
"single-h1": false
|
||||
}
|
||||
@@ -1,135 +1,46 @@
|
||||
# Code of Conduct
|
||||
# Contributor Covenant Code of Conduct:
|
||||
|
||||
As a member project of the OpenJS Foundation, Electron uses [Contributor Covenant v2.0](https://contributor-covenant.org/version/2/0/code_of_conduct) as their code of conduct. The full text is included [below](#contributor-covenant-code-of-conduct) in English, and translations are available from the Contributor Covenant organisation:
|
||||
## Our Pledge
|
||||
|
||||
* [contributor-covenant.org/translations](https://www.contributor-covenant.org/translations)
|
||||
* [github.com/ContributorCovenant](https://github.com/ContributorCovenant/contributor_covenant/tree/release/content/version/2/0)
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Contributor Covenant Code of Conduct
|
||||
## Our Standards
|
||||
|
||||
### Our Pledge
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
### Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
### Enforcement Responsibilities
|
||||
## Our Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
### Scope
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
### Enforcement
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
[coc@electronjs.org](mailto:coc@electronjs.org).
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [coc@electronjs.org](mailto:coc@electronjs.org). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
### Enforcement Guidelines
|
||||
## Attribution
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
This Code of Conduct is adapted from the [Contributor-Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
#### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
#### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
#### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
#### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
### Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
||||
[homepage]: https://contributor-covenant.org
|
||||
[version]: https://contributor-covenant.org/version/1/4/
|
||||
|
||||
@@ -22,14 +22,14 @@ Issues are created [here](https://github.com/electron/electron/issues/new).
|
||||
|
||||
### Issue Closure
|
||||
|
||||
Bug reports will be closed if the issue has been inactive and the latest affected version no longer receives support. At the moment, Electron maintains its three latest major versions, with a new major version being released every 8 weeks. (For more information on Electron's release cadence, see [this blog post](https://electronjs.org/blog/8-week-cadence).)
|
||||
Bug reports will be closed if the issue has been inactive and the latest affected version no longer receives support. At the moment, Electron maintains its three latest major versions, with a new major version being released every 12 weeks. (For more information on Electron's release cadence, see [this blog post](https://electronjs.org/blog/12-week-cadence).)
|
||||
|
||||
_If an issue has been closed and you still feel it's relevant, feel free to ping a maintainer or add a comment!_
|
||||
|
||||
### Languages
|
||||
|
||||
We accept issues in *any* language.
|
||||
When an issue is posted in a language besides English, it is acceptable and encouraged to post an English-translated copy as a reply.
|
||||
When an issue is posted in a language besides English, it is acceptable and encouraged to post an English-translated copy as a reply.
|
||||
Anyone may post the translated reply.
|
||||
In most cases, a quick pass through translation software is sufficient.
|
||||
Having the original text _as well as_ the translation can help mitigate translation errors.
|
||||
@@ -47,17 +47,17 @@ dependencies, and tools contained in the `electron/electron` repository.
|
||||
* [Step 1: Fork](https://electronjs.org/docs/development/pull-requests#step-1-fork)
|
||||
* [Step 2: Build](https://electronjs.org/docs/development/pull-requests#step-2-build)
|
||||
* [Step 3: Branch](https://electronjs.org/docs/development/pull-requests#step-3-branch)
|
||||
* [Making Changes](https://electronjs.org/docs/development/pull-requests#making-changes)
|
||||
* [The Process of Making Changes](https://electronjs.org/docs/development/pull-requests#the-process-of-making-changes)
|
||||
* [Step 4: Code](https://electronjs.org/docs/development/pull-requests#step-4-code)
|
||||
* [Step 5: Commit](https://electronjs.org/docs/development/pull-requests#step-5-commit)
|
||||
* [Commit message guidelines](https://electronjs.org/docs/development/pull-requests#commit-message-guidelines)
|
||||
* [Step 6: Rebase](https://electronjs.org/docs/development/pull-requests#step-6-rebase)
|
||||
* [Step 7: Test](https://electronjs.org/docs/development/pull-requests#step-7-test)
|
||||
* [Step 8: Push](https://electronjs.org/docs/development/pull-requests#step-8-push)
|
||||
* [Step 9: Opening the Pull Request](https://electronjs.org/docs/development/pull-requests#step-9-opening-the-pull-request)
|
||||
* [Step 10: Discuss and Update](https://electronjs.org/docs/development/pull-requests#step-10-discuss-and-update)
|
||||
* [Step 8: Opening the Pull Request](https://electronjs.org/docs/development/pull-requests#step-8-opening-the-pull-request)
|
||||
* [Step 9: Discuss and Update](#step-9-discuss-and-update)
|
||||
* [Approval and Request Changes Workflow](https://electronjs.org/docs/development/pull-requests#approval-and-request-changes-workflow)
|
||||
* [Step 11: Landing](https://electronjs.org/docs/development/pull-requests#step-11-landing)
|
||||
* [Step 10: Landing](https://electronjs.org/docs/development/pull-requests#step-10-landing)
|
||||
* [Continuous Integration Testing](https://electronjs.org/docs/development/pull-requests#continuous-integration-testing)
|
||||
|
||||
## Style Guides
|
||||
@@ -66,5 +66,5 @@ See [Coding Style](https://electronjs.org/docs/development/coding-style) for inf
|
||||
|
||||
## Further Reading
|
||||
|
||||
For more in-depth guides on developing Electron, see
|
||||
For more in-depth guides on developing Electron, see
|
||||
[/docs/development](/docs/development/README.md)
|
||||
|
||||
117
DEPS
117
DEPS
@@ -5,34 +5,28 @@ gclient_gn_args = [
|
||||
'checkout_android_native_support',
|
||||
'checkout_libaom',
|
||||
'checkout_nacl',
|
||||
'checkout_pgo_profiles',
|
||||
'checkout_oculus_sdk',
|
||||
'checkout_openxr',
|
||||
'checkout_google_benchmark',
|
||||
'mac_xcode_version',
|
||||
'generate_location_tags',
|
||||
'checkout_openxr'
|
||||
]
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'93.0.4577.82',
|
||||
'80.0.3987.163',
|
||||
'node_version':
|
||||
'v14.17.0',
|
||||
'v12.13.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
|
||||
# available.
|
||||
'65b32af46e9d7fab2e4ff657751205b3865f4920',
|
||||
'squirrel.mac_version':
|
||||
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',
|
||||
'2ee313aaca52e2b478965ac50eb5082520380d1b',
|
||||
|
||||
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
||||
'pyyaml_version': '3.12',
|
||||
'requests_version': 'e4d59bedfd3c7f4f254f4f5d036587bcd8152458',
|
||||
|
||||
'boto_git': 'https://github.com/boto',
|
||||
'chromium_git': 'https://chromium.googlesource.com',
|
||||
'electron_git': 'https://github.com/electron',
|
||||
'nodejs_git': 'https://github.com/nodejs',
|
||||
'requests_git': 'https://github.com/kennethreitz',
|
||||
'yaml_git': 'https://github.com/yaml',
|
||||
'squirrel_git': 'https://github.com/Squirrel',
|
||||
|
||||
# KEEP IN SYNC WITH utils.js FILE
|
||||
'yarn_version': '1.15.2',
|
||||
@@ -40,27 +34,27 @@ vars = {
|
||||
# To be able to build clean Chromium from sources.
|
||||
'apply_patches': True,
|
||||
|
||||
# To use an mtime cache for patched files to speed up builds.
|
||||
'use_mtime_cache': True,
|
||||
# Python interface to Amazon Web Services. Is used for releases only.
|
||||
'checkout_boto': False,
|
||||
|
||||
# To allow in-house builds to checkout those manually.
|
||||
'checkout_chromium': True,
|
||||
'checkout_node': True,
|
||||
'checkout_nan': True,
|
||||
'checkout_pgo_profiles': True,
|
||||
|
||||
# It's only needed to parse the native tests configurations.
|
||||
'checkout_pyyaml': False,
|
||||
|
||||
'use_rts': False,
|
||||
|
||||
'mac_xcode_version': 'default',
|
||||
|
||||
'generate_location_tags': False,
|
||||
# Python "requests" module is used for releases only.
|
||||
'checkout_requests': False,
|
||||
|
||||
# To allow running hooks without parsing the DEPS tree
|
||||
'process_deps': True,
|
||||
|
||||
# It is always needed for normal Electron builds,
|
||||
# but might be impossible for custom in-house builds.
|
||||
'download_external_binaries': True,
|
||||
|
||||
'checkout_nacl':
|
||||
False,
|
||||
'checkout_libaom':
|
||||
@@ -75,10 +69,6 @@ vars = {
|
||||
False,
|
||||
'checkout_android_native_support':
|
||||
False,
|
||||
'checkout_google_benchmark':
|
||||
False,
|
||||
'checkout_clang_tidy':
|
||||
True,
|
||||
}
|
||||
|
||||
deps = {
|
||||
@@ -94,76 +84,73 @@ deps = {
|
||||
'url': (Var("nodejs_git")) + '/node.git@' + (Var("node_version")),
|
||||
'condition': 'checkout_node and process_deps',
|
||||
},
|
||||
'src/third_party/pyyaml': {
|
||||
'src/electron/vendor/pyyaml': {
|
||||
'url': (Var("yaml_git")) + '/pyyaml.git@' + (Var("pyyaml_version")),
|
||||
'condition': 'checkout_pyyaml and process_deps',
|
||||
},
|
||||
'src/third_party/squirrel.mac': {
|
||||
'url': Var("squirrel_git") + '/Squirrel.Mac.git@' + Var("squirrel.mac_version"),
|
||||
'condition': 'process_deps',
|
||||
'src/electron/vendor/boto': {
|
||||
'url': Var('boto_git') + '/boto.git' + '@' + Var('boto_version'),
|
||||
'condition': 'checkout_boto and process_deps',
|
||||
},
|
||||
'src/third_party/squirrel.mac/vendor/ReactiveObjC': {
|
||||
'url': 'https://github.com/ReactiveCocoa/ReactiveObjC.git@74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76',
|
||||
'condition': 'process_deps'
|
||||
'src/electron/vendor/requests': {
|
||||
'url': Var('requests_git') + '/requests.git' + '@' + Var('requests_version'),
|
||||
'condition': 'checkout_requests and process_deps',
|
||||
},
|
||||
'src/third_party/squirrel.mac/vendor/Mantle': {
|
||||
'url': 'https://github.com/Mantle/Mantle.git@78d3966b3c331292ea29ec38661b25df0a245948',
|
||||
'condition': 'process_deps',
|
||||
}
|
||||
}
|
||||
|
||||
pre_deps_hooks = [
|
||||
{
|
||||
'name': 'generate_mtime_cache',
|
||||
'condition': '(checkout_chromium and apply_patches and use_mtime_cache) and process_deps',
|
||||
'pattern': 'src/electron',
|
||||
'action': [
|
||||
'python3',
|
||||
'src/electron/script/patches-mtime-cache.py',
|
||||
'generate',
|
||||
'--cache-file',
|
||||
'src/electron/patches/mtime-cache.json',
|
||||
'--patches-config',
|
||||
'src/electron/patches/config.json',
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
hooks = [
|
||||
{
|
||||
'name': 'patch_chromium',
|
||||
'condition': '(checkout_chromium and apply_patches) and process_deps',
|
||||
'pattern': 'src/electron',
|
||||
'action': [
|
||||
'python3',
|
||||
'python',
|
||||
'src/electron/script/apply_all_patches.py',
|
||||
'src/electron/patches/config.json',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'apply_mtime_cache',
|
||||
'condition': '(checkout_chromium and apply_patches and use_mtime_cache) and process_deps',
|
||||
'pattern': 'src/electron',
|
||||
'name': 'electron_external_binaries',
|
||||
'pattern': 'src/electron/script/update-external-binaries.py',
|
||||
'condition': 'download_external_binaries',
|
||||
'action': [
|
||||
'python3',
|
||||
'src/electron/script/patches-mtime-cache.py',
|
||||
'apply',
|
||||
'--cache-file',
|
||||
'src/electron/patches/mtime-cache.json',
|
||||
'src/electron/script/update-external-binaries.py',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'electron_npm_deps',
|
||||
'pattern': 'src/electron/package.json',
|
||||
'action': [
|
||||
'python3',
|
||||
'python',
|
||||
'-c',
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python3", "script/lib/npx.py", "yarn@' + (Var("yarn_version")) + '", "install", "--frozen-lockfile"]);',
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npx.py", "yarn@' + (Var("yarn_version")) + '", "install", "--frozen-lockfile"]);',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'setup_boto',
|
||||
'pattern': 'src/electron',
|
||||
'condition': 'checkout_boto and process_deps',
|
||||
'action': [
|
||||
'python',
|
||||
'-c',
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron", "vendor", "boto")); subprocess.check_call(["python", "setup.py", "build"]);',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'setup_requests',
|
||||
'pattern': 'src/electron',
|
||||
'condition': 'checkout_requests and process_deps',
|
||||
'action': [
|
||||
'python',
|
||||
'-c',
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron", "vendor", "requests")); subprocess.check_call(["python", "setup.py", "build"]);',
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
recursedeps = [
|
||||
'src',
|
||||
'src/third_party/squirrel.mac',
|
||||
]
|
||||
|
||||
# Touch DEPS to bust cache
|
||||
|
||||
50
Dockerfile
Normal file
50
Dockerfile
Normal file
@@ -0,0 +1,50 @@
|
||||
FROM ubuntu:18.04
|
||||
|
||||
RUN groupadd --gid 1000 builduser \
|
||||
&& useradd --uid 1000 --gid builduser --shell /bin/bash --create-home builduser
|
||||
|
||||
# Set up TEMP directory
|
||||
ENV TEMP=/tmp
|
||||
RUN chmod a+rwx /tmp
|
||||
|
||||
# Install Linux packages
|
||||
ADD build/install-build-deps.sh /setup/install-build-deps.sh
|
||||
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
|
||||
RUN dpkg --add-architecture i386
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
curl \
|
||||
libnotify-bin \
|
||||
locales \
|
||||
lsb-release \
|
||||
nano \
|
||||
python-dbus \
|
||||
python-pip \
|
||||
python-setuptools \
|
||||
sudo \
|
||||
vim-nox \
|
||||
wget \
|
||||
g++-multilib \
|
||||
libgl1:i386 \
|
||||
&& /setup/install-build-deps.sh --syms --no-prompt --no-chromeos-fonts --lib32 --arm \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Node.js
|
||||
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# crcmod is required by gsutil, which is used for filling the gclient git cache
|
||||
RUN pip install -U crcmod
|
||||
|
||||
# dbusmock is needed for Electron tests
|
||||
RUN pip install python-dbusmock
|
||||
|
||||
RUN mkdir /tmp/workspace
|
||||
RUN chown builduser:builduser /tmp/workspace
|
||||
|
||||
# Add xvfb init script
|
||||
ADD tools/xvfb-init.sh /etc/init.d/xvfb
|
||||
RUN chmod a+x /etc/init.d/xvfb
|
||||
|
||||
USER builduser
|
||||
WORKDIR /home/builduser
|
||||
59
Dockerfile.arm32v7
Normal file
59
Dockerfile.arm32v7
Normal file
@@ -0,0 +1,59 @@
|
||||
FROM arm32v7/ubuntu:18.04
|
||||
|
||||
RUN groupadd --gid 1000 builduser \
|
||||
&& useradd --uid 1000 --gid builduser --shell /bin/bash --create-home builduser
|
||||
|
||||
# Set up TEMP directory
|
||||
ENV TEMP=/tmp
|
||||
RUN chmod a+rwx /tmp
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
bison \
|
||||
build-essential \
|
||||
clang \
|
||||
curl \
|
||||
gperf \
|
||||
git \
|
||||
libasound2 \
|
||||
libasound2-dev \
|
||||
libcap-dev \
|
||||
libcups2-dev \
|
||||
libdbus-1-dev \
|
||||
libgnome-keyring-dev \
|
||||
libgtk2.0-0 \
|
||||
libgtk2.0-dev \
|
||||
libgtk-3-0 \
|
||||
libgtk-3-dev \
|
||||
libnotify-bin \
|
||||
libnss3 \
|
||||
libnss3-dev \
|
||||
libxss1 \
|
||||
libxtst-dev \
|
||||
libxtst6 \
|
||||
lsb-release \
|
||||
locales \
|
||||
nano \
|
||||
python-setuptools \
|
||||
python-pip \
|
||||
python-dbusmock \
|
||||
sudo \
|
||||
unzip \
|
||||
wget \
|
||||
xvfb \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Node.js
|
||||
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# crcmod is required by gsutil, which is used for filling the gclient git cache
|
||||
RUN pip install -U crcmod
|
||||
|
||||
ADD tools/xvfb-init.sh /etc/init.d/xvfb
|
||||
RUN chmod a+x /etc/init.d/xvfb
|
||||
|
||||
RUN usermod -aG sudo builduser
|
||||
RUN echo 'builduser ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||
|
||||
WORKDIR /home/builduser
|
||||
65
Dockerfile.arm64v8
Normal file
65
Dockerfile.arm64v8
Normal file
@@ -0,0 +1,65 @@
|
||||
FROM arm64v8/ubuntu:18.04
|
||||
|
||||
RUN groupadd --gid 1000 builduser \
|
||||
&& useradd --uid 1000 --gid builduser --shell /bin/bash --create-home builduser
|
||||
|
||||
# Set up TEMP directory
|
||||
ENV TEMP=/tmp
|
||||
RUN chmod a+rwx /tmp
|
||||
|
||||
RUN dpkg --add-architecture armhf
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
bison \
|
||||
build-essential \
|
||||
clang \
|
||||
curl \
|
||||
gperf \
|
||||
git \
|
||||
libasound2 \
|
||||
libasound2-dev \
|
||||
libc6:armhf \
|
||||
libcap-dev \
|
||||
libcups2-dev \
|
||||
libdbus-1-dev \
|
||||
libgnome-keyring-dev \
|
||||
libgtk2.0-0 \
|
||||
libgtk2.0-dev \
|
||||
libgtk-3-0 \
|
||||
libgtk-3-dev \
|
||||
libnotify-bin \
|
||||
libnss3 \
|
||||
libnss3-dev \
|
||||
libstdc++6:armhf \
|
||||
libxss1 \
|
||||
libxtst-dev \
|
||||
libxtst6 \
|
||||
lsb-release \
|
||||
locales \
|
||||
nano \
|
||||
python-setuptools \
|
||||
python-pip \
|
||||
sudo \
|
||||
unzip \
|
||||
wget \
|
||||
xvfb \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Node.js
|
||||
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# crcmod is required by gsutil, which is used for filling the gclient git cache
|
||||
RUN pip install -U crcmod
|
||||
|
||||
# dbusmock is needed for Electron tests
|
||||
RUN pip install python-dbusmock
|
||||
|
||||
ADD tools/xvfb-init.sh /etc/init.d/xvfb
|
||||
RUN chmod a+x /etc/init.d/xvfb
|
||||
|
||||
RUN usermod -aG sudo builduser
|
||||
RUN echo 'builduser ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||
|
||||
WORKDIR /home/builduser
|
||||
@@ -1 +1 @@
|
||||
14.0.2
|
||||
8.2.2
|
||||
3
LICENSE
3
LICENSE
@@ -1,5 +1,4 @@
|
||||
Copyright (c) Electron contributors
|
||||
Copyright (c) 2013-2020 GitHub Inc.
|
||||
Copyright (c) 2013-2019 GitHub Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
13
README.md
13
README.md
@@ -1,11 +1,11 @@
|
||||
[](https://electronjs.org)
|
||||
|
||||
|
||||
[](https://circleci.com/gh/electron/electron/tree/master)
|
||||
[](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/master)
|
||||
[](https://david-dm.org/electron/electron?type=dev)
|
||||
[](https://discord.com/invite/electron)
|
||||
|
||||
:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪.
|
||||
:memo: Available Translations: 🇨🇳 🇹🇼 🇧🇷 🇪🇸 🇰🇷 🇯🇵 🇷🇺 🇫🇷 🇹🇭 🇳🇱 🇹🇷 🇮🇩 🇺🇦 🇨🇿 🇮🇹 🇵🇱.
|
||||
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).
|
||||
|
||||
The Electron framework lets you write cross-platform desktop applications
|
||||
@@ -28,13 +28,16 @@ The preferred method is to install Electron as a development dependency in your
|
||||
app:
|
||||
|
||||
```sh
|
||||
npm install electron --save-dev
|
||||
npm install electron --save-dev [--save-exact]
|
||||
```
|
||||
|
||||
For more installation options and troubleshooting tips, see
|
||||
[installation](docs/tutorial/installation.md). For info on how to manage Electron versions in your apps, see
|
||||
The `--save-exact` flag is recommended for Electron prior to version 2, as it does not follow semantic
|
||||
versioning. As of version 2.0.0, Electron follows semver, so you don't need `--save-exact` flag. For info on how to manage Electron versions in your apps, see
|
||||
[Electron versioning](docs/tutorial/electron-versioning.md).
|
||||
|
||||
For more installation options and troubleshooting tips, see
|
||||
[installation](docs/tutorial/installation.md).
|
||||
|
||||
## Quick start & Electron Fiddle
|
||||
|
||||
Use [`Electron Fiddle`](https://github.com/electron/fiddle)
|
||||
|
||||
@@ -6,12 +6,7 @@ To report a security issue, email [security@electronjs.org](mailto:security@elec
|
||||
|
||||
The Electron team will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
|
||||
|
||||
Report security bugs in third-party modules to the person or team maintaining the module. You can also report a vulnerability through the [npm contact form](https://www.npmjs.com/support) by selecting "I'm reporting a security vulnerability".
|
||||
|
||||
## The Electron Security Notification Process
|
||||
|
||||
For context on Electron's security notification process, please see the [Notifications](https://github.com/electron/governance/blob/master/wg-security/membership-and-notifications.md#notifications) section of the Security WG's [Membership and Notifications](https://github.com/electron/governance/blob/master/wg-security/membership-and-notifications.md) Governance document.
|
||||
Report security bugs in third-party modules to the person or team maintaining the module. You can also report a vulnerability through the [Node Security Project](https://nodesecurity.io/report).
|
||||
|
||||
## Learning More About Security
|
||||
|
||||
To learn more about securing an Electron application, please see the [security tutorial](docs/tutorial/security.md).
|
||||
|
||||
119
appveyor.yml
119
appveyor.yml
@@ -1,5 +1,5 @@
|
||||
# The config expects the following environment variables to be set:
|
||||
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
|
||||
# - "GN_CONFIG" Build type. One of {'debug', 'testing', 'release'}.
|
||||
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
|
||||
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
|
||||
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_cpu
|
||||
@@ -28,15 +28,14 @@
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electron-16-core
|
||||
image: vs2019bt-16.6.2
|
||||
build_cloud: libcc-20
|
||||
image: vs2019-16.3-10.0.18362
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
|
||||
GOMA_FALLBACK_ON_AUTH_FAILURE: true
|
||||
notifications:
|
||||
- provider: Webhook
|
||||
url: https://electron-mission-control.herokuapp.com/rest/appveyor-hook
|
||||
@@ -54,9 +53,7 @@ build_script:
|
||||
} else {
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
|
||||
$result = node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||
Write-Output $result
|
||||
if ($result.ExitCode -eq 0) {
|
||||
if ($(node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH;$LASTEXITCODE -eq 0)) {
|
||||
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
|
||||
}
|
||||
}
|
||||
@@ -64,11 +61,13 @@ build_script:
|
||||
- git config --global core.longpaths true
|
||||
- cd ..
|
||||
- mkdir src
|
||||
- update_depot_tools.bat
|
||||
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
|
||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||
- ps: $env:SCCACHE_PATH="$pwd\src\electron\external_binaries\sccache.exe"
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -ne 'release') {
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
$env:GCLIENT_EXTRA_ARGS="$env:GCLIENT_EXTRA_ARGS --custom-var=checkout_boto=True --custom-var=checkout_requests=True"
|
||||
} else {
|
||||
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
|
||||
}
|
||||
- >-
|
||||
@@ -77,96 +76,49 @@ build_script:
|
||||
--unmanaged
|
||||
%GCLIENT_EXTRA_ARGS%
|
||||
"https://github.com/electron/electron"
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
$env:RUN_GCLIENT_SYNC="true"
|
||||
} else {
|
||||
cd src\electron
|
||||
node script\generate-deps-hash.js
|
||||
$depshash = Get-Content .\.depshash -Raw
|
||||
$zipfile = "Z:\$depshash.7z"
|
||||
cd ..\..
|
||||
if (Test-Path -Path $zipfile) {
|
||||
# file exists, unzip and then gclient sync
|
||||
7z x -y $zipfile -mmt=30 -aoa
|
||||
if (-not (Test-Path -Path "src\buildtools")) {
|
||||
# the zip file must be corrupt - resync
|
||||
$env:RUN_GCLIENT_SYNC="true"
|
||||
if ($env:TARGET_ARCH -ne 'ia32') {
|
||||
# only save on x64/woa to avoid contention saving
|
||||
$env:SAVE_GCLIENT_SRC="true"
|
||||
}
|
||||
} else {
|
||||
# update angle
|
||||
cd src\third_party\angle
|
||||
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
|
||||
git fetch
|
||||
cd ..\..\..
|
||||
}
|
||||
} else {
|
||||
# file does not exist, gclient sync, then zip
|
||||
$env:RUN_GCLIENT_SYNC="true"
|
||||
if ($env:TARGET_ARCH -ne 'ia32') {
|
||||
# only save on x64/woa to avoid contention saving
|
||||
$env:SAVE_GCLIENT_SRC="true"
|
||||
}
|
||||
}
|
||||
}
|
||||
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags --ignore_locks)
|
||||
- gclient sync --with_branch_heads --with_tags --ignore_locks --break_repo_locks
|
||||
- ps: >-
|
||||
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
|
||||
# archive current source for future use
|
||||
# only run on x64/woa to avoid contention saving
|
||||
$(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\WebKit\LayoutTests! -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30)
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
if ($(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\WebKit\LayoutTests! -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30;$LASTEXITCODE -ne 0)) {
|
||||
Write-warning "Could not save source to shared drive; continuing anyway"
|
||||
}
|
||||
# build time generation of file gen/angle/angle_commit.h depends on
|
||||
# third_party/angle/.git
|
||||
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
|
||||
$(7z a $zipfile src\third_party\angle\.git)
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-warning "Failed to add third_party\angle\.git; continuing anyway"
|
||||
}
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -ne 'release') {
|
||||
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
||||
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
|
||||
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
|
||||
}
|
||||
git clone https://github.com/electron/build-tools.git
|
||||
cd build-tools
|
||||
npm install
|
||||
mkdir third_party
|
||||
node -e "require('./src/utils/goma.js').downloadAndPrepare()"
|
||||
$env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
|
||||
$env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
|
||||
cd ..
|
||||
.\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
|
||||
}
|
||||
- ps: >-
|
||||
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
||||
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
|
||||
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
|
||||
}
|
||||
- git clone https://github.com/electron/build-tools.git
|
||||
- cd build-tools
|
||||
- npm install
|
||||
- mkdir third_party
|
||||
- ps: >-
|
||||
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
|
||||
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
|
||||
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
|
||||
- cd ..
|
||||
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
|
||||
- cd src
|
||||
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
|
||||
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
|
||||
- if DEFINED GN_GOMA_FILE (gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% ") else (gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") %GN_EXTRA_ARGS% cc_wrapper=\"%SCCACHE_PATH%\"")
|
||||
- gn check out/Default //electron:electron_lib
|
||||
- gn check out/Default //electron:electron_app
|
||||
- gn check out/Default //electron:manifests
|
||||
- gn check out/Default //electron/shell/common/api:mojo
|
||||
- if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
|
||||
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
|
||||
- if "%GN_CONFIG%"=="testing" ( python C:\Users\electron\depot_tools\post_build_ninja_summary.py -C out\Default )
|
||||
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
|
||||
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
||||
- ninja -C out/Default electron:electron_dist_zip
|
||||
- ninja -C out/Default shell_browser_ui_unittests
|
||||
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
||||
- ninja -C out/Default electron:electron_mksnapshot_zip
|
||||
- cd out\Default
|
||||
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
|
||||
- cd ..\..
|
||||
- ninja -C out/Default electron:hunspell_dictionaries_zip
|
||||
- ninja -C out/Default electron:electron_chromedriver_zip
|
||||
- ninja -C out/Default third_party/electron_node:headers
|
||||
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
|
||||
- python electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
||||
- appveyor PushArtifact out/Default/windows_toolchain_profile.json
|
||||
- if "%GN_CONFIG%"=="testing" ( python %LOCAL_GOMA_DIR%\goma_ctl.py stat )
|
||||
- appveyor PushArtifact out/Default/dist.zip
|
||||
- appveyor PushArtifact out/Default/shell_browser_ui_unittests.exe
|
||||
- appveyor PushArtifact out/Default/chromedriver.zip
|
||||
@@ -185,12 +137,12 @@ build_script:
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
python electron\script\zip-symbols.py
|
||||
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
||||
appveyor PushArtifact out/Default/symbols.zip
|
||||
} else {
|
||||
# It's useful to have pdb files when debugging testing builds that are
|
||||
# built on CI.
|
||||
7z a pdb.zip out\Default\*.pdb
|
||||
appveyor-retry appveyor PushArtifact pdb.zip
|
||||
appveyor PushArtifact pdb.zip
|
||||
}
|
||||
- python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
||||
test_script:
|
||||
@@ -208,25 +160,22 @@ test_script:
|
||||
echo "Skipping tests for $env:GN_CONFIG build"
|
||||
}
|
||||
- cd electron
|
||||
# CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
|
||||
- if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --trace-uncaught --enable-logging --disable-features=CalculateNativeWinOcclusion )
|
||||
- if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --ci --enable-logging)
|
||||
- cd ..
|
||||
- if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg )
|
||||
- echo "About to verify mksnapshot"
|
||||
- if "%RUN_TESTS%"=="true" ( echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd% )
|
||||
- echo "Done verifying mksnapshot"
|
||||
- if "%RUN_TESTS%"=="true" ( echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd% )
|
||||
- echo "Done verifying chromedriver"
|
||||
deploy_script:
|
||||
- cd electron
|
||||
- ps: >-
|
||||
if (Test-Path Env:\ELECTRON_RELEASE) {
|
||||
if (Test-Path Env:\UPLOAD_TO_S3) {
|
||||
Write-Output "Uploading Electron release distribution to s3"
|
||||
& python script\release\uploaders\upload.py --verbose --upload_to_s3
|
||||
& python script\release\uploaders\upload.py --upload_to_s3
|
||||
} else {
|
||||
Write-Output "Uploading Electron release distribution to github releases"
|
||||
& python script\release\uploaders\upload.py --verbose
|
||||
& python script\release\uploaders\upload.py
|
||||
}
|
||||
} elseif (Test-Path Env:\TEST_WOA) {
|
||||
node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
steps:
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy Files to: src/electron'
|
||||
inputs:
|
||||
TargetFolder: src/electron
|
||||
|
||||
- bash: |
|
||||
cd src/electron
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
displayName: 'Yarn install'
|
||||
|
||||
- bash: |
|
||||
export ZIP_DEST=$PWD/src/out/Default
|
||||
echo "##vso[task.setvariable variable=ZIP_DEST]$ZIP_DEST"
|
||||
mkdir -p $ZIP_DEST
|
||||
cd src/electron
|
||||
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=dist.zip --dest=$ZIP_DEST
|
||||
cd $ZIP_DEST
|
||||
unzip -o dist.zip
|
||||
xattr -cr Electron.app
|
||||
displayName: 'Download and unzip dist files for test'
|
||||
env:
|
||||
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
|
||||
|
||||
- bash: |
|
||||
export FFMPEG_ZIP_DEST=$PWD/src/out/ffmpeg
|
||||
mkdir -p $FFMPEG_ZIP_DEST
|
||||
cd src/electron
|
||||
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=ffmpeg.zip --dest=$FFMPEG_ZIP_DEST
|
||||
cd $FFMPEG_ZIP_DEST
|
||||
unzip -o ffmpeg.zip
|
||||
displayName: 'Download and unzip ffmpeg for test'
|
||||
env:
|
||||
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
|
||||
|
||||
- bash: |
|
||||
export NODE_HEADERS_DEST=$PWD/src/out/Default/gen
|
||||
mkdir -p $NODE_HEADERS_DEST
|
||||
cd src/electron
|
||||
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=node_headers.tar.gz --dest=$NODE_HEADERS_DEST
|
||||
cd $NODE_HEADERS_DEST
|
||||
tar xzf node_headers.tar.gz
|
||||
displayName: 'Download and untar node header files for test'
|
||||
env:
|
||||
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
|
||||
|
||||
- bash: |
|
||||
export CROSS_ARCH_SNAPSHOTS=$PWD/src/out/Default/cross-arch-snapshots
|
||||
mkdir -p $CROSS_ARCH_SNAPSHOTS
|
||||
cd src/electron
|
||||
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/snapshot_blob.bin --dest=$CROSS_ARCH_SNAPSHOTS
|
||||
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/v8_context_snapshot.arm64.bin --dest=$CROSS_ARCH_SNAPSHOTS
|
||||
displayName: 'Download cross arch snapshot files'
|
||||
env:
|
||||
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
|
||||
|
||||
- bash: |
|
||||
cd src
|
||||
export ELECTRON_OUT_DIR=Default
|
||||
export npm_config_arch=arm64
|
||||
(cd electron && node script/yarn test --enable-logging --runners main)
|
||||
displayName: 'Run Electron main tests'
|
||||
timeoutInMinutes: 20
|
||||
env:
|
||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||
IGNORE_YARN_INSTALL_ERROR: 1
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
|
||||
- bash: |
|
||||
cd src
|
||||
export ELECTRON_OUT_DIR=Default
|
||||
export npm_config_arch=arm64
|
||||
(cd electron && node script/yarn test --enable-logging --runners remote)
|
||||
displayName: 'Run Electron remote tests'
|
||||
timeoutInMinutes: 20
|
||||
condition: succeededOrFailed()
|
||||
env:
|
||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||
IGNORE_YARN_INSTALL_ERROR: 1
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
|
||||
- bash: |
|
||||
cd src
|
||||
python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg
|
||||
displayName: Verify non proprietary ffmpeg
|
||||
timeoutInMinutes: 5
|
||||
condition: succeededOrFailed()
|
||||
env:
|
||||
TARGET_ARCH: arm64
|
||||
|
||||
- bash: |
|
||||
cd src
|
||||
echo Verify cross arch snapshot
|
||||
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/out/Default/cross-arch-snapshots
|
||||
displayName: Verify cross arch snapshot
|
||||
timeoutInMinutes: 5
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: 'Publish Test Results'
|
||||
inputs:
|
||||
testResultsFiles: '*.xml'
|
||||
|
||||
searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/'
|
||||
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- bash: killall Electron || echo "No Electron processes left running"
|
||||
displayName: 'Kill processes left running from last test run'
|
||||
condition: always()
|
||||
|
||||
- bash: |
|
||||
rm -rf ~/Library/Application\ Support/Electron*
|
||||
rm -rf ~/Library/Application\ Support/electron*
|
||||
displayName: 'Delete user app data directories'
|
||||
condition: always()
|
||||
|
||||
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
||||
displayName: 'Clean Agent Directories'
|
||||
|
||||
condition: always()
|
||||
@@ -53,22 +53,6 @@ steps:
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
try {
|
||||
$localArtifactPath = "$pwd\src\pdb.zip"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/pdb.zip"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
cd src
|
||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip
|
||||
} catch {
|
||||
Write-Host "There was an exception encountered while downloading pdb files:" $_.Exception.Message
|
||||
} finally {
|
||||
$global:LASTEXITCODE = 0
|
||||
}
|
||||
displayName: 'Download pdb files for detailed stacktraces'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
New-Item src\out\Default\gen\node_headers\Release -Type directory
|
||||
Copy-Item -path src\out\Default\electron.lib -destination src\out\Default\gen\node_headers\Release\node.lib
|
||||
@@ -79,30 +63,14 @@ steps:
|
||||
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
||||
set npm_config_arch=arm64
|
||||
cd electron
|
||||
node script/yarn test --runners=main --runTestFilesSeperately --enable-logging --disable-features=CalculateNativeWinOcclusion
|
||||
displayName: 'Run Electron Main process tests'
|
||||
env:
|
||||
ELECTRON_ENABLE_STACK_DUMPING: true
|
||||
ELECTRON_OUT_DIR: Default
|
||||
IGNORE_YARN_INSTALL_ERROR: 1
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
|
||||
- script: |
|
||||
cd src
|
||||
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
||||
set npm_config_arch=arm64
|
||||
cd electron
|
||||
node script/yarn test --runners=remote --enable-logging --disable-features=CalculateNativeWinOcclusion
|
||||
displayName: 'Run Electron Remote based tests'
|
||||
node script/yarn test -- --ci --enable-logging --verbose
|
||||
displayName: 'Run Electron tests'
|
||||
env:
|
||||
ELECTRON_OUT_DIR: Default
|
||||
IGNORE_YARN_INSTALL_ERROR: 1
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
condition: always()
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: 'Publish Test Results'
|
||||
@@ -119,11 +87,6 @@ steps:
|
||||
|
||||
- powershell: |
|
||||
Get-Process | Where Name –Like "electron*" | Stop-Process
|
||||
Get-Process | Where Name –Like "msedge*" | Stop-Process
|
||||
Get-Process | Where Name –Like "MicrosoftEdge*" | Stop-Process
|
||||
displayName: 'Kill processes left running from last test run'
|
||||
condition: always()
|
||||
|
||||
- powershell: |
|
||||
Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore
|
||||
displayName: 'Delete user app data directories'
|
||||
condition: always()
|
||||
condition: always()
|
||||
@@ -2,12 +2,18 @@ is_electron_build = true
|
||||
root_extra_deps = [ "//electron" ]
|
||||
|
||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
|
||||
node_module_version = 97
|
||||
node_module_version = 76
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_typed_array_max_size_in_heap = 0
|
||||
v8_embedder_string = "-electron.0"
|
||||
|
||||
# TODO: this breaks native modules. See e.g. https://www.github.com/nodejs/node/pull/30463
|
||||
# We can probably enable this as long as we make sure node native modules
|
||||
# also build with the relevant #defines (V8_COMPRESS_POINTERS etc.)
|
||||
v8_enable_pointer_compression = false
|
||||
v8_enable_31bit_smis_on_64bit_arch = false
|
||||
|
||||
# TODO: this breaks mksnapshot
|
||||
v8_enable_snapshot_native_code_counters = false
|
||||
|
||||
@@ -19,17 +25,6 @@ enable_basic_printing = true
|
||||
angle_enable_vulkan_validation_layers = false
|
||||
dawn_enable_vulkan_validation_layers = false
|
||||
|
||||
# This breaks native node modules
|
||||
libcxx_abi_unstable = false
|
||||
|
||||
# These are disabled because they cause the zip manifest to differ between
|
||||
# testing and release builds.
|
||||
# See https://chromium-review.googlesource.com/c/chromium/src/+/2774898.
|
||||
enable_pseudolocales = false
|
||||
|
||||
is_cfi = false
|
||||
|
||||
# Make application name configurable at runtime for cookie crypto
|
||||
allow_runtime_configurable_key_storage = true
|
||||
|
||||
enable_cet_shadow_stack = false
|
||||
enable_osr = true
|
||||
|
||||
10
build/args/debug.gn
Normal file
10
build/args/debug.gn
Normal file
@@ -0,0 +1,10 @@
|
||||
import("all.gn")
|
||||
is_debug = true
|
||||
is_component_build = true
|
||||
|
||||
# This may be guarded behind is_chrome_branded alongside
|
||||
# proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
|
||||
# explicitly override here to build OpenH264 encoder/FFmpeg decoder.
|
||||
# The initialization of the decoder depends on whether ffmpeg has
|
||||
# been built with H.264 support.
|
||||
rtc_use_h264 = proprietary_codecs
|
||||
@@ -39,7 +39,7 @@ def main(dump_syms, binary, out_dir, stamp_file, dsym_file=None):
|
||||
args += ["-g", dsym_file]
|
||||
args += [binary]
|
||||
|
||||
symbol_data = subprocess.check_output(args).decode(sys.stdout.encoding)
|
||||
symbol_data = subprocess.check_output(args)
|
||||
symbol_path = os.path.join(out_dir, get_symbol_path(symbol_data))
|
||||
mkdir_p(os.path.dirname(symbol_path))
|
||||
|
||||
|
||||
@@ -34,7 +34,9 @@ template("extract_symbols") {
|
||||
dump_syms_binary,
|
||||
]
|
||||
stamp_file = "${target_gen_dir}/${target_name}.stamp"
|
||||
outputs = [ stamp_file ]
|
||||
outputs = [
|
||||
stamp_file,
|
||||
]
|
||||
args = [
|
||||
"./" + rebase_path(dump_syms_binary, root_build_dir),
|
||||
rebase_path(invoker.binary, root_build_dir),
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
if os.path.exists(sys.argv[2]):
|
||||
os.remove(sys.argv[2])
|
||||
|
||||
shutil.copy(sys.argv[1], sys.argv[2])
|
||||
@@ -1,102 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from collections import OrderedDict
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
SENTINEL = "dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX"
|
||||
|
||||
TEMPLATE_H = """
|
||||
#ifndef ELECTRON_FUSES_H_
|
||||
#define ELECTRON_FUSES_H_
|
||||
|
||||
#if defined(WIN32)
|
||||
#define FUSE_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define FUSE_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
namespace electron {
|
||||
|
||||
namespace fuses {
|
||||
|
||||
extern const volatile char kFuseWire[];
|
||||
|
||||
{getters}
|
||||
|
||||
} // namespace fuses
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // ELECTRON_FUSES_H_
|
||||
"""
|
||||
|
||||
TEMPLATE_CC = """
|
||||
#include "electron/fuses.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
namespace fuses {
|
||||
|
||||
const volatile char kFuseWire[] = { /* sentinel */ {sentinel}, /* fuse_version */ {fuse_version}, /* fuse_wire_length */ {fuse_wire_length}, /* fuse_wire */ {initial_config}};
|
||||
|
||||
{getters}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
"""
|
||||
|
||||
with open(os.path.join(dir_path, "fuses.json5"), 'r') as f:
|
||||
fuse_defaults = json.loads(''.join(line for line in f.readlines() if not line.strip()[0] == "/"), object_pairs_hook=OrderedDict)
|
||||
|
||||
fuse_version = fuse_defaults['_version']
|
||||
del fuse_defaults['_version']
|
||||
del fuse_defaults['_schema']
|
||||
del fuse_defaults['_comment']
|
||||
|
||||
if fuse_version >= pow(2, 8):
|
||||
raise Exception("Fuse version can not exceed one byte in size")
|
||||
|
||||
fuses = fuse_defaults.keys()
|
||||
|
||||
initial_config = ""
|
||||
getters_h = ""
|
||||
getters_cc = ""
|
||||
index = len(SENTINEL) + 1
|
||||
for fuse in fuses:
|
||||
index += 1
|
||||
initial_config += fuse_defaults[fuse]
|
||||
name = ''.join(word.title() for word in fuse.split('_'))
|
||||
getters_h += "FUSE_EXPORT bool Is{name}Enabled();\n".replace("{name}", name)
|
||||
getters_cc += """
|
||||
bool Is{name}Enabled() {
|
||||
return kFuseWire[{index}] == '1';
|
||||
}
|
||||
""".replace("{name}", name).replace("{index}", str(index))
|
||||
|
||||
def c_hex(n):
|
||||
s = hex(n)[2:]
|
||||
return "0x" + s.rjust(2, '0')
|
||||
|
||||
def hex_arr(s):
|
||||
arr = []
|
||||
for char in s:
|
||||
arr.append(c_hex(ord(char)))
|
||||
return ",".join(arr)
|
||||
|
||||
header = TEMPLATE_H.replace("{getters}", getters_h.strip())
|
||||
impl = TEMPLATE_CC.replace("{sentinel}", hex_arr(SENTINEL))
|
||||
impl = impl.replace("{fuse_version}", c_hex(fuse_version))
|
||||
impl = impl.replace("{fuse_wire_length}", c_hex(len(fuses)))
|
||||
impl = impl.replace("{initial_config}", hex_arr(initial_config))
|
||||
impl = impl.replace("{getters}", getters_cc.strip())
|
||||
|
||||
with open(sys.argv[1], 'w') as f:
|
||||
f.write(header)
|
||||
|
||||
with open(sys.argv[2], 'w') as f:
|
||||
f.write(impl)
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"_comment": "Modifying the fuse schema in any breaking way should result in the _version prop being incremented. NEVER remove a fuse or change its meaning, instead mark it as removed with 'r'",
|
||||
"_schema": "0 == off, 1 == on, r == removed fuse",
|
||||
"_version": 1,
|
||||
"run_as_node": "1",
|
||||
"cookie_encryption": "0"
|
||||
}
|
||||
653
build/install-build-deps.sh
Executable file
653
build/install-build-deps.sh
Executable file
@@ -0,0 +1,653 @@
|
||||
#!/bin/bash -e
|
||||
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
# Script to install everything needed to build chromium (well, ideally, anyway)
|
||||
# See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md
|
||||
usage() {
|
||||
echo "Usage: $0 [--options]"
|
||||
echo "Options:"
|
||||
echo "--[no-]syms: enable or disable installation of debugging symbols"
|
||||
echo "--lib32: enable installation of 32-bit libraries, e.g. for V8 snapshot"
|
||||
echo "--[no-]arm: enable or disable installation of arm cross toolchain"
|
||||
echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\
|
||||
"fonts"
|
||||
echo "--[no-]nacl: enable or disable installation of prerequisites for"\
|
||||
"building standalone NaCl and all its toolchains"
|
||||
echo "--[no-]backwards-compatible: enable or disable installation of packages
|
||||
that are no longer currently needed and have been removed from this
|
||||
script. Useful for bisection."
|
||||
echo "--no-prompt: silently select standard options/defaults"
|
||||
echo "--quick-check: quickly try to determine if dependencies are installed"
|
||||
echo " (this avoids interactive prompts and sudo commands,"
|
||||
echo " so might not be 100% accurate)"
|
||||
echo "--unsupported: attempt installation even on unsupported systems"
|
||||
echo "Script will prompt interactively if options not given."
|
||||
exit 1
|
||||
}
|
||||
# Checks whether a particular package is available in the repos.
|
||||
# USAGE: $ package_exists <package name>
|
||||
package_exists() {
|
||||
# 'apt-cache search' takes a regex string, so eg. the +'s in packages like
|
||||
# "libstdc++" need to be escaped.
|
||||
local escaped="$(echo $1 | sed 's/[\~\+\.\:-]/\\&/g')"
|
||||
[ ! -z "$(apt-cache search --names-only "${escaped}" | \
|
||||
awk '$1 == "'$1'" { print $1; }')" ]
|
||||
}
|
||||
# These default to on because (some) bots need them and it keeps things
|
||||
# simple for the bot setup if all bots just run the script in its default
|
||||
# mode. Developers who don't want stuff they don't need installed on their
|
||||
# own workstations can pass --no-arm --no-nacl when running the script.
|
||||
do_inst_arm=1
|
||||
do_inst_nacl=1
|
||||
while [ "$1" != "" ]
|
||||
do
|
||||
case "$1" in
|
||||
--syms) do_inst_syms=1;;
|
||||
--no-syms) do_inst_syms=0;;
|
||||
--lib32) do_inst_lib32=1;;
|
||||
--arm) do_inst_arm=1;;
|
||||
--no-arm) do_inst_arm=0;;
|
||||
--chromeos-fonts) do_inst_chromeos_fonts=1;;
|
||||
--no-chromeos-fonts) do_inst_chromeos_fonts=0;;
|
||||
--nacl) do_inst_nacl=1;;
|
||||
--no-nacl) do_inst_nacl=0;;
|
||||
--backwards-compatible) do_inst_backwards_compatible=1;;
|
||||
--no-backwards-compatible) do_inst_backwards_compatible=0;;
|
||||
--add-cross-tool-repo) add_cross_tool_repo=1;;
|
||||
--no-prompt) do_default=1
|
||||
do_quietly="-qq --assume-yes"
|
||||
;;
|
||||
--quick-check) do_quick_check=1;;
|
||||
--unsupported) do_unsupported=1;;
|
||||
*) usage;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [ "$do_inst_arm" = "1" ]; then
|
||||
do_inst_lib32=1
|
||||
fi
|
||||
# Check for lsb_release command in $PATH
|
||||
if ! which lsb_release > /dev/null; then
|
||||
echo "ERROR: lsb_release not found in \$PATH" >&2
|
||||
exit 1;
|
||||
fi
|
||||
distro_codename=$(lsb_release --codename --short)
|
||||
distro_id=$(lsb_release --id --short)
|
||||
supported_codenames="(trusty|xenial|artful|bionic)"
|
||||
supported_ids="(Debian)"
|
||||
if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then
|
||||
if [[ ! $distro_codename =~ $supported_codenames &&
|
||||
! $distro_id =~ $supported_ids ]]; then
|
||||
echo -e "ERROR: The only supported distros are\n" \
|
||||
"\tUbuntu 14.04 LTS (trusty)\n" \
|
||||
"\tUbuntu 16.04 LTS (xenial)\n" \
|
||||
"\tUbuntu 17.10 (artful)\n" \
|
||||
"\tUbuntu 18.04 LTS (bionic)\n" \
|
||||
"\tDebian 8 (jessie) or later" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! uname -m | egrep -q "i686|x86_64"; then
|
||||
echo "Only x86 architectures are currently supported" >&2
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then
|
||||
echo "Running as non-root user."
|
||||
echo "You might have to enter your password one or more times for 'sudo'."
|
||||
echo
|
||||
fi
|
||||
# Packages needed for chromeos only
|
||||
chromeos_dev_list="libbluetooth-dev libxkbcommon-dev"
|
||||
if package_exists realpath; then
|
||||
chromeos_dev_list="${chromeos_dev_list} realpath"
|
||||
fi
|
||||
# Packages needed for development
|
||||
dev_list="\
|
||||
binutils
|
||||
bison
|
||||
bzip2
|
||||
cdbs
|
||||
curl
|
||||
dbus-x11
|
||||
dpkg-dev
|
||||
elfutils
|
||||
devscripts
|
||||
fakeroot
|
||||
flex
|
||||
g++
|
||||
git-core
|
||||
git-svn
|
||||
gperf
|
||||
libappindicator3-dev
|
||||
libasound2-dev
|
||||
libatspi2.0-dev
|
||||
libbrlapi-dev
|
||||
libbz2-dev
|
||||
libcairo2-dev
|
||||
libcap-dev
|
||||
libcups2-dev
|
||||
libcurl4-gnutls-dev
|
||||
libdrm-dev
|
||||
libelf-dev
|
||||
libffi-dev
|
||||
libgbm-dev
|
||||
libglib2.0-dev
|
||||
libglu1-mesa-dev
|
||||
libgnome-keyring-dev
|
||||
libgtk-3-dev
|
||||
libkrb5-dev
|
||||
libnspr4-dev
|
||||
libnss3-dev
|
||||
libpam0g-dev
|
||||
libpci-dev
|
||||
libpulse-dev
|
||||
libsctp-dev
|
||||
libspeechd-dev
|
||||
libsqlite3-dev
|
||||
libssl-dev
|
||||
libudev-dev
|
||||
libwww-perl
|
||||
libxslt1-dev
|
||||
libxss-dev
|
||||
libxt-dev
|
||||
libxtst-dev
|
||||
locales
|
||||
openbox
|
||||
p7zip
|
||||
patch
|
||||
perl
|
||||
pkg-config
|
||||
python
|
||||
python-cherrypy3
|
||||
python-crypto
|
||||
python-dev
|
||||
python-numpy
|
||||
python-opencv
|
||||
python-openssl
|
||||
python-psutil
|
||||
python-yaml
|
||||
rpm
|
||||
ruby
|
||||
subversion
|
||||
uuid-dev
|
||||
wdiff
|
||||
x11-utils
|
||||
xcompmgr
|
||||
xz-utils
|
||||
zip
|
||||
$chromeos_dev_list
|
||||
"
|
||||
# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
|
||||
# NaCl binaries.
|
||||
if file -L /sbin/init | grep -q 'ELF 64-bit'; then
|
||||
dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
|
||||
fi
|
||||
# Run-time libraries required by chromeos only
|
||||
chromeos_lib_list="libpulse0 libbz2-1.0"
|
||||
# List of required run-time libraries
|
||||
common_lib_list="\
|
||||
libappindicator3-1
|
||||
libasound2
|
||||
libatk1.0-0
|
||||
libatspi2.0-0
|
||||
libc6
|
||||
libcairo2
|
||||
libcap2
|
||||
libcups2
|
||||
libexpat1
|
||||
libffi6
|
||||
libfontconfig1
|
||||
libfreetype6
|
||||
libglib2.0-0
|
||||
libgnome-keyring0
|
||||
libgtk-3-0
|
||||
libpam0g
|
||||
libpango1.0-0
|
||||
libpci3
|
||||
libpcre3
|
||||
libpixman-1-0
|
||||
libspeechd2
|
||||
libstdc++6
|
||||
libsqlite3-0
|
||||
libuuid1
|
||||
libwayland-egl1-mesa
|
||||
libx11-6
|
||||
libx11-xcb1
|
||||
libxau6
|
||||
libxcb1
|
||||
libxcomposite1
|
||||
libxcursor1
|
||||
libxdamage1
|
||||
libxdmcp6
|
||||
libxext6
|
||||
libxfixes3
|
||||
libxi6
|
||||
libxinerama1
|
||||
libxrandr2
|
||||
libxrender1
|
||||
libxtst6
|
||||
zlib1g
|
||||
"
|
||||
# Full list of required run-time libraries
|
||||
lib_list="\
|
||||
$common_lib_list
|
||||
$chromeos_lib_list
|
||||
"
|
||||
# 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf
|
||||
lib32_list="linux-libc-dev:i386 libpci3:i386"
|
||||
# 32-bit libraries needed for a 32-bit build
|
||||
lib32_list="$lib32_list libx11-xcb1:i386"
|
||||
# Packages that have been removed from this script. Regardless of configuration
|
||||
# or options passed to this script, whenever a package is removed, it should be
|
||||
# added here.
|
||||
backwards_compatible_list="\
|
||||
7za
|
||||
fonts-indic
|
||||
fonts-ipafont
|
||||
fonts-stix
|
||||
fonts-thai-tlwg
|
||||
fonts-tlwg-garuda
|
||||
language-pack-da
|
||||
language-pack-fr
|
||||
language-pack-he
|
||||
language-pack-zh-hant
|
||||
libappindicator-dev
|
||||
libappindicator1
|
||||
libappindicator3-1:i386
|
||||
libexif-dev
|
||||
libexif12
|
||||
libexif12:i386
|
||||
libgbm-dev
|
||||
libgl1-mesa-dev
|
||||
libgl1-mesa-glx:i386
|
||||
libgles2-mesa-dev
|
||||
libgtk2.0-0
|
||||
libgtk2.0-0:i386
|
||||
libgtk2.0-dev
|
||||
mesa-common-dev
|
||||
msttcorefonts
|
||||
ttf-dejavu-core
|
||||
ttf-indic-fonts
|
||||
ttf-kochi-gothic
|
||||
ttf-kochi-mincho
|
||||
ttf-mscorefonts-installer
|
||||
xfonts-mathml
|
||||
"
|
||||
case $distro_codename in
|
||||
trusty)
|
||||
backwards_compatible_list+=" \
|
||||
libgbm-dev-lts-trusty
|
||||
libgl1-mesa-dev-lts-trusty
|
||||
libgl1-mesa-glx-lts-trusty:i386
|
||||
libgles2-mesa-dev-lts-trusty
|
||||
mesa-common-dev-lts-trusty"
|
||||
;;
|
||||
xenial)
|
||||
backwards_compatible_list+=" \
|
||||
libgbm-dev-lts-xenial
|
||||
libgl1-mesa-dev-lts-xenial
|
||||
libgl1-mesa-glx-lts-xenial:i386
|
||||
libgles2-mesa-dev-lts-xenial
|
||||
mesa-common-dev-lts-xenial"
|
||||
;;
|
||||
esac
|
||||
# arm cross toolchain packages needed to build chrome on armhf
|
||||
EM_REPO="deb http://emdebian.org/tools/debian/ jessie main"
|
||||
EM_SOURCE=$(cat <<EOF
|
||||
# Repo added by Chromium $0
|
||||
${EM_REPO}
|
||||
# deb-src http://emdebian.org/tools/debian/ jessie main
|
||||
EOF
|
||||
)
|
||||
EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E"
|
||||
GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf"
|
||||
case $distro_codename in
|
||||
jessie)
|
||||
eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d')
|
||||
CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list"
|
||||
arm_list="libc6-dev:armhf
|
||||
linux-libc-dev:armhf"
|
||||
if [ "$do_inst_arm" = "1" ]; then
|
||||
if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then
|
||||
arm_list+=" ${GPP_ARM_PACKAGE}"
|
||||
else
|
||||
if [ "${add_cross_tool_repo}" = "1" ]; then
|
||||
gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER}
|
||||
gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add -
|
||||
if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then
|
||||
echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null
|
||||
fi
|
||||
arm_list+=" ${GPP_ARM_PACKAGE}"
|
||||
else
|
||||
echo "The Debian Cross-toolchains repository is necessary to"
|
||||
echo "cross-compile Chromium for arm."
|
||||
echo "Rerun with --add-deb-cross-tool-repo to have it added for you."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
# All necessary ARM packages are available on the default repos on
|
||||
# Debian 9 and later.
|
||||
*)
|
||||
arm_list="libc6-dev-armhf-cross
|
||||
linux-libc-dev-armhf-cross
|
||||
${GPP_ARM_PACKAGE}"
|
||||
;;
|
||||
esac
|
||||
# Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056
|
||||
case $distro_codename in
|
||||
trusty)
|
||||
arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf
|
||||
gcc-4.8-multilib-arm-linux-gnueabihf"
|
||||
;;
|
||||
xenial|artful|bionic)
|
||||
arm_list+=" g++-5-multilib-arm-linux-gnueabihf
|
||||
gcc-5-multilib-arm-linux-gnueabihf
|
||||
gcc-arm-linux-gnueabihf"
|
||||
;;
|
||||
esac
|
||||
# Packages to build NaCl, its toolchains, and its ports.
|
||||
naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc"
|
||||
nacl_list="\
|
||||
g++-mingw-w64-i686
|
||||
lib32z1-dev
|
||||
libasound2:i386
|
||||
libcap2:i386
|
||||
libelf-dev:i386
|
||||
libfontconfig1:i386
|
||||
libglib2.0-0:i386
|
||||
libgpm2:i386
|
||||
libgtk-3-0:i386
|
||||
libncurses5:i386
|
||||
lib32ncurses5-dev
|
||||
libnss3:i386
|
||||
libpango1.0-0:i386
|
||||
libssl-dev:i386
|
||||
libtinfo-dev
|
||||
libtinfo-dev:i386
|
||||
libtool
|
||||
libuuid1:i386
|
||||
libxcomposite1:i386
|
||||
libxcursor1:i386
|
||||
libxdamage1:i386
|
||||
libxi6:i386
|
||||
libxrandr2:i386
|
||||
libxss1:i386
|
||||
libxtst6:i386
|
||||
texinfo
|
||||
xvfb
|
||||
${naclports_list}
|
||||
"
|
||||
if package_exists libssl1.1; then
|
||||
nacl_list="${nacl_list} libssl1.1:i386"
|
||||
elif package_exists libssl1.0.2; then
|
||||
nacl_list="${nacl_list} libssl1.0.2:i386"
|
||||
else
|
||||
nacl_list="${nacl_list} libssl1.0.0:i386"
|
||||
fi
|
||||
# Some package names have changed over time
|
||||
if package_exists libpng16-16; then
|
||||
lib_list="${lib_list} libpng16-16"
|
||||
else
|
||||
lib_list="${lib_list} libpng12-0"
|
||||
fi
|
||||
if package_exists libnspr4; then
|
||||
lib_list="${lib_list} libnspr4 libnss3"
|
||||
else
|
||||
lib_list="${lib_list} libnspr4-0d libnss3-1d"
|
||||
fi
|
||||
if package_exists libjpeg-dev; then
|
||||
dev_list="${dev_list} libjpeg-dev"
|
||||
else
|
||||
dev_list="${dev_list} libjpeg62-dev"
|
||||
fi
|
||||
if package_exists libudev1; then
|
||||
dev_list="${dev_list} libudev1"
|
||||
nacl_list="${nacl_list} libudev1:i386"
|
||||
else
|
||||
dev_list="${dev_list} libudev0"
|
||||
nacl_list="${nacl_list} libudev0:i386"
|
||||
fi
|
||||
if package_exists libbrlapi0.6; then
|
||||
dev_list="${dev_list} libbrlapi0.6"
|
||||
else
|
||||
dev_list="${dev_list} libbrlapi0.5"
|
||||
fi
|
||||
if package_exists apache2.2-bin; then
|
||||
dev_list="${dev_list} apache2.2-bin"
|
||||
else
|
||||
dev_list="${dev_list} apache2-bin"
|
||||
fi
|
||||
if package_exists libav-tools; then
|
||||
dev_list="${dev_list} libav-tools"
|
||||
fi
|
||||
if package_exists php7.2-cgi; then
|
||||
dev_list="${dev_list} php7.2-cgi libapache2-mod-php7.2"
|
||||
elif package_exists php7.1-cgi; then
|
||||
dev_list="${dev_list} php7.1-cgi libapache2-mod-php7.1"
|
||||
elif package_exists php7.0-cgi; then
|
||||
dev_list="${dev_list} php7.0-cgi libapache2-mod-php7.0"
|
||||
else
|
||||
dev_list="${dev_list} php5-cgi libapache2-mod-php5"
|
||||
fi
|
||||
# Some packages are only needed if the distribution actually supports
|
||||
# installing them.
|
||||
if package_exists appmenu-gtk; then
|
||||
lib_list="$lib_list appmenu-gtk"
|
||||
fi
|
||||
# Cross-toolchain strip is needed for building the sysroots.
|
||||
if package_exists binutils-arm-linux-gnueabihf; then
|
||||
dev_list="${dev_list} binutils-arm-linux-gnueabihf"
|
||||
fi
|
||||
if package_exists binutils-aarch64-linux-gnu; then
|
||||
dev_list="${dev_list} binutils-aarch64-linux-gnu"
|
||||
fi
|
||||
if package_exists binutils-mipsel-linux-gnu; then
|
||||
dev_list="${dev_list} binutils-mipsel-linux-gnu"
|
||||
fi
|
||||
if package_exists binutils-mips64el-linux-gnuabi64; then
|
||||
dev_list="${dev_list} binutils-mips64el-linux-gnuabi64"
|
||||
fi
|
||||
# When cross building for arm/Android on 64-bit systems the host binaries
|
||||
# that are part of v8 need to be compiled with -m32 which means
|
||||
# that basic multilib support is needed.
|
||||
if file -L /sbin/init | grep -q 'ELF 64-bit'; then
|
||||
# gcc-multilib conflicts with the arm cross compiler (at least in trusty) but
|
||||
# g++-X.Y-multilib gives us the 32-bit support that we need. Find out the
|
||||
# appropriate value of X and Y by seeing what version the current
|
||||
# distribution's g++-multilib package depends on.
|
||||
multilib_package=$(apt-cache depends g++-multilib --important | \
|
||||
grep -E --color=never --only-matching '\bg\+\+-[0-9.]+-multilib\b')
|
||||
lib32_list="$lib32_list $multilib_package"
|
||||
fi
|
||||
if [ "$do_inst_syms" = "1" ]; then
|
||||
echo "Including debugging symbols."
|
||||
# Debian is in the process of transitioning to automatic debug packages, which
|
||||
# have the -dbgsym suffix (https://wiki.debian.org/AutomaticDebugPackages).
|
||||
# Untransitioned packages have the -dbg suffix. And on some systems, neither
|
||||
# will be available, so exclude the ones that are missing.
|
||||
dbg_package_name() {
|
||||
if package_exists "$1-dbgsym"; then
|
||||
echo "$1-dbgsym"
|
||||
elif package_exists "$1-dbg"; then
|
||||
echo "$1-dbg"
|
||||
fi
|
||||
}
|
||||
for package in "${common_lib_list}"; do
|
||||
dbg_list="$dbg_list $(dbg_package_name ${package})"
|
||||
done
|
||||
# Debugging symbols packages not following common naming scheme
|
||||
if [ "$(dbg_package_name libstdc++6)" == "" ]; then
|
||||
if package_exists libstdc++6-8-dbg; then
|
||||
dbg_list="${dbg_list} libstdc++6-8-dbg"
|
||||
elif package_exists libstdc++6-7-dbg; then
|
||||
dbg_list="${dbg_list} libstdc++6-7-dbg"
|
||||
elif package_exists libstdc++6-6-dbg; then
|
||||
dbg_list="${dbg_list} libstdc++6-6-dbg"
|
||||
elif package_exists libstdc++6-5-dbg; then
|
||||
dbg_list="${dbg_list} libstdc++6-5-dbg"
|
||||
elif package_exists libstdc++6-4.9-dbg; then
|
||||
dbg_list="${dbg_list} libstdc++6-4.9-dbg"
|
||||
elif package_exists libstdc++6-4.8-dbg; then
|
||||
dbg_list="${dbg_list} libstdc++6-4.8-dbg"
|
||||
elif package_exists libstdc++6-4.7-dbg; then
|
||||
dbg_list="${dbg_list} libstdc++6-4.7-dbg"
|
||||
elif package_exists libstdc++6-4.6-dbg; then
|
||||
dbg_list="${dbg_list} libstdc++6-4.6-dbg"
|
||||
fi
|
||||
fi
|
||||
if [ "$(dbg_package_name libatk1.0-0)" == "" ]; then
|
||||
dbg_list="$dbg_list $(dbg_package_name libatk1.0)"
|
||||
fi
|
||||
if [ "$(dbg_package_name libpango1.0-0)" == "" ]; then
|
||||
dbg_list="$dbg_list $(dbg_package_name libpango1.0-dev)"
|
||||
fi
|
||||
else
|
||||
echo "Skipping debugging symbols."
|
||||
dbg_list=
|
||||
fi
|
||||
if [ "$do_inst_lib32" = "1" ]; then
|
||||
echo "Including 32-bit libraries."
|
||||
else
|
||||
echo "Skipping 32-bit libraries."
|
||||
lib32_list=
|
||||
fi
|
||||
if [ "$do_inst_arm" = "1" ]; then
|
||||
echo "Including ARM cross toolchain."
|
||||
else
|
||||
echo "Skipping ARM cross toolchain."
|
||||
arm_list=
|
||||
fi
|
||||
if [ "$do_inst_nacl" = "1" ]; then
|
||||
echo "Including NaCl, NaCl toolchain, NaCl ports dependencies."
|
||||
else
|
||||
echo "Skipping NaCl, NaCl toolchain, NaCl ports dependencies."
|
||||
nacl_list=
|
||||
fi
|
||||
filtered_backwards_compatible_list=
|
||||
if [ "$do_inst_backwards_compatible" = "1" ]; then
|
||||
echo "Including backwards compatible packages."
|
||||
for package in ${backwards_compatible_list}; do
|
||||
if package_exists ${package}; then
|
||||
filtered_backwards_compatible_list+=" ${package}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# The `sort -r -s -t: -k2` sorts all the :i386 packages to the front, to avoid
|
||||
# confusing dpkg-query (crbug.com/446172).
|
||||
packages="$(
|
||||
echo "${dev_list} ${lib_list} ${dbg_list} ${lib32_list} ${arm_list}" \
|
||||
"${nacl_list}" ${filtered_backwards_compatible_list} | tr " " "\n" | \
|
||||
sort -u | sort -r -s -t: -k2 | tr "\n" " "
|
||||
)"
|
||||
if [ 1 -eq "${do_quick_check-0}" ] ; then
|
||||
if ! missing_packages="$(dpkg-query -W -f ' ' ${packages} 2>&1)"; then
|
||||
# Distinguish between packages that actually aren't available to the
|
||||
# system (i.e. not in any repo) and packages that just aren't known to
|
||||
# dpkg (i.e. managed by apt).
|
||||
missing_packages="$(echo "${missing_packages}" | awk '{print $NF}')"
|
||||
not_installed=""
|
||||
unknown=""
|
||||
for p in ${missing_packages}; do
|
||||
if apt-cache show ${p} > /dev/null 2>&1; then
|
||||
not_installed="${p}\n${not_installed}"
|
||||
else
|
||||
unknown="${p}\n${unknown}"
|
||||
fi
|
||||
done
|
||||
if [ -n "${not_installed}" ]; then
|
||||
echo "WARNING: The following packages are not installed:"
|
||||
echo -e "${not_installed}" | sed -e "s/^/ /"
|
||||
fi
|
||||
if [ -n "${unknown}" ]; then
|
||||
echo "WARNING: The following packages are unknown to your system"
|
||||
echo "(maybe missing a repo or need to 'sudo apt-get update'):"
|
||||
echo -e "${unknown}" | sed -e "s/^/ /"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
if [ "$do_inst_lib32" = "1" ] || [ "$do_inst_nacl" = "1" ]; then
|
||||
sudo dpkg --add-architecture i386
|
||||
fi
|
||||
sudo apt-get update
|
||||
# We initially run "apt-get" with the --reinstall option and parse its output.
|
||||
# This way, we can find all the packages that need to be newly installed
|
||||
# without accidentally promoting any packages from "auto" to "manual".
|
||||
# We then re-run "apt-get" with just the list of missing packages.
|
||||
echo "Finding missing packages..."
|
||||
# Intentionally leaving $packages unquoted so it's more readable.
|
||||
echo "Packages required: " $packages
|
||||
echo
|
||||
new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
|
||||
if new_list="$(yes n | LANGUAGE=en LANG=C $new_list_cmd)"; then
|
||||
# We probably never hit this following line.
|
||||
echo "No missing packages, and the packages are up to date."
|
||||
elif [ $? -eq 1 ]; then
|
||||
# We expect apt-get to have exit status of 1.
|
||||
# This indicates that we cancelled the install with "yes n|".
|
||||
new_list=$(echo "$new_list" |
|
||||
sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
|
||||
new_list=$(echo "$new_list" | sed 's/ *$//')
|
||||
if [ -z "$new_list" ] ; then
|
||||
echo "No missing packages, and the packages are up to date."
|
||||
else
|
||||
echo "Installing missing packages: $new_list."
|
||||
sudo apt-get install ${do_quietly-} ${new_list}
|
||||
fi
|
||||
echo
|
||||
else
|
||||
# An apt-get exit status of 100 indicates that a real error has occurred.
|
||||
# I am intentionally leaving out the '"'s around new_list_cmd,
|
||||
# as this makes it easier to cut and paste the output
|
||||
echo "The following command failed: " ${new_list_cmd}
|
||||
echo
|
||||
echo "It produces the following output:"
|
||||
yes n | $new_list_cmd || true
|
||||
echo
|
||||
echo "You will have to install the above packages yourself."
|
||||
echo
|
||||
exit 100
|
||||
fi
|
||||
# Install the Chrome OS default fonts. This must go after running
|
||||
# apt-get, since install-chromeos-fonts depends on curl.
|
||||
if [ "$do_inst_chromeos_fonts" != "0" ]; then
|
||||
echo
|
||||
echo "Installing Chrome OS fonts."
|
||||
dir=`echo $0 | sed -r -e 's/\/[^/]+$//'`
|
||||
if ! sudo $dir/linux/install-chromeos-fonts.py; then
|
||||
echo "ERROR: The installation of the Chrome OS default fonts failed."
|
||||
if [ `stat -f -c %T $dir` == "nfs" ]; then
|
||||
echo "The reason is that your repo is installed on a remote file system."
|
||||
else
|
||||
echo "This is expected if your repo is installed on a remote file system."
|
||||
fi
|
||||
echo "It is recommended to install your repo on a local file system."
|
||||
echo "You can skip the installation of the Chrome OS default founts with"
|
||||
echo "the command line option: --no-chromeos-fonts."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Skipping installation of Chrome OS fonts."
|
||||
fi
|
||||
echo "Installing locales."
|
||||
CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8"
|
||||
LOCALE_GEN=/etc/locale.gen
|
||||
if [ -e ${LOCALE_GEN} ]; then
|
||||
OLD_LOCALE_GEN="$(cat /etc/locale.gen)"
|
||||
for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
|
||||
sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN}
|
||||
done
|
||||
# Regenerating locales can take a while, so only do it if we need to.
|
||||
if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then
|
||||
echo "Locales already up-to-date."
|
||||
else
|
||||
sudo locale-gen
|
||||
fi
|
||||
else
|
||||
for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do
|
||||
sudo locale-gen ${CHROMIUM_LOCALE}
|
||||
done
|
||||
fi
|
||||
@@ -8,7 +8,6 @@
|
||||
# require any direct Cocoa locale support.
|
||||
|
||||
import os
|
||||
import errno
|
||||
import sys
|
||||
|
||||
|
||||
@@ -17,7 +16,7 @@ def main(args):
|
||||
try:
|
||||
os.makedirs(dirname)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EEXIST:
|
||||
if e.errno == os.errno.EEXIST:
|
||||
# It's OK if it already exists
|
||||
pass
|
||||
else:
|
||||
|
||||
@@ -15,6 +15,5 @@ args = [cmd, "run",
|
||||
try:
|
||||
subprocess.check_output(args, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError as e:
|
||||
error_msg = "NPM script '{}' failed with code '{}':\n".format(sys.argv[2], e.returncode)
|
||||
print(error_msg + e.output.decode('utf8'))
|
||||
print("NPM script '" + sys.argv[2] + "' failed with code '" + str(e.returncode) + "':\n" + e.output)
|
||||
sys.exit(e.returncode)
|
||||
|
||||
@@ -10,7 +10,9 @@ template("npm_action") {
|
||||
]
|
||||
script = "//electron/build/npm-run.py"
|
||||
|
||||
outputs = [ "$target_gen_dir/npm_pre_stamps/" + target_name + ".stamp" ]
|
||||
outputs = [
|
||||
"$target_gen_dir/npm_pre_stamps/" + target_name + ".stamp",
|
||||
]
|
||||
|
||||
args = [
|
||||
"--silent",
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
from __future__ import with_statement
|
||||
import contextlib
|
||||
import sys
|
||||
import os
|
||||
import optparse
|
||||
import json
|
||||
|
||||
sys.path.append("%s/../../build" % os.path.dirname(os.path.realpath(__file__)))
|
||||
|
||||
import find_depot_tools
|
||||
from vs_toolchain import \
|
||||
SetEnvironmentAndGetRuntimeDllDirs, \
|
||||
SetEnvironmentAndGetSDKDir, \
|
||||
NormalizePath
|
||||
|
||||
sys.path.append("%s/win_toolchain" % find_depot_tools.add_depot_tools_to_path())
|
||||
|
||||
from get_toolchain_if_necessary import CalculateHash
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def cwd(directory):
|
||||
curdir = os.getcwd()
|
||||
try:
|
||||
os.chdir(directory)
|
||||
yield
|
||||
finally:
|
||||
os.chdir(curdir)
|
||||
|
||||
|
||||
def calculate_hash(root):
|
||||
with cwd(root):
|
||||
return CalculateHash('.', None)
|
||||
|
||||
def windows_installed_software():
|
||||
import win32com.client
|
||||
strComputer = "."
|
||||
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
|
||||
objSWbemServices = objWMIService.ConnectServer(strComputer, "root\cimv2")
|
||||
colItems = objSWbemServices.ExecQuery("Select * from Win32_Product")
|
||||
items = []
|
||||
|
||||
for objItem in colItems:
|
||||
item = {}
|
||||
if objItem.Caption:
|
||||
item['caption'] = objItem.Caption
|
||||
if objItem.Caption:
|
||||
item['description'] = objItem.Description
|
||||
if objItem.InstallDate:
|
||||
item['install_date'] = objItem.InstallDate
|
||||
if objItem.InstallDate2:
|
||||
item['install_date_2'] = objItem.InstallDate2
|
||||
if objItem.InstallLocation:
|
||||
item['install_location'] = objItem.InstallLocation
|
||||
if objItem.Name:
|
||||
item['name'] = objItem.Name
|
||||
if objItem.SKUNumber:
|
||||
item['sku_number'] = objItem.SKUNumber
|
||||
if objItem.Vendor:
|
||||
item['vendor'] = objItem.Vendor
|
||||
if objItem.Version:
|
||||
item['version'] = objItem.Version
|
||||
items.append(item)
|
||||
|
||||
return items
|
||||
|
||||
|
||||
def windows_profile():
|
||||
runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs()
|
||||
win_sdk_dir = SetEnvironmentAndGetSDKDir()
|
||||
path = NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH'])
|
||||
|
||||
# since current windows executable are symbols path dependant,
|
||||
# profile the current directory too
|
||||
return {
|
||||
'pwd': os.getcwd(),
|
||||
'installed_software': windows_installed_software(),
|
||||
'sdks': [
|
||||
{'name': 'vs', 'path': path, 'hash': calculate_hash(path)},
|
||||
{
|
||||
'name': 'wsdk',
|
||||
'path': win_sdk_dir,
|
||||
'hash': calculate_hash(win_sdk_dir),
|
||||
},
|
||||
],
|
||||
'runtime_lib_dirs': runtime_dll_dirs,
|
||||
}
|
||||
|
||||
|
||||
def main(options):
|
||||
if sys.platform == 'win32':
|
||||
with open(options.output_json, 'wb') as f:
|
||||
json.dump(windows_profile(), f)
|
||||
else:
|
||||
raise OSError("Unsupported OS")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option('--output-json', metavar='FILE', default='profile.json',
|
||||
help='write information about toolchain to FILE')
|
||||
opts, args = parser.parse_args()
|
||||
sys.exit(main(opts))
|
||||
@@ -81,7 +81,9 @@ template("mac_xib_bundle_data") {
|
||||
"visibility",
|
||||
])
|
||||
|
||||
public_deps = [ ":$_compile_target_name" ]
|
||||
public_deps = [
|
||||
":$_compile_target_name",
|
||||
]
|
||||
sources = get_target_outputs(":$_compile_target_name")
|
||||
|
||||
_output_path = "{{bundle_resources_dir}}"
|
||||
@@ -89,6 +91,8 @@ template("mac_xib_bundle_data") {
|
||||
_output_path = invoker.output_path
|
||||
}
|
||||
|
||||
outputs = [ "$_output_path/{{source_file_part}}" ]
|
||||
outputs = [
|
||||
"$_output_path/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
def main(argv):
|
||||
cwd = argv[1]
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
source = sys.argv[1]
|
||||
dest = sys.argv[2]
|
||||
|
||||
# Ensure any existing framework is removed
|
||||
subprocess.check_output(["rm", "-rf", dest])
|
||||
|
||||
subprocess.check_output(["cp", "-a", source, dest])
|
||||
|
||||
# Strip headers, we do not need to ship them
|
||||
subprocess.check_output(["rm", "-r", os.path.join(dest, "Headers")])
|
||||
subprocess.check_output(
|
||||
["rm", "-r", os.path.join(dest, "Versions", "Current", "Headers")]
|
||||
)
|
||||
@@ -15,8 +15,12 @@ template("templated_file") {
|
||||
"inputs",
|
||||
"outputs",
|
||||
])
|
||||
inputs = [ invoker.template ]
|
||||
outputs = [ invoker.output ]
|
||||
inputs = [
|
||||
invoker.template,
|
||||
]
|
||||
outputs = [
|
||||
invoker.output,
|
||||
]
|
||||
script = "//electron/build/generate-template.py"
|
||||
args = [
|
||||
rebase_path(invoker.template),
|
||||
|
||||
@@ -26,12 +26,19 @@ template("typescript_build") {
|
||||
"//electron/typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
type_roots = "node_modules/@types,typings"
|
||||
if (defined(invoker.type_root)) {
|
||||
type_roots += "," + invoker.type_root
|
||||
}
|
||||
|
||||
base_out_path = invoker.output_gen_dir + "/electron/"
|
||||
args = [
|
||||
"-p",
|
||||
rebase_path(invoker.tsconfig),
|
||||
"--outDir",
|
||||
rebase_path("$base_out_path" + invoker.output_dir_name),
|
||||
"--typeRoots",
|
||||
type_roots,
|
||||
]
|
||||
|
||||
outputs = []
|
||||
|
||||
2
build/webpack/get-outputs.js
Normal file
2
build/webpack/get-outputs.js
Normal file
@@ -0,0 +1,2 @@
|
||||
process.env.PRINT_WEBPACK_GRAPH = true
|
||||
require('./run-compiler')
|
||||
22
build/webpack/run-compiler.js
Normal file
22
build/webpack/run-compiler.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
|
||||
const configPath = process.argv[2]
|
||||
const outPath = path.resolve(process.argv[3])
|
||||
const config = require(configPath)
|
||||
config.output = {
|
||||
path: path.dirname(outPath),
|
||||
filename: path.basename(outPath)
|
||||
}
|
||||
|
||||
webpack(config, (err, stats) => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
} else if (stats.hasErrors()) {
|
||||
console.error(stats.toString('normal'))
|
||||
process.exit(1)
|
||||
} else {
|
||||
process.exit(0)
|
||||
}
|
||||
})
|
||||
@@ -1,5 +0,0 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'asar',
|
||||
alwaysHasNode: true,
|
||||
targetDeletesNodeGlobals: true
|
||||
});
|
||||
@@ -1,19 +1,22 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const WrapperPlugin = require('wrapper-webpack-plugin');
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
|
||||
const electronRoot = path.resolve(__dirname, '../..');
|
||||
const electronRoot = path.resolve(__dirname, '../..')
|
||||
|
||||
const onlyPrintingGraph = !!process.env.PRINT_WEBPACK_GRAPH
|
||||
|
||||
class AccessDependenciesPlugin {
|
||||
apply (compiler) {
|
||||
apply(compiler) {
|
||||
// Only hook into webpack when we are printing the dependency graph
|
||||
if (!onlyPrintingGraph) return
|
||||
|
||||
compiler.hooks.compilation.tap('AccessDependenciesPlugin', compilation => {
|
||||
compilation.hooks.finishModules.tap('AccessDependenciesPlugin', modules => {
|
||||
const filePaths = modules.map(m => m.resource).filter(p => p).map(p => path.relative(electronRoot, p));
|
||||
console.info(JSON.stringify(filePaths));
|
||||
});
|
||||
});
|
||||
const filePaths = modules.map(m => m.resource).filter(p => p).map(p => path.relative(electronRoot, p))
|
||||
console.info(JSON.stringify(filePaths))
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,152 +24,60 @@ module.exports = ({
|
||||
alwaysHasNode,
|
||||
loadElectronFromAlternateTarget,
|
||||
targetDeletesNodeGlobals,
|
||||
target,
|
||||
wrapInitWithProfilingTimeout,
|
||||
wrapInitWithTryCatch
|
||||
target
|
||||
}) => {
|
||||
let entry = path.resolve(electronRoot, 'lib', target, 'init.ts');
|
||||
let entry = path.resolve(electronRoot, 'lib', target, 'init.ts')
|
||||
if (!fs.existsSync(entry)) {
|
||||
entry = path.resolve(electronRoot, 'lib', target, 'init.js');
|
||||
entry = path.resolve(electronRoot, 'lib', target, 'init.js')
|
||||
}
|
||||
|
||||
const electronAPIFile = path.resolve(electronRoot, 'lib', loadElectronFromAlternateTarget || target, 'api', 'exports', 'electron.ts');
|
||||
|
||||
return (env = {}, argv = {}) => {
|
||||
const onlyPrintingGraph = !!env.PRINT_WEBPACK_GRAPH;
|
||||
const outputFilename = argv['output-filename'] || `${target}.bundle.js`;
|
||||
|
||||
const defines = {
|
||||
BUILDFLAG: onlyPrintingGraph ? '(a => a)' : ''
|
||||
};
|
||||
|
||||
if (env.buildflags) {
|
||||
const flagFile = fs.readFileSync(env.buildflags, 'utf8');
|
||||
for (const line of flagFile.split(/(\r\n|\r|\n)/g)) {
|
||||
const flagMatch = line.match(/#define BUILDFLAG_INTERNAL_(.+?)\(\) \(([01])\)/);
|
||||
if (flagMatch) {
|
||||
const [, flagName, flagValue] = flagMatch;
|
||||
defines[flagName] = JSON.stringify(Boolean(parseInt(flagValue, 10)));
|
||||
return ({
|
||||
mode: 'development',
|
||||
devtool: 'inline-source-map',
|
||||
entry,
|
||||
target: alwaysHasNode ? 'node' : 'web',
|
||||
output: {
|
||||
filename: `${target}.bundle.js`
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@electron/internal': path.resolve(electronRoot, 'lib'),
|
||||
'electron': path.resolve(electronRoot, 'lib', loadElectronFromAlternateTarget || target, 'api', 'exports', 'electron.ts'),
|
||||
// Force timers to resolve to our dependency that doens't use window.postMessage
|
||||
'timers': path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||
},
|
||||
extensions: ['.ts', '.js']
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.ts$/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
configFile: path.resolve(electronRoot, 'tsconfig.electron.json'),
|
||||
transpileOnly: onlyPrintingGraph,
|
||||
ignoreDiagnostics: [6059]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ignoredModules = [];
|
||||
|
||||
if (defines.ENABLE_DESKTOP_CAPTURER === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/desktop-capturer',
|
||||
'@electron/internal/browser/api/desktop-capturer',
|
||||
'@electron/internal/renderer/api/desktop-capturer'
|
||||
);
|
||||
}
|
||||
|
||||
if (defines.ENABLE_VIEWS_API === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/api/views/image-view.js'
|
||||
);
|
||||
}
|
||||
|
||||
const plugins = [];
|
||||
|
||||
if (onlyPrintingGraph) {
|
||||
plugins.push(new AccessDependenciesPlugin());
|
||||
}
|
||||
|
||||
if (targetDeletesNodeGlobals) {
|
||||
plugins.push(new webpack.ProvidePlugin({
|
||||
process: ['@electron/internal/common/webpack-provider', 'process'],
|
||||
global: ['@electron/internal/common/webpack-provider', '_global'],
|
||||
Buffer: ['@electron/internal/common/webpack-provider', 'Buffer']
|
||||
}));
|
||||
}
|
||||
|
||||
plugins.push(new webpack.ProvidePlugin({
|
||||
Promise: ['@electron/internal/common/webpack-globals-provider', 'Promise']
|
||||
}));
|
||||
|
||||
plugins.push(new webpack.DefinePlugin(defines));
|
||||
|
||||
if (wrapInitWithProfilingTimeout) {
|
||||
plugins.push(new WrapperPlugin({
|
||||
header: 'function ___electron_webpack_init__() {',
|
||||
footer: `
|
||||
};
|
||||
if ((globalThis.process || binding.process).argv.includes("--profile-electron-init")) {
|
||||
setTimeout(___electron_webpack_init__, 0);
|
||||
} else {
|
||||
___electron_webpack_init__();
|
||||
}`
|
||||
}));
|
||||
}
|
||||
|
||||
if (wrapInitWithTryCatch) {
|
||||
plugins.push(new WrapperPlugin({
|
||||
header: 'try {',
|
||||
footer: `
|
||||
} catch (err) {
|
||||
console.error('Electron ${outputFilename} script failed to run');
|
||||
console.error(err);
|
||||
}`
|
||||
}));
|
||||
}
|
||||
|
||||
return {
|
||||
mode: 'development',
|
||||
devtool: false,
|
||||
entry,
|
||||
target: alwaysHasNode ? 'node' : 'web',
|
||||
output: {
|
||||
filename: outputFilename
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@electron/internal': path.resolve(electronRoot, 'lib'),
|
||||
electron$: electronAPIFile,
|
||||
'electron/main$': electronAPIFile,
|
||||
'electron/renderer$': electronAPIFile,
|
||||
'electron/common$': electronAPIFile,
|
||||
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
||||
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||
},
|
||||
extensions: ['.ts', '.js']
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: (moduleName) => !onlyPrintingGraph && ignoredModules.includes(moduleName),
|
||||
loader: 'null-loader'
|
||||
}, {
|
||||
test: /\.ts$/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
configFile: path.resolve(electronRoot, 'tsconfig.electron.json'),
|
||||
transpileOnly: onlyPrintingGraph,
|
||||
ignoreDiagnostics: [
|
||||
// File '{0}' is not under 'rootDir' '{1}'.
|
||||
6059
|
||||
]
|
||||
}
|
||||
}]
|
||||
},
|
||||
node: {
|
||||
__dirname: false,
|
||||
__filename: false,
|
||||
// We provide our own "timers" import above, any usage of setImmediate inside
|
||||
// one of our renderer bundles should import it from the 'timers' package
|
||||
setImmediate: false
|
||||
},
|
||||
optimization: {
|
||||
minimize: env.mode === 'production',
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
keep_fnames: true
|
||||
}
|
||||
})
|
||||
]
|
||||
},
|
||||
plugins
|
||||
};
|
||||
};
|
||||
};
|
||||
}]
|
||||
},
|
||||
node: {
|
||||
__dirname: false,
|
||||
__filename: false,
|
||||
// We provide our own "timers" import above, any usage of setImmediate inside
|
||||
// one of our renderer bundles should import it from the 'timers' package
|
||||
setImmediate: false,
|
||||
},
|
||||
plugins: [
|
||||
new AccessDependenciesPlugin(),
|
||||
...(targetDeletesNodeGlobals ? [
|
||||
new webpack.ProvidePlugin({
|
||||
process: ['@electron/internal/renderer/webpack-provider', 'process'],
|
||||
global: ['@electron/internal/renderer/webpack-provider', '_global'],
|
||||
Buffer: ['@electron/internal/renderer/webpack-provider', 'Buffer'],
|
||||
})
|
||||
] : []),
|
||||
new webpack.ProvidePlugin({
|
||||
Promise: ['@electron/internal/common/webpack-globals-provider', 'Promise'],
|
||||
}),
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'browser',
|
||||
alwaysHasNode: true
|
||||
});
|
||||
})
|
||||
|
||||
4
build/webpack/webpack.config.content_script.js
Normal file
4
build/webpack/webpack.config.content_script.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'content_script',
|
||||
alwaysHasNode: false
|
||||
})
|
||||
@@ -1,5 +1,4 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'isolated_renderer',
|
||||
alwaysHasNode: false,
|
||||
wrapInitWithTryCatch: true
|
||||
});
|
||||
alwaysHasNode: false
|
||||
})
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'renderer',
|
||||
alwaysHasNode: true,
|
||||
targetDeletesNodeGlobals: true,
|
||||
wrapInitWithProfilingTimeout: true,
|
||||
wrapInitWithTryCatch: true
|
||||
});
|
||||
targetDeletesNodeGlobals: true
|
||||
})
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'sandboxed_renderer',
|
||||
alwaysHasNode: false,
|
||||
wrapInitWithProfilingTimeout: true,
|
||||
wrapInitWithTryCatch: true
|
||||
});
|
||||
alwaysHasNode: false
|
||||
})
|
||||
|
||||
@@ -2,6 +2,5 @@ module.exports = require('./webpack.config.base')({
|
||||
target: 'worker',
|
||||
loadElectronFromAlternateTarget: 'renderer',
|
||||
alwaysHasNode: true,
|
||||
targetDeletesNodeGlobals: true,
|
||||
wrapInitWithTryCatch: true
|
||||
});
|
||||
targetDeletesNodeGlobals: true
|
||||
})
|
||||
|
||||
@@ -22,22 +22,13 @@ template("webpack_build") {
|
||||
"//electron/typings/internal-electron.d.ts",
|
||||
] + invoker.inputs
|
||||
|
||||
mode = "development"
|
||||
if (is_official_build) {
|
||||
mode = "production"
|
||||
}
|
||||
|
||||
args = [
|
||||
"--config",
|
||||
rebase_path(invoker.config_file),
|
||||
"--output-filename=" + get_path_info(invoker.out_file, "file"),
|
||||
"--output-path=" + rebase_path(get_path_info(invoker.out_file, "dir")),
|
||||
"--env.buildflags=" +
|
||||
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
"--env.mode=" + mode,
|
||||
rebase_path(invoker.out_file),
|
||||
]
|
||||
deps += [ "buildflags" ]
|
||||
|
||||
outputs = [ invoker.out_file ]
|
||||
outputs = [
|
||||
invoker.out_file,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
70
build/zip.py
70
build/zip.py
@@ -9,38 +9,21 @@ EXTENSIONS_TO_SKIP = [
|
||||
'.pdb',
|
||||
'.mojom.js',
|
||||
'.mojom-lite.js',
|
||||
'.info',
|
||||
'.m.js'
|
||||
]
|
||||
|
||||
PATHS_TO_SKIP = [
|
||||
# Skip because it is an output of //ui/gl that we don't need.
|
||||
'angledata',
|
||||
# Skip because these are outputs that we don't need.
|
||||
'./libVkICD_mock_',
|
||||
# Skip because these are outputs that we don't need.
|
||||
'./VkICD_mock_',
|
||||
# Skip because its an output of create_bundle from
|
||||
# //build/config/mac/rules.gni that we don't need
|
||||
'angledata', #Skipping because it is an output of //ui/gl that we don't need
|
||||
'./libVkICD_mock_', #Skipping because these are outputs that we don't need
|
||||
'./VkICD_mock_', #Skipping because these are outputs that we don't need
|
||||
|
||||
# Skipping because its an output of create_bundle from //build/config/mac/rules.gni
|
||||
# that we don't need
|
||||
'Electron.dSYM',
|
||||
# Refs https://chromium-review.googlesource.com/c/angle/angle/+/2425197.
|
||||
# Remove this when Angle themselves remove the file:
|
||||
# https://issuetracker.google.com/issues/168736059
|
||||
'gen/angle/angle_commit.h',
|
||||
|
||||
# //chrome/browser:resources depends on this via
|
||||
# //chrome/browser/resources/ssl/ssl_error_assistant, but we don't need to
|
||||
# ship it.
|
||||
'pyproto',
|
||||
# On Windows, this binary doesn't exist (the crashpad handler is built-in).
|
||||
# On MacOS, the binary is called 'chrome_crashpad_handler' and is inside the
|
||||
# app bundle.
|
||||
# On Linux, we don't use crashpad, but this binary is still built for some
|
||||
# reason. Exclude it from the zip.
|
||||
'./crashpad_handler',
|
||||
# Skip because these are outputs that we don't need.
|
||||
'resources/inspector',
|
||||
'gen/third_party/devtools-frontend/src',
|
||||
'gen/ui/webui'
|
||||
]
|
||||
|
||||
def skip_path(dep, dist_zip, target_cpu):
|
||||
@@ -53,12 +36,7 @@ def skip_path(dep, dist_zip, target_cpu):
|
||||
should_skip = (
|
||||
any(dep.startswith(path) for path in PATHS_TO_SKIP) or
|
||||
any(dep.endswith(ext) for ext in EXTENSIONS_TO_SKIP) or
|
||||
(
|
||||
"arm" in target_cpu
|
||||
and dist_zip == "mksnapshot.zip"
|
||||
and dep == "snapshot_blob.bin"
|
||||
)
|
||||
)
|
||||
('arm' in target_cpu and dist_zip == 'mksnapshot.zip' and dep == 'snapshot_blob.bin'))
|
||||
if should_skip:
|
||||
print("Skipping {}".format(dep))
|
||||
return should_skip
|
||||
@@ -72,7 +50,7 @@ def execute(argv):
|
||||
raise e
|
||||
|
||||
def main(argv):
|
||||
dist_zip, runtime_deps, target_cpu, _, flatten_val, flatten_relative_to = argv
|
||||
dist_zip, runtime_deps, target_cpu, target_os, flatten_val = argv
|
||||
should_flatten = flatten_val == "true"
|
||||
dist_files = set()
|
||||
with open(runtime_deps) as f:
|
||||
@@ -83,35 +61,17 @@ def main(argv):
|
||||
if sys.platform == 'darwin' and not should_flatten:
|
||||
execute(['zip', '-r', '-y', dist_zip] + list(dist_files))
|
||||
else:
|
||||
with zipfile.ZipFile(
|
||||
dist_zip, 'w', zipfile.ZIP_DEFLATED, allowZip64=True
|
||||
) as z:
|
||||
with zipfile.ZipFile(dist_zip, 'w', zipfile.ZIP_DEFLATED, allowZip64=True) as z:
|
||||
for dep in dist_files:
|
||||
if os.path.isdir(dep):
|
||||
for root, _, files in os.walk(dep):
|
||||
for filename in files:
|
||||
z.write(os.path.join(root, filename))
|
||||
for root, dirs, files in os.walk(dep):
|
||||
for file in files:
|
||||
z.write(os.path.join(root, file))
|
||||
else:
|
||||
basename = os.path.basename(dep)
|
||||
dirname = os.path.dirname(dep)
|
||||
arcname = (
|
||||
os.path.join(dirname, 'chrome-sandbox')
|
||||
if basename == 'chrome_sandbox'
|
||||
else dep
|
||||
)
|
||||
name_to_write = arcname
|
||||
if should_flatten:
|
||||
if flatten_relative_to:
|
||||
if name_to_write.startswith(flatten_relative_to):
|
||||
name_to_write = name_to_write[len(flatten_relative_to):]
|
||||
else:
|
||||
name_to_write = os.path.basename(arcname)
|
||||
else:
|
||||
name_to_write = os.path.basename(arcname)
|
||||
z.write(
|
||||
dep,
|
||||
name_to_write,
|
||||
)
|
||||
arcname = os.path.join(dirname, 'chrome-sandbox') if basename == 'chrome_sandbox' else dep
|
||||
z.write(dep, os.path.basename(arcname) if should_flatten else arcname)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
def execute(argv):
|
||||
try:
|
||||
output = subprocess.check_output(argv, stderr=subprocess.STDOUT)
|
||||
return output
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(e.output)
|
||||
raise e
|
||||
|
||||
def get_object_files(base_path, archive_name):
|
||||
archive_file = os.path.join(base_path, archive_name)
|
||||
output = execute(['nm', '-g', archive_file]).decode('ascii')
|
||||
object_files = set()
|
||||
lines = output.split("\n")
|
||||
for line in lines:
|
||||
if line.startswith(base_path):
|
||||
object_file = line.split(":")[0]
|
||||
object_files.add(object_file)
|
||||
if line.startswith('nm: '):
|
||||
object_file = line.split(":")[1].lstrip()
|
||||
object_files.add(object_file)
|
||||
return list(object_files) + [archive_file]
|
||||
|
||||
def main(argv):
|
||||
dist_zip, = argv
|
||||
out_dir = os.path.dirname(dist_zip)
|
||||
base_path_libcxx = os.path.join(out_dir, 'obj/buildtools/third_party/libc++')
|
||||
base_path_libcxxabi = os.path.join(out_dir, 'obj/buildtools/third_party/libc++abi')
|
||||
object_files_libcxx = get_object_files(base_path_libcxx, 'libc++.a')
|
||||
object_files_libcxxabi = get_object_files(base_path_libcxxabi, 'libc++abi.a')
|
||||
with zipfile.ZipFile(
|
||||
dist_zip, 'w', zipfile.ZIP_DEFLATED, allowZip64=True
|
||||
) as z:
|
||||
object_files_libcxx.sort()
|
||||
for object_file in object_files_libcxx:
|
||||
z.write(object_file, os.path.relpath(object_file, base_path_libcxx))
|
||||
for object_file in object_files_libcxxabi:
|
||||
z.write(object_file, os.path.relpath(object_file, base_path_libcxxabi))
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
@@ -12,14 +12,15 @@ buildflag_header("buildflags") {
|
||||
"ENABLE_DESKTOP_CAPTURER=$enable_desktop_capturer",
|
||||
"ENABLE_RUN_AS_NODE=$enable_run_as_node",
|
||||
"ENABLE_OSR=$enable_osr",
|
||||
"ENABLE_VIEWS_API=$enable_views_api",
|
||||
"ENABLE_REMOTE_MODULE=$enable_remote_module",
|
||||
"ENABLE_VIEW_API=$enable_view_api",
|
||||
"ENABLE_PEPPER_FLASH=$enable_pepper_flash",
|
||||
"ENABLE_PDF_VIEWER=$enable_pdf_viewer",
|
||||
"ENABLE_TTS=$enable_tts",
|
||||
"ENABLE_COLOR_CHOOSER=$enable_color_chooser",
|
||||
"ENABLE_ELECTRON_EXTENSIONS=$enable_electron_extensions",
|
||||
"ENABLE_BUILTIN_SPELLCHECKER=$enable_builtin_spellchecker",
|
||||
"ENABLE_PICTURE_IN_PICTURE=$enable_picture_in_picture",
|
||||
"ENABLE_WIN_DARK_MODE_WINDOW_UI=$enable_win_dark_mode_window_ui",
|
||||
"OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,9 +10,11 @@ declare_args() {
|
||||
|
||||
enable_osr = true
|
||||
|
||||
enable_views_api = true
|
||||
enable_remote_module = true
|
||||
|
||||
enable_pdf_viewer = true
|
||||
enable_view_api = false
|
||||
|
||||
enable_pdf_viewer = false
|
||||
|
||||
enable_tts = true
|
||||
|
||||
@@ -26,12 +28,12 @@ declare_args() {
|
||||
# Should not be enabled for release build.
|
||||
enable_fake_location_provider = !is_official_build
|
||||
|
||||
# Enable flash plugin support.
|
||||
enable_pepper_flash = true
|
||||
|
||||
# Enable Chrome extensions support.
|
||||
enable_electron_extensions = true
|
||||
enable_electron_extensions = false
|
||||
|
||||
# Enable Spellchecker support
|
||||
enable_builtin_spellchecker = true
|
||||
|
||||
# Undocumented Windows dark mode API
|
||||
enable_win_dark_mode_window_ui = false
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Use of this source code is governed by the MIT license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/ozone.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("//components/spellcheck/spellcheck_build_features.gni")
|
||||
import("//electron/buildflags/buildflags.gni")
|
||||
@@ -13,8 +12,6 @@ import("//third_party/widevine/cdm/widevine.gni")
|
||||
static_library("chrome") {
|
||||
visibility = [ "//electron:electron_lib" ]
|
||||
sources = [
|
||||
"//chrome/browser/accessibility/accessibility_ui.cc",
|
||||
"//chrome/browser/accessibility/accessibility_ui.h",
|
||||
"//chrome/browser/browser_process.cc",
|
||||
"//chrome/browser/browser_process.h",
|
||||
"//chrome/browser/devtools/devtools_contents_resizing_strategy.cc",
|
||||
@@ -25,10 +22,18 @@ static_library("chrome") {
|
||||
"//chrome/browser/devtools/devtools_file_system_indexer.h",
|
||||
"//chrome/browser/extensions/global_shortcut_listener.cc",
|
||||
"//chrome/browser/extensions/global_shortcut_listener.h",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_mac.h",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_mac.mm",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_win.cc",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_win.h",
|
||||
"//chrome/browser/icon_loader.cc",
|
||||
"//chrome/browser/icon_loader.h",
|
||||
"//chrome/browser/icon_loader_mac.mm",
|
||||
"//chrome/browser/icon_loader_win.cc",
|
||||
"//chrome/browser/icon_manager.cc",
|
||||
"//chrome/browser/icon_manager.h",
|
||||
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
|
||||
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
|
||||
"//chrome/browser/net/chrome_mojo_proxy_resolver_factory.cc",
|
||||
"//chrome/browser/net/chrome_mojo_proxy_resolver_factory.h",
|
||||
"//chrome/browser/net/proxy_config_monitor.cc",
|
||||
@@ -43,78 +48,34 @@ static_library("chrome") {
|
||||
"//chrome/browser/predictors/proxy_lookup_client_impl.h",
|
||||
"//chrome/browser/predictors/resolve_host_client_impl.cc",
|
||||
"//chrome/browser/predictors/resolve_host_client_impl.h",
|
||||
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc",
|
||||
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h",
|
||||
"//chrome/browser/ssl/security_state_tab_helper.cc",
|
||||
"//chrome/browser/ssl/security_state_tab_helper.h",
|
||||
"//chrome/browser/ssl/tls_deprecation_config.cc",
|
||||
"//chrome/browser/ui/autofill/popup_view_common.cc",
|
||||
"//chrome/browser/ui/autofill/popup_view_common.h",
|
||||
"//chrome/browser/win/chrome_process_finder.cc",
|
||||
"//chrome/browser/win/chrome_process_finder.h",
|
||||
"//extensions/browser/app_window/size_constraints.cc",
|
||||
"//extensions/browser/app_window/size_constraints.h",
|
||||
]
|
||||
|
||||
if (is_mac) {
|
||||
sources += [
|
||||
"//chrome/browser/extensions/global_shortcut_listener_mac.h",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_mac.mm",
|
||||
"//chrome/browser/icon_loader_mac.mm",
|
||||
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
|
||||
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
sources += [
|
||||
"//chrome/browser/extensions/global_shortcut_listener_win.cc",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_win.h",
|
||||
"//chrome/browser/icon_loader_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",
|
||||
]
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
"//chrome/browser:dev_ui_browser_resources",
|
||||
"//chrome/common",
|
||||
"//chrome/common:version_header",
|
||||
"//components/keyed_service/content",
|
||||
"//components/paint_preview/buildflags",
|
||||
"//components/proxy_config",
|
||||
"//components/security_state/content",
|
||||
"//content/public/browser",
|
||||
"//services/strings",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//chrome/browser:resource_prefetch_predictor_proto",
|
||||
"//chrome/services/speech:buildflags",
|
||||
"//components/optimization_guide/proto:optimization_guide_proto",
|
||||
"//components/feature_engagement:buildflags",
|
||||
]
|
||||
|
||||
if (enable_basic_printing && is_win) {
|
||||
deps += [ "//chrome/common:cloud_print_utility_mojom" ]
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
|
||||
if (use_x11 || use_ozone) {
|
||||
sources +=
|
||||
[ "//chrome/browser/extensions/global_shortcut_listener_linux.cc" ]
|
||||
}
|
||||
if (use_x11) {
|
||||
sources += [
|
||||
"//chrome/browser/extensions/global_shortcut_listener_x11.cc",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_x11.h",
|
||||
]
|
||||
}
|
||||
if (use_ozone) {
|
||||
deps += [ "//ui/ozone" ]
|
||||
sources += [
|
||||
"//chrome/browser/extensions/global_shortcut_listener_ozone.cc",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_ozone.h",
|
||||
]
|
||||
}
|
||||
sources += [
|
||||
"//chrome/browser/extensions/global_shortcut_listener_x11.cc",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_x11.h",
|
||||
"//chrome/browser/ui/views/status_icons/concat_menu_model.cc",
|
||||
"//chrome/browser/ui/views/status_icons/concat_menu_model.h",
|
||||
"//chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc",
|
||||
@@ -126,14 +87,6 @@ static_library("chrome") {
|
||||
]
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
sources += [
|
||||
"//chrome/browser/win/icon_reader_service.cc",
|
||||
"//chrome/browser/win/icon_reader_service.h",
|
||||
]
|
||||
public_deps += [ "//chrome/services/util_win:lib" ]
|
||||
}
|
||||
|
||||
if (enable_desktop_capturer) {
|
||||
sources += [
|
||||
"//chrome/browser/media/webrtc/desktop_media_list.h",
|
||||
@@ -149,31 +102,18 @@ static_library("chrome") {
|
||||
|
||||
if (enable_color_chooser) {
|
||||
sources += [
|
||||
"//chrome/browser/devtools/devtools_eye_dropper.cc",
|
||||
"//chrome/browser/devtools/devtools_eye_dropper.h",
|
||||
"//chrome/browser/platform_util.cc",
|
||||
"//chrome/browser/platform_util.h",
|
||||
"//chrome/browser/ui/browser_dialogs.h",
|
||||
"//chrome/browser/ui/color_chooser.h",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.cc",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.h",
|
||||
]
|
||||
|
||||
if (use_aura) {
|
||||
sources += [
|
||||
"//chrome/browser/platform_util_aura.cc",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_aura.cc",
|
||||
"//chrome/browser/ui/views/color_chooser_aura.cc",
|
||||
"//chrome/browser/ui/views/color_chooser_aura.h",
|
||||
]
|
||||
|
||||
if (!is_win) {
|
||||
sources += [
|
||||
"//chrome/browser/ui/views/color_chooser_aura.cc",
|
||||
"//chrome/browser/ui/views/color_chooser_aura.h",
|
||||
]
|
||||
}
|
||||
|
||||
deps += [ "//components/feature_engagement" ]
|
||||
}
|
||||
|
||||
@@ -182,8 +122,6 @@ static_library("chrome") {
|
||||
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
|
||||
"//chrome/browser/ui/cocoa/color_chooser_mac.h",
|
||||
"//chrome/browser/ui/cocoa/color_chooser_mac.mm",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
|
||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
|
||||
]
|
||||
deps += [
|
||||
"//components/remote_cocoa/app_shim",
|
||||
@@ -201,10 +139,17 @@ static_library("chrome") {
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += [ "//chrome/browser/media/webrtc/window_icon_util_linux.cc" ]
|
||||
sources += [ "//chrome/browser/media/webrtc/window_icon_util_x11.cc" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (enable_tts) {
|
||||
sources += [
|
||||
"//chrome/browser/speech/tts_controller_delegate_impl.cc",
|
||||
"//chrome/browser/speech/tts_controller_delegate_impl.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_widevine) {
|
||||
sources += [
|
||||
"//chrome/renderer/media/chrome_key_systems.cc",
|
||||
@@ -225,8 +170,12 @@ static_library("chrome") {
|
||||
"//chrome/browser/printing/print_job_worker.h",
|
||||
"//chrome/browser/printing/print_view_manager_base.cc",
|
||||
"//chrome/browser/printing/print_view_manager_base.h",
|
||||
"//chrome/browser/printing/print_view_manager_basic.cc",
|
||||
"//chrome/browser/printing/print_view_manager_basic.h",
|
||||
"//chrome/browser/printing/printer_query.cc",
|
||||
"//chrome/browser/printing/printer_query.h",
|
||||
"//chrome/browser/printing/printing_message_filter.cc",
|
||||
"//chrome/browser/printing/printing_message_filter.h",
|
||||
"//chrome/browser/printing/printing_service.cc",
|
||||
"//chrome/browser/printing/printing_service.h",
|
||||
]
|
||||
@@ -235,9 +184,9 @@ static_library("chrome") {
|
||||
"//chrome/services/printing:lib",
|
||||
"//components/printing/browser",
|
||||
"//components/printing/renderer",
|
||||
"//components/services/print_compositor",
|
||||
"//components/services/print_compositor/public/cpp",
|
||||
"//components/services/print_compositor/public/mojom",
|
||||
"//components/services/pdf_compositor",
|
||||
"//components/services/pdf_compositor/public/cpp",
|
||||
"//components/services/pdf_compositor/public/mojom",
|
||||
]
|
||||
|
||||
deps += [
|
||||
@@ -261,12 +210,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/close_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/constants.h",
|
||||
"//chrome/browser/ui/views/overlay/hang_up_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/hang_up_button.h",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_views.cc",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_views.h",
|
||||
"//chrome/browser/ui/views/overlay/playback_image_button.cc",
|
||||
@@ -275,10 +220,6 @@ static_library("chrome") {
|
||||
"//chrome/browser/ui/views/overlay/resize_handle_button.h",
|
||||
"//chrome/browser/ui/views/overlay/skip_ad_label_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/skip_ad_label_button.h",
|
||||
"//chrome/browser/ui/views/overlay/toggle_camera_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/toggle_camera_button.h",
|
||||
"//chrome/browser/ui/views/overlay/toggle_microphone_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
|
||||
"//chrome/browser/ui/views/overlay/track_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/track_image_button.h",
|
||||
]
|
||||
@@ -288,84 +229,6 @@ static_library("chrome") {
|
||||
"//components/vector_icons:vector_icons",
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_electron_extensions) {
|
||||
sources += [
|
||||
"//chrome/browser/extensions/chrome_url_request_util.cc",
|
||||
"//chrome/browser/extensions/chrome_url_request_util.h",
|
||||
"//chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc",
|
||||
"//chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h",
|
||||
"//chrome/renderer/extensions/extension_hooks_delegate.cc",
|
||||
"//chrome/renderer/extensions/extension_hooks_delegate.h",
|
||||
"//chrome/renderer/extensions/tabs_hooks_delegate.cc",
|
||||
"//chrome/renderer/extensions/tabs_hooks_delegate.h",
|
||||
]
|
||||
|
||||
if (enable_pdf_viewer) {
|
||||
sources += [
|
||||
"//chrome/browser/pdf/pdf_extension_util.cc",
|
||||
"//chrome/browser/pdf/pdf_extension_util.h",
|
||||
"//chrome/renderer/pepper/chrome_pdf_print_client.cc",
|
||||
"//chrome/renderer/pepper/chrome_pdf_print_client.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_mas_build) {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.h" ]
|
||||
if (is_mac) {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_mac.cc" ]
|
||||
} else if (is_win) {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump_win.cc" ]
|
||||
} else {
|
||||
sources += [ "//chrome/browser/hang_monitor/hang_crash_dump.cc" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
source_set("plugins") {
|
||||
sources = []
|
||||
deps = []
|
||||
frameworks = []
|
||||
|
||||
# browser side
|
||||
sources += [
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc",
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
|
||||
]
|
||||
deps += [
|
||||
"//media:media_buildflags",
|
||||
"//ppapi/buildflags",
|
||||
"//ppapi/proxy:ipc",
|
||||
"//services/device/public/mojom",
|
||||
]
|
||||
if (enable_pdf_viewer) {
|
||||
deps += [ "//components/pdf/browser" ]
|
||||
}
|
||||
|
||||
# renderer side
|
||||
sources += [
|
||||
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc",
|
||||
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.h",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
||||
]
|
||||
if (enable_pdf_viewer) {
|
||||
deps += [ "//components/pdf/renderer" ]
|
||||
}
|
||||
deps += [
|
||||
"//components/strings",
|
||||
"//media:media_buildflags",
|
||||
"//ppapi/host",
|
||||
"//ppapi/proxy",
|
||||
"//ppapi/proxy:ipc",
|
||||
"//ppapi/shared_impl",
|
||||
"//skia",
|
||||
]
|
||||
}
|
||||
|
||||
# This source set is just so we don't have to depend on all of //chrome/browser
|
||||
@@ -375,7 +238,6 @@ source_set("chrome_spellchecker") {
|
||||
sources = []
|
||||
deps = []
|
||||
libs = []
|
||||
public_deps = []
|
||||
|
||||
if (enable_builtin_spellchecker) {
|
||||
sources += [
|
||||
@@ -387,8 +249,8 @@ source_set("chrome_spellchecker") {
|
||||
"//chrome/browser/spellchecker/spellcheck_factory.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_language_blocklist_policy_handler.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_language_blocklist_policy_handler.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_service.cc",
|
||||
@@ -415,11 +277,9 @@ source_set("chrome_spellchecker") {
|
||||
"//components/spellcheck:buildflags",
|
||||
"//components/sync",
|
||||
]
|
||||
|
||||
public_deps += [ "//chrome/common:constants" ]
|
||||
}
|
||||
|
||||
public_deps += [
|
||||
public_deps = [
|
||||
"//components/spellcheck/browser",
|
||||
"//components/spellcheck/common",
|
||||
"//components/spellcheck/renderer",
|
||||
|
||||
@@ -36,7 +36,6 @@ net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
|
||||
// Linux has only a single persistent slot compared to ChromeOS's separate
|
||||
// public and private slot.
|
||||
// Redirect any slot usage to this persistent slot on Linux.
|
||||
crypto::EnsureNSSInit();
|
||||
g_nss_cert_database = new net::NSSCertDatabase(
|
||||
crypto::ScopedPK11Slot(PK11_GetInternalKeySlot()) /* public slot */,
|
||||
crypto::ScopedPK11Slot(PK11_GetInternalKeySlot()) /* private slot */);
|
||||
@@ -70,12 +69,12 @@ net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
|
||||
|
||||
// static
|
||||
void CertificateManagerModel::Create(content::BrowserContext* browser_context,
|
||||
CreationCallback callback) {
|
||||
const CreationCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
base::PostTask(FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&CertificateManagerModel::GetCertDBOnIOThread,
|
||||
browser_context->GetResourceContext(),
|
||||
std::move(callback)));
|
||||
base::PostTask(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&CertificateManagerModel::GetCertDBOnIOThread,
|
||||
browser_context->GetResourceContext(), callback));
|
||||
}
|
||||
|
||||
CertificateManagerModel::CertificateManagerModel(
|
||||
@@ -90,7 +89,7 @@ CertificateManagerModel::~CertificateManagerModel() = default;
|
||||
int CertificateManagerModel::ImportFromPKCS12(
|
||||
PK11SlotInfo* slot_info,
|
||||
const std::string& data,
|
||||
const std::u16string& password,
|
||||
const base::string16& password,
|
||||
bool is_extractable,
|
||||
net::ScopedCERTCertificateList* imported_certs) {
|
||||
return cert_db_->ImportFromPKCS12(slot_info, data, password, is_extractable,
|
||||
@@ -130,17 +129,17 @@ bool CertificateManagerModel::Delete(CERTCertificate* cert) {
|
||||
void CertificateManagerModel::DidGetCertDBOnUIThread(
|
||||
net::NSSCertDatabase* cert_db,
|
||||
bool is_user_db_available,
|
||||
CreationCallback callback) {
|
||||
const CreationCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
|
||||
std::unique_ptr<CertificateManagerModel> model(
|
||||
new CertificateManagerModel(cert_db, is_user_db_available));
|
||||
std::move(callback).Run(std::move(model));
|
||||
callback.Run(std::move(model));
|
||||
}
|
||||
|
||||
// static
|
||||
void CertificateManagerModel::DidGetCertDBOnIOThread(
|
||||
CreationCallback callback,
|
||||
const CreationCallback& callback,
|
||||
net::NSSCertDatabase* cert_db) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
|
||||
@@ -148,23 +147,17 @@ void CertificateManagerModel::DidGetCertDBOnIOThread(
|
||||
base::PostTask(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&CertificateManagerModel::DidGetCertDBOnUIThread, cert_db,
|
||||
is_user_db_available, std::move(callback)));
|
||||
is_user_db_available, callback));
|
||||
}
|
||||
|
||||
// static
|
||||
void CertificateManagerModel::GetCertDBOnIOThread(
|
||||
content::ResourceContext* context,
|
||||
CreationCallback callback) {
|
||||
const CreationCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
|
||||
auto split_callback = base::SplitOnceCallback(base::BindOnce(
|
||||
&CertificateManagerModel::DidGetCertDBOnIOThread, std::move(callback)));
|
||||
|
||||
net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext(
|
||||
context, std::move(split_callback.first));
|
||||
|
||||
// If the NSS database was already available, |cert_db| is non-null and
|
||||
// |did_get_cert_db_callback| has not been called. Call it explicitly.
|
||||
context, base::BindOnce(&CertificateManagerModel::DidGetCertDBOnIOThread,
|
||||
callback));
|
||||
if (cert_db)
|
||||
std::move(split_callback.second).Run(cert_db);
|
||||
DidGetCertDBOnIOThread(callback, cert_db);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "base/callback.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "net/cert/nss_cert_database.h"
|
||||
|
||||
namespace content {
|
||||
@@ -23,14 +24,14 @@ class ResourceContext;
|
||||
// manager dialog, and processes changes from the view.
|
||||
class CertificateManagerModel {
|
||||
public:
|
||||
using CreationCallback =
|
||||
base::OnceCallback<void(std::unique_ptr<CertificateManagerModel>)>;
|
||||
typedef base::Callback<void(std::unique_ptr<CertificateManagerModel>)>
|
||||
CreationCallback;
|
||||
|
||||
// Creates a CertificateManagerModel. The model will be passed to the callback
|
||||
// when it is ready. The caller must ensure the model does not outlive the
|
||||
// |browser_context|.
|
||||
static void Create(content::BrowserContext* browser_context,
|
||||
CreationCallback callback);
|
||||
const CreationCallback& callback);
|
||||
|
||||
~CertificateManagerModel();
|
||||
|
||||
@@ -45,7 +46,7 @@ class CertificateManagerModel {
|
||||
// Returns a net error code on failure.
|
||||
int ImportFromPKCS12(PK11SlotInfo* slot_info,
|
||||
const std::string& data,
|
||||
const std::u16string& password,
|
||||
const base::string16& password,
|
||||
bool is_extractable,
|
||||
net::ScopedCERTCertificateList* imported_certs);
|
||||
|
||||
@@ -99,11 +100,11 @@ class CertificateManagerModel {
|
||||
// file for details.
|
||||
static void DidGetCertDBOnUIThread(net::NSSCertDatabase* cert_db,
|
||||
bool is_user_db_available,
|
||||
CreationCallback callback);
|
||||
static void DidGetCertDBOnIOThread(CreationCallback callback,
|
||||
const CreationCallback& callback);
|
||||
static void DidGetCertDBOnIOThread(const CreationCallback& callback,
|
||||
net::NSSCertDatabase* cert_db);
|
||||
static void GetCertDBOnIOThread(content::ResourceContext* context,
|
||||
CreationCallback callback);
|
||||
const CreationCallback& callback);
|
||||
|
||||
net::NSSCertDatabase* cert_db_;
|
||||
// Whether the certificate database has a public slot associated with the
|
||||
|
||||
@@ -127,11 +127,10 @@ class ProcessSingleton {
|
||||
NotificationCallback notification_callback_; // Handler for notifications.
|
||||
|
||||
#if defined(OS_WIN)
|
||||
HWND remote_window_ = nullptr; // The HWND_MESSAGE of another browser.
|
||||
HWND remote_window_; // The HWND_MESSAGE of another browser.
|
||||
base::win::MessageWindow window_; // The message-only window.
|
||||
bool is_virtualized_ =
|
||||
false; // Stuck inside Microsoft Softricity VM environment.
|
||||
HANDLE lock_file_ = INVALID_HANDLE_VALUE;
|
||||
bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment.
|
||||
HANDLE lock_file_;
|
||||
base::FilePath user_data_dir_;
|
||||
ShouldKillRemoteProcessCallback should_kill_remote_process_callback_;
|
||||
#elif defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||
@@ -158,7 +157,7 @@ class ProcessSingleton {
|
||||
|
||||
// Function to call when the other process is hung and needs to be killed.
|
||||
// Allows overriding for tests.
|
||||
base::RepeatingCallback<void(int)> kill_callback_;
|
||||
base::Callback<void(int)> kill_callback_;
|
||||
|
||||
// Path in file system to the socket.
|
||||
base::FilePath socket_path_;
|
||||
@@ -176,7 +175,7 @@ class ProcessSingleton {
|
||||
// because it posts messages between threads.
|
||||
class LinuxWatcher;
|
||||
scoped_refptr<LinuxWatcher> watcher_;
|
||||
int sock_ = -1;
|
||||
int sock_;
|
||||
bool listen_on_ready_ = false;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/posix/eintr_wrapper.h"
|
||||
@@ -333,7 +334,7 @@ bool IsChromeProcess(pid_t pid) {
|
||||
// A helper class to hold onto a socket.
|
||||
class ScopedSocket {
|
||||
public:
|
||||
ScopedSocket() { Reset(); }
|
||||
ScopedSocket() : fd_(-1) { Reset(); }
|
||||
~ScopedSocket() { Close(); }
|
||||
int fd() { return fd_; }
|
||||
void Reset() {
|
||||
@@ -347,7 +348,7 @@ class ScopedSocket {
|
||||
}
|
||||
|
||||
private:
|
||||
int fd_ = -1;
|
||||
int fd_;
|
||||
};
|
||||
|
||||
// Returns a random string for uniquifying profile connections.
|
||||
@@ -360,7 +361,7 @@ bool CheckCookie(const base::FilePath& path, const base::FilePath& cookie) {
|
||||
}
|
||||
|
||||
bool IsAppSandboxed() {
|
||||
#if defined(OS_MAC)
|
||||
#if defined(OS_MACOSX)
|
||||
// NB: There is no sane API for this, we have to just guess by
|
||||
// reading tea leaves
|
||||
base::FilePath home_dir;
|
||||
@@ -371,7 +372,7 @@ bool IsAppSandboxed() {
|
||||
return home_dir.value().find("Library/Containers") != std::string::npos;
|
||||
#else
|
||||
return false;
|
||||
#endif // defined(OS_MAC)
|
||||
#endif // defined(OS_MACOSX)
|
||||
}
|
||||
|
||||
bool ConnectSocket(ScopedSocket* socket,
|
||||
@@ -421,7 +422,7 @@ bool ConnectSocket(ScopedSocket* socket,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_MAC)
|
||||
#if defined(OS_MACOSX)
|
||||
bool ReplaceOldSingletonLock(const base::FilePath& symlink_content,
|
||||
const base::FilePath& lock_path) {
|
||||
// Try taking an flock(2) on the file. Failure means the lock is taken so we
|
||||
@@ -447,14 +448,14 @@ bool ReplaceOldSingletonLock(const base::FilePath& symlink_content,
|
||||
// lock. We never flock() the lock file from now on. I.e. we assume that an
|
||||
// old version of Chrome will not run with the same user data dir after this
|
||||
// version has run.
|
||||
if (!base::DeleteFile(lock_path)) {
|
||||
if (!base::DeleteFile(lock_path, false)) {
|
||||
PLOG(ERROR) << "Could not delete old singleton lock.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return SymlinkPath(symlink_content, lock_path);
|
||||
}
|
||||
#endif // defined(OS_MAC)
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -473,7 +474,10 @@ class ProcessSingleton::LinuxWatcher
|
||||
SocketReader(ProcessSingleton::LinuxWatcher* parent,
|
||||
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
|
||||
int fd)
|
||||
: parent_(parent), ui_task_runner_(ui_task_runner), fd_(fd) {
|
||||
: parent_(parent),
|
||||
ui_task_runner_(ui_task_runner),
|
||||
fd_(fd),
|
||||
bytes_read_(0) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
// Wait for reads.
|
||||
fd_watch_controller_ = base::FileDescriptorWatcher::WatchReadable(
|
||||
@@ -505,20 +509,20 @@ class ProcessSingleton::LinuxWatcher
|
||||
fd_watch_controller_;
|
||||
|
||||
// The ProcessSingleton::LinuxWatcher that owns us.
|
||||
ProcessSingleton::LinuxWatcher* const parent_ = nullptr;
|
||||
ProcessSingleton::LinuxWatcher* const parent_;
|
||||
|
||||
// A reference to the UI task runner.
|
||||
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
|
||||
|
||||
// The file descriptor we're reading.
|
||||
const int fd_ = -1;
|
||||
const int fd_;
|
||||
|
||||
// Store the message in this buffer.
|
||||
char buf_[kMaxMessageLength];
|
||||
|
||||
// Tracks the number of bytes we've read in case we're getting partial
|
||||
// reads.
|
||||
size_t bytes_read_ = 0;
|
||||
size_t bytes_read_;
|
||||
|
||||
base::OneShotTimer timer_;
|
||||
|
||||
@@ -823,9 +827,10 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
to_send.append(current_dir.value());
|
||||
|
||||
const std::vector<std::string>& argv = electron::ElectronCommandLine::argv();
|
||||
for (const auto& arg : argv) {
|
||||
for (std::vector<std::string>::const_iterator it = argv.begin();
|
||||
it != argv.end(); ++it) {
|
||||
to_send.push_back(kTokenDelimiter);
|
||||
to_send.append(arg);
|
||||
to_send.append(*it);
|
||||
}
|
||||
|
||||
// Send the message
|
||||
@@ -966,7 +971,7 @@ bool ProcessSingleton::Create() {
|
||||
if (!SymlinkPath(symlink_content, lock_path_)) {
|
||||
// TODO(jackhou): Remove this case once this code is stable on Mac.
|
||||
// http://crbug.com/367612
|
||||
#if defined(OS_MAC)
|
||||
#if defined(OS_MACOSX)
|
||||
// On Mac, an existing non-symlink lock file means the lock could be held by
|
||||
// the old process singleton code. If we can successfully replace the lock,
|
||||
// continue as normal.
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "chrome/browser/process_singleton.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "base/base_paths.h"
|
||||
@@ -173,6 +172,8 @@ ProcessSingleton::ProcessSingleton(
|
||||
const base::FilePath& user_data_dir,
|
||||
const NotificationCallback& notification_callback)
|
||||
: notification_callback_(notification_callback),
|
||||
is_virtualized_(false),
|
||||
lock_file_(INVALID_HANDLE_VALUE),
|
||||
user_data_dir_(user_data_dir),
|
||||
should_kill_remote_process_callback_(
|
||||
base::BindRepeating(&TerminateAppWithError)) {
|
||||
@@ -196,7 +197,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
|
||||
return PROCESS_NONE;
|
||||
}
|
||||
|
||||
switch (chrome::AttemptToNotifyRunningChrome(remote_window_)) {
|
||||
switch (chrome::AttemptToNotifyRunningChrome(remote_window_, false)) {
|
||||
case chrome::NOTIFY_SUCCESS:
|
||||
return PROCESS_NOTIFIED;
|
||||
case chrome::NOTIFY_FAILED:
|
||||
|
||||
@@ -24,21 +24,22 @@ GlobalMenuBarRegistrarX11* GlobalMenuBarRegistrarX11::GetInstance() {
|
||||
return base::Singleton<GlobalMenuBarRegistrarX11>::get();
|
||||
}
|
||||
|
||||
void GlobalMenuBarRegistrarX11::OnWindowMapped(x11::Window window) {
|
||||
live_windows_.insert(window);
|
||||
void GlobalMenuBarRegistrarX11::OnWindowMapped(unsigned long xid) {
|
||||
live_xids_.insert(xid);
|
||||
|
||||
if (registrar_proxy_)
|
||||
RegisterXWindow(window);
|
||||
RegisterXID(xid);
|
||||
}
|
||||
|
||||
void GlobalMenuBarRegistrarX11::OnWindowUnmapped(x11::Window window) {
|
||||
void GlobalMenuBarRegistrarX11::OnWindowUnmapped(unsigned long xid) {
|
||||
if (registrar_proxy_)
|
||||
UnregisterXWindow(window);
|
||||
UnregisterXID(xid);
|
||||
|
||||
live_windows_.erase(window);
|
||||
live_xids_.erase(xid);
|
||||
}
|
||||
|
||||
GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11() {
|
||||
GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11()
|
||||
: registrar_proxy_(nullptr) {
|
||||
// libdbusmenu uses the gio version of dbus; I tried using the code in dbus/,
|
||||
// but it looks like that's isn't sharing the bus name with the gio version,
|
||||
// even when |connection_type| is set to SHARED.
|
||||
@@ -62,9 +63,9 @@ GlobalMenuBarRegistrarX11::~GlobalMenuBarRegistrarX11() {
|
||||
}
|
||||
}
|
||||
|
||||
void GlobalMenuBarRegistrarX11::RegisterXWindow(x11::Window window) {
|
||||
void GlobalMenuBarRegistrarX11::RegisterXID(unsigned long xid) {
|
||||
DCHECK(registrar_proxy_);
|
||||
std::string path = electron::GlobalMenuBarX11::GetPathForWindow(window);
|
||||
std::string path = electron::GlobalMenuBarX11::GetPathForWindow(xid);
|
||||
|
||||
ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/314087
|
||||
// TODO(erg): The mozilla implementation goes to a lot of callback trouble
|
||||
@@ -75,13 +76,13 @@ void GlobalMenuBarRegistrarX11::RegisterXWindow(x11::Window window) {
|
||||
// I don't see any reason why we should care if "RegisterWindow" completes or
|
||||
// not.
|
||||
g_dbus_proxy_call(registrar_proxy_, "RegisterWindow",
|
||||
g_variant_new("(uo)", window, path.c_str()),
|
||||
g_variant_new("(uo)", xid, path.c_str()),
|
||||
G_DBUS_CALL_FLAGS_NONE, -1, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
void GlobalMenuBarRegistrarX11::UnregisterXWindow(x11::Window window) {
|
||||
void GlobalMenuBarRegistrarX11::UnregisterXID(unsigned long xid) {
|
||||
DCHECK(registrar_proxy_);
|
||||
std::string path = electron::GlobalMenuBarX11::GetPathForWindow(window);
|
||||
std::string path = electron::GlobalMenuBarX11::GetPathForWindow(xid);
|
||||
|
||||
ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/314087
|
||||
// TODO(erg): The mozilla implementation goes to a lot of callback trouble
|
||||
@@ -92,7 +93,7 @@ void GlobalMenuBarRegistrarX11::UnregisterXWindow(x11::Window window) {
|
||||
// I don't see any reason why we should care if "UnregisterWindow" completes
|
||||
// or not.
|
||||
g_dbus_proxy_call(registrar_proxy_, "UnregisterWindow",
|
||||
g_variant_new("(u)", window), G_DBUS_CALL_FLAGS_NONE, -1,
|
||||
g_variant_new("(u)", xid), G_DBUS_CALL_FLAGS_NONE, -1,
|
||||
nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
@@ -119,9 +120,10 @@ void GlobalMenuBarRegistrarX11::OnProxyCreated(GObject* source,
|
||||
|
||||
void GlobalMenuBarRegistrarX11::OnNameOwnerChanged(GObject* /* ignored */,
|
||||
GParamSpec* /* ignored */) {
|
||||
// If the name owner changed, we need to reregister all the live x11::Window
|
||||
// with the system.
|
||||
for (const auto& window : live_windows_) {
|
||||
RegisterXWindow(window);
|
||||
// If the name owner changed, we need to reregister all the live xids with
|
||||
// the system.
|
||||
for (std::set<unsigned long>::const_iterator it = live_xids_.begin();
|
||||
it != live_xids_.end(); ++it) {
|
||||
RegisterXID(*it);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,20 +12,19 @@
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/singleton.h"
|
||||
#include "ui/base/glib/glib_signal.h"
|
||||
#include "ui/gfx/x/xproto.h"
|
||||
|
||||
// Advertises our menu bars to Unity.
|
||||
//
|
||||
// GlobalMenuBarX11 is responsible for managing the DbusmenuServer for each
|
||||
// x11::Window. We need a separate object to own the dbus channel to
|
||||
// XID. We need a separate object to own the dbus channel to
|
||||
// com.canonical.AppMenu.Registrar and to register/unregister the mapping
|
||||
// between a x11::Window and the DbusmenuServer instance we are offering.
|
||||
// between a XID and the DbusmenuServer instance we are offering.
|
||||
class GlobalMenuBarRegistrarX11 {
|
||||
public:
|
||||
static GlobalMenuBarRegistrarX11* GetInstance();
|
||||
|
||||
void OnWindowMapped(x11::Window window);
|
||||
void OnWindowUnmapped(x11::Window window);
|
||||
void OnWindowMapped(unsigned long xid);
|
||||
void OnWindowUnmapped(unsigned long xid);
|
||||
|
||||
private:
|
||||
friend struct base::DefaultSingletonTraits<GlobalMenuBarRegistrarX11>;
|
||||
@@ -34,8 +33,8 @@ class GlobalMenuBarRegistrarX11 {
|
||||
~GlobalMenuBarRegistrarX11();
|
||||
|
||||
// Sends the actual message.
|
||||
void RegisterXWindow(x11::Window window);
|
||||
void UnregisterXWindow(x11::Window window);
|
||||
void RegisterXID(unsigned long xid);
|
||||
void UnregisterXID(unsigned long xid);
|
||||
|
||||
CHROMEG_CALLBACK_1(GlobalMenuBarRegistrarX11,
|
||||
void,
|
||||
@@ -48,11 +47,11 @@ class GlobalMenuBarRegistrarX11 {
|
||||
GObject*,
|
||||
GParamSpec*);
|
||||
|
||||
GDBusProxy* registrar_proxy_ = nullptr;
|
||||
GDBusProxy* registrar_proxy_;
|
||||
|
||||
// x11::Window which want to be registered, but haven't yet been because
|
||||
// Window XIDs which want to be registered, but haven't yet been because
|
||||
// we're waiting for the proxy to become available.
|
||||
std::set<x11::Window> live_windows_;
|
||||
std::set<unsigned long> live_xids_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(GlobalMenuBarRegistrarX11);
|
||||
};
|
||||
|
||||
62
components/pepper_flash/BUILD.gn
Normal file
62
components/pepper_flash/BUILD.gn
Normal file
@@ -0,0 +1,62 @@
|
||||
# Copyright (c) 2018 GitHub, Inc.
|
||||
# Use of this source code is governed by the MIT license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
component("pepper_flash") {
|
||||
visibility = [ "//electron:electron_lib" ]
|
||||
defines = [ "IS_PEPPER_FLASH_IMPL" ]
|
||||
sources = [
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc",
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
|
||||
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc",
|
||||
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_fullscreen_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_fullscreen_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_menu_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_menu_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_renderer_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_renderer_host.h",
|
||||
"//chrome/renderer/pepper/pepper_helper.cc",
|
||||
"//chrome/renderer/pepper/pepper_helper.h",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
||||
]
|
||||
deps = [
|
||||
"//content/public/browser",
|
||||
"//content/public/renderer",
|
||||
"//media:media_buildflags",
|
||||
"//ppapi/host",
|
||||
"//ppapi/proxy",
|
||||
"//ppapi/proxy:ipc",
|
||||
"//ppapi/shared_impl",
|
||||
"//services/device/public/mojom",
|
||||
"//skia",
|
||||
"//third_party/adobe/flash:flapper_version_h",
|
||||
"//ui/base",
|
||||
"//ui/base/clipboard",
|
||||
]
|
||||
if (is_mac) {
|
||||
sources += [
|
||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.h",
|
||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.mm",
|
||||
]
|
||||
libs = [ "CoreGraphics.framework" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
deps += [ "//components/services/font/public/cpp" ]
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
|
||||
let mainWindow: BrowserWindow | null = null;
|
||||
|
||||
app.allowRendererProcessReuse = true;
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', () => {
|
||||
app.quit();
|
||||
@@ -30,29 +31,31 @@ function isTrustedSender (webContents: Electron.WebContents) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return url.fileURLToPath(webContents.getURL()) === indexPath;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const parsedUrl = new URL(webContents.getURL());
|
||||
const urlPath = process.platform === 'win32'
|
||||
// Strip the prefixed "/" that occurs on windows
|
||||
? path.resolve(parsedUrl.pathname.substr(1))
|
||||
: parsedUrl.pathname;
|
||||
return parsedUrl.protocol === 'file:' && urlPath === indexPath;
|
||||
}
|
||||
|
||||
ipcMain.handle('bootstrap', (event) => {
|
||||
return isTrustedSender(event.sender) ? electronPath : null;
|
||||
});
|
||||
|
||||
async function createWindow (backgroundColor?: string) {
|
||||
async function createWindow () {
|
||||
await app.whenReady();
|
||||
|
||||
const options: Electron.BrowserWindowConstructorOptions = {
|
||||
width: 960,
|
||||
height: 620,
|
||||
width: 900,
|
||||
height: 600,
|
||||
autoHideMenuBar: true,
|
||||
backgroundColor,
|
||||
backgroundColor: '#FFFFFF',
|
||||
webPreferences: {
|
||||
preload: path.resolve(__dirname, 'preload.js'),
|
||||
contextIsolation: true,
|
||||
sandbox: true
|
||||
sandbox: true,
|
||||
enableRemoteModule: false
|
||||
},
|
||||
useContentSize: true,
|
||||
show: false
|
||||
@@ -95,7 +98,7 @@ export const loadURL = async (appUrl: string) => {
|
||||
};
|
||||
|
||||
export const loadFile = async (appPath: string) => {
|
||||
mainWindow = await createWindow(appPath === 'index.html' ? '#2f3241' : undefined);
|
||||
mainWindow = await createWindow();
|
||||
mainWindow.loadFile(appPath);
|
||||
mainWindow.focus();
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
<head>
|
||||
<title>Electron</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'; trusted-types electron-default-app" />
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-6PH54BfkNq/EMMhUY7nhHf3c+AxloOwfy7hWyT01CM8='; style-src 'self'; img-src 'self'; connect-src 'self'" />
|
||||
<link href="./styles.css" type="text/css" rel="stylesheet" />
|
||||
<link href="./octicon/build.css" type="text/css" rel="stylesheet" />
|
||||
@@ -54,31 +53,31 @@
|
||||
<nav>
|
||||
<div class="linkcol">
|
||||
<a class="hero-link" target="_blank" href="https://electronjs.org/blog">
|
||||
<span class="octicon hero-octicon octicon-code-square-24" aria-hidden="true"></span>
|
||||
<span class="octicon hero-octicon octicon-gist" aria-hidden="true"></span>
|
||||
<h4>Blog</h4>
|
||||
</a>
|
||||
</div>
|
||||
<div class="linkcol">
|
||||
<a class="hero-link" target="_blank" href="https://github.com/electron/electron">
|
||||
<span class="octicon hero-octicon octicon-mark-github-16" aria-hidden="true"></span>
|
||||
<span class="octicon hero-octicon octicon-mark-github" aria-hidden="true"></span>
|
||||
<h4>Repository</h4>
|
||||
</a>
|
||||
</div>
|
||||
<div class="linkcol">
|
||||
<a class="hero-link" target="_blank" href="https://electronjs.org/docs">
|
||||
<span class="octicon hero-octicon octicon-book-24" aria-hidden="true"></span>
|
||||
<span class="octicon hero-octicon octicon-gear" aria-hidden="true"></span>
|
||||
<h4>Docs</h4>
|
||||
</a>
|
||||
</div>
|
||||
<div class="linkcol">
|
||||
<a class="hero-link" target="_blank" href="https://github.com/electron/electron-api-demos">
|
||||
<span class="octicon hero-octicon octicon-star-fill-24" aria-hidden="true"></span>
|
||||
<span class="octicon hero-octicon octicon-star" aria-hidden="true"></span>
|
||||
<h4>API Demos</h4>
|
||||
</a>
|
||||
</div>
|
||||
<div class="linkcol">
|
||||
<a class="hero-link" target="_blank" href="https://electronforge.io">
|
||||
<span class="octicon hero-octicon octicon-gift-24" aria-hidden="true"></span>
|
||||
<span class="octicon hero-octicon octicon-gift" aria-hidden="true"></span>
|
||||
<h4>Forge</h4>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import * as electron from 'electron';
|
||||
import { app, dialog } from 'electron';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
const { app, dialog } = electron;
|
||||
|
||||
type DefaultAppOptions = {
|
||||
file: null | string;
|
||||
@@ -109,7 +108,7 @@ function loadApplicationPackage (packagePath: string) {
|
||||
|
||||
try {
|
||||
const filePath = Module._resolveFilename(packagePath, module, true);
|
||||
app.setAppPath(appPath || path.dirname(filePath));
|
||||
app._setDefaultAppPaths(appPath || path.dirname(filePath));
|
||||
} catch (e) {
|
||||
showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${e.message}`);
|
||||
return;
|
||||
@@ -146,90 +145,13 @@ function startRepl () {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Prevent quitting.
|
||||
// prevent quitting
|
||||
app.on('window-all-closed', () => {});
|
||||
|
||||
const GREEN = '32';
|
||||
const colorize = (color: string, s: string) => `\x1b[${color}m${s}\x1b[0m`;
|
||||
const electronVersion = colorize(GREEN, `v${process.versions.electron}`);
|
||||
const nodeVersion = colorize(GREEN, `v${process.versions.node}`);
|
||||
|
||||
console.info(`
|
||||
Welcome to the Electron.js REPL \\[._.]/
|
||||
|
||||
You can access all Electron.js modules here as well as Node.js modules.
|
||||
Using: Node.js ${nodeVersion} and Electron.js ${electronVersion}
|
||||
`);
|
||||
|
||||
const { REPLServer } = require('repl');
|
||||
const repl = new REPLServer({
|
||||
prompt: '> '
|
||||
}).on('exit', () => {
|
||||
const repl = require('repl');
|
||||
repl.start('> ').on('exit', () => {
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
function defineBuiltin (context: any, name: string, getter: Function) {
|
||||
const setReal = (val: any) => {
|
||||
// Deleting the property before re-assigning it disables the
|
||||
// getter/setter mechanism.
|
||||
delete context[name];
|
||||
context[name] = val;
|
||||
};
|
||||
|
||||
Object.defineProperty(context, name, {
|
||||
get: () => {
|
||||
const lib = getter();
|
||||
|
||||
delete context[name];
|
||||
Object.defineProperty(context, name, {
|
||||
get: () => lib,
|
||||
set: setReal,
|
||||
configurable: true,
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
return lib;
|
||||
},
|
||||
set: setReal,
|
||||
configurable: true,
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
|
||||
defineBuiltin(repl.context, 'electron', () => electron);
|
||||
for (const api of Object.keys(electron) as (keyof typeof electron)[]) {
|
||||
defineBuiltin(repl.context, api, () => electron[api]);
|
||||
}
|
||||
|
||||
// Copied from node/lib/repl.js. For better DX, we don't want to
|
||||
// show e.g 'contentTracing' at a higher priority than 'const', so
|
||||
// we only trigger custom tab-completion when no common words are
|
||||
// potentially matches.
|
||||
const commonWords = [
|
||||
'async', 'await', 'break', 'case', 'catch', 'const', 'continue',
|
||||
'debugger', 'default', 'delete', 'do', 'else', 'export', 'false',
|
||||
'finally', 'for', 'function', 'if', 'import', 'in', 'instanceof', 'let',
|
||||
'new', 'null', 'return', 'switch', 'this', 'throw', 'true', 'try',
|
||||
'typeof', 'var', 'void', 'while', 'with', 'yield'
|
||||
];
|
||||
|
||||
const electronBuiltins = [...Object.keys(electron), 'original-fs', 'electron'];
|
||||
|
||||
const defaultComplete = repl.completer;
|
||||
repl.completer = (line: string, callback: Function) => {
|
||||
const lastSpace = line.lastIndexOf(' ');
|
||||
const currentSymbol = line.substring(lastSpace + 1, repl.cursor);
|
||||
|
||||
const filterFn = (c: string) => c.startsWith(currentSymbol);
|
||||
const ignores = commonWords.filter(filterFn);
|
||||
const hits = electronBuiltins.filter(filterFn);
|
||||
|
||||
if (!ignores.length && hits.length) {
|
||||
callback(null, [hits, currentSymbol]);
|
||||
} else {
|
||||
defaultComplete.apply(repl, [line, callback]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Start the specified app if there is one specified in command line, otherwise
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import { ipcRenderer, contextBridge } from 'electron';
|
||||
|
||||
const policy = window.trustedTypes.createPolicy('electron-default-app', {
|
||||
// we trust the SVG contents
|
||||
createHTML: input => input
|
||||
});
|
||||
|
||||
async function getOcticonSvg (name: string) {
|
||||
try {
|
||||
const response = await fetch(`octicon/${name}.svg`);
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = policy.createHTML(await response.text());
|
||||
div.innerHTML = await response.text();
|
||||
return div;
|
||||
} catch {
|
||||
return null;
|
||||
|
||||
@@ -8,7 +8,7 @@ body {
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 15px 30px;
|
||||
margin: 15px 30px 30px 30px;
|
||||
background-color: #2f3241;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
|
||||
33
docs-translations/README.md
Normal file
33
docs-translations/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
## Docs Translations
|
||||
|
||||
This directory once contained unstructured translations of Electron's
|
||||
documentation, but has been deprecated in favor of a new translation process
|
||||
using [Crowdin], a GitHub-friendly platform for collaborative translation.
|
||||
|
||||
For more details, visit the [electron/i18n] repo.
|
||||
|
||||
## Contributing
|
||||
|
||||
If you're interested in helping translate Electron's docs, visit
|
||||
[Crowdin] and log in with your GitHub account. And thanks!
|
||||
|
||||
## Offline Docs
|
||||
|
||||
If you miss having access to Electron's raw markdown files in your preferred
|
||||
language, don't fret! You can still get raw docs, they're just in a
|
||||
different place now. See [electron/i18n/tree/master/content]
|
||||
|
||||
To more easily view and browse offline docs in your language, clone the repo and use [vmd],
|
||||
an Electron-based GitHub-styled markdown viewer:
|
||||
|
||||
```sh
|
||||
npm i -g vmd
|
||||
git clone https://github.com/electron/i18n
|
||||
vmd electron-i18n/content/zh-CN
|
||||
```
|
||||
|
||||
[crowdin.com/project/electron]: https://crowdin.com/project/electron
|
||||
[Crowdin]: https://crowdin.com/project/electron
|
||||
[electron/i18n]: https://github.com/electron/i18n#readme
|
||||
[electron/i18n/tree/master/content]: https://github.com/electron/i18n/tree/master/content
|
||||
[vmd]: http://ghub.io/vmd
|
||||
@@ -18,14 +18,27 @@ an issue:
|
||||
|
||||
## Guides and Tutorials
|
||||
|
||||
### Getting started
|
||||
|
||||
* [Introduction](tutorial/introduction.md)
|
||||
* [Quick Start](tutorial/quick-start.md)
|
||||
* [Process Model](tutorial/process-model.md)
|
||||
|
||||
### Learning the basics
|
||||
|
||||
* [About Electron](tutorial/about.md)
|
||||
* [Setting up the Development Environment](tutorial/development-environment.md)
|
||||
* [Setting up macOS](tutorial/development-environment.md#setting-up-macos)
|
||||
* [Setting up Windows](tutorial/development-environment.md#setting-up-windows)
|
||||
* [Setting up Linux](tutorial/development-environment.md#setting-up-linux)
|
||||
* [Choosing an Editor](tutorial/development-environment.md#a-good-editor)
|
||||
* [Creating your First App](tutorial/first-app.md)
|
||||
* [Installing Electron](tutorial/first-app.md#installing-electron)
|
||||
* [Electron Development in a Nutshell](tutorial/first-app.md#electron-development-in-a-nutshell)
|
||||
* [Running Your App](tutorial/first-app.md#running-your-app)
|
||||
* [Boilerplates and CLIs](tutorial/boilerplates-and-clis.md)
|
||||
* [Boilerplate vs CLI](tutorial/boilerplates-and-clis.md#boilerplate-vs-cli)
|
||||
* [electron-forge](tutorial/boilerplates-and-clis.md#electron-forge)
|
||||
* [electron-builder](tutorial/boilerplates-and-clis.md#electron-builder)
|
||||
* [electron-react-boilerplate](tutorial/boilerplates-and-clis.md#electron-react-boilerplate)
|
||||
* [Other Tools and Boilerplates](tutorial/boilerplates-and-clis.md#other-tools-and-boilerplates)
|
||||
* [Application Architecture](tutorial/application-architecture.md)
|
||||
* [Main and Renderer Processes](tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
* [Using Electron's APIs](tutorial/application-architecture.md#using-electron-apis)
|
||||
* [Using Node.js APIs](tutorial/application-architecture.md#using-nodejs-apis)
|
||||
* [Using Native Node.js Modules](tutorial/using-native-node-modules.md)
|
||||
* Adding Features to Your App
|
||||
* [Notifications](tutorial/notifications.md)
|
||||
* [Recent Documents](tutorial/recent-documents.md)
|
||||
@@ -38,38 +51,29 @@ an issue:
|
||||
* [Represented File for macOS BrowserWindows](tutorial/represented-file.md)
|
||||
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
|
||||
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
|
||||
* [Dark Mode](tutorial/dark-mode.md)
|
||||
* [Web embeds in Electron](tutorial/web-embeds.md)
|
||||
* [Boilerplates and CLIs](tutorial/boilerplates-and-clis.md)
|
||||
* [Boilerplate vs CLI](tutorial/boilerplates-and-clis.md#boilerplate-vs-cli)
|
||||
* [electron-forge](tutorial/boilerplates-and-clis.md#electron-forge)
|
||||
* [electron-builder](tutorial/boilerplates-and-clis.md#electron-builder)
|
||||
* [electron-react-boilerplate](tutorial/boilerplates-and-clis.md#electron-react-boilerplate)
|
||||
* [Other Tools and Boilerplates](tutorial/boilerplates-and-clis.md#other-tools-and-boilerplates)
|
||||
|
||||
### Advanced steps
|
||||
|
||||
* Application Architecture
|
||||
* [Using Native Node.js Modules](tutorial/using-native-node-modules.md)
|
||||
* [Performance Strategies](tutorial/performance.md)
|
||||
* [Security Strategies](tutorial/security.md)
|
||||
* [Process Sandboxing](tutorial/sandbox.md)
|
||||
* [Supporting macOS Dark Mode](tutorial/mojave-dark-mode-guide.md)
|
||||
* [Accessibility](tutorial/accessibility.md)
|
||||
* [Manually Enabling Accessibility Features](tutorial/accessibility.md#manually-enabling-accessibility-features)
|
||||
* [Spectron](tutorial/accessibility.md#spectron)
|
||||
* [Devtron](tutorial/accessibility.md#devtron)
|
||||
* [Enabling Accessibility](tutorial/accessibility.md#enabling-accessibility)
|
||||
* [Testing and Debugging](tutorial/application-debugging.md)
|
||||
* [Debugging the Main Process](tutorial/debugging-main-process.md)
|
||||
* [Debugging with Visual Studio Code](tutorial/debugging-vscode.md)
|
||||
* [Debugging the Main Process with Visual Studio Code](tutorial/debugging-main-process-vscode.md)
|
||||
* [Using Selenium and WebDriver](tutorial/using-selenium-and-webdriver.md)
|
||||
* [Testing on Headless CI Systems (Travis, Jenkins)](tutorial/testing-on-headless-ci.md)
|
||||
* [DevTools Extension](tutorial/devtools-extension.md)
|
||||
* [Automated Testing with a Custom Driver](tutorial/automated-testing-with-a-custom-driver.md)
|
||||
* [REPL](tutorial/repl.md)
|
||||
* [Distribution](tutorial/application-distribution.md)
|
||||
* [Supported Platforms](tutorial/support.md#supported-platforms)
|
||||
* [Code Signing](tutorial/code-signing.md)
|
||||
* [Mac App Store](tutorial/mac-app-store-submission-guide.md)
|
||||
* [Windows Store](tutorial/windows-store-guide.md)
|
||||
* [Snapcraft](tutorial/snapcraft.md)
|
||||
* [Security](tutorial/security.md)
|
||||
* [Reporting Security Issues](tutorial/security.md#reporting-security-issues)
|
||||
* [Chromium Security Issues and Upgrades](tutorial/security.md#chromium-security-issues-and-upgrades)
|
||||
* [Electron Security Warnings](tutorial/security.md#electron-security-warnings)
|
||||
* [Security Checklist](tutorial/security.md#checklist-security-recommendations)
|
||||
* [Updates](tutorial/updates.md)
|
||||
* [Deploying an Update Server](tutorial/updates.md#deploying-an-update-server)
|
||||
* [Implementing Updates in Your App](tutorial/updates.md#implementing-updates-in-your-app)
|
||||
@@ -87,7 +91,14 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* Electron Releases & Developer Feedback
|
||||
* [Versioning Policy](tutorial/electron-versioning.md)
|
||||
* [Release Timelines](tutorial/electron-timelines.md)
|
||||
* [App Feedback Program](tutorial/app-feedback-program.md)
|
||||
* [Packaging App Source Code with asar](tutorial/application-packaging.md)
|
||||
* [Generating asar Archives](tutorial/application-packaging.md#generating-asar-archives)
|
||||
* [Using asar Archives](tutorial/application-packaging.md#using-asar-archives)
|
||||
* [Limitations](tutorial/application-packaging.md#limitations-of-the-node-api)
|
||||
* [Adding Unpacked Files to asar Archives](tutorial/application-packaging.md#adding-unpacked-files-to-asar-archives)
|
||||
* [Testing Widevine CDM](tutorial/testing-widevine-cdm.md)
|
||||
* [Using Pepper Flash Plugin](tutorial/using-pepper-flash-plugin.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -99,8 +110,7 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* [Process Object](api/process.md)
|
||||
* [Supported Command Line Switches](api/command-line-switches.md)
|
||||
* [Environment Variables](api/environment-variables.md)
|
||||
* [Chrome Extensions Support](api/extensions.md)
|
||||
* [Breaking API Changes](breaking-changes.md)
|
||||
* [Breaking API Changes](api/breaking-changes.md)
|
||||
|
||||
### Custom DOM Elements:
|
||||
|
||||
@@ -122,35 +132,30 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* [ipcMain](api/ipc-main.md)
|
||||
* [Menu](api/menu.md)
|
||||
* [MenuItem](api/menu-item.md)
|
||||
* [MessageChannelMain](api/message-channel-main.md)
|
||||
* [MessagePortMain](api/message-port-main.md)
|
||||
* [net](api/net.md)
|
||||
* [netLog](api/net-log.md)
|
||||
* [nativeTheme](api/native-theme.md)
|
||||
* [Notification](api/notification.md)
|
||||
* [powerMonitor](api/power-monitor.md)
|
||||
* [powerSaveBlocker](api/power-save-blocker.md)
|
||||
* [protocol](api/protocol.md)
|
||||
* [screen](api/screen.md)
|
||||
* [session](api/session.md)
|
||||
* [ShareMenu](api/share-menu.md)
|
||||
* [systemPreferences](api/system-preferences.md)
|
||||
* [TouchBar](api/touch-bar.md)
|
||||
* [Tray](api/tray.md)
|
||||
* [webContents](api/web-contents.md)
|
||||
* [webFrameMain](api/web-frame-main.md)
|
||||
|
||||
### Modules for the Renderer Process (Web Page):
|
||||
|
||||
* [contextBridge](api/context-bridge.md)
|
||||
* [desktopCapturer](api/desktop-capturer.md)
|
||||
* [ipcRenderer](api/ipc-renderer.md)
|
||||
* [remote](api/remote.md)
|
||||
* [webFrame](api/web-frame.md)
|
||||
|
||||
### Modules for Both Processes:
|
||||
|
||||
* [clipboard](api/clipboard.md)
|
||||
* [crashReporter](api/crash-reporter.md)
|
||||
* [desktopCapturer](api/desktop-capturer.md)
|
||||
* [nativeImage](api/native-image.md)
|
||||
* [shell](api/shell.md)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ method, i.e.
|
||||
```javascript
|
||||
const { app, globalShortcut } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
// Register a 'CommandOrControl+Y' shortcut listener.
|
||||
globalShortcut.register('CommandOrControl+Y', () => {
|
||||
// Do stuff when Y and either Command/Control is pressed.
|
||||
@@ -35,7 +35,7 @@ Linux and Windows to define some accelerators.
|
||||
Use `Alt` instead of `Option`. The `Option` key only exists on macOS, whereas
|
||||
the `Alt` key is available on all platforms.
|
||||
|
||||
The `Super` (or `Meta`) key is mapped to the `Windows` key on Windows and Linux and
|
||||
The `Super` key is mapped to the `Windows` key on Windows and Linux and
|
||||
`Cmd` on macOS.
|
||||
|
||||
## Available modifiers
|
||||
@@ -48,14 +48,13 @@ The `Super` (or `Meta`) key is mapped to the `Windows` key on Windows and Linux
|
||||
* `AltGr`
|
||||
* `Shift`
|
||||
* `Super`
|
||||
* `Meta`
|
||||
|
||||
## Available key codes
|
||||
|
||||
* `0` to `9`
|
||||
* `A` to `Z`
|
||||
* `F1` to `F24`
|
||||
* Punctuation like `~`, `!`, `@`, `#`, `$`, etc.
|
||||
* Punctuations like `~`, `!`, `@`, `#`, `$`, etc.
|
||||
* `Plus`
|
||||
* `Space`
|
||||
* `Tab`
|
||||
|
||||
329
docs/api/app.md
Executable file → Normal file
329
docs/api/app.md
Executable file → Normal file
@@ -32,15 +32,12 @@ In most cases, you should do everything in the `ready` event handler.
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `launchInfo` Record<string, any> | [NotificationResponse](structures/notification-response.md) _macOS_
|
||||
* `launchInfo` unknown _macOS_
|
||||
|
||||
Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
|
||||
holds the `userInfo` of the `NSUserNotification` or information from
|
||||
[`UNNotificationResponse`](structures/notification-response.md) that was used to open the
|
||||
application, if it was launched from Notification Center. You can also call
|
||||
`app.isReady()` to check if this event has already fired and `app.whenReady()`
|
||||
to get a Promise that is fulfilled when Electron is initialized.
|
||||
Emitted when Electron has finished initializing. On macOS, `launchInfo` holds
|
||||
the `userInfo` of the `NSUserNotification` that was used to open the application,
|
||||
if it was launched from Notification Center. You can call `app.isReady()` to
|
||||
check if this event has already fired.
|
||||
|
||||
### Event: 'window-all-closed'
|
||||
|
||||
@@ -77,7 +74,7 @@ Returns:
|
||||
* `event` Event
|
||||
|
||||
Emitted when all windows have been closed and the application will quit.
|
||||
Calling `event.preventDefault()` will prevent the default behavior, which is
|
||||
Calling `event.preventDefault()` will prevent the default behaviour, which is
|
||||
terminating the application.
|
||||
|
||||
See the description of the `window-all-closed` event for the differences between
|
||||
@@ -142,16 +139,6 @@ this event, such as launching the application for the first time, attempting
|
||||
to re-launch the application when it's already running, or clicking on the
|
||||
application's dock or taskbar icon.
|
||||
|
||||
### Event: 'did-become-active' _macOS_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
|
||||
Emitted when mac application become active. Difference from `activate` event is
|
||||
that `did-become-active` is emitted every time the app becomes active, not only
|
||||
when Dock icon is clicked or application is re-launched.
|
||||
|
||||
### Event: 'continue-activity' _macOS_
|
||||
|
||||
Returns:
|
||||
@@ -216,7 +203,7 @@ Returns:
|
||||
[`NSUserActivity.activityType`][activity-type].
|
||||
* `userInfo` unknown - Contains app-specific state stored by the activity.
|
||||
|
||||
Emitted when [Handoff][handoff] is about to be resumed on another device. If you need to update the state to be transferred, you should call `event.preventDefault()` immediately, construct a new `userInfo` dictionary and call `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will fail and `continue-activity-error` will be called.
|
||||
Emitted when [Handoff][handoff] is about to be resumed on another device. If you need to update the state to be transferred, you should call `event.preventDefault()` immediately, construct a new `userInfo` dictionary and call `app.updateCurrentActiviy()` in a timely manner. Otherwise, the operation will fail and `continue-activity-error` will be called.
|
||||
|
||||
### Event: 'new-window-for-tab' _macOS_
|
||||
|
||||
@@ -362,7 +349,7 @@ page.
|
||||
|
||||
Emitted whenever there is a GPU info update.
|
||||
|
||||
### Event: 'gpu-process-crashed' _Deprecated_
|
||||
### Event: 'gpu-process-crashed'
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -371,12 +358,7 @@ Returns:
|
||||
|
||||
Emitted when the GPU process crashes or is killed.
|
||||
|
||||
**Deprecated:** This event is superceded by the `child-process-gone` event
|
||||
which contains more information about why the child process disappeared. It
|
||||
isn't always because it crashed. The `killed` boolean can be replaced by
|
||||
checking `reason === 'killed'` when you switch to that event.
|
||||
|
||||
### Event: 'renderer-process-crashed' _Deprecated_
|
||||
### Event: 'renderer-process-crashed'
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -386,64 +368,6 @@ Returns:
|
||||
|
||||
Emitted when the renderer process of `webContents` crashes or is killed.
|
||||
|
||||
**Deprecated:** This event is superceded by the `render-process-gone` event
|
||||
which contains more information about why the render process disappeared. It
|
||||
isn't always because it crashed. The `killed` boolean can be replaced by
|
||||
checking `reason === 'killed'` when you switch to that event.
|
||||
|
||||
### Event: 'render-process-gone'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
* `details` Object
|
||||
* `reason` String - The reason the render process is gone. Possible values:
|
||||
* `clean-exit` - Process exited with an exit code of zero
|
||||
* `abnormal-exit` - Process exited with a non-zero exit code
|
||||
* `killed` - Process was sent a SIGTERM or otherwise killed externally
|
||||
* `crashed` - Process crashed
|
||||
* `oom` - Process ran out of memory
|
||||
* `launch-failed` - Process never successfully launched
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
* `exitCode` Integer - The exit code of the process, unless `reason` is
|
||||
`launch-failed`, in which case `exitCode` will be a platform-specific
|
||||
launch failure error code.
|
||||
|
||||
Emitted when the renderer process unexpectedly disappears. This is normally
|
||||
because it was crashed or killed.
|
||||
|
||||
### Event: 'child-process-gone'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `type` String - Process type. One of the following values:
|
||||
* `Utility`
|
||||
* `Zygote`
|
||||
* `Sandbox helper`
|
||||
* `GPU`
|
||||
* `Pepper Plugin`
|
||||
* `Pepper Plugin Broker`
|
||||
* `Unknown`
|
||||
* `reason` String - The reason the child process is gone. Possible values:
|
||||
* `clean-exit` - Process exited with an exit code of zero
|
||||
* `abnormal-exit` - Process exited with a non-zero exit code
|
||||
* `killed` - Process was sent a SIGTERM or otherwise killed externally
|
||||
* `crashed` - Process crashed
|
||||
* `oom` - Process ran out of memory
|
||||
* `launch-failed` - Process never successfully launched
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
* `exitCode` Number - The exit code for the process
|
||||
(e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).
|
||||
* `serviceName` String (optional) - The non-localized name of the process.
|
||||
* `name` String (optional) - The name of the process.
|
||||
Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc.
|
||||
|
||||
Emitted when the child process unexpectedly disappears. This is normally
|
||||
because it was crashed or killed. It does not include renderer processes.
|
||||
|
||||
### Event: 'accessibility-support-changed' _macOS_ _Windows_
|
||||
|
||||
Returns:
|
||||
@@ -489,8 +413,6 @@ and `workingDirectory` is its current working directory. Usually
|
||||
applications respond to this by making their primary window focused and
|
||||
non-minimized.
|
||||
|
||||
**Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
|
||||
|
||||
This event is guaranteed to be emitted after the `ready` event of `app`
|
||||
gets emitted.
|
||||
|
||||
@@ -507,6 +429,76 @@ Returns:
|
||||
Emitted when `desktopCapturer.getSources()` is called in the renderer process of `webContents`.
|
||||
Calling `event.preventDefault()` will make it return empty sources.
|
||||
|
||||
### Event: 'remote-require'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
* `moduleName` String
|
||||
|
||||
Emitted when `remote.require()` is called in the renderer process of `webContents`.
|
||||
Calling `event.preventDefault()` will prevent the module from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Event: 'remote-get-global'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
* `globalName` String
|
||||
|
||||
Emitted when `remote.getGlobal()` is called in the renderer process of `webContents`.
|
||||
Calling `event.preventDefault()` will prevent the global from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Event: 'remote-get-builtin'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
* `moduleName` String
|
||||
|
||||
Emitted when `remote.getBuiltin()` is called in the renderer process of `webContents`.
|
||||
Calling `event.preventDefault()` will prevent the module from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Event: 'remote-get-current-window'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
|
||||
Emitted when `remote.getCurrentWindow()` is called in the renderer process of `webContents`.
|
||||
Calling `event.preventDefault()` will prevent the object from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Event: 'remote-get-current-web-contents'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
|
||||
Emitted when `remote.getCurrentWebContents()` is called in the renderer process of `webContents`.
|
||||
Calling `event.preventDefault()` will prevent the object from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Event: 'remote-get-guest-web-contents'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
* `guestWebContents` [WebContents](web-contents.md)
|
||||
|
||||
Emitted when `<webview>.getWebContents()` is called in the renderer process of `webContents`.
|
||||
Calling `event.preventDefault()` will prevent the object from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
## Methods
|
||||
|
||||
The `app` object has the following methods:
|
||||
@@ -565,7 +557,6 @@ app.exit(0)
|
||||
### `app.isReady()`
|
||||
|
||||
Returns `Boolean` - `true` if Electron has finished initializing, `false` otherwise.
|
||||
See also `app.whenReady()`.
|
||||
|
||||
### `app.whenReady()`
|
||||
|
||||
@@ -573,17 +564,11 @@ Returns `Promise<void>` - fulfilled when Electron is initialized.
|
||||
May be used as a convenient alternative to checking `app.isReady()`
|
||||
and subscribing to the `ready` event if the app is not ready yet.
|
||||
|
||||
### `app.focus([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `steal` Boolean _macOS_ - Make the receiver the active app even if another app is
|
||||
currently active.
|
||||
### `app.focus()`
|
||||
|
||||
On Linux, focuses on the first visible window. On macOS, makes the application
|
||||
the active app. On Windows, focuses on the application's first window.
|
||||
|
||||
You should seek to use the `steal` option as sparingly as possible.
|
||||
|
||||
### `app.hide()` _macOS_
|
||||
|
||||
Hides all application windows without minimizing them.
|
||||
@@ -625,9 +610,8 @@ Returns `String` - The current application directory.
|
||||
* `music` Directory for a user's music.
|
||||
* `pictures` Directory for a user's pictures.
|
||||
* `videos` Directory for a user's videos.
|
||||
* `recent` Directory for the user's recent files (Windows only).
|
||||
* `logs` Directory for your app's log folder.
|
||||
* `crashDumps` Directory where crash dumps are stored.
|
||||
* `pepperFlashSystemPlugin` Full path to the system version of the Pepper Flash plugin.
|
||||
|
||||
Returns `String` - A path to a special directory or file associated with `name`. On
|
||||
failure, an `Error` is thrown.
|
||||
@@ -685,6 +669,8 @@ to the npm modules spec. You should usually also specify a `productName`
|
||||
field, which is your application's full capitalized name, and which will be
|
||||
preferred over `name` by Electron.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.setName(name)`
|
||||
|
||||
* `name` String
|
||||
@@ -693,10 +679,11 @@ Overrides the current application's name.
|
||||
|
||||
**Note:** This function overrides the name used internally by Electron; it does not affect the name that the OS uses.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.getLocale()`
|
||||
|
||||
Returns `String` - The current application locale, fetched using Chromium's `l10n_util` library.
|
||||
Possible return values are documented [here](https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc).
|
||||
Returns `String` - The current application locale. Possible return values are documented [here](locales.md).
|
||||
|
||||
To set the locale, you'll want to use a command line switch at app startup, which may be found [here](https://github.com/electron/electron/blob/master/docs/api/command-line-switches.md).
|
||||
|
||||
@@ -798,21 +785,6 @@ Returns `String` - Name of the application handling the protocol, or an empty
|
||||
This method returns the application name of the default handler for the protocol
|
||||
(aka URI scheme) of a URL.
|
||||
|
||||
### `app.getApplicationInfoForProtocol(url)` _macOS_ _Windows_
|
||||
|
||||
* `url` String - a URL with the protocol name to check. Unlike the other
|
||||
methods in this family, this accepts an entire URL, including `://` at a
|
||||
minimum (e.g. `https://`).
|
||||
|
||||
Returns `Promise<Object>` - Resolve with an object containing the following:
|
||||
|
||||
* `icon` NativeImage - the display icon of the app handling the protocol.
|
||||
* `path` String - installation path of the app handling the protocol.
|
||||
* `name` String - display name of the app handling the protocol.
|
||||
|
||||
This method returns a promise that contains the application name, icon and path of the default handler for the protocol
|
||||
(aka URI scheme) of a URL.
|
||||
|
||||
### `app.setUserTasks(tasks)` _Windows_
|
||||
|
||||
* `tasks` [Task[]](structures/task.md) - Array of `Task` objects
|
||||
@@ -872,10 +844,6 @@ re-add a removed item to a custom category earlier than that will result in the
|
||||
entire custom category being omitted from the Jump List. The list of removed
|
||||
items can be obtained using `app.getJumpListSettings()`.
|
||||
|
||||
**Note:** The maximum length of a Jump List item's `description` property is
|
||||
260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
List, nor will it be displayed.
|
||||
|
||||
Here's a very simple example of creating a custom Jump List:
|
||||
|
||||
```javascript
|
||||
@@ -977,8 +945,7 @@ if (!gotTheLock) {
|
||||
})
|
||||
|
||||
// Create myWindow, load the rest of the app, etc...
|
||||
app.whenReady().then(() => {
|
||||
myWindow = createWindow()
|
||||
app.on('ready', () => {
|
||||
})
|
||||
}
|
||||
```
|
||||
@@ -1035,18 +1002,6 @@ Updates the current activity if its type matches `type`, merging the entries fro
|
||||
|
||||
Changes the [Application User Model ID][app-user-model-id] to `id`.
|
||||
|
||||
### `app.setActivationPolicy(policy)` _macOS_
|
||||
|
||||
* `policy` String - Can be 'regular', 'accessory', or 'prohibited'.
|
||||
|
||||
Sets the activation policy for a given app.
|
||||
|
||||
Activation policy types:
|
||||
|
||||
* 'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.
|
||||
* 'accessory' - The application doesn’t appear in the Dock and doesn’t have a menu bar, but it may be activated programmatically or by clicking on one of its windows.
|
||||
* 'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.
|
||||
|
||||
### `app.importCertificate(options, callback)` _Linux_
|
||||
|
||||
* `options` Object
|
||||
@@ -1057,7 +1012,7 @@ Activation policy types:
|
||||
|
||||
Imports the certificate in pkcs12 format into the platform certificate store.
|
||||
`callback` is called with the `result` of import operation, a value of `0`
|
||||
indicates success while any other value indicates failure according to Chromium [net_error_list](https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h).
|
||||
indicates success while any other value indicates failure according to Chromium [net_error_list](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h).
|
||||
|
||||
### `app.disableHardwareAcceleration()`
|
||||
|
||||
@@ -1069,7 +1024,7 @@ This method can only be called before app is ready.
|
||||
|
||||
By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per
|
||||
domain basis if the GPU processes crashes too frequently. This function
|
||||
disables that behavior.
|
||||
disables that behaviour.
|
||||
|
||||
This method can only be called before app is ready.
|
||||
|
||||
@@ -1094,12 +1049,9 @@ For `infoType` equal to `complete`:
|
||||
|
||||
For `infoType` equal to `basic`:
|
||||
Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response:
|
||||
|
||||
```js
|
||||
{
|
||||
auxAttributes:
|
||||
{
|
||||
amdSwitchable: true,
|
||||
{ auxAttributes:
|
||||
{ amdSwitchable: true,
|
||||
canSupportThreadedTextureMailbox: false,
|
||||
directComposition: false,
|
||||
directRendering: true,
|
||||
@@ -1112,21 +1064,19 @@ For `infoType` equal to `basic`:
|
||||
sandboxed: false,
|
||||
softwareRendering: false,
|
||||
supportsOverlays: false,
|
||||
videoDecodeAcceleratorFlags: 0
|
||||
},
|
||||
gpuDevice:
|
||||
[{ active: true, deviceId: 26657, vendorId: 4098 },
|
||||
{ active: false, deviceId: 3366, vendorId: 32902 }],
|
||||
machineModelName: 'MacBookPro',
|
||||
machineModelVersion: '11.5'
|
||||
}
|
||||
videoDecodeAcceleratorFlags: 0 },
|
||||
gpuDevice:
|
||||
[ { active: true, deviceId: 26657, vendorId: 4098 },
|
||||
{ active: false, deviceId: 3366, vendorId: 32902 } ],
|
||||
machineModelName: 'MacBookPro',
|
||||
machineModelVersion: '11.5' }
|
||||
```
|
||||
|
||||
Using `basic` should be preferred if only basic information like `vendorId` or `driverId` is needed.
|
||||
|
||||
### `app.setBadgeCount([count])` _Linux_ _macOS_
|
||||
### `app.setBadgeCount(count)` _Linux_ _macOS_
|
||||
|
||||
* `count` Integer (optional) - If a value is provided, set the badge to the provided value otherwise, on macOS, display a plain white dot (e.g. unknown number of notifications). On Linux, if a value is not provided the badge will not display.
|
||||
* `count` Integer
|
||||
|
||||
Returns `Boolean` - Whether the call succeeded.
|
||||
|
||||
@@ -1135,13 +1085,17 @@ badge.
|
||||
|
||||
On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
|
||||
|
||||
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
|
||||
please read the [Unity integration documentation][unity-requirement].
|
||||
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
|
||||
for more information please read [Desktop Environment Integration][unity-requirement].
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.getBadgeCount()` _Linux_ _macOS_
|
||||
|
||||
Returns `Integer` - The current value displayed in the counter badge.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.isUnityRunning()` _Linux_
|
||||
|
||||
Returns `Boolean` - Whether the current desktop environment is Unity launcher.
|
||||
@@ -1171,13 +1125,6 @@ Returns `Object`:
|
||||
should restore the state from the previous session. This indicates that the
|
||||
app should restore the windows that were open the last time the app was
|
||||
closed. This setting is not available on [MAS builds][mas-builds].
|
||||
* `executableWillLaunchAtLogin` Boolean _Windows_ - `true` if app is set to open at login and its run key is not deactivated. This differs from `openAtLogin` as it ignores the `args` option, this property will be true if the given executable would be launched at login with **any** arguments.
|
||||
* `launchItems` Object[] _Windows_
|
||||
* `name` String _Windows_ - name value of a registry entry.
|
||||
* `path` String _Windows_ - The executable to an app that corresponds to a registry entry.
|
||||
* `args` String[] _Windows_ - the command-line arguments to pass to the executable.
|
||||
* `scope` String _Windows_ - one of `user` or `machine`. Indicates whether the registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
|
||||
* `enabled` Boolean _Windows_ - `true` if the app registry key is startup approved and therefore shows as `enabled` in Task Manager and Windows settings.
|
||||
|
||||
### `app.setLoginItemSettings(settings)` _macOS_ _Windows_
|
||||
|
||||
@@ -1193,9 +1140,7 @@ Returns `Object`:
|
||||
* `args` String[] (optional) _Windows_ - The command-line arguments to pass to
|
||||
the executable. Defaults to an empty array. Take care to wrap paths in
|
||||
quotes.
|
||||
* `enabled` Boolean (optional) _Windows_ - `true` will change the startup approved registry key and `enable / disable` the App in Task Manager and Windows Settings.
|
||||
Defaults to `true`.
|
||||
* `name` String (optional) _Windows_ - value name to write into registry. Defaults to the app's AppUserModelId().
|
||||
|
||||
Set the app's login item settings.
|
||||
|
||||
To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows],
|
||||
@@ -1225,6 +1170,8 @@ technologies, such as screen readers, has been detected. See
|
||||
https://www.chromium.org/developers/design-documents/accessibility for more
|
||||
details.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.setAccessibilitySupportEnabled(enabled)` _macOS_ _Windows_
|
||||
|
||||
* `enabled` Boolean - Enable or disable [accessibility tree](https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree) rendering
|
||||
@@ -1236,6 +1183,8 @@ This API must be called after the `ready` event is emitted.
|
||||
|
||||
**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.showAboutPanel()`
|
||||
|
||||
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`.
|
||||
@@ -1250,9 +1199,9 @@ Show the app's about panel options. These options can be overridden with `app.se
|
||||
* `credits` String (optional) _macOS_ _Windows_ - Credit information.
|
||||
* `authors` String[] (optional) _Linux_ - List of app authors.
|
||||
* `website` String (optional) _Linux_ - The app's website.
|
||||
* `iconPath` String (optional) _Linux_ _Windows_ - Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
|
||||
* `iconPath` String (optional) _Linux_ _Windows_ - Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
|
||||
|
||||
Set the about panel options. This will override the values defined in the app's `.plist` file on macOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
|
||||
Set the about panel options. This will override the values defined in the app's `.plist` file on MacOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
|
||||
|
||||
If you do not set `credits` but still wish to surface them in your app, AppKit will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in that order, in the bundle returned by the NSBundle class method main. The first file found is used, and if none is found, the info area is left blank. See Apple [documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc) for more information.
|
||||
|
||||
@@ -1281,9 +1230,9 @@ stopAccessingSecurityScopedResource()
|
||||
|
||||
Start accessing a security scoped resource. With this method Electron applications that are packaged for the Mac App Store may reach outside their sandbox to access files chosen by the user. See [Apple's documentation](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) for a description of how this system works.
|
||||
|
||||
### `app.enableSandbox()`
|
||||
### `app.enableSandbox()` _Experimental_
|
||||
|
||||
Enables full sandbox mode on the app. This means that all renderers will be launched sandboxed, regardless of the value of the `sandbox` flag in WebPreferences.
|
||||
Enables full sandbox mode on the app.
|
||||
|
||||
This method can only be called before app is ready.
|
||||
|
||||
@@ -1295,7 +1244,7 @@ systems Application folder. Use in combination with `app.moveToApplicationsFolde
|
||||
### `app.moveToApplicationsFolder([options])` _macOS_
|
||||
|
||||
* `options` Object (optional)
|
||||
* `conflictHandler` Function\<Boolean> (optional) - A handler for potential conflict in move failure.
|
||||
* `conflictHandler` Function<Boolean> (optional) - A handler for potential conflict in move failure.
|
||||
* `conflictType` String - The type of move conflict encountered by the handler; can be `exists` or `existsAndRunning`, where `exists` means that an app of the same name is present in the Applications directory and `existsAndRunning` means both that it exists and that it's presently running.
|
||||
|
||||
Returns `Boolean` - Whether the move was successful. Please note that if
|
||||
@@ -1311,7 +1260,7 @@ method returns false. If we fail to perform the copy, then this method will
|
||||
throw an error. The message in the error should be informative and tell
|
||||
you exactly what went wrong.
|
||||
|
||||
By default, if an app of the same name as the one being moved exists in the Applications directory and is _not_ running, the existing app will be trashed and the active app moved into its place. If it _is_ running, the pre-existing running app will assume focus and the previously active app will quit itself. This behavior can be changed by providing the optional conflict handler, where the boolean returned by the handler determines whether or not the move conflict is resolved with default behavior. i.e. returning `false` will ensure no further action is taken, returning `true` will result in the default behavior and the method continuing.
|
||||
By default, if an app of the same name as the one being moved exists in the Applications directory and is _not_ running, the existing app will be trashed and the active app moved into its place. If it _is_ running, the pre-existing running app will assume focus and the the previously active app will quit itself. This behavior can be changed by providing the optional conflict handler, where the boolean returned by the handler determines whether or not the move conflict is resolved with default behavior. i.e. returning `false` will ensure no further action is taken, returning `true` will result in the default behavior and the method continuing.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -1332,25 +1281,6 @@ app.moveToApplicationsFolder({
|
||||
|
||||
Would mean that if an app already exists in the user directory, if the user chooses to 'Continue Move' then the function would continue with its default behavior and the existing app will be trashed and the active app moved into its place.
|
||||
|
||||
### `app.isSecureKeyboardEntryEnabled()` _macOS_
|
||||
|
||||
Returns `Boolean` - whether `Secure Keyboard Entry` is enabled.
|
||||
|
||||
By default this API will return `false`.
|
||||
|
||||
### `app.setSecureKeyboardEntryEnabled(enabled)` _macOS_
|
||||
|
||||
* `enabled` Boolean - Enable or disable `Secure Keyboard Entry`
|
||||
|
||||
Set the `Secure Keyboard Entry` is enabled in your application.
|
||||
|
||||
By using this API, important information such as password and other sensitive information can be prevented from being intercepted by other processes.
|
||||
|
||||
See [Apple's documentation](https://developer.apple.com/library/archive/technotes/tn2150/_index.html) for more
|
||||
details.
|
||||
|
||||
**Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
|
||||
|
||||
## Properties
|
||||
|
||||
### `app.accessibilitySupportEnabled` _macOS_ _Windows_
|
||||
@@ -1374,11 +1304,8 @@ An `Integer` property that returns the badge count for current app. Setting the
|
||||
|
||||
On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.
|
||||
|
||||
**Note:** Unity launcher requires a `.desktop` file to work. For more information,
|
||||
please read the [Unity integration documentation][unity-requirement].
|
||||
|
||||
**Note:** On macOS, you need to ensure that your application has the permission
|
||||
to display notifications for this property to take effect.
|
||||
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
|
||||
for more information please read [Desktop Environment Integration][unity-requirement].
|
||||
|
||||
### `app.commandLine` _Readonly_
|
||||
|
||||
@@ -1387,7 +1314,7 @@ command line arguments that Chromium uses.
|
||||
|
||||
### `app.dock` _macOS_ _Readonly_
|
||||
|
||||
A [`Dock`](./dock.md) `| undefined` object that allows you to perform actions on your app icon in the user's
|
||||
A [`Dock`](./dock.md) object that allows you to perform actions on your app icon in the user's
|
||||
dock on macOS.
|
||||
|
||||
### `app.isPackaged` _Readonly_
|
||||
@@ -1403,7 +1330,7 @@ A `Boolean` property that returns `true` if the app is packaged, `false` otherw
|
||||
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme
|
||||
[handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html
|
||||
[activity-type]: https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType
|
||||
[unity-requirement]: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_shortcuts_to_a_launcher
|
||||
[unity-requirement]: ../tutorial/desktop-environment-integration.md#unity-launcher
|
||||
[mas-builds]: ../tutorial/mac-app-store-submission-guide.md
|
||||
[Squirrel-Windows]: https://github.com/Squirrel/Squirrel.Windows
|
||||
[JumpListBeginListMSDN]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx
|
||||
@@ -1427,11 +1354,15 @@ This is the user agent that will be used when no user agent is set at the
|
||||
app has the same user agent. Set to a custom value as early as possible
|
||||
in your app's initialization to ensure that your overridden value is used.
|
||||
|
||||
### `app.runningUnderRosettaTranslation` _macOS_ _Readonly_
|
||||
### `app.allowRendererProcessReuse`
|
||||
|
||||
A `Boolean` which when `true` indicates that the app is currently running
|
||||
under the [Rosetta Translator Environment](https://en.wikipedia.org/wiki/Rosetta_(software)).
|
||||
A `Boolean` which when `true` disables the overrides that Electron has in place
|
||||
to ensure renderer processes are restarted on every navigation. The current
|
||||
default value for this property is `false`.
|
||||
|
||||
You can use this property to prompt users to download the arm64 version of
|
||||
your application when they are running the x64 version under Rosetta
|
||||
incorrectly.
|
||||
The intention is for these overrides to become disabled by default and then at
|
||||
some point in the future this property will be removed. This property impacts
|
||||
which native modules you can use in the renderer process. For more information
|
||||
on the direction Electron is going with renderer process restarts and usage of
|
||||
native modules in the renderer process please check out this
|
||||
[Tracking Issue](https://github.com/electron/electron/issues/18397).
|
||||
|
||||
@@ -43,7 +43,7 @@ The installer generated with Squirrel will create a shortcut icon with an
|
||||
same ID for your app with `app.setAppUserModelId` API, otherwise Windows will
|
||||
not be able to pin your app properly in task bar.
|
||||
|
||||
Like Squirrel.Mac, Windows can host updates on S3 or any other static file host.
|
||||
Unlike Squirrel.Mac, Windows can host updates on S3 or any other static file host.
|
||||
You can read the documents of [Squirrel.Windows][squirrel-windows] to get more details
|
||||
about how Squirrel.Windows works.
|
||||
|
||||
@@ -104,7 +104,7 @@ The `autoUpdater` object has the following methods:
|
||||
* `options` Object
|
||||
* `url` String
|
||||
* `headers` Record<String, String> (optional) _macOS_ - HTTP request headers.
|
||||
* `serverType` String (optional) _macOS_ - Can be `json` or `default`, see the [Squirrel.Mac][squirrel-mac]
|
||||
* `serverType` String (optional) _macOS_ - Either `json` or `default`, see the [Squirrel.Mac][squirrel-mac]
|
||||
README for more information.
|
||||
|
||||
Sets the `url` and initialize the auto updater.
|
||||
@@ -118,9 +118,6 @@ Returns `String` - The current update feed URL.
|
||||
Asks the server whether there is an update. You must call `setFeedURL` before
|
||||
using this API.
|
||||
|
||||
**Note:** If an update is available it will be downloaded automatically.
|
||||
Calling `autoUpdater.checkForUpdates()` twice will download the update two times.
|
||||
|
||||
### `autoUpdater.quitAndInstall()`
|
||||
|
||||
Restarts the app and installs the update after it has been downloaded. It
|
||||
|
||||
61
docs/api/breaking-changes-ns.md
Normal file
61
docs/api/breaking-changes-ns.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Breaking changes (NetworkService) (Draft)
|
||||
|
||||
This document describes changes to Electron APIs after migrating network code
|
||||
to NetworkService API.
|
||||
|
||||
We don't currently have an estimate of when we will enable `NetworkService` by
|
||||
default in Electron, but as Chromium is already removing non-`NetworkService`
|
||||
code, we might switch before Electron 10.
|
||||
|
||||
The content of this document should be moved to `breaking-changes.md` once we have
|
||||
determined when to enable `NetworkService` in Electron.
|
||||
|
||||
## Planned Breaking API Changes
|
||||
|
||||
### `protocol.unregisterProtocol`
|
||||
### `protocol.uninterceptProtocol`
|
||||
|
||||
The APIs are now synchronous and the optional callback is no longer needed.
|
||||
|
||||
```javascript
|
||||
// Deprecated
|
||||
protocol.unregisterProtocol(scheme, () => { /* ... */ })
|
||||
// Replace with
|
||||
protocol.unregisterProtocol(scheme)
|
||||
```
|
||||
|
||||
### `protocol.registerFileProtocol`
|
||||
### `protocol.registerBufferProtocol`
|
||||
### `protocol.registerStringProtocol`
|
||||
### `protocol.registerHttpProtocol`
|
||||
### `protocol.registerStreamProtocol`
|
||||
### `protocol.interceptFileProtocol`
|
||||
### `protocol.interceptStringProtocol`
|
||||
### `protocol.interceptBufferProtocol`
|
||||
### `protocol.interceptHttpProtocol`
|
||||
### `protocol.interceptStreamProtocol`
|
||||
|
||||
The APIs are now synchronous and the optional callback is no longer needed.
|
||||
|
||||
```javascript
|
||||
// Deprecated
|
||||
protocol.registerFileProtocol(scheme, handler, () => { /* ... */ })
|
||||
// Replace with
|
||||
protocol.registerFileProtocol(scheme, handler)
|
||||
```
|
||||
|
||||
The registered or intercepted protocol does not have effect on current page
|
||||
until navigation happens.
|
||||
|
||||
### `protocol.isProtocolHandled`
|
||||
|
||||
This API is deprecated and users should use `protocol.isProtocolRegistered`
|
||||
and `protocol.isProtocolIntercepted` instead.
|
||||
|
||||
```javascript
|
||||
// Deprecated
|
||||
protocol.isProtocolHandled(scheme).then(() => { /* ... */ })
|
||||
// Replace with
|
||||
const isRegistered = protocol.isProtocolRegistered(scheme)
|
||||
const isIntercepted = protocol.isProtocolIntercepted(scheme)
|
||||
```
|
||||
684
docs/api/breaking-changes.md
Normal file
684
docs/api/breaking-changes.md
Normal file
@@ -0,0 +1,684 @@
|
||||
# Breaking Changes
|
||||
|
||||
Breaking changes will be documented here, and deprecation warnings added to JS code where possible, at least [one major version](../tutorial/electron-versioning.md#semver) before the change is made.
|
||||
|
||||
## `FIXME` comments
|
||||
|
||||
The `FIXME` string is used in code comments to denote things that should be fixed for future releases. See https://github.com/electron/electron/search?q=fixme
|
||||
|
||||
## Planned Breaking API Changes (8.0)
|
||||
|
||||
### Values sent over IPC are now serialized with Structured Clone Algorithm
|
||||
|
||||
The algorithm used to serialize objects sent over IPC (through
|
||||
`ipcRenderer.send`, `ipcRenderer.sendSync`, `WebContents.send` and related
|
||||
methods) has been switched from a custom algorithm to V8's built-in [Structured
|
||||
Clone Algorithm][SCA], the same algorithm used to serialize messages for
|
||||
`postMessage`. This brings about a 2x performance improvement for large
|
||||
messages, but also brings some breaking changes in behavior.
|
||||
|
||||
- Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any
|
||||
such values, over IPC will now throw an exception, instead of silently
|
||||
converting the functions to `undefined`.
|
||||
```js
|
||||
// Previously:
|
||||
ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
|
||||
// => results in { value: 3 } arriving in the main process
|
||||
|
||||
// From Electron 8:
|
||||
ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
|
||||
// => throws Error("() => {} could not be cloned.")
|
||||
```
|
||||
- `NaN`, `Infinity` and `-Infinity` will now be correctly serialized, instead
|
||||
of being converted to `null`.
|
||||
- Objects containing cyclic references will now be correctly serialized,
|
||||
instead of being converted to `null`.
|
||||
- `Set`, `Map`, `Error` and `RegExp` values will be correctly serialized,
|
||||
instead of being converted to `{}`.
|
||||
- `BigInt` values will be correctly serialized, instead of being converted to
|
||||
`null`.
|
||||
- Sparse arrays will be serialized as such, instead of being converted to dense
|
||||
arrays with `null`s.
|
||||
- `Date` objects will be transferred as `Date` objects, instead of being
|
||||
converted to their ISO string representation.
|
||||
- Typed Arrays (such as `Uint8Array`, `Uint16Array`, `Uint32Array` and so on)
|
||||
will be transferred as such, instead of being converted to Node.js `Buffer`.
|
||||
- Node.js `Buffer` objects will be transferred as `Uint8Array`s. You can
|
||||
convert a `Uint8Array` back to a Node.js `Buffer` by wrapping the underlying
|
||||
`ArrayBuffer`:
|
||||
```js
|
||||
Buffer.from(value.buffer, value.byteOffset, value.byteLength)
|
||||
```
|
||||
|
||||
Sending any objects that aren't native JS types, such as DOM objects (e.g.
|
||||
`Element`, `Location`, `DOMMatrix`), Node.js objects (e.g. `process.env`,
|
||||
`Stream`), or Electron objects (e.g. `WebContents`, `BrowserWindow`,
|
||||
`WebFrame`) is deprecated. In Electron 8, these objects will be serialized as
|
||||
before with a DeprecationWarning message, but starting in Electron 9, sending
|
||||
these kinds of objects will throw a 'could not be cloned' error.
|
||||
|
||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||
|
||||
### `<webview>.getWebContents()`
|
||||
|
||||
This API is implemented using the `remote` module, which has both performance
|
||||
and security implications. Therefore its usage should be explicit.
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
webview.getWebContents()
|
||||
// Replace with
|
||||
const { remote } = require('electron')
|
||||
remote.webContents.fromId(webview.getWebContentsId())
|
||||
```
|
||||
|
||||
However, it is recommended to avoid using the `remote` module altogether.
|
||||
|
||||
```js
|
||||
// main
|
||||
const { ipcMain, webContents } = require('electron')
|
||||
|
||||
const getGuestForWebContents = function (webContentsId, contents) {
|
||||
const guest = webContents.fromId(webContentsId)
|
||||
if (!guest) {
|
||||
throw new Error(`Invalid webContentsId: ${webContentsId}`)
|
||||
}
|
||||
if (guest.hostWebContents !== contents) {
|
||||
throw new Error(`Access denied to webContents`)
|
||||
}
|
||||
return guest
|
||||
}
|
||||
|
||||
ipcMain.handle('openDevTools', (event, webContentsId) => {
|
||||
const guest = getGuestForWebContents(webContentsId, event.sender)
|
||||
guest.openDevTools()
|
||||
})
|
||||
|
||||
// renderer
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
ipcRenderer.invoke('openDevTools', webview.getWebContentsId())
|
||||
```
|
||||
|
||||
### `webFrame.setLayoutZoomLevelLimits()`
|
||||
|
||||
Chromium has removed support for changing the layout zoom level limits, and it
|
||||
is beyond Electron's capacity to maintain it. The function will emit a warning
|
||||
in Electron 8.x, and cease to exist in Electron 9.x. The layout zoom level
|
||||
limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined
|
||||
[here](https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11).
|
||||
|
||||
## Planned Breaking API Changes (7.0)
|
||||
|
||||
### Node Headers URL
|
||||
|
||||
This is the URL specified as `disturl` in a `.npmrc` file or as the `--dist-url`
|
||||
command line flag when building native Node modules. Both will be supported for
|
||||
the foreseeable future but it is recommended that you switch.
|
||||
|
||||
Deprecated: https://atom.io/download/electron
|
||||
|
||||
Replace with: https://electronjs.org/headers
|
||||
|
||||
### `session.clearAuthCache(options)`
|
||||
|
||||
The `session.clearAuthCache` API no longer accepts options for what to clear, and instead unconditionally clears the whole cache.
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
session.clearAuthCache({ type: 'password' })
|
||||
// Replace with
|
||||
session.clearAuthCache()
|
||||
```
|
||||
|
||||
### `powerMonitor.querySystemIdleState`
|
||||
|
||||
```js
|
||||
// Removed in Electron 7.0
|
||||
powerMonitor.querySystemIdleState(threshold, callback)
|
||||
// Replace with synchronous API
|
||||
const idleState = getSystemIdleState(threshold)
|
||||
```
|
||||
|
||||
### `powerMonitor.querySystemIdleTime`
|
||||
|
||||
```js
|
||||
// Removed in Electron 7.0
|
||||
powerMonitor.querySystemIdleTime(callback)
|
||||
// Replace with synchronous API
|
||||
const idleTime = getSystemIdleTime()
|
||||
```
|
||||
|
||||
### webFrame Isolated World APIs
|
||||
|
||||
```js
|
||||
// Removed in Electron 7.0
|
||||
webFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)
|
||||
webFrame.setIsolatedWorldHumanReadableName(worldId, name)
|
||||
webFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)
|
||||
// Replace with
|
||||
webFrame.setIsolatedWorldInfo(
|
||||
worldId,
|
||||
{
|
||||
securityOrigin: 'some_origin',
|
||||
name: 'human_readable_name',
|
||||
csp: 'content_security_policy'
|
||||
})
|
||||
```
|
||||
|
||||
### Removal of deprecated `marked` property on getBlinkMemoryInfo
|
||||
|
||||
This property was removed in Chromium 77, and as such is no longer available.
|
||||
|
||||
### `webkitdirectory` attribute for `<input type="file"/>`
|
||||

|
||||
The `webkitdirectory` property on HTML file inputs allows them to select folders.
|
||||
Previous versions of Electron had an incorrect implementation where the `event.target.files`
|
||||
of the input returned a `FileList` that returned one `File` corresponding to the selected folder.
|
||||

|
||||
As of Electron 7, that `FileList` is now list of all files contained within
|
||||
the folder, similarly to Chrome, Firefox, and Edge
|
||||
([link to MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)).
|
||||

|
||||
As an illustration, take a folder with this structure:
|
||||
```console
|
||||
folder
|
||||
├── file1
|
||||
├── file2
|
||||
└── file3
|
||||
```
|
||||

|
||||
In Electron <=6, this would return a `FileList` with a `File` object for:
|
||||
```console
|
||||
path/to/folder
|
||||
```
|
||||

|
||||
In Electron 7, this now returns a `FileList` with a `File` object for:
|
||||
```console
|
||||
/path/to/folder/file3
|
||||
/path/to/folder/file2
|
||||
/path/to/folder/file1
|
||||
```
|
||||

|
||||
Note that `webkitdirectory` no longer exposes the path to the selected folder.
|
||||
If you require the path to the selected folder rather than the folder contents,
|
||||
see the `dialog.showOpenDialog` API ([link](https://github.com/electron/electron/blob/master/docs/api/dialog.md#dialogshowopendialogbrowserwindow-options)).
|
||||
|
||||
## Planned Breaking API Changes (6.0)
|
||||
|
||||
### `win.setMenu(null)`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
win.setMenu(null)
|
||||
// Replace with
|
||||
win.removeMenu()
|
||||
```
|
||||
|
||||
### `contentTracing.getTraceBufferUsage()`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
contentTracing.getTraceBufferUsage((percentage, value) => {
|
||||
// do something
|
||||
})
|
||||
// Replace with
|
||||
contentTracing.getTraceBufferUsage().then(infoObject => {
|
||||
// infoObject has percentage and value fields
|
||||
})
|
||||
```
|
||||
|
||||
### `electron.screen` in renderer process
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
require('electron').screen
|
||||
// Replace with
|
||||
require('electron').remote.screen
|
||||
```
|
||||
|
||||
### `require` in sandboxed renderers
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
require('child_process')
|
||||
// Replace with
|
||||
require('electron').remote.require('child_process')
|
||||
|
||||
// Deprecated
|
||||
require('fs')
|
||||
// Replace with
|
||||
require('electron').remote.require('fs')
|
||||
|
||||
// Deprecated
|
||||
require('os')
|
||||
// Replace with
|
||||
require('electron').remote.require('os')
|
||||
|
||||
// Deprecated
|
||||
require('path')
|
||||
// Replace with
|
||||
require('electron').remote.require('path')
|
||||
```
|
||||
|
||||
### `powerMonitor.querySystemIdleState`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
powerMonitor.querySystemIdleState(threshold, callback)
|
||||
// Replace with synchronous API
|
||||
const idleState = getSystemIdleState(threshold)
|
||||
```
|
||||
|
||||
### `powerMonitor.querySystemIdleTime`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
powerMonitor.querySystemIdleTime(callback)
|
||||
// Replace with synchronous API
|
||||
const idleTime = getSystemIdleTime()
|
||||
```
|
||||
|
||||
### `app.enableMixedSandbox`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
app.enableMixedSandbox()
|
||||
```
|
||||
|
||||
Mixed-sandbox mode is now enabled by default.
|
||||
|
||||
### `Tray`
|
||||
|
||||
Under macOS Catalina our former Tray implementation breaks.
|
||||
Apple's native substitute doesn't support changing the highlighting behavior.
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
tray.setHighlightMode(mode)
|
||||
// API will be removed in v7.0 without replacement.
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (5.0)
|
||||
|
||||
### `new BrowserWindow({ webPreferences })`
|
||||
|
||||
The following `webPreferences` option default values are deprecated in favor of the new defaults listed below.
|
||||
|
||||
| Property | Deprecated Default | New Default |
|
||||
|----------|--------------------|-------------|
|
||||
| `contextIsolation` | `false` | `true` |
|
||||
| `nodeIntegration` | `true` | `false` |
|
||||
| `webviewTag` | `nodeIntegration` if set else `true` | `false` |
|
||||
|
||||
E.g. Re-enabling the webviewTag
|
||||
|
||||
```js
|
||||
const w = new BrowserWindow({
|
||||
webPreferences: {
|
||||
webviewTag: true
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### `nativeWindowOpen`
|
||||
|
||||
Child windows opened with the `nativeWindowOpen` option will always have Node.js integration disabled, unless `nodeIntegrationInSubFrames` is `true.
|
||||
|
||||
### Privileged Schemes Registration
|
||||
|
||||
Renderer process APIs `webFrame.setRegisterURLSchemeAsPrivileged` and `webFrame.registerURLSchemeAsBypassingCSP` as well as browser process API `protocol.registerStandardSchemes` have been removed.
|
||||
A new API, `protocol.registerSchemesAsPrivileged` has been added and should be used for registering custom schemes with the required privileges. Custom schemes are required to be registered before app ready.
|
||||
|
||||
### webFrame Isolated World APIs
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
webFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)
|
||||
webFrame.setIsolatedWorldHumanReadableName(worldId, name)
|
||||
webFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)
|
||||
// Replace with
|
||||
webFrame.setIsolatedWorldInfo(
|
||||
worldId,
|
||||
{
|
||||
securityOrigin: 'some_origin',
|
||||
name: 'human_readable_name',
|
||||
csp: 'content_security_policy'
|
||||
})
|
||||
```
|
||||
|
||||
## `webFrame.setSpellCheckProvider`
|
||||
The `spellCheck` callback is now asynchronous, and `autoCorrectWord` parameter has been removed.
|
||||
```js
|
||||
// Deprecated
|
||||
webFrame.setSpellCheckProvider('en-US', true, {
|
||||
spellCheck: (text) => {
|
||||
return !spellchecker.isMisspelled(text)
|
||||
}
|
||||
})
|
||||
// Replace with
|
||||
webFrame.setSpellCheckProvider('en-US', {
|
||||
spellCheck: (words, callback) => {
|
||||
callback(words.filter(text => spellchecker.isMisspelled(text)))
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (4.0)
|
||||
|
||||
The following list includes the breaking API changes made in Electron 4.0.
|
||||
|
||||
### `app.makeSingleInstance`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
app.makeSingleInstance((argv, cwd) => {
|
||||
/* ... */
|
||||
})
|
||||
// Replace with
|
||||
app.requestSingleInstanceLock()
|
||||
app.on('second-instance', (event, argv, cwd) => {
|
||||
/* ... */
|
||||
})
|
||||
```
|
||||
|
||||
### `app.releaseSingleInstance`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
app.releaseSingleInstance()
|
||||
// Replace with
|
||||
app.releaseSingleInstanceLock()
|
||||
```
|
||||
|
||||
### `app.getGPUInfo`
|
||||
|
||||
```js
|
||||
app.getGPUInfo('complete')
|
||||
// Now behaves the same with `basic` on macOS
|
||||
app.getGPUInfo('basic')
|
||||
```
|
||||
|
||||
### `win_delay_load_hook`
|
||||
|
||||
When building native modules for windows, the `win_delay_load_hook` variable in
|
||||
the module's `binding.gyp` must be true (which is the default). If this hook is
|
||||
not present, then the native module will fail to load on Windows, with an error
|
||||
message like `Cannot find module`. See the [native module
|
||||
guide](/docs/tutorial/using-native-node-modules.md) for more.
|
||||
|
||||
## Breaking API Changes (3.0)
|
||||
|
||||
The following list includes the breaking API changes in Electron 3.0.
|
||||
|
||||
### `app`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
app.getAppMemoryInfo()
|
||||
// Replace with
|
||||
app.getAppMetrics()
|
||||
|
||||
// Deprecated
|
||||
const metrics = app.getAppMetrics()
|
||||
const { memory } = metrics[0] // Deprecated property
|
||||
```
|
||||
|
||||
### `BrowserWindow`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
let optionsA = { webPreferences: { blinkFeatures: '' } }
|
||||
let windowA = new BrowserWindow(optionsA)
|
||||
// Replace with
|
||||
let optionsB = { webPreferences: { enableBlinkFeatures: '' } }
|
||||
let windowB = new BrowserWindow(optionsB)
|
||||
|
||||
// Deprecated
|
||||
window.on('app-command', (e, cmd) => {
|
||||
if (cmd === 'media-play_pause') {
|
||||
// do something
|
||||
}
|
||||
})
|
||||
// Replace with
|
||||
window.on('app-command', (e, cmd) => {
|
||||
if (cmd === 'media-play-pause') {
|
||||
// do something
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### `clipboard`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
clipboard.readRtf()
|
||||
// Replace with
|
||||
clipboard.readRTF()
|
||||
|
||||
// Deprecated
|
||||
clipboard.writeRtf()
|
||||
// Replace with
|
||||
clipboard.writeRTF()
|
||||
|
||||
// Deprecated
|
||||
clipboard.readHtml()
|
||||
// Replace with
|
||||
clipboard.readHTML()
|
||||
|
||||
// Deprecated
|
||||
clipboard.writeHtml()
|
||||
// Replace with
|
||||
clipboard.writeHTML()
|
||||
```
|
||||
|
||||
### `crashReporter`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
crashReporter.start({
|
||||
companyName: 'Crashly',
|
||||
submitURL: 'https://crash.server.com',
|
||||
autoSubmit: true
|
||||
})
|
||||
// Replace with
|
||||
crashReporter.start({
|
||||
companyName: 'Crashly',
|
||||
submitURL: 'https://crash.server.com',
|
||||
uploadToServer: true
|
||||
})
|
||||
```
|
||||
|
||||
### `nativeImage`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
nativeImage.createFromBuffer(buffer, 1.0)
|
||||
// Replace with
|
||||
nativeImage.createFromBuffer(buffer, {
|
||||
scaleFactor: 1.0
|
||||
})
|
||||
```
|
||||
|
||||
### `process`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
const info = process.getProcessMemoryInfo()
|
||||
```
|
||||
|
||||
### `screen`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
screen.getMenuBarHeight()
|
||||
// Replace with
|
||||
screen.getPrimaryDisplay().workArea
|
||||
```
|
||||
|
||||
### `session`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
ses.setCertificateVerifyProc((hostname, certificate, callback) => {
|
||||
callback(true)
|
||||
})
|
||||
// Replace with
|
||||
ses.setCertificateVerifyProc((request, callback) => {
|
||||
callback(0)
|
||||
})
|
||||
```
|
||||
|
||||
### `Tray`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
tray.setHighlightMode(true)
|
||||
// Replace with
|
||||
tray.setHighlightMode('on')
|
||||
|
||||
// Deprecated
|
||||
tray.setHighlightMode(false)
|
||||
// Replace with
|
||||
tray.setHighlightMode('off')
|
||||
```
|
||||
|
||||
### `webContents`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
webContents.openDevTools({ detach: true })
|
||||
// Replace with
|
||||
webContents.openDevTools({ mode: 'detach' })
|
||||
|
||||
// Removed
|
||||
webContents.setSize(options)
|
||||
// There is no replacement for this API
|
||||
```
|
||||
|
||||
### `webFrame`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
webFrame.registerURLSchemeAsSecure('app')
|
||||
// Replace with
|
||||
protocol.registerStandardSchemes(['app'], { secure: true })
|
||||
|
||||
// Deprecated
|
||||
webFrame.registerURLSchemeAsPrivileged('app', { secure: true })
|
||||
// Replace with
|
||||
protocol.registerStandardSchemes(['app'], { secure: true })
|
||||
```
|
||||
|
||||
### `<webview>`
|
||||
|
||||
```js
|
||||
// Removed
|
||||
webview.setAttribute('disableguestresize', '')
|
||||
// There is no replacement for this API
|
||||
|
||||
// Removed
|
||||
webview.setAttribute('guestinstance', instanceId)
|
||||
// There is no replacement for this API
|
||||
|
||||
// Keyboard listeners no longer work on webview tag
|
||||
webview.onkeydown = () => { /* handler */ }
|
||||
webview.onkeyup = () => { /* handler */ }
|
||||
```
|
||||
|
||||
### Node Headers URL
|
||||
|
||||
This is the URL specified as `disturl` in a `.npmrc` file or as the `--dist-url`
|
||||
command line flag when building native Node modules.
|
||||
|
||||
Deprecated: https://atom.io/download/atom-shell
|
||||
|
||||
Replace with: https://atom.io/download/electron
|
||||
|
||||
## Breaking API Changes (2.0)
|
||||
|
||||
The following list includes the breaking API changes made in Electron 2.0.
|
||||
|
||||
### `BrowserWindow`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
let optionsA = { titleBarStyle: 'hidden-inset' }
|
||||
let windowA = new BrowserWindow(optionsA)
|
||||
// Replace with
|
||||
let optionsB = { titleBarStyle: 'hiddenInset' }
|
||||
let windowB = new BrowserWindow(optionsB)
|
||||
```
|
||||
|
||||
### `menu`
|
||||
|
||||
```js
|
||||
// Removed
|
||||
menu.popup(browserWindow, 100, 200, 2)
|
||||
// Replaced with
|
||||
menu.popup(browserWindow, { x: 100, y: 200, positioningItem: 2 })
|
||||
```
|
||||
|
||||
### `nativeImage`
|
||||
|
||||
```js
|
||||
// Removed
|
||||
nativeImage.toPng()
|
||||
// Replaced with
|
||||
nativeImage.toPNG()
|
||||
|
||||
// Removed
|
||||
nativeImage.toJpeg()
|
||||
// Replaced with
|
||||
nativeImage.toJPEG()
|
||||
```
|
||||
|
||||
### `process`
|
||||
|
||||
* `process.versions.electron` and `process.version.chrome` will be made
|
||||
read-only properties for consistency with the other `process.versions`
|
||||
properties set by Node.
|
||||
|
||||
### `webContents`
|
||||
|
||||
```js
|
||||
// Removed
|
||||
webContents.setZoomLevelLimits(1, 2)
|
||||
// Replaced with
|
||||
webContents.setVisualZoomLevelLimits(1, 2)
|
||||
```
|
||||
|
||||
### `webFrame`
|
||||
|
||||
```js
|
||||
// Removed
|
||||
webFrame.setZoomLevelLimits(1, 2)
|
||||
// Replaced with
|
||||
webFrame.setVisualZoomLevelLimits(1, 2)
|
||||
```
|
||||
|
||||
### `<webview>`
|
||||
|
||||
```js
|
||||
// Removed
|
||||
webview.setZoomLevelLimits(1, 2)
|
||||
// Replaced with
|
||||
webview.setVisualZoomLevelLimits(1, 2)
|
||||
```
|
||||
|
||||
### Duplicate ARM Assets
|
||||
|
||||
Each Electron release includes two identical ARM builds with slightly different
|
||||
filenames, like `electron-v1.7.3-linux-arm.zip` and
|
||||
`electron-v1.7.3-linux-armv7l.zip`. The asset with the `v7l` prefix was added
|
||||
to clarify to users which ARM version it supports, and to disambiguate it from
|
||||
future armv6l and arm64 assets that may be produced.
|
||||
|
||||
The file _without the prefix_ is still being published to avoid breaking any
|
||||
setups that may be consuming it. Starting at 2.0, the unprefixed file will
|
||||
no longer be published.
|
||||
|
||||
For details, see
|
||||
[6986](https://github.com/electron/electron/pull/6986)
|
||||
and
|
||||
[7189](https://github.com/electron/electron/pull/7189).
|
||||
@@ -1,25 +1,26 @@
|
||||
# BrowserView
|
||||
|
||||
A `BrowserView` can be used to embed additional web content into a
|
||||
[`BrowserWindow`](browser-window.md). It is like a child window, except that it is positioned
|
||||
relative to its owning window. It is meant to be an alternative to the
|
||||
`webview` tag.
|
||||
|
||||
## Class: BrowserView
|
||||
|
||||
> Create and control views.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
A `BrowserView` can be used to embed additional web content into a
|
||||
[`BrowserWindow`](browser-window.md). It is like a child window, except that it is positioned
|
||||
relative to its owning window. It is meant to be an alternative to the
|
||||
`webview` tag.
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
// In the main process.
|
||||
const { BrowserView, BrowserWindow } = require('electron')
|
||||
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
let win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.on('closed', () => {
|
||||
win = null
|
||||
})
|
||||
|
||||
const view = new BrowserView()
|
||||
let view = new BrowserView()
|
||||
win.setBrowserView(view)
|
||||
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
|
||||
view.webContents.loadURL('https://electronjs.org')
|
||||
@@ -30,6 +31,25 @@ view.webContents.loadURL('https://electronjs.org')
|
||||
* `options` Object (optional)
|
||||
* `webPreferences` Object (optional) - See [BrowserWindow](browser-window.md).
|
||||
|
||||
### Static Methods
|
||||
|
||||
#### `BrowserView.getAllViews()`
|
||||
|
||||
Returns `BrowserView[]` - An array of all opened BrowserViews.
|
||||
|
||||
#### `BrowserView.fromWebContents(webContents)`
|
||||
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
|
||||
Returns `BrowserView | null` - The BrowserView that owns the given `webContents`
|
||||
or `null` if the contents are not owned by a BrowserView.
|
||||
|
||||
#### `BrowserView.fromId(id)`
|
||||
|
||||
* `id` Integer
|
||||
|
||||
Returns `BrowserView` - The view with the given `id`.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
Objects created with `new BrowserView` have the following properties:
|
||||
@@ -38,10 +58,24 @@ Objects created with `new BrowserView` have the following properties:
|
||||
|
||||
A [`WebContents`](web-contents.md) object owned by this view.
|
||||
|
||||
#### `view.id` _Experimental_
|
||||
|
||||
A `Integer` representing the unique ID of the view.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
Objects created with `new BrowserView` have the following instance methods:
|
||||
|
||||
#### `view.destroy()`
|
||||
|
||||
Force closing the view, the `unload` and `beforeunload` events won't be emitted
|
||||
for the web page. After you're done with a view, call this function in order to
|
||||
free memory and other resources as soon as possible.
|
||||
|
||||
#### `view.isDestroyed()`
|
||||
|
||||
Returns `Boolean` - Whether the view is destroyed.
|
||||
|
||||
#### `view.setAutoResize(options)` _Experimental_
|
||||
|
||||
* `options` Object
|
||||
|
||||
@@ -8,13 +8,19 @@ Process: [Main](../glossary.md#main-process)
|
||||
// In the main process.
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
// Or use `remote` from the renderer process.
|
||||
// const { BrowserWindow } = require('electron').remote
|
||||
|
||||
let win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.on('closed', () => {
|
||||
win = null
|
||||
})
|
||||
|
||||
// Load a remote URL
|
||||
win.loadURL('https://github.com')
|
||||
|
||||
// Or load a local HTML file
|
||||
win.loadFile('index.html')
|
||||
win.loadURL(`file://${__dirname}/app/index.html`)
|
||||
```
|
||||
|
||||
## Frameless window
|
||||
@@ -22,13 +28,12 @@ win.loadFile('index.html')
|
||||
To create a window without chrome, or a transparent window in arbitrary shape,
|
||||
you can use the [Frameless Window](frameless-window.md) API.
|
||||
|
||||
## Showing the window gracefully
|
||||
## Showing window gracefully
|
||||
|
||||
When loading a page in the window directly, users may see the page load incrementally,
|
||||
which is not a good experience for a native app. To make the window display
|
||||
without a visual flash, there are two solutions for different situations.
|
||||
When loading a page in the window directly, users may see the page load incrementally, which is not a good experience for a native app. To make the window display
|
||||
without visual flash, there are two solutions for different situations.
|
||||
|
||||
### Using the `ready-to-show` event
|
||||
## Using `ready-to-show` event
|
||||
|
||||
While loading the page, the `ready-to-show` event will be emitted when the renderer
|
||||
process has rendered the page for the first time if the window has not been shown yet. Showing
|
||||
@@ -36,7 +41,7 @@ the window after this event will have no visual flash:
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({ show: false })
|
||||
let win = new BrowserWindow({ show: false })
|
||||
win.once('ready-to-show', () => {
|
||||
win.show()
|
||||
})
|
||||
@@ -49,7 +54,7 @@ event.
|
||||
Please note that using this event implies that the renderer will be considered "visible" and
|
||||
paint even though `show` is false. This event will never fire if you use `paintWhenInitiallyHidden: false`
|
||||
|
||||
### Setting the `backgroundColor` property
|
||||
## Setting `backgroundColor`
|
||||
|
||||
For a complex app, the `ready-to-show` event could be emitted too late, making
|
||||
the app feel slow. In this case, it is recommended to show the window
|
||||
@@ -58,7 +63,7 @@ immediately, and use a `backgroundColor` close to your app's background:
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
const win = new BrowserWindow({ backgroundColor: '#2e2c29' })
|
||||
let win = new BrowserWindow({ backgroundColor: '#2e2c29' })
|
||||
win.loadURL('https://github.com')
|
||||
```
|
||||
|
||||
@@ -72,8 +77,8 @@ By using `parent` option, you can create child windows:
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
const top = new BrowserWindow()
|
||||
const child = new BrowserWindow({ parent: top })
|
||||
let top = new BrowserWindow()
|
||||
let child = new BrowserWindow({ parent: top })
|
||||
child.show()
|
||||
top.show()
|
||||
```
|
||||
@@ -88,7 +93,7 @@ window, you have to set both `parent` and `modal` options:
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
const child = new BrowserWindow({ parent: top, modal: true, show: false })
|
||||
let child = new BrowserWindow({ parent: top, modal: true, show: false })
|
||||
child.loadURL('https://github.com')
|
||||
child.once('ready-to-show', () => {
|
||||
child.show()
|
||||
@@ -175,7 +180,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `simpleFullscreen` Boolean (optional) - Use pre-Lion fullscreen on macOS. Default is `false`.
|
||||
* `skipTaskbar` Boolean (optional) - Whether to show the window in taskbar. Default is
|
||||
`false`.
|
||||
* `kiosk` Boolean (optional) - Whether the window is in kiosk mode. Default is `false`.
|
||||
* `kiosk` Boolean (optional) - The kiosk mode. Default is `false`.
|
||||
* `title` String (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored.
|
||||
* `icon` ([NativeImage](native-image.md) | String) (optional) - The window icon. On Windows it is
|
||||
recommended to use `ICO` icons to get best visual effects, you can also
|
||||
@@ -188,9 +193,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `parent` BrowserWindow (optional) - Specify parent window. Default is `null`.
|
||||
* `modal` Boolean (optional) - Whether this is a modal window. This only works when the
|
||||
window is a child window. Default is `false`.
|
||||
* `acceptFirstMouse` Boolean (optional) - Whether clicking an inactive window will also
|
||||
click through to the web contents. Default is `false` on macOS. This option is not
|
||||
configurable on other platforms.
|
||||
* `acceptFirstMouse` Boolean (optional) - Whether the web view accepts a single
|
||||
mouse-down event that simultaneously activates the window. Default is
|
||||
`false`.
|
||||
* `disableAutoHideCursor` Boolean (optional) - Whether to hide cursor when typing.
|
||||
Default is `false`.
|
||||
* `autoHideMenuBar` Boolean (optional) - Auto hide the menu bar unless the `Alt`
|
||||
@@ -210,33 +215,30 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
Default is `false`. On Windows, does not work unless the window is frameless.
|
||||
* `type` String (optional) - The type of window, default is normal window. See more about
|
||||
this below.
|
||||
* `visualEffectState` String (optional) - Specify how the material appearance should reflect window activity state on macOS. Must be used with the `vibrancy` property. Possible values are:
|
||||
* `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) _macOS_ _Windows_ - The style of window title bar.
|
||||
* `titleBarStyle` String (optional) - The style of window title bar.
|
||||
Default is `default`. Possible values are:
|
||||
* `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
|
||||
* `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
|
||||
where the traffic light buttons are slightly more inset from the window edge.
|
||||
* `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.
|
||||
* `trafficLightPosition` [Point](structures/point.md) (optional) - Set a
|
||||
custom position for the traffic light buttons in frameless windows.
|
||||
* `roundedCorners` Boolean (optional) - Whether frameless window should have
|
||||
rounded corners on macOS. Default is `true`.
|
||||
* `fullscreenWindowTitle` Boolean (optional) _Deprecated_ - Shows the title in
|
||||
the title bar in full screen mode on macOS for `hiddenInset` titleBarStyle.
|
||||
* `customButtonsOnHover` Boolean (optional) - Draw custom close,
|
||||
and minimize buttons on macOS frameless windows. These buttons will not display
|
||||
unless hovered over in the top left of the window. These custom buttons prevent
|
||||
issues with mouse events that occur with the standard window toolbar buttons.
|
||||
**Note:** This option is currently experimental.
|
||||
* `trafficLightPosition` [Point](structures/point.md) (optional) - Set a custom position for the traffic light buttons. Can only be used with `titleBarStyle` set to `hidden`
|
||||
* `fullscreenWindowTitle` Boolean (optional) - Shows the title in the
|
||||
title bar in full screen mode on macOS for all `titleBarStyle` options.
|
||||
Default is `false`.
|
||||
* `thickFrame` Boolean (optional) - Use `WS_THICKFRAME` style for frameless windows on
|
||||
Windows, which adds standard window frame. Setting it to `false` will remove
|
||||
window shadow and window animations. Default is `true`.
|
||||
* `vibrancy` String (optional) - Add a type of vibrancy effect to the window, only on
|
||||
macOS. Can be `appearance-based`, `light`, `dark`, `titlebar`, `selection`,
|
||||
`menu`, `popover`, `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are deprecated and have been removed in macOS Catalina (10.15).
|
||||
`menu`, `popover`, `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please note that using `frame: false` in combination with a vibrancy value requires that you use a non-default `titleBarStyle` as well. Also note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` have been deprecated and will be removed in an upcoming version of macOS.
|
||||
* `zoomToPageWidth` Boolean (optional) - Controls the behavior on macOS when
|
||||
option-clicking the green stoplight button on the toolbar or by clicking the
|
||||
Window > Zoom menu item. If `true`, the window will grow to the preferred
|
||||
@@ -265,12 +267,14 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
be the absolute file path to the script.
|
||||
When node integration is turned off, the preload script can reintroduce
|
||||
Node global symbols back to the global scope. See example
|
||||
[here](context-bridge.md#exposing-node-global-symbols).
|
||||
[here](process.md#event-loaded).
|
||||
* `sandbox` Boolean (optional) - If set, this will sandbox the renderer
|
||||
associated with the window, making it compatible with the Chromium
|
||||
OS-level sandbox and disabling the Node.js engine. This is not the same as
|
||||
the `nodeIntegration` option and the APIs available to the preload script
|
||||
are more limited. Read more about the option [here](../tutorial/sandbox.md).
|
||||
are more limited. Read more about the option [here](sandbox-option.md).
|
||||
* `enableRemoteModule` Boolean (optional) - Whether to enable the [`remote`](remote.md) module.
|
||||
Default is `true`.
|
||||
* `session` [Session](session.md#class-session) (optional) - Sets the session used by the
|
||||
page. Instead of passing the Session object directly, you can also choose to
|
||||
use the `partition` option instead, which accepts a partition string. When
|
||||
@@ -282,6 +286,13 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
same `partition`. If there is no `persist:` prefix, the page will use an
|
||||
in-memory session. By assigning the same `partition`, multiple pages can share
|
||||
the same session. Default is the default session.
|
||||
* `affinity` String (optional) - When specified, web pages with the same
|
||||
`affinity` will run in the same renderer process. Note that due to reusing
|
||||
the renderer process, certain `webPreferences` options will also be shared
|
||||
between the web pages even when you specified different values for them,
|
||||
including but not limited to `preload`, `sandbox` and `nodeIntegration`.
|
||||
So it is suggested to use exact same `webPreferences` for web pages with
|
||||
the same `affinity`. _This property is experimental_
|
||||
* `zoomFactor` Number (optional) - The default zoom factor of the page, `3.0` represents
|
||||
`300%`. Default is `1.0`.
|
||||
* `javascript` Boolean (optional) - Enables JavaScript support. Default is `true`.
|
||||
@@ -328,21 +339,22 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
more details.
|
||||
* `contextIsolation` Boolean (optional) - Whether to run Electron APIs and
|
||||
the specified `preload` script in a separate JavaScript context. Defaults
|
||||
to `true`. The context that the `preload` script runs in will only have
|
||||
access to its own dedicated `document` and `window` globals, as well as
|
||||
its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.),
|
||||
which are all invisible to the loaded content. The Electron API will only
|
||||
be available in the `preload` script and not the loaded page. This option
|
||||
should be used when loading potentially untrusted remote content to ensure
|
||||
the loaded content cannot tamper with the `preload` script and any
|
||||
Electron APIs being used. This option uses the same technique used by
|
||||
[Chrome Content Scripts][chrome-content-scripts]. You can access this
|
||||
context in the dev tools by selecting the 'Electron Isolated Context'
|
||||
entry in the combo box at the top of the Console tab.
|
||||
to `false`. The context that the `preload` script runs in will still
|
||||
have full access to the `document` and `window` globals but it will use
|
||||
its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.)
|
||||
and will be isolated from any changes made to the global environment
|
||||
by the loaded page. The Electron API will only be available in the
|
||||
`preload` script and not the loaded page. This option should be used when
|
||||
loading potentially untrusted remote content to ensure the loaded content
|
||||
cannot tamper with the `preload` script and any Electron APIs being used.
|
||||
This option uses the same technique used by [Chrome Content Scripts][chrome-content-scripts].
|
||||
You can access this context in the dev tools by selecting the
|
||||
'Electron Isolated Context' entry in the combo box at the top of the
|
||||
Console tab.
|
||||
* `nativeWindowOpen` Boolean (optional) - Whether to use native
|
||||
`window.open()`. Defaults to `false`. Child windows will always have node
|
||||
integration disabled unless `nodeIntegrationInSubFrames` is true. **Note:** The default
|
||||
value will be changing to `true` in Electron 15.
|
||||
integration disabled unless `nodeIntegrationInSubFrames` is true. **Note:** This option is currently
|
||||
experimental.
|
||||
* `webviewTag` Boolean (optional) - Whether to enable the [`<webview>` tag](webview-tag.md).
|
||||
Defaults to `false`. **Note:** The
|
||||
`preload` script configured for the `<webview>` will have node integration
|
||||
@@ -375,22 +387,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
to accessibility tools such as screen readers. This string is not directly
|
||||
visible to users.
|
||||
* `spellcheck` Boolean (optional) - Whether to enable the builtin spellchecker.
|
||||
Default is `true`.
|
||||
* `enableWebSQL` Boolean (optional) - Whether to enable the [WebSQL api](https://www.w3.org/TR/webdatabase/).
|
||||
Default is `true`.
|
||||
* `v8CacheOptions` String (optional) - Enforces the v8 code caching policy
|
||||
used by blink. Accepted values are
|
||||
* `none` - Disables code caching
|
||||
* `code` - Heuristic based code caching
|
||||
* `bypassHeatCheck` - Bypass code caching heuristics but with lazy compilation
|
||||
* `bypassHeatCheckAndEagerCompile` - Same as above except compilation is eager.
|
||||
Default policy is `code`.
|
||||
* `enablePreferredSizeMode` Boolean (optional) - Whether to enable
|
||||
preferred size mode. The preferred size is the minimum size needed to
|
||||
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` [OverlayOptions](structures/overlay-options.md) | 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`. On Windows, the [OverlayOptions](structures/overlay-options.md) can be used instead of a boolean to specify colors for the overlay.
|
||||
Default is `false`.
|
||||
|
||||
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
|
||||
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
|
||||
@@ -456,7 +453,6 @@ window.onbeforeunload = (e) => {
|
||||
e.returnValue = false // equivalent to `return false` but not recommended
|
||||
}
|
||||
```
|
||||
|
||||
_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._
|
||||
|
||||
#### Event: 'closed'
|
||||
@@ -532,12 +528,6 @@ Note that this is only emitted when the window is being resized manually. Resizi
|
||||
|
||||
Emitted after the window has been resized.
|
||||
|
||||
#### Event: 'resized' _macOS_ _Windows_
|
||||
|
||||
Emitted once when the window has finished being resized.
|
||||
|
||||
This is usually emitted when the window has been resized manually. On macOS, resizing the window with `setBounds`/`setSize` and setting the `animate` parameter to `true` will also emit this event once resizing has finished.
|
||||
|
||||
#### Event: 'will-move' _macOS_ _Windows_
|
||||
|
||||
Returns:
|
||||
@@ -553,12 +543,12 @@ Note that this is only emitted when the window is being resized manually. Resizi
|
||||
|
||||
Emitted when the window is being moved to a new position.
|
||||
|
||||
#### Event: 'moved' _macOS_ _Windows_
|
||||
__Note__: On macOS this event is an alias of `moved`.
|
||||
|
||||
#### Event: 'moved' _macOS_
|
||||
|
||||
Emitted once when the window is moved to a new position.
|
||||
|
||||
__Note__: On macOS this event is an alias of `move`.
|
||||
|
||||
#### Event: 'enter-full-screen'
|
||||
|
||||
Emitted when the window enters a full-screen state.
|
||||
@@ -601,7 +591,7 @@ e.g. `APPCOMMAND_BROWSER_BACKWARD` is emitted as `browser-backward`.
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow()
|
||||
let win = new BrowserWindow()
|
||||
win.on('app-command', (e, cmd) => {
|
||||
// Navigate the window back when the user hits their mouse back button
|
||||
if (cmd === 'browser-backward' && win.webContents.canGoBack()) {
|
||||
@@ -636,12 +626,6 @@ Returns:
|
||||
|
||||
Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`, `left`.
|
||||
|
||||
The method underlying this event is built to handle older macOS-style trackpad swiping,
|
||||
where the content on the screen doesn't move with the swipe. Most macOS trackpads are not
|
||||
configured to allow this kind of swiping anymore, so in order for it to emit properly the
|
||||
'Swipe between pages' preference in `System Preferences > Trackpad > More Gestures` must be
|
||||
set to 'Swipe with two or three fingers'.
|
||||
|
||||
#### Event: 'rotate-gesture' _macOS_
|
||||
|
||||
Returns:
|
||||
@@ -667,20 +651,6 @@ Emitted when the window has closed a sheet.
|
||||
|
||||
Emitted when the native new tab button is clicked.
|
||||
|
||||
#### Event: 'system-context-menu' _Windows_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `point` [Point](structures/point.md) - The screen coordinates the context menu was triggered at
|
||||
|
||||
Emitted when the system context menu is triggered on the window, this is
|
||||
normally only triggered when the user right clicks on the non-client area
|
||||
of your window. This is the window titlebar or any area you have declared
|
||||
as `-webkit-app-region: drag` in a frameless window.
|
||||
|
||||
Calling `event.preventDefault()` will prevent the menu from being displayed.
|
||||
|
||||
### Static Methods
|
||||
|
||||
The `BrowserWindow` class has the following static methods:
|
||||
@@ -710,7 +680,77 @@ Returns `BrowserWindow | null` - The window that owns the given `browserView`. I
|
||||
|
||||
* `id` Integer
|
||||
|
||||
Returns `BrowserWindow | null` - The window with the given `id`.
|
||||
Returns `BrowserWindow` - The window with the given `id`.
|
||||
|
||||
#### `BrowserWindow.addExtension(path)`
|
||||
|
||||
* `path` String
|
||||
|
||||
Adds Chrome extension located at `path`, and returns extension's name.
|
||||
|
||||
The method will also not return if the extension's manifest is missing or incomplete.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `BrowserWindow.removeExtension(name)`
|
||||
|
||||
* `name` String
|
||||
|
||||
Remove a Chrome extension by name.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `BrowserWindow.getExtensions()`
|
||||
|
||||
Returns `Record<String, ExtensionInfo>` - The keys are the extension names and each value is
|
||||
an Object containing `name` and `version` properties.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `BrowserWindow.addDevToolsExtension(path)`
|
||||
|
||||
* `path` String
|
||||
|
||||
Adds DevTools extension located at `path`, and returns extension's name.
|
||||
|
||||
The extension will be remembered so you only need to call this API once, this
|
||||
API is not for programming use. If you try to add an extension that has already
|
||||
been loaded, this method will not return and instead log a warning to the
|
||||
console.
|
||||
|
||||
The method will also not return if the extension's manifest is missing or incomplete.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `BrowserWindow.removeDevToolsExtension(name)`
|
||||
|
||||
* `name` String
|
||||
|
||||
Remove a DevTools extension by name.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `BrowserWindow.getDevToolsExtensions()`
|
||||
|
||||
Returns `Record<string, ExtensionInfo>` - The keys are the extension names and each value is
|
||||
an Object containing `name` and `version` properties.
|
||||
|
||||
To check if a DevTools extension is installed you can run the following:
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
let installed = BrowserWindow.getDevToolsExtensions().hasOwnProperty('devtron')
|
||||
console.log(installed)
|
||||
```
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
@@ -719,7 +759,7 @@ Objects created with `new BrowserWindow` have the following properties:
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
// In this example `win` is our instance
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
let win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.loadURL('https://github.com')
|
||||
```
|
||||
|
||||
@@ -733,7 +773,7 @@ events.
|
||||
|
||||
#### `win.id` _Readonly_
|
||||
|
||||
A `Integer` property representing the unique ID of the window. Each ID is unique among all `BrowserWindow` instances of the entire Electron application.
|
||||
A `Integer` property representing the unique ID of the window.
|
||||
|
||||
#### `win.autoHideMenuBar`
|
||||
|
||||
@@ -742,55 +782,6 @@ A `Boolean` property that determines whether the window menu bar should hide its
|
||||
If the menu bar is already visible, setting this property to `true` won't
|
||||
hide it immediately.
|
||||
|
||||
#### `win.simpleFullScreen`
|
||||
|
||||
A `Boolean` property that determines whether the window is in simple (pre-Lion) fullscreen mode.
|
||||
|
||||
#### `win.fullScreen`
|
||||
|
||||
A `Boolean` property that determines whether the window is in fullscreen mode.
|
||||
|
||||
#### `win.focusable` _Windows_ _macOS_
|
||||
|
||||
A `Boolean` property that determines whether the window is focusable.
|
||||
|
||||
#### `win.visibleOnAllWorkspaces`
|
||||
|
||||
A `Boolean` property that determines whether the window is visible on all workspaces.
|
||||
|
||||
**Note:** Always returns false on Windows.
|
||||
|
||||
#### `win.shadow`
|
||||
|
||||
A `Boolean` property that determines whether the window has a shadow.
|
||||
|
||||
#### `win.menuBarVisible` _Windows_ _Linux_
|
||||
|
||||
A `Boolean` property that determines whether the menu bar should be visible.
|
||||
|
||||
**Note:** If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
|
||||
#### `win.kiosk`
|
||||
|
||||
A `Boolean` property that determines whether the window is in kiosk mode.
|
||||
|
||||
#### `win.documentEdited` _macOS_
|
||||
|
||||
A `Boolean` property that specifies whether the window’s document has been edited.
|
||||
|
||||
The icon in title bar will become gray when set to `true`.
|
||||
|
||||
#### `win.representedFilename` _macOS_
|
||||
|
||||
A `String` property that determines the pathname of the file the window represents,
|
||||
and the icon of the file will show in window's title bar.
|
||||
|
||||
#### `win.title`
|
||||
|
||||
A `String` property that determines the title of the native window.
|
||||
|
||||
**Note:** The title of the web page can be different from the title of the native window.
|
||||
|
||||
#### `win.minimizable`
|
||||
|
||||
A `Boolean` property that determines whether the window can be manually minimized by user.
|
||||
@@ -946,7 +937,7 @@ Returns `Boolean` - Whether the window is in fullscreen mode.
|
||||
|
||||
Enters or leaves simple fullscreen mode.
|
||||
|
||||
Simple fullscreen mode emulates the native fullscreen behavior found in versions of macOS prior to Lion (10.7).
|
||||
Simple fullscreen mode emulates the native fullscreen behavior found in versions of Mac OS X prior to Lion (10.7).
|
||||
|
||||
#### `win.isSimpleFullScreen()` _macOS_
|
||||
|
||||
@@ -956,11 +947,11 @@ Returns `Boolean` - Whether the window is in simple (pre-Lion) fullscreen mode.
|
||||
|
||||
Returns `Boolean` - Whether the window is in normal state (not maximized, not minimized, not in fullscreen mode).
|
||||
|
||||
#### `win.setAspectRatio(aspectRatio[, extraSize])`
|
||||
#### `win.setAspectRatio(aspectRatio[, extraSize])` _macOS_
|
||||
|
||||
* `aspectRatio` Float - The aspect ratio to maintain for some portion of the
|
||||
content view.
|
||||
* `extraSize` [Size](structures/size.md) (optional) _macOS_ - The extra size not to be included while
|
||||
* `extraSize` [Size](structures/size.md) (optional) - The extra size not to be included while
|
||||
maintaining the aspect ratio.
|
||||
|
||||
This will make a window maintain an aspect ratio. The extra size allows a
|
||||
@@ -973,12 +964,12 @@ Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
|
||||
on the right edge and 50 pixels of controls below the player. In order to
|
||||
maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
|
||||
the player itself we would call this function with arguments of 16/9 and
|
||||
{ width: 40, height: 50 }. The second argument doesn't care where the extra width and height
|
||||
[ 40, 50 ]. The second argument doesn't care where the extra width and height
|
||||
are within the content view--only that they exist. Sum any extra width and
|
||||
height areas you have within the overall content view.
|
||||
|
||||
The aspect ratio is not respected when window is resized programmatically with
|
||||
APIs like `win.setSize`.
|
||||
Calling this function with a value of `0` will remove any previously set aspect
|
||||
ratios.
|
||||
|
||||
#### `win.setBackgroundColor(backgroundColor)`
|
||||
|
||||
@@ -1029,11 +1020,6 @@ console.log(win.getBounds())
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
|
||||
|
||||
#### `win.getBackgroundColor()`
|
||||
|
||||
Returns `String` - Gets the background color of the window. See [Setting
|
||||
`backgroundColor`](#setting-backgroundcolor).
|
||||
|
||||
#### `win.setContentBounds(bounds[, animate])`
|
||||
|
||||
* `bounds` [Rectangle](structures/rectangle.md)
|
||||
@@ -1060,7 +1046,7 @@ Disable or enable the window.
|
||||
|
||||
#### `win.isEnabled()`
|
||||
|
||||
Returns `Boolean` - whether the window is enabled.
|
||||
Returns Boolean - whether the window is enabled.
|
||||
|
||||
#### `win.setSize(width, height[, animate])`
|
||||
|
||||
@@ -1112,11 +1098,15 @@ Returns `Integer[]` - Contains the window's maximum width and height.
|
||||
|
||||
* `resizable` Boolean
|
||||
|
||||
Sets whether the window can be manually resized by the user.
|
||||
Sets whether the window can be manually resized by user.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isResizable()`
|
||||
|
||||
Returns `Boolean` - Whether the window can be manually resized by the user.
|
||||
Returns `Boolean` - Whether the window can be manually resized by user.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMovable(movable)` _macOS_ _Windows_
|
||||
|
||||
@@ -1124,29 +1114,41 @@ Returns `Boolean` - Whether the window can be manually resized by the user.
|
||||
|
||||
Sets whether the window can be moved by user. On Linux does nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isMovable()` _macOS_ _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window can be moved by user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMinimizable(minimizable)` _macOS_ _Windows_
|
||||
|
||||
* `minimizable` Boolean
|
||||
|
||||
Sets whether the window can be manually minimized by user. On Linux does nothing.
|
||||
Sets whether the window can be manually minimized by user. On Linux does
|
||||
nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isMinimizable()` _macOS_ _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window can be manually minimized by the user.
|
||||
Returns `Boolean` - Whether the window can be manually minimized by user
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMaximizable(maximizable)` _macOS_ _Windows_
|
||||
|
||||
* `maximizable` Boolean
|
||||
|
||||
Sets whether the window can be manually maximized by user. On Linux does nothing.
|
||||
Sets whether the window can be manually maximized by user. On Linux does
|
||||
nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isMaximizable()` _macOS_ _Windows_
|
||||
|
||||
@@ -1154,15 +1156,23 @@ Returns `Boolean` - Whether the window can be manually maximized by user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setFullScreenable(fullscreenable)`
|
||||
|
||||
* `fullscreenable` Boolean
|
||||
|
||||
Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
||||
Sets whether the maximize/zoom window button toggles fullscreen mode or
|
||||
maximizes the window.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isFullScreenable()`
|
||||
|
||||
Returns `Boolean` - Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
||||
Returns `Boolean` - Whether the maximize/zoom window button toggles fullscreen mode or
|
||||
maximizes the window.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setClosable(closable)` _macOS_ _Windows_
|
||||
|
||||
@@ -1170,12 +1180,16 @@ Returns `Boolean` - Whether the maximize/zoom window button toggles fullscreen m
|
||||
|
||||
Sets whether the window can be manually closed by user. On Linux does nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isClosable()` _macOS_ _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window can be manually closed by user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setAlwaysOnTop(flag[, level][, relativeLevel])`
|
||||
|
||||
* `flag` Boolean
|
||||
@@ -1251,9 +1265,9 @@ a HTML-rendered toolbar. For example:
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow()
|
||||
let win = new BrowserWindow()
|
||||
|
||||
const toolbarRect = document.getElementById('toolbar').getBoundingClientRect()
|
||||
let toolbarRect = document.getElementById('toolbar').getBoundingClientRect()
|
||||
win.setSheetOffset(toolbarRect.height)
|
||||
```
|
||||
|
||||
@@ -1273,26 +1287,15 @@ Makes the window not show in the taskbar.
|
||||
|
||||
* `flag` Boolean
|
||||
|
||||
Enters or leaves kiosk mode.
|
||||
Enters or leaves the kiosk mode.
|
||||
|
||||
#### `win.isKiosk()`
|
||||
|
||||
Returns `Boolean` - Whether the window is in kiosk mode.
|
||||
|
||||
#### `win.isTabletMode()` _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window is in Windows 10 tablet mode.
|
||||
|
||||
Since Windows 10 users can [use their PC as tablet](https://support.microsoft.com/en-us/help/17210/windows-10-use-your-pc-like-a-tablet),
|
||||
under this mode apps can choose to optimize their UI for tablets, such as
|
||||
enlarging the titlebar and hiding titlebar buttons.
|
||||
|
||||
This API returns whether the window is in tablet mode, and the `resize` event
|
||||
can be be used to listen to changes to tablet mode.
|
||||
|
||||
#### `win.getMediaSourceId()`
|
||||
|
||||
Returns `String` - Window id in the format of DesktopCapturerSource's id. For example "window:1324:0".
|
||||
Returns `String` - Window id in the format of DesktopCapturerSource's id. For example "window:1234:0".
|
||||
|
||||
More precisely the format is `window:id:other_id` where `id` is `HWND` on
|
||||
Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
|
||||
@@ -1310,8 +1313,6 @@ The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
|
||||
|
||||
* `message` Integer
|
||||
* `callback` Function
|
||||
* `wParam` any - The `wParam` provided to the WndProc
|
||||
* `lParam` any - The `lParam` provided to the WndProc
|
||||
|
||||
Hooks a windows message. The `callback` is called when
|
||||
the message is received in the WndProc.
|
||||
@@ -1364,7 +1365,7 @@ Returns `Boolean` - Whether the window's document has been edited.
|
||||
|
||||
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
|
||||
|
||||
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. If the page is not visible, `rect` may be empty.
|
||||
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.
|
||||
|
||||
#### `win.loadURL(url[, options])`
|
||||
|
||||
@@ -1373,7 +1374,7 @@ Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
|
||||
* `httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer URL.
|
||||
* `userAgent` String (optional) - A user agent originating the request.
|
||||
* `extraHeaders` String (optional) - Extra headers separated by "\n"
|
||||
* `postData` ([UploadRawData](structures/upload-raw-data.md) | [UploadFile](structures/upload-file.md))[] (optional)
|
||||
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md) | [UploadBlob[]](structures/upload-blob.md)) (optional)
|
||||
* `baseURLForDataURL` String (optional) - Base URL (with trailing path separator) for files to be loaded by the data URL. This is needed only if the specified `url` is a data URL and needs to load other files.
|
||||
|
||||
Returns `Promise<void>` - the promise will resolve when the page has finished loading
|
||||
@@ -1390,7 +1391,7 @@ Node's [`url.format`](https://nodejs.org/api/url.html#url_url_format_urlobject)
|
||||
method:
|
||||
|
||||
```javascript
|
||||
const url = require('url').format({
|
||||
let url = require('url').format({
|
||||
protocol: 'file',
|
||||
slashes: true,
|
||||
pathname: require('path').join(__dirname, 'index.html')
|
||||
@@ -1591,6 +1592,8 @@ Changes window icon.
|
||||
|
||||
Sets whether the window traffic light buttons should be visible.
|
||||
|
||||
This cannot be called when `titleBarStyle` is set to `customButtonsOnHover`.
|
||||
|
||||
#### `win.setAutoHideMenuBar(hide)`
|
||||
|
||||
* `hide` Boolean
|
||||
@@ -1598,17 +1601,23 @@ Sets whether the window traffic light buttons should be visible.
|
||||
Sets whether the window menu bar should hide itself automatically. Once set the
|
||||
menu bar will only show when users press the single `Alt` key.
|
||||
|
||||
If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't hide it immediately.
|
||||
If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
|
||||
hide it immediately.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isMenuBarAutoHide()`
|
||||
|
||||
Returns `Boolean` - Whether menu bar automatically hides itself.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMenuBarVisibility(visible)` _Windows_ _Linux_
|
||||
|
||||
* `visible` Boolean
|
||||
|
||||
Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
|
||||
can still bring up the menu bar by pressing the single `Alt` key.
|
||||
|
||||
#### `win.isMenuBarVisible()`
|
||||
|
||||
@@ -1619,14 +1628,7 @@ Returns `Boolean` - Whether the menu bar is visible.
|
||||
* `visible` Boolean
|
||||
* `options` Object (optional)
|
||||
* `visibleOnFullScreen` Boolean (optional) _macOS_ - Sets whether
|
||||
the window should be visible above fullscreen windows.
|
||||
* `skipTransformProcessType` Boolean (optional) _macOS_ - Calling
|
||||
setVisibleOnAllWorkspaces will by default transform the process
|
||||
type between UIElementApplication and ForegroundApplication to
|
||||
ensure the correct behavior. However, this will hide the window
|
||||
and dock for a short time every time it is called. If your window
|
||||
is already of type UIElementApplication, you can bypass this
|
||||
transformation by passing true to skipTransformProcessType.
|
||||
the window should be visible above fullscreen windows _deprecated_
|
||||
|
||||
Sets whether the window should be visible on all workspaces.
|
||||
|
||||
@@ -1660,9 +1662,7 @@ events.
|
||||
Prevents the window contents from being captured by other apps.
|
||||
|
||||
On macOS it sets the NSWindow's sharingType to NSWindowSharingNone.
|
||||
On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
|
||||
For Windows 10 version 2004 and up the window will be removed from capture entirely,
|
||||
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
|
||||
On Windows it calls SetWindowDisplayAffinity with `WDA_MONITOR`.
|
||||
|
||||
#### `win.setFocusable(focusable)` _macOS_ _Windows_
|
||||
|
||||
@@ -1672,10 +1672,6 @@ Changes whether the window can be focused.
|
||||
|
||||
On macOS it does not remove the focus from the window.
|
||||
|
||||
#### `win.isFocusable()` _macOS_ _Windows_
|
||||
|
||||
Returns whether the window can be focused.
|
||||
|
||||
#### `win.setParentWindow(parent)`
|
||||
|
||||
* `parent` BrowserWindow | null
|
||||
@@ -1744,14 +1740,14 @@ deprecated and will be removed in an upcoming version of macOS.
|
||||
|
||||
* `position` [Point](structures/point.md)
|
||||
|
||||
Set a custom position for the traffic light buttons in frameless window.
|
||||
Set a custom position for the traffic light buttons. Can only be used with `titleBarStyle` set to `hidden`.
|
||||
|
||||
#### `win.getTrafficLightPosition()` _macOS_
|
||||
|
||||
Returns `Point` - The custom position for the traffic light buttons in
|
||||
frameless window.
|
||||
Returns `Point` - The current position for the traffic light buttons. Can only be used with `titleBarStyle`
|
||||
set to `hidden`.
|
||||
|
||||
#### `win.setTouchBar(touchBar)` _macOS_
|
||||
#### `win.setTouchBar(touchBar)` _macOS_ _Experimental_
|
||||
|
||||
* `touchBar` TouchBar | null
|
||||
|
||||
@@ -1783,13 +1779,6 @@ Replacement API for setBrowserView supporting work with multi browser views.
|
||||
|
||||
* `browserView` [BrowserView](browser-view.md)
|
||||
|
||||
#### `win.setTopBrowserView(browserView)` _Experimental_
|
||||
|
||||
* `browserView` [BrowserView](browser-view.md)
|
||||
|
||||
Raises `browserView` above other `BrowserView`s attached to `win`.
|
||||
Throws an error if `browserView` is not attached to `win`.
|
||||
|
||||
#### `win.getBrowserViews()` _Experimental_
|
||||
|
||||
Returns `BrowserView[]` - an array of all BrowserViews that have been attached
|
||||
@@ -1805,5 +1794,3 @@ removed in future Electron releases.
|
||||
[window-levels]: https://developer.apple.com/documentation/appkit/nswindow/level
|
||||
[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
|
||||
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
|
||||
|
||||
@@ -13,41 +13,30 @@ interface and is therefore an [EventEmitter][event-emitter].
|
||||
the request URL. If it is an object, it is expected to fully specify an HTTP request via the
|
||||
following properties:
|
||||
* `method` String (optional) - The HTTP request method. Defaults to the GET
|
||||
method.
|
||||
method.
|
||||
* `url` String (optional) - The request URL. Must be provided in the absolute
|
||||
form with the protocol scheme specified as http or https.
|
||||
form with the protocol scheme specified as http or https.
|
||||
* `session` Session (optional) - The [`Session`](session.md) instance with
|
||||
which the request is associated.
|
||||
which the request is associated.
|
||||
* `partition` String (optional) - The name of the [`partition`](session.md)
|
||||
with which the request is associated. Defaults to the empty string. The
|
||||
`session` option supersedes `partition`. Thus if a `session` is explicitly
|
||||
specified, `partition` is ignored.
|
||||
* `credentials` String (optional) - Can be `include` or `omit`. Whether to
|
||||
send [credentials](https://fetch.spec.whatwg.org/#credentials) with this
|
||||
request. If set to `include`, credentials from the session associated with
|
||||
the request will be used. If set to `omit`, credentials will not be sent
|
||||
with the request (and the `'login'` event will not be triggered in the
|
||||
event of a 401). This matches the behavior of the
|
||||
[fetch](https://fetch.spec.whatwg.org/#concept-request-credentials-mode)
|
||||
option of the same name. If this option is not specified, authentication
|
||||
data from the session will be sent, and cookies will not be sent (unless
|
||||
`useSessionCookies` is set).
|
||||
with which the request is associated. Defaults to the empty string. The
|
||||
`session` option prevails on `partition`. Thus if a `session` is explicitly
|
||||
specified, `partition` is ignored.
|
||||
* `useSessionCookies` Boolean (optional) - Whether to send cookies with this
|
||||
request from the provided session. If `credentials` is specified, this
|
||||
option has no effect. Default is `false`.
|
||||
* `protocol` String (optional) - Can be `http:` or `https:`. The protocol
|
||||
scheme in the form 'scheme:'. Defaults to 'http:'.
|
||||
request from the provided session. This will make the `net` request's
|
||||
cookie behavior match a `fetch` request. Default is `false`.
|
||||
* `protocol` String (optional) - The protocol scheme in the form 'scheme:'.
|
||||
Currently supported values are 'http:' or 'https:'. Defaults to 'http:'.
|
||||
* `host` String (optional) - The server host provided as a concatenation of
|
||||
the hostname and the port number 'hostname:port'.
|
||||
the hostname and the port number 'hostname:port'.
|
||||
* `hostname` String (optional) - The server host name.
|
||||
* `port` Integer (optional) - The server's listening port number.
|
||||
* `path` String (optional) - The path part of the request URL.
|
||||
* `redirect` String (optional) - Can be `follow`, `error` or `manual`. The
|
||||
redirect mode for this request. When mode is `error`, any redirection will
|
||||
be aborted. When mode is `manual` the redirection will be cancelled unless
|
||||
[`request.followRedirect`](#requestfollowredirect) is invoked synchronously
|
||||
during the [`redirect`](#event-redirect) event. Defaults to `follow`.
|
||||
* `origin` String (optional) - The origin URL of the request.
|
||||
* `redirect` String (optional) - The redirect mode for this request. Should be
|
||||
one of `follow`, `error` or `manual`. Defaults to `follow`. When mode is `error`,
|
||||
any redirection will be aborted. When mode is `manual` the redirection will be
|
||||
cancelled unless [`request.followRedirect`](#requestfollowredirect) is invoked
|
||||
synchronously during the [`redirect`](#event-redirect) event.
|
||||
|
||||
`options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
|
||||
strictly follow the Node.js model as described in the
|
||||
@@ -71,7 +60,7 @@ const request = net.request({
|
||||
|
||||
Returns:
|
||||
|
||||
* `response` [IncomingMessage](incoming-message.md) - An object representing the HTTP response message.
|
||||
* `response` IncomingMessage - An object representing the HTTP response message.
|
||||
|
||||
#### Event: 'login'
|
||||
|
||||
@@ -99,7 +88,6 @@ request.on('login', (authInfo, callback) => {
|
||||
callback('username', 'password')
|
||||
})
|
||||
```
|
||||
|
||||
Providing empty credentials will cancel the request and report an authentication
|
||||
error on the response object:
|
||||
|
||||
@@ -141,6 +129,7 @@ Emitted as the last event in the HTTP request-response transaction. The `close`
|
||||
event indicates that no more events will be emitted on either the `request` or
|
||||
`response` objects.
|
||||
|
||||
|
||||
#### Event: 'redirect'
|
||||
|
||||
Returns:
|
||||
@@ -182,20 +171,6 @@ lowercasing. It can be called only before first write. Calling this method after
|
||||
the first write will throw an error. If the passed value is not a `String`, its
|
||||
`toString()` method will be called to obtain the final value.
|
||||
|
||||
Certain headers are restricted from being set by apps. These headers are
|
||||
listed below. More information on restricted headers can be found in
|
||||
[Chromium's header utils](https://source.chromium.org/chromium/chromium/src/+/master:services/network/public/cpp/header_util.cc;drc=1562cab3f1eda927938f8f4a5a91991fefde66d3;bpv=1;bpt=1;l=22).
|
||||
|
||||
* `Content-Length`
|
||||
* `Host`
|
||||
* `Trailer` or `Te`
|
||||
* `Upgrade`
|
||||
* `Cookie2`
|
||||
* `Keep-Alive`
|
||||
* `Transfer-Encoding`
|
||||
|
||||
Additionally, setting the `Connection` header to the value `upgrade` is also disallowed.
|
||||
|
||||
#### `request.getHeader(name)`
|
||||
|
||||
* `name` String - Specify an extra header name.
|
||||
|
||||
@@ -199,7 +199,7 @@ const { clipboard } = require('electron')
|
||||
|
||||
const hasFormat = clipboard.has('<p>selection</p>')
|
||||
console.log(hasFormat)
|
||||
// 'true' or 'false'
|
||||
// 'true' or 'false
|
||||
```
|
||||
|
||||
### `clipboard.read(format)` _Experimental_
|
||||
@@ -208,10 +208,6 @@ console.log(hasFormat)
|
||||
|
||||
Returns `String` - Reads `format` type from the clipboard.
|
||||
|
||||
`format` should contain valid ASCII characters and have `/` separator.
|
||||
`a/c`, `a/bc` are valid formats while `/abc`, `abc/`, `a/`, `/a`, `a`
|
||||
are not valid.
|
||||
|
||||
### `clipboard.readBuffer(format)` _Experimental_
|
||||
|
||||
* `format` String
|
||||
@@ -222,9 +218,9 @@ Returns `Buffer` - Reads `format` type from the clipboard.
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
const buffer = Buffer.from('this is binary', 'utf8')
|
||||
clipboard.writeBuffer('public/utf8-plain-text', buffer)
|
||||
clipboard.writeBuffer('public.utf8-plain-text', buffer)
|
||||
|
||||
const ret = clipboard.readBuffer('public/utf8-plain-text')
|
||||
const ret = clipboard.readBuffer('public.utf8-plain-text')
|
||||
|
||||
console.log(buffer.equals(out))
|
||||
// true
|
||||
@@ -242,7 +238,7 @@ Writes the `buffer` into the clipboard as `format`.
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
const buffer = Buffer.from('writeBuffer', 'utf8')
|
||||
clipboard.writeBuffer('public/utf8-plain-text', buffer)
|
||||
clipboard.writeBuffer('public.utf8-plain-text', buffer)
|
||||
```
|
||||
|
||||
### `clipboard.write(data[, type])`
|
||||
|
||||
@@ -11,86 +11,85 @@ const { app } = require('electron')
|
||||
app.commandLine.appendSwitch('remote-debugging-port', '8315')
|
||||
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
// Your code here
|
||||
})
|
||||
```
|
||||
|
||||
## Electron CLI Flags
|
||||
## --ignore-connections-limit=`domains`
|
||||
|
||||
### --auth-server-whitelist=`url`
|
||||
Ignore the connections limit for `domains` list separated by `,`.
|
||||
|
||||
A comma-separated list of servers for which integrated authentication is enabled.
|
||||
|
||||
For example:
|
||||
|
||||
```sh
|
||||
--auth-server-whitelist='*example.com, *foobar.com, *baz'
|
||||
```
|
||||
|
||||
then any `url` ending with `example.com`, `foobar.com`, `baz` will be considered
|
||||
for integrated authentication. Without `*` prefix the URL has to match exactly.
|
||||
|
||||
### --auth-negotiate-delegate-whitelist=`url`
|
||||
|
||||
A comma-separated list of servers for which delegation of user credentials is required.
|
||||
Without `*` prefix the URL has to match exactly.
|
||||
|
||||
### --disable-ntlm-v2
|
||||
|
||||
Disables NTLM v2 for posix platforms, no effect elsewhere.
|
||||
|
||||
### --disable-http-cache
|
||||
## --disable-http-cache
|
||||
|
||||
Disables the disk cache for HTTP requests.
|
||||
|
||||
### --disable-http2
|
||||
## --disable-http2
|
||||
|
||||
Disable HTTP/2 and SPDY/3.1 protocols.
|
||||
|
||||
### --disable-renderer-backgrounding
|
||||
## --lang
|
||||
|
||||
Prevents Chromium from lowering the priority of invisible pages' renderer
|
||||
processes.
|
||||
Set a custom locale.
|
||||
|
||||
This flag is global to all renderer processes, if you only want to disable
|
||||
throttling in one window, you can take the hack of
|
||||
[playing silent audio][play-silent-audio].
|
||||
## --inspect=`port` and --inspect-brk=`port`
|
||||
|
||||
### --disk-cache-size=`size`
|
||||
Debug-related flags, see the [Debugging the Main Process][debugging-main-process] guide for details.
|
||||
|
||||
## --remote-debugging-port=`port`
|
||||
|
||||
Enables remote debugging over HTTP on the specified `port`.
|
||||
|
||||
## --disk-cache-size=`size`
|
||||
|
||||
Forces the maximum disk space to be used by the disk cache, in bytes.
|
||||
|
||||
### --enable-api-filtering-logging
|
||||
## --js-flags=`flags`
|
||||
|
||||
Enables caller stack logging for the following APIs (filtering events):
|
||||
Specifies the flags passed to the Node.js engine. It has to be passed when starting
|
||||
Electron if you want to enable the `flags` in the main process.
|
||||
|
||||
* `desktopCapturer.getSources()` / `desktop-capturer-get-sources`
|
||||
```sh
|
||||
$ electron --js-flags="--harmony_proxies --harmony_collections" your-app
|
||||
```
|
||||
|
||||
### --enable-logging[=file]
|
||||
See the [Node.js documentation][node-cli] or run `node --help` in your terminal for a list of available flags. Additionally, run `node --v8-options` to see a list of flags that specifically refer to Node.js's V8 JavaScript engine.
|
||||
|
||||
Prints Chromium's logging to stderr (or a log file).
|
||||
## --proxy-server=`address:port`
|
||||
|
||||
The `ELECTRON_ENABLE_LOGGING` environment variable has the same effect as
|
||||
passing `--enable-logging`.
|
||||
Use a specified proxy server, which overrides the system setting. This switch
|
||||
only affects requests with HTTP protocol, including HTTPS and WebSocket
|
||||
requests. It is also noteworthy that not all proxy servers support HTTPS and
|
||||
WebSocket requests. The proxy URL does not support username and password
|
||||
authentication [per Chromium issue](https://bugs.chromium.org/p/chromium/issues/detail?id=615947).
|
||||
|
||||
Passing `--enable-logging` will result in logs being printed on stderr.
|
||||
Passing `--enable-logging=file` will result in logs being saved to the file
|
||||
specified by `--log-file=...`, or to `electron_debug.log` in the user-data
|
||||
directory if `--log-file` is not specified.
|
||||
## --proxy-bypass-list=`hosts`
|
||||
|
||||
> **Note:** On Windows, logs from child processes cannot be sent to stderr.
|
||||
> Logging to a file is the most reliable way to collect logs on Windows.
|
||||
Instructs Electron to bypass the proxy server for the given semi-colon-separated
|
||||
list of hosts. This flag has an effect only if used in tandem with
|
||||
`--proxy-server`.
|
||||
|
||||
See also `--log-file`, `--log-level`, `--v`, and `--vmodule`.
|
||||
For example:
|
||||
|
||||
### --force-fieldtrials=`trials`
|
||||
```javascript
|
||||
const { app } = require('electron')
|
||||
app.commandLine.appendSwitch('proxy-bypass-list', '<local>;*.google.com;*foo.com;1.2.3.4:5678')
|
||||
```
|
||||
|
||||
Field trials to be forcefully enabled or disabled.
|
||||
Will use the proxy server for all hosts except for local addresses (`localhost`,
|
||||
`127.0.0.1` etc.), `google.com` subdomains, hosts that contain the suffix
|
||||
`foo.com` and anything at `1.2.3.4:5678`.
|
||||
|
||||
For example: `WebRTC-Audio-Red-For-Opus/Enabled/`
|
||||
## --proxy-pac-url=`url`
|
||||
|
||||
### --host-rules=`rules`
|
||||
Uses the PAC script at the specified `url`.
|
||||
|
||||
## --no-proxy-server
|
||||
|
||||
Don't use a proxy server and always make direct connections. Overrides any other
|
||||
proxy server flags that are passed.
|
||||
|
||||
## --host-rules=`rules`
|
||||
|
||||
A comma-separated list of `rules` that control how hostnames are mapped.
|
||||
|
||||
@@ -108,118 +107,69 @@ These mappings apply to the endpoint host in a net request (the TCP connect
|
||||
and host resolver in a direct connection, and the `CONNECT` in an HTTP proxy
|
||||
connection, and the endpoint host in a `SOCKS` proxy connection).
|
||||
|
||||
### --host-resolver-rules=`rules`
|
||||
## --host-resolver-rules=`rules`
|
||||
|
||||
Like `--host-rules` but these `rules` only apply to the host resolver.
|
||||
|
||||
### --ignore-certificate-errors
|
||||
## --auth-server-whitelist=`url`
|
||||
|
||||
Ignores certificate related errors.
|
||||
|
||||
### --ignore-connections-limit=`domains`
|
||||
|
||||
Ignore the connections limit for `domains` list separated by `,`.
|
||||
|
||||
### --js-flags=`flags`
|
||||
|
||||
Specifies the flags passed to the Node.js engine. It has to be passed when starting
|
||||
Electron if you want to enable the `flags` in the main process.
|
||||
|
||||
```sh
|
||||
$ electron --js-flags="--harmony_proxies --harmony_collections" your-app
|
||||
```
|
||||
|
||||
See the [Node.js documentation][node-cli] or run `node --help` in your terminal for a list of available flags. Additionally, run `node --v8-options` to see a list of flags that specifically refer to Node.js's V8 JavaScript engine.
|
||||
|
||||
### --lang
|
||||
|
||||
Set a custom locale.
|
||||
|
||||
### --log-file=`path`
|
||||
|
||||
If `--enable-logging` is specified, logs will be written to the given path. The
|
||||
parent directory must exist.
|
||||
|
||||
Setting the `ELECTRON_LOG_FILE` environment variable is equivalent to passing
|
||||
this flag. If both are present, the command-line switch takes precedence.
|
||||
|
||||
### --log-net-log=`path`
|
||||
|
||||
Enables net log events to be saved and writes them to `path`.
|
||||
|
||||
### --log-level=`N`
|
||||
|
||||
Sets the verbosity of logging when used together with `--enable-logging`.
|
||||
`N` should be one of [Chrome's LogSeverities][severities].
|
||||
|
||||
Note that two complimentary logging mechanisms in Chromium -- `LOG()`
|
||||
and `VLOG()` -- are controlled by different switches. `--log-level`
|
||||
controls `LOG()` messages, while `--v` and `--vmodule` control `VLOG()`
|
||||
messages. So you may want to use a combination of these three switches
|
||||
depending on the granularity you want and what logging calls are made
|
||||
by the code you're trying to watch.
|
||||
|
||||
See [Chromium Logging source][logging] for more information on how
|
||||
`LOG()` and `VLOG()` interact. Loosely speaking, `VLOG()` can be thought
|
||||
of as sub-levels / per-module levels inside `LOG(INFO)` to control the
|
||||
firehose of `LOG(INFO)` data.
|
||||
|
||||
See also `--enable-logging`, `--log-level`, `--v`, and `--vmodule`.
|
||||
|
||||
### --no-proxy-server
|
||||
|
||||
Don't use a proxy server and always make direct connections. Overrides any other
|
||||
proxy server flags that are passed.
|
||||
|
||||
### --no-sandbox
|
||||
|
||||
Disables the Chromium [sandbox](https://www.chromium.org/developers/design-documents/sandbox).
|
||||
Forces renderer process and Chromium helper processes to run un-sandboxed.
|
||||
Should only be used for testing.
|
||||
|
||||
### --proxy-bypass-list=`hosts`
|
||||
|
||||
Instructs Electron to bypass the proxy server for the given semi-colon-separated
|
||||
list of hosts. This flag has an effect only if used in tandem with
|
||||
`--proxy-server`.
|
||||
A comma-separated list of servers for which integrated authentication is enabled.
|
||||
|
||||
For example:
|
||||
|
||||
```javascript
|
||||
const { app } = require('electron')
|
||||
app.commandLine.appendSwitch('proxy-bypass-list', '<local>;*.google.com;*foo.com;1.2.3.4:5678')
|
||||
```sh
|
||||
--auth-server-whitelist='*example.com, *foobar.com, *baz'
|
||||
```
|
||||
|
||||
Will use the proxy server for all hosts except for local addresses (`localhost`,
|
||||
`127.0.0.1` etc.), `google.com` subdomains, hosts that contain the suffix
|
||||
`foo.com` and anything at `1.2.3.4:5678`.
|
||||
then any `url` ending with `example.com`, `foobar.com`, `baz` will be considered
|
||||
for integrated authentication. Without `*` prefix the URL has to match exactly.
|
||||
|
||||
### --proxy-pac-url=`url`
|
||||
## --auth-negotiate-delegate-whitelist=`url`
|
||||
|
||||
Uses the PAC script at the specified `url`.
|
||||
A comma-separated list of servers for which delegation of user credentials is required.
|
||||
Without `*` prefix the URL has to match exactly.
|
||||
|
||||
### --proxy-server=`address:port`
|
||||
## --ignore-certificate-errors
|
||||
|
||||
Use a specified proxy server, which overrides the system setting. This switch
|
||||
only affects requests with HTTP protocol, including HTTPS and WebSocket
|
||||
requests. It is also noteworthy that not all proxy servers support HTTPS and
|
||||
WebSocket requests. The proxy URL does not support username and password
|
||||
authentication [per Chromium issue](https://bugs.chromium.org/p/chromium/issues/detail?id=615947).
|
||||
Ignores certificate related errors.
|
||||
|
||||
### --remote-debugging-port=`port`
|
||||
## --ppapi-flash-path=`path`
|
||||
|
||||
Enables remote debugging over HTTP on the specified `port`.
|
||||
Sets the `path` of the pepper flash plugin.
|
||||
|
||||
### --v=`log_level`
|
||||
## --ppapi-flash-version=`version`
|
||||
|
||||
Sets the `version` of the pepper flash plugin.
|
||||
|
||||
## --log-net-log=`path`
|
||||
|
||||
Enables net log events to be saved and writes them to `path`.
|
||||
|
||||
## --disable-renderer-backgrounding
|
||||
|
||||
Prevents Chromium from lowering the priority of invisible pages' renderer
|
||||
processes.
|
||||
|
||||
This flag is global to all renderer processes, if you only want to disable
|
||||
throttling in one window, you can take the hack of
|
||||
[playing silent audio][play-silent-audio].
|
||||
|
||||
## --enable-logging
|
||||
|
||||
Prints Chromium's logging into console.
|
||||
|
||||
This switch can not be used in `app.commandLine.appendSwitch` since it is parsed
|
||||
earlier than user's app is loaded, but you can set the `ELECTRON_ENABLE_LOGGING`
|
||||
environment variable to achieve the same effect.
|
||||
|
||||
## --v=`log_level`
|
||||
|
||||
Gives the default maximal active V-logging level; 0 is the default. Normally
|
||||
positive values are used for V-logging levels.
|
||||
|
||||
This switch only works when `--enable-logging` is also passed.
|
||||
|
||||
See also `--enable-logging`, `--log-level`, and `--vmodule`.
|
||||
|
||||
### --vmodule=`pattern`
|
||||
## --vmodule=`pattern`
|
||||
|
||||
Gives the per-module maximal V-logging levels to override the value given by
|
||||
`--v`. E.g. `my_module=2,foo*=3` would change the logging level for all code in
|
||||
@@ -231,57 +181,25 @@ logging level for all code in the source files under a `foo/bar` directory.
|
||||
|
||||
This switch only works when `--enable-logging` is also passed.
|
||||
|
||||
See also `--enable-logging`, `--log-level`, and `--v`.
|
||||
## --enable-api-filtering-logging
|
||||
|
||||
### --force_high_performance_gpu
|
||||
Enables caller stack logging for the following APIs (filtering events):
|
||||
- `desktopCapturer.getSources()` / `desktop-capturer-get-sources`
|
||||
- `remote.require()` / `remote-require`
|
||||
- `remote.getGlobal()` / `remote-get-builtin`
|
||||
- `remote.getBuiltin()` / `remote-get-global`
|
||||
- `remote.getCurrentWindow()` / `remote-get-current-window`
|
||||
- `remote.getCurrentWebContents()` / `remote-get-current-web-contents`
|
||||
- `remote.getGuestWebContents()` / `remote-get-guest-web-contents`
|
||||
|
||||
Force using discrete GPU when there are multiple GPUs available.
|
||||
## --no-sandbox
|
||||
|
||||
### --force_low_power_gpu
|
||||
|
||||
Force using integrated GPU when there are multiple GPUs available.
|
||||
|
||||
## Node.js Flags
|
||||
|
||||
Electron supports some of the [CLI flags][node-cli] supported by Node.js.
|
||||
|
||||
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
|
||||
|
||||
### --inspect-brk[=[host:]port]
|
||||
|
||||
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
|
||||
|
||||
Aliased to `--debug-brk=[host:]port`.
|
||||
|
||||
### --inspect-port=[host:]port
|
||||
|
||||
Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is `127.0.0.1`.
|
||||
|
||||
Aliased to `--debug-port=[host:]port`.
|
||||
|
||||
### --inspect[=[host:]port]
|
||||
|
||||
Activate inspector on `host:port`. Default is `127.0.0.1:9229`.
|
||||
|
||||
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Electron instances. The tools attach to Electron instances via a TCP port and communicate using the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).
|
||||
|
||||
See the [Debugging the Main Process][debugging-main-process] guide for more details.
|
||||
|
||||
Aliased to `--debug[=[host:]port`.
|
||||
|
||||
### --inspect-publish-uid=stderr,http
|
||||
|
||||
Specify ways of the inspector web socket url exposure.
|
||||
|
||||
By default inspector websocket url is available in stderr and under /json/list endpoint on http://host:port/json/list.
|
||||
Disables Chromium sandbox, which is now enabled by default.
|
||||
Should only be used for testing.
|
||||
|
||||
[app]: app.md
|
||||
[append-switch]: command-line.md#commandlineappendswitchswitch-value
|
||||
[append-switch]: app.md#appcommandlineappendswitchswitch-value
|
||||
[ready]: app.md#event-ready
|
||||
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
|
||||
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
||||
[logging]: https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h
|
||||
[node-cli]: https://nodejs.org/api/cli.html
|
||||
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
|
||||
[ready]: app.md#event-ready
|
||||
[severities]: https://source.chromium.org/chromium/chromium/src/+/master:base/logging.h?q=logging::LogSeverity&ss=chromium
|
||||
|
||||
@@ -13,10 +13,10 @@ module is emitted.
|
||||
```javascript
|
||||
const { app, contentTracing } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
(async () => {
|
||||
await contentTracing.startRecording({
|
||||
included_categories: ['*']
|
||||
include_categories: ['*']
|
||||
})
|
||||
console.log('Tracing started')
|
||||
await new Promise(resolve => setTimeout(resolve, 5000))
|
||||
@@ -38,9 +38,6 @@ Get a set of category groups. The category groups can change as new code paths
|
||||
are reached. See also the [list of built-in tracing
|
||||
categories](https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h).
|
||||
|
||||
> **NOTE:** Electron adds a non-default tracing category called `"electron"`.
|
||||
> This category can be used to capture Electron-specific tracing events.
|
||||
|
||||
### `contentTracing.startRecording(options)`
|
||||
|
||||
* `options` ([TraceConfig](structures/trace-config.md) | [TraceCategoriesAndOptions](structures/trace-categories-and-options.md))
|
||||
@@ -83,4 +80,4 @@ Returns `Promise<Object>` - Resolves with an object containing the `value` and `
|
||||
Get the maximum usage across processes of trace buffer as a percentage of the
|
||||
full state.
|
||||
|
||||
[trace viewer]: https://chromium.googlesource.com/catapult/+/HEAD/tracing/README.md
|
||||
[trace viewer]: https://github.com/catapult-project/catapult/blob/master/tracing
|
||||
|
||||
@@ -33,7 +33,7 @@ page you load in your renderer executes code in this world.
|
||||
|
||||
### Isolated World
|
||||
|
||||
When `contextIsolation` is enabled in your `webPreferences` (this is the default behavior since Electron 12.0.0), your `preload` scripts run in an
|
||||
When `contextIsolation` is enabled in your `webPreferences`, your `preload` scripts run in an
|
||||
"Isolated World". You can read more about context isolation and what it affects in the
|
||||
[security](../tutorial/security.md#3-enable-context-isolation-for-remote-content) docs.
|
||||
|
||||
@@ -41,22 +41,22 @@ When `contextIsolation` is enabled in your `webPreferences` (this is the default
|
||||
|
||||
The `contextBridge` module has the following methods:
|
||||
|
||||
### `contextBridge.exposeInMainWorld(apiKey, api)`
|
||||
### `contextBridge.exposeInMainWorld(apiKey, api)` _Experimental_
|
||||
|
||||
* `apiKey` String - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
|
||||
* `api` any - Your API, more information on what this API can be and how it works is available below.
|
||||
* `api` Record<String, any> - Your API object, more information on what this API can be and how it works is available below.
|
||||
|
||||
## Usage
|
||||
|
||||
### API
|
||||
### API Objects
|
||||
|
||||
The `api` provided to [`exposeInMainWorld`](#contextbridgeexposeinmainworldapikey-api) must be a `Function`, `String`, `Number`, `Array`, `Boolean`, or an object
|
||||
The `api` object provided to [`exposeInMainWorld`](#contextbridgeexposeinmainworldapikey-api-experimental) must be an object
|
||||
whose keys are strings and values are a `Function`, `String`, `Number`, `Array`, `Boolean`, or another nested object that meets the same conditions.
|
||||
|
||||
`Function` values are proxied to the other context and all other values are **copied** and **frozen**. Any data / primitives sent in
|
||||
the API become immutable and updates on either side of the bridge do not result in an update on the other side.
|
||||
the API object become immutable and updates on either side of the bridge do not result in an update on the other side.
|
||||
|
||||
An example of a complex API is shown below:
|
||||
An example of a complex API object is shown below:
|
||||
|
||||
```javascript
|
||||
const { contextBridge } = require('electron')
|
||||
@@ -106,26 +106,7 @@ has been included below for completeness:
|
||||
| `Promise` | Complex | ✅ | ✅ | Promises are only proxied if they are the return value or exact parameter. Promises nested in arrays or objects will be dropped. |
|
||||
| `Function` | Complex | ✅ | ✅ | Prototype modifications are dropped. Sending classes or constructors will not work. |
|
||||
| [Cloneable Types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) | Simple | ✅ | ✅ | See the linked document on cloneable types |
|
||||
| `Element` | Complex | ✅ | ✅ | Prototype modifications are dropped. Sending custom elements will not work. |
|
||||
| `Symbol` | N/A | ❌ | ❌ | Symbols cannot be copied across contexts so they are dropped |
|
||||
|
||||
|
||||
If the type you care about is not in the above table, it is probably not supported.
|
||||
|
||||
### Exposing Node Global Symbols
|
||||
|
||||
The `contextBridge` can be used by the preload script to give your renderer access to Node APIs.
|
||||
The table of supported types described above also applies to Node APIs that you expose through `contextBridge`.
|
||||
Please note that many Node APIs grant access to local system resources.
|
||||
Be very cautious about which globals and APIs you expose to untrusted remote content.
|
||||
|
||||
```javascript
|
||||
const { contextBridge } = require('electron')
|
||||
const crypto = require('crypto')
|
||||
contextBridge.exposeInMainWorld('nodeCrypto', {
|
||||
sha256sum (data) {
|
||||
const hash = crypto.createHash('sha256')
|
||||
hash.update(data)
|
||||
return hash.digest('hex')
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
@@ -45,8 +45,6 @@ The following events are available on instances of `Cookies`:
|
||||
|
||||
#### Event: 'changed'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `cookie` [Cookie](structures/cookie.md) - The cookie that was changed.
|
||||
* `cause` String - The cause of the change with one of the following values:
|
||||
@@ -98,7 +96,6 @@ the response.
|
||||
* `expirationDate` Double (optional) - The expiration date of the cookie as the number of
|
||||
seconds since the UNIX epoch. If omitted then the cookie becomes a session
|
||||
cookie and will not be retained between sessions.
|
||||
* `sameSite` String (optional) - The [Same Site](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_cookies) policy to apply to this cookie. Can be `unspecified`, `no_restriction`, `lax` or `strict`. Default is `no_restriction`.
|
||||
|
||||
Returns `Promise<void>` - A promise which resolves when the cookie has been set
|
||||
|
||||
|
||||
@@ -4,13 +4,18 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
The following is an example of setting up Electron to automatically submit
|
||||
crash reports to a remote server:
|
||||
The following is an example of automatically submitting a crash report to a
|
||||
remote server:
|
||||
|
||||
```javascript
|
||||
const { crashReporter } = require('electron')
|
||||
|
||||
crashReporter.start({ submitURL: 'https://your-domain.com/url-to-submit' })
|
||||
crashReporter.start({
|
||||
productName: 'YourName',
|
||||
companyName: 'YourCompany',
|
||||
submitURL: 'https://your-domain.com/url-to-submit',
|
||||
uploadToServer: true
|
||||
})
|
||||
```
|
||||
|
||||
For setting up a server to accept and process crash reports, you can use
|
||||
@@ -25,50 +30,11 @@ Or use a 3rd party hosted solution:
|
||||
* [Sentry](https://docs.sentry.io/clients/electron)
|
||||
* [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.
|
||||
|
||||
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).
|
||||
Crash reports are saved locally in an application-specific temp directory folder.
|
||||
For a `productName` of `YourName`, crash reports will be stored in a folder
|
||||
named `YourName Crashes` inside the temp directory. You can customize this temp
|
||||
directory location for your app by calling the `app.setPath('temp', '/my/custom/temp')`
|
||||
API before starting the crash reporter.
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -77,68 +43,40 @@ The `crashReporter` module has the following methods:
|
||||
### `crashReporter.start(options)`
|
||||
|
||||
* `options` Object
|
||||
* `submitURL` String (optional) - URL that crash reports will be sent to as
|
||||
POST. Required unless `uploadToServer` is `false`.
|
||||
* `companyName` String
|
||||
* `submitURL` String - URL that crash reports will be sent to as POST.
|
||||
* `productName` String (optional) - Defaults to `app.name`.
|
||||
* `companyName` String (optional) _Deprecated_ - Deprecated alias for
|
||||
`{ globalExtra: { _companyName: ... } }`.
|
||||
* `uploadToServer` Boolean (optional) - Whether crash reports should be sent
|
||||
to the server. If false, crash reports will be collected and stored in the
|
||||
crashes directory, but not uploaded. Default is `true`.
|
||||
* `ignoreSystemCrashHandler` Boolean (optional) - If true, crashes generated
|
||||
in the main process will not be forwarded to the system crash handler.
|
||||
Default is `false`.
|
||||
* `rateLimit` Boolean (optional) _macOS_ _Windows_ - If true, limit the
|
||||
number of crashes uploaded to 1/hour. Default is `false`.
|
||||
* `compress` Boolean (optional) - If true, crash reports will be compressed
|
||||
and uploaded with `Content-Encoding: gzip`. Default is `true`.
|
||||
* `extra` Record<String, String> (optional) - Extra string key/value
|
||||
annotations that will be sent along with crash reports that are generated
|
||||
in the main process. Only string values are supported. Crashes generated in
|
||||
child processes will not contain these extra
|
||||
parameters to crash reports generated from child processes, call
|
||||
[`addExtraParameter`](#crashreporteraddextraparameterkey-value) from the
|
||||
child process.
|
||||
* `globalExtra` Record<String, String> (optional) - Extra string key/value
|
||||
annotations that will be sent along with any crash reports generated in any
|
||||
process. These annotations cannot be changed once the crash reporter has
|
||||
been started. If a key is present in both the global extra parameters and
|
||||
the process-specific extra parameters, then the global one will take
|
||||
precedence. By default, `productName` and the app version are included, as
|
||||
well as the Electron version.
|
||||
* `uploadToServer` Boolean (optional) - Whether crash reports should be sent to the server. Default is `true`.
|
||||
* `ignoreSystemCrashHandler` Boolean (optional) - Default is `false`.
|
||||
* `extra` Record<String, String> (optional) - An object you can define that will be sent along with the
|
||||
report. Only string properties are sent correctly. Nested objects are not
|
||||
supported. When using Windows, the property names and values must be fewer than 64 characters.
|
||||
* `crashesDirectory` String (optional) - Directory to store the crash reports temporarily (only used when the crash reporter is started via `process.crashReporter.start`).
|
||||
|
||||
This method must be called before using any other `crashReporter` APIs. Once
|
||||
initialized this way, the crashpad handler collects crashes from all
|
||||
subsequently created processes. The crash reporter cannot be disabled once
|
||||
started.
|
||||
You are required to call this method before using any other `crashReporter` APIs
|
||||
and in each process (main/renderer) from which you want to collect crash reports.
|
||||
You can pass different options to `crashReporter.start` when calling from different processes.
|
||||
|
||||
This method should be called as early as possible in app startup, preferably
|
||||
before `app.on('ready')`. If the crash reporter is not initialized at the time
|
||||
a renderer process is created, then that renderer process will not be monitored
|
||||
by the crash reporter.
|
||||
**Note** Child processes created via the `child_process` module will not have access to the Electron modules.
|
||||
Therefore, to collect crash reports from them, use `process.crashReporter.start` instead. Pass the same options as above
|
||||
along with an additional one called `crashesDirectory` that should point to a directory to store the crash
|
||||
reports temporarily. You can test this out by calling `process.crash()` to crash the child process.
|
||||
|
||||
**Note:** You can test out the crash reporter by generating a crash using
|
||||
`process.crash()`.
|
||||
**Note:** If you need send additional/updated `extra` parameters after your
|
||||
first call `start` you can call `addExtraParameter` on macOS or call `start`
|
||||
again with the new/updated `extra` parameters on Linux and Windows.
|
||||
|
||||
**Note:** If you need to send additional/updated `extra` parameters after your
|
||||
first call `start` you can call `addExtraParameter`.
|
||||
|
||||
**Note:** Parameters passed in `extra`, `globalExtra` or set with
|
||||
`addExtraParameter` have limits on the length of the keys and values. Key names
|
||||
must be at most 39 bytes long, and values must be no longer than 127 bytes.
|
||||
Keys with names longer than the maximum will be silently ignored. Key values
|
||||
longer than the maximum length will be truncated.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
**Note:** On macOS and windows, Electron uses a new `crashpad` client for crash collection and reporting.
|
||||
If you want to enable crash reporting, initializing `crashpad` from the main process using `crashReporter.start` is required
|
||||
regardless of which process you want to collect crashes from. Once initialized this way, the crashpad handler collects
|
||||
crashes from all processes. You still have to call `crashReporter.start` from the renderer or child process, otherwise crashes from
|
||||
them will get reported without `companyName`, `productName` or any of the `extra` information.
|
||||
|
||||
### `crashReporter.getLastCrashReport()`
|
||||
|
||||
Returns [`CrashReport`](structures/crash-report.md) - The date and ID of the
|
||||
last crash report. Only crash reports that have been uploaded will be returned;
|
||||
even if a crash report is present on disk it will not be returned until it is
|
||||
uploaded. In the case that there are no uploaded reports, `null` is returned.
|
||||
Returns [`CrashReport`](structures/crash-report.md):
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
Returns the date and ID of the last crash report. Only crash reports that have been uploaded will be returned; even if a crash report is present on disk it will not be returned until it is uploaded. In the case that there are no uploaded reports, `null` is returned.
|
||||
|
||||
### `crashReporter.getUploadedReports()`
|
||||
|
||||
@@ -147,61 +85,43 @@ Returns [`CrashReport[]`](structures/crash-report.md):
|
||||
Returns all uploaded crash reports. Each report contains the date and uploaded
|
||||
ID.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
|
||||
### `crashReporter.getUploadToServer()`
|
||||
|
||||
Returns `Boolean` - Whether reports should be submitted to the server. Set through
|
||||
the `start` method or `setUploadToServer`.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
**Note:** This API can only be called from the main process.
|
||||
|
||||
### `crashReporter.setUploadToServer(uploadToServer)`
|
||||
|
||||
* `uploadToServer` Boolean - Whether reports should be submitted to the server.
|
||||
* `uploadToServer` Boolean _macOS_ - Whether reports should be submitted to the server.
|
||||
|
||||
This would normally be controlled by user preferences. This has no effect if
|
||||
called before `start` is called.
|
||||
|
||||
**Note:** This method is only available in the main process.
|
||||
**Note:** This API can only be called from the main process.
|
||||
|
||||
### `crashReporter.addExtraParameter(key, value)`
|
||||
### `crashReporter.addExtraParameter(key, value)` _macOS_ _Windows_
|
||||
|
||||
* `key` String - Parameter key, must be no longer than 39 bytes.
|
||||
* `value` String - Parameter value, must be no longer than 127 bytes.
|
||||
* `key` String - Parameter key, must be less than 64 characters long.
|
||||
* `value` String - Parameter value, must be less than 64 characters long.
|
||||
|
||||
Set an extra parameter to be sent with the crash report. The values specified
|
||||
here will be sent in addition to any values set via the `extra` option when
|
||||
`start` was called.
|
||||
Set an extra parameter to be sent with the crash report. The values
|
||||
specified here will be sent in addition to any values set via the `extra` option when `start` was called. This API is only available on macOS and windows, if you need to add/update extra parameters on Linux after your first call to `start` you can call `start` again with the updated `extra` options.
|
||||
|
||||
Parameters added in this fashion (or via the `extra` parameter to
|
||||
`crashReporter.start`) are specific to the calling process. Adding extra
|
||||
parameters in the main process will not cause those parameters to be sent along
|
||||
with crashes from renderer or other child processes. Similarly, adding extra
|
||||
parameters in a renderer process will not result in those parameters being sent
|
||||
with crashes that occur in other renderer processes or in the main process.
|
||||
### `crashReporter.removeExtraParameter(key)` _macOS_ _Windows_
|
||||
|
||||
**Note:** Parameters have limits on the length of the keys and values. Key
|
||||
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.
|
||||
* `key` String - Parameter key, must be less than 64 characters long.
|
||||
|
||||
**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.
|
||||
|
||||
Remove an extra parameter from the current set of parameters. Future crashes
|
||||
will not include this parameter.
|
||||
Remove a extra parameter from the current set of parameters so that it will not be sent with the crash report.
|
||||
|
||||
### `crashReporter.getParameters()`
|
||||
|
||||
Returns `Record<String, String>` - The current 'extra' parameters of the crash reporter.
|
||||
See all of the current parameters being passed to the crash reporter.
|
||||
|
||||
### `crashReporter.getCrashesDirectory()`
|
||||
|
||||
Returns `String` - The directory where crashes are temporarily stored before being uploaded.
|
||||
|
||||
## Crash Report Payload
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ runtime that allows interacting with pages and instrumenting them.
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow()
|
||||
let win = new BrowserWindow()
|
||||
|
||||
try {
|
||||
win.webContents.debugger.attach('1.1')
|
||||
@@ -52,8 +52,6 @@ Returns:
|
||||
* `method` String - Method name.
|
||||
* `params` any - Event parameters defined by the 'parameters'
|
||||
attribute in the remote debugging protocol.
|
||||
* `sessionId` String - Unique identifier of attached debugging session,
|
||||
will match the value sent from `debugger.sendCommand`.
|
||||
|
||||
Emitted whenever the debugging target issues an instrumentation event.
|
||||
|
||||
@@ -76,16 +74,11 @@ Returns `Boolean` - Whether a debugger is attached to the `webContents`.
|
||||
|
||||
Detaches the debugger from the `webContents`.
|
||||
|
||||
#### `debugger.sendCommand(method[, commandParams, sessionId])`
|
||||
#### `debugger.sendCommand(method[, commandParams])`
|
||||
|
||||
* `method` String - Method name, should be one of the methods defined by the
|
||||
[remote debugging protocol][rdp].
|
||||
* `commandParams` any (optional) - JSON object with request parameters.
|
||||
* `sessionId` String (optional) - send command to the target with associated
|
||||
debugging session id. The initial value can be obtained by sending
|
||||
[Target.attachToTarget][attachToTarget] message.
|
||||
|
||||
[attachToTarget]: https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget
|
||||
|
||||
Returns `Promise<any>` - A promise that resolves with the response defined by
|
||||
the 'returns' attribute of the command description in the remote debugging protocol
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user