mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
453 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f93e88902 | ||
|
|
092706c43c | ||
|
|
13ed82a7d5 | ||
|
|
3b062b84b2 | ||
|
|
bcd0250866 | ||
|
|
f83f7760bb | ||
|
|
c77c902cc7 | ||
|
|
cbaaf6a34e | ||
|
|
4fb7b33b2b | ||
|
|
c2485e1181 | ||
|
|
cb71ab3222 | ||
|
|
3e6ee023a5 | ||
|
|
418049f70c | ||
|
|
3674762c36 | ||
|
|
669fd2bf88 | ||
|
|
91dfa1e5b2 | ||
|
|
bc8fc0d406 | ||
|
|
2db889b539 | ||
|
|
b181077654 | ||
|
|
60bdb56673 | ||
|
|
12cbca449c | ||
|
|
3a568ab070 | ||
|
|
bef1325a46 | ||
|
|
7deaef0be8 | ||
|
|
66ee5b8d7d | ||
|
|
fa81cd7621 | ||
|
|
8f502de1dc | ||
|
|
13d2090a54 | ||
|
|
ac7ec6012c | ||
|
|
e90a928a14 | ||
|
|
24db46d072 | ||
|
|
df2a249a6c | ||
|
|
5990d3404f | ||
|
|
d87c8a8183 | ||
|
|
512b9f2536 | ||
|
|
66b407ee22 | ||
|
|
cb2248e1f9 | ||
|
|
7fc14a8987 | ||
|
|
49e8c84c07 | ||
|
|
d2edf5899b | ||
|
|
22ebf4c142 | ||
|
|
7046b3c409 | ||
|
|
f450985d49 | ||
|
|
7de1fdddeb | ||
|
|
6f6ca442e6 | ||
|
|
2362fa0a0d | ||
|
|
35a4db080e | ||
|
|
c7f1319711 | ||
|
|
5b3267c400 | ||
|
|
0552e0d5de | ||
|
|
c87b474496 | ||
|
|
69683def0d | ||
|
|
8148b76efa | ||
|
|
7dfcb5ef04 | ||
|
|
0b3bf1e556 | ||
|
|
fd529ac30a | ||
|
|
3909001a00 | ||
|
|
039be2e407 | ||
|
|
fb6f60460b | ||
|
|
ca11175780 | ||
|
|
f45e2d2075 | ||
|
|
653576448b | ||
|
|
3dd4ac9ddc | ||
|
|
154d306e79 | ||
|
|
08f156cf61 | ||
|
|
a9bead22f6 | ||
|
|
0301ae9c77 | ||
|
|
959e80cc53 | ||
|
|
97010bf947 | ||
|
|
372c5b9518 | ||
|
|
4dc2c2800c | ||
|
|
ba1b75c218 | ||
|
|
5dac4531ca | ||
|
|
3cb788a030 | ||
|
|
9984dd9017 | ||
|
|
7efa4ccfb3 | ||
|
|
3bf5ad22f4 | ||
|
|
6e94fb3f9f | ||
|
|
9c92d87e2f | ||
|
|
8dcf7fc0b9 | ||
|
|
c7fd17a723 | ||
|
|
b68f8999ca | ||
|
|
35cb95b3d8 | ||
|
|
3b3cc0215a | ||
|
|
3cb2484184 | ||
|
|
bafcac7913 | ||
|
|
6a0c701a43 | ||
|
|
5ed3bd8724 | ||
|
|
779e3250c0 | ||
|
|
4c5197fe6e | ||
|
|
72a75889de | ||
|
|
242658102a | ||
|
|
7586295378 | ||
|
|
e7fce15152 | ||
|
|
456c9f09a2 | ||
|
|
f229d12056 | ||
|
|
4a2d94d031 | ||
|
|
df09e278a1 | ||
|
|
10f65979ff | ||
|
|
cac3884d75 | ||
|
|
b9734edfd1 | ||
|
|
ace3216392 | ||
|
|
12cb11f99b | ||
|
|
c16c4c25ed | ||
|
|
8e30e21ee6 | ||
|
|
a80f7fc81f | ||
|
|
83e7b00e7c | ||
|
|
eabb872345 | ||
|
|
b12090a129 | ||
|
|
0bf12e4e76 | ||
|
|
411b9f2ae7 | ||
|
|
a632f1f1b7 | ||
|
|
2543517443 | ||
|
|
5736df41c8 | ||
|
|
fbbe8afc3e | ||
|
|
6fdd055642 | ||
|
|
0f082ecd5c | ||
|
|
f29a600fd8 | ||
|
|
1bde50636f | ||
|
|
7d739a3608 | ||
|
|
8d3f0f47c1 | ||
|
|
dfd338d8bf | ||
|
|
dd242f4b28 | ||
|
|
4c61f62149 | ||
|
|
fd654afae9 | ||
|
|
cadddfec23 | ||
|
|
0e8aa5c252 | ||
|
|
edac24c9be | ||
|
|
0251f5aa93 | ||
|
|
cccd3778f8 | ||
|
|
680f3432ae | ||
|
|
420fb46121 | ||
|
|
6ef605eaa2 | ||
|
|
d7247bc77d | ||
|
|
5e6e118595 | ||
|
|
b1f19970e7 | ||
|
|
c30ecc38d0 | ||
|
|
14d9b8a8b4 | ||
|
|
f0d872947d | ||
|
|
40a212e132 | ||
|
|
cb9b3b29af | ||
|
|
da65c881e2 | ||
|
|
aa5e51dbe0 | ||
|
|
b5d38bfff0 | ||
|
|
a3054443f4 | ||
|
|
1f631ca337 | ||
|
|
e7576019e9 | ||
|
|
77448c75c6 | ||
|
|
538ebabf7e | ||
|
|
d17dfabfcb | ||
|
|
b6cb396893 | ||
|
|
4da56797c3 | ||
|
|
570e4f6a34 | ||
|
|
8c5a2c0a4a | ||
|
|
1c1e9fc7a7 | ||
|
|
0a3a0def25 | ||
|
|
ae9ee76e56 | ||
|
|
7908013a49 | ||
|
|
c7bb1d0300 | ||
|
|
4cf67fea52 | ||
|
|
2c29a4e93d | ||
|
|
04234f41f2 | ||
|
|
0799c8721c | ||
|
|
442174da0f | ||
|
|
ef94a79cac | ||
|
|
38afcff63a | ||
|
|
7ddfffb723 | ||
|
|
f8e601adaf | ||
|
|
dd27520637 | ||
|
|
85c07d0715 | ||
|
|
4dac36d111 | ||
|
|
ae27218296 | ||
|
|
c92efa4ec5 | ||
|
|
cbf499b18a | ||
|
|
7b1117e186 | ||
|
|
3bd3d9440a | ||
|
|
704cdd3a2b | ||
|
|
c56e5abd8c | ||
|
|
ec61041d41 | ||
|
|
32b51bce75 | ||
|
|
e0576ef11a | ||
|
|
a889ec7957 | ||
|
|
bef0dd868b | ||
|
|
3d74cacefe | ||
|
|
0b1248c8e6 | ||
|
|
0569c929a1 | ||
|
|
2dc42971ce | ||
|
|
577d0483e9 | ||
|
|
a3fde67056 | ||
|
|
79aebdffb7 | ||
|
|
fc800837bd | ||
|
|
58469efd1c | ||
|
|
80c36602fd | ||
|
|
f910704838 | ||
|
|
f17dc63c16 | ||
|
|
04b0d61323 | ||
|
|
544b4c5209 | ||
|
|
b35f37ea5a | ||
|
|
7f0bbd27b1 | ||
|
|
3b557bcf2e | ||
|
|
ef2f0580d9 | ||
|
|
425d2fa6f1 | ||
|
|
1409056baf | ||
|
|
72cb493023 | ||
|
|
1e7f26e5fd | ||
|
|
383e75796a | ||
|
|
1edfffae25 | ||
|
|
96e7b443fc | ||
|
|
8f728af13a | ||
|
|
281b0741f7 | ||
|
|
38c43ab48f | ||
|
|
d1d3d1bd1f | ||
|
|
89a7bdb566 | ||
|
|
09d59f2b83 | ||
|
|
ebec22045d | ||
|
|
a2c4000b84 | ||
|
|
9010838f21 | ||
|
|
6fe40ca797 | ||
|
|
101b971f36 | ||
|
|
6156254886 | ||
|
|
d0e4bd3fc9 | ||
|
|
3e5213b4e9 | ||
|
|
7ba8855ac1 | ||
|
|
c3e0ae9646 | ||
|
|
4b456bf3cb | ||
|
|
2a4bdfff98 | ||
|
|
c4baee0dab | ||
|
|
15688c6d6e | ||
|
|
aa4d7f1799 | ||
|
|
0476eb67ab | ||
|
|
69aebc05e5 | ||
|
|
98d06f6e5c | ||
|
|
7d321a90aa | ||
|
|
cfddc0a125 | ||
|
|
ade70463c1 | ||
|
|
4cb983ed40 | ||
|
|
79b3fcb2ab | ||
|
|
4cfa7be79d | ||
|
|
67bcc2a972 | ||
|
|
449bdcfda2 | ||
|
|
e70adc8f83 | ||
|
|
a6ae1ca755 | ||
|
|
b6fb8d3a63 | ||
|
|
5462a2c197 | ||
|
|
de428e9a7a | ||
|
|
fbe36e2365 | ||
|
|
5ac12c9e44 | ||
|
|
8d11391cb4 | ||
|
|
e82f453f71 | ||
|
|
abc187d651 | ||
|
|
913ef7890f | ||
|
|
bcb24bcdd1 | ||
|
|
d7ce600503 | ||
|
|
d16f29f7fc | ||
|
|
3b77af7ac3 | ||
|
|
0a241479cb | ||
|
|
1c8177c542 | ||
|
|
3f148fc3aa | ||
|
|
dd2310df48 | ||
|
|
9bc81be9d0 | ||
|
|
dc90c1153e | ||
|
|
7beb7b9a12 | ||
|
|
b6198b1648 | ||
|
|
16ff7b17a0 | ||
|
|
0d8be47c0f | ||
|
|
c4ab79e7ae | ||
|
|
49d91c7fc8 | ||
|
|
2b84b1ea43 | ||
|
|
4bb6f57657 | ||
|
|
db47a846da | ||
|
|
a3c951b14b | ||
|
|
c5abb17569 | ||
|
|
1b0ba71973 | ||
|
|
8dd004235b | ||
|
|
55955c3d79 | ||
|
|
5b33e9d9b7 | ||
|
|
6871b448ad | ||
|
|
7a1b3c5f2d | ||
|
|
2e8349c520 | ||
|
|
d63150502b | ||
|
|
daa61688b1 | ||
|
|
0a3b0391f4 | ||
|
|
1b66c03e41 | ||
|
|
92362da082 | ||
|
|
16e468137f | ||
|
|
b27a34eb91 | ||
|
|
18176b48b4 | ||
|
|
317f0cec68 | ||
|
|
49009236d9 | ||
|
|
976c7d122a | ||
|
|
ef548b6592 | ||
|
|
37c1df6ce1 | ||
|
|
d9068b7175 | ||
|
|
cac0a4fe3c | ||
|
|
e6807b387c | ||
|
|
f6f73a5a78 | ||
|
|
7bad919bee | ||
|
|
667db6fa67 | ||
|
|
022ee3793b | ||
|
|
5c0e8c5fd3 | ||
|
|
961436f300 | ||
|
|
e2c7e4b1ad | ||
|
|
d12b0eefe0 | ||
|
|
8dfb8c5589 | ||
|
|
57bb08e084 | ||
|
|
03e0905519 | ||
|
|
b6717a6644 | ||
|
|
41b32cf5d9 | ||
|
|
176f4728d7 | ||
|
|
0de78019c8 | ||
|
|
1926169c91 | ||
|
|
25b3ee29cf | ||
|
|
2228e5ac65 | ||
|
|
92cace3998 | ||
|
|
7dc858be02 | ||
|
|
7ffa127f0f | ||
|
|
f423312090 | ||
|
|
4cacd15730 | ||
|
|
37eeaf32ad | ||
|
|
b97c3aca2d | ||
|
|
2e07877c28 | ||
|
|
d8bd7654c6 | ||
|
|
f979e0cfbc | ||
|
|
1582824d33 | ||
|
|
71009fd61e | ||
|
|
055b5d274e | ||
|
|
1841742586 | ||
|
|
3841ac9b6d | ||
|
|
ed1c2a47f1 | ||
|
|
bcc4f67784 | ||
|
|
771d4dc374 | ||
|
|
b1fb7c7bfb | ||
|
|
725dac35ab | ||
|
|
6e32da3798 | ||
|
|
32ac551ca5 | ||
|
|
b90ac55d2d | ||
|
|
e797639d6d | ||
|
|
a31d041f03 | ||
|
|
6b70f0e8e6 | ||
|
|
b1357ab12b | ||
|
|
ffdec7a661 | ||
|
|
50822bc8d4 | ||
|
|
85164223cb | ||
|
|
5cb6ba2883 | ||
|
|
e23030b69e | ||
|
|
d417bbdcfd | ||
|
|
e6f92f3f30 | ||
|
|
3b59f12495 | ||
|
|
3083693e67 | ||
|
|
2a2f7e7090 | ||
|
|
f4c697d7a1 | ||
|
|
944690e79b | ||
|
|
ae303ade7d | ||
|
|
19162f4bac | ||
|
|
ee53f8cef6 | ||
|
|
4463715714 | ||
|
|
f6894da715 | ||
|
|
1657908fa8 | ||
|
|
26d059b3ea | ||
|
|
49aaa2fe96 | ||
|
|
0a9b201c34 | ||
|
|
e17cd837ef | ||
|
|
981208b66c | ||
|
|
77af675511 | ||
|
|
a92ee9443d | ||
|
|
23a52c02a3 | ||
|
|
8536f62826 | ||
|
|
312f14ee88 | ||
|
|
1f660c67c6 | ||
|
|
325bdfaf23 | ||
|
|
e3dcdba2db | ||
|
|
6b5a2c550a | ||
|
|
21e702a563 | ||
|
|
f79cfae3c2 | ||
|
|
51ffe25f45 | ||
|
|
0a0d7a8202 | ||
|
|
421490c6b3 | ||
|
|
068e12d909 | ||
|
|
d251642c83 | ||
|
|
27ceeb5e94 | ||
|
|
4ac616b681 | ||
|
|
fc677b7cf6 | ||
|
|
d25e511fc0 | ||
|
|
b4ba2f6d55 | ||
|
|
f967d73a13 | ||
|
|
c923aa2fde | ||
|
|
dec2078e54 | ||
|
|
2d16034854 | ||
|
|
4ce431829f | ||
|
|
430b355258 | ||
|
|
638ca05702 | ||
|
|
9e7cce3d2b | ||
|
|
c7a3142bab | ||
|
|
b6f5e26eab | ||
|
|
3330647834 | ||
|
|
bb8c7dfc7e | ||
|
|
4dea193854 | ||
|
|
080c2c9218 | ||
|
|
182f63d3a3 | ||
|
|
d3e0c461f6 | ||
|
|
b09a1c7607 | ||
|
|
7cc1efd2e6 | ||
|
|
324096aa37 | ||
|
|
d780a16d78 | ||
|
|
005ef96ac0 | ||
|
|
4f74be084a | ||
|
|
b7c2188d09 | ||
|
|
192326c7c5 | ||
|
|
1af064a144 | ||
|
|
6061fcce40 | ||
|
|
e68a9486da | ||
|
|
dd8bcb67ba | ||
|
|
27661d8e7b | ||
|
|
94ddcc4742 | ||
|
|
2515087322 | ||
|
|
36a5ba0d4d | ||
|
|
241b2a98af | ||
|
|
9b2e3d1d0b | ||
|
|
67cb05b435 | ||
|
|
3f5222b047 | ||
|
|
28e7e6492d | ||
|
|
23f7f63405 | ||
|
|
99eaa0d1bb | ||
|
|
543dbaf412 | ||
|
|
5901293628 | ||
|
|
30543cec74 | ||
|
|
66aeeac8df | ||
|
|
b03bc4de83 | ||
|
|
601c3f97ea | ||
|
|
d01a8eaa39 | ||
|
|
54e1c11b2b | ||
|
|
c1ad66b104 | ||
|
|
a905259646 | ||
|
|
356045ff57 | ||
|
|
a9f69bf732 | ||
|
|
3e181b8efc | ||
|
|
171c76e3cb | ||
|
|
0299f69fd1 | ||
|
|
0bdb7b164c | ||
|
|
ea9cfc127c | ||
|
|
0afb1a8188 | ||
|
|
f154dbda40 | ||
|
|
c3013d2e9f | ||
|
|
3272564eac | ||
|
|
a0f4632461 | ||
|
|
8ddf837d49 | ||
|
|
9822953d31 | ||
|
|
c6061cce41 | ||
|
|
a9602682c5 | ||
|
|
b7e5213afc | ||
|
|
9b70d9aa68 | ||
|
|
d9bfac32e3 | ||
|
|
9e815afc02 |
1407
.circleci/config.yml
1407
.circleci/config.yml
File diff suppressed because it is too large
Load Diff
@@ -19,35 +19,18 @@
|
||||
"prefer-const": ["error", {
|
||||
"destructuring": "all"
|
||||
}],
|
||||
"standard/no-callback-literal": "off",
|
||||
"node/no-deprecated-api": 0
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"globals": {
|
||||
"standardScheme": "readonly",
|
||||
"BUILDFLAG": "readonly",
|
||||
"ENABLE_DESKTOP_CAPTURER": "readonly",
|
||||
"ENABLE_ELECTRON_EXTENSIONS": "readonly",
|
||||
"ENABLE_REMOTE_MODULE": "readonly",
|
||||
"ENABLE_VIEW_API": "readonly",
|
||||
"BigInt": "readonly"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.js",
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": "*.d.ts",
|
||||
"rules": {
|
||||
"no-useless-constructor": "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
|
||||
|
||||
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**.
|
||||
2
.github/config.yml
vendored
2
.github/config.yml
vendored
@@ -29,11 +29,13 @@ firstPRMergeComment: >
|
||||
# Users authorized to run manual trop backports
|
||||
authorizedUsers:
|
||||
- alexeykuzmin
|
||||
- BinaryMuse
|
||||
- ckerr
|
||||
- codebytere
|
||||
- deepak1556
|
||||
- jkleinsc
|
||||
- MarshallOfSound
|
||||
- miniak
|
||||
- nitsakh
|
||||
- nornagon
|
||||
- zcbenz
|
||||
|
||||
10
.github/main.workflow
vendored
Normal file
10
.github/main.workflow
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
workflow "Clerk" {
|
||||
#TODO(codebytere): make this work properly on pull_request
|
||||
on = "repository_dispatch"
|
||||
resolves = "Check release notes"
|
||||
}
|
||||
|
||||
action "Check release notes" {
|
||||
uses = "electron/clerk@master"
|
||||
secrets = [ "GITHUB_TOKEN" ]
|
||||
}
|
||||
25
.github/stale.yml
vendored
Normal file
25
.github/stale.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 45
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- fixme/bug
|
||||
- fixme/crash
|
||||
- fixme/regression
|
||||
- fixme/security
|
||||
- blocked
|
||||
- blocking-stable
|
||||
- needs-review
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity and is not currently prioritized. It will be closed
|
||||
in a week if no further activity occurs :)
|
||||
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: >
|
||||
If you still think this issue is relevant, please ping a maintainer or
|
||||
leave a comment!
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -58,11 +58,10 @@ spec/.hash
|
||||
.eslintcache
|
||||
|
||||
# Generated native addon files
|
||||
/spec-main/fixtures/native-addon/echo/build/
|
||||
/spec/fixtures/native-addon/echo/build/
|
||||
|
||||
# If someone runs tsc this is where stuff will end up
|
||||
ts-gen
|
||||
|
||||
# Used to accelerate CI builds
|
||||
.depshash
|
||||
.depshash-target
|
||||
@@ -20,11 +20,13 @@ Issues are created [here](https://github.com/electron/electron/issues/new).
|
||||
* [Triaging a Bug Report](https://electronjs.org/docs/development/issues#triaging-a-bug-report)
|
||||
* [Resolving a Bug Report](https://electronjs.org/docs/development/issues#resolving-a-bug-report)
|
||||
|
||||
### 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 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!_
|
||||
### Issue Maintenance and Closure
|
||||
* If an issue is inactive for 45 days (no activity of any kind), it will be
|
||||
marked for closure with `stale`.
|
||||
* If after this label is applied, no further activity occurs in the next 7 days,
|
||||
the issue will be closed.
|
||||
* If an issue has been closed and you still feel it's relevant, feel free to
|
||||
ping a maintainer or add a comment!
|
||||
|
||||
### Languages
|
||||
|
||||
|
||||
11
DEPS
11
DEPS
@@ -6,15 +6,14 @@ gclient_gn_args = [
|
||||
'checkout_libaom',
|
||||
'checkout_nacl',
|
||||
'checkout_oculus_sdk',
|
||||
'checkout_openxr',
|
||||
'checkout_google_benchmark'
|
||||
'checkout_openxr'
|
||||
]
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'83.0.4103.122',
|
||||
'78.0.3904.130',
|
||||
'node_version':
|
||||
'v12.14.1',
|
||||
'v12.8.1',
|
||||
'nan_version':
|
||||
'2ee313aaca52e2b478965ac50eb5082520380d1b',
|
||||
|
||||
@@ -70,8 +69,6 @@ vars = {
|
||||
False,
|
||||
'checkout_android_native_support':
|
||||
False,
|
||||
'checkout_google_benchmark':
|
||||
False,
|
||||
}
|
||||
|
||||
deps = {
|
||||
@@ -156,4 +153,4 @@ recursedeps = [
|
||||
'src',
|
||||
]
|
||||
|
||||
# Touch DEPS again to bust cache
|
||||
# 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 @@
|
||||
9.3.2
|
||||
7.3.2
|
||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
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
|
||||
|
||||
12
README.md
12
README.md
@@ -58,13 +58,13 @@ npm start
|
||||
|
||||
## Resources for learning Electron
|
||||
|
||||
- [electronjs.org/docs](https://electronjs.org/docs) - All of Electron's documentation
|
||||
- [electronjs.org/docs](https://electronjs.org/docs) - all of Electron's documentation
|
||||
- [electron/fiddle](https://github.com/electron/fiddle) - A tool to build, run, and package small Electron experiments
|
||||
- [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - A very basic starter Electron app
|
||||
- [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - Sample starter apps created by the community
|
||||
- [electron/simple-samples](https://github.com/electron/simple-samples) - Small applications with ideas for taking them further
|
||||
- [electron/electron-api-demos](https://github.com/electron/electron-api-demos) - An Electron app that teaches you how to use Electron
|
||||
- [hokein/electron-sample-apps](https://github.com/hokein/electron-sample-apps) - Small demo apps for the various Electron APIs
|
||||
- [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - a very basic starter Electron app
|
||||
- [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - sample starter apps created by the community
|
||||
- [electron/simple-samples](https://github.com/electron/simple-samples) - small applications with ideas for taking them further
|
||||
- [electron/electron-api-demos](https://github.com/electron/electron-api-demos) - an Electron app that teaches you how to use Electron
|
||||
- [hokein/electron-sample-apps](https://github.com/hokein/electron-sample-apps) - small demo apps for the various Electron APIs
|
||||
|
||||
## Programmatic usage
|
||||
|
||||
|
||||
98
appveyor.yml
98
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
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: libcc-20
|
||||
image: vs2019bt-16.4.0
|
||||
image: vs2017-15.9-10.0.18362
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
@@ -50,12 +50,6 @@ build_script:
|
||||
- ps: >-
|
||||
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
|
||||
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
|
||||
} else {
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
- echo "Building $env:GN_CONFIG build"
|
||||
- git config --global core.longpaths true
|
||||
@@ -76,95 +70,28 @@ 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 external binaries
|
||||
python src/electron/script/update-external-binaries.py
|
||||
}
|
||||
} 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)
|
||||
- ps: >-
|
||||
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
|
||||
# archive current source for future use
|
||||
# only run on x64/woa to avoid contention saving
|
||||
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"
|
||||
}
|
||||
}
|
||||
- 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
|
||||
}
|
||||
- gclient sync --with_branch_heads --with_tags --reset
|
||||
- cd src
|
||||
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
|
||||
- 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%\"")
|
||||
- ps: $env:BUILD_CONFIG_PATH="//electron/build/args/%GN_CONFIG%.gn"
|
||||
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") %GN_EXTRA_ARGS%"
|
||||
- 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 )
|
||||
- ninja -C out/Default electron:electron_app
|
||||
- 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
|
||||
- if "%GN_CONFIG%"=="testing" ( 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
|
||||
- appveyor PushArtifact out/Default/dist.zip
|
||||
- appveyor PushArtifact out/Default/shell_browser_ui_unittests.exe
|
||||
- appveyor PushArtifact out/Default/chromedriver.zip
|
||||
- appveyor PushArtifact out/ffmpeg/ffmpeg.zip
|
||||
- 7z a node_headers.zip out\Default\gen\node_headers
|
||||
- appveyor PushArtifact node_headers.zip
|
||||
- appveyor PushArtifact out/Default/mksnapshot.zip
|
||||
- appveyor PushArtifact out/Default/hunspell_dictionaries.zip
|
||||
- appveyor PushArtifact out/Default/electron.lib
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
@@ -175,12 +102,7 @@ build_script:
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
python electron\script\zip-symbols.py
|
||||
appveyor-retry 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 out/Default/symbols.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:
|
||||
@@ -198,14 +120,12 @@ test_script:
|
||||
echo "Skipping tests for $env:GN_CONFIG build"
|
||||
}
|
||||
- cd electron
|
||||
- if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --enable-logging)
|
||||
- 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: >-
|
||||
|
||||
@@ -18,14 +18,6 @@ steps:
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
$localArtifactPath = "$pwd\src\out\Default\shell_browser_ui_unittests.exe"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/shell_browser_ui_unittests.exe"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
displayName: 'Download and extract native test executables for test'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
$localArtifactPath = "$pwd\ffmpeg.zip"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/ffmpeg.zip"
|
||||
@@ -63,7 +55,7 @@ steps:
|
||||
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
||||
set npm_config_arch=arm64
|
||||
cd electron
|
||||
node script/yarn test -- --enable-logging --verbose
|
||||
node script/yarn test -- --ci --enable-logging --verbose
|
||||
displayName: 'Run Electron tests'
|
||||
env:
|
||||
ELECTRON_OUT_DIR: Default
|
||||
@@ -90,4 +82,4 @@ steps:
|
||||
Get-Process | Where Name –Like "MicrosoftEdge*" | Stop-Process
|
||||
Get-Process | Where Name –Like "msedge*" | Stop-Process
|
||||
displayName: 'Kill processes left running from last test run'
|
||||
condition: always()
|
||||
condition: always()
|
||||
@@ -1,8 +1,9 @@
|
||||
is_electron_build = true
|
||||
use_jumbo_build = true
|
||||
root_extra_deps = [ "//electron" ]
|
||||
|
||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
|
||||
node_module_version = 80
|
||||
node_module_version = 75
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_typed_array_max_size_in_heap = 0
|
||||
@@ -17,6 +18,9 @@ ffmpeg_branding = "Chrome"
|
||||
|
||||
enable_basic_printing = true
|
||||
angle_enable_vulkan_validation_layers = false
|
||||
dawn_enable_vulkan_validation_layers = false
|
||||
|
||||
is_cfi = false
|
||||
|
||||
# TODO: Remove this and update CI to contain 10.14 SDK once
|
||||
# crbug.com/986701 is fixed.
|
||||
mac_sdk_min = "10.13"
|
||||
|
||||
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
|
||||
@@ -1,2 +0,0 @@
|
||||
goma_dir = rebase_path("//electron/external_binaries/goma")
|
||||
use_goma = true
|
||||
@@ -5,3 +5,4 @@ is_debug = false
|
||||
is_component_build = false
|
||||
is_component_ffmpeg = false
|
||||
symbol_level = 1
|
||||
use_jumbo_build = true
|
||||
|
||||
@@ -6,6 +6,8 @@ is_official_build = false
|
||||
dcheck_always_on = true
|
||||
symbol_level = 1
|
||||
|
||||
strip_absolute_paths_from_debug_symbols = false
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,98 +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, \
|
||||
GetVisualStudioVersion, \
|
||||
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(dir):
|
||||
curdir = os.getcwd()
|
||||
try:
|
||||
os.chdir(dir)
|
||||
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'])
|
||||
|
||||
return {
|
||||
'pwd': os.getcwd(), # since current windows executable are symbols path dependant, profile the current directory too
|
||||
'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')
|
||||
options, args = parser.parse_args()
|
||||
sys.exit(main(options))
|
||||
@@ -1,50 +1,9 @@
|
||||
import("//build/config/mac/mac_sdk.gni")
|
||||
|
||||
# Template to compile .xib and .storyboard files.
|
||||
# (copied from src/build/config/ios/rules.gni)
|
||||
#
|
||||
# Arguments
|
||||
#
|
||||
# sources:
|
||||
# list of string, sources to compile
|
||||
#
|
||||
# ibtool_flags:
|
||||
# (optional) list of string, additional flags to pass to the ibtool
|
||||
template("compile_ib_files") {
|
||||
action_foreach(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
||||
assert(defined(invoker.sources),
|
||||
"sources must be specified for $target_name")
|
||||
assert(defined(invoker.output_extension),
|
||||
"output_extension must be specified for $target_name")
|
||||
|
||||
ibtool_flags = []
|
||||
if (defined(invoker.ibtool_flags)) {
|
||||
ibtool_flags = invoker.ibtool_flags
|
||||
}
|
||||
|
||||
_output_extension = invoker.output_extension
|
||||
|
||||
script = "//build/config/ios/compile_ib_files.py"
|
||||
sources = invoker.sources
|
||||
outputs = [
|
||||
"$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
|
||||
]
|
||||
args = [
|
||||
"--input",
|
||||
"{{source}}",
|
||||
"--output",
|
||||
rebase_path(
|
||||
"$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
|
||||
root_build_dir),
|
||||
]
|
||||
args += ibtool_flags
|
||||
}
|
||||
}
|
||||
# This is imported from /ios becuase this functionality was moved
|
||||
# after Chromium stopped using xib files for macOS menu functionality
|
||||
# See https://chromium-review.googlesource.com/c/chromium/src/+/1648695
|
||||
import("//build/config/ios/rules.gni")
|
||||
|
||||
# Template is copied here from Chromium but was removed in
|
||||
# https://chromium-review.googlesource.com/c/chromium/src/+/1637981
|
||||
@@ -81,7 +40,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 +50,8 @@ template("mac_xib_bundle_data") {
|
||||
_output_path = invoker.output_path
|
||||
}
|
||||
|
||||
outputs = [ "$_output_path/{{source_file_part}}" ]
|
||||
outputs = [
|
||||
"$_output_path/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
|
||||
@@ -10,9 +9,7 @@ config.output = {
|
||||
filename: path.basename(outPath)
|
||||
}
|
||||
|
||||
const { wrapInitWithProfilingTimeout, wrapInitWithTryCatch, ...webpackConfig } = config;
|
||||
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
webpack(config, (err, stats) => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
@@ -20,26 +17,6 @@ webpack(webpackConfig, (err, stats) => {
|
||||
console.error(stats.toString('normal'))
|
||||
process.exit(1)
|
||||
} else {
|
||||
let contents = fs.readFileSync(outPath, 'utf8');
|
||||
if (wrapInitWithTryCatch) {
|
||||
contents = `try {
|
||||
${contents}
|
||||
} catch (err) {
|
||||
console.error('Electron ${webpackConfig.output.filename} script failed to run');
|
||||
console.error(err);
|
||||
}`;
|
||||
}
|
||||
if (wrapInitWithProfilingTimeout) {
|
||||
contents = `function ___electron_webpack_init__() {
|
||||
${contents}
|
||||
};
|
||||
if ((globalThis.process || binding.process).argv.includes("--profile-electron-init")) {
|
||||
setTimeout(___electron_webpack_init__, 0);
|
||||
} else {
|
||||
___electron_webpack_init__();
|
||||
}`;
|
||||
}
|
||||
fs.writeFileSync(outPath, contents)
|
||||
process.exit(0)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
|
||||
const electronRoot = path.resolve(__dirname, '../..')
|
||||
|
||||
@@ -21,73 +20,11 @@ class AccessDependenciesPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
const defines = {
|
||||
BUILDFLAG: onlyPrintingGraph ? '(a => a)' : ''
|
||||
}
|
||||
|
||||
const buildFlagsPrefix = '--buildflags='
|
||||
const buildFlagArg = process.argv.find(arg => arg.startsWith(buildFlagsPrefix))
|
||||
|
||||
if (buildFlagArg) {
|
||||
const buildFlagPath = buildFlagArg.substr(buildFlagsPrefix.length)
|
||||
|
||||
const flagFile = fs.readFileSync(buildFlagPath, '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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ignoredModules = []
|
||||
|
||||
if (defines['ENABLE_DESKTOP_CAPTURER'] === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/desktop-capturer',
|
||||
'@electron/internal/renderer/api/desktop-capturer'
|
||||
)
|
||||
}
|
||||
|
||||
if (defines['ENABLE_REMOTE_MODULE'] === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/remote/server',
|
||||
'@electron/internal/renderer/api/remote'
|
||||
)
|
||||
}
|
||||
|
||||
if (defines['ENABLE_VIEW_API'] === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/api/views/box-layout',
|
||||
'@electron/internal/browser/api/views/button',
|
||||
'@electron/internal/browser/api/views/label-button',
|
||||
'@electron/internal/browser/api/views/layout-manager',
|
||||
'@electron/internal/browser/api/views/md-text-button',
|
||||
'@electron/internal/browser/api/views/resize-area',
|
||||
'@electron/internal/browser/api/views/text-field'
|
||||
)
|
||||
}
|
||||
|
||||
if (defines['ENABLE_ELECTRON_EXTENSIONS'] === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/@browser/chrome-extension-shim'
|
||||
)
|
||||
} else {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/chrome-extension',
|
||||
'@electron/internal/renderer/chrome-api',
|
||||
'@electron/internal/renderer/content-scripts-injector'
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = ({
|
||||
alwaysHasNode,
|
||||
loadElectronFromAlternateTarget,
|
||||
targetDeletesNodeGlobals,
|
||||
target,
|
||||
wrapInitWithProfilingTimeout,
|
||||
wrapInitWithTryCatch
|
||||
target
|
||||
}) => {
|
||||
let entry = path.resolve(electronRoot, 'lib', target, 'init.ts')
|
||||
if (!fs.existsSync(entry)) {
|
||||
@@ -96,37 +33,29 @@ module.exports = ({
|
||||
|
||||
return ({
|
||||
mode: 'development',
|
||||
devtool: false,
|
||||
devtool: 'inline-source-map',
|
||||
entry,
|
||||
target: alwaysHasNode ? 'node' : 'web',
|
||||
output: {
|
||||
filename: `${target}.bundle.js`
|
||||
},
|
||||
wrapInitWithProfilingTimeout,
|
||||
wrapInitWithTryCatch,
|
||||
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 doesn't use window.postMessage
|
||||
'electron': path.resolve(electronRoot, 'lib', loadElectronFromAlternateTarget || target, 'api', 'exports', 'electron.js'),
|
||||
// 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: (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,
|
||||
]
|
||||
ignoreDiagnostics: [6059]
|
||||
}
|
||||
}]
|
||||
},
|
||||
@@ -137,17 +66,6 @@ module.exports = ({
|
||||
// one of our renderer bundles should import it from the 'timers' package
|
||||
setImmediate: false,
|
||||
},
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
keep_fnames: true,
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new AccessDependenciesPlugin(),
|
||||
...(targetDeletesNodeGlobals ? [
|
||||
@@ -160,7 +78,6 @@ module.exports = ({
|
||||
new webpack.ProvidePlugin({
|
||||
Promise: ['@electron/internal/common/webpack-globals-provider', 'Promise'],
|
||||
}),
|
||||
new webpack.DefinePlugin(defines),
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
@@ -16,7 +16,6 @@ template("webpack_build") {
|
||||
inputs = [
|
||||
invoker.config_file,
|
||||
"//electron/build/webpack/webpack.config.base.js",
|
||||
"//electron/build/webpack/run-compiler.js",
|
||||
"//electron/tsconfig.json",
|
||||
"//electron/yarn.lock",
|
||||
"//electron/typings/internal-ambient.d.ts",
|
||||
@@ -26,10 +25,10 @@ template("webpack_build") {
|
||||
args = [
|
||||
rebase_path(invoker.config_file),
|
||||
rebase_path(invoker.out_file),
|
||||
"--buildflags=" + rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
]
|
||||
deps += [ "buildflags" ]
|
||||
|
||||
outputs = [ invoker.out_file ]
|
||||
outputs = [
|
||||
invoker.out_file,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
15
build/zip.py
15
build/zip.py
@@ -9,7 +9,6 @@ EXTENSIONS_TO_SKIP = [
|
||||
'.pdb',
|
||||
'.mojom.js',
|
||||
'.mojom-lite.js',
|
||||
'.info'
|
||||
]
|
||||
|
||||
PATHS_TO_SKIP = [
|
||||
@@ -25,13 +24,6 @@ PATHS_TO_SKIP = [
|
||||
# //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',
|
||||
]
|
||||
|
||||
def skip_path(dep, dist_zip, target_cpu):
|
||||
@@ -58,15 +50,14 @@ def execute(argv):
|
||||
raise e
|
||||
|
||||
def main(argv):
|
||||
dist_zip, runtime_deps, target_cpu, target_os, flatten_val = argv
|
||||
should_flatten = flatten_val == "true"
|
||||
dist_zip, runtime_deps, target_cpu, target_os = argv
|
||||
dist_files = set()
|
||||
with open(runtime_deps) as f:
|
||||
for dep in f.readlines():
|
||||
dep = dep.strip()
|
||||
if not skip_path(dep, dist_zip, target_cpu):
|
||||
dist_files.add(dep)
|
||||
if sys.platform == 'darwin' and not should_flatten:
|
||||
if sys.platform == 'darwin':
|
||||
execute(['zip', '-r', '-y', dist_zip] + list(dist_files))
|
||||
else:
|
||||
with zipfile.ZipFile(dist_zip, 'w', zipfile.ZIP_DEFLATED, allowZip64=True) as z:
|
||||
@@ -79,7 +70,7 @@ def main(argv):
|
||||
basename = os.path.basename(dep)
|
||||
dirname = os.path.dirname(dep)
|
||||
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)
|
||||
z.write(dep, arcname)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
|
||||
@@ -12,15 +12,14 @@ buildflag_header("buildflags") {
|
||||
"ENABLE_DESKTOP_CAPTURER=$enable_desktop_capturer",
|
||||
"ENABLE_RUN_AS_NODE=$enable_run_as_node",
|
||||
"ENABLE_OSR=$enable_osr",
|
||||
"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_MEDIA_KEY_OVERRIDES=$enable_media_key_overrides",
|
||||
"OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,11 +10,9 @@ declare_args() {
|
||||
|
||||
enable_osr = true
|
||||
|
||||
enable_remote_module = true
|
||||
|
||||
enable_view_api = false
|
||||
|
||||
enable_pdf_viewer = true
|
||||
enable_pdf_viewer = false
|
||||
|
||||
enable_tts = true
|
||||
|
||||
@@ -22,6 +20,8 @@ declare_args() {
|
||||
|
||||
enable_picture_in_picture = true
|
||||
|
||||
enable_media_key_overrides = true
|
||||
|
||||
# Provide a fake location provider for mocking
|
||||
# the geolocation responses. Disable it if you
|
||||
# need to test with chromium's location provider.
|
||||
@@ -32,8 +32,5 @@ declare_args() {
|
||||
enable_pepper_flash = true
|
||||
|
||||
# Enable Chrome extensions support.
|
||||
enable_electron_extensions = true
|
||||
|
||||
# Enable Spellchecker support
|
||||
enable_builtin_spellchecker = true
|
||||
enable_electron_extensions = false
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/ui.gni")
|
||||
import("//components/spellcheck/spellcheck_build_features.gni")
|
||||
import("//electron/buildflags/buildflags.gni")
|
||||
import("//printing/buildflags/buildflags.gni")
|
||||
import("//third_party/widevine/cdm/widevine.gni")
|
||||
@@ -14,8 +13,6 @@ static_library("chrome") {
|
||||
sources = [
|
||||
"//chrome/browser/browser_process.cc",
|
||||
"//chrome/browser/browser_process.h",
|
||||
"//chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc",
|
||||
"//chrome/browser/crash_upload_list/crash_upload_list_crashpad.h",
|
||||
"//chrome/browser/devtools/devtools_contents_resizing_strategy.cc",
|
||||
"//chrome/browser/devtools/devtools_contents_resizing_strategy.h",
|
||||
"//chrome/browser/devtools/devtools_embedder_message_dispatcher.cc",
|
||||
@@ -34,8 +31,6 @@ static_library("chrome") {
|
||||
"//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",
|
||||
@@ -44,21 +39,16 @@ static_library("chrome") {
|
||||
"//chrome/browser/net/proxy_service_factory.h",
|
||||
"//chrome/browser/predictors/preconnect_manager.cc",
|
||||
"//chrome/browser/predictors/preconnect_manager.h",
|
||||
"//chrome/browser/predictors/predictors_features.cc",
|
||||
"//chrome/browser/predictors/predictors_features.h",
|
||||
"//chrome/browser/predictors/proxy_lookup_client_impl.cc",
|
||||
"//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/ssl/security_state_tab_helper.cc",
|
||||
"//chrome/browser/ssl/security_state_tab_helper.h",
|
||||
"//chrome/browser/ssl/tls_deprecation_config.cc",
|
||||
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc",
|
||||
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h",
|
||||
"//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",
|
||||
"//chrome/child/v8_crashpad_support_win.cc",
|
||||
"//chrome/child/v8_crashpad_support_win.h",
|
||||
"//extensions/browser/app_window/size_constraints.cc",
|
||||
"//extensions/browser/app_window/size_constraints.h",
|
||||
]
|
||||
@@ -73,7 +63,6 @@ static_library("chrome") {
|
||||
deps = [
|
||||
"//chrome/browser:resource_prefetch_predictor_proto",
|
||||
"//components/feature_engagement:buildflags",
|
||||
"//components/optimization_guide/proto:optimization_guide_proto",
|
||||
]
|
||||
|
||||
if (is_linux) {
|
||||
@@ -81,14 +70,6 @@ static_library("chrome") {
|
||||
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",
|
||||
"//chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h",
|
||||
]
|
||||
public_deps += [
|
||||
"//components/dbus/menu",
|
||||
"//components/dbus/thread_linux",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -114,15 +95,11 @@ static_library("chrome") {
|
||||
]
|
||||
|
||||
if (use_aura) {
|
||||
sources += [ "//chrome/browser/platform_util_aura.cc" ]
|
||||
|
||||
if (!is_win) {
|
||||
sources += [
|
||||
"//chrome/browser/ui/views/color_chooser_aura.cc",
|
||||
"//chrome/browser/ui/views/color_chooser_aura.h",
|
||||
]
|
||||
}
|
||||
|
||||
sources += [
|
||||
"//chrome/browser/platform_util_aura.cc",
|
||||
"//chrome/browser/ui/views/color_chooser_aura.cc",
|
||||
"//chrome/browser/ui/views/color_chooser_aura.h",
|
||||
]
|
||||
deps += [ "//components/feature_engagement" ]
|
||||
}
|
||||
|
||||
@@ -193,9 +170,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 += [
|
||||
@@ -238,165 +215,4 @@ 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",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
source_set("plugins") {
|
||||
sources = []
|
||||
deps = []
|
||||
libs = []
|
||||
|
||||
# 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_broker_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.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" ]
|
||||
}
|
||||
if (enable_pepper_flash) {
|
||||
sources += [
|
||||
"//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",
|
||||
]
|
||||
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" ]
|
||||
}
|
||||
}
|
||||
|
||||
# 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_shared_memory_message_filter.cc",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
||||
]
|
||||
if (enable_pepper_flash) {
|
||||
sources += [
|
||||
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_drm_renderer_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",
|
||||
]
|
||||
}
|
||||
if (enable_pepper_flash || enable_pdf_viewer) {
|
||||
sources += [
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.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
|
||||
# You may have to add new files here during the upgrade if //chrome/browser/spellchecker
|
||||
# gets more files
|
||||
source_set("chrome_spellchecker") {
|
||||
sources = []
|
||||
deps = []
|
||||
libs = []
|
||||
|
||||
if (enable_builtin_spellchecker) {
|
||||
sources += [
|
||||
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.cc",
|
||||
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_custom_dictionary.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_custom_dictionary.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_factory.cc",
|
||||
"//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_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",
|
||||
"//chrome/browser/spellchecker/spellcheck_service.h",
|
||||
"//chrome/common/pref_names.h",
|
||||
]
|
||||
|
||||
if (has_spellcheck_panel) {
|
||||
sources += [
|
||||
"//chrome/browser/spellchecker/spell_check_panel_host_impl.cc",
|
||||
"//chrome/browser/spellchecker/spell_check_panel_host_impl.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (use_browser_spellchecker) {
|
||||
sources += [
|
||||
"//chrome/browser/spellchecker/spelling_request.cc",
|
||||
"//chrome/browser/spellchecker/spelling_request.h",
|
||||
]
|
||||
}
|
||||
|
||||
deps += [
|
||||
"//base:base_static",
|
||||
"//components/language/core/browser",
|
||||
"//components/spellcheck:buildflags",
|
||||
"//components/sync",
|
||||
]
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
"//components/spellcheck/browser",
|
||||
"//components/spellcheck/common",
|
||||
"//components/spellcheck/renderer",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -36,10 +36,11 @@ 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 */);
|
||||
crypto::ScopedPK11Slot(
|
||||
crypto::GetPersistentNSSKeySlot()) /* public slot */,
|
||||
crypto::ScopedPK11Slot(
|
||||
crypto::GetPersistentNSSKeySlot()) /* private slot */);
|
||||
}
|
||||
return g_nss_cert_database;
|
||||
}
|
||||
@@ -72,7 +73,7 @@ net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
|
||||
void CertificateManagerModel::Create(content::BrowserContext* browser_context,
|
||||
const CreationCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
base::PostTask(
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&CertificateManagerModel::GetCertDBOnIOThread,
|
||||
browser_context->GetResourceContext(), callback));
|
||||
@@ -85,7 +86,7 @@ CertificateManagerModel::CertificateManagerModel(
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
}
|
||||
|
||||
CertificateManagerModel::~CertificateManagerModel() = default;
|
||||
CertificateManagerModel::~CertificateManagerModel() {}
|
||||
|
||||
int CertificateManagerModel::ImportFromPKCS12(
|
||||
PK11SlotInfo* slot_info,
|
||||
@@ -145,7 +146,7 @@ void CertificateManagerModel::DidGetCertDBOnIOThread(
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
|
||||
bool is_user_db_available = !!cert_db->GetPublicSlot();
|
||||
base::PostTask(
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&CertificateManagerModel::DidGetCertDBOnUIThread, cert_db,
|
||||
is_user_db_available, callback));
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/common/electron_command_line.h"
|
||||
#include "shell/common/atom_command_line.h"
|
||||
|
||||
#include "base/base_paths.h"
|
||||
#include "base/bind.h"
|
||||
@@ -93,6 +93,7 @@
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "net/base/network_interfaces.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
||||
#if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
||||
#include "ui/views/linux_ui/linux_ui.h"
|
||||
@@ -184,7 +185,7 @@ int WaitSocketForRead(int fd, const base::TimeDelta& timeout) {
|
||||
FD_ZERO(&read_fds);
|
||||
FD_SET(fd, &read_fds);
|
||||
|
||||
return HANDLE_EINTR(select(fd + 1, &read_fds, nullptr, nullptr, &tv));
|
||||
return HANDLE_EINTR(select(fd + 1, &read_fds, NULL, NULL, &tv));
|
||||
}
|
||||
|
||||
// Read a message from a socket fd, with an optional timeout.
|
||||
@@ -704,7 +705,7 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK(
|
||||
if (shutdown(fd_, SHUT_WR) < 0)
|
||||
PLOG(ERROR) << "shutdown() failed";
|
||||
|
||||
base::PostTask(
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&ProcessSingleton::LinuxWatcher::RemoveSocketReader,
|
||||
parent_, this));
|
||||
@@ -826,7 +827,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
return PROCESS_NONE;
|
||||
to_send.append(current_dir.value());
|
||||
|
||||
const std::vector<std::string>& argv = electron::ElectronCommandLine::argv();
|
||||
const std::vector<std::string>& argv = electron::AtomCommandLine::argv();
|
||||
for (std::vector<std::string>::const_iterator it = argv.begin();
|
||||
it != argv.end(); ++it) {
|
||||
to_send.push_back(kTokenDelimiter);
|
||||
@@ -884,9 +885,10 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() {
|
||||
|
||||
void ProcessSingleton::StartListeningOnSocket() {
|
||||
watcher_ = new LinuxWatcher(this);
|
||||
base::PostTask(FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&ProcessSingleton::LinuxWatcher::StartListening,
|
||||
watcher_, sock_));
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&ProcessSingleton::LinuxWatcher::StartListening, watcher_,
|
||||
sock_));
|
||||
}
|
||||
|
||||
void ProcessSingleton::OnBrowserReady() {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "chrome/browser/win/chrome_process_finder.h"
|
||||
#include "content/public/common/result_codes.h"
|
||||
#include "net/base/escape.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/win/hwnd_util.h"
|
||||
|
||||
namespace {
|
||||
@@ -197,7 +198,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:
|
||||
|
||||
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,6 +1,5 @@
|
||||
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
|
||||
let mainWindow: BrowserWindow | null = null;
|
||||
|
||||
@@ -30,11 +29,12 @@ 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) => {
|
||||
|
||||
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
|
||||
@@ -53,7 +53,6 @@ an issue:
|
||||
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
|
||||
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
|
||||
* [Supporting macOS Dark Mode](tutorial/mojave-dark-mode-guide.md)
|
||||
* [Web embeds in Electron](tutorial/web-embeds.md)
|
||||
* [Accessibility](tutorial/accessibility.md)
|
||||
* [Spectron](tutorial/accessibility.md#spectron)
|
||||
* [Devtron](tutorial/accessibility.md#devtron)
|
||||
@@ -110,10 +109,9 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
|
||||
* [Synopsis](api/synopsis.md)
|
||||
* [Process Object](api/process.md)
|
||||
* [Supported Command Line Switches](api/command-line-switches.md)
|
||||
* [Supported Chrome Command Line Switches](api/chrome-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:
|
||||
|
||||
@@ -137,7 +135,6 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* [MenuItem](api/menu-item.md)
|
||||
* [net](api/net.md)
|
||||
* [netLog](api/net-log.md)
|
||||
* [Notification](api/notification.md)
|
||||
* [powerMonitor](api/power-monitor.md)
|
||||
* [powerSaveBlocker](api/power-save-blocker.md)
|
||||
* [protocol](api/protocol.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.
|
||||
@@ -54,7 +54,7 @@ The `Super` key is mapped to the `Windows` key on Windows and Linux and
|
||||
* `0` to `9`
|
||||
* `A` to `Z`
|
||||
* `F1` to `F24`
|
||||
* Punctuation like `~`, `!`, `@`, `#`, `$`, etc.
|
||||
* Punctuations like `~`, `!`, `@`, `#`, `$`, etc.
|
||||
* `Plus`
|
||||
* `Space`
|
||||
* `Tab`
|
||||
|
||||
114
docs/api/app.md
114
docs/api/app.md
@@ -34,11 +34,10 @@ Returns:
|
||||
|
||||
* `launchInfo` unknown _macOS_
|
||||
|
||||
Emitted once, 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 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'
|
||||
|
||||
@@ -75,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
|
||||
@@ -204,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_
|
||||
|
||||
@@ -369,25 +368,6 @@ Returns:
|
||||
|
||||
Emitted when the renderer process of `webContents` crashes or is killed.
|
||||
|
||||
#### 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-failure` - Process never successfully launched
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
|
||||
Emitted when the renderer process unexpectedly dissapears. This is normally
|
||||
because it was crashed or killed.
|
||||
|
||||
### Event: 'accessibility-support-changed' _macOS_ _Windows_
|
||||
|
||||
Returns:
|
||||
@@ -412,7 +392,7 @@ Emitted when Electron has created a new `session`.
|
||||
```javascript
|
||||
const { app } = require('electron')
|
||||
|
||||
app.on('session-created', (session) => {
|
||||
app.on('session-created', (event, session) => {
|
||||
console.log(session)
|
||||
})
|
||||
```
|
||||
@@ -507,6 +487,18 @@ Emitted when `remote.getCurrentWebContents()` is called in the renderer process
|
||||
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.
|
||||
@@ -627,7 +612,6 @@ Returns `String` - The current application directory.
|
||||
* `videos` Directory for a user's videos.
|
||||
* `logs` Directory for your app's log folder.
|
||||
* `pepperFlashSystemPlugin` Full path to the system version of the Pepper Flash plugin.
|
||||
* `crashDumps` Directory where crash dumps are stored.
|
||||
|
||||
Returns `String` - A path to a special directory or file associated with `name`. On
|
||||
failure, an `Error` is thrown.
|
||||
@@ -685,19 +669,21 @@ 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
|
||||
|
||||
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. 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).
|
||||
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/chrome-command-line-switches.md).
|
||||
|
||||
**Note:** When distributing your packaged app, you have to also ship the
|
||||
`locales` folder.
|
||||
@@ -782,21 +768,6 @@ macOS machine. Please refer to
|
||||
|
||||
The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme` internally.
|
||||
|
||||
### `app.getApplicationNameForProtocol(url)`
|
||||
|
||||
* `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 `String` - Name of the application handling the protocol, or an empty
|
||||
string if there is no handler. For instance, if Electron is the default
|
||||
handler of the URL, this could be `Electron` on Windows and Mac. However,
|
||||
don't rely on the precise format which is not guaranteed to remain unchanged.
|
||||
Expect a different format on Linux, possibly with a `.desktop` suffix.
|
||||
|
||||
This method returns the application name 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
|
||||
@@ -957,7 +928,7 @@ if (!gotTheLock) {
|
||||
})
|
||||
|
||||
// Create myWindow, load the rest of the app, etc...
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
})
|
||||
}
|
||||
```
|
||||
@@ -1014,17 +985,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
|
||||
@@ -1047,7 +1007,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.
|
||||
|
||||
@@ -1111,10 +1071,14 @@ On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
|
||||
**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.
|
||||
@@ -1189,6 +1153,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
|
||||
@@ -1200,23 +1166,25 @@ 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.
|
||||
|
||||
### `app.showAboutPanel()`
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.showAboutPanel()` _macOS_ _Linux_
|
||||
|
||||
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`.
|
||||
|
||||
### `app.setAboutPanelOptions(options)`
|
||||
### `app.setAboutPanelOptions(options)` _macOS_ _Linux_
|
||||
|
||||
* `options` Object
|
||||
* `applicationName` String (optional) - The app's name.
|
||||
* `applicationVersion` String (optional) - The app's version.
|
||||
* `copyright` String (optional) - Copyright information.
|
||||
* `version` String (optional) _macOS_ - The app's build version number.
|
||||
* `credits` String (optional) _macOS_ _Windows_ - Credit information.
|
||||
* `credits` String (optional) _macOS_ - 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. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
|
||||
* `iconPath` String (optional) _Linux_ - Path to the app's icon. 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.
|
||||
|
||||
@@ -1329,7 +1297,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_
|
||||
@@ -1373,7 +1341,7 @@ in your app's initialization to ensure that your overridden value is used.
|
||||
|
||||
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 `true`.
|
||||
default value for this property is `false`.
|
||||
|
||||
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
|
||||
|
||||
582
docs/api/breaking-changes.md
Normal file
582
docs/api/breaking-changes.md
Normal file
@@ -0,0 +1,582 @@
|
||||
# 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 (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 Elecron 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
|
||||
// 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'
|
||||
})
|
||||
```
|
||||
|
||||
## `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).
|
||||
@@ -15,9 +15,12 @@ relative to its owning window. It is meant to be an alternative to the
|
||||
// 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')
|
||||
|
||||
@@ -11,7 +11,10 @@ const { BrowserWindow } = require('electron')
|
||||
// Or use `remote` from the renderer process.
|
||||
// const { BrowserWindow } = require('electron').remote
|
||||
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
let win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.on('closed', () => {
|
||||
win = null
|
||||
})
|
||||
|
||||
// Load a remote URL
|
||||
win.loadURL('https://github.com')
|
||||
@@ -177,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
|
||||
@@ -203,11 +206,12 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `backgroundColor` String (optional) - Window's background color as a hexadecimal value,
|
||||
like `#66CD00` or `#FFF` or `#80FFFFFF` (alpha in #AARRGGBB format is supported if
|
||||
`transparent` is set to `true`). Default is `#FFF` (white).
|
||||
* `hasShadow` Boolean (optional) - Whether window should have a shadow. Default is `true`.
|
||||
* `hasShadow` Boolean (optional) - Whether window should have a shadow. This is only
|
||||
implemented on macOS. Default is `true`.
|
||||
* `opacity` Number (optional) - Set the initial opacity of the window, between 0.0 (fully
|
||||
transparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.
|
||||
* `darkTheme` Boolean (optional) - Forces using dark theme for the window, only works on
|
||||
some GTK desktop environments. Default is `false`.
|
||||
some GTK+3 desktop environments. Default is `false`.
|
||||
* `transparent` Boolean (optional) - Makes the window [transparent](frameless-window.md#transparent-window).
|
||||
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
|
||||
@@ -226,7 +230,6 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
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`.
|
||||
@@ -289,7 +292,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
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`. _Deprecated_
|
||||
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`.
|
||||
@@ -348,9 +351,6 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
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.
|
||||
* `worldSafeExecuteJavaScript` Boolean (optional) - If true, values returned from `webFrame.executeJavaScript` will be sanitized to ensure JS values
|
||||
can't unsafely cross between worlds when using `contextIsolation`. The default
|
||||
is `false`. In Electron 12, the default will be changed to `true`. _Deprecated_
|
||||
* `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:** This option is currently
|
||||
@@ -372,8 +372,6 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
consecutive dialog protection is triggered. If not defined the default
|
||||
message would be used, note that currently the default message is in
|
||||
English and not localized.
|
||||
* `disableDialogs` Boolean (optional) - Whether to disable dialogs
|
||||
completely. Overrides `safeDialogs`. Default is `false`.
|
||||
* `navigateOnDragDrop` Boolean (optional) - Whether dragging and dropping a
|
||||
file or link onto the page causes a navigation. Default is `false`.
|
||||
* `autoplayPolicy` String (optional) - Autoplay policy to apply to
|
||||
@@ -383,20 +381,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `disableHtmlFullscreenWindowResize` Boolean (optional) - Whether to
|
||||
prevent the window from resizing when entering HTML Fullscreen. Default
|
||||
is `false`.
|
||||
* `accessibleTitle` String (optional) - An alternative title string provided only
|
||||
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`.
|
||||
|
||||
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
|
||||
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
|
||||
@@ -537,14 +523,14 @@ Note that this is only emitted when the window is being resized manually. Resizi
|
||||
|
||||
Emitted after the window has been resized.
|
||||
|
||||
#### Event: 'will-move' _macOS_ _Windows_
|
||||
#### Event: 'will-move' _Windows_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `newBounds` [Rectangle](structures/rectangle.md) - Location the window is being moved to.
|
||||
|
||||
Emitted before the window is moved. On Windows, calling `event.preventDefault()` will prevent the window from being moved.
|
||||
Emitted before the window is moved. Calling `event.preventDefault()` will prevent the window from being moved.
|
||||
|
||||
Note that this is only emitted when the window is being resized manually. Resizing the window with `setBounds`/`setSize` will not emit this event.
|
||||
|
||||
@@ -682,8 +668,7 @@ Returns `BrowserWindow | null` - The window that is focused in this application,
|
||||
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
|
||||
Returns `BrowserWindow | null` - The window that owns the given `webContents`
|
||||
or `null` if the contents are not owned by a window.
|
||||
Returns `BrowserWindow` - The window that owns the given `webContents`.
|
||||
|
||||
#### `BrowserWindow.fromBrowserView(browserView)`
|
||||
|
||||
@@ -697,7 +682,7 @@ Returns `BrowserWindow | null` - The window that owns the given `browserView`. I
|
||||
|
||||
Returns `BrowserWindow` - The window with the given `id`.
|
||||
|
||||
#### `BrowserWindow.addExtension(path)` _Deprecated_
|
||||
#### `BrowserWindow.addExtension(path)`
|
||||
|
||||
* `path` String
|
||||
|
||||
@@ -708,10 +693,7 @@ The method will also not return if the extension's manifest is missing or incomp
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.loadExtension(path)`](session.md#sesloadextensionpath).
|
||||
|
||||
#### `BrowserWindow.removeExtension(name)` _Deprecated_
|
||||
#### `BrowserWindow.removeExtension(name)`
|
||||
|
||||
* `name` String
|
||||
|
||||
@@ -720,10 +702,7 @@ Remove a Chrome extension by name.
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.removeExtension(extension_id)`](session.md#sesremoveextensionextensionid).
|
||||
|
||||
#### `BrowserWindow.getExtensions()` _Deprecated_
|
||||
#### `BrowserWindow.getExtensions()`
|
||||
|
||||
Returns `Record<String, ExtensionInfo>` - The keys are the extension names and each value is
|
||||
an Object containing `name` and `version` properties.
|
||||
@@ -731,10 +710,7 @@ an Object containing `name` and `version` properties.
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.getAllExtensions()`](session.md#sesgetallextensions).
|
||||
|
||||
#### `BrowserWindow.addDevToolsExtension(path)` _Deprecated_
|
||||
#### `BrowserWindow.addDevToolsExtension(path)`
|
||||
|
||||
* `path` String
|
||||
|
||||
@@ -750,10 +726,7 @@ The method will also not return if the extension's manifest is missing or incomp
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.loadExtension(path)`](session.md#sesloadextensionpath).
|
||||
|
||||
#### `BrowserWindow.removeDevToolsExtension(name)` _Deprecated_
|
||||
#### `BrowserWindow.removeDevToolsExtension(name)`
|
||||
|
||||
* `name` String
|
||||
|
||||
@@ -762,10 +735,7 @@ Remove a DevTools extension by name.
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.removeExtension(extension_id)`](session.md#sesremoveextensionextensionid).
|
||||
|
||||
#### `BrowserWindow.getDevToolsExtensions()` _Deprecated_
|
||||
#### `BrowserWindow.getDevToolsExtensions()`
|
||||
|
||||
Returns `Record<string, ExtensionInfo>` - The keys are the extension names and each value is
|
||||
an Object containing `name` and `version` properties.
|
||||
@@ -782,9 +752,6 @@ console.log(installed)
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.getAllExtensions()`](session.md#sesgetallextensions).
|
||||
|
||||
### Instance Properties
|
||||
|
||||
Objects created with `new BrowserWindow` have the following properties:
|
||||
@@ -806,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`
|
||||
|
||||
@@ -815,51 +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.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.
|
||||
@@ -912,12 +834,6 @@ const menu = Menu.buildFromTemplate(template)
|
||||
Menu.setApplicationMenu(menu)
|
||||
```
|
||||
|
||||
#### `win.accessibleTitle`
|
||||
|
||||
A `String` property that defines an alternative title provided only to
|
||||
accessibility tools such as screen readers. This string is not directly
|
||||
visible to users.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
Objects created with `new BrowserWindow` have the following instance methods:
|
||||
@@ -1015,7 +931,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_
|
||||
|
||||
@@ -1025,11 +941,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])` _macOS_ _Linux_
|
||||
#### `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
|
||||
@@ -1042,10 +958,13 @@ 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.
|
||||
|
||||
Calling this function with a value of `0` will remove any previously set aspect
|
||||
ratios.
|
||||
|
||||
#### `win.setBackgroundColor(backgroundColor)`
|
||||
|
||||
* `backgroundColor` String - Window's background color as a hexadecimal value,
|
||||
@@ -1095,11 +1014,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)
|
||||
@@ -1126,7 +1040,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])`
|
||||
|
||||
@@ -1265,14 +1179,6 @@ can not be focused on.
|
||||
|
||||
Returns `Boolean` - Whether the window is always on top of other windows.
|
||||
|
||||
#### `win.moveAbove(mediaSourceId)`
|
||||
|
||||
* `mediaSourceId` String - Window id in the format of DesktopCapturerSource's id. For example "window:1869:0".
|
||||
|
||||
Moves window above the source window in the sense of z-order. If the
|
||||
`mediaSourceId` is not of type window or if the window does not exist then
|
||||
this method throws an error.
|
||||
|
||||
#### `win.moveTop()`
|
||||
|
||||
Moves window to top(z-order) regardless of focus
|
||||
@@ -1339,21 +1245,12 @@ 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.getMediaSourceId()`
|
||||
|
||||
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
|
||||
Linux. `other_id` is used to identify web contents (tabs) so within the same
|
||||
top level window.
|
||||
|
||||
#### `win.getNativeWindowHandle()`
|
||||
|
||||
Returns `Buffer` - The platform-specific handle of the window.
|
||||
@@ -1782,17 +1679,6 @@ will remove the vibrancy effect on the window.
|
||||
Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` have been
|
||||
deprecated and will be removed in an upcoming version of macOS.
|
||||
|
||||
#### `win.setTrafficLightPosition(position)` _macOS_
|
||||
|
||||
* `position` [Point](structures/point.md)
|
||||
|
||||
Set a custom position for the traffic light buttons. Can only be used with `titleBarStyle` set to `hidden`.
|
||||
|
||||
#### `win.getTrafficLightPosition()` _macOS_
|
||||
|
||||
Returns `Point` - The current position for the traffic light buttons. Can only be used with `titleBarStyle`
|
||||
set to `hidden`.
|
||||
|
||||
#### `win.setTouchBar(touchBar)` _macOS_ _Experimental_
|
||||
|
||||
* `touchBar` TouchBar | null
|
||||
@@ -1806,14 +1692,14 @@ removed in future Electron releases.
|
||||
|
||||
#### `win.setBrowserView(browserView)` _Experimental_
|
||||
|
||||
* `browserView` [BrowserView](browser-view.md) | null - Attach `browserView` to `win`.
|
||||
If there are other `BrowserView`s attached, they will be removed from
|
||||
* `browserView` [BrowserView](browser-view.md) | null - Attach browserView to win.
|
||||
If there is some other browserViews was attached they will be removed from
|
||||
this window.
|
||||
|
||||
#### `win.getBrowserView()` _Experimental_
|
||||
|
||||
Returns `BrowserView | null` - The `BrowserView` attached to `win`. Returns `null`
|
||||
if one is not attached. Throws an error if multiple `BrowserView`s are attached.
|
||||
Returns `BrowserView | null` - an BrowserView what is attached. Returns `null`
|
||||
if none is attached. Throw error if multiple BrowserViews is attached.
|
||||
|
||||
#### `win.addBrowserView(browserView)` _Experimental_
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Supported Command Line Switches
|
||||
# Supported Chrome Command Line Switches
|
||||
|
||||
> Command line switches supported by Electron.
|
||||
|
||||
@@ -11,7 +11,7 @@ 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
|
||||
})
|
||||
```
|
||||
@@ -185,16 +185,6 @@ logging level for all code in the source files under a `foo/bar` directory.
|
||||
|
||||
This switch only works when `--enable-logging` is also passed.
|
||||
|
||||
## --enable-api-filtering-logging
|
||||
|
||||
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`
|
||||
|
||||
## --no-sandbox
|
||||
|
||||
Disables Chromium sandbox, which is now enabled by default.
|
||||
@@ -12,7 +12,7 @@ app.commandLine.hasSwitch('disable-gpu')
|
||||
```
|
||||
|
||||
For more information on what kinds of flags and switches you can use, check
|
||||
out the [Command Line Switches](./command-line-switches.md)
|
||||
out the [Chrome Command Line Switches](./chrome-command-line-switches.md)
|
||||
document.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
@@ -13,7 +13,7 @@ module is emitted.
|
||||
```javascript
|
||||
const { app, contentTracing } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
(async () => {
|
||||
await contentTracing.startRecording({
|
||||
include_categories: ['*']
|
||||
@@ -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))
|
||||
|
||||
@@ -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,19 +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.
|
||||
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
|
||||
|
||||
@@ -46,68 +43,40 @@ The `crashReporter` module has the following methods:
|
||||
### `crashReporter.start(options)`
|
||||
|
||||
* `options` Object
|
||||
* `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) _macOS_ _Windows_ - If true, crash reports
|
||||
will be compressed and uploaded with `Content-Encoding: gzip`. Not all
|
||||
collection servers support compressed payloads. Default is `false`.
|
||||
* `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:** Calling this method from the renderer process is deprecated.
|
||||
**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:** Calling this method from the renderer process is deprecated.
|
||||
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()`
|
||||
|
||||
@@ -116,67 +85,39 @@ Returns [`CrashReport[]`](structures/crash-report.md):
|
||||
Returns all uploaded crash reports. Each report contains the date and uploaded
|
||||
ID.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
|
||||
### `crashReporter.getUploadToServer()`
|
||||
|
||||
Returns `Boolean` - Whether reports should be submitted to the server. Set through
|
||||
the `start` method or `setUploadToServer`.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
**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:** Calling this method from the renderer process is deprecated.
|
||||
**Note:** This API can only be called from the main process.
|
||||
|
||||
### `crashReporter.getCrashesDirectory()` _Deprecated_
|
||||
### `crashReporter.addExtraParameter(key, value)` _macOS_ _Windows_
|
||||
|
||||
Returns `String` - The directory where crashes are temporarily stored before being uploaded.
|
||||
* `key` String - Parameter key, must be less than 64 characters long.
|
||||
* `value` String - Parameter value, must be less than 64 characters long.
|
||||
|
||||
**Note:** This method is deprecated, use `app.getPath('crashDumps')` instead.
|
||||
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.
|
||||
|
||||
### `crashReporter.addExtraParameter(key, value)`
|
||||
### `crashReporter.removeExtraParameter(key)` _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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
**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.
|
||||
|
||||
**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 a 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.
|
||||
|
||||
## Crash Report Payload
|
||||
|
||||
|
||||
@@ -50,10 +50,8 @@ Returns:
|
||||
|
||||
* `event` Event
|
||||
* `method` String - Method name.
|
||||
* `params` any - Event parameters defined by the 'parameters'
|
||||
* `params` unknown - 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
|
||||
|
||||
@@ -91,11 +91,7 @@ The `desktopCapturer` module has the following methods:
|
||||
|
||||
Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`DesktopCapturerSource`](structures/desktop-capturer-source.md) objects, each `DesktopCapturerSource` represents a screen or an individual window that can be captured.
|
||||
|
||||
**Note** Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
|
||||
which can detected by [`systemPreferences.getMediaAccessStatus`].
|
||||
|
||||
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
|
||||
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-macos
|
||||
|
||||
## Caveats
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ The `dialog` module has the following methods:
|
||||
their target path.
|
||||
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
||||
as a directory instead of a file.
|
||||
* `dontAddToRecent` _Windows_ - Do not add the item being opened to the recent documents list.
|
||||
* `message` String (optional) _macOS_ - Message to display above input
|
||||
boxes.
|
||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
|
||||
@@ -111,7 +110,6 @@ dialog.showOpenDialogSync(mainWindow, {
|
||||
their target path.
|
||||
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
||||
as a directory instead of a file.
|
||||
* `dontAddToRecent` _Windows_ - Do not add the item being opened to the recent documents list.
|
||||
* `message` String (optional) _macOS_ - Message to display above input
|
||||
boxes.
|
||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
|
||||
@@ -173,13 +171,6 @@ dialog.showOpenDialog(mainWindow, {
|
||||
displayed in front of the filename text field.
|
||||
* `showsTagField` Boolean (optional) _macOS_ - Show the tags input box,
|
||||
defaults to `true`.
|
||||
* `properties` String[] (optional)
|
||||
* `showHiddenFiles` - Show hidden files in dialog.
|
||||
* `createDirectory` _macOS_ - Allow creating new directories from dialog.
|
||||
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
||||
as a directory instead of a file.
|
||||
* `showOverwriteConfirmation` _Linux_ - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.
|
||||
* `dontAddToRecent` _Windows_ - Do not add the item being saved to the recent documents list.
|
||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
|
||||
|
||||
Returns `String | undefined`, the path of the file chosen by the user; if the dialog is cancelled it returns `undefined`.
|
||||
@@ -202,14 +193,8 @@ The `filters` specifies an array of file types that can be displayed, see
|
||||
* `message` String (optional) _macOS_ - Message to display above text fields.
|
||||
* `nameFieldLabel` String (optional) _macOS_ - Custom label for the text
|
||||
displayed in front of the filename text field.
|
||||
* `showsTagField` Boolean (optional) _macOS_ - Show the tags input box, defaults to `true`.
|
||||
* `properties` String[] (optional)
|
||||
* `showHiddenFiles` - Show hidden files in dialog.
|
||||
* `createDirectory` _macOS_ - Allow creating new directories from dialog.
|
||||
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
||||
as a directory instead of a file.
|
||||
* `showOverwriteConfirmation` _Linux_ - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.
|
||||
* `dontAddToRecent` _Windows_ - Do not add the item being saved to the recent documents list.
|
||||
* `showsTagField` Boolean (optional) _macOS_ - Show the tags input box,
|
||||
defaults to `true`.
|
||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
|
||||
|
||||
Returns `Promise<Object>` - Resolve with an object containing the following:
|
||||
@@ -269,7 +254,7 @@ Shows a message box, it will block the process until the message box is closed.
|
||||
It returns the index of the clicked button.
|
||||
|
||||
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
|
||||
If `browserWindow` is not shown dialog will not be attached to it. In such case It will be displayed as independed window.
|
||||
If the `browserWindow` is not shown, the dialog will not be attached to it. In that case it will be displayed as an independent window.
|
||||
|
||||
### `dialog.showMessageBox([browserWindow, ]options)`
|
||||
|
||||
|
||||
@@ -82,12 +82,16 @@ The API is only available in session's `will-download` callback function.
|
||||
If user doesn't set the save path via the API, Electron will use the original
|
||||
routine to determine the save path; this usually prompts a save dialog.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md): use the `savePath` property instead.**
|
||||
|
||||
#### `downloadItem.getSavePath()`
|
||||
|
||||
Returns `String` - The save path of the download item. This will be either the path
|
||||
set via `downloadItem.setSavePath(path)` or the path selected from the shown
|
||||
save dialog.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md): use the `savePath` property instead.**
|
||||
|
||||
#### `downloadItem.setSaveDialogOptions(options)`
|
||||
|
||||
* `options` SaveDialogOptions - Set the save file dialog options. This object has the same
|
||||
|
||||
@@ -44,32 +44,20 @@ Unsupported options are:
|
||||
--use-openssl-ca
|
||||
```
|
||||
|
||||
`NODE_OPTIONS` are explicitly disallowed in packaged apps, except for the following:
|
||||
|
||||
```sh
|
||||
--max-http-header-size
|
||||
--http-parser
|
||||
```
|
||||
`NODE_OPTIONS` are explicitly disallowed in packaged apps.
|
||||
|
||||
### `GOOGLE_API_KEY`
|
||||
|
||||
Geolocation support in Electron requires the use of Google Cloud Platform's
|
||||
geolocation webservice. To enable this feature, acquire a
|
||||
[Google API key](https://developers.google.com/maps/documentation/geolocation/get-api-key)
|
||||
and place the following code in your main process file, before opening any
|
||||
browser windows that will make geolocation requests:
|
||||
You can provide an API key for making requests to Google's geocoding webservice. To do this, place the following code in your main process
|
||||
file, before opening any browser windows that will make geocoding requests:
|
||||
|
||||
```javascript
|
||||
process.env.GOOGLE_API_KEY = 'YOUR_KEY_HERE'
|
||||
```
|
||||
|
||||
By default, a newly generated Google API key may not be allowed to make geolocation requests.
|
||||
To enable the geolocation webservice for your project, enable it through the
|
||||
[API library](https://console.cloud.google.com/apis/library).
|
||||
|
||||
N.B. You will need to add a
|
||||
[Billing Account](https://cloud.google.com/billing/docs/how-to/payment-methods#add_a_payment_method)
|
||||
to the project associated to the API key for the geolocation webservice to work.
|
||||
For instructions on how to acquire a Google API key, visit [this page](https://developers.google.com/maps/documentation/javascript/get-api-key).
|
||||
By default, a newly generated Google API key may not be allowed to make
|
||||
geocoding requests. To enable geocoding requests, visit [this page](https://developers.google.com/maps/documentation/geocoding/get-api-key).
|
||||
|
||||
### `ELECTRON_NO_ASAR`
|
||||
|
||||
@@ -133,7 +121,7 @@ the `electron` command to use the specified build of Electron instead of
|
||||
the one downloaded by `npm install`. Usage:
|
||||
|
||||
```sh
|
||||
export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing
|
||||
export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Debug
|
||||
```
|
||||
|
||||
## Set By Electron
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
# Chrome Extension Support
|
||||
|
||||
Electron supports a subset of the [Chrome Extensions
|
||||
API][chrome-extensions-api-index], primarily to support DevTools extensions and
|
||||
Chromium-internal extensions, but it also happens to support some other
|
||||
extension capabilities.
|
||||
|
||||
[chrome-extensions-api-index]: https://developer.chrome.com/extensions/api_index
|
||||
|
||||
> **Note:** Electron does not support arbitrary Chrome extensions from the
|
||||
> store, and it is a **non-goal** of the Electron project to be perfectly
|
||||
> compatible with Chrome's implementation of Extensions.
|
||||
|
||||
## Loading extensions
|
||||
|
||||
Electron only supports loading unpacked extensions (i.e., `.crx` files do not
|
||||
work). Extensions are installed per-`session`. To load an extension, call
|
||||
[`ses.loadExtension`](session.md#sesloadextensionpath):
|
||||
|
||||
```js
|
||||
const { session } = require('electron')
|
||||
|
||||
session.loadExtension('path/to/unpacked/extension').then(({ id }) => {
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
Loaded extensions will not be automatically remembered across exits; if you do
|
||||
not call `loadExtension` when the app runs, the extension will not be loaded.
|
||||
|
||||
Note that loading extensions is only supported in persistent sessions.
|
||||
Attempting to load an extension into an in-memory session will throw an error.
|
||||
|
||||
See the [`session`](session.md) documentation for more information about
|
||||
loading, unloading, and querying active extensions.
|
||||
|
||||
## Supported Extensions APIs
|
||||
|
||||
We support the following extensions APIs, with some caveats. Other APIs may
|
||||
additionally be supported, but support for any APIs not listed here is
|
||||
provisional and may be removed.
|
||||
|
||||
### `chrome.devtools.inspectedWindow`
|
||||
|
||||
All features of this API are supported.
|
||||
|
||||
### `chrome.devtools.network`
|
||||
|
||||
All features of this API are supported.
|
||||
|
||||
### `chrome.devtools.panels`
|
||||
|
||||
All features of this API are supported.
|
||||
|
||||
### `chrome.extension`
|
||||
|
||||
The following properties of `chrome.extension` are supported:
|
||||
|
||||
- `chrome.extension.lastError`
|
||||
|
||||
The following methods of `chrome.extension` are supported:
|
||||
|
||||
- `chrome.extension.getURL`
|
||||
- `chrome.extension.getBackgroundPage`
|
||||
|
||||
### `chrome.runtime`
|
||||
|
||||
The following properties of `chrome.runtime` are supported:
|
||||
|
||||
- `chrome.runtime.lastError`
|
||||
- `chrome.runtime.id`
|
||||
|
||||
The following methods of `chrome.runtime` are supported:
|
||||
|
||||
- `chrome.runtime.getBackgroundPage`
|
||||
- `chrome.runtime.getManifest`
|
||||
- `chrome.runtime.getURL`
|
||||
- `chrome.runtime.connect`
|
||||
- `chrome.runtime.sendMessage`
|
||||
|
||||
The following events of `chrome.runtime` are supported:
|
||||
|
||||
- `chrome.runtime.onStartup`
|
||||
- `chrome.runtime.onInstalled`
|
||||
- `chrome.runtime.onSuspend`
|
||||
- `chrome.runtime.onSuspendCanceled`
|
||||
- `chrome.runtime.onConnect`
|
||||
- `chrome.runtime.onMessage`
|
||||
|
||||
### `chrome.storage`
|
||||
|
||||
Only `chrome.storage.local` is supported; `chrome.storage.sync` and
|
||||
`chrome.storage.managed` are not.
|
||||
|
||||
### `chrome.tabs`
|
||||
|
||||
The following methods of `chrome.tabs` are supported:
|
||||
|
||||
- `chrome.tabs.sendMessage`
|
||||
- `chrome.tabs.executeScript`
|
||||
|
||||
> **Note:** In Chrome, passing `-1` as a tab ID signifies the "currently active
|
||||
> tab". Since Electron has no such concept, passing `-1` as a tab ID is not
|
||||
> supported and will raise an error.
|
||||
|
||||
### `chrome.management`
|
||||
|
||||
The following methods of `chrome.management` are supported:
|
||||
|
||||
- `chrome.management.getAll`
|
||||
- `chrome.management.get`
|
||||
- `chrome.management.getSelf`
|
||||
- `chrome.management.getPermissionWarningsById`
|
||||
- `chrome.management.getPermissionWarningsByManifest`
|
||||
- `chrome.management.onEnabled`
|
||||
- `chrome.management.onDisabled`
|
||||
@@ -52,7 +52,7 @@ win.show()
|
||||
Uses custom drawn close, and miniaturize buttons that display
|
||||
when hovering in the top left of the window. The fullscreen button
|
||||
is not available due to restrictions of frameless windows as they
|
||||
interface with Apple's macOS window masks. These custom buttons prevent
|
||||
interface with Apple's MacOS window masks. These custom buttons prevent
|
||||
issues with mouse events that occur with the standard window toolbar buttons.
|
||||
This option is only applicable for frameless windows.
|
||||
|
||||
@@ -158,7 +158,7 @@ buttons in titlebar non-draggable.
|
||||
|
||||
## Text selection
|
||||
|
||||
In a frameless window the dragging behavior may conflict with selecting text.
|
||||
In a frameless window the dragging behaviour may conflict with selecting text.
|
||||
For example, when you drag the titlebar you may accidentally select the text on
|
||||
the titlebar. To prevent this, you need to disable text selection within a
|
||||
draggable area like this:
|
||||
|
||||
@@ -15,7 +15,7 @@ event of the app module is emitted.
|
||||
```javascript
|
||||
const { app, globalShortcut } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
// Register a 'CommandOrControl+X' shortcut listener.
|
||||
const ret = globalShortcut.register('CommandOrControl+X', () => {
|
||||
console.log('CommandOrControl+X is pressed')
|
||||
|
||||
@@ -40,17 +40,11 @@ Retrieves the product descriptions.
|
||||
|
||||
### `inAppPurchase.canMakePayments()`
|
||||
|
||||
Returns `Boolean` - whether a user can make a payment.
|
||||
|
||||
### `inAppPurchase.restoreCompletedTransactions()`
|
||||
|
||||
Restores finished transactions. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.
|
||||
|
||||
[The payment queue](https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc) delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.
|
||||
Returns `Boolean`, whether a user can make a payment.
|
||||
|
||||
### `inAppPurchase.getReceiptURL()`
|
||||
|
||||
Returns `String` - the path to the receipt.
|
||||
Returns `String`, the path to the receipt.
|
||||
|
||||
### `inAppPurchase.finishAllTransactions()`
|
||||
|
||||
|
||||
@@ -148,4 +148,4 @@ found in the [`ipc-main-invoke-event`](structures/ipc-main-invoke-event.md)
|
||||
structure docs.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[web-contents-send]: web-contents.md#contentssendchannel-arg1-arg2-
|
||||
[web-contents-send]: web-contents.md#contentssendchannel-args
|
||||
|
||||
@@ -55,23 +55,13 @@ Removes all listeners, or those of the specified `channel`.
|
||||
* `channel` String
|
||||
* `...args` any[]
|
||||
|
||||
Send an asynchronous message to the main process via `channel`, along with
|
||||
arguments. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
|
||||
> special Electron objects is deprecated, and will begin throwing an exception
|
||||
> starting with Electron 9.
|
||||
Send a message to the main process asynchronously via `channel`, you can also
|
||||
send arbitrary arguments. Arguments will be serialized as JSON internally and
|
||||
hence no functions or prototype chain will be included.
|
||||
|
||||
The main process handles it by listening for `channel` with the
|
||||
[`ipcMain`](ipc-main.md) module.
|
||||
|
||||
If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRenderer.postMessage`](#ipcrendererpostmessagechannel-message-transfer).
|
||||
|
||||
If you want to receive a single response from the main process, like the result of a method call, consider using [`ipcRenderer.invoke`](#ipcrendererinvokechannel-args).
|
||||
|
||||
### `ipcRenderer.invoke(channel, ...args)`
|
||||
|
||||
* `channel` String
|
||||
@@ -79,15 +69,9 @@ If you want to receive a single response from the main process, like the result
|
||||
|
||||
Returns `Promise<any>` - Resolves with the response from the main process.
|
||||
|
||||
Send a message to the main process via `channel` and expect a result
|
||||
asynchronously. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
|
||||
> special Electron objects is deprecated, and will begin throwing an exception
|
||||
> starting with Electron 9.
|
||||
Send a message to the main process asynchronously via `channel` and expect an
|
||||
asynchronous result. Arguments will be serialized as JSON internally and
|
||||
hence no functions or prototype chain will be included.
|
||||
|
||||
The main process should listen for `channel` with
|
||||
[`ipcMain.handle()`](ipc-main.md#ipcmainhandlechannel-listener).
|
||||
@@ -106,10 +90,6 @@ ipcMain.handle('some-name', async (event, someArgument) => {
|
||||
})
|
||||
```
|
||||
|
||||
If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRenderer.postMessage`](#ipcrendererpostmessagechannel-message-transfer).
|
||||
|
||||
If you do not need a respons to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
|
||||
|
||||
### `ipcRenderer.sendSync(channel, ...args)`
|
||||
|
||||
* `channel` String
|
||||
@@ -117,52 +97,15 @@ If you do not need a respons to the message, consider using [`ipcRenderer.send`]
|
||||
|
||||
Returns `any` - The value sent back by the [`ipcMain`](ipc-main.md) handler.
|
||||
|
||||
Send a message to the main process via `channel` and expect a result
|
||||
synchronously. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
|
||||
> special Electron objects is deprecated, and will begin throwing an exception
|
||||
> starting with Electron 9.
|
||||
Send a message to the main process synchronously via `channel`, you can also
|
||||
send arbitrary arguments. Arguments will be serialized in JSON internally and
|
||||
hence no functions or prototype chain will be included.
|
||||
|
||||
The main process handles it by listening for `channel` with [`ipcMain`](ipc-main.md) module,
|
||||
and replies by setting `event.returnValue`.
|
||||
|
||||
> :warning: **WARNING**: Sending a synchronous message will block the whole
|
||||
> renderer process until the reply is received, so use this method only as a
|
||||
> last resort. It's much better to use the asynchronous version,
|
||||
> [`invoke()`](ipc-renderer.md#ipcrendererinvokechannel-args).
|
||||
|
||||
### `ipcRenderer.postMessage(channel, message, [transfer])`
|
||||
|
||||
* `channel` String
|
||||
* `message` any
|
||||
* `transfer` MessagePort[] (optional)
|
||||
|
||||
Send a message to the main process, optionally transferring ownership of zero
|
||||
or more [`MessagePort`][] objects.
|
||||
|
||||
The transferred `MessagePort` objects will be available in the main process as
|
||||
[`MessagePortMain`](message-port-main.md) objects by accessing the `ports`
|
||||
property of the emitted event.
|
||||
|
||||
For example:
|
||||
```js
|
||||
// Renderer process
|
||||
const { port1, port2 } = new MessageChannel()
|
||||
ipcRenderer.postMessage('port', { message: 'hello' }, [port1])
|
||||
|
||||
// Main process
|
||||
ipcMain.on('port', (e, msg) => {
|
||||
const [port] = e.ports
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
For more information on using `MessagePort` and `MessageChannel`, see the [MDN
|
||||
documentation](https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel).
|
||||
**Note:** Sending a synchronous message will block the whole renderer process,
|
||||
unless you know what you are doing you should never use it.
|
||||
|
||||
### `ipcRenderer.sendTo(webContentsId, channel, ...args)`
|
||||
|
||||
@@ -186,6 +129,3 @@ The documentation for the `event` object passed to the `callback` can be found
|
||||
in the [`ipc-renderer-event`](structures/ipc-renderer-event.md) structure docs.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||
[`window.postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||
[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
|
||||
|
||||
@@ -12,9 +12,9 @@ See [`Menu`](menu.md) for examples.
|
||||
* `click` Function (optional) - Will be called with
|
||||
`click(menuItem, browserWindow, event)` when the menu item is clicked.
|
||||
* `menuItem` MenuItem
|
||||
* `browserWindow` [BrowserWindow](browser-window.md) | undefined - This will not be defined if no window is open.
|
||||
* `browserWindow` [BrowserWindow](browser-window.md)
|
||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
`click` property will be ignored. See [roles](#roles).
|
||||
* `type` String (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
|
||||
`radio`.
|
||||
@@ -117,7 +117,7 @@ When specifying a `role` on macOS, `label` and `accelerator` are the only
|
||||
options that will affect the menu item. All other options will be ignored.
|
||||
Lowercase `role`, e.g. `toggledevtools`, is still supported.
|
||||
|
||||
**Nota Bene:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on macOS.
|
||||
**Nota Bene:** The `enabled` and `visibility` properties are not available for top-level menu items in the tray on MacOS.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
@@ -130,7 +130,8 @@ dynamically changed.
|
||||
|
||||
#### `menuItem.label`
|
||||
|
||||
A `String` indicating the item's visible label.
|
||||
A `String` indicating the item's visible label, this property can be
|
||||
dynamically changed.
|
||||
|
||||
#### `menuItem.click`
|
||||
|
||||
@@ -151,7 +152,7 @@ A `String` indicating the type of the item. Can be `normal`, `separator`, `subme
|
||||
|
||||
#### `menuItem.role`
|
||||
|
||||
A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
|
||||
A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
|
||||
|
||||
#### `menuItem.accelerator`
|
||||
|
||||
@@ -164,7 +165,7 @@ item's icon, if set.
|
||||
|
||||
#### `menuItem.sublabel`
|
||||
|
||||
A `String` indicating the item's sublabel.
|
||||
A `String` indicating the item's sublabel, this property can be dynamically changed.
|
||||
|
||||
#### `menuItem.toolTip` _macOS_
|
||||
|
||||
@@ -196,9 +197,7 @@ You can add a `click` function for additional behavior.
|
||||
#### `menuItem.registerAccelerator`
|
||||
|
||||
A `Boolean` indicating if the accelerator should be registered with the
|
||||
system or just displayed.
|
||||
|
||||
This property can be dynamically changed.
|
||||
system or just displayed, this property can be dynamically changed.
|
||||
|
||||
#### `menuItem.commandId`
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
# MessageChannelMain
|
||||
|
||||
`MessageChannelMain` is the main-process-side equivalent of the DOM
|
||||
[`MessageChannel`][] object. Its singular function is to create a pair of
|
||||
connected [`MessagePortMain`](message-port-main.md) objects.
|
||||
|
||||
See the [Channel Messaging API][] documentation for more information on using
|
||||
channel messaging.
|
||||
|
||||
## Class: MessageChannelMain
|
||||
|
||||
Example:
|
||||
```js
|
||||
const { port1, port2 } = new MessageChannelMain()
|
||||
w.webContents.postMessage('port', null, [port2])
|
||||
port1.postMessage({ some: 'message' })
|
||||
```
|
||||
|
||||
### Instance Properties
|
||||
|
||||
#### `channel.port1`
|
||||
|
||||
A [`MessagePortMain`](message-port-main.md) property.
|
||||
|
||||
#### `channel.port2`
|
||||
|
||||
A [`MessagePortMain`](message-port-main.md) property.
|
||||
|
||||
[`MessageChannel`]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel
|
||||
[Channel Messaging API]: https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API
|
||||
@@ -1,49 +0,0 @@
|
||||
# MessagePortMain
|
||||
|
||||
`MessagePortMain` is the main-process-side equivalent of the DOM
|
||||
[`MessagePort`][] object. It behaves similarly to the DOM version, with the
|
||||
exception that it uses the Node.js `EventEmitter` event system, instead of the
|
||||
DOM `EventTarget` system. This means you should use `port.on('message', ...)`
|
||||
to listen for events, instead of `port.onmessage = ...` or
|
||||
`port.addEventListener('message', ...)`
|
||||
|
||||
See the [Channel Messaging API][] documentation for more information on using
|
||||
channel messaging.
|
||||
|
||||
`MessagePortMain` is an [EventEmitter][event-emitter].
|
||||
|
||||
## Class: MessagePortMain
|
||||
|
||||
### Instance Methods
|
||||
|
||||
#### `port.postMessage(message, [transfer])`
|
||||
|
||||
* `message` any
|
||||
* `transfer` MessagePortMain[] (optional)
|
||||
|
||||
Sends a message from the port, and optionally, transfers ownership of objects
|
||||
to other browsing contexts.
|
||||
|
||||
#### `port.start()`
|
||||
|
||||
Starts the sending of messages queued on the port. Messages will be queued
|
||||
until this method is called.
|
||||
|
||||
#### `port.close()`
|
||||
|
||||
Disconnects the port, so it is no longer active.
|
||||
|
||||
### Instance Events
|
||||
|
||||
#### Event: 'message'
|
||||
|
||||
Returns:
|
||||
|
||||
* `messageEvent` Object
|
||||
* `data` any
|
||||
* `ports` MessagePortMain[]
|
||||
|
||||
Emitted when a MessagePortMain object receives a message.
|
||||
|
||||
[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
|
||||
[Channel Messaging API]: https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API
|
||||
@@ -1,6 +1,17 @@
|
||||
## Promisification
|
||||
|
||||
The Electron team recently underwent an initiative to convert callback-based APIs to Promise-based ones. See converted functions below:
|
||||
The Electron team is currently undergoing an initiative to convert callback-based functions in Electron to return Promises. During this transition period, both the callback and Promise-based versions of these functions will work correctly, and will both be documented.
|
||||
|
||||
To enable deprecation warnings for these updated functions, use the `process.enablePromiseAPI` runtime flag.
|
||||
|
||||
When a majority of affected functions are migrated, this flag will be enabled by default and all developers will be able to see these deprecation warnings. At that time, the callback-based versions will also be removed from documentation. This document will be continuously updated as more functions are converted.
|
||||
|
||||
### Candidate Functions
|
||||
|
||||
- [app.importCertificate(options, callback)](https://github.com/electron/electron/blob/master/docs/api/app.md#importCertificate)
|
||||
- [contents.print([options], [callback])](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#print)
|
||||
|
||||
### Converted Functions
|
||||
|
||||
- [app.getFileIcon(path[, options], callback)](https://github.com/electron/electron/blob/master/docs/api/app.md#getFileIcon)
|
||||
- [contents.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#capturePage)
|
||||
|
||||
@@ -5,7 +5,14 @@ The Electron team is currently undergoing an initiative to convert separate gett
|
||||
## Candidates
|
||||
|
||||
* `BrowserWindow`
|
||||
* `fullscreen`
|
||||
* `simpleFullscreen`
|
||||
* `alwaysOnTop`
|
||||
* `title`
|
||||
* `documentEdited`
|
||||
* `hasShadow`
|
||||
* `menubarVisible`
|
||||
* `visibleOnAllWorkspaces`
|
||||
* `crashReporter` module
|
||||
* `uploadToServer`
|
||||
* `webFrame` modules
|
||||
@@ -38,3 +45,9 @@ The Electron team is currently undergoing an initiative to convert separate gett
|
||||
* `isMacTemplateImage`
|
||||
* `SystemPreferences` module
|
||||
* `appLevelAppearance`
|
||||
* `webContents` module
|
||||
* `audioMuted`
|
||||
* `frameRate`
|
||||
* `userAgent`
|
||||
* `zoomFactor`
|
||||
* `zoomLevel`
|
||||
|
||||
@@ -14,11 +14,11 @@ image file path as a `String`:
|
||||
const { BrowserWindow, Tray } = require('electron')
|
||||
|
||||
const appIcon = new Tray('/Users/somebody/images/icon.png')
|
||||
const win = new BrowserWindow({ icon: '/Users/somebody/images/window.png' })
|
||||
let win = new BrowserWindow({ icon: '/Users/somebody/images/window.png' })
|
||||
console.log(appIcon, win)
|
||||
```
|
||||
|
||||
Or read the image from the clipboard, which returns a `NativeImage`:
|
||||
Or read the image from the clipboard which returns a `NativeImage`:
|
||||
|
||||
```javascript
|
||||
const { clipboard, Tray } = require('electron')
|
||||
@@ -33,19 +33,19 @@ Currently `PNG` and `JPEG` image formats are supported. `PNG` is recommended
|
||||
because of its support for transparency and lossless compression.
|
||||
|
||||
On Windows, you can also load `ICO` icons from file paths. For best visual
|
||||
quality, it is recommended to include at least the following sizes in the:
|
||||
quality it is recommended to include at least the following sizes in the:
|
||||
|
||||
* Small icon
|
||||
* 16x16 (100% DPI scale)
|
||||
* 20x20 (125% DPI scale)
|
||||
* 24x24 (150% DPI scale)
|
||||
* 32x32 (200% DPI scale)
|
||||
* 16x16 (100% DPI scale)
|
||||
* 20x20 (125% DPI scale)
|
||||
* 24x24 (150% DPI scale)
|
||||
* 32x32 (200% DPI scale)
|
||||
* Large icon
|
||||
* 32x32 (100% DPI scale)
|
||||
* 40x40 (125% DPI scale)
|
||||
* 48x48 (150% DPI scale)
|
||||
* 64x64 (200% DPI scale)
|
||||
* 256x256
|
||||
* 32x32 (100% DPI scale)
|
||||
* 40x40 (125% DPI scale)
|
||||
* 48x48 (150% DPI scale)
|
||||
* 64x64 (200% DPI scale)
|
||||
* 256x256
|
||||
|
||||
Check the *Size requirements* section in [this article][icons].
|
||||
|
||||
@@ -56,7 +56,7 @@ Check the *Size requirements* section in [this article][icons].
|
||||
On platforms that have high-DPI support such as Apple Retina displays, you can
|
||||
append `@2x` after image's base filename to mark it as a high resolution image.
|
||||
|
||||
For example, if `icon.png` is a normal image that has standard resolution, then
|
||||
For example if `icon.png` is a normal image that has standard resolution, then
|
||||
`icon@2x.png` will be treated as a high resolution image that has double DPI
|
||||
density.
|
||||
|
||||
@@ -73,11 +73,11 @@ images/
|
||||
|
||||
```javascript
|
||||
const { Tray } = require('electron')
|
||||
const appIcon = new Tray('/Users/somebody/images/icon.png')
|
||||
let appIcon = new Tray('/Users/somebody/images/icon.png')
|
||||
console.log(appIcon)
|
||||
```
|
||||
|
||||
The following suffixes for DPI are also supported:
|
||||
Following suffixes for DPI are also supported:
|
||||
|
||||
* `@1x`
|
||||
* `@1.25x`
|
||||
@@ -97,7 +97,7 @@ Template images consist of black and an alpha channel.
|
||||
Template images are not intended to be used as standalone images and are usually
|
||||
mixed with other content to create the desired final appearance.
|
||||
|
||||
The most common case is to use template images for a menu bar icon, so it can
|
||||
The most common case is to use template images for a menu bar icon so it can
|
||||
adapt to both light and dark menu bars.
|
||||
|
||||
**Note:** Template image is only supported on macOS.
|
||||
@@ -132,7 +132,7 @@ a valid image.
|
||||
```javascript
|
||||
const nativeImage = require('electron').nativeImage
|
||||
|
||||
const image = nativeImage.createFromPath('/Users/somebody/images/icon.png')
|
||||
let image = nativeImage.createFromPath('/Users/somebody/images/icon.png')
|
||||
console.log(image)
|
||||
```
|
||||
|
||||
@@ -180,8 +180,7 @@ Creates a new `NativeImage` instance from the NSImage that maps to the
|
||||
given image name. See [`System Icons`](https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/)
|
||||
for a list of possible values.
|
||||
|
||||
The `hslShift` is applied to the image with the following rules:
|
||||
|
||||
The `hslShift` is applied to the image with the following rules
|
||||
* `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map
|
||||
to 0 and 360 on the hue color wheel (red).
|
||||
* `hsl_shift[1]` (saturation): A saturation shift for the image, with the
|
||||
@@ -249,9 +248,9 @@ Returns `String` - The data URL of the image.
|
||||
|
||||
Returns `Buffer` - A [Buffer][buffer] that contains the image's raw bitmap pixel data.
|
||||
|
||||
The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does not
|
||||
The difference between `getBitmap()` and `toBitmap()` is, `getBitmap()` does not
|
||||
copy the bitmap data, so you have to use the returned Buffer immediately in
|
||||
current event loop tick; otherwise the data might be changed or destroyed.
|
||||
current event loop tick, otherwise the data might be changed or destroyed.
|
||||
|
||||
#### `image.getNativeHandle()` _macOS_
|
||||
|
||||
@@ -276,10 +275,14 @@ Returns [`Size`](structures/size.md)
|
||||
|
||||
Marks the image as a template image.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `image.isTemplateImage()`
|
||||
|
||||
Returns `Boolean` - Whether the image is a template image.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `image.crop(rect)`
|
||||
|
||||
* `rect` [Rectangle](structures/rectangle.md) - The area of the image to crop.
|
||||
@@ -292,7 +295,7 @@ Returns `NativeImage` - The cropped image.
|
||||
* `width` Integer (optional) - Defaults to the image's width.
|
||||
* `height` Integer (optional) - Defaults to the image's height.
|
||||
* `quality` String (optional) - The desired quality of the resize image.
|
||||
Possible values are `good`, `better`, or `best`. The default is `best`.
|
||||
Possible values are `good`, `better` or `best`. The default is `best`.
|
||||
These values express a desired quality/speed tradeoff. They are translated
|
||||
into an algorithm-specific method that depends on the capabilities
|
||||
(CPU, GPU) of the underlying platform. It is possible for all three methods
|
||||
|
||||
@@ -27,7 +27,7 @@ should use `themeSource` below.
|
||||
|
||||
### `nativeTheme.themeSource`
|
||||
|
||||
A `String` property that can be `system`, `light` or `dark`. It is used to override and supersede
|
||||
A `String` property that can be `system`, `light` or `dark`. It is used to override and supercede
|
||||
the value that Chromium has chosen to use internally.
|
||||
|
||||
Setting this property to `system` will remove the override and
|
||||
|
||||
@@ -7,7 +7,7 @@ Process: [Main](../glossary.md#main-process)
|
||||
```javascript
|
||||
const { netLog } = require('electron')
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
app.on('ready', async () => {
|
||||
await netLog.startLogging('/path/to/net-log')
|
||||
// After some network events
|
||||
const path = await netLog.stopLogging()
|
||||
@@ -15,7 +15,7 @@ app.whenReady().then(async () => {
|
||||
})
|
||||
```
|
||||
|
||||
See [`--log-net-log`](command-line-switches.md#--log-net-logpath) to log network events throughout the app's lifecycle.
|
||||
See [`--log-net-log`](chrome-command-line-switches.md#--log-net-logpath) to log network events throughout the app's lifecycle.
|
||||
|
||||
**Note:** All methods unless specified can only be used after the `ready` event
|
||||
of the `app` module gets emitted.
|
||||
|
||||
@@ -28,7 +28,7 @@ Example usage:
|
||||
|
||||
```javascript
|
||||
const { app } = require('electron')
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
const { net } = require('electron')
|
||||
const request = net.request('https://github.com')
|
||||
request.on('response', (response) => {
|
||||
|
||||
@@ -35,10 +35,8 @@ Returns `Boolean` - Whether or not desktop notifications are supported on the cu
|
||||
* `silent` Boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.
|
||||
* `icon` (String | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
|
||||
* `hasReply` Boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
|
||||
* `timeoutType` String (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
|
||||
* `replyPlaceholder` String (optional) _macOS_ - The placeholder to write in the inline reply input field.
|
||||
* `sound` String (optional) _macOS_ - The name of the sound file to play when the notification is shown.
|
||||
* `urgency` String (optional) _Linux_ - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
|
||||
* `actions` [NotificationAction[]](structures/notification-action.md) (optional) _macOS_ - Actions to add to the notification. Please read the available actions and limitations in the `NotificationAction` documentation.
|
||||
* `closeButtonText` String (optional) _macOS_ - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.
|
||||
|
||||
@@ -146,18 +144,6 @@ A `Boolean` property representing whether the notification is silent.
|
||||
|
||||
A `Boolean` property representing whether the notification has a reply action.
|
||||
|
||||
#### `notification.urgency` _Linux_
|
||||
|
||||
A `String` property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.
|
||||
|
||||
Default is 'low' - see [NotifyUrgency](https://developer.gnome.org/notification-spec/#urgency-levels) for more information.
|
||||
|
||||
#### `notification.timeoutType` _Linux_ _Windows_
|
||||
|
||||
A `String` property representing the type of timeout duration for the notification. Can be 'default' or 'never'.
|
||||
|
||||
If `timeoutType` is set to 'never', the notification never expires. It stays open until closed by the calling API or the user.
|
||||
|
||||
#### `notification.actions`
|
||||
|
||||
A [`NotificationAction[]`](structures/notification-action.md) property representing the actions of the notification.
|
||||
|
||||
@@ -13,7 +13,7 @@ For example:
|
||||
```javascript
|
||||
const { app, powerMonitor } = require('electron')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
powerMonitor.on('suspend', () => {
|
||||
console.log('The system is going to sleep')
|
||||
})
|
||||
@@ -24,19 +24,19 @@ app.whenReady().then(() => {
|
||||
|
||||
The `powerMonitor` module emits the following events:
|
||||
|
||||
### Event: 'suspend' _macOS_ _Windows_
|
||||
### Event: 'suspend'
|
||||
|
||||
Emitted when the system is suspending.
|
||||
|
||||
### Event: 'resume' _macOS_ _Windows_
|
||||
### Event: 'resume'
|
||||
|
||||
Emitted when system is resuming.
|
||||
|
||||
### Event: 'on-ac' _macOS_ _Windows_
|
||||
### Event: 'on-ac' _Windows_
|
||||
|
||||
Emitted when the system changes to AC power.
|
||||
|
||||
### Event: 'on-battery' _macOS_ _Windows_
|
||||
### Event: 'on-battery' _Windows_
|
||||
|
||||
Emitted when system changes to battery power.
|
||||
|
||||
|
||||
@@ -82,6 +82,12 @@ A `Boolean` that controls whether or not deprecation warnings are printed to `st
|
||||
Setting this to `true` will silence deprecation warnings. This property is used
|
||||
instead of the `--no-deprecation` command line flag.
|
||||
|
||||
### `process.enablePromiseAPIs`
|
||||
|
||||
A `Boolean` that controls whether or not deprecation warnings are printed to `stderr` when
|
||||
formerly callback-based APIs converted to Promises are invoked using callbacks. Setting this to `true`
|
||||
will enable deprecation warnings.
|
||||
|
||||
### `process.resourcesPath` _Readonly_
|
||||
|
||||
A `String` representing the path to the resources directory.
|
||||
|
||||
@@ -20,7 +20,7 @@ An example of implementing a protocol that has the same effect as the
|
||||
const { app, protocol } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
protocol.registerFileProtocol('atom', (request, callback) => {
|
||||
const url = request.url.substr(7)
|
||||
callback({ path: path.normalize(`${__dirname}/${url}`) })
|
||||
@@ -47,7 +47,7 @@ to register it to that session explicitly.
|
||||
const { session, app, protocol } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
const partition = 'persist:example'
|
||||
const ses = session.fromPartition(partition)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ An example of implementing a protocol that has the same effect as the
|
||||
const { app, protocol } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
protocol.registerFileProtocol('atom', (request, callback) => {
|
||||
const url = request.url.substr(7)
|
||||
callback({ path: path.normalize(`${__dirname}/${url}`) })
|
||||
@@ -34,7 +34,7 @@ To have your custom protocol work in combination with a custom session, you need
|
||||
const { session, app, protocol } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
const partition = 'persist:example'
|
||||
const ses = session.fromPartition(partition)
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ project/
|
||||
```js
|
||||
// main process: main/index.js
|
||||
const { app } = require('electron')
|
||||
app.whenReady().then(() => { /* ... */ })
|
||||
app.on('ready', () => { /* ... */ })
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
@@ -39,7 +39,7 @@ To create a sandboxed window, pass `sandbox: true` to `webPreferences`:
|
||||
|
||||
```js
|
||||
let win
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow({
|
||||
webPreferences: {
|
||||
sandbox: true
|
||||
@@ -51,7 +51,7 @@ app.whenReady().then(() => {
|
||||
|
||||
In the above code the [`BrowserWindow`](browser-window.md) that was created has Node.js disabled and can communicate
|
||||
only via IPC. The use of this option stops Electron from creating a Node.js runtime in the renderer. Also,
|
||||
within this new window `window.open` follows the native behavior (by default Electron creates a [`BrowserWindow`](browser-window.md)
|
||||
within this new window `window.open` follows the native behaviour (by default Electron creates a [`BrowserWindow`](browser-window.md)
|
||||
and returns a proxy to this via `window.open`).
|
||||
|
||||
[`app.enableSandbox`](app.md#appenablesandbox-experimental) can be used to force `sandbox: true` for all `BrowserWindow` instances.
|
||||
@@ -59,7 +59,7 @@ and returns a proxy to this via `window.open`).
|
||||
```js
|
||||
let win
|
||||
app.enableSandbox()
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
// no need to pass `sandbox: true` since `app.enableSandbox()` was called.
|
||||
win = new BrowserWindow()
|
||||
win.loadURL('http://google.com')
|
||||
@@ -73,7 +73,7 @@ Here's an example:
|
||||
|
||||
```js
|
||||
let win
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow({
|
||||
webPreferences: {
|
||||
sandbox: true,
|
||||
|
||||
@@ -18,7 +18,7 @@ An example of creating a window that fills the whole screen:
|
||||
const { app, BrowserWindow, screen } = require('electron')
|
||||
|
||||
let win
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
const { width, height } = screen.getPrimaryDisplay().workAreaSize
|
||||
win = new BrowserWindow({ width, height })
|
||||
win.loadURL('https://github.com')
|
||||
@@ -32,7 +32,7 @@ const { app, BrowserWindow, screen } = require('electron')
|
||||
|
||||
let win
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
let displays = screen.getAllDisplays()
|
||||
let externalDisplay = displays.find((display) => {
|
||||
return display.bounds.x !== 0 || display.bounds.y !== 0
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
## Class: ServiceWorkers
|
||||
|
||||
> Query and receive events from a sessions active service workers.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
Instances of the `ServiceWorkers` class are accessed by using `serviceWorkers` property of
|
||||
a `Session`.
|
||||
|
||||
For example:
|
||||
|
||||
```javascript
|
||||
const { session } = require('electron')
|
||||
|
||||
// Get all service workers.
|
||||
console.log(session.defaultSession.serviceWorkers.getAllRunning())
|
||||
|
||||
// Handle logs and get service worker info
|
||||
session.defaultSession.serviceWorkers.on('console-message', (event, messageDetails) => {
|
||||
console.log(
|
||||
'Got service worker message',
|
||||
messageDetails,
|
||||
'from',
|
||||
session.defaultSession.serviceWorkers.getFromVersionID(messageDetails.versionId)
|
||||
)
|
||||
})
|
||||
```
|
||||
|
||||
### Instance Events
|
||||
|
||||
The following events are available on instances of `ServiceWorkers`:
|
||||
|
||||
#### Event: 'console-message'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `messageDetails` Object - Information about the console message
|
||||
* `message` String - The actual console message
|
||||
* `versionId` Number - The version ID of the service worker that sent the log message
|
||||
* `source` String - The type of source for this message. Can be `javascript`, `xml`, `network`, `console-api`, `storage`, `app-cache`, `rendering`, `security`, `deprecation`, `worker`, `violation`, `intervention`, `recommendation` or `other`.
|
||||
* `level` Number - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
|
||||
* `sourceUrl` String - The URL the message came from
|
||||
* `lineNumber` Number - The line number of the source that triggered this console message
|
||||
|
||||
Emitted when a service worker logs something to the console.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The following methods are available on instances of `ServiceWorkers`:
|
||||
|
||||
#### `serviceWorkers.getAllRunning()`
|
||||
|
||||
Returns `Record<Number, ServiceWorkerInfo>` - A [ServiceWorkerInfo](structures/service-worker-info.md) object where the keys are the service worker version ID and the values are the information about that service worker.
|
||||
|
||||
#### `serviceWorkers.getFromVersionID(versionId)`
|
||||
|
||||
* `versionId` Number
|
||||
|
||||
Returns [`ServiceWorkerInfo`](structures/service-worker-info.md) - Information about this service worker
|
||||
|
||||
If the service worker does not exist or is not running this method will throw an exception.
|
||||
@@ -91,7 +91,7 @@ session.defaultSession.on('will-download', (event, item, webContents) => {
|
||||
})
|
||||
```
|
||||
|
||||
#### Event: 'preconnect'
|
||||
#### Event: 'preconnect' _Experimental_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -105,45 +105,6 @@ Returns:
|
||||
Emitted when a render process requests preconnection to a URL, generally due to
|
||||
a [resource hint](https://w3c.github.io/resource-hints/).
|
||||
|
||||
#### Event: 'spellcheck-dictionary-initialized'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `languageCode` String - The language code of the dictionary file
|
||||
|
||||
Emitted when a hunspell dictionary file has been successfully initialized. This
|
||||
occurs after the file has been downloaded.
|
||||
|
||||
#### Event: 'spellcheck-dictionary-download-begin'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `languageCode` String - The language code of the dictionary file
|
||||
|
||||
Emitted when a hunspell dictionary file starts downloading
|
||||
|
||||
#### Event: 'spellcheck-dictionary-download-success'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `languageCode` String - The language code of the dictionary file
|
||||
|
||||
Emitted when a hunspell dictionary file has been successfully downloaded
|
||||
|
||||
#### Event: 'spellcheck-dictionary-download-failure'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `languageCode` String - The language code of the dictionary file
|
||||
|
||||
Emitted when a hunspell dictionary file download fails. For details
|
||||
on the failure you should collect a netlog and inspect the download
|
||||
request.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The following methods are available on instances of `Session`:
|
||||
@@ -165,10 +126,9 @@ Clears the session’s HTTP cache.
|
||||
`scheme://host:port`.
|
||||
* `storages` String[] (optional) - The types of storages to clear, can contain:
|
||||
`appcache`, `cookies`, `filesystem`, `indexdb`, `localstorage`,
|
||||
`shadercache`, `websql`, `serviceworkers`, `cachestorage`. If not
|
||||
specified, clear all storage types.
|
||||
`shadercache`, `websql`, `serviceworkers`, `cachestorage`.
|
||||
* `quotas` String[] (optional) - The types of quotas to clear, can contain:
|
||||
`temporary`, `persistent`, `syncable`. If not specified, clear all quotas.
|
||||
`temporary`, `persistent`, `syncable`.
|
||||
|
||||
Returns `Promise<void>` - resolves when the storage data has been cleared.
|
||||
|
||||
@@ -179,9 +139,9 @@ Writes any unwritten DOMStorage data to disk.
|
||||
#### `ses.setProxy(config)`
|
||||
|
||||
* `config` Object
|
||||
* `pacScript` String (optional) - The URL associated with the PAC file.
|
||||
* `proxyRules` String (optional) - Rules indicating which proxies to use.
|
||||
* `proxyBypassRules` String (optional) - Rules indicating which URLs should
|
||||
* `pacScript` String - The URL associated with the PAC file.
|
||||
* `proxyRules` String - Rules indicating which proxies to use.
|
||||
* `proxyBypassRules` String - Rules indicating which URLs should
|
||||
bypass the proxy settings.
|
||||
|
||||
Returns `Promise<void>` - Resolves when the proxy setting process is complete.
|
||||
@@ -292,7 +252,7 @@ window.webContents.session.enableNetworkEmulation({
|
||||
window.webContents.session.enableNetworkEmulation({ offline: true })
|
||||
```
|
||||
|
||||
#### `ses.preconnect(options)`
|
||||
#### `ses.preconnect(options)` _Experimental_
|
||||
|
||||
* `options` Object
|
||||
* `url` String - URL for preconnect. Only the origin is relevant for opening the socket.
|
||||
@@ -307,11 +267,10 @@ the original network configuration.
|
||||
|
||||
#### `ses.setCertificateVerifyProc(proc)`
|
||||
|
||||
* `proc` Function | null
|
||||
* `proc` Function
|
||||
* `request` Object
|
||||
* `hostname` String
|
||||
* `certificate` [Certificate](structures/certificate.md)
|
||||
* `validatedCertificate` [Certificate](structures/certificate.md)
|
||||
* `verificationResult` String - Verification result from chromium.
|
||||
* `errorCode` Integer - Error code.
|
||||
* `callback` Function
|
||||
@@ -449,17 +408,6 @@ Returns `String` - The user agent for this session.
|
||||
|
||||
Returns `Promise<Buffer>` - resolves with blob data.
|
||||
|
||||
#### `ses.downloadURL(url)`
|
||||
|
||||
* `url` String
|
||||
|
||||
Initiates a download of the resource at `url`.
|
||||
The API will generate a [DownloadItem](download-item.md) that can be accessed
|
||||
with the [will-download](#event-will-download) event.
|
||||
|
||||
**Note:** This does not perform any security checks that relate to a page's origin,
|
||||
unlike [`webContents.downloadURL`](web-contents.md#contentsdownloadurlurl).
|
||||
|
||||
#### `ses.createInterruptedDownload(options)`
|
||||
|
||||
* `options` Object
|
||||
@@ -468,8 +416,8 @@ unlike [`webContents.downloadURL`](web-contents.md#contentsdownloadurlurl).
|
||||
* `mimeType` String (optional)
|
||||
* `offset` Integer - Start range for the download.
|
||||
* `length` Integer - Total length of the download.
|
||||
* `lastModified` String (optional) - Last-Modified header value.
|
||||
* `eTag` String (optional) - ETag header value.
|
||||
* `lastModified` String - Last-Modified header value.
|
||||
* `eTag` String - ETag header value.
|
||||
* `startTime` Double (optional) - Time when download was started in
|
||||
number of seconds since UNIX epoch.
|
||||
|
||||
@@ -497,139 +445,14 @@ this session just before normal `preload` scripts run.
|
||||
Returns `String[]` an array of paths to preload scripts that have been
|
||||
registered.
|
||||
|
||||
#### `ses.setSpellCheckerLanguages(languages)`
|
||||
|
||||
* `languages` String[] - An array of language codes to enable the spellchecker for.
|
||||
|
||||
The built in spellchecker does not automatically detect what language a user is typing in. In order for the
|
||||
spell checker to correctly check their words you must call this API with an array of language codes. You can
|
||||
get the list of supported language codes with the `ses.availableSpellCheckerLanguages` property.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and will detect your language automatically. This API is a no-op on macOS.
|
||||
|
||||
#### `ses.getSpellCheckerLanguages()`
|
||||
|
||||
Returns `String[]` - An array of language codes the spellchecker is enabled for. If this list is empty the spellchecker
|
||||
will fallback to using `en-US`. By default on launch if this setting is an empty list Electron will try to populate this
|
||||
setting with the current OS locale. This setting is persisted across restarts.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and has it's own list of languages. This API is a no-op on macOS.
|
||||
|
||||
#### `ses.setSpellCheckerDictionaryDownloadURL(url)`
|
||||
|
||||
* `url` String - A base URL for Electron to download hunspell dictionaries from.
|
||||
|
||||
By default Electron will download hunspell dictionaries from the Chromium CDN. If you want to override this
|
||||
behavior you can use this API to point the dictionary downloader at your own hosted version of the hunspell
|
||||
dictionaries. We publish a `hunspell_dictionaries.zip` file with each release which contains the files you need
|
||||
to host here, the file server must be **case insensitive** you must upload each file twice, once with the case it
|
||||
has in the ZIP file and once with the filename as all lower case.
|
||||
|
||||
If the files present in `hunspell_dictionaries.zip` are available at `https://example.com/dictionaries/language-code.bdic`
|
||||
then you should call this api with `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`. Please
|
||||
note the trailing slash. The URL to the dictionaries is formed as `${url}${filename}`.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and therefore we do not download any dictionary files. This API is a no-op on macOS.
|
||||
|
||||
#### `ses.listWordsInSpellCheckerDictionary()`
|
||||
|
||||
Returns `Promise<String[]>` - An array of all words in app's custom dictionary.
|
||||
Resolves when the full dictionary is loaded from disk.
|
||||
|
||||
#### `ses.addWordToSpellCheckerDictionary(word)`
|
||||
|
||||
* `word` String - The word you want to add to the dictionary
|
||||
|
||||
Returns `Boolean` - Whether the word was successfully written to the custom dictionary. This API
|
||||
will not work on non-persistent (in-memory) sessions.
|
||||
|
||||
**Note:** On macOS and Windows 10 this word will be written to the OS custom dictionary as well
|
||||
|
||||
#### `ses.removeWordFromSpellCheckerDictionary(word)`
|
||||
|
||||
* `word` String - The word you want to remove from the dictionary
|
||||
|
||||
Returns `Boolean` - Whether the word was successfully removed from the custom dictionary. This API
|
||||
will not work on non-persistent (in-memory) sessions.
|
||||
|
||||
**Note:** On macOS and Windows 10 this word will be removed from the OS custom dictionary as well
|
||||
|
||||
#### `ses.loadExtension(path)`
|
||||
|
||||
* `path` String - Path to a directory containing an unpacked Chrome extension
|
||||
|
||||
Returns `Promise<Extension>` - resolves when the extension is loaded.
|
||||
|
||||
This method will raise an exception if the extension could not be loaded. If
|
||||
there are warnings when installing the extension (e.g. if the extension
|
||||
requests an API that Electron does not support) then they will be logged to the
|
||||
console.
|
||||
|
||||
Note that Electron does not support the full range of Chrome extensions APIs.
|
||||
|
||||
Note that in previous versions of Electron, extensions that were loaded would
|
||||
be remembered for future runs of the application. This is no longer the case:
|
||||
`loadExtension` must be called on every boot of your app if you want the
|
||||
extension to be loaded.
|
||||
|
||||
```js
|
||||
const { app, session } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.on('ready', async () => {
|
||||
await session.defaultSession.loadExtension(path.join(__dirname, 'react-devtools'))
|
||||
// Note that in order to use the React DevTools extension, you'll need to
|
||||
// download and unzip a copy of the extension.
|
||||
})
|
||||
```
|
||||
|
||||
This API does not support loading packed (.crx) extensions.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `ses.removeExtension(extensionId)`
|
||||
|
||||
* `extensionId` String - ID of extension to remove
|
||||
|
||||
Unloads an extension.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `ses.getExtension(extensionId)`
|
||||
|
||||
* `extensionId` String - ID of extension to query
|
||||
|
||||
Returns `Extension` | `null` - The loaded extension with the given ID.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
#### `ses.getAllExtensions()`
|
||||
|
||||
Returns `Extension[]` - A list of all loaded extensions.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
is emitted.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
The following properties are available on instances of `Session`:
|
||||
|
||||
#### `ses.availableSpellCheckerLanguages` _Readonly_
|
||||
|
||||
A `String[]` array which consists of all the known available spell checker languages. Providing a language
|
||||
code to the `setSpellCheckerLanaguages` API that isn't in this array will result in an error.
|
||||
|
||||
#### `ses.cookies` _Readonly_
|
||||
|
||||
A [`Cookies`](cookies.md) object for this session.
|
||||
|
||||
#### `ses.serviceWorkers` _Readonly_
|
||||
|
||||
A [`ServiceWorkers`](service-workers.md) object for this session.
|
||||
|
||||
#### `ses.webRequest` _Readonly_
|
||||
|
||||
A [`WebRequest`](web-request.md) object for this session.
|
||||
@@ -642,12 +465,12 @@ A [`Protocol`](protocol.md) object for this session.
|
||||
const { app, session } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', function () {
|
||||
const protocol = session.fromPartition('some-partition').protocol
|
||||
protocol.registerFileProtocol('atom', (request, callback) => {
|
||||
let url = request.url.substr(7)
|
||||
protocol.registerFileProtocol('atom', function (request, callback) {
|
||||
var url = request.url.substr(7)
|
||||
callback({ path: path.normalize(`${__dirname}/${url}`) })
|
||||
}, (error) => {
|
||||
}, function (error) {
|
||||
if (error) console.error('Failed to register protocol')
|
||||
})
|
||||
})
|
||||
@@ -660,7 +483,7 @@ A [`NetLog`](net-log.md) object for this session.
|
||||
```javascript
|
||||
const { app, session } = require('electron')
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
app.on('ready', async function () {
|
||||
const netLog = session.fromPartition('some-partition').netLog
|
||||
netLog.startLogging('/path/to/net-log')
|
||||
// After some network events
|
||||
|
||||
@@ -24,11 +24,11 @@ The `shell` module has the following methods:
|
||||
|
||||
Show the given file in a file manager. If possible, select the file.
|
||||
|
||||
### `shell.openPath(path)`
|
||||
### `shell.openItem(fullPath)`
|
||||
|
||||
* `path` String
|
||||
* `fullPath` String
|
||||
|
||||
Returns `Promise<String>` - Resolves with an string containing the error message corresponding to the failure if a failure occurred, otherwise "".
|
||||
Returns `Boolean` - Whether the item was successfully opened.
|
||||
|
||||
Open the given file in the desktop's default manner.
|
||||
|
||||
@@ -43,12 +43,11 @@ Returns `Promise<void>`
|
||||
|
||||
Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent).
|
||||
|
||||
### `shell.moveItemToTrash(fullPath[, deleteOnFail])`
|
||||
### `shell.moveItemToTrash(fullPath)`
|
||||
|
||||
* `fullPath` String
|
||||
* `deleteOnFail` Boolean (optional) - Whether or not to unilaterally remove the item if the Trash is disabled or unsupported on the volume. _macOS_
|
||||
|
||||
Returns `Boolean` - Whether the item was successfully moved to the trash or otherwise deleted.
|
||||
Returns `Boolean` - Whether the item was successfully moved to the trash.
|
||||
|
||||
Move the given file to trash and returns a boolean status for the operation.
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# Extension Object
|
||||
|
||||
* `id` String
|
||||
* `manifest` any - Copy of the [extension's manifest data](https://developer.chrome.com/extensions/manifest).
|
||||
* `name` String
|
||||
* `path` String - The extension's file path.
|
||||
* `version` String
|
||||
* `url` String - The extension's `chrome-extension://` URL.
|
||||
@@ -1,6 +1,6 @@
|
||||
# InputEvent Object
|
||||
|
||||
* `modifiers` String[] (optional) - An array of modifiers of the event, can
|
||||
be `shift`, `control`, `ctrl`, `alt`, `meta`, `command`, `cmd`, `isKeypad`,
|
||||
`isAutoRepeat`, `leftButtonDown`, `middleButtonDown`, `rightButtonDown`,
|
||||
`capsLock`, `numLock`, `left`, `right`.
|
||||
* `modifiers` String[] - An array of modifiers of the event, can
|
||||
be `shift`, `control`, `alt`, `meta`, `isKeypad`, `isAutoRepeat`,
|
||||
`leftButtonDown`, `middleButtonDown`, `rightButtonDown`, `capsLock`,
|
||||
`numLock`, `left`, `right`.
|
||||
|
||||
@@ -3,7 +3,5 @@
|
||||
* `frameId` Integer - The ID of the renderer frame that sent this message
|
||||
* `returnValue` any - Set this to the value to be returned in a synchronous message
|
||||
* `sender` WebContents - Returns the `webContents` that sent the message
|
||||
* `ports` MessagePortMain[] - A list of MessagePorts that were transferred with this message
|
||||
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
|
||||
* `channel` String
|
||||
* `...args` any[]
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
|
||||
* `sender` IpcRenderer - The `IpcRenderer` instance that emitted the event originally
|
||||
* `senderId` Integer - The `webContents.id` that sent the message, you can call `event.sender.sendTo(event.senderId, ...)` to reply to the message, see [ipcRenderer.sendTo][ipc-renderer-sendto] for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set `event.senderId` to `0`.
|
||||
* `ports` MessagePort[] - A list of MessagePorts that were transferred with this message
|
||||
|
||||
[ipc-renderer-sendto]: #ipcrenderersendtowindowid-channel--arg1-arg2-
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
# PrinterInfo Object
|
||||
|
||||
* `name` String - the name of the printer as understood by the OS.
|
||||
* `displayName` String - the name of the printer as shown in Print Preview.
|
||||
* `description` String - a longer description of the printer's type.
|
||||
* `status` Number - the current status of the printer.
|
||||
* `isDefault` Boolean - whether or not a given printer is set as the default printer on the OS.
|
||||
* `options` Object - an object containing a variable number of platform-specific printer information.
|
||||
|
||||
The number represented by `status` means different things on different platforms: on Windows it's potential values can be found [here](https://docs.microsoft.com/en-us/windows/win32/printdocs/printer-info-2), and on Linux and macOS they can be found [here](https://www.cups.org/doc/cupspm.html).
|
||||
* `name` String
|
||||
* `description` String
|
||||
* `status` Number
|
||||
* `isDefault` Boolean
|
||||
|
||||
## Example
|
||||
|
||||
@@ -16,14 +12,13 @@ may be different on each platform.
|
||||
|
||||
```javascript
|
||||
{
|
||||
name: 'Austin_4th_Floor_Printer___C02XK13BJHD4',
|
||||
displayName: 'Austin 4th Floor Printer @ C02XK13BJHD4',
|
||||
description: 'TOSHIBA ColorMFP',
|
||||
name: 'Zebra_LP2844',
|
||||
description: 'Zebra LP2844',
|
||||
status: 3,
|
||||
isDefault: false,
|
||||
options: {
|
||||
copies: '1',
|
||||
'device-uri': 'dnssd://Austin%204th%20Floor%20Printer%20%40%20C02XK13BJHD4._ipps._tcp.local./?uuid=71687f1e-1147-3274-6674-22de61b110bd',
|
||||
'device-uri': 'usb://Zebra/LP2844?location=14200000',
|
||||
finishings: '3',
|
||||
'job-cancel-after': '10800',
|
||||
'job-hold-until': 'no-hold',
|
||||
@@ -31,19 +26,18 @@ may be different on each platform.
|
||||
'job-sheets': 'none,none',
|
||||
'marker-change-time': '0',
|
||||
'number-up': '1',
|
||||
'printer-commands': 'ReportLevels,PrintSelfTestPage,com.toshiba.ColourProfiles.update,com.toshiba.EFiling.update,com.toshiba.EFiling.checkPassword',
|
||||
'printer-info': 'Austin 4th Floor Printer @ C02XK13BJHD4',
|
||||
'printer-commands': 'none',
|
||||
'printer-info': 'Zebra LP2844',
|
||||
'printer-is-accepting-jobs': 'true',
|
||||
'printer-is-shared': 'false',
|
||||
'printer-is-temporary': 'false',
|
||||
'printer-is-shared': 'true',
|
||||
'printer-location': '',
|
||||
'printer-make-and-model': 'TOSHIBA ColorMFP',
|
||||
'printer-make-and-model': 'Zebra EPL2 Label Printer',
|
||||
'printer-state': '3',
|
||||
'printer-state-change-time': '1573472937',
|
||||
'printer-state-reasons': 'offline-report,com.toshiba.snmp.failed',
|
||||
'printer-type': '10531038',
|
||||
'printer-uri-supported': 'ipp://localhost/printers/Austin_4th_Floor_Printer___C02XK13BJHD4',
|
||||
system_driverinfo: 'T'
|
||||
'printer-state-change-time': '1484872644',
|
||||
'printer-state-reasons': 'offline-report',
|
||||
'printer-type': '36932',
|
||||
'printer-uri-supported': 'ipp://localhost/printers/Zebra_LP2844',
|
||||
system_driverinfo: 'Z'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -7,5 +7,4 @@
|
||||
* `contentLengths` Number[] - The total size of the content, in bytes.
|
||||
* `price` Number - The cost of the product in the local currency.
|
||||
* `formattedPrice` String - The locale formatted price of the product.
|
||||
* `currencyCode` String - 3 character code presenting a product's currency based on the ISO 4217 standard.
|
||||
* `isDownloadable` Boolean - A Boolean value that indicates whether the App Store has downloadable content for this product. `true` if at least one file has been associated with the product.
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# ServiceWorkerInfo Object
|
||||
|
||||
* `scriptUrl` String - The full URL to the script that this service worker runs
|
||||
* `scope` String - The base URL that this service worker is active for.
|
||||
* `renderProcessId` Number - The virtual ID of the process that this service worker is running in. This is not an OS level PID. This aligns with the ID set used for `webContents.getProcessId()`.
|
||||
@@ -1,4 +0,0 @@
|
||||
# SharedWorkerInfo Object
|
||||
|
||||
* `id` String - The unique id of the shared worker.
|
||||
* `url` String - The url of the shared worker.
|
||||
@@ -22,7 +22,7 @@ The main process script is like a normal Node.js script:
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
let win = null
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.loadURL('https://github.com')
|
||||
})
|
||||
@@ -56,7 +56,7 @@ const { app, BrowserWindow } = require('electron')
|
||||
|
||||
let win
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow()
|
||||
win.loadURL('https://github.com')
|
||||
})
|
||||
@@ -71,7 +71,7 @@ const { app, BrowserWindow } = electron
|
||||
|
||||
let win
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow()
|
||||
win.loadURL('https://github.com')
|
||||
})
|
||||
@@ -85,7 +85,7 @@ const app = electron.app
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
let win
|
||||
|
||||
app.whenReady().then(() => {
|
||||
app.on('ready', () => {
|
||||
win = new BrowserWindow()
|
||||
win.loadURL('https://github.com')
|
||||
})
|
||||
|
||||
@@ -291,7 +291,7 @@ This API is only available on macOS 10.14 Mojave or newer.
|
||||
* `window-frame` - Window frame.
|
||||
* `window-text` - Text in windows.
|
||||
* On **macOS**
|
||||
* `alternate-selected-control-text` - The text on a selected surface in a list or table. _deprecated_
|
||||
* `alternate-selected-control-text` - The text on a selected surface in a list or table.
|
||||
* `control-background` - The background of a large interface element, such as a browser or table.
|
||||
* `control` - The surface of a control.
|
||||
* `control-text` -The text of a control that isn’t disabled.
|
||||
@@ -310,7 +310,7 @@ This API is only available on macOS 10.14 Mojave or newer.
|
||||
* `selected-content-background` - The background for selected content in a key window or view.
|
||||
* `selected-control` - The surface of a selected control.
|
||||
* `selected-control-text` - The text of a selected control.
|
||||
* `selected-menu-item-text` - The text of a selected menu.
|
||||
* `selected-menu-item` - The text of a selected menu.
|
||||
* `selected-text-background` - The background of selected text.
|
||||
* `selected-text` - Selected text.
|
||||
* `separator` - A separator between different sections of content.
|
||||
@@ -326,9 +326,7 @@ This API is only available on macOS 10.14 Mojave or newer.
|
||||
* `window-frame-text` - The text in the window's titlebar area.
|
||||
|
||||
Returns `String` - The system color setting in RGB hexadecimal form (`#ABCDEF`).
|
||||
See the [Windows docs][windows-colors] and the [macOS docs][macos-colors] for more details.
|
||||
|
||||
The following colors are only available on macOS 10.14: `find-highlight`, `selected-content-background`, `separator`, `unemphasized-selected-content-background`, `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
|
||||
See the [Windows docs][windows-colors] and the [MacOS docs][macos-colors] for more details.
|
||||
|
||||
[windows-colors]:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx
|
||||
[macos-colors]:https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors
|
||||
@@ -360,7 +358,7 @@ Returns `Boolean` - `true` if an inverted color scheme (a high contrast color sc
|
||||
|
||||
Returns `Boolean` - `true` if a high contrast theme is active, `false` otherwise.
|
||||
|
||||
**Deprecated:** Should use the new [`nativeTheme.shouldUseHighContrastColors`](native-theme.md#nativethemeshouldusehighcontrastcolors-macos-windows-readonly) API.
|
||||
**Depreacted:** Should use the new [`nativeTheme.shouldUseHighContrastColors`](native-theme.md#nativethemeshouldusehighcontrastcolors-macos-windows-readonly) API.
|
||||
|
||||
### `systemPreferences.getEffectiveAppearance()` _macOS_
|
||||
|
||||
@@ -369,6 +367,16 @@ Returns `String` - Can be `dark`, `light` or `unknown`.
|
||||
Gets the macOS appearance setting that is currently applied to your application,
|
||||
maps to [NSApplication.effectiveAppearance](https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc)
|
||||
|
||||
Please note that until Electron is built targeting the 10.14 SDK, your application's
|
||||
`effectiveAppearance` will default to 'light' and won't inherit the OS preference. In
|
||||
the interim in order for your application to inherit the OS preference you must set the
|
||||
`NSRequiresAquaSystemAppearance` key in your apps `Info.plist` to `false`. If you are
|
||||
using `electron-packager` or `electron-forge` just set the `enableDarwinDarkMode`
|
||||
packager option to `true`. See the [Electron Packager API](https://github.com/electron/electron-packager/blob/master/docs/api.md#darwindarkmodesupport)
|
||||
for more details.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `systemPreferences.getAppLevelAppearance()` _macOS_ _Deprecated_
|
||||
|
||||
Returns `String` | `null` - Can be `dark`, `light` or `unknown`.
|
||||
@@ -377,6 +385,8 @@ Gets the macOS appearance setting that you have declared you want for
|
||||
your application, maps to [NSApplication.appearance](https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc).
|
||||
You can use the `setAppLevelAppearance` API to set this value.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `systemPreferences.setAppLevelAppearance(appearance)` _macOS_ _Deprecated_
|
||||
|
||||
* `appearance` String | null - Can be `dark` or `light`
|
||||
@@ -384,6 +394,8 @@ You can use the `setAppLevelAppearance` API to set this value.
|
||||
Sets the appearance setting for your application, this should override the
|
||||
system default and override the value of `getEffectiveAppearance`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `systemPreferences.canPromptTouchID()` _macOS_
|
||||
|
||||
Returns `Boolean` - whether or not this device has the ability to use Touch ID.
|
||||
@@ -416,18 +428,13 @@ This API itself will not protect your user data; rather, it is a mechanism to al
|
||||
|
||||
Returns `Boolean` - `true` if the current process is a trusted accessibility client and `false` if it is not.
|
||||
|
||||
### `systemPreferences.getMediaAccessStatus(mediaType)` _Windows_ _macOS_
|
||||
### `systemPreferences.getMediaAccessStatus(mediaType)` _macOS_
|
||||
|
||||
* `mediaType` String - Can be `microphone`, `camera` or `screen`.
|
||||
* `mediaType` String - `microphone` or `camera`.
|
||||
|
||||
Returns `String` - Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
|
||||
|
||||
This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return `granted`.
|
||||
macOS 10.14 Mojave or higher requires consent for `microphone` and `camera` access.
|
||||
macOS 10.15 Catalina or higher requires consent for `screen` access.
|
||||
|
||||
Windows 10 has a global setting controlling `microphone` and `camera` access for all win32 applications.
|
||||
It will always return `granted` for `screen` and for all media types on older versions of Windows.
|
||||
This user consent was not required until macOS 10.14 Mojave, so this method will always return `granted` if your system is running 10.13 High Sierra or lower.
|
||||
|
||||
### `systemPreferences.askForMediaAccess(mediaType)` _macOS_
|
||||
|
||||
@@ -467,3 +474,11 @@ A `String` property that can be `dark`, `light` or `unknown`.
|
||||
|
||||
Returns the macOS appearance setting that is currently applied to your application,
|
||||
maps to [NSApplication.effectiveAppearance](https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc)
|
||||
|
||||
Please note that until Electron is built targeting the 10.14 SDK, your application's
|
||||
`effectiveAppearance` will default to 'light' and won't inherit the OS preference. In
|
||||
the interim in order for your application to inherit the OS preference you must set the
|
||||
`NSRequiresAquaSystemAppearance` key in your apps `Info.plist` to `false`. If you are
|
||||
using `electron-packager` or `electron-forge` just set the `enableDarwinDarkMode`
|
||||
packager option to `true`. See the [Electron Packager API](https://github.com/electron/electron-packager/blob/master/docs/api.md#darwindarkmodesupport)
|
||||
for more details.
|
||||
|
||||
@@ -8,24 +8,16 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
|
||||
|
||||
* `options` Object
|
||||
* `label` String (optional) - Button text.
|
||||
* `accessibilityLabel` String (optional) - A short description of the button for use by screenreaders like VoiceOver.
|
||||
* `backgroundColor` String (optional) - Button background color in hex format,
|
||||
i.e `#ABCDEF`.
|
||||
* `icon` [NativeImage](native-image.md) | String (optional) - Button icon.
|
||||
* `iconPosition` String (optional) - Can be `left`, `right` or `overlay`. Defaults to `overlay`.
|
||||
* `iconPosition` String (optional) - Can be `left`, `right` or `overlay`.
|
||||
* `click` Function (optional) - Function to call when the button is clicked.
|
||||
* `enabled` Boolean (optional) - Whether the button is in an enabled state. Default is `true`.
|
||||
|
||||
When defining `accessibilityLabel`, ensure you have considered macOS [best practices](https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc).
|
||||
|
||||
### Instance Properties
|
||||
|
||||
The following properties are available on instances of `TouchBarButton`:
|
||||
|
||||
#### `touchBarButton.accessibilityLabel`
|
||||
|
||||
A `String` representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.
|
||||
|
||||
#### `touchBarButton.label`
|
||||
|
||||
A `String` representing the button's current text. Changing this value immediately updates the button
|
||||
@@ -40,7 +32,3 @@ the button in the touch bar.
|
||||
|
||||
A `NativeImage` representing the button's current icon. Changing this value immediately updates the button
|
||||
in the touch bar.
|
||||
|
||||
#### `touchBarButton.enabled`
|
||||
|
||||
A `Boolean` representing whether the button is in an enabled state.
|
||||
|
||||
@@ -8,11 +8,8 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
|
||||
|
||||
* `options` Object
|
||||
* `label` String (optional) - Text to display.
|
||||
* `accessibilityLabel` String (optional) - A short description of the button for use by screenreaders like VoiceOver.
|
||||
* `textColor` String (optional) - Hex color of text, i.e `#ABCDEF`.
|
||||
|
||||
When defining `accessibilityLabel`, ensure you have considered macOS [best practices](https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc).
|
||||
|
||||
### Instance Properties
|
||||
|
||||
The following properties are available on instances of `TouchBarLabel`:
|
||||
@@ -22,10 +19,6 @@ The following properties are available on instances of `TouchBarLabel`:
|
||||
A `String` representing the label's current text. Changing this value immediately updates the label in
|
||||
the touch bar.
|
||||
|
||||
#### `touchBarLabel.accessibilityLabel`
|
||||
|
||||
A `String` representing the description of the label to be read by a screen reader.
|
||||
|
||||
#### `touchBarLabel.textColor`
|
||||
|
||||
A `String` hex code representing the label's current text color. Changing this value immediately updates the
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user