mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Compare commits
863 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83928bd9ff | ||
|
|
9885c1cfe6 | ||
|
|
92d966c215 | ||
|
|
c437aa90e2 | ||
|
|
c7e9011f73 | ||
|
|
5e0014f08b | ||
|
|
1998ec2de1 | ||
|
|
4c007a96e9 | ||
|
|
1cac941047 | ||
|
|
f99c1752ad | ||
|
|
b03574b715 | ||
|
|
3c8ce8e85d | ||
|
|
599833fce2 | ||
|
|
c781daaa6a | ||
|
|
27bb1095fb | ||
|
|
b1e7078bb5 | ||
|
|
8e7e0dfca1 | ||
|
|
edeaa9f2be | ||
|
|
bfb870234d | ||
|
|
792a7c5913 | ||
|
|
705ef4bc60 | ||
|
|
14dc9a479f | ||
|
|
a290148714 | ||
|
|
b71926aba9 | ||
|
|
485bbfecfd | ||
|
|
401ea74cc8 | ||
|
|
419b5b77ae | ||
|
|
53ab44b1f2 | ||
|
|
13549bbc7b | ||
|
|
e69270a600 | ||
|
|
39203e93c0 | ||
|
|
961cc47948 | ||
|
|
9c614be4f8 | ||
|
|
e5da0b5c59 | ||
|
|
7db9895214 | ||
|
|
d706649da8 | ||
|
|
51ac59e1eb | ||
|
|
7623604030 | ||
|
|
ab2d2dc625 | ||
|
|
0e8b10beba | ||
|
|
e1dce7c1f7 | ||
|
|
266c471680 | ||
|
|
2bc14c9b7e | ||
|
|
b8c4a71cd7 | ||
|
|
1403a48add | ||
|
|
7c5430a47f | ||
|
|
0dd5d57423 | ||
|
|
a49593580d | ||
|
|
0a6a3fd812 | ||
|
|
56d28dce94 | ||
|
|
857ce18e17 | ||
|
|
56f042f5e5 | ||
|
|
ce36849a3d | ||
|
|
3483a341de | ||
|
|
e8cc2f613e | ||
|
|
6749f8f065 | ||
|
|
10fba52f73 | ||
|
|
f2daab093c | ||
|
|
89763c9042 | ||
|
|
c506624807 | ||
|
|
3f344e91bb | ||
|
|
d9533135d0 | ||
|
|
b8df68d7f4 | ||
|
|
79b07b9c70 | ||
|
|
bb88737b9c | ||
|
|
6494e41306 | ||
|
|
5a5ea4845e | ||
|
|
4076f06036 | ||
|
|
169136c69c | ||
|
|
63e59a196a | ||
|
|
4d8d8f56cc | ||
|
|
7b7b4941fe | ||
|
|
9537370cf6 | ||
|
|
8edbb1d4ae | ||
|
|
f8c0682b6e | ||
|
|
8a10a90ebf | ||
|
|
2255705c70 | ||
|
|
74d5ddcd28 | ||
|
|
bb9badc41a | ||
|
|
10632e3f54 | ||
|
|
6010ac6c76 | ||
|
|
1c1a0cdead | ||
|
|
af0a995bb2 | ||
|
|
a0efada13b | ||
|
|
8635029f47 | ||
|
|
ac0ba48736 | ||
|
|
f527b8aa2a | ||
|
|
e3b7c3024f | ||
|
|
9f007b9afb | ||
|
|
d5ce1387ce | ||
|
|
42ca25c338 | ||
|
|
2c723d7e84 | ||
|
|
16a7bd7102 | ||
|
|
bbb590b777 | ||
|
|
32583ac756 | ||
|
|
679ce632a9 | ||
|
|
629c54ba36 | ||
|
|
2751c2b07f | ||
|
|
c6d6af2551 | ||
|
|
b71cccb0d6 | ||
|
|
3a94634ae5 | ||
|
|
9c48992e21 | ||
|
|
7529ebfe0e | ||
|
|
4f1f263a9a | ||
|
|
87c183df6a | ||
|
|
517225b99e | ||
|
|
bd345358f6 | ||
|
|
9616dfb1f6 | ||
|
|
41d393c076 | ||
|
|
2cc24542f5 | ||
|
|
d57d9f71df | ||
|
|
f8aee0fbe7 | ||
|
|
f9d1b9aded | ||
|
|
9618a7227e | ||
|
|
9f8308907b | ||
|
|
05577d0903 | ||
|
|
a9ef68f126 | ||
|
|
d8bb172318 | ||
|
|
654e571512 | ||
|
|
46a74d1086 | ||
|
|
75d2caf451 | ||
|
|
1b1609aa0f | ||
|
|
5fc3ed936e | ||
|
|
8f5959aad2 | ||
|
|
31a0bb7de2 | ||
|
|
5c1186f624 | ||
|
|
184ac2b382 | ||
|
|
2008c9a5d0 | ||
|
|
0ba0df4523 | ||
|
|
71b8804fd0 | ||
|
|
15540975ff | ||
|
|
8b430c9d26 | ||
|
|
2f2c43e5e5 | ||
|
|
169cf531ba | ||
|
|
b9464d89b8 | ||
|
|
67a0c702fa | ||
|
|
ea6f873f97 | ||
|
|
07530f8e37 | ||
|
|
260678bd0c | ||
|
|
02ad8fcd5f | ||
|
|
ff4816367e | ||
|
|
ff3289d260 | ||
|
|
99a34d5209 | ||
|
|
625b4619d6 | ||
|
|
a75e8e051e | ||
|
|
09302a2fc6 | ||
|
|
b13f776d1b | ||
|
|
7ca2bb5f9c | ||
|
|
ad289d120f | ||
|
|
85b193178f | ||
|
|
3aed596fba | ||
|
|
3e730ab016 | ||
|
|
0158077bec | ||
|
|
7921fec761 | ||
|
|
289bdbe4bc | ||
|
|
da0fd286b4 | ||
|
|
44c40efecf | ||
|
|
8bd66026a8 | ||
|
|
dde513b0d3 | ||
|
|
a8d89b3d52 | ||
|
|
b13606e55d | ||
|
|
4310468513 | ||
|
|
23d4a252c6 | ||
|
|
f2c341b655 | ||
|
|
bcafe8f654 | ||
|
|
d8d5d4a4a1 | ||
|
|
295c5331ee | ||
|
|
76880be6d2 | ||
|
|
e660fdf776 | ||
|
|
dd757f4e22 | ||
|
|
dc5d27a73b | ||
|
|
ce138fe969 | ||
|
|
79454dc50d | ||
|
|
8f09d6b47e | ||
|
|
b307314401 | ||
|
|
294f27900c | ||
|
|
8a926ffde4 | ||
|
|
7ce94eb0b4 | ||
|
|
1328d8d670 | ||
|
|
76afd8c028 | ||
|
|
eb97ce1931 | ||
|
|
b6eadf2414 | ||
|
|
8212616c76 | ||
|
|
ee7cf5a6d4 | ||
|
|
0759f3320e | ||
|
|
c2cb97ea29 | ||
|
|
e8ae0571b8 | ||
|
|
b3fd5eb258 | ||
|
|
9006f0e0c5 | ||
|
|
7493062555 | ||
|
|
e02de74ff2 | ||
|
|
ebb866e63d | ||
|
|
ef00a2a1da | ||
|
|
6072c4c71b | ||
|
|
1fe21ff712 | ||
|
|
a072f06168 | ||
|
|
8bfbb251cc | ||
|
|
3f4c4a4470 | ||
|
|
5c784c2b1b | ||
|
|
e1494ddc47 | ||
|
|
e31c96a564 | ||
|
|
faafcc7f87 | ||
|
|
a6b6816bec | ||
|
|
f916ce2c49 | ||
|
|
6196393c94 | ||
|
|
ff0517be3e | ||
|
|
d8e037e426 | ||
|
|
3bd85c8dc2 | ||
|
|
e63d4a6321 | ||
|
|
256d4678bb | ||
|
|
2cda1443fc | ||
|
|
12eade752d | ||
|
|
c76a931e20 | ||
|
|
16f459228b | ||
|
|
94955a7999 | ||
|
|
29ca3d1467 | ||
|
|
3f598ef1ed | ||
|
|
6a68afdb8a | ||
|
|
fea844c3da | ||
|
|
f82a863f65 | ||
|
|
dfb8a2d804 | ||
|
|
998a0820d9 | ||
|
|
621baa7bb7 | ||
|
|
74d59af3c5 | ||
|
|
c09c94fc98 | ||
|
|
697a219bcb | ||
|
|
f8077cc004 | ||
|
|
e0b4c485fe | ||
|
|
a2ae308448 | ||
|
|
7d96321786 | ||
|
|
39d79c5c28 | ||
|
|
f62aab76b3 | ||
|
|
324db14969 | ||
|
|
8a0b4fa338 | ||
|
|
626e248dea | ||
|
|
22d6102702 | ||
|
|
ad33a5f364 | ||
|
|
d357218654 | ||
|
|
c69754b8e6 | ||
|
|
0df8878da4 | ||
|
|
4438731124 | ||
|
|
eb3262cd87 | ||
|
|
4ffdd284c3 | ||
|
|
9719cea250 | ||
|
|
dfc134de42 | ||
|
|
8c3c0f0b50 | ||
|
|
0783692809 | ||
|
|
4935fd2422 | ||
|
|
99f4a42d41 | ||
|
|
b1d7b30ca3 | ||
|
|
d71b5e53fd | ||
|
|
6cc69122ce | ||
|
|
76ce6d5fb4 | ||
|
|
01cf5c5f99 | ||
|
|
80bcea7e55 | ||
|
|
9aed5bcac5 | ||
|
|
eebf34cc6c | ||
|
|
994834d25a | ||
|
|
7d3f22dd32 | ||
|
|
fa3cd17475 | ||
|
|
ee8a27492f | ||
|
|
bd6612273b | ||
|
|
f25c87dc70 | ||
|
|
5cf15cdab7 | ||
|
|
532162d2b5 | ||
|
|
30bdede09f | ||
|
|
38a7da692a | ||
|
|
bf20aabb9e | ||
|
|
3a3be23f0e | ||
|
|
748c6af61e | ||
|
|
f244e75927 | ||
|
|
c847229a7e | ||
|
|
62502b8937 | ||
|
|
12a7d7eea5 | ||
|
|
9f97c3e50a | ||
|
|
200153da8e | ||
|
|
71ba841f0a | ||
|
|
ef463b39be | ||
|
|
6ec4c7e563 | ||
|
|
b3a744db8a | ||
|
|
c14f52aeb7 | ||
|
|
88dac9afc5 | ||
|
|
730d9181b3 | ||
|
|
b0036ea43a | ||
|
|
a0dbae72c8 | ||
|
|
a0c20fef96 | ||
|
|
34cb360730 | ||
|
|
4fb4167b8b | ||
|
|
17d5016163 | ||
|
|
e3efa16415 | ||
|
|
3a6d6ff008 | ||
|
|
ebd1c8358b | ||
|
|
84c94c3ebb | ||
|
|
142eb89d5e | ||
|
|
c16baa063a | ||
|
|
87145c393c | ||
|
|
7d89cb1bd4 | ||
|
|
08ccc81574 | ||
|
|
f53ca20d41 | ||
|
|
e09a4a31ca | ||
|
|
bda094674f | ||
|
|
de206987fe | ||
|
|
2db0f7f8d4 | ||
|
|
98c0fa1c8b | ||
|
|
bfbe73396b | ||
|
|
6ad679f540 | ||
|
|
a7248af79e | ||
|
|
f99122abfc | ||
|
|
9cdc8bf6ca | ||
|
|
b7c5b48c38 | ||
|
|
5fe1ac5c3d | ||
|
|
1830c0f6c3 | ||
|
|
e0fb5cbe1f | ||
|
|
bfced8cbfe | ||
|
|
75f9573e53 | ||
|
|
d0e220cbce | ||
|
|
1847581848 | ||
|
|
2f23bdb19e | ||
|
|
4744674e93 | ||
|
|
f6bbad287a | ||
|
|
23264488c5 | ||
|
|
d829fb7ef2 | ||
|
|
f65b05b8cc | ||
|
|
8128fa6d85 | ||
|
|
3eb593dfde | ||
|
|
3de7844212 | ||
|
|
a3a9463024 | ||
|
|
70d6cbfb44 | ||
|
|
22ff2b6b93 | ||
|
|
7e8607fd7a | ||
|
|
6f77e63804 | ||
|
|
07c3e62d68 | ||
|
|
e1459f4d50 | ||
|
|
900ffede41 | ||
|
|
3ce35f224e | ||
|
|
0ff6508f5b | ||
|
|
33325e3608 | ||
|
|
221bb51326 | ||
|
|
0c04be502c | ||
|
|
d6d86f8b16 | ||
|
|
eca6029c0a | ||
|
|
9b2b1998b8 | ||
|
|
fc2e6bd0ed | ||
|
|
19baea4bc2 | ||
|
|
9b787d30f4 | ||
|
|
748a739291 | ||
|
|
b9bffb19ca | ||
|
|
82f146e223 | ||
|
|
402553aeeb | ||
|
|
1d6885c781 | ||
|
|
97b353a30a | ||
|
|
e15e66f229 | ||
|
|
532025c207 | ||
|
|
43182bf030 | ||
|
|
8e4a168a13 | ||
|
|
947f1b0abf | ||
|
|
db7c92fd57 | ||
|
|
e87c4015fe | ||
|
|
e85450b21a | ||
|
|
672539187c | ||
|
|
cbc1ee5775 | ||
|
|
9c2d89476c | ||
|
|
8424779906 | ||
|
|
81766707fc | ||
|
|
4cb57ad1a0 | ||
|
|
a8934d2302 | ||
|
|
f1216ca593 | ||
|
|
ceabca850c | ||
|
|
81d95b53b3 | ||
|
|
4d54cadb28 | ||
|
|
eab7ab2c47 | ||
|
|
882cdb1f7a | ||
|
|
1d95b98cc8 | ||
|
|
8646bf8d30 | ||
|
|
32fefb1f50 | ||
|
|
6548808054 | ||
|
|
faa2f7afa3 | ||
|
|
f3dbdaaf33 | ||
|
|
0400eb2e60 | ||
|
|
91f9436ad8 | ||
|
|
34b985c556 | ||
|
|
76431ac1fa | ||
|
|
a11cc3274f | ||
|
|
a719568ac1 | ||
|
|
fbcd8f8a6e | ||
|
|
aaa60dc0bc | ||
|
|
4cfdef0ffd | ||
|
|
b9fea0d2d2 | ||
|
|
1b2e5b4106 | ||
|
|
47a08f9570 | ||
|
|
21117ea5b2 | ||
|
|
6d859dcd7f | ||
|
|
bba22ae720 | ||
|
|
d15348ecc2 | ||
|
|
3baf713648 | ||
|
|
2b96d06960 | ||
|
|
c47031a279 | ||
|
|
74432a313c | ||
|
|
4e919c919c | ||
|
|
fb39f241fb | ||
|
|
afa4f5052b | ||
|
|
7b8fb2b074 | ||
|
|
4e8480b15b | ||
|
|
3fe00d75e9 | ||
|
|
3d4d1b33ba | ||
|
|
53cd23159e | ||
|
|
31be6ecf7b | ||
|
|
e3893632e7 | ||
|
|
0cdc946b27 | ||
|
|
0d36c0cdc6 | ||
|
|
7588bb7425 | ||
|
|
6c17dd2296 | ||
|
|
29434ee7c6 | ||
|
|
b67c69d741 | ||
|
|
00e9bf107a | ||
|
|
9028bb79a8 | ||
|
|
8004cb8722 | ||
|
|
7f757075bc | ||
|
|
674596d11e | ||
|
|
3c2ec2280e | ||
|
|
de1cec8693 | ||
|
|
99c2706376 | ||
|
|
63593ffb22 | ||
|
|
b0c6fb5152 | ||
|
|
77b4aab720 | ||
|
|
7c2ed98214 | ||
|
|
62001dc6cb | ||
|
|
ff804e3a74 | ||
|
|
9416091180 | ||
|
|
6d9e8b65bc | ||
|
|
b42fd1ddca | ||
|
|
182ab9ad76 | ||
|
|
77e1a046ec | ||
|
|
0be73d18ef | ||
|
|
c842f63383 | ||
|
|
6674082041 | ||
|
|
cabfb8507d | ||
|
|
aa40652456 | ||
|
|
dd68fae081 | ||
|
|
ad1bbc198b | ||
|
|
2c51a81e85 | ||
|
|
648c9934c0 | ||
|
|
aeba6ca973 | ||
|
|
49302e4a2f | ||
|
|
57c265198e | ||
|
|
08dd38d9be | ||
|
|
dd82a26e95 | ||
|
|
3c63f075bd | ||
|
|
fec4cca8d4 | ||
|
|
1ed191114a | ||
|
|
d4e97483aa | ||
|
|
7ae3025fd5 | ||
|
|
67eda4bcc8 | ||
|
|
9f0e7126c4 | ||
|
|
be7f90481d | ||
|
|
6dc1218c37 | ||
|
|
cffcd0d47a | ||
|
|
9e0a3c44dd | ||
|
|
1b96a3aa1d | ||
|
|
3c7d446fad | ||
|
|
60b6e74e3f | ||
|
|
ba25714e16 | ||
|
|
05d4966251 | ||
|
|
eb8c9452cb | ||
|
|
38848c5bf7 | ||
|
|
57b02e153d | ||
|
|
8a0df1f487 | ||
|
|
c4cde78818 | ||
|
|
f1746c81c6 | ||
|
|
9d23a624c1 | ||
|
|
574da5a9a1 | ||
|
|
2afb284456 | ||
|
|
4bec26cd0c | ||
|
|
0cb39b5bb5 | ||
|
|
e9f42b4ad4 | ||
|
|
9a5d759ea3 | ||
|
|
d32e6cc252 | ||
|
|
440c575aa6 | ||
|
|
46e5c537c8 | ||
|
|
07d168343a | ||
|
|
62aeb74d7c | ||
|
|
afd08c9450 | ||
|
|
5314ae5342 | ||
|
|
511ff8bc8d | ||
|
|
95019f0454 | ||
|
|
4190ec2482 | ||
|
|
f63bba8ce2 | ||
|
|
8f3fb8db09 | ||
|
|
2b862c18ba | ||
|
|
fa8e4a7610 | ||
|
|
2eb0e5dcab | ||
|
|
459404f536 | ||
|
|
78848f8bfe | ||
|
|
eba9d3fc79 | ||
|
|
1941c88442 | ||
|
|
e83c3ec744 | ||
|
|
7ec88584b5 | ||
|
|
47d8d4cc5c | ||
|
|
f7428baace | ||
|
|
403bd39d05 | ||
|
|
c418275228 | ||
|
|
98cd16d336 | ||
|
|
e5db178ab6 | ||
|
|
0ee7f14190 | ||
|
|
d28ed0da20 | ||
|
|
1edf9d2ada | ||
|
|
d359736e65 | ||
|
|
c885f9063b | ||
|
|
c3920c5c02 | ||
|
|
5d120359f6 | ||
|
|
0d4e417594 | ||
|
|
4ddd03b1b3 | ||
|
|
7c12baccab | ||
|
|
461561c19c | ||
|
|
1f814eacb2 | ||
|
|
ad2b1fee59 | ||
|
|
35ff95d3c7 | ||
|
|
6257e0c348 | ||
|
|
3310e4039f | ||
|
|
40fbc05bb2 | ||
|
|
3458eac276 | ||
|
|
44b9ee51f4 | ||
|
|
07294cbf15 | ||
|
|
a4043237da | ||
|
|
704b2199b3 | ||
|
|
f1087cc830 | ||
|
|
d028044a24 | ||
|
|
9c311a2059 | ||
|
|
47afaddaf5 | ||
|
|
59d3c12cae | ||
|
|
e86d1cba75 | ||
|
|
032e1d9bef | ||
|
|
39840502be | ||
|
|
8238cca87b | ||
|
|
e2c58d164d | ||
|
|
ba4893c248 | ||
|
|
c5b87e4919 | ||
|
|
3b881e4a13 | ||
|
|
106aa0e922 | ||
|
|
11924bdbb2 | ||
|
|
cd19a741b1 | ||
|
|
5895296239 | ||
|
|
e3243ad113 | ||
|
|
5fee5b0e22 | ||
|
|
f172136752 | ||
|
|
218797eb61 | ||
|
|
e410109a3d | ||
|
|
a5869fe997 | ||
|
|
bf52318c76 | ||
|
|
73c85410c5 | ||
|
|
ad7aab8338 | ||
|
|
140c8d0d0a | ||
|
|
34fc53e5e6 | ||
|
|
528cbe8131 | ||
|
|
116c32a030 | ||
|
|
530a022b05 | ||
|
|
f3f327823e | ||
|
|
0f528c1e43 | ||
|
|
2bbbc66eb8 | ||
|
|
3cd5223134 | ||
|
|
8e45f43f18 | ||
|
|
d341610d64 | ||
|
|
6e9466f96b | ||
|
|
e2f42e5d99 | ||
|
|
ec98e95b8a | ||
|
|
bf4efb693b | ||
|
|
999a225edb | ||
|
|
b3ec0a801a | ||
|
|
6f8bfdeb7a | ||
|
|
20538c4f34 | ||
|
|
d2e539c7d4 | ||
|
|
ea4278754c | ||
|
|
f418a49857 | ||
|
|
bad8d5e08a | ||
|
|
4ec95edf06 | ||
|
|
4c7c0b41c2 | ||
|
|
21ef8501e7 | ||
|
|
bed38e0985 | ||
|
|
8de5cdb426 | ||
|
|
9707812d68 | ||
|
|
16cd22ff6a | ||
|
|
954fd72500 | ||
|
|
8157a01a42 | ||
|
|
d565243f98 | ||
|
|
77dcf4a5e0 | ||
|
|
2a9b3cc9cd | ||
|
|
7ca3f55b10 | ||
|
|
e5543a2dd2 | ||
|
|
bd81ae08ac | ||
|
|
57b863c213 | ||
|
|
52c0a4fafc | ||
|
|
1302ebf50e | ||
|
|
37d93b0482 | ||
|
|
2fd0194e94 | ||
|
|
6d50717eed | ||
|
|
289128b96c | ||
|
|
16db5a112e | ||
|
|
f44ecb7f03 | ||
|
|
8e97f3badf | ||
|
|
a203123473 | ||
|
|
c750936328 | ||
|
|
5f0f517486 | ||
|
|
4ec2de659f | ||
|
|
30d15715a9 | ||
|
|
882fa36940 | ||
|
|
e56f626b94 | ||
|
|
92b0f3e808 | ||
|
|
4f99e3e46c | ||
|
|
f39c1a35e5 | ||
|
|
05b03b01dc | ||
|
|
6038e42c23 | ||
|
|
b00c026a54 | ||
|
|
eb26f99f6e | ||
|
|
d13c879a15 | ||
|
|
3ad70d0f0b | ||
|
|
0671f229ac | ||
|
|
539a53786c | ||
|
|
000c3d981c | ||
|
|
eb9888d1d2 | ||
|
|
1cd07c565a | ||
|
|
f306fbc010 | ||
|
|
5057cbf418 | ||
|
|
561be72373 | ||
|
|
a38e5d20ff | ||
|
|
cda8f3c15c | ||
|
|
df91dd6d2b | ||
|
|
470396d6ac | ||
|
|
3849d19e14 | ||
|
|
2cb53c5db1 | ||
|
|
93b39b92b5 | ||
|
|
0d69067dee | ||
|
|
fd88908457 | ||
|
|
34a9268e97 | ||
|
|
03d9615f99 | ||
|
|
2ffa31832e | ||
|
|
4accf67d2b | ||
|
|
afca3519fd | ||
|
|
4b3a7b7762 | ||
|
|
a6a2bb65a4 | ||
|
|
fd559d8516 | ||
|
|
7bc4b919dc | ||
|
|
6cb2b9eab7 | ||
|
|
b8abf5e38a | ||
|
|
6667de28e3 | ||
|
|
9d3fc9c794 | ||
|
|
ba573f5583 | ||
|
|
df9383cb3c | ||
|
|
09a80ea48c | ||
|
|
887b5a7dc7 | ||
|
|
c3fa6005db | ||
|
|
89fab6a549 | ||
|
|
291eb60916 | ||
|
|
aa3e852a73 | ||
|
|
1639ccf98f | ||
|
|
38c21b7aca | ||
|
|
ff13fa8f0a | ||
|
|
ba7dedcc6f | ||
|
|
5ff94e7f2b | ||
|
|
17c8ec765b | ||
|
|
588005a9d5 | ||
|
|
73e0bf973d | ||
|
|
455544dfb6 | ||
|
|
2436152536 | ||
|
|
61374019c0 | ||
|
|
04b33b319b | ||
|
|
97c9451efc | ||
|
|
4e3587c7c6 | ||
|
|
ccde8994b5 | ||
|
|
125c324a49 | ||
|
|
4aba68a59d | ||
|
|
7af0b58c98 | ||
|
|
cc411946d7 | ||
|
|
b06737fdac | ||
|
|
8b5613efcb | ||
|
|
a8103691ac | ||
|
|
142e1f667b | ||
|
|
ff5f66395e | ||
|
|
ba3aca8200 | ||
|
|
d67532ee9f | ||
|
|
4f8a843606 | ||
|
|
dd6ce91f57 | ||
|
|
6f8a36f404 | ||
|
|
c512993744 | ||
|
|
6063d4f8df | ||
|
|
64dc90824b | ||
|
|
79e1881b2a | ||
|
|
a853a6ce9f | ||
|
|
5633c45c19 | ||
|
|
9bcbe70dbe | ||
|
|
e76cf3e2ed | ||
|
|
627c2987ba | ||
|
|
7f5346b954 | ||
|
|
4fc42092b8 | ||
|
|
c8fbabae48 | ||
|
|
b94f25c287 | ||
|
|
5572659988 | ||
|
|
030087c1c7 | ||
|
|
5391211824 | ||
|
|
00368aca37 | ||
|
|
9483e714c4 | ||
|
|
03e68e2efe | ||
|
|
6fea35271c | ||
|
|
dd7dfd7ecd | ||
|
|
3ba60de51d | ||
|
|
1bdbb69351 | ||
|
|
2900bc55aa | ||
|
|
0d35084ada | ||
|
|
0f2da5c830 | ||
|
|
808efd89ed | ||
|
|
0696320d28 | ||
|
|
a401360057 | ||
|
|
d8a7219d07 | ||
|
|
a2a8e493eb | ||
|
|
90eb47f70b | ||
|
|
323f7d4c19 | ||
|
|
706d585eb8 | ||
|
|
5b648854d5 | ||
|
|
2091343b78 | ||
|
|
4fad376b0e | ||
|
|
60f1e5e008 | ||
|
|
349cd98b0a | ||
|
|
747dfe5851 | ||
|
|
658407df7a | ||
|
|
0893733496 | ||
|
|
f887000d50 | ||
|
|
7dee5179cb | ||
|
|
a71936e395 | ||
|
|
e1ed96b574 | ||
|
|
9901d2f281 | ||
|
|
14f07d7814 | ||
|
|
6f851afab5 | ||
|
|
682d2e3f78 | ||
|
|
b55f9d868a | ||
|
|
ce562b6889 | ||
|
|
015185ad5a | ||
|
|
fb534c927a | ||
|
|
192a7fad0d | ||
|
|
097da1d4ba | ||
|
|
b3530d5df8 | ||
|
|
b5297ea8e2 | ||
|
|
15c931201a | ||
|
|
f91b24deb5 | ||
|
|
d2c3e78117 | ||
|
|
a00544c745 | ||
|
|
160d6923db | ||
|
|
6d5501d0bd | ||
|
|
bfabd67112 | ||
|
|
40c022ad69 | ||
|
|
028a72daac | ||
|
|
6a1748da06 | ||
|
|
0a73f60423 | ||
|
|
f48a921d14 | ||
|
|
f3e0517b6e | ||
|
|
53c3dd68b2 | ||
|
|
283e4826af | ||
|
|
e571417c52 | ||
|
|
a5501d7118 | ||
|
|
0c8c755ffb | ||
|
|
bb146e3deb | ||
|
|
33e9bfd99b | ||
|
|
e864bc44c6 | ||
|
|
64517b36ef | ||
|
|
00021a41b1 | ||
|
|
b53118ca28 | ||
|
|
0c864837af | ||
|
|
fec147a0cb | ||
|
|
841e0a4e0c | ||
|
|
31c2b5703a | ||
|
|
6733279037 | ||
|
|
2d0ad04354 | ||
|
|
5ae234d5e1 | ||
|
|
0f087127de | ||
|
|
b9c0166b49 | ||
|
|
fd191fc50b | ||
|
|
37b7e347fc | ||
|
|
9d4aceb940 | ||
|
|
eee4232069 | ||
|
|
635b3a94c8 | ||
|
|
99791f620b | ||
|
|
8b0af86097 | ||
|
|
f5e874cbcb | ||
|
|
dda8bc3cd1 | ||
|
|
233a39dbc9 | ||
|
|
7658edfa1a | ||
|
|
16f8d713ab | ||
|
|
3d4d39d67b | ||
|
|
b66667b843 | ||
|
|
bfbba9dad6 | ||
|
|
341b7bdf4a | ||
|
|
4c4e02318f | ||
|
|
de2f48b40f | ||
|
|
a9c52926c0 | ||
|
|
bfa5b21044 | ||
|
|
d804cd5de2 | ||
|
|
7038d2d418 | ||
|
|
b8c0ef9713 | ||
|
|
c5b93eaf17 | ||
|
|
2ca46058cd | ||
|
|
3057ff0120 | ||
|
|
48edb2c707 | ||
|
|
56ab3d73c6 | ||
|
|
0287c3f511 | ||
|
|
1c53fc4331 | ||
|
|
c0d442364a | ||
|
|
59dd17f2cf | ||
|
|
e8ed9cb4b5 | ||
|
|
c9fd255093 | ||
|
|
caddc83cfe | ||
|
|
a7a5e7fcfd | ||
|
|
207d4e5823 | ||
|
|
8e2310db31 | ||
|
|
6872306117 | ||
|
|
41c1a7e318 | ||
|
|
9d6e6c45c1 | ||
|
|
f711fe6b57 | ||
|
|
94c2a7671c | ||
|
|
4d4682c0e3 | ||
|
|
7fb1c8faad | ||
|
|
ba8e7b9638 | ||
|
|
75ccec7996 | ||
|
|
68d6d8d451 | ||
|
|
0168aede8e | ||
|
|
a05d9be44f | ||
|
|
f95e565884 | ||
|
|
4615fc53ca | ||
|
|
927ab3104d | ||
|
|
cc3743bd43 | ||
|
|
fcbdaab5e3 | ||
|
|
a72acfc535 | ||
|
|
477aa389e6 | ||
|
|
1ada5d7ddf | ||
|
|
dce6c23b33 | ||
|
|
df34d20a21 | ||
|
|
d309558f64 | ||
|
|
128560c4ac | ||
|
|
bff1a37791 | ||
|
|
fcd7dbfa5c | ||
|
|
58386fbf43 | ||
|
|
09251fe24c | ||
|
|
18db9c551d | ||
|
|
c2449c421c | ||
|
|
e28bde9947 | ||
|
|
f287b0b382 | ||
|
|
204b53e7b8 | ||
|
|
0ac6d74536 | ||
|
|
78a3752ade | ||
|
|
9207c2aa68 | ||
|
|
1864edd287 | ||
|
|
9722ca78b2 | ||
|
|
7612df7687 | ||
|
|
cbd06cd25e | ||
|
|
8c8642634d | ||
|
|
afe0116d59 | ||
|
|
b711860d21 | ||
|
|
929fc8bea5 | ||
|
|
a508dce1bf | ||
|
|
f13f07023f | ||
|
|
aac546368f | ||
|
|
c119b1ebef | ||
|
|
df3cfb663c | ||
|
|
a9296229c8 | ||
|
|
9c3b159b95 | ||
|
|
89c1abd1b3 |
1
.circleci/.gitignore
vendored
Normal file
1
.circleci/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
config-staging
|
||||||
@@ -6,6 +6,7 @@ setup: true
|
|||||||
# Orbs
|
# Orbs
|
||||||
orbs:
|
orbs:
|
||||||
path-filtering: circleci/path-filtering@0.1.0
|
path-filtering: circleci/path-filtering@0.1.0
|
||||||
|
continuation: circleci/continuation@0.2.0
|
||||||
|
|
||||||
# All input parameters to pass to build config
|
# All input parameters to pass to build config
|
||||||
parameters:
|
parameters:
|
||||||
@@ -13,7 +14,7 @@ parameters:
|
|||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
upload-to-s3:
|
upload-to-storage:
|
||||||
type: string
|
type: string
|
||||||
default: '1'
|
default: '1'
|
||||||
|
|
||||||
@@ -43,103 +44,33 @@ parameters:
|
|||||||
default: all
|
default: all
|
||||||
enum: ["all", "osx-x64", "osx-arm64", "mas-x64", "mas-arm64"]
|
enum: ["all", "osx-x64", "osx-arm64", "mas-x64", "mas-arm64"]
|
||||||
|
|
||||||
# Envs
|
|
||||||
env-global: &env-global
|
|
||||||
ELECTRON_OUT_DIR: Default
|
|
||||||
|
|
||||||
env-linux-medium: &env-linux-medium
|
|
||||||
<<: *env-global
|
|
||||||
NUMBER_OF_NINJA_PROCESSES: 3
|
|
||||||
|
|
||||||
# Executors
|
|
||||||
executors:
|
|
||||||
linux-docker:
|
|
||||||
parameters:
|
|
||||||
size:
|
|
||||||
description: "Docker executor size"
|
|
||||||
default: 2xlarge+
|
|
||||||
type: enum
|
|
||||||
enum: ["medium", "xlarge", "2xlarge+"]
|
|
||||||
docker:
|
|
||||||
- image: ghcr.io/electron/build:27db4a3e3512bfd2e47f58cea69922da0835f1d9
|
|
||||||
resource_class: << parameters.size >>
|
|
||||||
|
|
||||||
# List of always run steps
|
|
||||||
step-checkout-electron: &step-checkout-electron
|
|
||||||
checkout:
|
|
||||||
path: src/electron
|
|
||||||
|
|
||||||
steps-lint: &steps-lint
|
|
||||||
steps:
|
|
||||||
- *step-checkout-electron
|
|
||||||
- run:
|
|
||||||
name: Setup third_party Depot Tools
|
|
||||||
command: |
|
|
||||||
# "depot_tools" has to be checkout into "//third_party/depot_tools" so pylint.py can a "pylintrc" file.
|
|
||||||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git src/third_party/depot_tools
|
|
||||||
echo 'export PATH="$PATH:'"$PWD"'/src/third_party/depot_tools"' >> $BASH_ENV
|
|
||||||
- run:
|
|
||||||
name: Download GN Binary
|
|
||||||
command: |
|
|
||||||
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
|
||||||
gn_version="$(curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/DEPS?format=TEXT" | base64 -d | grep gn_version | head -n1 | cut -d\' -f4)"
|
|
||||||
|
|
||||||
cipd ensure -ensure-file - -root . \<<-CIPD
|
|
||||||
\$ServiceURL https://chrome-infra-packages.appspot.com/
|
|
||||||
@Subdir src/buildtools/linux64
|
|
||||||
gn/gn/linux-amd64 $gn_version
|
|
||||||
CIPD
|
|
||||||
|
|
||||||
echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/src/buildtools"' >> $BASH_ENV
|
|
||||||
- run:
|
|
||||||
name: Download clang-format Binary
|
|
||||||
command: |
|
|
||||||
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
|
||||||
|
|
||||||
sha1_path='buildtools/linux64/clang-format.sha1'
|
|
||||||
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/${sha1_path}?format=TEXT" | base64 -d > "src/${sha1_path}"
|
|
||||||
|
|
||||||
download_from_google_storage.py --no_resume --no_auth --bucket chromium-clang-format -s "src/${sha1_path}"
|
|
||||||
- run:
|
|
||||||
name: Run Lint
|
|
||||||
command: |
|
|
||||||
# gn.py tries to find a gclient root folder starting from the current dir.
|
|
||||||
# When it fails and returns "None" path, the whole script fails. Let's "fix" it.
|
|
||||||
touch .gclient
|
|
||||||
# Another option would be to checkout "buildtools" inside the Electron checkout,
|
|
||||||
# but then we would lint its contents (at least gn format), and it doesn't pass it.
|
|
||||||
|
|
||||||
cd src/electron
|
|
||||||
node script/yarn install --frozen-lockfile
|
|
||||||
node script/yarn lint
|
|
||||||
- run:
|
|
||||||
name: Run Script Typechecker
|
|
||||||
command: |
|
|
||||||
cd src/electron
|
|
||||||
node script/yarn tsc -p tsconfig.script.json
|
|
||||||
|
|
||||||
# List of always run jobs.
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
generate-config:
|
||||||
executor:
|
docker:
|
||||||
name: linux-docker
|
- image: cimg/node:16.14
|
||||||
size: medium
|
steps:
|
||||||
environment:
|
- checkout
|
||||||
<<: *env-linux-medium
|
- path-filtering/set-parameters:
|
||||||
<<: *steps-lint
|
|
||||||
|
|
||||||
# Initial setup workflow
|
|
||||||
workflows:
|
|
||||||
lint:
|
|
||||||
jobs:
|
|
||||||
# Job inherited from path-filtering orb
|
|
||||||
- path-filtering/filter:
|
|
||||||
base-revision: main
|
base-revision: main
|
||||||
# Params for mapping; `path-to-test parameter-to-set value-for-parameter` for each row
|
|
||||||
mapping: |
|
mapping: |
|
||||||
^((?!docs/).)*$ run-build-mac true
|
^((?!docs/).)*$ run-build-mac true
|
||||||
^((?!docs/).)*$ run-build-linux true
|
^((?!docs/).)*$ run-build-linux true
|
||||||
docs/.* run-docs-only true
|
docs/.* run-docs-only true
|
||||||
^((?!docs/).)*$ run-docs-only false
|
^((?!docs/).)*$ run-docs-only false
|
||||||
config-path: .circleci/build_config.yml
|
- run:
|
||||||
- lint
|
command: |
|
||||||
|
cd .circleci/config
|
||||||
|
yarn
|
||||||
|
export CIRCLECI_BINARY="$HOME/circleci"
|
||||||
|
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | DESTDIR=$CIRCLECI_BINARY bash
|
||||||
|
node build.js
|
||||||
|
name: Pack config.yml
|
||||||
|
- continuation/continue:
|
||||||
|
configuration_path: .circleci/config-staging/built.yml
|
||||||
|
parameters: /tmp/pipeline-parameters.json
|
||||||
|
|
||||||
|
# Initial setup workflow
|
||||||
|
workflows:
|
||||||
|
setup:
|
||||||
|
jobs:
|
||||||
|
- generate-config
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
34
.circleci/config/build.js
Normal file
34
.circleci/config/build.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
const cp = require('child_process');
|
||||||
|
const fs = require('fs-extra');
|
||||||
|
const path = require('path');
|
||||||
|
const yaml = require('js-yaml');
|
||||||
|
|
||||||
|
const STAGING_DIR = path.resolve(__dirname, '..', 'config-staging');
|
||||||
|
|
||||||
|
function copyAndExpand(dir = './') {
|
||||||
|
const absDir = path.resolve(__dirname, dir);
|
||||||
|
const targetDir = path.resolve(STAGING_DIR, dir);
|
||||||
|
|
||||||
|
if (!fs.existsSync(targetDir)) {
|
||||||
|
fs.mkdirSync(targetDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const file of fs.readdirSync(absDir)) {
|
||||||
|
if (!file.endsWith('.yml')) {
|
||||||
|
if (fs.statSync(path.resolve(absDir, file)).isDirectory()) {
|
||||||
|
copyAndExpand(path.join(dir, file));
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync(path.resolve(targetDir, file), yaml.dump(yaml.load(fs.readFileSync(path.resolve(absDir, file), 'utf8')), {
|
||||||
|
noRefs: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs.pathExists(STAGING_DIR)) fs.removeSync(STAGING_DIR);
|
||||||
|
copyAndExpand();
|
||||||
|
|
||||||
|
const output = cp.spawnSync(process.env.CIRCLECI_BINARY || 'circleci', ['config', 'pack', STAGING_DIR]);
|
||||||
|
fs.writeFileSync(path.resolve(STAGING_DIR, 'built.yml'), output.stdout.toString());
|
||||||
51
.circleci/config/jobs/lint.yml
Normal file
51
.circleci/config/jobs/lint.yml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
executor:
|
||||||
|
name: linux-docker
|
||||||
|
size: medium
|
||||||
|
steps:
|
||||||
|
- checkout:
|
||||||
|
path: src/electron
|
||||||
|
- run:
|
||||||
|
name: Setup third_party Depot Tools
|
||||||
|
command: |
|
||||||
|
# "depot_tools" has to be checkout into "//third_party/depot_tools" so pylint.py can a "pylintrc" file.
|
||||||
|
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git src/third_party/depot_tools
|
||||||
|
echo 'export PATH="$PATH:'"$PWD"'/src/third_party/depot_tools"' >> $BASH_ENV
|
||||||
|
- run:
|
||||||
|
name: Download GN Binary
|
||||||
|
command: |
|
||||||
|
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
||||||
|
gn_version="$(curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/DEPS?format=TEXT" | base64 -d | grep gn_version | head -n1 | cut -d\' -f4)"
|
||||||
|
|
||||||
|
cipd ensure -ensure-file - -root . \<<-CIPD
|
||||||
|
\$ServiceURL https://chrome-infra-packages.appspot.com/
|
||||||
|
@Subdir src/buildtools/linux64
|
||||||
|
gn/gn/linux-amd64 $gn_version
|
||||||
|
CIPD
|
||||||
|
|
||||||
|
echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/src/buildtools"' >> $BASH_ENV
|
||||||
|
- run:
|
||||||
|
name: Download clang-format Binary
|
||||||
|
command: |
|
||||||
|
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
|
||||||
|
|
||||||
|
sha1_path='buildtools/linux64/clang-format.sha1'
|
||||||
|
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/${sha1_path}?format=TEXT" | base64 -d > "src/${sha1_path}"
|
||||||
|
|
||||||
|
download_from_google_storage.py --no_resume --no_auth --bucket chromium-clang-format -s "src/${sha1_path}"
|
||||||
|
- run:
|
||||||
|
name: Run Lint
|
||||||
|
command: |
|
||||||
|
# gn.py tries to find a gclient root folder starting from the current dir.
|
||||||
|
# When it fails and returns "None" path, the whole script fails. Let's "fix" it.
|
||||||
|
touch .gclient
|
||||||
|
# Another option would be to checkout "buildtools" inside the Electron checkout,
|
||||||
|
# but then we would lint its contents (at least gn format), and it doesn't pass it.
|
||||||
|
|
||||||
|
cd src/electron
|
||||||
|
node script/yarn install --frozen-lockfile
|
||||||
|
node script/yarn lint
|
||||||
|
- run:
|
||||||
|
name: Run Script Typechecker
|
||||||
|
command: |
|
||||||
|
cd src/electron
|
||||||
|
node script/yarn tsc -p tsconfig.script.json
|
||||||
10
.circleci/config/package.json
Normal file
10
.circleci/config/package.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "@electron/circleci-config",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"fs-extra": "^10.1.0",
|
||||||
|
"js-yaml": "^4.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
43
.circleci/config/yarn.lock
Normal file
43
.circleci/config/yarn.lock
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
argparse@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
|
||||||
|
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
|
||||||
|
|
||||||
|
fs-extra@^10.1.0:
|
||||||
|
version "10.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
|
||||||
|
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
|
||||||
|
dependencies:
|
||||||
|
graceful-fs "^4.2.0"
|
||||||
|
jsonfile "^6.0.1"
|
||||||
|
universalify "^2.0.0"
|
||||||
|
|
||||||
|
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
|
||||||
|
version "4.2.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
|
||||||
|
integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==
|
||||||
|
|
||||||
|
js-yaml@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
|
||||||
|
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
|
||||||
|
dependencies:
|
||||||
|
argparse "^2.0.1"
|
||||||
|
|
||||||
|
jsonfile@^6.0.1:
|
||||||
|
version "6.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
|
||||||
|
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
|
||||||
|
dependencies:
|
||||||
|
universalify "^2.0.0"
|
||||||
|
optionalDependencies:
|
||||||
|
graceful-fs "^4.1.6"
|
||||||
|
|
||||||
|
universalify@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
|
||||||
|
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
|
||||||
@@ -4,14 +4,13 @@ Welcome to the Codespaces Electron Developer Environment.
|
|||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
Upon creation of your codespace you should have [build tools](https://github.com/electron/build-tools) installed and an initialized gclient checkout of Electron. In order to build electron you'll need to run the following commands.
|
Upon creation of your codespace you should have [build tools](https://github.com/electron/build-tools) installed and an initialized gclient checkout of Electron. In order to build electron you'll need to run the following command.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
e sync -vv
|
|
||||||
e build
|
e build
|
||||||
```
|
```
|
||||||
|
|
||||||
The initial sync will take approximately ~30 minutes and the build will take ~8 minutes. Incremental syncs and incremental builds are substantially quicker.
|
The initial build will take ~8 minutes. Incremental builds are substantially quicker. If you pull changes from upstream that touch either the `patches` folder or the `DEPS` folder you will have to run `e sync` in order to keep your checkout up to date.
|
||||||
|
|
||||||
## Directory Structure
|
## Directory Structure
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"dockerComposeFile": "docker-compose.yml",
|
"dockerComposeFile": "docker-compose.yml",
|
||||||
"service": "buildtools",
|
"service": "buildtools",
|
||||||
"onCreateCommand": ".devcontainer/on-create-command.sh",
|
"onCreateCommand": ".devcontainer/on-create-command.sh",
|
||||||
|
"updateContentCommand": ".devcontainer/update-content-command.sh",
|
||||||
"workspaceFolder": "/workspaces/gclient/src/electron",
|
"workspaceFolder": "/workspaces/gclient/src/electron",
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"joeleinbinder.mojom-language",
|
"joeleinbinder.mojom-language",
|
||||||
@@ -11,14 +12,28 @@
|
|||||||
"mutantdino.resourcemonitor",
|
"mutantdino.resourcemonitor",
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"shakram02.bash-beautify",
|
"shakram02.bash-beautify",
|
||||||
"marshallofsound.gnls-electron"
|
"marshallofsound.gnls-electron",
|
||||||
|
"CircleCI.circleci"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"editor.tabSize": 2,
|
||||||
|
"bashBeautify.tabSize": 2,
|
||||||
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"[gn]": {
|
"[gn]": {
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
},
|
},
|
||||||
"editor.tabSize": 2,
|
"[javascript]": {
|
||||||
"bashBeautify.tabSize": 2
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll.eslint": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll.eslint": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"javascript.preferences.quoteStyle": "single",
|
||||||
|
"typescript.preferences.quoteStyle": "single"
|
||||||
},
|
},
|
||||||
"forwardPorts": [8088, 6080, 5901],
|
"forwardPorts": [8088, 6080, 5901],
|
||||||
"portsAttributes": {
|
"portsAttributes": {
|
||||||
@@ -36,8 +51,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"hostRequirements": {
|
"hostRequirements": {
|
||||||
"storage": "32gb",
|
"storage": "128gb",
|
||||||
"cpus": 8
|
"cpus": 16
|
||||||
},
|
},
|
||||||
"remoteUser": "builduser"
|
"remoteUser": "builduser",
|
||||||
|
"customizations": {
|
||||||
|
"codespaces": {
|
||||||
|
"openFiles": [
|
||||||
|
".devcontainer/README.md"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ version: '3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
buildtools:
|
buildtools:
|
||||||
image: ghcr.io/electron/devcontainer:27db4a3e3512bfd2e47f58cea69922da0835f1d9
|
image: ghcr.io/electron/devcontainer:3d8d44d0f15b05bef6149e448f9cc522111847e9
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ..:/workspaces/gclient/src/electron:cached
|
- ..:/workspaces/gclient/src/electron:cached
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export PATH="$PATH:$buildtools/src"
|
|||||||
|
|
||||||
# Create the persisted buildtools config folder
|
# Create the persisted buildtools config folder
|
||||||
mkdir -p $buildtools_configs
|
mkdir -p $buildtools_configs
|
||||||
|
mkdir -p $gclient_root/.git-cache
|
||||||
rm -f $buildtools/configs
|
rm -f $buildtools/configs
|
||||||
ln -s $buildtools_configs $buildtools/configs
|
ln -s $buildtools_configs $buildtools/configs
|
||||||
|
|
||||||
|
|||||||
10
.devcontainer/update-content-command.sh
Executable file
10
.devcontainer/update-content-command.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
buildtools=$HOME/.electron_build_tools
|
||||||
|
|
||||||
|
export PATH="$PATH:$buildtools/src"
|
||||||
|
|
||||||
|
# Sync latest
|
||||||
|
e d gclient sync --with_branch_heads --with_tags
|
||||||
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -4,7 +4,7 @@
|
|||||||
# https://git-scm.com/docs/gitignore
|
# https://git-scm.com/docs/gitignore
|
||||||
|
|
||||||
# Upgrades WG
|
# Upgrades WG
|
||||||
/patches/ @electron/wg-upgrades @electron/wg-security
|
/patches/ @electron/patch-owners
|
||||||
DEPS @electron/wg-upgrades
|
DEPS @electron/wg-upgrades
|
||||||
|
|
||||||
# Releases WG
|
# Releases WG
|
||||||
|
|||||||
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,4 +1,5 @@
|
|||||||
#### Description of Change
|
#### Description of Change
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Thank you for your Pull Request. Please provide a description above and review
|
Thank you for your Pull Request. Please provide a description above and review
|
||||||
the requirements below.
|
the requirements below.
|
||||||
@@ -12,7 +13,7 @@ Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.
|
|||||||
- [ ] PR description included and stakeholders cc'd
|
- [ ] PR description included and stakeholders cc'd
|
||||||
- [ ] `npm test` passes
|
- [ ] `npm test` passes
|
||||||
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
|
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
|
||||||
- [ ] relevant documentation is changed or added
|
- [ ] relevant documentation, tutorials, templates and examples are changed or added
|
||||||
- [ ] [PR release notes](https://github.com/electron/clerk/blob/master/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/master/README.md#examples).
|
- [ ] [PR release notes](https://github.com/electron/clerk/blob/master/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/master/README.md#examples).
|
||||||
|
|
||||||
#### Release Notes
|
#### Release Notes
|
||||||
|
|||||||
2
.github/semantic.yml
vendored
2
.github/semantic.yml
vendored
@@ -1,2 +0,0 @@
|
|||||||
# Always validate the PR title, and ignore the commits
|
|
||||||
titleOnly: true
|
|
||||||
30
.github/workflows/issue-labeled.yml
vendored
Normal file
30
.github/workflows/issue-labeled.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
name: Issue Labeled
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [labeled]
|
||||||
|
|
||||||
|
permissions: # added using https://github.com/step-security/secure-workflows
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
issue-labeled:
|
||||||
|
permissions:
|
||||||
|
issues: write # for actions-cool/issues-helper to update issues
|
||||||
|
pull-requests: write # for actions-cool/issues-helper to update PRs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: blocked/need-repro
|
||||||
|
if: github.event.label.name == 'blocked/need-repro'
|
||||||
|
uses: actions-cool/issues-helper@dad28fdb88da5f082c04659b7373d85790f9b135 # v3.3.0
|
||||||
|
with:
|
||||||
|
actions: 'create-comment'
|
||||||
|
body: |
|
||||||
|
Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
|
||||||
|
|
||||||
|
Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, [Electron Fiddle](https://www.electronjs.org/fiddle) is a great tool for making small test cases and makes it easy to publish your test case to a [gist](https://gist.github.com) that Electron maintainers can use.
|
||||||
|
|
||||||
|
Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.
|
||||||
|
|
||||||
|
Now adding the `blocked/need-repro` label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
|
||||||
|
|
||||||
33
.github/workflows/release_dependency_versions.yml
vendored
Normal file
33
.github/workflows/release_dependency_versions.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: Trigger Major Release Dependency Updates
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trigger_chromedriver:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag: v3
|
||||||
|
- name: Trigger New chromedriver Release
|
||||||
|
run: |
|
||||||
|
if [[ ${{ github.event.release.tag_name }} =~ ^v\d+\.\d+\.\d+$ ]]; then
|
||||||
|
gh api /repos/:owner/chromedriver/actions/workflows/release.yml/dispatches --input - <<< '{"ref":"main","inputs":{"version":"${{ github.event.release.tag_name }}"}}'
|
||||||
|
else
|
||||||
|
echo "Not releasing for version ${{ github.event.release.tag_name }}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
trigger_mksnapshot:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag: v3
|
||||||
|
- name: Trigger New mksnapshot Release
|
||||||
|
run: |
|
||||||
|
if [[ ${{ github.event.release.tag_name }} =~ ^v\d+\.\d+\.\d+$ ]]; then
|
||||||
|
gh api /repos/:owner/mksnapshot/actions/workflows/release.yml/dispatches --input - <<< '{"ref":"main","inputs":{"version":"${{ github.event.release.tag_name }}"}}'
|
||||||
|
else
|
||||||
|
echo "Not releasing for version ${{ github.event.release.tag_name }}"
|
||||||
|
fi
|
||||||
54
.github/workflows/scorecards.yml
vendored
Normal file
54
.github/workflows/scorecards.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
name: Scorecards supply-chain security
|
||||||
|
on:
|
||||||
|
# Only the default branch is supported.
|
||||||
|
branch_protection_rule:
|
||||||
|
schedule:
|
||||||
|
- cron: '44 17 * * 0'
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
# Declare default permissions as read only.
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analysis:
|
||||||
|
name: Scorecards analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
# Needed to upload the results to code-scanning dashboard.
|
||||||
|
security-events: write
|
||||||
|
# Used to receive a badge.
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "Checkout code"
|
||||||
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3.0.0
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: "Run analysis"
|
||||||
|
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # tag=v2.0.6
|
||||||
|
with:
|
||||||
|
results_file: results.sarif
|
||||||
|
results_format: sarif
|
||||||
|
|
||||||
|
# Publish the results for public repositories to enable scorecard badges. For more details, see
|
||||||
|
# https://github.com/ossf/scorecard-action#publishing-results.
|
||||||
|
# For private repositories, `publish_results` will automatically be set to `false`, regardless
|
||||||
|
# of the value entered here.
|
||||||
|
publish_results: true
|
||||||
|
|
||||||
|
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||||
|
# format to the repository Actions tab.
|
||||||
|
- name: "Upload artifact"
|
||||||
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # tag=v3.0.0
|
||||||
|
with:
|
||||||
|
name: SARIF file
|
||||||
|
path: results.sarif
|
||||||
|
retention-days: 5
|
||||||
|
|
||||||
|
# Upload the results to GitHub's code scanning dashboard.
|
||||||
|
- name: "Upload to code-scanning"
|
||||||
|
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # tag=v1.0.26
|
||||||
|
with:
|
||||||
|
sarif_file: results.sarif
|
||||||
26
.github/workflows/semantic.yml
vendored
Normal file
26
.github/workflows/semantic.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: "Check Semantic Commit"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- edited
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
permissions:
|
||||||
|
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
|
||||||
|
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
|
||||||
|
name: Validate PR Title
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: semantic-pull-request
|
||||||
|
uses: amannn/action-semantic-pull-request@505e44b4f33b4c801f063838b3f053990ee46ea7 # tag: v4
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
validateSingleCommit: false
|
||||||
25
.github/workflows/stale.yml
vendored
Normal file
25
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: 'Close stale issues'
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# 1:30am every day
|
||||||
|
- cron: '30 1 * * *'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
stale:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/stale@3de2653986ebd134983c79fe2be5d45cc3d9f4e1
|
||||||
|
with:
|
||||||
|
days-before-stale: 90
|
||||||
|
days-before-close: 30
|
||||||
|
stale-issue-label: stale
|
||||||
|
operations-per-run: 1750
|
||||||
|
stale-issue-message: >
|
||||||
|
This issue has been automatically marked as stale. **If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the [latest version of Electron](https://www.electronjs.org/releases/stable) or in the [beta](https://www.electronjs.org/releases/beta)—please include it with your comment!
|
||||||
|
close-issue-message: >
|
||||||
|
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a [supported version of Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline) please open a new issue and include instructions for reproducing the issue.
|
||||||
|
exempt-issue-labels: "discussion,security \U0001F512,enhancement :sparkles:"
|
||||||
|
only-pr-labels: not-a-real-label
|
||||||
62
.github/workflows/update_appveyor_image.yml
vendored
Normal file
62
.github/workflows/update_appveyor_image.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
name: Update AppVeyor Image
|
||||||
|
|
||||||
|
# Run chron daily Mon-Fri
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 8 * * 1-5' # runs 8:00 every business day (see https://crontab.guru)
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bake-appveyor-image:
|
||||||
|
name: Bake AppVeyor Image
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write # to create a new PR with updated Appveyor images
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Yarn install
|
||||||
|
run: |
|
||||||
|
node script/yarn.js install --frozen-lockfile
|
||||||
|
- name: Set Repo for Commit
|
||||||
|
run: git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||||
|
- name: Check AppVeyor Image
|
||||||
|
env:
|
||||||
|
APPVEYOR_TOKEN: ${{ secrets.APPVEYOR_TOKEN }}
|
||||||
|
run: |
|
||||||
|
node ./script/prepare-appveyor
|
||||||
|
if [ -f ./image_version.txt ]; then
|
||||||
|
echo "APPVEYOR_IMAGE_VERSION="$(cat image_version.txt)"" >> $GITHUB_ENV
|
||||||
|
rm image_version.txt
|
||||||
|
fi
|
||||||
|
- name: (Optionally) Update Appveyor Image
|
||||||
|
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
||||||
|
uses: mikefarah/yq@1c7dc0e88aad311c89889bc5ce5d8f96931a1bd0 # v4.27.2
|
||||||
|
with:
|
||||||
|
cmd: yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml"
|
||||||
|
- name: (Optionally) Generate Commit Diff
|
||||||
|
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
||||||
|
run: |
|
||||||
|
diff -w -B appveyor.yml appveyor2.yml > appveyor.diff || true
|
||||||
|
patch -f appveyor.yml < appveyor.diff
|
||||||
|
rm appveyor2.yml appveyor.diff
|
||||||
|
- name: (Optionally) Commit and Pull Request
|
||||||
|
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
||||||
|
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
|
||||||
|
commit-message: 'build: update appveyor image to latest version'
|
||||||
|
committer: GitHub <noreply@github.com>
|
||||||
|
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||||
|
signoff: false
|
||||||
|
branch: bump-appveyor-image
|
||||||
|
delete-branch: true
|
||||||
|
title: 'build: update appveyor image to latest version'
|
||||||
|
body: |
|
||||||
|
This PR updates appveyor.yml to the latest baked image, ${{ env.APPVEYOR_IMAGE_VERSION }}.
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -41,7 +41,7 @@ spec/.hash
|
|||||||
.eslintcache*
|
.eslintcache*
|
||||||
|
|
||||||
# Generated native addon files
|
# 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
|
# If someone runs tsc this is where stuff will end up
|
||||||
ts-gen
|
ts-gen
|
||||||
@@ -53,4 +53,4 @@ ts-gen
|
|||||||
# Used to accelerate builds after sync
|
# Used to accelerate builds after sync
|
||||||
patches/mtime-cache.json
|
patches/mtime-cache.json
|
||||||
|
|
||||||
spec/fixtures/logo.png
|
spec/fixtures/logo.png
|
||||||
|
|||||||
1
.husky/.gitignore
vendored
1
.husky/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
_
|
|
||||||
@@ -23,7 +23,5 @@
|
|||||||
"br_spaces": 0
|
"br_spaces": 0
|
||||||
},
|
},
|
||||||
"single-h1": false,
|
"single-h1": false,
|
||||||
"no-inline-html": {
|
"no-inline-html": false
|
||||||
"allowed_elements": ["br"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
282
BUILD.gn
282
BUILD.gn
@@ -37,12 +37,13 @@ if (is_mac) {
|
|||||||
import("build/rules.gni")
|
import("build/rules.gni")
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
mac_deployment_target == "10.11.0",
|
mac_deployment_target == "10.13",
|
||||||
"Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change")
|
"Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_linux) {
|
if (is_linux) {
|
||||||
import("//build/config/linux/pkg_config.gni")
|
import("//build/config/linux/pkg_config.gni")
|
||||||
|
import("//tools/generate_stubs/rules.gni")
|
||||||
|
|
||||||
pkg_config("gio_unix") {
|
pkg_config("gio_unix") {
|
||||||
packages = [ "gio-unix-2.0" ]
|
packages = [ "gio-unix-2.0" ]
|
||||||
@@ -54,6 +55,48 @@ if (is_linux) {
|
|||||||
"gdk-pixbuf-2.0",
|
"gdk-pixbuf-2.0",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generate_library_loader("libnotify_loader") {
|
||||||
|
name = "LibNotifyLoader"
|
||||||
|
output_h = "libnotify_loader.h"
|
||||||
|
output_cc = "libnotify_loader.cc"
|
||||||
|
header = "<libnotify/notify.h>"
|
||||||
|
config = ":libnotify_config"
|
||||||
|
|
||||||
|
functions = [
|
||||||
|
"notify_is_initted",
|
||||||
|
"notify_init",
|
||||||
|
"notify_get_server_caps",
|
||||||
|
"notify_get_server_info",
|
||||||
|
"notify_notification_new",
|
||||||
|
"notify_notification_add_action",
|
||||||
|
"notify_notification_set_image_from_pixbuf",
|
||||||
|
"notify_notification_set_timeout",
|
||||||
|
"notify_notification_set_urgency",
|
||||||
|
"notify_notification_set_hint_string",
|
||||||
|
"notify_notification_show",
|
||||||
|
"notify_notification_close",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Generates electron_gtk_stubs.h header which contains
|
||||||
|
# stubs for extracting function ptrs from the gtk library.
|
||||||
|
# Function signatures for which stubs are required should be
|
||||||
|
# declared in electron_gtk.sigs, currently this file contains
|
||||||
|
# signatures for the functions used with native file chooser
|
||||||
|
# implementation. In future, this file can be extended to contain
|
||||||
|
# gtk4 stubs to switch gtk version in runtime.
|
||||||
|
generate_stubs("electron_gtk_stubs") {
|
||||||
|
sigs = [
|
||||||
|
"shell/browser/ui/electron_gdk_pixbuf.sigs",
|
||||||
|
"shell/browser/ui/electron_gtk.sigs",
|
||||||
|
]
|
||||||
|
extra_header = "shell/browser/ui/electron_gtk.fragment"
|
||||||
|
output_name = "electron_gtk_stubs"
|
||||||
|
public_deps = [ "//ui/gtk:gtk_config" ]
|
||||||
|
logging_function = "LogNoop()"
|
||||||
|
logging_include = "ui/gtk/log_noop.h"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_args() {
|
declare_args() {
|
||||||
@@ -64,6 +107,14 @@ branding = read_file("shell/app/BRANDING.json", "json")
|
|||||||
electron_project_name = branding.project_name
|
electron_project_name = branding.project_name
|
||||||
electron_product_name = branding.product_name
|
electron_product_name = branding.product_name
|
||||||
electron_mac_bundle_id = branding.mac_bundle_id
|
electron_mac_bundle_id = branding.mac_bundle_id
|
||||||
|
electron_version = exec_script("script/print-version.py",
|
||||||
|
[],
|
||||||
|
"trim string",
|
||||||
|
[
|
||||||
|
".git/packed-refs",
|
||||||
|
".git/HEAD",
|
||||||
|
"script/lib/get-version.js",
|
||||||
|
])
|
||||||
|
|
||||||
if (is_mas_build) {
|
if (is_mas_build) {
|
||||||
assert(is_mac,
|
assert(is_mac,
|
||||||
@@ -92,7 +143,7 @@ config("electron_lib_config") {
|
|||||||
include_dirs = [ "." ]
|
include_dirs = [ "." ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# We geneate the definitions twice here, once in //electron/electron.d.ts
|
# We generate the definitions twice here, once in //electron/electron.d.ts
|
||||||
# and once in $target_gen_dir
|
# and once in $target_gen_dir
|
||||||
# The one in $target_gen_dir is used for the actual TSC build later one
|
# The one in $target_gen_dir is used for the actual TSC build later one
|
||||||
# and the one in //electron/electron.d.ts is used by your IDE (vscode)
|
# and the one in //electron/electron.d.ts is used by your IDE (vscode)
|
||||||
@@ -159,6 +210,15 @@ webpack_build("electron_isolated_renderer_bundle") {
|
|||||||
out_file = "$target_gen_dir/js2c/isolated_bundle.js"
|
out_file = "$target_gen_dir/js2c/isolated_bundle.js"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
webpack_build("electron_utility_bundle") {
|
||||||
|
deps = [ ":build_electron_definitions" ]
|
||||||
|
|
||||||
|
inputs = auto_filenames.utility_bundle_deps
|
||||||
|
|
||||||
|
config_file = "//electron/build/webpack/webpack.config.utility.js"
|
||||||
|
out_file = "$target_gen_dir/js2c/utility_init.js"
|
||||||
|
}
|
||||||
|
|
||||||
action("electron_js2c") {
|
action("electron_js2c") {
|
||||||
deps = [
|
deps = [
|
||||||
":electron_asar_bundle",
|
":electron_asar_bundle",
|
||||||
@@ -166,6 +226,7 @@ action("electron_js2c") {
|
|||||||
":electron_isolated_renderer_bundle",
|
":electron_isolated_renderer_bundle",
|
||||||
":electron_renderer_bundle",
|
":electron_renderer_bundle",
|
||||||
":electron_sandboxed_renderer_bundle",
|
":electron_sandboxed_renderer_bundle",
|
||||||
|
":electron_utility_bundle",
|
||||||
":electron_worker_bundle",
|
":electron_worker_bundle",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -175,6 +236,7 @@ action("electron_js2c") {
|
|||||||
"$target_gen_dir/js2c/isolated_bundle.js",
|
"$target_gen_dir/js2c/isolated_bundle.js",
|
||||||
"$target_gen_dir/js2c/renderer_init.js",
|
"$target_gen_dir/js2c/renderer_init.js",
|
||||||
"$target_gen_dir/js2c/sandbox_bundle.js",
|
"$target_gen_dir/js2c/sandbox_bundle.js",
|
||||||
|
"$target_gen_dir/js2c/utility_init.js",
|
||||||
"$target_gen_dir/js2c/worker_init.js",
|
"$target_gen_dir/js2c/worker_init.js",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -190,6 +252,7 @@ action("electron_js2c") {
|
|||||||
action("generate_config_gypi") {
|
action("generate_config_gypi") {
|
||||||
outputs = [ "$root_gen_dir/config.gypi" ]
|
outputs = [ "$root_gen_dir/config.gypi" ]
|
||||||
script = "script/generate-config-gypi.py"
|
script = "script/generate-config-gypi.py"
|
||||||
|
inputs = [ "//third_party/electron_node/configure.py" ]
|
||||||
args = rebase_path(outputs) + [ target_cpu ]
|
args = rebase_path(outputs) + [ target_cpu ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,42 +316,14 @@ copy("copy_shell_devtools_discovery_page") {
|
|||||||
outputs = [ "$target_gen_dir/shell_devtools_discovery_page.html" ]
|
outputs = [ "$target_gen_dir/shell_devtools_discovery_page.html" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_linux) {
|
|
||||||
generate_library_loader("libnotify_loader") {
|
|
||||||
name = "LibNotifyLoader"
|
|
||||||
output_h = "libnotify_loader.h"
|
|
||||||
output_cc = "libnotify_loader.cc"
|
|
||||||
header = "<libnotify/notify.h>"
|
|
||||||
config = ":libnotify_config"
|
|
||||||
|
|
||||||
functions = [
|
|
||||||
"notify_is_initted",
|
|
||||||
"notify_init",
|
|
||||||
"notify_get_server_caps",
|
|
||||||
"notify_get_server_info",
|
|
||||||
"notify_notification_new",
|
|
||||||
"notify_notification_add_action",
|
|
||||||
"notify_notification_set_image_from_pixbuf",
|
|
||||||
"notify_notification_set_timeout",
|
|
||||||
"notify_notification_set_urgency",
|
|
||||||
"notify_notification_set_hint_string",
|
|
||||||
"notify_notification_show",
|
|
||||||
"notify_notification_close",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
npm_action("electron_version_args") {
|
npm_action("electron_version_args") {
|
||||||
script = "generate-version-json"
|
script = "generate-version-json"
|
||||||
|
|
||||||
outputs = [ "$target_gen_dir/electron_version.args" ]
|
outputs = [ "$target_gen_dir/electron_version.args" ]
|
||||||
|
|
||||||
args = rebase_path(outputs)
|
args = rebase_path(outputs) + [ "$electron_version" ]
|
||||||
|
|
||||||
inputs = [
|
inputs = [ "script/generate-version-json.js" ]
|
||||||
"ELECTRON_VERSION",
|
|
||||||
"script/generate-version-json.js",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
templated_file("electron_version_header") {
|
templated_file("electron_version_header") {
|
||||||
@@ -300,6 +335,39 @@ templated_file("electron_version_header") {
|
|||||||
args_files = get_target_outputs(":electron_version_args")
|
args_files = get_target_outputs(":electron_version_args")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
templated_file("electron_win_rc") {
|
||||||
|
deps = [ ":electron_version_args" ]
|
||||||
|
|
||||||
|
template = "build/templates/electron_rc.tmpl"
|
||||||
|
output = "$target_gen_dir/win-resources/electron.rc"
|
||||||
|
|
||||||
|
args_files = get_target_outputs(":electron_version_args")
|
||||||
|
}
|
||||||
|
|
||||||
|
copy("electron_win_resource_files") {
|
||||||
|
sources = [
|
||||||
|
"shell/browser/resources/win/electron.ico",
|
||||||
|
"shell/browser/resources/win/resource.h",
|
||||||
|
]
|
||||||
|
outputs = [ "$target_gen_dir/win-resources/{{source_file_part}}" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
templated_file("electron_version_file") {
|
||||||
|
deps = [ ":electron_version_args" ]
|
||||||
|
|
||||||
|
template = "build/templates/version_string.tmpl"
|
||||||
|
output = "$root_build_dir/version"
|
||||||
|
|
||||||
|
args_files = get_target_outputs(":electron_version_args")
|
||||||
|
}
|
||||||
|
|
||||||
|
group("electron_win32_resources") {
|
||||||
|
public_deps = [
|
||||||
|
":electron_win_rc",
|
||||||
|
":electron_win_resource_files",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
action("electron_fuses") {
|
action("electron_fuses") {
|
||||||
script = "build/fuses/build.py"
|
script = "build/fuses/build.py"
|
||||||
|
|
||||||
@@ -349,12 +417,15 @@ source_set("electron_lib") {
|
|||||||
"chromium_src:chrome",
|
"chromium_src:chrome",
|
||||||
"chromium_src:chrome_spellchecker",
|
"chromium_src:chrome_spellchecker",
|
||||||
"shell/common/api:mojo",
|
"shell/common/api:mojo",
|
||||||
|
"shell/services/node/public/mojom",
|
||||||
"//base:base_static",
|
"//base:base_static",
|
||||||
"//base/allocator:buildflags",
|
"//base/allocator:buildflags",
|
||||||
|
"//chrome:strings",
|
||||||
"//chrome/app:command_ids",
|
"//chrome/app:command_ids",
|
||||||
"//chrome/app/resources:platform_locale_settings",
|
"//chrome/app/resources:platform_locale_settings",
|
||||||
"//components/autofill/core/common:features",
|
"//components/autofill/core/common:features",
|
||||||
"//components/certificate_transparency",
|
"//components/certificate_transparency",
|
||||||
|
"//components/embedder_support:browser_util",
|
||||||
"//components/language/core/browser",
|
"//components/language/core/browser",
|
||||||
"//components/net_log",
|
"//components/net_log",
|
||||||
"//components/network_hints/browser",
|
"//components/network_hints/browser",
|
||||||
@@ -363,10 +434,6 @@ source_set("electron_lib") {
|
|||||||
"//components/network_session_configurator/common",
|
"//components/network_session_configurator/common",
|
||||||
"//components/omnibox/browser:buildflags",
|
"//components/omnibox/browser:buildflags",
|
||||||
"//components/os_crypt",
|
"//components/os_crypt",
|
||||||
"//components/pdf/browser",
|
|
||||||
"//components/pdf/browser:interceptors",
|
|
||||||
"//components/pdf/common",
|
|
||||||
"//components/pdf/renderer",
|
|
||||||
"//components/pref_registry",
|
"//components/pref_registry",
|
||||||
"//components/prefs",
|
"//components/prefs",
|
||||||
"//components/security_state/content",
|
"//components/security_state/content",
|
||||||
@@ -374,6 +441,7 @@ source_set("electron_lib") {
|
|||||||
"//components/user_prefs",
|
"//components/user_prefs",
|
||||||
"//components/viz/host",
|
"//components/viz/host",
|
||||||
"//components/viz/service",
|
"//components/viz/service",
|
||||||
|
"//components/webrtc",
|
||||||
"//content/public/browser",
|
"//content/public/browser",
|
||||||
"//content/public/child",
|
"//content/public/child",
|
||||||
"//content/public/gpu",
|
"//content/public/gpu",
|
||||||
@@ -386,9 +454,6 @@ source_set("electron_lib") {
|
|||||||
"//media/mojo/mojom",
|
"//media/mojo/mojom",
|
||||||
"//net:extras",
|
"//net:extras",
|
||||||
"//net:net_resources",
|
"//net:net_resources",
|
||||||
"//ppapi/host",
|
|
||||||
"//ppapi/proxy",
|
|
||||||
"//ppapi/shared_impl",
|
|
||||||
"//printing/buildflags",
|
"//printing/buildflags",
|
||||||
"//services/device/public/cpp/geolocation",
|
"//services/device/public/cpp/geolocation",
|
||||||
"//services/device/public/cpp/hid",
|
"//services/device/public/cpp/hid",
|
||||||
@@ -447,6 +512,8 @@ source_set("electron_lib") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configs += [ "//electron/build/config:mas_build" ]
|
||||||
|
|
||||||
sources = filenames.lib_sources
|
sources = filenames.lib_sources
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
sources += filenames.lib_sources_win
|
sources += filenames.lib_sources_win
|
||||||
@@ -475,13 +542,6 @@ source_set("electron_lib") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_linux) {
|
|
||||||
deps += [
|
|
||||||
"//components/crash/content/browser",
|
|
||||||
"//ui/gtk:gtk_config",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_mac) {
|
if (is_mac) {
|
||||||
deps += [
|
deps += [
|
||||||
"//components/remote_cocoa/app_shim",
|
"//components/remote_cocoa/app_shim",
|
||||||
@@ -515,7 +575,6 @@ source_set("electron_lib") {
|
|||||||
if (is_mas_build) {
|
if (is_mas_build) {
|
||||||
sources += [ "shell/browser/api/electron_api_app_mas.mm" ]
|
sources += [ "shell/browser/api/electron_api_app_mas.mm" ]
|
||||||
sources -= [ "shell/browser/auto_updater_mac.mm" ]
|
sources -= [ "shell/browser/auto_updater_mac.mm" ]
|
||||||
defines += [ "MAS_BUILD" ]
|
|
||||||
sources -= [
|
sources -= [
|
||||||
"shell/app/electron_crash_reporter_client.cc",
|
"shell/app/electron_crash_reporter_client.cc",
|
||||||
"shell/app/electron_crash_reporter_client.h",
|
"shell/app/electron_crash_reporter_client.h",
|
||||||
@@ -541,14 +600,19 @@ source_set("electron_lib") {
|
|||||||
if (is_linux) {
|
if (is_linux) {
|
||||||
libs = [ "xshmfence" ]
|
libs = [ "xshmfence" ]
|
||||||
deps += [
|
deps += [
|
||||||
|
":electron_gtk_stubs",
|
||||||
":libnotify_loader",
|
":libnotify_loader",
|
||||||
"//build/config/linux/gtk",
|
"//build/config/linux/gtk",
|
||||||
|
"//components/crash/content/browser",
|
||||||
"//dbus",
|
"//dbus",
|
||||||
"//device/bluetooth",
|
"//device/bluetooth",
|
||||||
|
"//third_party/crashpad/crashpad/client",
|
||||||
"//ui/base/ime/linux",
|
"//ui/base/ime/linux",
|
||||||
"//ui/events/devices/x11",
|
"//ui/events/devices/x11",
|
||||||
"//ui/events/platform/x11",
|
"//ui/events/platform/x11",
|
||||||
"//ui/gtk",
|
"//ui/gtk:gtk_config",
|
||||||
|
"//ui/linux:linux_ui",
|
||||||
|
"//ui/linux:linux_ui_factory",
|
||||||
"//ui/views/controls/webview",
|
"//ui/views/controls/webview",
|
||||||
"//ui/wm",
|
"//ui/wm",
|
||||||
]
|
]
|
||||||
@@ -568,16 +632,6 @@ source_set("electron_lib") {
|
|||||||
sources += [
|
sources += [
|
||||||
"shell/browser/certificate_manager_model.cc",
|
"shell/browser/certificate_manager_model.cc",
|
||||||
"shell/browser/certificate_manager_model.h",
|
"shell/browser/certificate_manager_model.h",
|
||||||
"shell/browser/ui/gtk/app_indicator_icon.cc",
|
|
||||||
"shell/browser/ui/gtk/app_indicator_icon.h",
|
|
||||||
"shell/browser/ui/gtk/app_indicator_icon_menu.cc",
|
|
||||||
"shell/browser/ui/gtk/app_indicator_icon_menu.h",
|
|
||||||
"shell/browser/ui/gtk/gtk_status_icon.cc",
|
|
||||||
"shell/browser/ui/gtk/gtk_status_icon.h",
|
|
||||||
"shell/browser/ui/gtk/menu_util.cc",
|
|
||||||
"shell/browser/ui/gtk/menu_util.h",
|
|
||||||
"shell/browser/ui/gtk/status_icon.cc",
|
|
||||||
"shell/browser/ui/gtk/status_icon.h",
|
|
||||||
"shell/browser/ui/gtk_util.cc",
|
"shell/browser/ui/gtk_util.cc",
|
||||||
"shell/browser/ui/gtk_util.h",
|
"shell/browser/ui/gtk_util.h",
|
||||||
]
|
]
|
||||||
@@ -600,11 +654,23 @@ source_set("electron_lib") {
|
|||||||
if (enable_plugins) {
|
if (enable_plugins) {
|
||||||
deps += [ "chromium_src:plugins" ]
|
deps += [ "chromium_src:plugins" ]
|
||||||
sources += [
|
sources += [
|
||||||
|
"shell/common/plugin_info.cc",
|
||||||
|
"shell/common/plugin_info.h",
|
||||||
|
"shell/renderer/electron_renderer_pepper_host_factory.cc",
|
||||||
|
"shell/renderer/electron_renderer_pepper_host_factory.h",
|
||||||
"shell/renderer/pepper_helper.cc",
|
"shell/renderer/pepper_helper.cc",
|
||||||
"shell/renderer/pepper_helper.h",
|
"shell/renderer/pepper_helper.h",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enable_ppapi) {
|
||||||
|
deps += [
|
||||||
|
"//ppapi/host",
|
||||||
|
"//ppapi/proxy",
|
||||||
|
"//ppapi/shared_impl",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
if (enable_run_as_node) {
|
if (enable_run_as_node) {
|
||||||
sources += [
|
sources += [
|
||||||
"shell/app/node_main.cc",
|
"shell/app/node_main.cc",
|
||||||
@@ -652,10 +718,8 @@ source_set("electron_lib") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_basic_printing) {
|
if (enable_printing) {
|
||||||
sources += [
|
sources += [
|
||||||
"shell/browser/printing/print_preview_message_handler.cc",
|
|
||||||
"shell/browser/printing/print_preview_message_handler.h",
|
|
||||||
"shell/browser/printing/print_view_manager_electron.cc",
|
"shell/browser/printing/print_view_manager_electron.cc",
|
||||||
"shell/browser/printing/print_view_manager_electron.h",
|
"shell/browser/printing/print_view_manager_electron.h",
|
||||||
"shell/renderer/printing/print_render_frame_helper_delegate.cc",
|
"shell/renderer/printing/print_render_frame_helper_delegate.cc",
|
||||||
@@ -680,7 +744,7 @@ source_set("electron_lib") {
|
|||||||
"//components/update_client:update_client",
|
"//components/update_client:update_client",
|
||||||
"//components/zoom",
|
"//components/zoom",
|
||||||
"//extensions/browser",
|
"//extensions/browser",
|
||||||
"//extensions/browser:core_api_provider",
|
"//extensions/browser/api:api_provider",
|
||||||
"//extensions/browser/updater",
|
"//extensions/browser/updater",
|
||||||
"//extensions/common",
|
"//extensions/common",
|
||||||
"//extensions/common:core_api_provider",
|
"//extensions/common:core_api_provider",
|
||||||
@@ -700,6 +764,8 @@ source_set("electron_lib") {
|
|||||||
deps += [
|
deps += [
|
||||||
"//chrome/browser/resources/pdf:resources",
|
"//chrome/browser/resources/pdf:resources",
|
||||||
"//components/pdf/browser",
|
"//components/pdf/browser",
|
||||||
|
"//components/pdf/browser:interceptors",
|
||||||
|
"//components/pdf/common",
|
||||||
"//components/pdf/renderer",
|
"//components/pdf/renderer",
|
||||||
"//pdf",
|
"//pdf",
|
||||||
]
|
]
|
||||||
@@ -711,14 +777,6 @@ source_set("electron_lib") {
|
|||||||
|
|
||||||
sources += get_target_outputs(":electron_fuses")
|
sources += get_target_outputs(":electron_fuses")
|
||||||
|
|
||||||
if (is_win && enable_win_dark_mode_window_ui) {
|
|
||||||
sources += [
|
|
||||||
"shell/browser/win/dark_mode.cc",
|
|
||||||
"shell/browser/win/dark_mode.h",
|
|
||||||
]
|
|
||||||
libs += [ "uxtheme.lib" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allow_runtime_configurable_key_storage) {
|
if (allow_runtime_configurable_key_storage) {
|
||||||
defines += [ "ALLOW_RUNTIME_CONFIGURABLE_KEY_STORAGE" ]
|
defines += [ "ALLOW_RUNTIME_CONFIGURABLE_KEY_STORAGE" ]
|
||||||
}
|
}
|
||||||
@@ -738,7 +796,6 @@ if (is_mac) {
|
|||||||
electron_helper_name = "$electron_product_name Helper"
|
electron_helper_name = "$electron_product_name Helper"
|
||||||
electron_login_helper_name = "$electron_product_name Login Helper"
|
electron_login_helper_name = "$electron_product_name Login Helper"
|
||||||
electron_framework_version = "A"
|
electron_framework_version = "A"
|
||||||
electron_version = read_file("ELECTRON_VERSION", "trim string")
|
|
||||||
|
|
||||||
mac_xib_bundle_data("electron_xibs") {
|
mac_xib_bundle_data("electron_xibs") {
|
||||||
sources = [ "shell/common/resources/mac/MainMenu.xib" ]
|
sources = [ "shell/common/resources/mac/MainMenu.xib" ]
|
||||||
@@ -803,16 +860,11 @@ if (is_mac) {
|
|||||||
# Add the SwiftShader .dylibs in the Libraries directory of the Framework.
|
# Add the SwiftShader .dylibs in the Libraries directory of the Framework.
|
||||||
bundle_data("electron_swiftshader_binaries") {
|
bundle_data("electron_swiftshader_binaries") {
|
||||||
sources = [
|
sources = [
|
||||||
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
|
|
||||||
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
|
|
||||||
"$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
|
"$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
|
||||||
"$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
|
"$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
|
||||||
]
|
]
|
||||||
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
|
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
|
||||||
public_deps = [
|
public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ]
|
||||||
"//ui/gl:swiftshader_egl_library_copy",
|
|
||||||
"//ui/gl:swiftshader_vk_library_copy",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
group("electron_angle_library") {
|
group("electron_angle_library") {
|
||||||
@@ -894,6 +946,13 @@ if (is_mac) {
|
|||||||
"@executable_path/../../../../../..",
|
"@executable_path/../../../../../..",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# For component ffmpeg under non-component build, it is linked from
|
||||||
|
# @loader_path. However the ffmpeg.dylib is moved to a different place
|
||||||
|
# when generating app bundle, and we should change to link from @rpath.
|
||||||
|
if (is_component_ffmpeg && !is_component_build) {
|
||||||
|
ldflags += [ "-Wcrl,installnametool,-change,@loader_path/libffmpeg.dylib,@rpath/libffmpeg.dylib" ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template("electron_helper_app") {
|
template("electron_helper_app") {
|
||||||
@@ -901,11 +960,15 @@ if (is_mac) {
|
|||||||
assert(defined(invoker.helper_name_suffix))
|
assert(defined(invoker.helper_name_suffix))
|
||||||
|
|
||||||
output_name = electron_helper_name + invoker.helper_name_suffix
|
output_name = electron_helper_name + invoker.helper_name_suffix
|
||||||
deps = [ ":electron_framework+link" ]
|
deps = [
|
||||||
|
":electron_framework+link",
|
||||||
|
"//base/allocator:early_zone_registration_mac",
|
||||||
|
]
|
||||||
if (!is_mas_build) {
|
if (!is_mas_build) {
|
||||||
deps += [ "//sandbox/mac:seatbelt" ]
|
deps += [ "//sandbox/mac:seatbelt" ]
|
||||||
}
|
}
|
||||||
defines = [ "HELPER_EXECUTABLE" ]
|
defines = [ "HELPER_EXECUTABLE" ]
|
||||||
|
extra_configs = [ "//electron/build/config:mas_build" ]
|
||||||
sources = [
|
sources = [
|
||||||
"shell/app/electron_main_mac.cc",
|
"shell/app/electron_main_mac.cc",
|
||||||
"shell/app/uv_stdio_fix.cc",
|
"shell/app/uv_stdio_fix.cc",
|
||||||
@@ -1054,7 +1117,6 @@ if (is_mac) {
|
|||||||
"shell/app/electron_main_mac.cc",
|
"shell/app/electron_main_mac.cc",
|
||||||
"shell/app/uv_stdio_fix.cc",
|
"shell/app/uv_stdio_fix.cc",
|
||||||
"shell/app/uv_stdio_fix.h",
|
"shell/app/uv_stdio_fix.h",
|
||||||
"shell/common/electron_constants.cc",
|
|
||||||
]
|
]
|
||||||
include_dirs = [ "." ]
|
include_dirs = [ "." ]
|
||||||
deps = [
|
deps = [
|
||||||
@@ -1062,6 +1124,7 @@ if (is_mac) {
|
|||||||
":electron_app_plist",
|
":electron_app_plist",
|
||||||
":electron_app_resources",
|
":electron_app_resources",
|
||||||
":electron_fuses",
|
":electron_fuses",
|
||||||
|
"//base/allocator:early_zone_registration_mac",
|
||||||
"//electron/buildflags",
|
"//electron/buildflags",
|
||||||
]
|
]
|
||||||
if (is_mas_build) {
|
if (is_mas_build) {
|
||||||
@@ -1076,6 +1139,7 @@ if (is_mac) {
|
|||||||
"-rpath",
|
"-rpath",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
]
|
]
|
||||||
|
extra_configs = [ "//electron/build/config:mas_build" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_dsyms) {
|
if (enable_dsyms) {
|
||||||
@@ -1105,21 +1169,18 @@ if (is_mac) {
|
|||||||
deps = [ ":electron_app" ]
|
deps = [ ":electron_app" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_symbols("swiftshader_egl_syms") {
|
extract_symbols("egl_syms") {
|
||||||
binary = "$root_out_dir/libswiftshader_libEGL.dylib"
|
binary = "$root_out_dir/libEGL.dylib"
|
||||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||||
dsym_file = "$root_out_dir/libswiftshader_libEGL.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libEGL.dylib"
|
dsym_file = "$root_out_dir/libEGL.dylib.dSYM/Contents/Resources/DWARF/libEGL.dylib"
|
||||||
deps =
|
deps = [ "//third_party/angle:libEGL" ]
|
||||||
[ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_symbols("swiftshader_gles_syms") {
|
extract_symbols("gles_syms") {
|
||||||
binary = "$root_out_dir/libswiftshader_libGLESv2.dylib"
|
binary = "$root_out_dir/libGLESv2.dylib"
|
||||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||||
dsym_file = "$root_out_dir/libswiftshader_libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libGLESv2.dylib"
|
dsym_file = "$root_out_dir/libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libGLESv2.dylib"
|
||||||
deps = [
|
deps = [ "//third_party/angle:libGLESv2" ]
|
||||||
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_symbols("crashpad_handler_syms") {
|
extract_symbols("crashpad_handler_syms") {
|
||||||
@@ -1131,10 +1192,10 @@ if (is_mac) {
|
|||||||
|
|
||||||
group("electron_symbols") {
|
group("electron_symbols") {
|
||||||
deps = [
|
deps = [
|
||||||
|
":egl_syms",
|
||||||
":electron_app_syms",
|
":electron_app_syms",
|
||||||
":electron_framework_syms",
|
":electron_framework_syms",
|
||||||
":swiftshader_egl_syms",
|
":gles_syms",
|
||||||
":swiftshader_gles_syms",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!is_mas_build) {
|
if (!is_mas_build) {
|
||||||
@@ -1177,6 +1238,7 @@ if (is_mac) {
|
|||||||
":default_app_asar",
|
":default_app_asar",
|
||||||
":electron_app_manifest",
|
":electron_app_manifest",
|
||||||
":electron_lib",
|
":electron_lib",
|
||||||
|
":electron_win32_resources",
|
||||||
":packed_resources",
|
":packed_resources",
|
||||||
"//components/crash/core/app",
|
"//components/crash/core/app",
|
||||||
"//content:sandbox_helper_win",
|
"//content:sandbox_helper_win",
|
||||||
@@ -1210,8 +1272,7 @@ if (is_mac) {
|
|||||||
|
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
sources += [
|
sources += [
|
||||||
# TODO: we should be generating our .rc files more like how chrome does
|
"$target_gen_dir/win-resources/electron.rc",
|
||||||
"shell/browser/resources/win/electron.rc",
|
|
||||||
"shell/browser/resources/win/resource.h",
|
"shell/browser/resources/win/resource.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1271,6 +1332,10 @@ if (is_mac) {
|
|||||||
if (!is_component_build && is_component_ffmpeg) {
|
if (!is_component_build && is_component_ffmpeg) {
|
||||||
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_linux) {
|
||||||
|
deps += [ "//sandbox/linux:chrome_sandbox" ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1289,27 +1354,23 @@ if (is_mac) {
|
|||||||
deps = [ ":electron_app" ]
|
deps = [ ":electron_app" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_symbols("swiftshader_egl_symbols") {
|
extract_symbols("egl_symbols") {
|
||||||
binary = "$root_out_dir/swiftshader/libEGL$_target_shared_library_suffix"
|
binary = "$root_out_dir/libEGL$_target_shared_library_suffix"
|
||||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||||
deps =
|
deps = [ "//third_party/angle:libEGL" ]
|
||||||
[ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_symbols("swiftshader_gles_symbols") {
|
extract_symbols("gles_symbols") {
|
||||||
binary =
|
binary = "$root_out_dir/libGLESv2$_target_shared_library_suffix"
|
||||||
"$root_out_dir/swiftshader/libGLESv2$_target_shared_library_suffix"
|
|
||||||
symbol_dir = "$root_out_dir/breakpad_symbols"
|
symbol_dir = "$root_out_dir/breakpad_symbols"
|
||||||
deps = [
|
deps = [ "//third_party/angle:libGLESv2" ]
|
||||||
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group("electron_symbols") {
|
group("electron_symbols") {
|
||||||
deps = [
|
deps = [
|
||||||
|
":egl_symbols",
|
||||||
":electron_app_symbols",
|
":electron_app_symbols",
|
||||||
":swiftshader_egl_symbols",
|
":gles_symbols",
|
||||||
":swiftshader_gles_symbols",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1393,15 +1454,10 @@ group("licenses") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
copy("electron_version") {
|
|
||||||
sources = [ "ELECTRON_VERSION" ]
|
|
||||||
outputs = [ "$root_build_dir/version" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
dist_zip("electron_dist_zip") {
|
dist_zip("electron_dist_zip") {
|
||||||
data_deps = [
|
data_deps = [
|
||||||
":electron_app",
|
":electron_app",
|
||||||
":electron_version",
|
":electron_version_file",
|
||||||
":licenses",
|
":licenses",
|
||||||
]
|
]
|
||||||
if (is_linux) {
|
if (is_linux) {
|
||||||
@@ -1419,7 +1475,7 @@ dist_zip("electron_ffmpeg_zip") {
|
|||||||
|
|
||||||
electron_chromedriver_deps = [
|
electron_chromedriver_deps = [
|
||||||
":licenses",
|
":licenses",
|
||||||
"//chrome/test/chromedriver",
|
"//chrome/test/chromedriver:chromedriver_server",
|
||||||
"//electron/buildflags",
|
"//electron/buildflags",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
9
DEPS
9
DEPS
@@ -2,14 +2,11 @@ gclient_gn_args_from = 'src'
|
|||||||
|
|
||||||
vars = {
|
vars = {
|
||||||
'chromium_version':
|
'chromium_version':
|
||||||
'102.0.4962.3',
|
'110.0.5481.100',
|
||||||
'node_version':
|
'node_version':
|
||||||
'v16.14.2',
|
'v18.12.1',
|
||||||
'nan_version':
|
'nan_version':
|
||||||
# The following commit hash of NAN is v2.14.2 with *only* changes to the
|
'16fa32231e2ccd89d2804b3f765319128b20c4ac',
|
||||||
# test suite. This should be updated to a specific tag when one becomes
|
|
||||||
# available.
|
|
||||||
'65b32af46e9d7fab2e4ff657751205b3865f4920',
|
|
||||||
'squirrel.mac_version':
|
'squirrel.mac_version':
|
||||||
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',
|
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
19.0.0-nightly.20220329
|
|
||||||
10
README.md
10
README.md
@@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
[](https://circleci.com/gh/electron/electron/tree/main)
|
[](https://circleci.com/gh/electron/electron/tree/main)
|
||||||
[](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/main)
|
[](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/main)
|
||||||
[](https://discord.com/invite/APGC3k5yaH)
|
[](https://discord.gg/electronjs)
|
||||||
|
|
||||||
:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪.
|
:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪.
|
||||||
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).
|
View these docs in other languages on our [Crowdin](https://crowdin.com/project/electron) project.
|
||||||
|
|
||||||
The Electron framework lets you write cross-platform desktop applications
|
The Electron framework lets you write cross-platform desktop applications
|
||||||
using JavaScript, HTML and CSS. It is based on [Node.js](https://nodejs.org/) and
|
using JavaScript, HTML and CSS. It is based on [Node.js](https://nodejs.org/) and
|
||||||
[Chromium](https://www.chromium.org) and is used by the [Atom
|
[Chromium](https://www.chromium.org) and is used by the [Atom
|
||||||
editor](https://github.com/atom/atom) and many other [apps](https://electronjs.org/apps).
|
editor](https://github.com/atom/atom) and many other [apps](https://electronjs.org/apps).
|
||||||
|
|
||||||
Follow [@ElectronJS](https://twitter.com/electronjs) on Twitter for important
|
Follow [@electronjs](https://twitter.com/electronjs) on Twitter for important
|
||||||
announcements.
|
announcements.
|
||||||
|
|
||||||
This project adheres to the Contributor Covenant
|
This project adheres to the Contributor Covenant
|
||||||
@@ -38,8 +38,8 @@ For more installation options and troubleshooting tips, see
|
|||||||
|
|
||||||
Each Electron release provides binaries for macOS, Windows, and Linux.
|
Each Electron release provides binaries for macOS, Windows, and Linux.
|
||||||
|
|
||||||
* macOS (El Capitan and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
|
* macOS (High Sierra and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
|
||||||
* Windows (Windows 7 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8.
|
* Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice).
|
||||||
* Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on:
|
* Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on:
|
||||||
* Ubuntu 14.04 and newer
|
* Ubuntu 14.04 and newer
|
||||||
* Fedora 24 and newer
|
* Fedora 24 and newer
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
The Electron team and community take security bugs in Electron seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
|
The Electron team and community take security bugs in Electron seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
|
||||||
|
|
||||||
To report a security issue, email [security@electronjs.org](mailto:security@electronjs.org) and include the word "SECURITY" in the subject line.
|
To report a security issue, please use the GitHub Security Advisory ["Report a Vulnerability"](https://github.com/electron/electron/security/advisories/new) tab.
|
||||||
|
|
||||||
The Electron team will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
|
The Electron team will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
|
||||||
|
|
||||||
|
|||||||
107
appveyor-bake.yml
Normal file
107
appveyor-bake.yml
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
# The config is used to bake appveyor images, not for running CI jobs.
|
||||||
|
# The config expects the following environment variables to be set:
|
||||||
|
# - "APPVEYOR_BAKE_IMAGE" e.g. 'electron-99.0.4767.0'. Name of the image to be baked.
|
||||||
|
# Typically named after the Chromium version on which the image is built.
|
||||||
|
# This can be set dynamically in the prepare-appveyor script.
|
||||||
|
|
||||||
|
version: 1.0.{build}
|
||||||
|
build_cloud: electronhq-16-core
|
||||||
|
image: e-111.0.5560.0-node18
|
||||||
|
environment:
|
||||||
|
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||||
|
ELECTRON_OUT_DIR: Default
|
||||||
|
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||||
|
MOCHA_REPORTER: mocha-multi-reporters
|
||||||
|
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
|
||||||
|
GOMA_FALLBACK_ON_AUTH_FAILURE: true
|
||||||
|
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
|
||||||
|
PYTHONIOENCODING: UTF-8
|
||||||
|
|
||||||
|
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
|
||||||
|
# init:
|
||||||
|
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
# - appveyor version
|
||||||
|
# - ps: $ErrorActionPreference = 'Stop'
|
||||||
|
# - ps: 'Write-Host "OS Build: $((Get-CimInstance Win32_OperatingSystem).BuildNumber)"'
|
||||||
|
|
||||||
|
# clone_folder: '%USERPROFILE%\image-bake-scripts'
|
||||||
|
|
||||||
|
# clone_script:
|
||||||
|
# - ps: Invoke-WebRequest "https://github.com/appveyor/build-images/archive/1f90d94e74c8243c909a09b994e527584dfcb838.zip" -OutFile "$env:temp\scripts.zip"
|
||||||
|
# - ps: Expand-Archive -Path "$env:temp\scripts.zip" -DestinationPath "$env:temp\scripts" -Force
|
||||||
|
# - ps: Copy-Item -Path "$env:temp\scripts\build-images-1f90d94e74c8243c909a09b994e527584dfcb838\scripts\Windows\*" -Destination $env:APPVEYOR_BUILD_FOLDER -Recurse
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
|
||||||
|
# - ps: .\init_server.ps1
|
||||||
|
# - ps: .\extend_system_volume.ps1
|
||||||
|
|
||||||
|
# # Restart VM
|
||||||
|
# - ps: Start-Sleep -s 5; Restart-Computer
|
||||||
|
# - ps: Start-Sleep -s 5
|
||||||
|
|
||||||
|
# - appveyor version
|
||||||
|
# - ps: .\install_path_utils.ps1
|
||||||
|
# - ps: .\install_powershell_core.ps1
|
||||||
|
# - ps: .\install_powershell_get.ps1
|
||||||
|
# - ps: .\install_7zip.ps1
|
||||||
|
# - ps: .\install_chocolatey.ps1
|
||||||
|
# - ps: .\install_webpi.ps1
|
||||||
|
# - ps: .\install_nuget.ps1
|
||||||
|
# - ps: .\install_pstools.ps1
|
||||||
|
|
||||||
|
# - ps: .\install_git.ps1
|
||||||
|
# - ps: .\install_git_lfs.ps1
|
||||||
|
|
||||||
|
# # Restart VM
|
||||||
|
# - ps: Start-Sleep -s 5; Restart-Computer
|
||||||
|
# - ps: Start-Sleep -s 5
|
||||||
|
# END LINES FOR COMPLETELY NEW IMAGE
|
||||||
|
|
||||||
|
- git config --global core.longpaths true
|
||||||
|
- ps: >-
|
||||||
|
if (-not (Test-Path -Path C:\projects\src)) {
|
||||||
|
New-Item -Path C:\projects\src -ItemType Directory
|
||||||
|
}
|
||||||
|
- cd C:\projects\
|
||||||
|
- git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/electron/electron.git C:\projects\src\electron
|
||||||
|
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
|
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
|
||||||
|
- update_depot_tools.bat
|
||||||
|
# Uncomment the following line if windows deps change
|
||||||
|
# - src\electron\script\setup-win-for-dev.bat
|
||||||
|
- >-
|
||||||
|
gclient config
|
||||||
|
--name "src\electron"
|
||||||
|
--unmanaged
|
||||||
|
%GCLIENT_EXTRA_ARGS%
|
||||||
|
"https://github.com/electron/electron"
|
||||||
|
- ps: cd src\electron
|
||||||
|
- ps: node script\generate-deps-hash.js
|
||||||
|
- ps: $depshash = Get-Content .\.depshash -Raw
|
||||||
|
- ps: Copy-Item -path .\.depshash -destination ..\.depshash
|
||||||
|
- ps: cd ..\..
|
||||||
|
- gclient sync --with_branch_heads --with_tags --nohooks
|
||||||
|
- ps: regsvr32 /s "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\DIA SDK\bin\amd64\msdia140.dll"
|
||||||
|
|
||||||
|
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
|
||||||
|
# # Restart VM
|
||||||
|
# - ps: Start-Sleep -s 5; Restart-Computer
|
||||||
|
# - ps: Start-Sleep -s 5
|
||||||
|
|
||||||
|
# - cd %USERPROFILE%\image-bake-scripts
|
||||||
|
# - appveyor version
|
||||||
|
# - ps: .\optimize_dotnet_runtime.ps1
|
||||||
|
# - ps: .\disable_windows_background_services.ps1
|
||||||
|
# - ps: .\enforce_windows_firewall.ps1
|
||||||
|
# - ps: .\cleanup_windows.ps1
|
||||||
|
# END LINES FOR COMPLETELY NEW IMAGE
|
||||||
|
on_image_bake:
|
||||||
|
- ps: >-
|
||||||
|
echo "Baking image: $env:APPVEYOR_BAKE_IMAGE at dir $PWD"
|
||||||
|
- ps: Remove-Item -Recurse -Force C:\projects\depot_tools
|
||||||
|
- ps: Remove-Item -Recurse -Force C:\projects\src\electron
|
||||||
|
# Uncomment these lines and set APPVEYOR_RDP_PASSWORD in project settings to enable RDP after bake is done
|
||||||
|
# # on_finish:
|
||||||
|
# - ps: >-
|
||||||
|
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
279
appveyor-woa.yml
Normal file
279
appveyor-woa.yml
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor.yml
|
||||||
|
# IF APPLICABLE!!!!
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# The config expects the following environment variables to be set:
|
||||||
|
# - "GN_CONFIG" Build type. One of {'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
|
||||||
|
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
|
||||||
|
# if you pass a custom value for 'target_cpu'.
|
||||||
|
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
|
||||||
|
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
|
||||||
|
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
|
||||||
|
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64', 'mips64el'}.
|
||||||
|
# Is used in some publishing scripts, but does NOT affect the Electron binary.
|
||||||
|
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
|
||||||
|
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
|
||||||
|
# Otherwise the release will be uploaded to the GitHub Releases.
|
||||||
|
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
|
||||||
|
#
|
||||||
|
# The publishing scripts expect access tokens to be defined as env vars,
|
||||||
|
# but those are not covered here.
|
||||||
|
#
|
||||||
|
# AppVeyor docs on variables:
|
||||||
|
# https://www.appveyor.com/docs/environment-variables/
|
||||||
|
# https://www.appveyor.com/docs/build-configuration/#secure-variables
|
||||||
|
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
|
||||||
|
|
||||||
|
version: 1.0.{build}
|
||||||
|
build_cloud: electronhq-16-core
|
||||||
|
image: e-110.0.5481.77
|
||||||
|
environment:
|
||||||
|
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||||
|
ELECTRON_OUT_DIR: Default
|
||||||
|
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||||
|
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
||||||
|
MOCHA_REPORTER: mocha-multi-reporters
|
||||||
|
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
|
||||||
|
GOMA_FALLBACK_ON_AUTH_FAILURE: true
|
||||||
|
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
|
||||||
|
PYTHONIOENCODING: UTF-8
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
|
||||||
|
- job_name: Build Arm on X64 Windows
|
||||||
|
- job_name: Test On Windows On Arm Hardware
|
||||||
|
job_depends_on: Build Arm on X64 Windows
|
||||||
|
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
|
||||||
|
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
|
||||||
|
|
||||||
|
clone_folder: C:\projects\src\electron
|
||||||
|
|
||||||
|
skip_branch_with_pr: true
|
||||||
|
|
||||||
|
# the first failed job cancels other jobs and fails entire build
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
|
||||||
|
for:
|
||||||
|
|
||||||
|
- matrix:
|
||||||
|
only:
|
||||||
|
- job_name: Build Arm on X64 Windows
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- ps: |
|
||||||
|
node script/yarn.js install --frozen-lockfile
|
||||||
|
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
|
||||||
|
}
|
||||||
|
$global:LASTEXITCODE = 0
|
||||||
|
- cd ..
|
||||||
|
- ps: Write-Host "Building $env:GN_CONFIG build"
|
||||||
|
- git config --global core.longpaths true
|
||||||
|
- ps: >-
|
||||||
|
if (Test-Path -Path "$pwd\depot_tools") {
|
||||||
|
Remove-Item -Recurse -Force $pwd\depot_tools
|
||||||
|
}
|
||||||
|
- ps: >-
|
||||||
|
if (Test-Path -Path "$pwd\build-tools") {
|
||||||
|
Remove-Item -Recurse -Force $pwd\build-tools
|
||||||
|
}
|
||||||
|
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
|
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
|
||||||
|
- ps: >-
|
||||||
|
if (Test-Path -Path "$pwd\src\electron") {
|
||||||
|
Remove-Item -Recurse -Force $pwd\src\electron
|
||||||
|
}
|
||||||
|
- ps: >-
|
||||||
|
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
||||||
|
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
|
||||||
|
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
|
||||||
|
}
|
||||||
|
- git clone https://github.com/electron/build-tools.git
|
||||||
|
- cd build-tools
|
||||||
|
- npm install
|
||||||
|
- mkdir third_party
|
||||||
|
- ps: >-
|
||||||
|
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
|
||||||
|
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
|
||||||
|
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
|
||||||
|
- cd ..\..
|
||||||
|
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
|
||||||
|
- ps: >-
|
||||||
|
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
||||||
|
$goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
|
||||||
|
if ($goma_login -eq 'Login as Fermi Planck') {
|
||||||
|
Write-warning "Goma authentication is correct";
|
||||||
|
} else {
|
||||||
|
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
|
||||||
|
$host.SetShouldExit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||||
|
- ps: >-
|
||||||
|
if ($env:GN_CONFIG -ne 'release') {
|
||||||
|
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
|
||||||
|
}
|
||||||
|
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
|
||||||
|
# Patches are applied in the image bake. Check depshash to see if patches have changed.
|
||||||
|
- ps: $env:RUN_GCLIENT_SYNC="false"
|
||||||
|
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
|
||||||
|
- ps: cd src\electron
|
||||||
|
- ps: node script\generate-deps-hash.js
|
||||||
|
- ps: $depshash = Get-Content .\.depshash -Raw
|
||||||
|
- ps: cd ..\..
|
||||||
|
- ps: >-
|
||||||
|
if ($depshash_baked -ne $depshash) {
|
||||||
|
$env:RUN_GCLIENT_SYNC="true"
|
||||||
|
}
|
||||||
|
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
|
||||||
|
- cd src
|
||||||
|
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
|
||||||
|
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
|
||||||
|
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
|
||||||
|
- gn check out/Default //electron:electron_lib
|
||||||
|
- gn check out/Default //electron:electron_app
|
||||||
|
- 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 )
|
||||||
|
- 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/default_mksnapshot_args
|
||||||
|
# Remove unused args from mksnapshot_args
|
||||||
|
- ps: >-
|
||||||
|
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
|
||||||
|
- ninja -C out/Default electron:electron_mksnapshot_zip
|
||||||
|
- cd out\Default
|
||||||
|
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
|
||||||
|
- cd ..\..
|
||||||
|
- ninja -C out/Default electron:hunspell_dictionaries_zip
|
||||||
|
- ninja -C out/Default electron:electron_chromedriver_zip
|
||||||
|
- ninja -C out/Default third_party/electron_node:headers
|
||||||
|
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
|
||||||
|
- ps: >-
|
||||||
|
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
|
||||||
|
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
||||||
|
- 7z a node_headers.zip out\Default\gen\node_headers
|
||||||
|
- ps: >-
|
||||||
|
if ($env:GN_CONFIG -eq 'release') {
|
||||||
|
# Needed for msdia140.dll on 64-bit windows
|
||||||
|
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
||||||
|
ninja -C out/Default electron:electron_symbols
|
||||||
|
}
|
||||||
|
- ps: >-
|
||||||
|
if ($env:GN_CONFIG -eq 'release') {
|
||||||
|
python3 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
|
||||||
|
}
|
||||||
|
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
||||||
|
|
||||||
|
deploy_script:
|
||||||
|
- cd electron
|
||||||
|
- ps: >-
|
||||||
|
if (Test-Path Env:\ELECTRON_RELEASE) {
|
||||||
|
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
|
||||||
|
Write-Output "Uploading Electron release distribution to azure"
|
||||||
|
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
|
||||||
|
} else {
|
||||||
|
Write-Output "Uploading Electron release distribution to github releases"
|
||||||
|
& python3 script\release\uploaders\upload.py --verbose
|
||||||
|
}
|
||||||
|
}
|
||||||
|
on_finish:
|
||||||
|
# Uncomment this lines to enable RDP
|
||||||
|
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
- cd C:\projects\src
|
||||||
|
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
|
||||||
|
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
|
||||||
|
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
|
||||||
|
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
|
||||||
|
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
|
||||||
|
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
|
||||||
|
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
|
||||||
|
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
|
||||||
|
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
|
||||||
|
- ps: >-
|
||||||
|
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
||||||
|
appveyor-retry appveyor PushArtifact pdb.zip
|
||||||
|
}
|
||||||
|
- matrix:
|
||||||
|
only:
|
||||||
|
- job_name: Test On Windows On Arm Hardware
|
||||||
|
|
||||||
|
environment:
|
||||||
|
IGNORE_YARN_INSTALL_ERROR: 1
|
||||||
|
ELECTRON_TEST_RESULTS_DIR: junit
|
||||||
|
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
||||||
|
MOCHA_REPORTER: mocha-multi-reporters
|
||||||
|
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- ps: |
|
||||||
|
node script/yarn.js install --frozen-lockfile
|
||||||
|
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
|
||||||
|
}
|
||||||
|
$global:LASTEXITCODE = 0
|
||||||
|
- cd ..
|
||||||
|
- mkdir out\Default
|
||||||
|
- cd ..
|
||||||
|
- ps: |
|
||||||
|
# Download build artifacts
|
||||||
|
$apiUrl = 'https://ci.appveyor.com/api'
|
||||||
|
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
|
||||||
|
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','pdb.zip','electron.lib')
|
||||||
|
foreach ($job in $build_info.build.jobs) {
|
||||||
|
if ($job.name -eq "Build Arm on X64 Windows") {
|
||||||
|
$jobId = $job.jobId
|
||||||
|
foreach($artifact_name in $artifacts_to_download) {
|
||||||
|
if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
|
||||||
|
$outfile = "src\out\Default\$artifact_name"
|
||||||
|
} else {
|
||||||
|
$outfile = $artifact_name
|
||||||
|
}
|
||||||
|
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- ps: |
|
||||||
|
$out_default_zips = @('dist.zip','pdb.zip')
|
||||||
|
foreach($zip_name in $out_default_zips) {
|
||||||
|
7z x -y -osrc\out\Default $zip_name
|
||||||
|
}
|
||||||
|
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
|
||||||
|
- ps: 7z x -y -osrc node_headers.zip
|
||||||
|
|
||||||
|
test_script:
|
||||||
|
# Workaround for https://github.com/appveyor/ci/issues/2420
|
||||||
|
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
|
||||||
|
- ps: |
|
||||||
|
cd src
|
||||||
|
New-Item .\out\Default\gen\node_headers\Release -Type directory
|
||||||
|
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
|
||||||
|
- set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
||||||
|
- set npm_config_arch=arm64
|
||||||
|
- cd electron
|
||||||
|
# Explicitly set npm_config_arch because the .env doesn't persist
|
||||||
|
- ps: >-
|
||||||
|
if ($env:TARGET_ARCH -eq 'ia32') {
|
||||||
|
$env:npm_config_arch = "ia32"
|
||||||
|
}
|
||||||
|
- echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
|
||||||
|
- cd ..
|
||||||
|
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
||||||
|
|
||||||
|
on_finish:
|
||||||
|
# Uncomment these lines to enable RDP
|
||||||
|
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
|
||||||
458
appveyor.yml
458
appveyor.yml
@@ -1,9 +1,13 @@
|
|||||||
|
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor-woa.yml
|
||||||
|
# IF APPLICABLE!!!!
|
||||||
|
#
|
||||||
|
#
|
||||||
# The config expects the following environment variables to be set:
|
# The config expects the following environment variables to be set:
|
||||||
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
|
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
|
||||||
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
|
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
|
||||||
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
|
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
|
||||||
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_cpu
|
# https://gn.googlesource.com/gn/+/master/docs/reference.md#target_cpu
|
||||||
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordningly
|
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
|
||||||
# if you pass a custom value for 'target_cpu'.
|
# if you pass a custom value for 'target_cpu'.
|
||||||
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
|
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
|
||||||
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
|
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
|
||||||
@@ -11,8 +15,8 @@
|
|||||||
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64', 'mips64el'}.
|
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64', 'mips64el'}.
|
||||||
# Is used in some publishing scripts, but does NOT affect the Electron binary.
|
# Is used in some publishing scripts, but does NOT affect the Electron binary.
|
||||||
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
|
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
|
||||||
# - "UPLOAD_TO_S3" Set it to '1' upload a release to the S3 bucket.
|
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
|
||||||
# Otherwise the release will be uploaded to the Github Releases.
|
# Otherwise the release will be uploaded to the GitHub Releases.
|
||||||
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
|
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
|
||||||
#
|
#
|
||||||
# The publishing scripts expect access tokens to be defined as env vars,
|
# The publishing scripts expect access tokens to be defined as env vars,
|
||||||
@@ -23,227 +27,253 @@
|
|||||||
# https://www.appveyor.com/docs/build-configuration/#secure-variables
|
# https://www.appveyor.com/docs/build-configuration/#secure-variables
|
||||||
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
|
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
|
||||||
|
|
||||||
# Uncomment these lines to enable RDP
|
|
||||||
#on_finish:
|
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
|
|
||||||
version: 1.0.{build}
|
version: 1.0.{build}
|
||||||
build_cloud: electron-16-core
|
build_cloud: electronhq-16-core
|
||||||
image: vs2019bt-16.6.2
|
image: e-110.0.5481.77-node18
|
||||||
environment:
|
environment:
|
||||||
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
|
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||||
ELECTRON_OUT_DIR: Default
|
ELECTRON_OUT_DIR: Default
|
||||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||||
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
MOCHA_REPORTER: mocha-multi-reporters
|
||||||
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
|
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
|
||||||
GOMA_FALLBACK_ON_AUTH_FAILURE: true
|
GOMA_FALLBACK_ON_AUTH_FAILURE: true
|
||||||
notifications:
|
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
|
||||||
- provider: Webhook
|
PYTHONIOENCODING: UTF-8
|
||||||
url: https://electron-mission-control.herokuapp.com/rest/appveyor-hook
|
|
||||||
method: POST
|
|
||||||
headers:
|
|
||||||
x-mission-control-secret:
|
|
||||||
secure: 90BLVPcqhJPG7d24v0q/RRray6W3wDQ8uVQlQjOHaBWkw1i8FoA1lsjr2C/v1dVok+tS2Pi6KxDctPUkwIb4T27u4RhvmcPzQhVpfwVJAG9oNtq+yKN7vzHfg7k/pojEzVdJpQLzeJGcSrZu7VY39Q==
|
|
||||||
on_build_success: false
|
|
||||||
on_build_failure: true
|
|
||||||
on_build_status_changed: false
|
|
||||||
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
|
|
||||||
|
|
||||||
$result = node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
matrix:
|
||||||
Write-Output $result
|
|
||||||
if ($result.ExitCode -eq 0) {
|
- job_name: Build
|
||||||
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
|
- job_name: Test
|
||||||
}
|
job_depends_on: Build
|
||||||
}
|
|
||||||
- echo "Building $env:GN_CONFIG build"
|
clone_folder: C:\projects\src\electron
|
||||||
- git config --global core.longpaths true
|
|
||||||
- cd ..
|
skip_branch_with_pr: true
|
||||||
- mkdir src
|
|
||||||
- update_depot_tools.bat
|
# the first failed job cancels other jobs and fails entire build
|
||||||
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
|
matrix:
|
||||||
- ps: >-
|
fast_finish: true
|
||||||
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
|
||||||
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
|
for:
|
||||||
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
|
|
||||||
}
|
- matrix:
|
||||||
- git clone https://github.com/electron/build-tools.git
|
only:
|
||||||
- cd build-tools
|
- job_name: Build
|
||||||
- npm install
|
|
||||||
- mkdir third_party
|
build_script:
|
||||||
- ps: >-
|
- ps: |
|
||||||
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
|
node script/yarn.js install --frozen-lockfile
|
||||||
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
|
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||||
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
|
if ($LASTEXITCODE -eq 0) {
|
||||||
- cd ..
|
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
|
||||||
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
|
}
|
||||||
- ps: >-
|
$global:LASTEXITCODE = 0
|
||||||
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
- cd ..
|
||||||
$goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
|
- ps: Write-Host "Building $env:GN_CONFIG build"
|
||||||
if ($goma_login -eq 'Login as Fermi Planck') {
|
- git config --global core.longpaths true
|
||||||
Write-warning "Goma authentication is correct";
|
- ps: >-
|
||||||
} else {
|
if (Test-Path -Path "$pwd\depot_tools") {
|
||||||
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
|
Remove-Item -Recurse -Force $pwd\depot_tools
|
||||||
$host.SetShouldExit(1)
|
}
|
||||||
}
|
- ps: >-
|
||||||
}
|
if (Test-Path -Path "$pwd\build-tools") {
|
||||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
Remove-Item -Recurse -Force $pwd\build-tools
|
||||||
- ps: >-
|
}
|
||||||
if ($env:GN_CONFIG -ne 'release') {
|
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
|
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
|
||||||
}
|
- ps: >-
|
||||||
- >-
|
if (Test-Path -Path "$pwd\src\electron") {
|
||||||
gclient config
|
Remove-Item -Recurse -Force $pwd\src\electron
|
||||||
--name "src\electron"
|
}
|
||||||
--unmanaged
|
- ps: >-
|
||||||
%GCLIENT_EXTRA_ARGS%
|
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
||||||
"https://github.com/electron/electron"
|
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
|
||||||
- ps: >-
|
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
|
||||||
if ($env:GN_CONFIG -eq 'release') {
|
}
|
||||||
$env:RUN_GCLIENT_SYNC="true"
|
- git clone https://github.com/electron/build-tools.git
|
||||||
} else {
|
- cd build-tools
|
||||||
cd src\electron
|
- npm install
|
||||||
node script\generate-deps-hash.js
|
- mkdir third_party
|
||||||
$depshash = Get-Content .\.depshash -Raw
|
- ps: >-
|
||||||
$zipfile = "Z:\$depshash.7z"
|
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
|
||||||
cd ..\..
|
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
|
||||||
if (Test-Path -Path $zipfile) {
|
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
|
||||||
# file exists, unzip and then gclient sync
|
- cd ..\..
|
||||||
7z x -y $zipfile -mmt=30 -aoa
|
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
|
||||||
if (-not (Test-Path -Path "src\buildtools")) {
|
- ps: >-
|
||||||
# the zip file must be corrupt - resync
|
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
||||||
$env:RUN_GCLIENT_SYNC="true"
|
$goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
|
||||||
if ($env:TARGET_ARCH -ne 'ia32') {
|
if ($goma_login -eq 'Login as Fermi Planck') {
|
||||||
# only save on x64/woa to avoid contention saving
|
Write-warning "Goma authentication is correct";
|
||||||
$env:SAVE_GCLIENT_SRC="true"
|
} else {
|
||||||
|
Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
|
||||||
|
$host.SetShouldExit(1)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||||
|
- ps: >-
|
||||||
|
if ($env:GN_CONFIG -ne 'release') {
|
||||||
|
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
|
||||||
|
}
|
||||||
|
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
|
||||||
|
# Patches are applied in the image bake. Check depshash to see if patches have changed.
|
||||||
|
- ps: $env:RUN_GCLIENT_SYNC="false"
|
||||||
|
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
|
||||||
|
- ps: cd src\electron
|
||||||
|
- ps: node script\generate-deps-hash.js
|
||||||
|
- ps: $depshash = Get-Content .\.depshash -Raw
|
||||||
|
- ps: cd ..\..
|
||||||
|
- ps: >-
|
||||||
|
if ($depshash_baked -ne $depshash) {
|
||||||
|
$env:RUN_GCLIENT_SYNC="true"
|
||||||
|
}
|
||||||
|
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
|
||||||
|
- cd src
|
||||||
|
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
|
||||||
|
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
|
||||||
|
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
|
||||||
|
- gn check out/Default //electron:electron_lib
|
||||||
|
- gn check out/Default //electron:electron_app
|
||||||
|
- 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 )
|
||||||
|
- 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/default_mksnapshot_args
|
||||||
|
# Remove unused args from mksnapshot_args
|
||||||
|
- ps: >-
|
||||||
|
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
|
||||||
|
- ninja -C out/Default electron:electron_mksnapshot_zip
|
||||||
|
- cd out\Default
|
||||||
|
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
|
||||||
|
- cd ..\..
|
||||||
|
- ninja -C out/Default electron:hunspell_dictionaries_zip
|
||||||
|
- ninja -C out/Default electron:electron_chromedriver_zip
|
||||||
|
- ninja -C out/Default third_party/electron_node:headers
|
||||||
|
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
|
||||||
|
- ps: >-
|
||||||
|
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
|
||||||
|
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
||||||
|
- 7z a node_headers.zip out\Default\gen\node_headers
|
||||||
|
- ps: >-
|
||||||
|
if ($env:GN_CONFIG -eq 'release') {
|
||||||
|
# Needed for msdia140.dll on 64-bit windows
|
||||||
|
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
||||||
|
ninja -C out/Default electron:electron_symbols
|
||||||
|
}
|
||||||
|
- ps: >-
|
||||||
|
if ($env:GN_CONFIG -eq 'release') {
|
||||||
|
python3 electron\script\zip-symbols.py
|
||||||
|
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
||||||
} else {
|
} else {
|
||||||
# update angle
|
# It's useful to have pdb files when debugging testing builds that are
|
||||||
cd src\third_party\angle
|
# built on CI.
|
||||||
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
|
7z a pdb.zip out\Default\*.pdb
|
||||||
git fetch
|
|
||||||
cd ..\..\..
|
|
||||||
}
|
}
|
||||||
} else {
|
- python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
||||||
# file does not exist, gclient sync, then zip
|
|
||||||
$env:RUN_GCLIENT_SYNC="true"
|
deploy_script:
|
||||||
if ($env:TARGET_ARCH -ne 'ia32') {
|
- cd electron
|
||||||
# only save on x64/woa to avoid contention saving
|
- ps: >-
|
||||||
$env:SAVE_GCLIENT_SRC="true"
|
if (Test-Path Env:\ELECTRON_RELEASE) {
|
||||||
|
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
|
||||||
|
Write-Output "Uploading Electron release distribution to azure"
|
||||||
|
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
|
||||||
|
} else {
|
||||||
|
Write-Output "Uploading Electron release distribution to github releases"
|
||||||
|
& python3 script\release\uploaders\upload.py --verbose
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
on_finish:
|
||||||
}
|
# Uncomment this lines to enable RDP
|
||||||
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync )
|
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
- ps: >-
|
- cd C:\projects\src
|
||||||
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
|
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
|
||||||
# archive current source for future use
|
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
|
||||||
# only run on x64/woa to avoid contention saving
|
- if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
|
||||||
$(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\WebKit\LayoutTests! -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30)
|
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
|
||||||
if ($LASTEXITCODE -ne 0) {
|
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
|
||||||
Write-warning "Could not save source to shared drive; continuing anyway"
|
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
|
||||||
}
|
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
|
||||||
# build time generation of file gen/angle/angle_commit.h depends on
|
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
|
||||||
# third_party/angle/.git
|
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
|
||||||
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
|
- ps: >-
|
||||||
$(7z a $zipfile src\third_party\angle\.git)
|
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
||||||
if ($LASTEXITCODE -ne 0) {
|
appveyor-retry appveyor PushArtifact pdb.zip
|
||||||
Write-warning "Failed to add third_party\angle\.git; continuing anyway"
|
}
|
||||||
}
|
- matrix:
|
||||||
}
|
only:
|
||||||
- cd src
|
- job_name: Test
|
||||||
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
|
|
||||||
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
|
init:
|
||||||
- gn check out/Default //electron:electron_lib
|
- ps: |
|
||||||
- gn check out/Default //electron:electron_app
|
if ($env:RUN_TESTS -ne 'true') {
|
||||||
- gn check out/Default //electron/shell/common/api:mojo
|
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
|
||||||
- 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 )
|
build_script:
|
||||||
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
|
- ps: |
|
||||||
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
node script/yarn.js install --frozen-lockfile
|
||||||
- ninja -C out/Default electron:electron_dist_zip
|
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||||
- ninja -C out/Default shell_browser_ui_unittests
|
if ($LASTEXITCODE -eq 0) {
|
||||||
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
|
||||||
- ninja -C out/Default electron:electron_mksnapshot_zip
|
}
|
||||||
- cd out\Default
|
$global:LASTEXITCODE = 0
|
||||||
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
|
- cd ..
|
||||||
- cd ..\..
|
- mkdir out\Default
|
||||||
- ninja -C out/Default electron:hunspell_dictionaries_zip
|
- cd ..
|
||||||
- ninja -C out/Default electron:electron_chromedriver_zip
|
- ps: |
|
||||||
- ninja -C out/Default third_party/electron_node:headers
|
# Download build artifacts
|
||||||
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
|
$apiUrl = 'https://ci.appveyor.com/api'
|
||||||
- python electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
|
||||||
- appveyor PushArtifact out/Default/windows_toolchain_profile.json
|
$artifacts_to_download = @('dist.zip','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
|
||||||
- appveyor PushArtifact out/Default/dist.zip
|
foreach ($job in $build_info.build.jobs) {
|
||||||
- appveyor PushArtifact out/Default/shell_browser_ui_unittests.exe
|
if ($job.name -eq "Build") {
|
||||||
- appveyor PushArtifact out/Default/chromedriver.zip
|
$jobId = $job.jobId
|
||||||
- appveyor PushArtifact out/ffmpeg/ffmpeg.zip
|
foreach($artifact_name in $artifacts_to_download) {
|
||||||
- 7z a node_headers.zip out\Default\gen\node_headers
|
if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
|
||||||
- appveyor PushArtifact node_headers.zip
|
$outfile = "src\out\Default\$artifact_name"
|
||||||
- appveyor PushArtifact out/Default/mksnapshot.zip
|
} else {
|
||||||
- appveyor PushArtifact out/Default/hunspell_dictionaries.zip
|
$outfile = $artifact_name
|
||||||
- appveyor PushArtifact out/Default/electron.lib
|
}
|
||||||
- ps: >-
|
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
||||||
if ($env:GN_CONFIG -eq 'release') {
|
}
|
||||||
# Needed for msdia140.dll on 64-bit windows
|
}
|
||||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
}
|
||||||
ninja -C out/Default electron:electron_symbols
|
- ps: |
|
||||||
}
|
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
|
||||||
- ps: >-
|
foreach($zip_name in $out_default_zips) {
|
||||||
if ($env:GN_CONFIG -eq 'release') {
|
7z x -y -osrc\out\Default $zip_name
|
||||||
python electron\script\zip-symbols.py
|
}
|
||||||
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
|
||||||
} else {
|
- ps: 7z x -y -osrc node_headers.zip
|
||||||
# It's useful to have pdb files when debugging testing builds that are
|
|
||||||
# built on CI.
|
test_script:
|
||||||
7z a pdb.zip out\Default\*.pdb
|
# Workaround for https://github.com/appveyor/ci/issues/2420
|
||||||
appveyor-retry appveyor PushArtifact pdb.zip
|
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
|
||||||
}
|
- ps: |
|
||||||
- python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
cd src
|
||||||
test_script:
|
New-Item .\out\Default\gen\node_headers\Release -Type directory
|
||||||
# Workaround for https://github.com/appveyor/ci/issues/2420
|
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
|
||||||
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
|
- cd electron
|
||||||
- ps: >-
|
# Explicitly set npm_config_arch because the .env doesn't persist
|
||||||
if ((-Not (Test-Path Env:\TEST_WOA)) -And (-Not (Test-Path Env:\ELECTRON_RELEASE)) -And ($env:GN_CONFIG -in "testing", "release")) {
|
- ps: >-
|
||||||
$env:RUN_TESTS="true"
|
if ($env:TARGET_ARCH -eq 'ia32') {
|
||||||
}
|
$env:npm_config_arch = "ia32"
|
||||||
- ps: >-
|
}
|
||||||
if ($env:RUN_TESTS -eq 'true') {
|
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log
|
||||||
New-Item .\out\Default\gen\node_headers\Release -Type directory
|
- echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log
|
||||||
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
|
- cd ..
|
||||||
} else {
|
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
||||||
echo "Skipping tests for $env:GN_CONFIG build"
|
- echo "About to verify mksnapshot"
|
||||||
}
|
- echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
|
||||||
- cd electron
|
- echo "Done verifying mksnapshot"
|
||||||
# CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
|
- echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
|
||||||
- if "%RUN_TESTS%"=="true" ( echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
|
- echo "Done verifying chromedriver"
|
||||||
- if "%RUN_TESTS%"=="true" ( echo Running remote test suite & node script/yarn test -- --trace-uncaught --runners=remote --runTestFilesSeperately --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
|
|
||||||
- if "%RUN_TESTS%"=="true" ( echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
|
on_finish:
|
||||||
- cd ..
|
# Uncomment these lines to enable RDP
|
||||||
- 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 )
|
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
- echo "About to verify mksnapshot"
|
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
|
||||||
- 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"
|
|
||||||
- if exist %cd%\electron.log ( appveyor-retry appveyor PushArtifact %cd%\electron.log )
|
|
||||||
deploy_script:
|
|
||||||
- cd electron
|
|
||||||
- ps: >-
|
|
||||||
if (Test-Path Env:\ELECTRON_RELEASE) {
|
|
||||||
if (Test-Path Env:\UPLOAD_TO_S3) {
|
|
||||||
Write-Output "Uploading Electron release distribution to s3"
|
|
||||||
& python script\release\uploaders\upload.py --verbose --upload_to_s3
|
|
||||||
} else {
|
|
||||||
Write-Output "Uploading Electron release distribution to github releases"
|
|
||||||
& python script\release\uploaders\upload.py --verbose
|
|
||||||
}
|
|
||||||
} elseif (Test-Path Env:\TEST_WOA) {
|
|
||||||
node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
|
|
||||||
}
|
|
||||||
on_finish:
|
|
||||||
- if exist src\electron\electron.log ( appveyor-retry appveyor PushArtifact src\electron\electron.log )
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
steps:
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: 'Copy Files to: src/electron'
|
|
||||||
inputs:
|
|
||||||
TargetFolder: src/electron
|
|
||||||
|
|
||||||
- bash: |
|
|
||||||
cd src/electron
|
|
||||||
node script/yarn.js install --frozen-lockfile
|
|
||||||
displayName: 'Yarn install'
|
|
||||||
|
|
||||||
- bash: |
|
|
||||||
export ZIP_DEST=$PWD/src/out/Default
|
|
||||||
echo "##vso[task.setvariable variable=ZIP_DEST]$ZIP_DEST"
|
|
||||||
mkdir -p $ZIP_DEST
|
|
||||||
cd src/electron
|
|
||||||
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=dist.zip --dest=$ZIP_DEST
|
|
||||||
cd $ZIP_DEST
|
|
||||||
unzip -o dist.zip
|
|
||||||
xattr -cr Electron.app
|
|
||||||
displayName: 'Download and unzip dist files for test'
|
|
||||||
env:
|
|
||||||
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
|
|
||||||
|
|
||||||
- bash: |
|
|
||||||
export FFMPEG_ZIP_DEST=$PWD/src/out/ffmpeg
|
|
||||||
mkdir -p $FFMPEG_ZIP_DEST
|
|
||||||
cd src/electron
|
|
||||||
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=ffmpeg.zip --dest=$FFMPEG_ZIP_DEST
|
|
||||||
cd $FFMPEG_ZIP_DEST
|
|
||||||
unzip -o ffmpeg.zip
|
|
||||||
displayName: 'Download and unzip ffmpeg for test'
|
|
||||||
env:
|
|
||||||
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
|
|
||||||
|
|
||||||
- bash: |
|
|
||||||
export NODE_HEADERS_DEST=$PWD/src/out/Default/gen
|
|
||||||
mkdir -p $NODE_HEADERS_DEST
|
|
||||||
cd src/electron
|
|
||||||
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=node_headers.tar.gz --dest=$NODE_HEADERS_DEST
|
|
||||||
cd $NODE_HEADERS_DEST
|
|
||||||
tar xzf node_headers.tar.gz
|
|
||||||
displayName: 'Download and untar node header files for test'
|
|
||||||
env:
|
|
||||||
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
|
|
||||||
|
|
||||||
- bash: |
|
|
||||||
export CROSS_ARCH_SNAPSHOTS=$PWD/src/out/Default/cross-arch-snapshots
|
|
||||||
mkdir -p $CROSS_ARCH_SNAPSHOTS
|
|
||||||
cd src/electron
|
|
||||||
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/snapshot_blob.bin --dest=$CROSS_ARCH_SNAPSHOTS
|
|
||||||
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/v8_context_snapshot.arm64.bin --dest=$CROSS_ARCH_SNAPSHOTS
|
|
||||||
displayName: 'Download cross arch snapshot files'
|
|
||||||
env:
|
|
||||||
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
|
|
||||||
|
|
||||||
- bash: |
|
|
||||||
cd src
|
|
||||||
export ELECTRON_OUT_DIR=Default
|
|
||||||
export npm_config_arch=arm64
|
|
||||||
(cd electron && node script/yarn test --enable-logging --runners main)
|
|
||||||
displayName: 'Run Electron main tests'
|
|
||||||
timeoutInMinutes: 20
|
|
||||||
env:
|
|
||||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
|
||||||
IGNORE_YARN_INSTALL_ERROR: 1
|
|
||||||
ELECTRON_TEST_RESULTS_DIR: junit
|
|
||||||
|
|
||||||
- bash: |
|
|
||||||
cd src
|
|
||||||
export ELECTRON_OUT_DIR=Default
|
|
||||||
export npm_config_arch=arm64
|
|
||||||
(cd electron && node script/yarn test --enable-logging --runners remote)
|
|
||||||
displayName: 'Run Electron remote tests'
|
|
||||||
timeoutInMinutes: 20
|
|
||||||
condition: succeededOrFailed()
|
|
||||||
env:
|
|
||||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
|
||||||
IGNORE_YARN_INSTALL_ERROR: 1
|
|
||||||
ELECTRON_TEST_RESULTS_DIR: junit
|
|
||||||
|
|
||||||
- bash: |
|
|
||||||
cd src
|
|
||||||
python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg
|
|
||||||
displayName: Verify non proprietary ffmpeg
|
|
||||||
timeoutInMinutes: 5
|
|
||||||
condition: succeededOrFailed()
|
|
||||||
env:
|
|
||||||
TARGET_ARCH: arm64
|
|
||||||
|
|
||||||
- bash: |
|
|
||||||
cd src
|
|
||||||
echo Verify cross arch snapshot
|
|
||||||
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/out/Default/cross-arch-snapshots
|
|
||||||
displayName: Verify cross arch snapshot
|
|
||||||
timeoutInMinutes: 5
|
|
||||||
condition: succeededOrFailed()
|
|
||||||
|
|
||||||
- task: PublishTestResults@2
|
|
||||||
displayName: 'Publish Test Results'
|
|
||||||
inputs:
|
|
||||||
testResultsFiles: '*.xml'
|
|
||||||
|
|
||||||
searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/'
|
|
||||||
|
|
||||||
condition: succeededOrFailed()
|
|
||||||
|
|
||||||
- bash: killall Electron || echo "No Electron processes left running"
|
|
||||||
displayName: 'Kill processes left running from last test run'
|
|
||||||
condition: always()
|
|
||||||
|
|
||||||
- bash: |
|
|
||||||
rm -rf ~/Library/Application\ Support/Electron*
|
|
||||||
rm -rf ~/Library/Application\ Support/electron*
|
|
||||||
displayName: 'Delete user app data directories'
|
|
||||||
condition: always()
|
|
||||||
|
|
||||||
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
|
||||||
displayName: 'Clean Agent Directories'
|
|
||||||
|
|
||||||
condition: always()
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
workspace:
|
|
||||||
clean: all
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- checkout: self
|
|
||||||
path: src\electron
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
node script/yarn.js install --frozen-lockfile
|
|
||||||
displayName: 'Yarn install'
|
|
||||||
|
|
||||||
- powershell: |
|
|
||||||
$localArtifactPath = "$pwd\dist.zip"
|
|
||||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/dist.zip"
|
|
||||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
|
||||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -o$(Pipeline.Workspace)\src\out\Default -y $localArtifactPath
|
|
||||||
displayName: 'Download and extract dist.zip for test'
|
|
||||||
env:
|
|
||||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
|
||||||
|
|
||||||
- powershell: |
|
|
||||||
$localArtifactPath = "$(Pipeline.Workspace)\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"
|
|
||||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
|
||||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -o$(Pipeline.Workspace)\src\out\ffmpeg $localArtifactPath
|
|
||||||
displayName: 'Download and extract ffmpeg.zip for test'
|
|
||||||
env:
|
|
||||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
|
||||||
|
|
||||||
- powershell: |
|
|
||||||
$localArtifactPath = "$(Pipeline.Workspace)\src\node_headers.zip"
|
|
||||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/node_headers.zip"
|
|
||||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
|
||||||
cd $(Pipeline.Workspace)\src
|
|
||||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y node_headers.zip
|
|
||||||
displayName: 'Download node headers for test'
|
|
||||||
env:
|
|
||||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
|
||||||
|
|
||||||
- powershell: |
|
|
||||||
$localArtifactPath = "$(Pipeline.Workspace)\src\out\Default\electron.lib"
|
|
||||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/electron.lib"
|
|
||||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
|
||||||
displayName: 'Download electron.lib for test'
|
|
||||||
env:
|
|
||||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
|
||||||
|
|
||||||
# Uncomment the following block if pdb files are needed to debug issues
|
|
||||||
# - powershell: |
|
|
||||||
# try {
|
|
||||||
# $localArtifactPath = "$(Pipeline.Workspace)\src\pdb.zip"
|
|
||||||
# $serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/pdb.zip"
|
|
||||||
# Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
|
||||||
# cd $(Pipeline.Workspace)\src
|
|
||||||
# & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip
|
|
||||||
# } catch {
|
|
||||||
# Write-Host "There was an exception encountered while downloading pdb files:" $_.Exception.Message
|
|
||||||
# } finally {
|
|
||||||
# $global:LASTEXITCODE = 0
|
|
||||||
# }
|
|
||||||
# displayName: 'Download pdb files for detailed stacktraces'
|
|
||||||
# env:
|
|
||||||
# APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
|
||||||
|
|
||||||
- powershell: |
|
|
||||||
New-Item $(Pipeline.Workspace)\src\out\Default\gen\node_headers\Release -Type directory
|
|
||||||
Copy-Item -path $(Pipeline.Workspace)\src\out\Default\electron.lib -destination $(Pipeline.Workspace)\src\out\Default\gen\node_headers\Release\node.lib
|
|
||||||
displayName: 'Setup node headers'
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
cd $(Pipeline.Workspace)\src
|
|
||||||
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
|
||||||
set npm_config_arch=arm64
|
|
||||||
cd electron
|
|
||||||
node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
|
|
||||||
displayName: 'Run Electron Main process tests'
|
|
||||||
env:
|
|
||||||
ELECTRON_ENABLE_STACK_DUMPING: true
|
|
||||||
ELECTRON_OUT_DIR: Default
|
|
||||||
IGNORE_YARN_INSTALL_ERROR: 1
|
|
||||||
ELECTRON_TEST_RESULTS_DIR: junit
|
|
||||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
cd $(Pipeline.Workspace)\src
|
|
||||||
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
|
||||||
set npm_config_arch=arm64
|
|
||||||
cd electron
|
|
||||||
node script/yarn test --runners=remote --enable-logging --disable-features=CalculateNativeWinOcclusion
|
|
||||||
displayName: 'Run Electron Remote based tests'
|
|
||||||
env:
|
|
||||||
ELECTRON_OUT_DIR: Default
|
|
||||||
IGNORE_YARN_INSTALL_ERROR: 1
|
|
||||||
ELECTRON_TEST_RESULTS_DIR: junit
|
|
||||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
|
||||||
condition: succeededOrFailed()
|
|
||||||
|
|
||||||
- task: PublishTestResults@2
|
|
||||||
displayName: 'Publish Test Results'
|
|
||||||
inputs:
|
|
||||||
testResultsFiles: '*.xml'
|
|
||||||
searchFolder: '$(Pipeline.Workspace)/src/junit/'
|
|
||||||
condition: always()
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
cd $(Pipeline.Workspace)\src
|
|
||||||
echo "Verifying non proprietary ffmpeg"
|
|
||||||
python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
|
||||||
displayName: 'Verify ffmpeg'
|
|
||||||
|
|
||||||
- powershell: |
|
|
||||||
Get-Process | Where Name –Like "electron*" | Stop-Process
|
|
||||||
Get-Process | Where Name –Like "msedge*" | Stop-Process
|
|
||||||
displayName: 'Kill processes left running from last test run'
|
|
||||||
condition: always()
|
|
||||||
|
|
||||||
- powershell: |
|
|
||||||
Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore
|
|
||||||
displayName: 'Delete user app data directories'
|
|
||||||
condition: always()
|
|
||||||
@@ -2,7 +2,7 @@ is_electron_build = true
|
|||||||
root_extra_deps = [ "//electron" ]
|
root_extra_deps = [ "//electron" ]
|
||||||
|
|
||||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
|
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
|
||||||
node_module_version = 106
|
node_module_version = 113
|
||||||
|
|
||||||
v8_promise_internal_field_count = 1
|
v8_promise_internal_field_count = 1
|
||||||
v8_embedder_string = "-electron.0"
|
v8_embedder_string = "-electron.0"
|
||||||
@@ -20,7 +20,10 @@ enable_cdm_host_verification = false
|
|||||||
proprietary_codecs = true
|
proprietary_codecs = true
|
||||||
ffmpeg_branding = "Chrome"
|
ffmpeg_branding = "Chrome"
|
||||||
|
|
||||||
enable_basic_printing = true
|
enable_printing = true
|
||||||
|
|
||||||
|
# Removes DLLs from the build, which are only meant to be used for Chromium development.
|
||||||
|
# See https://github.com/electron/electron/pull/17985
|
||||||
angle_enable_vulkan_validation_layers = false
|
angle_enable_vulkan_validation_layers = false
|
||||||
dawn_enable_vulkan_validation_layers = false
|
dawn_enable_vulkan_validation_layers = false
|
||||||
|
|
||||||
@@ -29,9 +32,19 @@ dawn_enable_vulkan_validation_layers = false
|
|||||||
# See https://chromium-review.googlesource.com/c/chromium/src/+/2774898.
|
# See https://chromium-review.googlesource.com/c/chromium/src/+/2774898.
|
||||||
enable_pseudolocales = false
|
enable_pseudolocales = false
|
||||||
|
|
||||||
is_cfi = false
|
|
||||||
|
|
||||||
# Make application name configurable at runtime for cookie crypto
|
# Make application name configurable at runtime for cookie crypto
|
||||||
allow_runtime_configurable_key_storage = true
|
allow_runtime_configurable_key_storage = true
|
||||||
|
|
||||||
|
# CET shadow stack is incompatible with v8, until v8 is CET compliant
|
||||||
|
# enabling this flag causes main process crashes where CET is enabled
|
||||||
|
# Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=357
|
||||||
enable_cet_shadow_stack = false
|
enable_cet_shadow_stack = false
|
||||||
|
|
||||||
|
# For similar reasons, disable CFI, which is not well supported in V8.
|
||||||
|
# Chromium doesn't have any problems with this because they do not run
|
||||||
|
# V8 in the browser process.
|
||||||
|
# Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=281
|
||||||
|
is_cfi = false
|
||||||
|
|
||||||
|
# TODO: fix this once sysroots have been updated.
|
||||||
|
use_qt = false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
root_extra_deps = [ "//electron/spec" ]
|
root_extra_deps = [ "//electron/spec-chromium:spec" ]
|
||||||
|
|
||||||
dcheck_always_on = true
|
dcheck_always_on = true
|
||||||
is_debug = false
|
is_debug = false
|
||||||
|
|||||||
@@ -1,33 +1,22 @@
|
|||||||
import("node.gni")
|
template("node_action") {
|
||||||
|
assert(defined(invoker.script), "Need script path to run")
|
||||||
|
assert(defined(invoker.args), "Need script arguments")
|
||||||
|
|
||||||
# TODO(MarshallOfSound): Move to electron/node, this is the only place it is used now
|
|
||||||
# Run an action with a given working directory. Behaves identically to the
|
|
||||||
# action() target type, with the exception that it changes directory before
|
|
||||||
# running the script.
|
|
||||||
#
|
|
||||||
# Parameters:
|
|
||||||
# cwd [required]: Directory to change to before running the script.
|
|
||||||
template("chdir_action") {
|
|
||||||
action(target_name) {
|
action(target_name) {
|
||||||
forward_variables_from(invoker,
|
forward_variables_from(invoker,
|
||||||
"*",
|
|
||||||
[
|
[
|
||||||
"script",
|
"deps",
|
||||||
"args",
|
"public_deps",
|
||||||
|
"sources",
|
||||||
|
"inputs",
|
||||||
|
"outputs",
|
||||||
])
|
])
|
||||||
assert(defined(cwd), "Need cwd in $target_name")
|
if (!defined(inputs)) {
|
||||||
script = "//electron/build/run-in-dir.py"
|
inputs = []
|
||||||
if (defined(sources)) {
|
|
||||||
sources += [ invoker.script ]
|
|
||||||
} else {
|
|
||||||
assert(defined(inputs))
|
|
||||||
inputs += [ invoker.script ]
|
|
||||||
}
|
}
|
||||||
args = [
|
inputs += [ invoker.script ]
|
||||||
rebase_path(cwd),
|
script = "//electron/build/run-node.py"
|
||||||
rebase_path(invoker.script),
|
args = [ rebase_path(invoker.script) ] + invoker.args
|
||||||
]
|
|
||||||
args += invoker.args
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,8 @@
|
|||||||
config("build_time_executable") {
|
|
||||||
configs = []
|
|
||||||
|
|
||||||
if (is_electron_build && !is_component_build) {
|
|
||||||
# The executables which have this config applied are dependent on ffmpeg,
|
|
||||||
# which is always a shared library in an Electron build. However, in the
|
|
||||||
# non-component build, executables don't have rpath set to search for
|
|
||||||
# libraries in the executable's directory, so ffmpeg cannot be found. So
|
|
||||||
# let's make sure rpath is set here.
|
|
||||||
# See '//build/config/gcc/BUILD.gn' for details on the rpath setting.
|
|
||||||
if (is_linux) {
|
|
||||||
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_mac) {
|
|
||||||
ldflags = [ "-Wl,-rpath,@loader_path/." ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# For MAS build, we force defining "MAS_BUILD".
|
# For MAS build, we force defining "MAS_BUILD".
|
||||||
config("mas_build") {
|
config("mas_build") {
|
||||||
if (is_mas_build) {
|
if (is_mas_build) {
|
||||||
defines = [ "MAS_BUILD" ]
|
defines = [ "IS_MAS_BUILD()=1" ]
|
||||||
|
} else {
|
||||||
|
defines = [ "IS_MAS_BUILD()=0" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,11 @@ template("extract_symbols") {
|
|||||||
assert(defined(invoker.binary), "Need binary to dump")
|
assert(defined(invoker.binary), "Need binary to dump")
|
||||||
assert(defined(invoker.symbol_dir), "Need directory for symbol output")
|
assert(defined(invoker.symbol_dir), "Need directory for symbol output")
|
||||||
|
|
||||||
dump_syms_label = "//third_party/breakpad:dump_syms($host_toolchain)"
|
if (host_os == "win" && target_cpu == "x86") {
|
||||||
|
dump_syms_label = "//third_party/breakpad:dump_syms(//build/toolchain/win:win_clang_x64)"
|
||||||
|
} else {
|
||||||
|
dump_syms_label = "//third_party/breakpad:dump_syms($host_toolchain)"
|
||||||
|
}
|
||||||
dump_syms_binary = get_label_info(dump_syms_label, "root_out_dir") +
|
dump_syms_binary = get_label_info(dump_syms_label, "root_out_dir") +
|
||||||
"/dump_syms$_host_executable_suffix"
|
"/dump_syms$_host_executable_suffix"
|
||||||
|
|
||||||
|
|||||||
@@ -19,17 +19,13 @@ TEMPLATE_H = """
|
|||||||
#define FUSE_EXPORT __attribute__((visibility("default")))
|
#define FUSE_EXPORT __attribute__((visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace electron {
|
namespace electron::fuses {
|
||||||
|
|
||||||
namespace fuses {
|
|
||||||
|
|
||||||
extern const volatile char kFuseWire[];
|
extern const volatile char kFuseWire[];
|
||||||
|
|
||||||
{getters}
|
{getters}
|
||||||
|
|
||||||
} // namespace fuses
|
} // namespace electron::fuses
|
||||||
|
|
||||||
} // namespace electron
|
|
||||||
|
|
||||||
#endif // ELECTRON_FUSES_H_
|
#endif // ELECTRON_FUSES_H_
|
||||||
"""
|
"""
|
||||||
@@ -37,17 +33,13 @@ extern const volatile char kFuseWire[];
|
|||||||
TEMPLATE_CC = """
|
TEMPLATE_CC = """
|
||||||
#include "electron/fuses.h"
|
#include "electron/fuses.h"
|
||||||
|
|
||||||
namespace electron {
|
namespace electron::fuses {
|
||||||
|
|
||||||
namespace fuses {
|
|
||||||
|
|
||||||
const volatile char kFuseWire[] = { /* sentinel */ {sentinel}, /* fuse_version */ {fuse_version}, /* fuse_wire_length */ {fuse_wire_length}, /* fuse_wire */ {initial_config}};
|
const volatile char kFuseWire[] = { /* sentinel */ {sentinel}, /* fuse_version */ {fuse_version}, /* fuse_wire_length */ {fuse_wire_length}, /* fuse_wire */ {initial_config}};
|
||||||
|
|
||||||
{getters}
|
{getters}
|
||||||
|
|
||||||
}
|
} // namespace electron:fuses
|
||||||
|
|
||||||
}
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
with open(os.path.join(dir_path, "fuses.json5"), 'r') as f:
|
with open(os.path.join(dir_path, "fuses.json5"), 'r') as f:
|
||||||
|
|||||||
@@ -7,5 +7,6 @@
|
|||||||
"node_options": "1",
|
"node_options": "1",
|
||||||
"node_cli_inspect": "1",
|
"node_cli_inspect": "1",
|
||||||
"embedded_asar_integrity_validation": "0",
|
"embedded_asar_integrity_validation": "0",
|
||||||
"only_load_app_from_asar": "0"
|
"only_load_app_from_asar": "0",
|
||||||
|
"load_browser_process_specific_v8_snapshot": "0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -8,9 +8,7 @@ TEMPLATE = """
|
|||||||
#include "node_native_module.h"
|
#include "node_native_module.h"
|
||||||
#include "node_internals.h"
|
#include "node_internals.h"
|
||||||
|
|
||||||
namespace node {{
|
namespace node::native_module {{
|
||||||
|
|
||||||
namespace native_module {{
|
|
||||||
|
|
||||||
{definitions}
|
{definitions}
|
||||||
|
|
||||||
@@ -18,9 +16,7 @@ void NativeModuleLoader::LoadEmbedderJavaScriptSource() {{
|
|||||||
{initializers}
|
{initializers}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
}} // namespace native_module
|
}} // namespace node::native_module
|
||||||
|
|
||||||
}} // namespace node
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# Cocoa .app bundle. The presence of these empty directories is sufficient to
|
# Cocoa .app bundle. The presence of these empty directories is sufficient to
|
||||||
# convince Cocoa that the application supports the named localization, even if
|
# convince Cocoa that the application supports the named localization, even if
|
||||||
# an InfoPlist.strings file is not provided. Chrome uses these empty locale
|
# an InfoPlist.strings file is not provided. Chrome uses these empty locale
|
||||||
# directoires for its helper executable bundles, which do not otherwise
|
# directories for its helper executable bundles, which do not otherwise
|
||||||
# require any direct Cocoa locale support.
|
# require any direct Cocoa locale support.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
template("node_action") {
|
|
||||||
assert(defined(invoker.script), "Need script path to run")
|
|
||||||
assert(defined(invoker.args), "Need script argumets")
|
|
||||||
|
|
||||||
action(target_name) {
|
|
||||||
forward_variables_from(invoker,
|
|
||||||
[
|
|
||||||
"deps",
|
|
||||||
"public_deps",
|
|
||||||
"sources",
|
|
||||||
"inputs",
|
|
||||||
"outputs",
|
|
||||||
])
|
|
||||||
if (!defined(inputs)) {
|
|
||||||
inputs = []
|
|
||||||
}
|
|
||||||
inputs += [ invoker.script ]
|
|
||||||
script = "//electron/build/run-node.py"
|
|
||||||
args = [ rebase_path(invoker.script) ] + invoker.args
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
template("npm_action") {
|
template("npm_action") {
|
||||||
assert(defined(invoker.script),
|
assert(defined(invoker.script),
|
||||||
"Need script name to run (must be defined in package.json)")
|
"Need script name to run (must be defined in package.json)")
|
||||||
assert(defined(invoker.args), "Need script argumets")
|
assert(defined(invoker.args), "Need script arguments")
|
||||||
|
|
||||||
action("npm_pre_flight_" + target_name) {
|
action("npm_pre_flight_" + target_name) {
|
||||||
inputs = [
|
inputs = [
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import optparse
|
import optparse
|
||||||
import json
|
import json
|
||||||
import re
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
sys.path.append("%s/../../build" % os.path.dirname(os.path.realpath(__file__)))
|
sys.path.append("%s/../../build" % os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
|
||||||
@@ -36,56 +34,10 @@ def calculate_hash(root):
|
|||||||
return CalculateHash('.', None)
|
return CalculateHash('.', None)
|
||||||
|
|
||||||
def windows_installed_software():
|
def windows_installed_software():
|
||||||
powershell_command = [
|
# file_path = os.path.join(os.getcwd(), 'installed_software.json')
|
||||||
"Get-CimInstance",
|
# return json.loads(open('installed_software.json').read().decode('utf-8'))
|
||||||
"-Namespace",
|
f = open('installed_software.json', encoding='utf-8-sig')
|
||||||
"root\cimv2",
|
return json.load(f)
|
||||||
"-Class",
|
|
||||||
"Win32_product",
|
|
||||||
"|",
|
|
||||||
"Select",
|
|
||||||
"vendor,",
|
|
||||||
"description,",
|
|
||||||
"@{l='install_location';e='InstallLocation'},",
|
|
||||||
"@{l='install_date';e='InstallDate'},",
|
|
||||||
"@{l='install_date_2';e='InstallDate2'},",
|
|
||||||
"caption,",
|
|
||||||
"version,",
|
|
||||||
"name,",
|
|
||||||
"@{l='sku_number';e='SKUNumber'}",
|
|
||||||
"|",
|
|
||||||
"ConvertTo-Json",
|
|
||||||
]
|
|
||||||
|
|
||||||
proc = subprocess.Popen(
|
|
||||||
["powershell.exe", "-Command", "-"],
|
|
||||||
stdin=subprocess.PIPE,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
)
|
|
||||||
|
|
||||||
stdout, _ = proc.communicate(" ".join(powershell_command).encode("utf-8"))
|
|
||||||
|
|
||||||
if proc.returncode != 0:
|
|
||||||
raise RuntimeError("Failed to get list of installed software")
|
|
||||||
|
|
||||||
# On AppVeyor there's other output related to PSReadline,
|
|
||||||
# so grab only the JSON output and ignore everything else
|
|
||||||
json_match = re.match(
|
|
||||||
r".*(\[.*{.*}.*\]).*", stdout.decode("utf-8"), re.DOTALL
|
|
||||||
)
|
|
||||||
|
|
||||||
if not json_match:
|
|
||||||
raise RuntimeError(
|
|
||||||
"Couldn't find JSON output for list of installed software"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Filter out missing keys
|
|
||||||
return list(
|
|
||||||
map(
|
|
||||||
lambda info: {k: info[k] for k in info if info[k]},
|
|
||||||
json.loads(json_match.group(1)),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def windows_profile():
|
def windows_profile():
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ template("compile_ib_files") {
|
|||||||
# Template to compile and package Mac XIB files as bundle data.
|
# Template to compile and package Mac XIB files as bundle data.
|
||||||
# Arguments
|
# Arguments
|
||||||
# sources:
|
# sources:
|
||||||
# list of string, sources to comiple
|
# list of string, sources to compile
|
||||||
# output_path:
|
# output_path:
|
||||||
# (optional) string, the path to use for the outputs list in the
|
# (optional) string, the path to use for the outputs list in the
|
||||||
# bundle_data step. If unspecified, defaults to bundle_resources_dir.
|
# bundle_data step. If unspecified, defaults to bundle_resources_dir.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ END
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 19,0,0,20220329
|
FILEVERSION $major,$minor,$patch,$prerelease_number
|
||||||
PRODUCTVERSION 19,0,0,20220329
|
PRODUCTVERSION $major,$minor,$patch,$prerelease_number
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
@@ -68,12 +68,12 @@ BEGIN
|
|||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "GitHub, Inc."
|
VALUE "CompanyName", "GitHub, Inc."
|
||||||
VALUE "FileDescription", "Electron"
|
VALUE "FileDescription", "Electron"
|
||||||
VALUE "FileVersion", "19.0.0"
|
VALUE "FileVersion", "$major.$minor.$patch"
|
||||||
VALUE "InternalName", "electron.exe"
|
VALUE "InternalName", "electron.exe"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
|
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
|
||||||
VALUE "OriginalFilename", "electron.exe"
|
VALUE "OriginalFilename", "electron.exe"
|
||||||
VALUE "ProductName", "Electron"
|
VALUE "ProductName", "Electron"
|
||||||
VALUE "ProductVersion", "19.0.0"
|
VALUE "ProductVersion", "$major.$minor.$patch"
|
||||||
VALUE "SquirrelAwareVersion", "1"
|
VALUE "SquirrelAwareVersion", "1"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
1
build/templates/version_string.tmpl
Normal file
1
build/templates/version_string.tmpl
Normal file
@@ -0,0 +1 @@
|
|||||||
|
$full_version
|
||||||
@@ -75,9 +75,17 @@ module.exports = ({
|
|||||||
|
|
||||||
if (targetDeletesNodeGlobals) {
|
if (targetDeletesNodeGlobals) {
|
||||||
plugins.push(new webpack.ProvidePlugin({
|
plugins.push(new webpack.ProvidePlugin({
|
||||||
process: ['@electron/internal/common/webpack-provider', 'process'],
|
Buffer: ['@electron/internal/common/webpack-provider', 'Buffer'],
|
||||||
global: ['@electron/internal/common/webpack-provider', '_global'],
|
global: ['@electron/internal/common/webpack-provider', '_global'],
|
||||||
Buffer: ['@electron/internal/common/webpack-provider', 'Buffer']
|
process: ['@electron/internal/common/webpack-provider', 'process']
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Webpack 5 no longer polyfills process or Buffer.
|
||||||
|
if (!alwaysHasNode) {
|
||||||
|
plugins.push(new webpack.ProvidePlugin({
|
||||||
|
Buffer: ['buffer', 'Buffer'],
|
||||||
|
process: 'process/browser'
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +137,12 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
|||||||
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
||||||
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||||
},
|
},
|
||||||
extensions: ['.ts', '.js']
|
extensions: ['.ts', '.js'],
|
||||||
|
fallback: {
|
||||||
|
// We provide our own "timers" import above, any usage of setImmediate inside
|
||||||
|
// one of our renderer bundles should import it from the 'timers' package
|
||||||
|
setImmediate: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [{
|
rules: [{
|
||||||
@@ -150,10 +163,7 @@ if ((globalThis.process || binding.process).argv.includes("--profile-electron-in
|
|||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
__dirname: false,
|
__dirname: false,
|
||||||
__filename: false,
|
__filename: false
|
||||||
// We provide our own "timers" import above, any usage of setImmediate inside
|
|
||||||
// one of our renderer bundles should import it from the 'timers' package
|
|
||||||
setImmediate: false
|
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: env.mode === 'production',
|
minimize: env.mode === 'production',
|
||||||
|
|||||||
4
build/webpack/webpack.config.utility.js
Normal file
4
build/webpack/webpack.config.utility.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module.exports = require('./webpack.config.base')({
|
||||||
|
target: 'utility',
|
||||||
|
alwaysHasNode: true
|
||||||
|
});
|
||||||
@@ -30,11 +30,14 @@ template("webpack_build") {
|
|||||||
args = [
|
args = [
|
||||||
"--config",
|
"--config",
|
||||||
rebase_path(invoker.config_file),
|
rebase_path(invoker.config_file),
|
||||||
"--output-filename=" + get_path_info(invoker.out_file, "file"),
|
"--output-filename",
|
||||||
"--output-path=" + rebase_path(get_path_info(invoker.out_file, "dir")),
|
get_path_info(invoker.out_file, "file"),
|
||||||
"--env.buildflags=" +
|
"--output-path",
|
||||||
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
rebase_path(get_path_info(invoker.out_file, "dir")),
|
||||||
"--env.mode=" + mode,
|
"--env",
|
||||||
|
"buildflags=" + rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||||
|
"--env",
|
||||||
|
"mode=" + mode,
|
||||||
]
|
]
|
||||||
deps += [ "//electron/buildflags" ]
|
deps += [ "//electron/buildflags" ]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ buildflag_header("buildflags") {
|
|||||||
"ENABLE_ELECTRON_EXTENSIONS=$enable_electron_extensions",
|
"ENABLE_ELECTRON_EXTENSIONS=$enable_electron_extensions",
|
||||||
"ENABLE_BUILTIN_SPELLCHECKER=$enable_builtin_spellchecker",
|
"ENABLE_BUILTIN_SPELLCHECKER=$enable_builtin_spellchecker",
|
||||||
"ENABLE_PICTURE_IN_PICTURE=$enable_picture_in_picture",
|
"ENABLE_PICTURE_IN_PICTURE=$enable_picture_in_picture",
|
||||||
"ENABLE_WIN_DARK_MODE_WINDOW_UI=$enable_win_dark_mode_window_ui",
|
|
||||||
"OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
|
"OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,4 @@ declare_args() {
|
|||||||
|
|
||||||
# Enable Spellchecker support
|
# Enable Spellchecker support
|
||||||
enable_builtin_spellchecker = true
|
enable_builtin_spellchecker = true
|
||||||
|
|
||||||
# Undocumented Windows dark mode API
|
|
||||||
enable_win_dark_mode_window_ui = false
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import("//build/config/ozone.gni")
|
|||||||
import("//build/config/ui.gni")
|
import("//build/config/ui.gni")
|
||||||
import("//components/spellcheck/spellcheck_build_features.gni")
|
import("//components/spellcheck/spellcheck_build_features.gni")
|
||||||
import("//electron/buildflags/buildflags.gni")
|
import("//electron/buildflags/buildflags.gni")
|
||||||
|
import("//ppapi/buildflags/buildflags.gni")
|
||||||
import("//printing/buildflags/buildflags.gni")
|
import("//printing/buildflags/buildflags.gni")
|
||||||
import("//third_party/widevine/cdm/widevine.gni")
|
import("//third_party/widevine/cdm/widevine.gni")
|
||||||
|
|
||||||
@@ -55,6 +56,14 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/process_singleton.h",
|
"//chrome/browser/process_singleton.h",
|
||||||
"//chrome/browser/process_singleton_internal.cc",
|
"//chrome/browser/process_singleton_internal.cc",
|
||||||
"//chrome/browser/process_singleton_internal.h",
|
"//chrome/browser/process_singleton_internal.h",
|
||||||
|
"//chrome/browser/themes/browser_theme_pack.cc",
|
||||||
|
"//chrome/browser/themes/browser_theme_pack.h",
|
||||||
|
"//chrome/browser/themes/custom_theme_supplier.cc",
|
||||||
|
"//chrome/browser/themes/custom_theme_supplier.h",
|
||||||
|
"//chrome/browser/themes/theme_properties.cc",
|
||||||
|
"//chrome/browser/themes/theme_properties.h",
|
||||||
|
"//chrome/browser/ui/color/chrome_color_mixers.cc",
|
||||||
|
"//chrome/browser/ui/color/chrome_color_mixers.h",
|
||||||
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.cc",
|
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.cc",
|
||||||
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h",
|
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h",
|
||||||
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.cc",
|
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.cc",
|
||||||
@@ -69,12 +78,17 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.h",
|
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.h",
|
||||||
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.cc",
|
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.cc",
|
||||||
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.h",
|
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.h",
|
||||||
|
"//chrome/browser/ui/frame/window_frame_util.cc",
|
||||||
|
"//chrome/browser/ui/frame/window_frame_util.h",
|
||||||
|
"//chrome/browser/ui/ui_features.cc",
|
||||||
|
"//chrome/browser/ui/ui_features.h",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.cc",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.cc",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.h",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view.h",
|
||||||
"//extensions/browser/app_window/size_constraints.cc",
|
"//extensions/browser/app_window/size_constraints.cc",
|
||||||
"//extensions/browser/app_window/size_constraints.h",
|
"//extensions/browser/app_window/size_constraints.h",
|
||||||
|
"//ui/views/native_window_tracker.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (is_posix) {
|
if (is_posix) {
|
||||||
@@ -88,7 +102,10 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/icon_loader_mac.mm",
|
"//chrome/browser/icon_loader_mac.mm",
|
||||||
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
|
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
|
||||||
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
|
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
|
||||||
|
"//chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.h",
|
||||||
|
"//chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm",
|
||||||
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
|
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
|
||||||
|
"//chrome/browser/platform_util_mac.mm",
|
||||||
"//chrome/browser/process_singleton_mac.mm",
|
"//chrome/browser/process_singleton_mac.mm",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
|
||||||
@@ -106,6 +123,8 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/ui/view_ids.h",
|
"//chrome/browser/ui/view_ids.h",
|
||||||
"//chrome/browser/win/chrome_process_finder.cc",
|
"//chrome/browser/win/chrome_process_finder.cc",
|
||||||
"//chrome/browser/win/chrome_process_finder.h",
|
"//chrome/browser/win/chrome_process_finder.h",
|
||||||
|
"//chrome/browser/win/titlebar_config.cc",
|
||||||
|
"//chrome/browser/win/titlebar_config.h",
|
||||||
"//chrome/browser/win/titlebar_config.h",
|
"//chrome/browser/win/titlebar_config.h",
|
||||||
"//chrome/child/v8_crashpad_support_win.cc",
|
"//chrome/child/v8_crashpad_support_win.cc",
|
||||||
"//chrome/child/v8_crashpad_support_win.h",
|
"//chrome/child/v8_crashpad_support_win.h",
|
||||||
@@ -120,11 +139,14 @@ static_library("chrome") {
|
|||||||
sources += [
|
sources += [
|
||||||
"//chrome/browser/platform_util_aura.cc",
|
"//chrome/browser/platform_util_aura.cc",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_aura.cc",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_aura.cc",
|
||||||
|
"//ui/views/native_window_tracker_aura.cc",
|
||||||
|
"//ui/views/native_window_tracker_aura.h",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
public_deps = [
|
public_deps = [
|
||||||
"//chrome/browser:dev_ui_browser_resources",
|
"//chrome/browser:dev_ui_browser_resources",
|
||||||
|
"//chrome/browser/ui/color:mixers",
|
||||||
"//chrome/common",
|
"//chrome/common",
|
||||||
"//chrome/common:version_header",
|
"//chrome/common:version_header",
|
||||||
"//components/keyed_service/content",
|
"//components/keyed_service/content",
|
||||||
@@ -135,10 +157,7 @@ static_library("chrome") {
|
|||||||
"//services/strings",
|
"//services/strings",
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [ "//chrome/browser:resource_prefetch_predictor_proto" ]
|
||||||
"//chrome/browser:resource_prefetch_predictor_proto",
|
|
||||||
"//components/optimization_guide/proto:optimization_guide_proto",
|
|
||||||
]
|
|
||||||
|
|
||||||
if (is_linux) {
|
if (is_linux) {
|
||||||
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
|
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
|
||||||
@@ -193,7 +212,7 @@ static_library("chrome") {
|
|||||||
deps += [ "//components/cdm/renderer" ]
|
deps += [ "//components/cdm/renderer" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_basic_printing) {
|
if (enable_printing) {
|
||||||
sources += [
|
sources += [
|
||||||
"//chrome/browser/bad_message.cc",
|
"//chrome/browser/bad_message.cc",
|
||||||
"//chrome/browser/bad_message.h",
|
"//chrome/browser/bad_message.h",
|
||||||
@@ -211,6 +230,12 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/printing/printer_query.h",
|
"//chrome/browser/printing/printer_query.h",
|
||||||
"//chrome/browser/printing/printing_service.cc",
|
"//chrome/browser/printing/printing_service.cc",
|
||||||
"//chrome/browser/printing/printing_service.h",
|
"//chrome/browser/printing/printing_service.h",
|
||||||
|
"//components/printing/browser/print_to_pdf/pdf_print_job.cc",
|
||||||
|
"//components/printing/browser/print_to_pdf/pdf_print_job.h",
|
||||||
|
"//components/printing/browser/print_to_pdf/pdf_print_result.cc",
|
||||||
|
"//components/printing/browser/print_to_pdf/pdf_print_result.h",
|
||||||
|
"//components/printing/browser/print_to_pdf/pdf_print_utils.cc",
|
||||||
|
"//components/printing/browser/print_to_pdf/pdf_print_utils.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (enable_oop_printing) {
|
if (enable_oop_printing) {
|
||||||
@@ -239,7 +264,10 @@ static_library("chrome") {
|
|||||||
sources += [
|
sources += [
|
||||||
"//chrome/browser/printing/pdf_to_emf_converter.cc",
|
"//chrome/browser/printing/pdf_to_emf_converter.cc",
|
||||||
"//chrome/browser/printing/pdf_to_emf_converter.h",
|
"//chrome/browser/printing/pdf_to_emf_converter.h",
|
||||||
|
"//chrome/browser/printing/printer_xml_parser_impl.cc",
|
||||||
|
"//chrome/browser/printing/printer_xml_parser_impl.h",
|
||||||
]
|
]
|
||||||
|
deps += [ "//printing:printing_base" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,32 +275,26 @@ static_library("chrome") {
|
|||||||
sources += [
|
sources += [
|
||||||
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc",
|
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc",
|
||||||
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
|
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
|
||||||
"//chrome/browser/ui/views/overlay/back_to_tab_image_button.cc",
|
|
||||||
"//chrome/browser/ui/views/overlay/back_to_tab_image_button.h",
|
|
||||||
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
|
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/close_image_button.h",
|
"//chrome/browser/ui/views/overlay/close_image_button.h",
|
||||||
"//chrome/browser/ui/views/overlay/constants.h",
|
"//chrome/browser/ui/views/overlay/constants.h",
|
||||||
"//chrome/browser/ui/views/overlay/document_overlay_window_views.cc",
|
|
||||||
"//chrome/browser/ui/views/overlay/document_overlay_window_views.h",
|
|
||||||
"//chrome/browser/ui/views/overlay/hang_up_button.cc",
|
"//chrome/browser/ui/views/overlay/hang_up_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/hang_up_button.h",
|
"//chrome/browser/ui/views/overlay/hang_up_button.h",
|
||||||
"//chrome/browser/ui/views/overlay/overlay_window_image_button.cc",
|
"//chrome/browser/ui/views/overlay/overlay_window_image_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/overlay_window_image_button.h",
|
"//chrome/browser/ui/views/overlay/overlay_window_image_button.h",
|
||||||
"//chrome/browser/ui/views/overlay/overlay_window_views.cc",
|
|
||||||
"//chrome/browser/ui/views/overlay/overlay_window_views.h",
|
|
||||||
"//chrome/browser/ui/views/overlay/playback_image_button.cc",
|
"//chrome/browser/ui/views/overlay/playback_image_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/playback_image_button.h",
|
"//chrome/browser/ui/views/overlay/playback_image_button.h",
|
||||||
"//chrome/browser/ui/views/overlay/resize_handle_button.cc",
|
"//chrome/browser/ui/views/overlay/resize_handle_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/resize_handle_button.h",
|
"//chrome/browser/ui/views/overlay/resize_handle_button.h",
|
||||||
|
"//chrome/browser/ui/views/overlay/simple_overlay_window_image_button.cc",
|
||||||
|
"//chrome/browser/ui/views/overlay/simple_overlay_window_image_button.h",
|
||||||
"//chrome/browser/ui/views/overlay/skip_ad_label_button.cc",
|
"//chrome/browser/ui/views/overlay/skip_ad_label_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/skip_ad_label_button.h",
|
"//chrome/browser/ui/views/overlay/skip_ad_label_button.h",
|
||||||
"//chrome/browser/ui/views/overlay/toggle_camera_button.cc",
|
"//chrome/browser/ui/views/overlay/toggle_camera_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/toggle_camera_button.h",
|
"//chrome/browser/ui/views/overlay/toggle_camera_button.h",
|
||||||
"//chrome/browser/ui/views/overlay/toggle_microphone_button.cc",
|
"//chrome/browser/ui/views/overlay/toggle_microphone_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
|
"//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
|
||||||
"//chrome/browser/ui/views/overlay/track_image_button.cc",
|
|
||||||
"//chrome/browser/ui/views/overlay/track_image_button.h",
|
|
||||||
"//chrome/browser/ui/views/overlay/video_overlay_window_views.cc",
|
"//chrome/browser/ui/views/overlay/video_overlay_window_views.cc",
|
||||||
"//chrome/browser/ui/views/overlay/video_overlay_window_views.h",
|
"//chrome/browser/ui/views/overlay/video_overlay_window_views.h",
|
||||||
]
|
]
|
||||||
@@ -290,10 +312,10 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/extensions/chrome_url_request_util.h",
|
"//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.cc",
|
||||||
"//chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h",
|
"//chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h",
|
||||||
"//chrome/renderer/extensions/extension_hooks_delegate.cc",
|
"//chrome/renderer/extensions/api/extension_hooks_delegate.cc",
|
||||||
"//chrome/renderer/extensions/extension_hooks_delegate.h",
|
"//chrome/renderer/extensions/api/extension_hooks_delegate.h",
|
||||||
"//chrome/renderer/extensions/tabs_hooks_delegate.cc",
|
"//chrome/renderer/extensions/api/tabs_hooks_delegate.cc",
|
||||||
"//chrome/renderer/extensions/tabs_hooks_delegate.h",
|
"//chrome/renderer/extensions/api/tabs_hooks_delegate.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (enable_pdf_viewer) {
|
if (enable_pdf_viewer) {
|
||||||
@@ -307,6 +329,10 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc",
|
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc",
|
||||||
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.h",
|
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.h",
|
||||||
]
|
]
|
||||||
|
deps += [
|
||||||
|
"//components/pdf/browser",
|
||||||
|
"//components/pdf/renderer",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,15 +360,6 @@ source_set("plugins") {
|
|||||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
|
"//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/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
|
||||||
]
|
]
|
||||||
deps += [
|
|
||||||
"//media:media_buildflags",
|
|
||||||
"//ppapi/buildflags",
|
|
||||||
"//ppapi/proxy:ipc",
|
|
||||||
"//services/device/public/mojom",
|
|
||||||
]
|
|
||||||
if (enable_pdf_viewer) {
|
|
||||||
deps += [ "//components/pdf/browser" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# renderer side
|
# renderer side
|
||||||
sources += [
|
sources += [
|
||||||
@@ -351,18 +368,24 @@ source_set("plugins") {
|
|||||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
||||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
||||||
]
|
]
|
||||||
if (enable_pdf_viewer) {
|
|
||||||
deps += [ "//components/pdf/renderer" ]
|
|
||||||
}
|
|
||||||
deps += [
|
deps += [
|
||||||
"//components/strings",
|
"//components/strings",
|
||||||
"//media:media_buildflags",
|
"//media:media_buildflags",
|
||||||
"//ppapi/host",
|
"//services/device/public/mojom",
|
||||||
"//ppapi/proxy",
|
|
||||||
"//ppapi/proxy:ipc",
|
|
||||||
"//ppapi/shared_impl",
|
|
||||||
"//skia",
|
"//skia",
|
||||||
|
"//storage/browser",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (enable_ppapi) {
|
||||||
|
deps += [
|
||||||
|
"//ppapi/buildflags",
|
||||||
|
"//ppapi/host",
|
||||||
|
"//ppapi/proxy",
|
||||||
|
"//ppapi/proxy:ipc",
|
||||||
|
"//ppapi/shared_impl",
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# This source set is just so we don't have to depend on all of //chrome/browser
|
# This source set is just so we don't have to depend on all of //chrome/browser
|
||||||
@@ -376,6 +399,10 @@ source_set("chrome_spellchecker") {
|
|||||||
|
|
||||||
if (enable_builtin_spellchecker) {
|
if (enable_builtin_spellchecker) {
|
||||||
sources += [
|
sources += [
|
||||||
|
"//chrome/browser/profiles/profile_keyed_service_factory.cc",
|
||||||
|
"//chrome/browser/profiles/profile_keyed_service_factory.h",
|
||||||
|
"//chrome/browser/profiles/profile_selections.cc",
|
||||||
|
"//chrome/browser/profiles/profile_selections.h",
|
||||||
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.cc",
|
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.cc",
|
||||||
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.h",
|
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.h",
|
||||||
"//chrome/browser/spellchecker/spellcheck_custom_dictionary.cc",
|
"//chrome/browser/spellchecker/spellcheck_custom_dictionary.cc",
|
||||||
@@ -384,14 +411,19 @@ source_set("chrome_spellchecker") {
|
|||||||
"//chrome/browser/spellchecker/spellcheck_factory.h",
|
"//chrome/browser/spellchecker/spellcheck_factory.h",
|
||||||
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc",
|
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc",
|
||||||
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h",
|
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h",
|
||||||
"//chrome/browser/spellchecker/spellcheck_language_blocklist_policy_handler.cc",
|
|
||||||
"//chrome/browser/spellchecker/spellcheck_language_blocklist_policy_handler.h",
|
|
||||||
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.cc",
|
|
||||||
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.h",
|
|
||||||
"//chrome/browser/spellchecker/spellcheck_service.cc",
|
"//chrome/browser/spellchecker/spellcheck_service.cc",
|
||||||
"//chrome/browser/spellchecker/spellcheck_service.h",
|
"//chrome/browser/spellchecker/spellcheck_service.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (!is_mac) {
|
||||||
|
sources += [
|
||||||
|
"//chrome/browser/spellchecker/spellcheck_language_blocklist_policy_handler.cc",
|
||||||
|
"//chrome/browser/spellchecker/spellcheck_language_blocklist_policy_handler.h",
|
||||||
|
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.cc",
|
||||||
|
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.h",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
if (has_spellcheck_panel) {
|
if (has_spellcheck_panel) {
|
||||||
sources += [
|
sources += [
|
||||||
"//chrome/browser/spellchecker/spell_check_panel_host_impl.cc",
|
"//chrome/browser/spellchecker/spell_check_panel_host_impl.cc",
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ async function createWindow (backgroundColor?: string) {
|
|||||||
mainWindow = new BrowserWindow(options);
|
mainWindow = new BrowserWindow(options);
|
||||||
mainWindow.on('ready-to-show', () => mainWindow!.show());
|
mainWindow.on('ready-to-show', () => mainWindow!.show());
|
||||||
|
|
||||||
mainWindow.webContents.on('new-window', (event, url) => {
|
mainWindow.webContents.setWindowOpenHandler(details => {
|
||||||
event.preventDefault();
|
shell.openExternal(decorateURL(details.url));
|
||||||
shell.openExternal(decorateURL(url));
|
return { action: 'deny' };
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.webContents.session.setPermissionRequestHandler((webContents, permission, done) => {
|
mainWindow.webContents.session.setPermissionRequestHandler((webContents, permission, done) => {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ function loadApplicationPackage (packagePath: string) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Override app name and version.
|
// Override app's package.json data.
|
||||||
packagePath = path.resolve(packagePath);
|
packagePath = path.resolve(packagePath);
|
||||||
const packageJsonPath = path.join(packagePath, 'package.json');
|
const packageJsonPath = path.join(packagePath, 'package.json');
|
||||||
let appPath;
|
let appPath;
|
||||||
@@ -104,6 +104,16 @@ function loadApplicationPackage (packagePath: string) {
|
|||||||
} else if (packageJson.name) {
|
} else if (packageJson.name) {
|
||||||
app.name = packageJson.name;
|
app.name = packageJson.name;
|
||||||
}
|
}
|
||||||
|
if (packageJson.desktopName) {
|
||||||
|
app.setDesktopName(packageJson.desktopName);
|
||||||
|
} else {
|
||||||
|
app.setDesktopName(`${app.name}.desktop`);
|
||||||
|
}
|
||||||
|
// Set v8 flags, deliberately lazy load so that apps that do not use this
|
||||||
|
// feature do not pay the price
|
||||||
|
if (packageJson.v8Flags) {
|
||||||
|
require('v8').setFlagsFromString(packageJson.v8Flags);
|
||||||
|
}
|
||||||
appPath = packagePath;
|
appPath = packagePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ an issue:
|
|||||||
* [Web embeds in Electron](tutorial/web-embeds.md)
|
* [Web embeds in Electron](tutorial/web-embeds.md)
|
||||||
* [Boilerplates and CLIs](tutorial/boilerplates-and-clis.md)
|
* [Boilerplates and CLIs](tutorial/boilerplates-and-clis.md)
|
||||||
* [Boilerplate vs CLI](tutorial/boilerplates-and-clis.md#boilerplate-vs-cli)
|
* [Boilerplate vs CLI](tutorial/boilerplates-and-clis.md#boilerplate-vs-cli)
|
||||||
* [electron-forge](tutorial/boilerplates-and-clis.md#electron-forge)
|
* [Electron Forge](tutorial/boilerplates-and-clis.md#electron-forge)
|
||||||
* [electron-builder](tutorial/boilerplates-and-clis.md#electron-builder)
|
* [electron-builder](tutorial/boilerplates-and-clis.md#electron-builder)
|
||||||
* [electron-react-boilerplate](tutorial/boilerplates-and-clis.md#electron-react-boilerplate)
|
* [electron-react-boilerplate](tutorial/boilerplates-and-clis.md#electron-react-boilerplate)
|
||||||
* [Other Tools and Boilerplates](tutorial/boilerplates-and-clis.md#other-tools-and-boilerplates)
|
* [Other Tools and Boilerplates](tutorial/boilerplates-and-clis.md#other-tools-and-boilerplates)
|
||||||
@@ -68,10 +68,8 @@ an issue:
|
|||||||
* [Mac App Store](tutorial/mac-app-store-submission-guide.md)
|
* [Mac App Store](tutorial/mac-app-store-submission-guide.md)
|
||||||
* [Windows Store](tutorial/windows-store-guide.md)
|
* [Windows Store](tutorial/windows-store-guide.md)
|
||||||
* [Snapcraft](tutorial/snapcraft.md)
|
* [Snapcraft](tutorial/snapcraft.md)
|
||||||
|
* [ASAR Archives](tutorial/asar-archives.md)
|
||||||
* [Updates](tutorial/updates.md)
|
* [Updates](tutorial/updates.md)
|
||||||
* [Deploying an Update Server](tutorial/updates.md#deploying-an-update-server)
|
|
||||||
* [Implementing Updates in Your App](tutorial/updates.md#implementing-updates-in-your-app)
|
|
||||||
* [Applying Updates](tutorial/updates.md#applying-updates)
|
|
||||||
* [Getting Support](tutorial/support.md)
|
* [Getting Support](tutorial/support.md)
|
||||||
|
|
||||||
## Detailed Tutorials
|
## Detailed Tutorials
|
||||||
@@ -85,7 +83,6 @@ These individual tutorials expand on topics discussed in the guide above.
|
|||||||
* Electron Releases & Developer Feedback
|
* Electron Releases & Developer Feedback
|
||||||
* [Versioning Policy](tutorial/electron-versioning.md)
|
* [Versioning Policy](tutorial/electron-versioning.md)
|
||||||
* [Release Timelines](tutorial/electron-timelines.md)
|
* [Release Timelines](tutorial/electron-timelines.md)
|
||||||
* [Testing Widevine CDM](tutorial/testing-widevine-cdm.md)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
122
docs/api/app.md
122
docs/api/app.md
@@ -130,6 +130,11 @@ set `NSPrincipalClass` to `AtomApplication`.
|
|||||||
|
|
||||||
You should call `event.preventDefault()` if you want to handle this event.
|
You should call `event.preventDefault()` if you want to handle this event.
|
||||||
|
|
||||||
|
As with the `open-file` event, be sure to register a listener for the `open-url`
|
||||||
|
event early in your application startup to detect if the the application being
|
||||||
|
is being opened to handle a URL. If you register the listener in response to a
|
||||||
|
`ready` event, you'll miss URLs that trigger the launch of your application.
|
||||||
|
|
||||||
### Event: 'activate' _macOS_
|
### Event: 'activate' _macOS_
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -484,7 +489,6 @@ Returns:
|
|||||||
* `argv` string[] - An array of the second instance's command line arguments
|
* `argv` string[] - An array of the second instance's command line arguments
|
||||||
* `workingDirectory` string - The second instance's working directory
|
* `workingDirectory` string - The second instance's working directory
|
||||||
* `additionalData` unknown - A JSON object of additional data passed from the second instance
|
* `additionalData` unknown - A JSON object of additional data passed from the second instance
|
||||||
* `ackCallback` unknown - A function that can be used to send data back to the second instance
|
|
||||||
|
|
||||||
This event will be emitted inside the primary instance of your application
|
This event will be emitted inside the primary instance of your application
|
||||||
when a second instance has been executed and calls `app.requestSingleInstanceLock()`.
|
when a second instance has been executed and calls `app.requestSingleInstanceLock()`.
|
||||||
@@ -494,37 +498,18 @@ and `workingDirectory` is its current working directory. Usually
|
|||||||
applications respond to this by making their primary window focused and
|
applications respond to this by making their primary window focused and
|
||||||
non-minimized.
|
non-minimized.
|
||||||
|
|
||||||
|
**Note:** `argv` will not be exactly the same list of arguments as those passed
|
||||||
|
to the second instance. The order might change and additional arguments might be appended.
|
||||||
|
If you need to maintain the exact same arguments, it's advised to use `additionalData` instead.
|
||||||
|
|
||||||
**Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
|
**Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
|
||||||
|
|
||||||
**Note:** `ackCallback` allows the user to send data back to the
|
|
||||||
second instance during the `app.requestSingleInstanceLock()` flow.
|
|
||||||
This callback can be used for cases where the second instance
|
|
||||||
needs to obtain additional information from the first instance
|
|
||||||
before quitting.
|
|
||||||
|
|
||||||
Currently, the limit on the message size is kMaxMessageLength,
|
|
||||||
or around 32kB. To be safe, keep the amount of data passed to 31kB at most.
|
|
||||||
|
|
||||||
In order to call the callback, `event.preventDefault()` must be called, first.
|
|
||||||
If the callback is not called in either case, `null` will be sent back.
|
|
||||||
If `event.preventDefault()` is not called, but `ackCallback` is called
|
|
||||||
by the user in the event, then the behaviour is undefined.
|
|
||||||
|
|
||||||
This event is guaranteed to be emitted after the `ready` event of `app`
|
This event is guaranteed to be emitted after the `ready` event of `app`
|
||||||
gets emitted.
|
gets emitted.
|
||||||
|
|
||||||
**Note:** Extra command line arguments might be added by Chromium,
|
**Note:** Extra command line arguments might be added by Chromium,
|
||||||
such as `--original-process-start-time`.
|
such as `--original-process-start-time`.
|
||||||
|
|
||||||
### Event: 'first-instance-ack'
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
* `event` Event
|
|
||||||
* `additionalData` unknown - A JSON object of additional data passed from the first instance, in response to the first instance's `second-instance` event.
|
|
||||||
|
|
||||||
This event will be emitted within the second instance during the call to `app.requestSingleInstanceLock()`, when the first instance calls the `ackCallback` provided by the `second-instance` event handler.
|
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
The `app` object has the following methods:
|
The `app` object has the following methods:
|
||||||
@@ -606,6 +591,10 @@ You should seek to use the `steal` option as sparingly as possible.
|
|||||||
|
|
||||||
Hides all application windows without minimizing them.
|
Hides all application windows without minimizing them.
|
||||||
|
|
||||||
|
### `app.isHidden()` _macOS_
|
||||||
|
|
||||||
|
Returns `boolean` - `true` if the application—including all of its windows—is hidden (e.g. with `Command-H`), `false` otherwise.
|
||||||
|
|
||||||
### `app.show()` _macOS_
|
### `app.show()` _macOS_
|
||||||
|
|
||||||
Shows application windows after they were hidden. Does not automatically focus
|
Shows application windows after they were hidden. Does not automatically focus
|
||||||
@@ -631,9 +620,18 @@ Returns `string` - The current application directory.
|
|||||||
* `%APPDATA%` on Windows
|
* `%APPDATA%` on Windows
|
||||||
* `$XDG_CONFIG_HOME` or `~/.config` on Linux
|
* `$XDG_CONFIG_HOME` or `~/.config` on Linux
|
||||||
* `~/Library/Application Support` on macOS
|
* `~/Library/Application Support` on macOS
|
||||||
* `userData` The directory for storing your app's configuration files, which by
|
* `userData` The directory for storing your app's configuration files, which
|
||||||
default it is the `appData` directory appended with your app's name.
|
by default is the `appData` directory appended with your app's name. By
|
||||||
* `cache`
|
convention files storing user data should be written to this directory, and
|
||||||
|
it is not recommended to write large files here because some environments
|
||||||
|
may backup this directory to cloud storage.
|
||||||
|
* `sessionData` The directory for storing data generated by `Session`, such
|
||||||
|
as localStorage, cookies, disk cache, downloaded dictionaries, network
|
||||||
|
state, devtools files. By default this points to `userData`. Chromium may
|
||||||
|
write very large disk cache here, so if your app does not rely on browser
|
||||||
|
storage like localStorage or cookies to save user data, it is recommended
|
||||||
|
to set this directory to other locations to avoid polluting the `userData`
|
||||||
|
directory.
|
||||||
* `temp` Temporary directory.
|
* `temp` Temporary directory.
|
||||||
* `exe` The current executable file.
|
* `exe` The current executable file.
|
||||||
* `module` The `libchromiumcontent` library.
|
* `module` The `libchromiumcontent` library.
|
||||||
@@ -683,9 +681,9 @@ In that case, the directory should be created with `fs.mkdirSync` or similar.
|
|||||||
|
|
||||||
You can only override paths of a `name` defined in `app.getPath`.
|
You can only override paths of a `name` defined in `app.getPath`.
|
||||||
|
|
||||||
By default, web pages' cookies and caches will be stored under the `userData`
|
By default, web pages' cookies and caches will be stored under the `sessionData`
|
||||||
directory. If you want to change this location, you have to override the
|
directory. If you want to change this location, you have to override the
|
||||||
`userData` path before the `ready` event of the `app` module is emitted.
|
`sessionData` path before the `ready` event of the `app` module is emitted.
|
||||||
|
|
||||||
### `app.getVersion()`
|
### `app.getVersion()`
|
||||||
|
|
||||||
@@ -721,7 +719,9 @@ To set the locale, you'll want to use a command line switch at app startup, whic
|
|||||||
**Note:** When distributing your packaged app, you have to also ship the
|
**Note:** When distributing your packaged app, you have to also ship the
|
||||||
`locales` folder.
|
`locales` folder.
|
||||||
|
|
||||||
**Note:** On Windows, you have to call it after the `ready` events gets emitted.
|
**Note:** This API must be called after the `ready` event is emitted.
|
||||||
|
|
||||||
|
**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||||
|
|
||||||
### `app.getLocaleCountryCode()`
|
### `app.getLocaleCountryCode()`
|
||||||
|
|
||||||
@@ -729,6 +729,44 @@ Returns `string` - User operating system's locale two-letter [ISO 3166](https://
|
|||||||
|
|
||||||
**Note:** When unable to detect locale country code, it returns empty string.
|
**Note:** When unable to detect locale country code, it returns empty string.
|
||||||
|
|
||||||
|
### `app.getSystemLocale()`
|
||||||
|
|
||||||
|
Returns `string` - The current system locale. On Windows and Linux, it is fetched using Chromium's `i18n` library. On macOS, `[NSLocale currentLocale]` is used instead. To get the user's current system language, which is not always the same as the locale, it is better to use [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||||
|
|
||||||
|
Different operating systems also use the regional data differently:
|
||||||
|
|
||||||
|
* Windows 11 uses the regional format for numbers, dates, and times.
|
||||||
|
* macOS Monterey uses the region for formatting numbers, dates, times, and for selecting the currency symbol to use.
|
||||||
|
|
||||||
|
Therefore, this API can be used for purposes such as choosing a format for rendering dates and times in a calendar app, especially when the developer wants the format to be consistent with the OS.
|
||||||
|
|
||||||
|
**Note:** This API must be called after the `ready` event is emitted.
|
||||||
|
|
||||||
|
**Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
|
||||||
|
|
||||||
|
### `app.getPreferredSystemLanguages()`
|
||||||
|
|
||||||
|
Returns `string[]` - The user's preferred system languages from most preferred to least preferred, including the country codes if applicable. A user can modify and add to this list on Windows or macOS through the Language and Region settings.
|
||||||
|
|
||||||
|
The API uses `GlobalizationPreferences` (with a fallback to `GetSystemPreferredUILanguages`) on Windows, `\[NSLocale preferredLanguages\]` on macOS, and `g_get_language_names` on Linux.
|
||||||
|
|
||||||
|
This API can be used for purposes such as deciding what language to present the application in.
|
||||||
|
|
||||||
|
Here are some examples of return values of the various language and locale APIs with different configurations:
|
||||||
|
|
||||||
|
* For Windows, where the application locale is German, the regional format is Finnish (Finland), and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish (Latin America):
|
||||||
|
* `app.getLocale()` returns `'de'`
|
||||||
|
* `app.getSystemLocale()` returns `'fi-FI'`
|
||||||
|
* `app.getPreferredSystemLanguages()` returns `['fr-CA', 'en-US', 'zh-Hans-CN', 'fi', 'es-419']`
|
||||||
|
* On macOS, where the application locale is German, the region is Finland, and the preferred system languages from most to least preferred are French (Canada), English (US), Simplified Chinese, and Spanish (Latin America):
|
||||||
|
* `app.getLocale()` returns `'de'`
|
||||||
|
* `app.getSystemLocale()` returns `'fr-FI'`
|
||||||
|
* `app.getPreferredSystemLanguages()` returns `['fr-CA', 'en-US', 'zh-Hans-FI', 'es-419']`
|
||||||
|
|
||||||
|
Both the available languages and regions and the possible return values differ between the two operating systems.
|
||||||
|
|
||||||
|
As can be seen with the example above, on Windows, it is possible that a preferred system language has no country code, and that one of the preferred system languages corresponds with the language used for the regional format. On macOS, the region serves more as a default country code: the user doesn't need to have Finnish as a preferred language to use Finland as the region,and the country code `FI` is used as the country code for preferred system languages that do not have associated countries in the language name.
|
||||||
|
|
||||||
### `app.addRecentDocument(path)` _macOS_ _Windows_
|
### `app.addRecentDocument(path)` _macOS_ _Windows_
|
||||||
|
|
||||||
* `path` string
|
* `path` string
|
||||||
@@ -861,6 +899,8 @@ Returns `Object`:
|
|||||||
|
|
||||||
* `categories` [JumpListCategory[]](structures/jump-list-category.md) | `null` - Array of `JumpListCategory` objects.
|
* `categories` [JumpListCategory[]](structures/jump-list-category.md) | `null` - Array of `JumpListCategory` objects.
|
||||||
|
|
||||||
|
Returns `string`
|
||||||
|
|
||||||
Sets or removes a custom Jump List for the application, and returns one of the
|
Sets or removes a custom Jump List for the application, and returns one of the
|
||||||
following strings:
|
following strings:
|
||||||
|
|
||||||
@@ -983,13 +1023,6 @@ starts:
|
|||||||
const { app } = require('electron')
|
const { app } = require('electron')
|
||||||
let myWindow = null
|
let myWindow = null
|
||||||
|
|
||||||
app.on('first-instance-ack', (event, additionalData) => {
|
|
||||||
// Print out the ack received from the first instance.
|
|
||||||
// Note this event handler must come before the requestSingleInstanceLock call.
|
|
||||||
// Expected output: '{"myAckKey":"myAckValue"}'
|
|
||||||
console.log(JSON.stringify(additionalData))
|
|
||||||
})
|
|
||||||
|
|
||||||
const additionalData = { myKey: 'myValue' }
|
const additionalData = { myKey: 'myValue' }
|
||||||
const gotTheLock = app.requestSingleInstanceLock(additionalData)
|
const gotTheLock = app.requestSingleInstanceLock(additionalData)
|
||||||
|
|
||||||
@@ -997,19 +1030,14 @@ if (!gotTheLock) {
|
|||||||
app.quit()
|
app.quit()
|
||||||
} else {
|
} else {
|
||||||
app.on('second-instance', (event, commandLine, workingDirectory, additionalData) => {
|
app.on('second-instance', (event, commandLine, workingDirectory, additionalData) => {
|
||||||
// We must call preventDefault if we're sending back data.
|
|
||||||
event.preventDefault()
|
|
||||||
// Print out data received from the second instance.
|
// Print out data received from the second instance.
|
||||||
// Expected output: '{"myKey":"myValue"}'
|
console.log(additionalData)
|
||||||
console.log(JSON.stringify(additionalData))
|
|
||||||
|
|
||||||
// Someone tried to run a second instance, we should focus our window.
|
// Someone tried to run a second instance, we should focus our window.
|
||||||
if (myWindow) {
|
if (myWindow) {
|
||||||
if (myWindow.isMinimized()) myWindow.restore()
|
if (myWindow.isMinimized()) myWindow.restore()
|
||||||
myWindow.focus()
|
myWindow.focus()
|
||||||
}
|
}
|
||||||
const ackData = { myAckKey: 'myAckValue' }
|
|
||||||
ackCallback(ackData)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create myWindow, load the rest of the app, etc...
|
// Create myWindow, load the rest of the app, etc...
|
||||||
@@ -1213,7 +1241,7 @@ For `infoType` equal to `basic`:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Using `basic` should be preferred if only basic information like `vendorId` or `driverId` is needed.
|
Using `basic` should be preferred if only basic information like `vendorId` or `deviceId` is needed.
|
||||||
|
|
||||||
### `app.setBadgeCount([count])` _Linux_ _macOS_
|
### `app.setBadgeCount([count])` _Linux_ _macOS_
|
||||||
|
|
||||||
@@ -1402,7 +1430,7 @@ method returns false. If we fail to perform the copy, then this method will
|
|||||||
throw an error. The message in the error should be informative and tell
|
throw an error. The message in the error should be informative and tell
|
||||||
you exactly what went wrong.
|
you exactly what went wrong.
|
||||||
|
|
||||||
By default, if an app of the same name as the one being moved exists in the Applications directory and is _not_ running, the existing app will be trashed and the active app moved into its place. If it _is_ running, the pre-existing running app will assume focus and the previously active app will quit itself. This behavior can be changed by providing the optional conflict handler, where the boolean returned by the handler determines whether or not the move conflict is resolved with default behavior. i.e. returning `false` will ensure no further action is taken, returning `true` will result in the default behavior and the method continuing.
|
By default, if an app of the same name as the one being moved exists in the Applications directory and is _not_ running, the existing app will be trashed and the active app moved into its place. If it _is_ running, the preexisting running app will assume focus and the previously active app will quit itself. This behavior can be changed by providing the optional conflict handler, where the boolean returned by the handler determines whether or not the move conflict is resolved with default behavior. i.e. returning `false` will ensure no further action is taken, returning `true` will result in the default behavior and the method continuing.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@@ -1485,7 +1513,6 @@ dock on macOS.
|
|||||||
|
|
||||||
A `boolean` property that returns `true` if the app is packaged, `false` otherwise. For many apps, this property can be used to distinguish development and production environments.
|
A `boolean` property that returns `true` if the app is packaged, `false` otherwise. For many apps, this property can be used to distinguish development and production environments.
|
||||||
|
|
||||||
[dock-menu]:https://developer.apple.com/macos/human-interface-guidelines/menus/dock-menus/
|
|
||||||
[tasks]:https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
|
[tasks]:https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
|
||||||
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
|
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
|
||||||
[electron-forge]: https://www.electronforge.io/
|
[electron-forge]: https://www.electronforge.io/
|
||||||
@@ -1539,5 +1566,4 @@ an ARM64 translator (like the macOS
|
|||||||
or Windows [WOW](https://en.wikipedia.org/wiki/Windows_on_Windows)).
|
or Windows [WOW](https://en.wikipedia.org/wiki/Windows_on_Windows)).
|
||||||
|
|
||||||
You can use this property to prompt users to download the arm64 version of
|
You can use this property to prompt users to download the arm64 version of
|
||||||
your application when they are running the x64 version under Rosetta
|
your application when they are mistakenly running the x64 version under Rosetta or WOW.
|
||||||
incorrectly.
|
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ This is a requirement of `Squirrel.Mac`.
|
|||||||
|
|
||||||
On Windows, you have to install your app into a user's machine before you can
|
On Windows, you have to install your app into a user's machine before you can
|
||||||
use the `autoUpdater`, so it is recommended that you use the
|
use the `autoUpdater`, so it is recommended that you use the
|
||||||
[electron-winstaller][installer-lib], [electron-forge][electron-forge-lib] or the [grunt-electron-installer][installer] package to generate a Windows installer.
|
[electron-winstaller][installer-lib], [Electron Forge][electron-forge-lib] or the [grunt-electron-installer][installer] package to generate a Windows installer.
|
||||||
|
|
||||||
When using [electron-winstaller][installer-lib] or [electron-forge][electron-forge-lib] make sure you do not try to update your app [the first time it runs](https://github.com/electron/windows-installer#handling-squirrel-events) (Also see [this issue for more info](https://github.com/electron/electron/issues/7155)). It's also recommended to use [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) to get desktop shortcuts for your app.
|
When using [electron-winstaller][installer-lib] or [Electron Forge][electron-forge-lib] make sure you do not try to update your app [the first time it runs](https://github.com/electron/windows-installer#handling-squirrel-events) (Also see [this issue for more info](https://github.com/electron/electron/issues/7155)). It's also recommended to use [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) to get desktop shortcuts for your app.
|
||||||
|
|
||||||
The installer generated with Squirrel will create a shortcut icon with an
|
The installer generated with Squirrel will create a shortcut icon with an
|
||||||
[Application User Model ID][app-user-model-id] in the format of
|
[Application User Model ID][app-user-model-id] in the format of
|
||||||
@@ -139,6 +139,6 @@ application starts.
|
|||||||
[squirrel-windows]: https://github.com/Squirrel/Squirrel.Windows
|
[squirrel-windows]: https://github.com/Squirrel/Squirrel.Windows
|
||||||
[installer]: https://github.com/electron/grunt-electron-installer
|
[installer]: https://github.com/electron/grunt-electron-installer
|
||||||
[installer-lib]: https://github.com/electron/windows-installer
|
[installer-lib]: https://github.com/electron/windows-installer
|
||||||
[electron-forge-lib]: https://github.com/electron-userland/electron-forge
|
[electron-forge-lib]: https://github.com/electron/forge
|
||||||
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
|
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
|
||||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ relative to its owning window. It is meant to be an alternative to the
|
|||||||
|
|
||||||
Process: [Main](../glossary.md#main-process)
|
Process: [Main](../glossary.md#main-process)
|
||||||
|
|
||||||
|
This module cannot be used until the `ready` event of the `app`
|
||||||
|
module is emitted.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
Process: [Main](../glossary.md#main-process)
|
Process: [Main](../glossary.md#main-process)
|
||||||
|
|
||||||
|
This module cannot be used until the `ready` event of the `app`
|
||||||
|
module is emitted.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// In the main process.
|
// In the main process.
|
||||||
const { BrowserWindow } = require('electron')
|
const { BrowserWindow } = require('electron')
|
||||||
@@ -164,14 +167,14 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
|||||||
* `maxWidth` Integer (optional) - Window's maximum width. Default is no limit.
|
* `maxWidth` Integer (optional) - Window's maximum width. Default is no limit.
|
||||||
* `maxHeight` Integer (optional) - Window's maximum height. Default is no limit.
|
* `maxHeight` Integer (optional) - Window's maximum height. Default is no limit.
|
||||||
* `resizable` boolean (optional) - Whether window is resizable. Default is `true`.
|
* `resizable` boolean (optional) - Whether window is resizable. Default is `true`.
|
||||||
* `movable` boolean (optional) - Whether window is movable. This is not implemented
|
* `movable` boolean (optional) _macOS_ _Windows_ - Whether window is
|
||||||
on Linux. Default is `true`.
|
movable. This is not implemented on Linux. Default is `true`.
|
||||||
* `minimizable` boolean (optional) - Whether window is minimizable. This is not
|
* `minimizable` boolean (optional) _macOS_ _Windows_ - Whether window is
|
||||||
implemented on Linux. Default is `true`.
|
minimizable. This is not implemented on Linux. Default is `true`.
|
||||||
* `maximizable` boolean (optional) - Whether window is maximizable. This is not
|
* `maximizable` boolean (optional) _macOS_ _Windows_ - Whether window is
|
||||||
implemented on Linux. Default is `true`.
|
maximizable. This is not implemented on Linux. Default is `true`.
|
||||||
* `closable` boolean (optional) - Whether window is closable. This is not implemented
|
* `closable` boolean (optional) _macOS_ _Windows_ - Whether window is
|
||||||
on Linux. Default is `true`.
|
closable. This is not implemented on Linux. Default is `true`.
|
||||||
* `focusable` boolean (optional) - Whether the window can be focused. Default is
|
* `focusable` boolean (optional) - Whether the window can be focused. Default is
|
||||||
`true`. On Windows setting `focusable: false` also implies setting
|
`true`. On Windows setting `focusable: false` also implies setting
|
||||||
`skipTaskbar: true`. On Linux setting `focusable: false` makes the window
|
`skipTaskbar: true`. On Linux setting `focusable: false` makes the window
|
||||||
@@ -185,9 +188,11 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
|||||||
* `fullscreenable` boolean (optional) - Whether the window can be put into fullscreen
|
* `fullscreenable` boolean (optional) - Whether the window can be put into fullscreen
|
||||||
mode. On macOS, also whether the maximize/zoom button should toggle full
|
mode. On macOS, also whether the maximize/zoom button should toggle full
|
||||||
screen mode or maximize window. Default is `true`.
|
screen mode or maximize window. Default is `true`.
|
||||||
* `simpleFullscreen` boolean (optional) - Use pre-Lion fullscreen on macOS. Default is `false`.
|
* `simpleFullscreen` boolean (optional) _macOS_ - Use pre-Lion fullscreen on
|
||||||
|
macOS. Default is `false`.
|
||||||
* `skipTaskbar` boolean (optional) _macOS_ _Windows_ - Whether to show the window in taskbar.
|
* `skipTaskbar` boolean (optional) _macOS_ _Windows_ - Whether to show the window in taskbar.
|
||||||
Default is `false`.
|
Default is `false`.
|
||||||
|
* `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control.
|
||||||
* `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`.
|
* `kiosk` boolean (optional) - Whether the window is in 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.
|
* `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
|
* `icon` ([NativeImage](native-image.md) | string) (optional) - The window icon. On Windows it is
|
||||||
@@ -201,27 +206,30 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
|||||||
* `parent` BrowserWindow (optional) - Specify parent window. Default is `null`.
|
* `parent` BrowserWindow (optional) - Specify parent window. Default is `null`.
|
||||||
* `modal` boolean (optional) - Whether this is a modal window. This only works when the
|
* `modal` boolean (optional) - Whether this is a modal window. This only works when the
|
||||||
window is a child window. Default is `false`.
|
window is a child window. Default is `false`.
|
||||||
* `acceptFirstMouse` boolean (optional) - Whether clicking an inactive window will also
|
* `acceptFirstMouse` boolean (optional) _macOS_ - Whether clicking an
|
||||||
click through to the web contents. Default is `false` on macOS. This option is not
|
inactive window will also click through to the web contents. Default is
|
||||||
configurable on other platforms.
|
`false` on macOS. This option is not configurable on other platforms.
|
||||||
* `disableAutoHideCursor` boolean (optional) - Whether to hide cursor when typing.
|
* `disableAutoHideCursor` boolean (optional) - Whether to hide cursor when typing.
|
||||||
Default is `false`.
|
Default is `false`.
|
||||||
* `autoHideMenuBar` boolean (optional) - Auto hide the menu bar unless the `Alt`
|
* `autoHideMenuBar` boolean (optional) - Auto hide the menu bar unless the `Alt`
|
||||||
key is pressed. Default is `false`.
|
key is pressed. Default is `false`.
|
||||||
* `enableLargerThanScreen` boolean (optional) - Enable the window to be resized larger
|
* `enableLargerThanScreen` boolean (optional) _macOS_ - Enable the window to
|
||||||
than screen. Only relevant for macOS, as other OSes allow
|
be resized larger than screen. Only relevant for macOS, as other OSes
|
||||||
larger-than-screen windows by default. Default is `false`.
|
allow larger-than-screen windows by default. Default is `false`.
|
||||||
* `backgroundColor` string (optional) - The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported if `transparent` is set to `true`. Default is `#FFF` (white). See [win.setBackgroundColor](browser-window.md#winsetbackgroundcolorbackgroundcolor) for more information.
|
* `backgroundColor` string (optional) - The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported if `transparent` is set to `true`. Default is `#FFF` (white). See [win.setBackgroundColor](browser-window.md#winsetbackgroundcolorbackgroundcolor) for more information.
|
||||||
* `hasShadow` boolean (optional) - Whether window should have a shadow. Default is `true`.
|
* `hasShadow` boolean (optional) - Whether window should have a shadow. Default is `true`.
|
||||||
* `opacity` number (optional) - Set the initial opacity of the window, between 0.0 (fully
|
* `opacity` number (optional) _macOS_ _Windows_ - Set the initial opacity of
|
||||||
transparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.
|
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
|
* `darkTheme` boolean (optional) - Forces using dark theme for the window, only works on
|
||||||
some GTK+3 desktop environments. Default is `false`.
|
some GTK+3 desktop environments. Default is `false`.
|
||||||
* `transparent` boolean (optional) - Makes the window [transparent](../tutorial/window-customization.md#create-transparent-windows).
|
* `transparent` boolean (optional) - Makes the window [transparent](../tutorial/window-customization.md#create-transparent-windows).
|
||||||
Default is `false`. On Windows, does not work unless the window is frameless.
|
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
|
* `type` string (optional) - The type of window, default is normal window. See more about
|
||||||
this below.
|
this below.
|
||||||
* `visualEffectState` string (optional) - Specify how the material appearance should reflect window activity state on macOS. Must be used with the `vibrancy` property. Possible values are:
|
* `visualEffectState` string (optional) _macOS_ - Specify how the material
|
||||||
|
appearance should reflect window activity state on macOS. Must be used
|
||||||
|
with the `vibrancy` property. Possible values are:
|
||||||
* `followWindow` - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.
|
* `followWindow` - The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.
|
||||||
* `active` - The backdrop should always appear active.
|
* `active` - The backdrop should always appear active.
|
||||||
* `inactive` - The backdrop should always appear inactive.
|
* `inactive` - The backdrop should always appear inactive.
|
||||||
@@ -229,36 +237,42 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
|||||||
Default is `default`. Possible values are:
|
Default is `default`. Possible values are:
|
||||||
* `default` - Results in the standard title bar for macOS or Windows respectively.
|
* `default` - Results in the standard title bar for macOS or Windows respectively.
|
||||||
* `hidden` - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with `titleBarOverlay: true` it will activate the Window Controls Overlay (see `titleBarOverlay` for more information), otherwise no window controls will be shown.
|
* `hidden` - Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined with `titleBarOverlay: true` it will activate the Window Controls Overlay (see `titleBarOverlay` for more information), otherwise no window controls will be shown.
|
||||||
* `hiddenInset` - Only on macOS, results in a hidden title bar with an alternative look
|
* `hiddenInset` _macOS_ - Only on macOS, results in a hidden title bar
|
||||||
where the traffic light buttons are slightly more inset from the window edge.
|
with an alternative look where the traffic light buttons are slightly
|
||||||
* `customButtonsOnHover` - Only on macOS, results in a hidden title bar and a full size
|
more inset from the window edge.
|
||||||
content window, the traffic light buttons will display when being hovered
|
* `customButtonsOnHover` _macOS_ - Only on macOS, results in a hidden
|
||||||
over in the top left of the window. **Note:** This option is currently
|
title bar and a full size content window, the traffic light buttons will
|
||||||
experimental.
|
display when being hovered over in the top left of the window.
|
||||||
* `trafficLightPosition` [Point](structures/point.md) (optional) - Set a
|
**Note:** This option is currently experimental.
|
||||||
custom position for the traffic light buttons in frameless windows.
|
* `trafficLightPosition` [Point](structures/point.md) (optional) _macOS_ -
|
||||||
* `roundedCorners` boolean (optional) - Whether frameless window should have
|
Set a custom position for the traffic light buttons in frameless windows.
|
||||||
rounded corners on macOS. Default is `true`.
|
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
|
||||||
* `fullscreenWindowTitle` boolean (optional) _Deprecated_ - Shows the title in
|
should have rounded corners on macOS. Default is `true`. Setting this property
|
||||||
the title bar in full screen mode on macOS for `hiddenInset` titleBarStyle.
|
to `false` will prevent the window from being fullscreenable.
|
||||||
Default is `false`.
|
* `fullscreenWindowTitle` boolean (optional) _macOS_ _Deprecated_ - Shows
|
||||||
|
the title in the title bar in full screen mode on macOS for `hiddenInset`
|
||||||
|
titleBarStyle. Default is `false`.
|
||||||
* `thickFrame` boolean (optional) - Use `WS_THICKFRAME` style for frameless windows on
|
* `thickFrame` boolean (optional) - Use `WS_THICKFRAME` style for frameless windows on
|
||||||
Windows, which adds standard window frame. Setting it to `false` will remove
|
Windows, which adds standard window frame. Setting it to `false` will remove
|
||||||
window shadow and window animations. Default is `true`.
|
window shadow and window animations. Default is `true`.
|
||||||
* `vibrancy` string (optional) - Add a type of vibrancy effect to the window, only on
|
* `vibrancy` string (optional) _macOS_ - Add a type of vibrancy effect to
|
||||||
macOS. Can be `appearance-based`, `light`, `dark`, `titlebar`, `selection`,
|
the window, only on macOS. Can be `appearance-based`, `light`, `dark`,
|
||||||
`menu`, `popover`, `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are deprecated and have been removed in macOS Catalina (10.15).
|
`titlebar`, `selection`, `menu`, `popover`, `sidebar`, `medium-light`,
|
||||||
* `zoomToPageWidth` boolean (optional) - Controls the behavior on macOS when
|
`ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`,
|
||||||
option-clicking the green stoplight button on the toolbar or by clicking the
|
`tooltip`, `content`, `under-window`, or `under-page`. Please note that
|
||||||
Window > Zoom menu item. If `true`, the window will grow to the preferred
|
`appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are
|
||||||
width of the web page when zoomed, `false` will cause it to zoom to the
|
deprecated and have been removed in macOS Catalina (10.15).
|
||||||
width of the screen. This will also affect the behavior when calling
|
* `zoomToPageWidth` boolean (optional) _macOS_ - Controls the behavior on
|
||||||
`maximize()` directly. Default is `false`.
|
macOS when option-clicking the green stoplight button on the toolbar or by
|
||||||
* `tabbingIdentifier` string (optional) - Tab group name, allows opening the
|
clicking the Window > Zoom menu item. If `true`, the window will grow to
|
||||||
window as a native tab on macOS 10.12+. Windows with the same tabbing
|
the preferred width of the web page when zoomed, `false` will cause it to
|
||||||
identifier will be grouped together. This also adds a native new tab button
|
zoom to the width of the screen. This will also affect the behavior when
|
||||||
to your window's tab bar and allows your `app` and window to receive the
|
calling `maximize()` directly. Default is `false`.
|
||||||
`new-window-for-tab` event.
|
* `tabbingIdentifier` string (optional) _macOS_ - Tab group name, allows
|
||||||
|
opening the window as a native tab on macOS 10.12+. Windows with the same
|
||||||
|
tabbing identifier will be grouped together. This also adds a native new
|
||||||
|
tab button to your window's tab bar and allows your `app` and window to
|
||||||
|
receive the `new-window-for-tab` event.
|
||||||
* `webPreferences` Object (optional) - Settings of web page's features.
|
* `webPreferences` Object (optional) - Settings of web page's features.
|
||||||
* `devTools` boolean (optional) - Whether to enable DevTools. If it is set to `false`, can not use `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
|
* `devTools` boolean (optional) - Whether to enable DevTools. If it is set to `false`, can not use `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
|
||||||
* `nodeIntegration` boolean (optional) - Whether node integration is enabled.
|
* `nodeIntegration` boolean (optional) - Whether node integration is enabled.
|
||||||
@@ -310,8 +324,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
|||||||
* `plugins` boolean (optional) - Whether plugins should be enabled. Default is `false`.
|
* `plugins` boolean (optional) - Whether plugins should be enabled. Default is `false`.
|
||||||
* `experimentalFeatures` boolean (optional) - Enables Chromium's experimental features.
|
* `experimentalFeatures` boolean (optional) - Enables Chromium's experimental features.
|
||||||
Default is `false`.
|
Default is `false`.
|
||||||
* `scrollBounce` boolean (optional) - Enables scroll bounce (rubber banding) effect on
|
* `scrollBounce` boolean (optional) _macOS_ - Enables scroll bounce
|
||||||
macOS. Default is `false`.
|
(rubber banding) effect on macOS. Default is `false`.
|
||||||
* `enableBlinkFeatures` string (optional) - A list of feature strings separated by `,`, like
|
* `enableBlinkFeatures` string (optional) - A list of feature strings separated by `,`, like
|
||||||
`CSSVariables,KeyboardEventKey` to enable. The full list of supported feature
|
`CSSVariables,KeyboardEventKey` to enable. The full list of supported feature
|
||||||
strings can be found in the [RuntimeEnabledFeatures.json5][runtime-enabled-features]
|
strings can be found in the [RuntimeEnabledFeatures.json5][runtime-enabled-features]
|
||||||
@@ -413,13 +427,17 @@ Possible values are:
|
|||||||
|
|
||||||
* On Linux, possible types are `desktop`, `dock`, `toolbar`, `splash`,
|
* On Linux, possible types are `desktop`, `dock`, `toolbar`, `splash`,
|
||||||
`notification`.
|
`notification`.
|
||||||
* On macOS, possible types are `desktop`, `textured`.
|
* On macOS, possible types are `desktop`, `textured`, `panel`.
|
||||||
* The `textured` type adds metal gradient appearance
|
* The `textured` type adds metal gradient appearance
|
||||||
(`NSTexturedBackgroundWindowMask`).
|
(`NSWindowStyleMaskTexturedBackground`).
|
||||||
* The `desktop` type places the window at the desktop background window level
|
* The `desktop` type places the window at the desktop background window level
|
||||||
(`kCGDesktopWindowLevel - 1`). Note that desktop window will not receive
|
(`kCGDesktopWindowLevel - 1`). Note that desktop window will not receive
|
||||||
focus, keyboard or mouse events, but you can use `globalShortcut` to receive
|
focus, keyboard or mouse events, but you can use `globalShortcut` to receive
|
||||||
input sparingly.
|
input sparingly.
|
||||||
|
* The `panel` type enables the window to float on top of full-screened apps
|
||||||
|
by adding the `NSWindowStyleMaskNonactivatingPanel` style mask,normally
|
||||||
|
reserved for NSPanel, at runtime. Also, the window will appear on all
|
||||||
|
spaces (desktops).
|
||||||
* On Windows, possible type is `toolbar`.
|
* On Windows, possible type is `toolbar`.
|
||||||
|
|
||||||
### Instance Events
|
### Instance Events
|
||||||
@@ -464,7 +482,7 @@ window.onbeforeunload = (e) => {
|
|||||||
// a non-void value will silently cancel the close.
|
// a non-void value will silently cancel the close.
|
||||||
// It is recommended to use the dialog API to let the user confirm closing the
|
// It is recommended to use the dialog API to let the user confirm closing the
|
||||||
// application.
|
// application.
|
||||||
e.returnValue = false // equivalent to `return false` but not recommended
|
e.returnValue = false
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -635,18 +653,36 @@ The following app commands are explicitly supported on Linux:
|
|||||||
* `browser-backward`
|
* `browser-backward`
|
||||||
* `browser-forward`
|
* `browser-forward`
|
||||||
|
|
||||||
#### Event: 'scroll-touch-begin' _macOS_
|
#### Event: 'scroll-touch-begin' _macOS_ _Deprecated_
|
||||||
|
|
||||||
Emitted when scroll wheel event phase has begun.
|
Emitted when scroll wheel event phase has begun.
|
||||||
|
|
||||||
#### Event: 'scroll-touch-end' _macOS_
|
> **Note**
|
||||||
|
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
|
||||||
|
> Changes](breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
|
||||||
|
> for details of how to migrate to using the [WebContents
|
||||||
|
> `input-event`](api/web-contents.md#event-input-event) event.
|
||||||
|
|
||||||
|
#### Event: 'scroll-touch-end' _macOS_ _Deprecated_
|
||||||
|
|
||||||
Emitted when scroll wheel event phase has ended.
|
Emitted when scroll wheel event phase has ended.
|
||||||
|
|
||||||
#### Event: 'scroll-touch-edge' _macOS_
|
> **Note**
|
||||||
|
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
|
||||||
|
> Changes](breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
|
||||||
|
> for details of how to migrate to using the [WebContents
|
||||||
|
> `input-event`](api/web-contents.md#event-input-event) event.
|
||||||
|
|
||||||
|
#### Event: 'scroll-touch-edge' _macOS_ _Deprecated_
|
||||||
|
|
||||||
Emitted when scroll wheel event phase filed upon reaching the edge of element.
|
Emitted when scroll wheel event phase filed upon reaching the edge of element.
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
|
||||||
|
> Changes](breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
|
||||||
|
> for details of how to migrate to using the [WebContents
|
||||||
|
> `input-event`](api/web-contents.md#event-input-event) event.
|
||||||
|
|
||||||
#### Event: 'swipe' _macOS_
|
#### Event: 'swipe' _macOS_
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -774,7 +810,7 @@ A `boolean` property that determines whether the window is in fullscreen mode.
|
|||||||
|
|
||||||
A `boolean` property that determines whether the window is focusable.
|
A `boolean` property that determines whether the window is focusable.
|
||||||
|
|
||||||
#### `win.visibleOnAllWorkspaces`
|
#### `win.visibleOnAllWorkspaces` _macOS_ _Linux_
|
||||||
|
|
||||||
A `boolean` property that determines whether the window is visible on all workspaces.
|
A `boolean` property that determines whether the window is visible on all workspaces.
|
||||||
|
|
||||||
@@ -811,13 +847,13 @@ 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.
|
**Note:** The title of the web page can be different from the title of the native window.
|
||||||
|
|
||||||
#### `win.minimizable`
|
#### `win.minimizable` _macOS_ _Windows_
|
||||||
|
|
||||||
A `boolean` property that determines whether the window can be manually minimized by user.
|
A `boolean` property that determines whether the window can be manually minimized by user.
|
||||||
|
|
||||||
On Linux the setter is a no-op, although the getter returns `true`.
|
On Linux the setter is a no-op, although the getter returns `true`.
|
||||||
|
|
||||||
#### `win.maximizable`
|
#### `win.maximizable` _macOS_ _Windows_
|
||||||
|
|
||||||
A `boolean` property that determines whether the window can be manually maximized by user.
|
A `boolean` property that determines whether the window can be manually maximized by user.
|
||||||
|
|
||||||
@@ -832,13 +868,13 @@ maximizes the window.
|
|||||||
|
|
||||||
A `boolean` property that determines whether the window can be manually resized by user.
|
A `boolean` property that determines whether the window can be manually resized by user.
|
||||||
|
|
||||||
#### `win.closable`
|
#### `win.closable` _macOS_ _Windows_
|
||||||
|
|
||||||
A `boolean` property that determines whether the window can be manually closed by user.
|
A `boolean` property that determines whether the window can be manually closed by user.
|
||||||
|
|
||||||
On Linux the setter is a no-op, although the getter returns `true`.
|
On Linux the setter is a no-op, although the getter returns `true`.
|
||||||
|
|
||||||
#### `win.movable`
|
#### `win.movable` _macOS_ _Windows_
|
||||||
|
|
||||||
A `boolean` property that determines Whether the window can be moved by user.
|
A `boolean` property that determines Whether the window can be moved by user.
|
||||||
|
|
||||||
@@ -1000,6 +1036,8 @@ height areas you have within the overall content view.
|
|||||||
The aspect ratio is not respected when window is resized programmatically with
|
The aspect ratio is not respected when window is resized programmatically with
|
||||||
APIs like `win.setSize`.
|
APIs like `win.setSize`.
|
||||||
|
|
||||||
|
To reset an aspect ratio, pass 0 as the `aspectRatio` value: `win.setAspectRatio(0)`.
|
||||||
|
|
||||||
#### `win.setBackgroundColor(backgroundColor)`
|
#### `win.setBackgroundColor(backgroundColor)`
|
||||||
|
|
||||||
* `backgroundColor` string - Color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. The alpha channel is optional for the hex type.
|
* `backgroundColor` string - Color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. The alpha channel is optional for the hex type.
|
||||||
@@ -1220,6 +1258,16 @@ Returns `boolean` - Whether the window can be manually closed by user.
|
|||||||
|
|
||||||
On Linux always returns `true`.
|
On Linux always returns `true`.
|
||||||
|
|
||||||
|
#### `win.setHiddenInMissionControl(hidden)` _macOS_
|
||||||
|
|
||||||
|
* `hidden` boolean
|
||||||
|
|
||||||
|
Sets whether the window will be hidden when the user toggles into mission control.
|
||||||
|
|
||||||
|
#### `win.isHiddenInMissionControl()` _macOS_
|
||||||
|
|
||||||
|
Returns `boolean` - Whether the window will be hidden when the user toggles into mission control.
|
||||||
|
|
||||||
#### `win.setAlwaysOnTop(flag[, level][, relativeLevel])`
|
#### `win.setAlwaysOnTop(flag[, level][, relativeLevel])`
|
||||||
|
|
||||||
* `flag` boolean
|
* `flag` boolean
|
||||||
@@ -1307,7 +1355,7 @@ win.setSheetOffset(toolbarRect.height)
|
|||||||
|
|
||||||
Starts or stops flashing the window to attract user's attention.
|
Starts or stops flashing the window to attract user's attention.
|
||||||
|
|
||||||
#### `win.setSkipTaskbar(skip)`
|
#### `win.setSkipTaskbar(skip)` _macOS_ _Windows_
|
||||||
|
|
||||||
* `skip` boolean
|
* `skip` boolean
|
||||||
|
|
||||||
@@ -1402,13 +1450,16 @@ Returns `boolean` - Whether the window's document has been edited.
|
|||||||
|
|
||||||
#### `win.blurWebView()`
|
#### `win.blurWebView()`
|
||||||
|
|
||||||
#### `win.capturePage([rect])`
|
#### `win.capturePage([rect, opts])`
|
||||||
|
|
||||||
* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture
|
* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture
|
||||||
|
* `opts` Object (optional)
|
||||||
|
* `stayHidden` boolean (optional) - Keep the page hidden instead of visible. Default is `false`.
|
||||||
|
* `stayAwake` boolean (optional) - Keep the system awake instead of allowing it to sleep. Default is `false`.
|
||||||
|
|
||||||
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
|
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
|
||||||
|
|
||||||
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. If the page is not visible, `rect` may be empty.
|
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. If the page is not visible, `rect` may be empty. The page is considered visible when its browser window is hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that `stayHidden` is set to true.
|
||||||
|
|
||||||
#### `win.loadURL(url[, options])`
|
#### `win.loadURL(url[, options])`
|
||||||
|
|
||||||
@@ -1635,7 +1686,7 @@ Changes window icon.
|
|||||||
|
|
||||||
Sets whether the window traffic light buttons should be visible.
|
Sets whether the window traffic light buttons should be visible.
|
||||||
|
|
||||||
#### `win.setAutoHideMenuBar(hide)`
|
#### `win.setAutoHideMenuBar(hide)` _Windows_ _Linux_
|
||||||
|
|
||||||
* `hide` boolean
|
* `hide` boolean
|
||||||
|
|
||||||
@@ -1644,7 +1695,7 @@ menu bar will only show when users press the single `Alt` key.
|
|||||||
|
|
||||||
If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't hide it immediately.
|
If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't hide it immediately.
|
||||||
|
|
||||||
#### `win.isMenuBarAutoHide()`
|
#### `win.isMenuBarAutoHide()` _Windows_ _Linux_
|
||||||
|
|
||||||
Returns `boolean` - Whether menu bar automatically hides itself.
|
Returns `boolean` - Whether menu bar automatically hides itself.
|
||||||
|
|
||||||
@@ -1654,11 +1705,11 @@ Returns `boolean` - Whether menu bar automatically hides itself.
|
|||||||
|
|
||||||
Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||||
|
|
||||||
#### `win.isMenuBarVisible()`
|
#### `win.isMenuBarVisible()` _Windows_ _Linux_
|
||||||
|
|
||||||
Returns `boolean` - Whether the menu bar is visible.
|
Returns `boolean` - Whether the menu bar is visible.
|
||||||
|
|
||||||
#### `win.setVisibleOnAllWorkspaces(visible[, options])`
|
#### `win.setVisibleOnAllWorkspaces(visible[, options])` _macOS_ _Linux_
|
||||||
|
|
||||||
* `visible` boolean
|
* `visible` boolean
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
@@ -1676,7 +1727,7 @@ Sets whether the window should be visible on all workspaces.
|
|||||||
|
|
||||||
**Note:** This API does nothing on Windows.
|
**Note:** This API does nothing on Windows.
|
||||||
|
|
||||||
#### `win.isVisibleOnAllWorkspaces()`
|
#### `win.isVisibleOnAllWorkspaces()` _macOS_ _Linux_
|
||||||
|
|
||||||
Returns `boolean` - Whether the window is visible on all workspaces.
|
Returns `boolean` - Whether the window is visible on all workspaces.
|
||||||
|
|
||||||
@@ -1852,7 +1903,7 @@ removed in future Electron releases.
|
|||||||
On a Window with Window Controls Overlay already enabled, this method updates
|
On a Window with Window Controls Overlay already enabled, this method updates
|
||||||
the style of the title bar overlay.
|
the style of the title bar overlay.
|
||||||
|
|
||||||
[runtime-enabled-features]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70
|
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||||
[page-visibility-api]: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
|
[page-visibility-api]: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
|
||||||
[quick-look]: https://en.wikipedia.org/wiki/Quick_Look
|
[quick-look]: https://en.wikipedia.org/wiki/Quick_Look
|
||||||
[vibrancy-docs]: https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc
|
[vibrancy-docs]: https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
> Perform copy and paste operations on the system clipboard.
|
> Perform copy and paste operations on the system clipboard.
|
||||||
|
|
||||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
|
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) (non-sandboxed only)
|
||||||
|
|
||||||
On Linux, there is also a `selection` clipboard. To manipulate it
|
On Linux, there is also a `selection` clipboard. To manipulate it
|
||||||
you need to pass `selection` to each method:
|
you need to pass `selection` to each method:
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ page you load in your renderer executes code in this world.
|
|||||||
|
|
||||||
When `contextIsolation` is enabled in your `webPreferences` (this is the default behavior since Electron 12.0.0), your `preload` scripts run in an
|
When `contextIsolation` is enabled in your `webPreferences` (this is the default behavior since Electron 12.0.0), your `preload` scripts run in an
|
||||||
"Isolated World". You can read more about context isolation and what it affects in the
|
"Isolated World". You can read more about context isolation and what it affects in the
|
||||||
[security](../tutorial/security.md#3-enable-context-isolation-for-remote-content) docs.
|
[security](../tutorial/security.md#3-enable-context-isolation) docs.
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
@@ -46,6 +46,12 @@ The `contextBridge` module has the following methods:
|
|||||||
* `apiKey` string - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
|
* `apiKey` string - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
|
||||||
* `api` any - Your API, more information on what this API can be and how it works is available below.
|
* `api` any - Your API, more information on what this API can be and how it works is available below.
|
||||||
|
|
||||||
|
### `contextBridge.exposeInIsolatedWorld(worldId, apiKey, api)`
|
||||||
|
|
||||||
|
* `worldId` Integer - The ID of the world to inject the API into. `0` is the default world, `999` is the world used by Electron's `contextIsolation` feature. Using 999 would expose the object for preload context. We recommend using 1000+ while creating isolated world.
|
||||||
|
* `apiKey` string - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
|
||||||
|
* `api` any - Your API, more information on what this API can be and how it works is available below.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### API
|
### API
|
||||||
@@ -84,6 +90,26 @@ contextBridge.exposeInMainWorld(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
An example of `exposeInIsolatedWorld` is shown below:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const { contextBridge, ipcRenderer } = require('electron')
|
||||||
|
|
||||||
|
contextBridge.exposeInIsolatedWorld(
|
||||||
|
1004,
|
||||||
|
'electron',
|
||||||
|
{
|
||||||
|
doThing: () => ipcRenderer.send('do-a-thing')
|
||||||
|
}
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Renderer (In isolated world id1004)
|
||||||
|
|
||||||
|
window.electron.doThing()
|
||||||
|
```
|
||||||
|
|
||||||
### API Functions
|
### API Functions
|
||||||
|
|
||||||
`Function` values that you bind through the `contextBridge` are proxied through Electron to ensure that contexts remain isolated. This
|
`Function` values that you bind through the `contextBridge` are proxied through Electron to ensure that contexts remain isolated. This
|
||||||
|
|||||||
@@ -79,3 +79,5 @@ Returns `Menu | null` - The application's [dock menu][dock-menu].
|
|||||||
* `image` ([NativeImage](native-image.md) | string)
|
* `image` ([NativeImage](native-image.md) | string)
|
||||||
|
|
||||||
Sets the `image` associated with this dock icon.
|
Sets the `image` associated with this dock icon.
|
||||||
|
|
||||||
|
[dock-menu]: https://developer.apple.com/macos/human-interface-guidelines/menus/dock-menus/
|
||||||
|
|||||||
@@ -139,8 +139,7 @@ green and non-draggable regions will be colored red to aid debugging.
|
|||||||
|
|
||||||
### `ELECTRON_DEBUG_NOTIFICATIONS`
|
### `ELECTRON_DEBUG_NOTIFICATIONS`
|
||||||
|
|
||||||
Adds extra logs to [`Notification`](./notification.md) lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common a
|
Adds extra logs to [`Notification`](./notification.md) lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common actions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.
|
||||||
tions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.
|
|
||||||
|
|
||||||
Sample output:
|
Sample output:
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ work). Extensions are installed per-`session`. To load an extension, call
|
|||||||
```js
|
```js
|
||||||
const { session } = require('electron')
|
const { session } = require('electron')
|
||||||
|
|
||||||
session.loadExtension('path/to/unpacked/extension').then(({ id }) => {
|
session.defaultSession.loadExtension('path/to/unpacked/extension').then(({ id }) => {
|
||||||
// ...
|
// ...
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@@ -99,6 +99,7 @@ Only `chrome.storage.local` is supported; `chrome.storage.sync` and
|
|||||||
The following methods of `chrome.tabs` are supported:
|
The following methods of `chrome.tabs` are supported:
|
||||||
|
|
||||||
- `chrome.tabs.sendMessage`
|
- `chrome.tabs.sendMessage`
|
||||||
|
- `chrome.tabs.reload`
|
||||||
- `chrome.tabs.executeScript`
|
- `chrome.tabs.executeScript`
|
||||||
- `chrome.tabs.update` (partial support)
|
- `chrome.tabs.update` (partial support)
|
||||||
- supported properties: `url`, `muted`.
|
- supported properties: `url`, `muted`.
|
||||||
|
|||||||
@@ -96,14 +96,6 @@ Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will no
|
|||||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||||
throw an exception.
|
throw an exception.
|
||||||
|
|
||||||
> **NOTE:** Sending non-standard JavaScript types such as DOM objects or
|
|
||||||
> special Electron objects will throw an exception.
|
|
||||||
>
|
|
||||||
> Since the main process does not have support for DOM objects such as
|
|
||||||
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
|
|
||||||
> Electron's IPC to the main process, as the main process would have no way to decode
|
|
||||||
> them. Attempting to send such objects over IPC will result in an error.
|
|
||||||
|
|
||||||
The main process should listen for `channel` with
|
The main process should listen for `channel` with
|
||||||
[`ipcMain.handle()`](./ipc-main.md#ipcmainhandlechannel-listener).
|
[`ipcMain.handle()`](./ipc-main.md#ipcmainhandlechannel-listener).
|
||||||
|
|
||||||
@@ -126,6 +118,21 @@ If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRender
|
|||||||
|
|
||||||
If you do not need a response to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
|
If you do not need a response to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
> Sending non-standard JavaScript types such as DOM objects or
|
||||||
|
> special Electron objects will throw an exception.
|
||||||
|
>
|
||||||
|
> Since the main process does not have support for DOM objects such as
|
||||||
|
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
|
||||||
|
> Electron's IPC to the main process, as the main process would have no way to decode
|
||||||
|
> them. Attempting to send such objects over IPC will result in an error.
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
> If the handler in the main process throws an error,
|
||||||
|
> the promise returned by `invoke` will reject.
|
||||||
|
> However, the `Error` object in the renderer process
|
||||||
|
> will not be the same as the one thrown in the main process.
|
||||||
|
|
||||||
### `ipcRenderer.sendSync(channel, ...args)`
|
### `ipcRenderer.sendSync(channel, ...args)`
|
||||||
|
|
||||||
* `channel` string
|
* `channel` string
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ See [`Menu`](menu.md) for examples.
|
|||||||
* `menuItem` MenuItem
|
* `menuItem` MenuItem
|
||||||
* `browserWindow` [BrowserWindow](browser-window.md) | undefined - This will not be defined if no window is open.
|
* `browserWindow` [BrowserWindow](browser-window.md) | undefined - This will not be defined if no window is open.
|
||||||
* `event` [KeyboardEvent](structures/keyboard-event.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`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, 'showSubstitutions', 'toggleSmartQuotes', 'toggleSmartDashes', 'toggleTextReplacement', `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `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`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`, `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `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).
|
`click` property will be ignored. See [roles](#roles).
|
||||||
* `type` string (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
|
* `type` string (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
|
||||||
`radio`.
|
`radio`.
|
||||||
|
|||||||
@@ -56,3 +56,4 @@ Emitted when the remote end of a MessagePortMain object becomes disconnected.
|
|||||||
|
|
||||||
[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
|
[`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
|
[Channel Messaging API]: https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API
|
||||||
|
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ console.log(image)
|
|||||||
* `options` Object
|
* `options` Object
|
||||||
* `width` Integer
|
* `width` Integer
|
||||||
* `height` Integer
|
* `height` Integer
|
||||||
* `scaleFactor` Double (optional) - Defaults to 1.0.
|
* `scaleFactor` Number (optional) - Defaults to 1.0.
|
||||||
|
|
||||||
Returns `NativeImage`
|
Returns `NativeImage`
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ pixel data returned by `toBitmap()`. The specific format is platform-dependent.
|
|||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `width` Integer (optional) - Required for bitmap buffers.
|
* `width` Integer (optional) - Required for bitmap buffers.
|
||||||
* `height` Integer (optional) - Required for bitmap buffers.
|
* `height` Integer (optional) - Required for bitmap buffers.
|
||||||
* `scaleFactor` Double (optional) - Defaults to 1.0.
|
* `scaleFactor` Number (optional) - Defaults to 1.0.
|
||||||
|
|
||||||
Returns `NativeImage`
|
Returns `NativeImage`
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ The following methods are available on instances of the `NativeImage` class:
|
|||||||
#### `image.toPNG([options])`
|
#### `image.toPNG([options])`
|
||||||
|
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `scaleFactor` Double (optional) - Defaults to 1.0.
|
* `scaleFactor` Number (optional) - Defaults to 1.0.
|
||||||
|
|
||||||
Returns `Buffer` - A [Buffer][buffer] that contains the image's `PNG` encoded data.
|
Returns `Buffer` - A [Buffer][buffer] that contains the image's `PNG` encoded data.
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ Returns `Buffer` - A [Buffer][buffer] that contains the image's `JPEG` encoded d
|
|||||||
#### `image.toBitmap([options])`
|
#### `image.toBitmap([options])`
|
||||||
|
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `scaleFactor` Double (optional) - Defaults to 1.0.
|
* `scaleFactor` Number (optional) - Defaults to 1.0.
|
||||||
|
|
||||||
Returns `Buffer` - A [Buffer][buffer] that contains a copy of the image's raw bitmap pixel
|
Returns `Buffer` - A [Buffer][buffer] that contains a copy of the image's raw bitmap pixel
|
||||||
data.
|
data.
|
||||||
@@ -246,14 +246,14 @@ data.
|
|||||||
#### `image.toDataURL([options])`
|
#### `image.toDataURL([options])`
|
||||||
|
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `scaleFactor` Double (optional) - Defaults to 1.0.
|
* `scaleFactor` Number (optional) - Defaults to 1.0.
|
||||||
|
|
||||||
Returns `string` - The data URL of the image.
|
Returns `string` - The data URL of the image.
|
||||||
|
|
||||||
#### `image.getBitmap([options])`
|
#### `image.getBitmap([options])`
|
||||||
|
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `scaleFactor` Double (optional) - Defaults to 1.0.
|
* `scaleFactor` Number (optional) - Defaults to 1.0.
|
||||||
|
|
||||||
Returns `Buffer` - A [Buffer][buffer] that contains the image's raw bitmap pixel data.
|
Returns `Buffer` - A [Buffer][buffer] that contains the image's raw bitmap pixel data.
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ Returns `boolean` - Whether the image is empty.
|
|||||||
|
|
||||||
#### `image.getSize([scaleFactor])`
|
#### `image.getSize([scaleFactor])`
|
||||||
|
|
||||||
* `scaleFactor` Double (optional) - Defaults to 1.0.
|
* `scaleFactor` Number (optional) - Defaults to 1.0.
|
||||||
|
|
||||||
Returns [`Size`](structures/size.md).
|
Returns [`Size`](structures/size.md).
|
||||||
|
|
||||||
@@ -317,20 +317,20 @@ will be preserved in the resized image.
|
|||||||
|
|
||||||
#### `image.getAspectRatio([scaleFactor])`
|
#### `image.getAspectRatio([scaleFactor])`
|
||||||
|
|
||||||
* `scaleFactor` Double (optional) - Defaults to 1.0.
|
* `scaleFactor` Number (optional) - Defaults to 1.0.
|
||||||
|
|
||||||
Returns `Float` - The image's aspect ratio.
|
Returns `Number` - The image's aspect ratio.
|
||||||
|
|
||||||
If `scaleFactor` is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.
|
If `scaleFactor` is passed, this will return the aspect ratio corresponding to the image representation most closely matching the passed value.
|
||||||
|
|
||||||
#### `image.getScaleFactors()`
|
#### `image.getScaleFactors()`
|
||||||
|
|
||||||
Returns `Float[]` - An array of all scale factors corresponding to representations for a given nativeImage.
|
Returns `Number[]` - An array of all scale factors corresponding to representations for a given nativeImage.
|
||||||
|
|
||||||
#### `image.addRepresentation(options)`
|
#### `image.addRepresentation(options)`
|
||||||
|
|
||||||
* `options` Object
|
* `options` Object
|
||||||
* `scaleFactor` Double - The scale factor to add the image representation for.
|
* `scaleFactor` Number (optional) - The scale factor to add the image representation for.
|
||||||
* `width` Integer (optional) - Defaults to 0. Required if a bitmap buffer
|
* `width` Integer (optional) - Defaults to 0. Required if a bitmap buffer
|
||||||
is specified as `buffer`.
|
is specified as `buffer`.
|
||||||
* `height` Integer (optional) - Defaults to 0. Required if a bitmap buffer
|
* `height` Integer (optional) - Defaults to 0. Required if a bitmap buffer
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ The `net` module has the following methods:
|
|||||||
|
|
||||||
### `net.request(options)`
|
### `net.request(options)`
|
||||||
|
|
||||||
* `options` (ClientRequestConstructorOptions | string) - The `ClientRequest` constructor options.
|
* `options` ([ClientRequestConstructorOptions](client-request.md#new-clientrequestoptions) | string) - The `ClientRequest` constructor options.
|
||||||
|
|
||||||
Returns [`ClientRequest`](./client-request.md)
|
Returns [`ClientRequest`](./client-request.md)
|
||||||
|
|
||||||
|
|||||||
48
docs/api/parent-port.md
Normal file
48
docs/api/parent-port.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# parentPort
|
||||||
|
|
||||||
|
> Interface for communication with parent process.
|
||||||
|
|
||||||
|
Process: [Utility](../glossary.md#utility-process)
|
||||||
|
|
||||||
|
`parentPort` is an [EventEmitter][event-emitter].
|
||||||
|
_This object is not exported from the `'electron'` module. It is only available as a property of the process object in the Electron API._
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Main process
|
||||||
|
const child = utilityProcess.fork(path.join(__dirname, 'test.js'))
|
||||||
|
child.postMessage({ message: 'hello' })
|
||||||
|
child.on('message', (data) => {
|
||||||
|
console.log(data) // hello world!
|
||||||
|
})
|
||||||
|
|
||||||
|
// Child process
|
||||||
|
process.parentPort.on('message', (e) => {
|
||||||
|
process.parentPort.postMessage(`${e.data} world!`)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Events
|
||||||
|
|
||||||
|
The `parentPort` object emits the following events:
|
||||||
|
|
||||||
|
### Event: 'message'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `messageEvent` Object
|
||||||
|
* `data` any
|
||||||
|
* `ports` MessagePortMain[]
|
||||||
|
|
||||||
|
Emitted when the process receives a message. Messages received on
|
||||||
|
this port will be queued up until a handler is registered for this
|
||||||
|
event.
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
### `parentPort.postMessage(message)`
|
||||||
|
|
||||||
|
* `message` any
|
||||||
|
|
||||||
|
Sends a message from the process to its parent.
|
||||||
|
|
||||||
|
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||||
@@ -113,6 +113,7 @@ A `string` representing the current process's type, can be:
|
|||||||
* `browser` - The main process
|
* `browser` - The main process
|
||||||
* `renderer` - A renderer process
|
* `renderer` - A renderer process
|
||||||
* `worker` - In a web worker
|
* `worker` - In a web worker
|
||||||
|
* `utility` - In a node process launched as a service
|
||||||
|
|
||||||
### `process.versions.chrome` _Readonly_
|
### `process.versions.chrome` _Readonly_
|
||||||
|
|
||||||
@@ -134,6 +135,11 @@ Each frame has its own JavaScript context. When contextIsolation is enabled, the
|
|||||||
world also has a separate JavaScript context.
|
world also has a separate JavaScript context.
|
||||||
This property is only available in the renderer process.
|
This property is only available in the renderer process.
|
||||||
|
|
||||||
|
### `process.parentPort`
|
||||||
|
|
||||||
|
A [`Electron.ParentPort`](parent-port.md) property if this is a [`UtilityProcess`](utility-process.md)
|
||||||
|
(or `null` otherwise) allowing communication with the parent process.
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
The `process` object has the following methods:
|
The `process` object has the following methods:
|
||||||
|
|||||||
@@ -10,11 +10,12 @@ An example of implementing a protocol that has the same effect as the
|
|||||||
```javascript
|
```javascript
|
||||||
const { app, protocol } = require('electron')
|
const { app, protocol } = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const url = require('url')
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
protocol.registerFileProtocol('atom', (request, callback) => {
|
protocol.registerFileProtocol('atom', (request, callback) => {
|
||||||
const url = request.url.substr(7)
|
const filePath = url.fileURLToPath('file://' + request.url.slice('atom://'.length))
|
||||||
callback({ path: path.normalize(`${__dirname}/${url}`) })
|
callback(filePath)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@@ -175,7 +176,7 @@ property.
|
|||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `response` ProtocolResponse
|
* `response` [ProtocolResponse](structures/protocol-response.md)
|
||||||
|
|
||||||
Returns `boolean` - Whether the protocol was successfully registered
|
Returns `boolean` - Whether the protocol was successfully registered
|
||||||
|
|
||||||
|
|||||||
48
docs/api/push-notifications.md
Normal file
48
docs/api/push-notifications.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# pushNotifications
|
||||||
|
|
||||||
|
Process: [Main](../glossary.md#main-process)
|
||||||
|
|
||||||
|
> Register for and receive notifications from remote push notification services
|
||||||
|
|
||||||
|
For example, when registering for push notifications via Apple push notification services (APNS):
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const { pushNotifications, Notification } = require('electron')
|
||||||
|
|
||||||
|
pushNotifications.registerForAPNSNotifications().then((token) => {
|
||||||
|
// forward token to your remote notification server
|
||||||
|
})
|
||||||
|
|
||||||
|
pushNotifications.on('received-apns-notification', (event, userInfo) => {
|
||||||
|
// generate a new Notification object with the relevant userInfo fields
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Events
|
||||||
|
|
||||||
|
The `pushNotification` module emits the following events:
|
||||||
|
|
||||||
|
#### Event: 'received-apns-notification' _macOS_
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `userInfo` Record<String, any>
|
||||||
|
|
||||||
|
Emitted when the app receives a remote notification while running.
|
||||||
|
See: https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428430-application?language=objc
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
The `pushNotification` module has the following methods:
|
||||||
|
|
||||||
|
### `pushNotifications.registerForAPNSNotifications()` _macOS_
|
||||||
|
|
||||||
|
Returns `Promise<string>`
|
||||||
|
|
||||||
|
Registers the app with Apple Push Notification service (APNS) to receive [Badge, Sound, and Alert](https://developer.apple.com/documentation/appkit/sremotenotificationtype?language=objc) notifications. If registration is successful, the promise will be resolved with the APNS device token. Otherwise, the promise will be rejected with an error message.
|
||||||
|
See: https://developer.apple.com/documentation/appkit/nsapplication/1428476-registerforremotenotificationtyp?language=objc
|
||||||
|
|
||||||
|
### `pushNotifications.unregisterForAPNSNotifications()` _macOS_
|
||||||
|
|
||||||
|
Unregisters the app from notifications received from APNS.
|
||||||
|
See: https://developer.apple.com/documentation/appkit/nsapplication/1428747-unregisterforremotenotifications?language=objc
|
||||||
@@ -18,9 +18,9 @@ The `safeStorage` module has the following methods:
|
|||||||
|
|
||||||
Returns `boolean` - Whether encryption is available.
|
Returns `boolean` - Whether encryption is available.
|
||||||
|
|
||||||
On Linux, returns true if the secret key is
|
On Linux, returns true if the app has emitted the `ready` event and the secret key is available.
|
||||||
available. On MacOS, returns true if Keychain is available.
|
On MacOS, returns true if Keychain is available.
|
||||||
On Windows, returns true with no other preconditions.
|
On Windows, returns true once the app has emitted the `ready` event.
|
||||||
|
|
||||||
### `safeStorage.encryptString(plainText)`
|
### `safeStorage.encryptString(plainText)`
|
||||||
|
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ app.whenReady().then(() => {
|
|||||||
const selectedDevice = details.deviceList.find((device) => {
|
const selectedDevice = details.deviceList.find((device) => {
|
||||||
return device.vendorId === '9025' && device.productId === '67'
|
return device.vendorId === '9025' && device.productId === '67'
|
||||||
})
|
})
|
||||||
callback(selectedPort?.deviceId)
|
callback(selectedDevice?.deviceId)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@@ -253,9 +253,11 @@ Returns:
|
|||||||
* `device` [HIDDevice[]](structures/hid-device.md)
|
* `device` [HIDDevice[]](structures/hid-device.md)
|
||||||
* `frame` [WebFrameMain](web-frame-main.md)
|
* `frame` [WebFrameMain](web-frame-main.md)
|
||||||
|
|
||||||
Emitted when a new HID device becomes available. For example, when a new USB device is plugged in.
|
Emitted after `navigator.hid.requestDevice` has been called and
|
||||||
|
`select-hid-device` has fired if a new device becomes available before
|
||||||
This event will only be emitted after `navigator.hid.requestDevice` has been called and `select-hid-device` has fired.
|
the callback from `select-hid-device` is called. This event is intended for
|
||||||
|
use when using a UI to ask users to pick a device so that the UI can be updated
|
||||||
|
with the newly added device.
|
||||||
|
|
||||||
#### Event: 'hid-device-removed'
|
#### Event: 'hid-device-removed'
|
||||||
|
|
||||||
@@ -266,9 +268,24 @@ Returns:
|
|||||||
* `device` [HIDDevice[]](structures/hid-device.md)
|
* `device` [HIDDevice[]](structures/hid-device.md)
|
||||||
* `frame` [WebFrameMain](web-frame-main.md)
|
* `frame` [WebFrameMain](web-frame-main.md)
|
||||||
|
|
||||||
Emitted when a HID device has been removed. For example, this event will fire when a USB device is unplugged.
|
Emitted after `navigator.hid.requestDevice` has been called and
|
||||||
|
`select-hid-device` has fired if a device has been removed before the callback
|
||||||
|
from `select-hid-device` is called. This event is intended for use when using
|
||||||
|
a UI to ask users to pick a device so that the UI can be updated to remove the
|
||||||
|
specified device.
|
||||||
|
|
||||||
This event will only be emitted after `navigator.hid.requestDevice` has been called and `select-hid-device` has fired.
|
#### Event: 'hid-device-revoked'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `details` Object
|
||||||
|
* `device` [HIDDevice[]](structures/hid-device.md)
|
||||||
|
* `origin` string (optional) - The origin that the device has been revoked from.
|
||||||
|
|
||||||
|
Emitted after `HIDDevice.forget()` has been called. This event can be used
|
||||||
|
to help maintain persistent storage of permissions when
|
||||||
|
`setDevicePermissionHandler` is used.
|
||||||
|
|
||||||
#### Event: 'select-serial-port'
|
#### Event: 'select-serial-port'
|
||||||
|
|
||||||
@@ -348,7 +365,11 @@ Returns:
|
|||||||
* `port` [SerialPort](structures/serial-port.md)
|
* `port` [SerialPort](structures/serial-port.md)
|
||||||
* `webContents` [WebContents](web-contents.md)
|
* `webContents` [WebContents](web-contents.md)
|
||||||
|
|
||||||
Emitted after `navigator.serial.requestPort` has been called and `select-serial-port` has fired if a new serial port becomes available. For example, this event will fire when a new USB device is plugged in.
|
Emitted after `navigator.serial.requestPort` has been called and
|
||||||
|
`select-serial-port` has fired if a new serial port becomes available before
|
||||||
|
the callback from `select-serial-port` is called. This event is intended for
|
||||||
|
use when using a UI to ask users to pick a port so that the UI can be updated
|
||||||
|
with the newly added port.
|
||||||
|
|
||||||
#### Event: 'serial-port-removed'
|
#### Event: 'serial-port-removed'
|
||||||
|
|
||||||
@@ -358,7 +379,167 @@ Returns:
|
|||||||
* `port` [SerialPort](structures/serial-port.md)
|
* `port` [SerialPort](structures/serial-port.md)
|
||||||
* `webContents` [WebContents](web-contents.md)
|
* `webContents` [WebContents](web-contents.md)
|
||||||
|
|
||||||
Emitted after `navigator.serial.requestPort` has been called and `select-serial-port` has fired if a serial port has been removed. For example, this event will fire when a USB device is unplugged.
|
Emitted after `navigator.serial.requestPort` has been called and
|
||||||
|
`select-serial-port` has fired if a serial port has been removed before the
|
||||||
|
callback from `select-serial-port` is called. This event is intended for use
|
||||||
|
when using a UI to ask users to pick a port so that the UI can be updated
|
||||||
|
to remove the specified port.
|
||||||
|
|
||||||
|
#### Event: 'serial-port-revoked'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `details` Object
|
||||||
|
* `port` [SerialPort](structures/serial-port.md)
|
||||||
|
* `frame` [WebFrameMain](web-frame-main.md)
|
||||||
|
* `origin` string - The origin that the device has been revoked from.
|
||||||
|
|
||||||
|
Emitted after `SerialPort.forget()` has been called. This event can be used
|
||||||
|
to help maintain persistent storage of permissions when `setDevicePermissionHandler` is used.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Browser Process
|
||||||
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 600
|
||||||
|
})
|
||||||
|
|
||||||
|
win.webContents.session.on('serial-port-revoked', (event, details) => {
|
||||||
|
console.log(`Access revoked for serial device from origin ${details.origin}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Renderer Process
|
||||||
|
|
||||||
|
const portConnect = async () => {
|
||||||
|
// Request a port.
|
||||||
|
const port = await navigator.serial.requestPort()
|
||||||
|
|
||||||
|
// Wait for the serial port to open.
|
||||||
|
await port.open({ baudRate: 9600 })
|
||||||
|
|
||||||
|
// ...later, revoke access to the serial port.
|
||||||
|
await port.forget()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Event: 'select-usb-device'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `details` Object
|
||||||
|
* `deviceList` [USBDevice[]](structures/usb-device.md)
|
||||||
|
* `frame` [WebFrameMain](web-frame-main.md)
|
||||||
|
* `callback` Function
|
||||||
|
* `deviceId` string (optional)
|
||||||
|
|
||||||
|
Emitted when a USB device needs to be selected when a call to
|
||||||
|
`navigator.usb.requestDevice` is made. `callback` should be called with
|
||||||
|
`deviceId` to be selected; passing no arguments to `callback` will
|
||||||
|
cancel the request. Additionally, permissioning on `navigator.usb` can
|
||||||
|
be further managed by using [ses.setPermissionCheckHandler(handler)](#sessetpermissioncheckhandlerhandler)
|
||||||
|
and [ses.setDevicePermissionHandler(handler)`](#sessetdevicepermissionhandlerhandler).
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
let win = null
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
win = new BrowserWindow()
|
||||||
|
|
||||||
|
win.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
|
||||||
|
if (permission === 'usb') {
|
||||||
|
// Add logic here to determine if permission should be given to allow USB selection
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
|
// Optionally, retrieve previously persisted devices from a persistent store (fetchGrantedDevices needs to be implemented by developer to fetch persisted permissions)
|
||||||
|
const grantedDevices = fetchGrantedDevices()
|
||||||
|
|
||||||
|
win.webContents.session.setDevicePermissionHandler((details) => {
|
||||||
|
if (new URL(details.origin).hostname === 'some-host' && details.deviceType === 'usb') {
|
||||||
|
if (details.device.vendorId === 123 && details.device.productId === 345) {
|
||||||
|
// Always allow this type of device (this allows skipping the call to `navigator.usb.requestDevice` first)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search through the list of devices that have previously been granted permission
|
||||||
|
return grantedDevices.some((grantedDevice) => {
|
||||||
|
return grantedDevice.vendorId === details.device.vendorId &&
|
||||||
|
grantedDevice.productId === details.device.productId &&
|
||||||
|
grantedDevice.serialNumber && grantedDevice.serialNumber === details.device.serialNumber
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
|
win.webContents.session.on('select-usb-device', (event, details, callback) => {
|
||||||
|
event.preventDefault()
|
||||||
|
const selectedDevice = details.deviceList.find((device) => {
|
||||||
|
return device.vendorId === '9025' && device.productId === '67'
|
||||||
|
})
|
||||||
|
if (selectedDevice) {
|
||||||
|
// Optionally, add this to the persisted devices (updateGrantedDevices needs to be implemented by developer to persist permissions)
|
||||||
|
grantedDevices.push(selectedDevice)
|
||||||
|
updateGrantedDevices(grantedDevices)
|
||||||
|
}
|
||||||
|
callback(selectedDevice?.deviceId)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Event: 'usb-device-added'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `details` Object
|
||||||
|
* `device` [USBDevice](structures/usb-device.md)
|
||||||
|
* `frame` [WebFrameMain](web-frame-main.md)
|
||||||
|
|
||||||
|
Emitted after `navigator.usb.requestDevice` has been called and
|
||||||
|
`select-usb-device` has fired if a new device becomes available before
|
||||||
|
the callback from `select-usb-device` is called. This event is intended for
|
||||||
|
use when using a UI to ask users to pick a device so that the UI can be updated
|
||||||
|
with the newly added device.
|
||||||
|
|
||||||
|
#### Event: 'usb-device-removed'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `details` Object
|
||||||
|
* `device` [USBDevice](structures/usb-device.md)
|
||||||
|
* `frame` [WebFrameMain](web-frame-main.md)
|
||||||
|
|
||||||
|
Emitted after `navigator.usb.requestDevice` has been called and
|
||||||
|
`select-usb-device` has fired if a device has been removed before the callback
|
||||||
|
from `select-usb-device` is called. This event is intended for use when using
|
||||||
|
a UI to ask users to pick a device so that the UI can be updated to remove the
|
||||||
|
specified device.
|
||||||
|
|
||||||
|
#### Event: 'usb-device-revoked'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `details` Object
|
||||||
|
* `device` [USBDevice[]](structures/usb-device.md)
|
||||||
|
* `origin` string (optional) - The origin that the device has been revoked from.
|
||||||
|
|
||||||
|
Emitted after `USBDevice.forget()` has been called. This event can be used
|
||||||
|
to help maintain persistent storage of permissions when
|
||||||
|
`setDevicePermissionHandler` is used.
|
||||||
|
|
||||||
### Instance Methods
|
### Instance Methods
|
||||||
|
|
||||||
@@ -380,11 +561,11 @@ Clears the session’s HTTP cache.
|
|||||||
* `origin` string (optional) - Should follow `window.location.origin`’s representation
|
* `origin` string (optional) - Should follow `window.location.origin`’s representation
|
||||||
`scheme://host:port`.
|
`scheme://host:port`.
|
||||||
* `storages` string[] (optional) - The types of storages to clear, can contain:
|
* `storages` string[] (optional) - The types of storages to clear, can contain:
|
||||||
`appcache`, `cookies`, `filesystem`, `indexdb`, `localstorage`,
|
`cookies`, `filesystem`, `indexdb`, `localstorage`,
|
||||||
`shadercache`, `websql`, `serviceworkers`, `cachestorage`. If not
|
`shadercache`, `websql`, `serviceworkers`, `cachestorage`. If not
|
||||||
specified, clear all storage types.
|
specified, clear all storage types.
|
||||||
* `quotas` string[] (optional) - The types of quotas to clear, can contain:
|
* `quotas` string[] (optional) - The types of quotas to clear, can contain:
|
||||||
`temporary`, `persistent`, `syncable`. If not specified, clear all quotas.
|
`temporary`, `syncable`. If not specified, clear all quotas.
|
||||||
|
|
||||||
Returns `Promise<void>` - resolves when the storage data has been cleared.
|
Returns `Promise<void>` - resolves when the storage data has been cleared.
|
||||||
|
|
||||||
@@ -603,6 +784,7 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
|
|||||||
* `webContents` [WebContents](web-contents.md) - WebContents requesting the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin.
|
* `webContents` [WebContents](web-contents.md) - WebContents requesting the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin.
|
||||||
* `permission` string - The type of requested permission.
|
* `permission` string - The type of requested permission.
|
||||||
* `clipboard-read` - Request access to read from the clipboard.
|
* `clipboard-read` - Request access to read from the clipboard.
|
||||||
|
* `clipboard-sanitized-write` - Request access to write to the clipboard.
|
||||||
* `media` - Request access to media devices such as camera, microphone and speakers.
|
* `media` - Request access to media devices such as camera, microphone and speakers.
|
||||||
* `display-capture` - Request access to capture the screen.
|
* `display-capture` - Request access to capture the screen.
|
||||||
* `mediaKeySystem` - Request access to DRM protected content.
|
* `mediaKeySystem` - Request access to DRM protected content.
|
||||||
@@ -610,9 +792,10 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
|
|||||||
* `notifications` - Request notification creation and the ability to display them in the user's system tray.
|
* `notifications` - Request notification creation and the ability to display them in the user's system tray.
|
||||||
* `midi` - Request MIDI access in the `webmidi` API.
|
* `midi` - Request MIDI access in the `webmidi` API.
|
||||||
* `midiSysex` - Request the use of system exclusive messages in the `webmidi` API.
|
* `midiSysex` - Request the use of system exclusive messages in the `webmidi` API.
|
||||||
* `pointerLock` - Request to directly interpret mouse movements as an input method. Click [here](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API) to know more.
|
* `pointerLock` - Request to directly interpret mouse movements as an input method. Click [here](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API) to know more. These requests always appear to originate from the main frame.
|
||||||
* `fullscreen` - Request for the app to enter fullscreen mode.
|
* `fullscreen` - Request for the app to enter fullscreen mode.
|
||||||
* `openExternal` - Request to open links in external applications.
|
* `openExternal` - Request to open links in external applications.
|
||||||
|
* `window-management` - Request access to enumerate screens using the [`getScreenDetails`](https://developer.chrome.com/en/articles/multi-screen-window-placement/) API.
|
||||||
* `unknown` - An unrecognized permission request
|
* `unknown` - An unrecognized permission request
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `permissionGranted` boolean - Allow or deny the permission.
|
* `permissionGranted` boolean - Allow or deny the permission.
|
||||||
@@ -645,7 +828,7 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
|
|||||||
|
|
||||||
* `handler` Function\<boolean> | null
|
* `handler` Function\<boolean> | null
|
||||||
* `webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. All cross origin sub frames making permission checks will pass a `null` webContents to this handler, while certain other permission checks such as `notifications` checks will always pass `null`. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
|
* `webContents` ([WebContents](web-contents.md) | null) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin. All cross origin sub frames making permission checks will pass a `null` webContents to this handler, while certain other permission checks such as `notifications` checks will always pass `null`. You should use `embeddingOrigin` and `requestingOrigin` to determine what origin the owning frame and the requesting frame are on respectively.
|
||||||
* `permission` string - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, `hid`, or `serial`.
|
* `permission` string - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, `hid`, `serial`, or `usb`.
|
||||||
* `requestingOrigin` string - The origin URL of the permission check
|
* `requestingOrigin` string - The origin URL of the permission check
|
||||||
* `details` Object - Some properties are only available on certain permission types.
|
* `details` Object - Some properties are only available on certain permission types.
|
||||||
* `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
|
* `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
|
||||||
@@ -673,14 +856,67 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### `ses.setDisplayMediaRequestHandler(handler)`
|
||||||
|
|
||||||
|
* `handler` Function | null
|
||||||
|
* `request` Object
|
||||||
|
* `frame` [WebFrameMain](web-frame-main.md) - Frame that is requesting access to media.
|
||||||
|
* `securityOrigin` String - Origin of the page making the request.
|
||||||
|
* `videoRequested` Boolean - true if the web content requested a video stream.
|
||||||
|
* `audioRequested` Boolean - true if the web content requested an audio stream.
|
||||||
|
* `userGesture` Boolean - Whether a user gesture was active when this request was triggered.
|
||||||
|
* `callback` Function
|
||||||
|
* `streams` Object
|
||||||
|
* `video` Object | [WebFrameMain](web-frame-main.md) (optional)
|
||||||
|
* `id` String - The id of the stream being granted. This will usually
|
||||||
|
come from a [DesktopCapturerSource](structures/desktop-capturer-source.md)
|
||||||
|
object.
|
||||||
|
* `name` String - The name of the stream being granted. This will
|
||||||
|
usually come from a [DesktopCapturerSource](structures/desktop-capturer-source.md)
|
||||||
|
object.
|
||||||
|
* `audio` String | [WebFrameMain](web-frame-main.md) (optional) - If
|
||||||
|
a string is specified, can be `loopback` or `loopbackWithMute`.
|
||||||
|
Specifying a loopback device will capture system audio, and is
|
||||||
|
currently only supported on Windows. If a WebFrameMain is specified,
|
||||||
|
will capture audio from that frame.
|
||||||
|
|
||||||
|
This handler will be called when web content requests access to display media
|
||||||
|
via the `navigator.mediaDevices.getDisplayMedia` API. Use the
|
||||||
|
[desktopCapturer](desktop-capturer.md) API to choose which stream(s) to grant
|
||||||
|
access to.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const { session, desktopCapturer } = require('electron')
|
||||||
|
|
||||||
|
session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
|
||||||
|
desktopCapturer.getSources({ types: ['screen'] }).then((sources) => {
|
||||||
|
// Grant access to the first screen found.
|
||||||
|
callback({ video: sources[0] })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Passing a [WebFrameMain](web-frame-main.md) object as a video or audio stream
|
||||||
|
will capture the video or audio stream from that frame.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const { session } = require('electron')
|
||||||
|
|
||||||
|
session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
|
||||||
|
// Allow the tab to capture itself.
|
||||||
|
callback({ video: request.frame })
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Passing `null` instead of a function resets the handler to its default state.
|
||||||
|
|
||||||
#### `ses.setDevicePermissionHandler(handler)`
|
#### `ses.setDevicePermissionHandler(handler)`
|
||||||
|
|
||||||
* `handler` Function\<boolean> | null
|
* `handler` Function\<boolean> | null
|
||||||
* `details` Object
|
* `details` Object
|
||||||
* `deviceType` string - The type of device that permission is being requested on, can be `hid` or `serial`.
|
* `deviceType` string - The type of device that permission is being requested on, can be `hid`, `serial`, or `usb`.
|
||||||
* `origin` string - The origin URL of the device permission check.
|
* `origin` string - The origin URL of the device permission check.
|
||||||
* `device` [HIDDevice](structures/hid-device.md) | [SerialPort](structures/serial-port.md)- the device that permission is being requested for.
|
* `device` [HIDDevice](structures/hid-device.md) | [SerialPort](structures/serial-port.md)- the device that permission is being requested for.
|
||||||
* `frame` [WebFrameMain](web-frame-main.md) - WebFrameMain checking the device permission.
|
|
||||||
|
|
||||||
Sets the handler which can be used to respond to device permission checks for the `session`.
|
Sets the handler which can be used to respond to device permission checks for the `session`.
|
||||||
Returning `true` will allow the device to be permitted and `false` will reject it.
|
Returning `true` will allow the device to be permitted and `false` will reject it.
|
||||||
@@ -688,8 +924,8 @@ To clear the handler, call `setDevicePermissionHandler(null)`.
|
|||||||
This handler can be used to provide default permissioning to devices without first calling for permission
|
This handler can be used to provide default permissioning to devices without first calling for permission
|
||||||
to devices (eg via `navigator.hid.requestDevice`). If this handler is not defined, the default device
|
to devices (eg via `navigator.hid.requestDevice`). If this handler is not defined, the default device
|
||||||
permissions as granted through device selection (eg via `navigator.hid.requestDevice`) will be used.
|
permissions as granted through device selection (eg via `navigator.hid.requestDevice`) will be used.
|
||||||
Additionally, the default behavior of Electron is to store granted device permision through the lifetime
|
Additionally, the default behavior of Electron is to store granted device permision in memory.
|
||||||
of the corresponding WebContents. If longer term storage is needed, a developer can store granted device
|
If longer term storage is needed, a developer can store granted device
|
||||||
permissions (eg when handling the `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`.
|
permissions (eg when handling the `select-hid-device` event) and then read from that storage with `setDevicePermissionHandler`.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@@ -706,6 +942,8 @@ app.whenReady().then(() => {
|
|||||||
return true
|
return true
|
||||||
} else if (permission === 'serial') {
|
} else if (permission === 'serial') {
|
||||||
// Add logic here to determine if permission should be given to allow serial port selection
|
// Add logic here to determine if permission should be given to allow serial port selection
|
||||||
|
} else if (permission === 'usb') {
|
||||||
|
// Add logic here to determine if permission should be given to allow USB device selection
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
@@ -745,6 +983,71 @@ app.whenReady().then(() => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### `ses.setBluetoothPairingHandler(handler)` _Windows_ _Linux_
|
||||||
|
|
||||||
|
* `handler` Function | null
|
||||||
|
* `details` Object
|
||||||
|
* `deviceId` string
|
||||||
|
* `pairingKind` string - The type of pairing prompt being requested.
|
||||||
|
One of the following values:
|
||||||
|
* `confirm`
|
||||||
|
This prompt is requesting confirmation that the Bluetooth device should
|
||||||
|
be paired.
|
||||||
|
* `confirmPin`
|
||||||
|
This prompt is requesting confirmation that the provided PIN matches the
|
||||||
|
pin displayed on the device.
|
||||||
|
* `providePin`
|
||||||
|
This prompt is requesting that a pin be provided for the device.
|
||||||
|
* `frame` [WebFrameMain](web-frame-main.md)
|
||||||
|
* `pin` string (optional) - The pin value to verify if `pairingKind` is `confirmPin`.
|
||||||
|
* `callback` Function
|
||||||
|
* `response` Object
|
||||||
|
* `confirmed` boolean - `false` should be passed in if the dialog is canceled.
|
||||||
|
If the `pairingKind` is `confirm` or `confirmPin`, this value should indicate
|
||||||
|
if the pairing is confirmed. If the `pairingKind` is `providePin` the value
|
||||||
|
should be `true` when a value is provided.
|
||||||
|
* `pin` string | null (optional) - When the `pairingKind` is `providePin`
|
||||||
|
this value should be the required pin for the Bluetooth device.
|
||||||
|
|
||||||
|
Sets a handler to respond to Bluetooth pairing requests. This handler
|
||||||
|
allows developers to handle devices that require additional validation
|
||||||
|
before pairing. When a handler is not defined, any pairing on Linux or Windows
|
||||||
|
that requires additional validation will be automatically cancelled.
|
||||||
|
macOS does not require a handler because macOS handles the pairing
|
||||||
|
automatically. To clear the handler, call `setBluetoothPairingHandler(null)`.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
|
||||||
|
const { app, BrowserWindow, ipcMain, session } = require('electron')
|
||||||
|
|
||||||
|
let bluetoothPinCallback = null
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
const mainWindow = new BrowserWindow({
|
||||||
|
webPreferences: {
|
||||||
|
preload: path.join(__dirname, 'preload.js')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Listen for an IPC message from the renderer to get the response for the Bluetooth pairing.
|
||||||
|
ipcMain.on('bluetooth-pairing-response', (event, response) => {
|
||||||
|
bluetoothPinCallback(response)
|
||||||
|
})
|
||||||
|
|
||||||
|
mainWindow.webContents.session.setBluetoothPairingHandler((details, callback) => {
|
||||||
|
bluetoothPinCallback = callback
|
||||||
|
// Send a IPC message to the renderer to prompt the user to confirm the pairing.
|
||||||
|
// Note that this will require logic in the renderer to handle this message and
|
||||||
|
// display a prompt to the user.
|
||||||
|
mainWindow.webContents.send('bluetooth-pairing-request', details)
|
||||||
|
})
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
#### `ses.clearHostResolverCache()`
|
#### `ses.clearHostResolverCache()`
|
||||||
|
|
||||||
Returns `Promise<void>` - Resolves when the operation is complete.
|
Returns `Promise<void>` - Resolves when the operation is complete.
|
||||||
@@ -908,7 +1211,7 @@ Returns `string[]` - An array of language codes the spellchecker is enabled for.
|
|||||||
will fallback to using `en-US`. By default on launch if this setting is an empty list Electron will try to populate this
|
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.
|
setting with the current OS locale. This setting is persisted across restarts.
|
||||||
|
|
||||||
**Note:** On macOS the OS spellchecker is used and has its own list of languages. This API is a no-op on macOS.
|
**Note:** On macOS the OS spellchecker is used and has its own list of languages. On macOS, this API will return whichever languages have been configured by the OS.
|
||||||
|
|
||||||
#### `ses.setSpellCheckerDictionaryDownloadURL(url)`
|
#### `ses.setSpellCheckerDictionaryDownloadURL(url)`
|
||||||
|
|
||||||
@@ -1025,7 +1328,7 @@ is emitted.
|
|||||||
|
|
||||||
#### `ses.getStoragePath()`
|
#### `ses.getStoragePath()`
|
||||||
|
|
||||||
A `string | null` indicating the absolute file system path where data for this
|
Returns `string | null` - The absolute file system path where data for this
|
||||||
session is persisted on disk. For in memory sessions this returns `null`.
|
session is persisted on disk. For in memory sessions this returns `null`.
|
||||||
|
|
||||||
### Instance Properties
|
### Instance Properties
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
* `id` string - The identifier of a window or screen that can be used as a
|
* `id` string - The identifier of a window or screen that can be used as a
|
||||||
`chromeMediaSourceId` constraint when calling
|
`chromeMediaSourceId` constraint when calling
|
||||||
[`navigator.webkitGetUserMedia`]. The format of the identifier will be
|
[`navigator.getUserMedia`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getUserMedia). The format of the identifier will be
|
||||||
`window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle. YY is 1 for
|
`window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle. YY is 1 for
|
||||||
the current process, and 0 for all others. ZZ is a sequential number
|
the current process, and 0 for all others. ZZ is a sequential number
|
||||||
that represents the screen, and it does not equal to the index in the
|
that represents the screen, and it does not equal to the index in the
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Display Object
|
# Display Object
|
||||||
|
|
||||||
* `id` number - Unique identifier associated with the display.
|
* `id` number - Unique identifier associated with the display.
|
||||||
|
* `label` string - User-friendly label, determined by the platform.
|
||||||
* `rotation` number - Can be 0, 90, 180, 270, represents screen rotation in
|
* `rotation` number - Can be 0, 90, 180, 270, represents screen rotation in
|
||||||
clock-wise degrees.
|
clock-wise degrees.
|
||||||
* `scaleFactor` number - Output device's pixel scale factor.
|
* `scaleFactor` number - Output device's pixel scale factor.
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
# InputEvent Object
|
# InputEvent Object
|
||||||
|
|
||||||
|
* `type` string - Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`,
|
||||||
|
`mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`,
|
||||||
|
`keyDown`, `keyUp`, `char`, `gestureScrollBegin`, `gestureScrollEnd`,
|
||||||
|
`gestureScrollUpdate`, `gestureFlingStart`, `gestureFlingCancel`,
|
||||||
|
`gesturePinchBegin`, `gesturePinchEnd`, `gesturePinchUpdate`,
|
||||||
|
`gestureTapDown`, `gestureShowPress`, `gestureTap`, `gestureTapCancel`,
|
||||||
|
`gestureShortPress`, `gestureLongPress`, `gestureLongTap`,
|
||||||
|
`gestureTwoFingerTap`, `gestureTapUnconfirmed`, `gestureDoubleTap`,
|
||||||
|
`touchStart`, `touchMove`, `touchEnd`, `touchCancel`, `touchScrollStarted`,
|
||||||
|
`pointerDown`, `pointerUp`, `pointerMove`, `pointerRawUpdate`,
|
||||||
|
`pointerCancel` or `pointerCausedUaAction`.
|
||||||
* `modifiers` string[] (optional) - An array of modifiers of the event, can
|
* `modifiers` string[] (optional) - An array of modifiers of the event, can
|
||||||
be `shift`, `control`, `ctrl`, `alt`, `meta`, `command`, `cmd`, `isKeypad`,
|
be `shift`, `control`, `ctrl`, `alt`, `meta`, `command`, `cmd`, `isKeypad`,
|
||||||
`isAutoRepeat`, `leftButtonDown`, `middleButtonDown`, `rightButtonDown`,
|
`isAutoRepeat`, `leftButtonDown`, `middleButtonDown`, `rightButtonDown`,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# KeyboardInputEvent Object extends `InputEvent`
|
# KeyboardInputEvent Object extends `InputEvent`
|
||||||
|
|
||||||
* `type` string - The type of the event, can be `keyDown`, `keyUp` or `char`.
|
* `type` string - The type of the event, can be `rawKeyDown`, `keyDown`, `keyUp` or `char`.
|
||||||
* `keyCode` string - The character that will be sent
|
* `keyCode` string - The character that will be sent
|
||||||
as the keyboard event. Should only use the valid key codes in
|
as the keyboard event. Should only use the valid key codes in
|
||||||
[Accelerator](../accelerator.md).
|
[Accelerator](../accelerator.md).
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# NewWindowWebContentsEvent Object extends `Event`
|
|
||||||
|
|
||||||
* `newGuest` BrowserWindow (optional)
|
|
||||||
17
docs/api/structures/usb-device.md
Normal file
17
docs/api/structures/usb-device.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# USBDevice Object
|
||||||
|
|
||||||
|
* `deviceId` string - Unique identifier for the device.
|
||||||
|
* `vendorId` Integer - The USB vendor ID.
|
||||||
|
* `productId` Integer - The USB product ID.
|
||||||
|
* `productName` string (optional) - Name of the device.
|
||||||
|
* `serialNumber` string (optional) - The USB device serial number.
|
||||||
|
* `manufacturerName` string (optional) - The manufacturer name of the device.
|
||||||
|
* `usbVersionMajor` Integer - The USB protocol major version supported by the device
|
||||||
|
* `usbVersionMinor` Integer - The USB protocol minor version supported by the device
|
||||||
|
* `usbVersionSubminor` Integer - The USB protocol subminor version supported by the device
|
||||||
|
* `deviceClass` Integer - The device class for the communication interface supported by the device
|
||||||
|
* `deviceSubclass` Integer - The device subclass for the communication interface supported by the device
|
||||||
|
* `deviceProtocol` Integer - The device protocol for the communication interface supported by the device
|
||||||
|
* `deviceVersionMajor` Integer - The major version number of the device as defined by the device manufacturer.
|
||||||
|
* `deviceVersionMinor` Integer - The minor version number of the device as defined by the device manufacturer.
|
||||||
|
* `deviceVersionSubminor` Integer - The subminor version number of the device as defined by the device manufacturer.
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
# WebRequestFilter Object
|
# WebRequestFilter Object
|
||||||
|
|
||||||
* `urls` string[] - Array of URL patterns that will be used to filter out the requests that do not match the URL patterns.
|
* `urls` string[] - Array of [URL patterns](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns) that will be used to filter out the requests that do not match the URL patterns.
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ that contains the user information dictionary sent along with the notification.
|
|||||||
|
|
||||||
### `systemPreferences.subscribeNotification(event, callback)` _macOS_
|
### `systemPreferences.subscribeNotification(event, callback)` _macOS_
|
||||||
|
|
||||||
* `event` string
|
* `event` string | null
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `event` string
|
* `event` string
|
||||||
* `userInfo` Record<string, unknown>
|
* `userInfo` Record<string, unknown>
|
||||||
@@ -109,9 +109,11 @@ example values of `event` are:
|
|||||||
* `AppleColorPreferencesChangedNotification`
|
* `AppleColorPreferencesChangedNotification`
|
||||||
* `AppleShowScrollBarsSettingChanged`
|
* `AppleShowScrollBarsSettingChanged`
|
||||||
|
|
||||||
|
If `event` is null, the `NSDistributedNotificationCenter` doesn’t use it as criteria for delivery to the observer. See [docs](https://developer.apple.com/documentation/foundation/nsnotificationcenter/1411723-addobserverforname?language=objc) for more information.
|
||||||
|
|
||||||
### `systemPreferences.subscribeLocalNotification(event, callback)` _macOS_
|
### `systemPreferences.subscribeLocalNotification(event, callback)` _macOS_
|
||||||
|
|
||||||
* `event` string
|
* `event` string | null
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `event` string
|
* `event` string
|
||||||
* `userInfo` Record<string, unknown>
|
* `userInfo` Record<string, unknown>
|
||||||
@@ -122,9 +124,11 @@ Returns `number` - The ID of this subscription
|
|||||||
Same as `subscribeNotification`, but uses `NSNotificationCenter` for local defaults.
|
Same as `subscribeNotification`, but uses `NSNotificationCenter` for local defaults.
|
||||||
This is necessary for events such as `NSUserDefaultsDidChangeNotification`.
|
This is necessary for events such as `NSUserDefaultsDidChangeNotification`.
|
||||||
|
|
||||||
|
If `event` is null, the `NSNotificationCenter` doesn’t use it as criteria for delivery to the observer. See [docs](https://developer.apple.com/documentation/foundation/nsnotificationcenter/1411723-addobserverforname?language=objc) for more information.
|
||||||
|
|
||||||
### `systemPreferences.subscribeWorkspaceNotification(event, callback)` _macOS_
|
### `systemPreferences.subscribeWorkspaceNotification(event, callback)` _macOS_
|
||||||
|
|
||||||
* `event` string
|
* `event` string | null
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `event` string
|
* `event` string
|
||||||
* `userInfo` Record<string, unknown>
|
* `userInfo` Record<string, unknown>
|
||||||
@@ -135,6 +139,8 @@ Returns `number` - The ID of this subscription
|
|||||||
Same as `subscribeNotification`, but uses `NSWorkspace.sharedWorkspace.notificationCenter`.
|
Same as `subscribeNotification`, but uses `NSWorkspace.sharedWorkspace.notificationCenter`.
|
||||||
This is necessary for events such as `NSWorkspaceDidActivateApplicationNotification`.
|
This is necessary for events such as `NSWorkspaceDidActivateApplicationNotification`.
|
||||||
|
|
||||||
|
If `event` is null, the `NSWorkspaceNotificationCenter` doesn’t use it as criteria for delivery to the observer. See [docs](https://developer.apple.com/documentation/foundation/nsnotificationcenter/1411723-addobserverforname?language=objc) for more information.
|
||||||
|
|
||||||
### `systemPreferences.unsubscribeNotification(id)` _macOS_
|
### `systemPreferences.unsubscribeNotification(id)` _macOS_
|
||||||
|
|
||||||
* `id` Integer
|
* `id` Integer
|
||||||
@@ -435,7 +441,7 @@ It will always return `granted` for `screen` and for all media types on older ve
|
|||||||
|
|
||||||
Returns `Promise<boolean>` - A promise that resolves with `true` if consent was granted and `false` if it was denied. If an invalid `mediaType` is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it _must_ be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.
|
Returns `Promise<boolean>` - A promise that resolves with `true` if consent was granted and `false` if it was denied. If an invalid `mediaType` is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it _must_ be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.
|
||||||
|
|
||||||
**Important:** In order to properly leverage this API, you [must set](https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc) the `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your app's `Info.plist` file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See [Electron Application Distribution](../tutorial/application-distribution.md#macos) for more information about how to set these in the context of Electron.
|
**Important:** In order to properly leverage this API, you [must set](https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc) the `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your app's `Info.plist` file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See [Electron Application Distribution](../tutorial/application-distribution.md#rebranding-with-downloaded-binaries) for more information about how to set these in the context of Electron.
|
||||||
|
|
||||||
This user consent was not required until macOS 10.14 Mojave, so this method will always return `true` if your system is running 10.13 High Sierra or lower.
|
This user consent was not required until macOS 10.14 Mojave, so this method will always return `true` if your system is running 10.13 High Sierra or lower.
|
||||||
|
|
||||||
|
|||||||
@@ -25,15 +25,18 @@ app.whenReady().then(() => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
__Platform limitations:__
|
__Platform Considerations__
|
||||||
|
|
||||||
* On Linux the app indicator will be used if it is supported, otherwise
|
__Linux__
|
||||||
|
|
||||||
|
* Tray icon uses [StatusNotifierItem](https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/)
|
||||||
|
by default, when it is not available in user's desktop environment the
|
||||||
`GtkStatusIcon` will be used instead.
|
`GtkStatusIcon` will be used instead.
|
||||||
* On Linux distributions that only have app indicator support, you have to
|
* The `click` event is emitted when the tray icon receives activation from
|
||||||
install `libappindicator1` to make the tray icon work.
|
user, however the StatusNotifierItem spec does not specify which action would
|
||||||
* App indicator will only be shown when it has a context menu.
|
cause an activation, for some environments it is left mouse click, but for
|
||||||
* When app indicator is used on Linux, the `click` event is ignored.
|
some it might be double left mouse click.
|
||||||
* On Linux in order for changes made to individual `MenuItem`s to take effect,
|
* In order for changes made to individual `MenuItem`s to take effect,
|
||||||
you have to call `setContextMenu` again. For example:
|
you have to call `setContextMenu` again. For example:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@@ -55,10 +58,16 @@ app.whenReady().then(() => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
* On Windows it is recommended to use `ICO` icons to get best visual effects.
|
__MacOS__
|
||||||
|
|
||||||
If you want to keep exact same behaviors on all platforms, you should not
|
* Icons passed to the Tray constructor should be [Template Images](native-image.md#template-image).
|
||||||
rely on the `click` event and always attach a context menu to the tray icon.
|
* To make sure your icon isn't grainy on retina monitors, be sure your `@2x` image is 144dpi.
|
||||||
|
* If you are bundling your application (e.g., with webpack for development), be sure that the file names are not being mangled or hashed. The filename needs to end in Template, and the `@2x` image needs to have the same filename as the standard image, or MacOS will not magically invert your image's colors or use the high density image.
|
||||||
|
* 16x16 (72dpi) and 32x32@2x (144dpi) work well for most icons.
|
||||||
|
|
||||||
|
__Windows__
|
||||||
|
|
||||||
|
* It is recommended to use `ICO` icons to get best visual effects.
|
||||||
|
|
||||||
### `new Tray(image, [guid])`
|
### `new Tray(image, [guid])`
|
||||||
|
|
||||||
@@ -81,6 +90,9 @@ Returns:
|
|||||||
|
|
||||||
Emitted when the tray icon is clicked.
|
Emitted when the tray icon is clicked.
|
||||||
|
|
||||||
|
Note that on Linux this event is emitted when the tray icon receives an
|
||||||
|
activation, which might not necessarily be left mouse click.
|
||||||
|
|
||||||
#### Event: 'right-click' _macOS_ _Windows_
|
#### Event: 'right-click' _macOS_ _Windows_
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|||||||
138
docs/api/utility-process.md
Normal file
138
docs/api/utility-process.md
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
# utilityProcess
|
||||||
|
|
||||||
|
`utilityProcess` creates a child process with
|
||||||
|
Node.js and Message ports enabled. It provides the equivalent of [`child_process.fork`][] API from Node.js
|
||||||
|
but instead uses [Services API][] from Chromium to launch the child process.
|
||||||
|
|
||||||
|
Process: [Main](../glossary.md#main-process)<br />
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
### `utilityProcess.fork(modulePath[, args][, options])`
|
||||||
|
|
||||||
|
* `modulePath` string - Path to the script that should run as entrypoint in the child process.
|
||||||
|
* `args` string[] (optional) - List of string arguments that will be available as `process.argv`
|
||||||
|
in the child process.
|
||||||
|
* `options` Object (optional)
|
||||||
|
* `env` Object (optional) - Environment key-value pairs. Default is `process.env`.
|
||||||
|
* `execArgv` string[] (optional) - List of string arguments passed to the executable.
|
||||||
|
* `cwd` string (optional) - Current working directory of the child process.
|
||||||
|
* `stdio` (string[] | string) (optional) - Allows configuring the mode for `stdout` and `stderr`
|
||||||
|
of the child process. Default is `inherit`.
|
||||||
|
String value can be one of `pipe`, `ignore`, `inherit`, for more details on these values you can refer to
|
||||||
|
[stdio][] documentation from Node.js. Currently this option only supports configuring `stdout` and
|
||||||
|
`stderr` to either `pipe`, `inherit` or `ignore`. Configuring `stdin` is not supported; `stdin` will
|
||||||
|
always be ignored.
|
||||||
|
For example, the supported values will be processed as following:
|
||||||
|
* `pipe`: equivalent to ['ignore', 'pipe', 'pipe'] (the default)
|
||||||
|
* `ignore`: equivalent to 'ignore', 'ignore', 'ignore']
|
||||||
|
* `inherit`: equivalent to ['ignore', 'inherit', 'inherit']
|
||||||
|
* `serviceName` string (optional) - Name of the process that will appear in `name` property of
|
||||||
|
[`child-process-gone` event of `app`](app.md#event-child-process-gone).
|
||||||
|
Default is `node.mojom.NodeService`.
|
||||||
|
* `allowLoadingUnsignedLibraries` boolean (optional) _macOS_ - With this flag, the utility process will be
|
||||||
|
launched via the `Electron Helper (Plugin).app` helper executable on macOS, which can be
|
||||||
|
codesigned with `com.apple.security.cs.disable-library-validation` and
|
||||||
|
`com.apple.security.cs.allow-unsigned-executable-memory` entitlements. This will allow the utility process
|
||||||
|
to load unsigned libraries. Unless you specifically need this capability, it is best to leave this disabled.
|
||||||
|
Default is `false`.
|
||||||
|
|
||||||
|
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)
|
||||||
|
|
||||||
|
## Class: UtilityProcess
|
||||||
|
|
||||||
|
> Instances of the `UtilityProcess` represent the Chromium spawned child process
|
||||||
|
> with Node.js integration.
|
||||||
|
|
||||||
|
`UtilityProcess` is an [EventEmitter][event-emitter].
|
||||||
|
|
||||||
|
### Instance Methods
|
||||||
|
|
||||||
|
#### `child.postMessage(message, [transfer])`
|
||||||
|
|
||||||
|
* `message` any
|
||||||
|
* `transfer` MessagePortMain[] (optional)
|
||||||
|
|
||||||
|
Send a message to the child process, optionally transferring ownership of
|
||||||
|
zero or more [`MessagePortMain`][] objects.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Main process
|
||||||
|
const { port1, port2 } = new MessageChannelMain()
|
||||||
|
const child = utilityProcess.fork(path.join(__dirname, 'test.js'))
|
||||||
|
child.postMessage({ message: 'hello' }, [port1])
|
||||||
|
|
||||||
|
// Child process
|
||||||
|
process.parentPort.once('message', (e) => {
|
||||||
|
const [port] = e.ports
|
||||||
|
// ...
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `child.kill()`
|
||||||
|
|
||||||
|
Returns `boolean`
|
||||||
|
|
||||||
|
Terminates the process gracefully. On POSIX, it uses SIGTERM
|
||||||
|
but will ensure the process is reaped on exit. This function returns
|
||||||
|
true if the kill is successful, and false otherwise.
|
||||||
|
|
||||||
|
### Instance Properties
|
||||||
|
|
||||||
|
#### `child.pid`
|
||||||
|
|
||||||
|
A `Integer | undefined` representing the process identifier (PID) of the child process.
|
||||||
|
If the child process fails to spawn due to errors, then the value is `undefined`. When
|
||||||
|
the child process exits, then the value is `undefined` after the `exit` event is emitted.
|
||||||
|
|
||||||
|
#### `child.stdout`
|
||||||
|
|
||||||
|
A `NodeJS.ReadableStream | null` that represents the child process's stdout.
|
||||||
|
If the child was spawned with options.stdio[1] set to anything other than 'pipe', then this will be `null`.
|
||||||
|
When the child process exits, then the value is `null` after the `exit` event is emitted.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Main process
|
||||||
|
const { port1, port2 } = new MessageChannelMain()
|
||||||
|
const child = utilityProcess.fork(path.join(__dirname, 'test.js'))
|
||||||
|
child.stdout.on('data', (data) => {
|
||||||
|
console.log(`Received chunk ${data}`)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `child.stderr`
|
||||||
|
|
||||||
|
A `NodeJS.ReadableStream | null` that represents the child process's stderr.
|
||||||
|
If the child was spawned with options.stdio[2] set to anything other than 'pipe', then this will be `null`.
|
||||||
|
When the child process exits, then the value is `null` after the `exit` event is emitted.
|
||||||
|
|
||||||
|
### Instance Events
|
||||||
|
|
||||||
|
#### Event: 'spawn'
|
||||||
|
|
||||||
|
Emitted once the child process has spawned successfully.
|
||||||
|
|
||||||
|
#### Event: 'exit'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `code` number - Contains the exit code for
|
||||||
|
the process obtained from waitpid on posix, or GetExitCodeProcess on windows.
|
||||||
|
|
||||||
|
Emitted after the child process ends.
|
||||||
|
|
||||||
|
#### Event: 'message'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `message` any
|
||||||
|
|
||||||
|
Emitted when the child process sends a message using [`process.parentPort.postMessage()`](process.md#processparentport).
|
||||||
|
|
||||||
|
[`child_process.fork`]: https://nodejs.org/dist/latest-v16.x/docs/api/child_process.html#child_processforkmodulepath-args-options
|
||||||
|
[Services API]: https://chromium.googlesource.com/chromium/src/+/main/docs/mojo_and_services.md
|
||||||
|
[stdio]: https://nodejs.org/dist/latest/docs/api/child_process.html#optionsstdio
|
||||||
|
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||||
|
[`MessagePortMain`]: message-port-main.md
|
||||||
@@ -45,6 +45,13 @@ returns `null`.
|
|||||||
Returns `WebContents` | undefined - A WebContents instance with the given ID, or
|
Returns `WebContents` | undefined - A WebContents instance with the given ID, or
|
||||||
`undefined` if there is no WebContents associated with the given ID.
|
`undefined` if there is no WebContents associated with the given ID.
|
||||||
|
|
||||||
|
### `webContents.fromFrame(frame)`
|
||||||
|
|
||||||
|
* `frame` WebFrameMain
|
||||||
|
|
||||||
|
Returns `WebContents` | undefined - A WebContents instance with the given WebFrameMain, or
|
||||||
|
`undefined` if there is no WebContents associated with the given WebFrameMain.
|
||||||
|
|
||||||
### `webContents.fromDevToolsTargetId(targetId)`
|
### `webContents.fromDevToolsTargetId(targetId)`
|
||||||
|
|
||||||
* `targetId` string - The Chrome DevTools Protocol [TargetID](https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID) associated with the WebContents instance.
|
* `targetId` string - The Chrome DevTools Protocol [TargetID](https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID) associated with the WebContents instance.
|
||||||
@@ -130,10 +137,6 @@ Corresponds to the points in time when the spinner of the tab stopped spinning.
|
|||||||
|
|
||||||
#### Event: 'dom-ready'
|
#### Event: 'dom-ready'
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
* `event` Event
|
|
||||||
|
|
||||||
Emitted when the document in the top-level frame is loaded.
|
Emitted when the document in the top-level frame is loaded.
|
||||||
|
|
||||||
#### Event: 'page-title-updated'
|
#### Event: 'page-title-updated'
|
||||||
@@ -156,63 +159,17 @@ Returns:
|
|||||||
|
|
||||||
Emitted when page receives favicon urls.
|
Emitted when page receives favicon urls.
|
||||||
|
|
||||||
#### Event: 'new-window' _Deprecated_
|
#### Event: 'content-bounds-updated'
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
* `event` NewWindowWebContentsEvent
|
* `event` Event
|
||||||
* `url` string
|
* `bounds` [Rectangle](structures/rectangle.md) - requested new content bounds
|
||||||
* `frameName` string
|
|
||||||
* `disposition` string - Can be `default`, `foreground-tab`, `background-tab`,
|
|
||||||
`new-window`, `save-to-disk` and `other`.
|
|
||||||
* `options` BrowserWindowConstructorOptions - The options which will be used for creating the new
|
|
||||||
[`BrowserWindow`](browser-window.md).
|
|
||||||
* `additionalFeatures` string[] - The non-standard features (features not handled
|
|
||||||
by Chromium or Electron) given to `window.open()`. Deprecated, and will now
|
|
||||||
always be the empty array `[]`.
|
|
||||||
* `referrer` [Referrer](structures/referrer.md) - The referrer that will be
|
|
||||||
passed to the new window. May or may not result in the `Referer` header being
|
|
||||||
sent, depending on the referrer policy.
|
|
||||||
* `postBody` [PostBody](structures/post-body.md) (optional) - The post data that
|
|
||||||
will be sent to the new window, along with the appropriate headers that will
|
|
||||||
be set. If no post data is to be sent, the value will be `null`. Only defined
|
|
||||||
when the window is being created by a form that set `target=_blank`.
|
|
||||||
|
|
||||||
Deprecated in favor of [`webContents.setWindowOpenHandler`](web-contents.md#contentssetwindowopenhandlerhandler).
|
Emitted when the page calls `window.moveTo`, `window.resizeTo` or related APIs.
|
||||||
|
|
||||||
Emitted when the page requests to open a new window for a `url`. It could be
|
By default, this will move the window. To prevent that behavior, call
|
||||||
requested by `window.open` or an external link like `<a target='_blank'>`.
|
`event.preventDefault()`.
|
||||||
|
|
||||||
By default a new `BrowserWindow` will be created for the `url`.
|
|
||||||
|
|
||||||
Calling `event.preventDefault()` will prevent Electron from automatically creating a
|
|
||||||
new [`BrowserWindow`](browser-window.md). If you call `event.preventDefault()` and manually create a new
|
|
||||||
[`BrowserWindow`](browser-window.md) then you must set `event.newGuest` to reference the new [`BrowserWindow`](browser-window.md)
|
|
||||||
instance, failing to do so may result in unexpected behavior. For example:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
myBrowserWindow.webContents.on('new-window', (event, url, frameName, disposition, options, additionalFeatures, referrer, postBody) => {
|
|
||||||
event.preventDefault()
|
|
||||||
const win = new BrowserWindow({
|
|
||||||
webContents: options.webContents, // use existing webContents if provided
|
|
||||||
show: false
|
|
||||||
})
|
|
||||||
win.once('ready-to-show', () => win.show())
|
|
||||||
if (!options.webContents) {
|
|
||||||
const loadOptions = {
|
|
||||||
httpReferrer: referrer
|
|
||||||
}
|
|
||||||
if (postBody != null) {
|
|
||||||
const { data, contentType, boundary } = postBody
|
|
||||||
loadOptions.postData = postBody.data
|
|
||||||
loadOptions.extraHeaders = `content-type: ${contentType}; boundary=${boundary}`
|
|
||||||
}
|
|
||||||
|
|
||||||
win.loadURL(url, loadOptions) // existing webContents will be navigated automatically
|
|
||||||
}
|
|
||||||
event.newGuest = win
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Event: 'did-create-window'
|
#### Event: 'did-create-window'
|
||||||
|
|
||||||
@@ -454,6 +411,16 @@ Emitted when a plugin process has crashed.
|
|||||||
|
|
||||||
Emitted when `webContents` is destroyed.
|
Emitted when `webContents` is destroyed.
|
||||||
|
|
||||||
|
#### Event: 'input-event'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `inputEvent` [InputEvent](structures/input-event.md)
|
||||||
|
|
||||||
|
Emitted when an input event is sent to the WebContents. See
|
||||||
|
[InputEvent](structures/input-event.md) for details.
|
||||||
|
|
||||||
#### Event: 'before-input-event'
|
#### Event: 'before-input-event'
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -862,6 +829,8 @@ Returns:
|
|||||||
|
|
||||||
Emitted when the renderer process sends an asynchronous message via `ipcRenderer.send()`.
|
Emitted when the renderer process sends an asynchronous message via `ipcRenderer.send()`.
|
||||||
|
|
||||||
|
See also [`webContents.ipc`](#contentsipc-readonly), which provides an [`IpcMain`](ipc-main.md)-like interface for responding to IPC messages specifically from this WebContents.
|
||||||
|
|
||||||
#### Event: 'ipc-message-sync'
|
#### Event: 'ipc-message-sync'
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -872,6 +841,8 @@ Returns:
|
|||||||
|
|
||||||
Emitted when the renderer process sends a synchronous message via `ipcRenderer.sendSync()`.
|
Emitted when the renderer process sends a synchronous message via `ipcRenderer.sendSync()`.
|
||||||
|
|
||||||
|
See also [`webContents.ipc`](#contentsipc-readonly), which provides an [`IpcMain`](ipc-main.md)-like interface for responding to IPC messages specifically from this WebContents.
|
||||||
|
|
||||||
#### Event: 'preferred-size-changed'
|
#### Event: 'preferred-size-changed'
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -980,6 +951,21 @@ Returns `string` - The title of the current web page.
|
|||||||
|
|
||||||
Returns `boolean` - Whether the web page is destroyed.
|
Returns `boolean` - Whether the web page is destroyed.
|
||||||
|
|
||||||
|
#### `contents.close([opts])`
|
||||||
|
|
||||||
|
* `opts` Object (optional)
|
||||||
|
* `waitForBeforeUnload` boolean - if true, fire the `beforeunload` event
|
||||||
|
before closing the page. If the page prevents the unload, the WebContents
|
||||||
|
will not be closed. The [`will-prevent-unload`](#event-will-prevent-unload)
|
||||||
|
will be fired if the page requests prevention of unload.
|
||||||
|
|
||||||
|
Closes the page, as if the web content had called `window.close()`.
|
||||||
|
|
||||||
|
If the page is successfully closed (i.e. the unload is not prevented by the
|
||||||
|
page, or `waitForBeforeUnload` is false or unspecified), the WebContents will
|
||||||
|
be destroyed and no longer usable. The [`destroyed`](#event-destroyed) event
|
||||||
|
will be emitted.
|
||||||
|
|
||||||
#### `contents.focus()`
|
#### `contents.focus()`
|
||||||
|
|
||||||
Focuses the web page.
|
Focuses the web page.
|
||||||
@@ -1169,7 +1155,7 @@ Ignore application menu shortcuts while this web contents is focused.
|
|||||||
|
|
||||||
#### `contents.setWindowOpenHandler(handler)`
|
#### `contents.setWindowOpenHandler(handler)`
|
||||||
|
|
||||||
* `handler` Function<{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}>
|
* `handler` Function<{action: 'deny'} | {action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}>
|
||||||
* `details` Object
|
* `details` Object
|
||||||
* `url` string - The _resolved_ version of the URL passed to `window.open()`. e.g. opening a window with `window.open('foo')` will yield something like `https://the-origin/the/current/path/foo`.
|
* `url` string - The _resolved_ version of the URL passed to `window.open()`. e.g. opening a window with `window.open('foo')` will yield something like `https://the-origin/the/current/path/foo`.
|
||||||
* `frameName` string - Name of the window provided in `window.open()`
|
* `frameName` string - Name of the window provided in `window.open()`
|
||||||
@@ -1184,8 +1170,11 @@ Ignore application menu shortcuts while this web contents is focused.
|
|||||||
be set. If no post data is to be sent, the value will be `null`. Only defined
|
be set. If no post data is to be sent, the value will be `null`. Only defined
|
||||||
when the window is being created by a form that set `target=_blank`.
|
when the window is being created by a form that set `target=_blank`.
|
||||||
|
|
||||||
Returns `{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}` - `deny` cancels the creation of the new
|
Returns `{action: 'deny'} | {action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}` - `deny` cancels the creation of the new
|
||||||
window. `allow` will allow the new window to be created. Specifying `overrideBrowserWindowOptions` allows customization of the created window.
|
window. `allow` will allow the new window to be created. Specifying `overrideBrowserWindowOptions` allows customization of the created window.
|
||||||
|
By default, child windows are closed when their opener is closed. This can be
|
||||||
|
changed by specifying `outlivesOpener: true`, in which case the opened window
|
||||||
|
will not be closed when its opener is closed.
|
||||||
Returning an unrecognized value such as a null, undefined, or an object
|
Returning an unrecognized value such as a null, undefined, or an object
|
||||||
without a recognized 'action' value will result in a console error and have
|
without a recognized 'action' value will result in a console error and have
|
||||||
the same effect as returning `{action: 'deny'}`.
|
the same effect as returning `{action: 'deny'}`.
|
||||||
@@ -1352,39 +1341,24 @@ const requestId = webContents.findInPage('api')
|
|||||||
console.log(requestId)
|
console.log(requestId)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `contents.capturePage([rect])`
|
#### `contents.capturePage([rect, opts])`
|
||||||
|
|
||||||
* `rect` [Rectangle](structures/rectangle.md) (optional) - The area of the page to be captured.
|
* `rect` [Rectangle](structures/rectangle.md) (optional) - The area of the page to be captured.
|
||||||
|
* `opts` Object (optional)
|
||||||
|
* `stayHidden` boolean (optional) - Keep the page hidden instead of visible. Default is `false`.
|
||||||
|
* `stayAwake` boolean (optional) - Keep the system awake instead of allowing it to sleep. Default is `false`.
|
||||||
|
|
||||||
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
|
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
|
||||||
|
|
||||||
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.
|
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.
|
||||||
|
The page is considered visible when its browser window is hidden and the capturer count is non-zero.
|
||||||
|
If you would like the page to stay hidden, you should ensure that `stayHidden` is set to true.
|
||||||
|
|
||||||
#### `contents.isBeingCaptured()`
|
#### `contents.isBeingCaptured()`
|
||||||
|
|
||||||
Returns `boolean` - Whether this page is being captured. It returns true when the capturer count
|
Returns `boolean` - Whether this page is being captured. It returns true when the capturer count
|
||||||
is large then 0.
|
is large then 0.
|
||||||
|
|
||||||
#### `contents.incrementCapturerCount([size, stayHidden, stayAwake])`
|
|
||||||
|
|
||||||
* `size` [Size](structures/size.md) (optional) - The preferred size for the capturer.
|
|
||||||
* `stayHidden` boolean (optional) - Keep the page hidden instead of visible.
|
|
||||||
* `stayAwake` boolean (optional) - Keep the system awake instead of allowing it to sleep.
|
|
||||||
|
|
||||||
Increase the capturer count by one. The page is considered visible when its browser window is
|
|
||||||
hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that `stayHidden` is set to true.
|
|
||||||
|
|
||||||
This also affects the Page Visibility API.
|
|
||||||
|
|
||||||
#### `contents.decrementCapturerCount([stayHidden, stayAwake])`
|
|
||||||
|
|
||||||
* `stayHidden` boolean (optional) - Keep the page in hidden state instead of visible.
|
|
||||||
* `stayAwake` boolean (optional) - Keep the system awake instead of allowing it to sleep.
|
|
||||||
|
|
||||||
Decrease the capturer count by one. The page will be set to hidden or occluded state when its
|
|
||||||
browser window is hidden or occluded and the capturer count reaches zero. If you want to
|
|
||||||
decrease the hidden capturer count instead you should set `stayHidden` to true.
|
|
||||||
|
|
||||||
#### `contents.getPrinters()` _Deprecated_
|
#### `contents.getPrinters()` _Deprecated_
|
||||||
|
|
||||||
Get the system printer list.
|
Get the system printer list.
|
||||||
@@ -1427,8 +1401,8 @@ Returns `Promise<PrinterInfo[]>` - Resolves with a [`PrinterInfo[]`](structures/
|
|||||||
* `vertical` number (optional) - The vertical dpi.
|
* `vertical` number (optional) - The vertical dpi.
|
||||||
* `header` string (optional) - string to be printed as page header.
|
* `header` string (optional) - string to be printed as page header.
|
||||||
* `footer` string (optional) - string to be printed as page footer.
|
* `footer` string (optional) - string to be printed as page footer.
|
||||||
* `pageSize` string | Size (optional) - Specify page size of the printed document. Can be `A3`,
|
* `pageSize` string | Size (optional) - Specify page size of the printed document. Can be `A0`, `A1`, `A2`, `A3`,
|
||||||
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`.
|
`A4`, `A5`, `A6`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and `width`.
|
||||||
* `callback` Function (optional)
|
* `callback` Function (optional)
|
||||||
* `success` boolean - Indicates success of the print call.
|
* `success` boolean - Indicates success of the print call.
|
||||||
* `failureReason` string - Error description called back if the print fails.
|
* `failureReason` string - Error description called back if the print fails.
|
||||||
@@ -1459,43 +1433,28 @@ win.webContents.print(options, (success, errorType) => {
|
|||||||
#### `contents.printToPDF(options)`
|
#### `contents.printToPDF(options)`
|
||||||
|
|
||||||
* `options` Object
|
* `options` Object
|
||||||
* `headerFooter` Record<string, string> (optional) - the header and footer for the PDF.
|
* `landscape` boolean (optional) - Paper orientation.`true` for landscape, `false` for portrait. Defaults to false.
|
||||||
* `title` string - The title for the PDF header.
|
* `displayHeaderFooter` boolean (optional) - Whether to display header and footer. Defaults to false.
|
||||||
* `url` string - the url for the PDF footer.
|
* `printBackground` boolean (optional) - Whether to print background graphics. Defaults to false.
|
||||||
* `landscape` boolean (optional) - `true` for landscape, `false` for portrait.
|
* `scale` number(optional) - Scale of the webpage rendering. Defaults to 1.
|
||||||
* `marginsType` Integer (optional) - Specifies the type of margins to use. Uses 0 for
|
* `pageSize` string | Size (optional) - Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`,
|
||||||
default margin, 1 for no margin, and 2 for minimum margin.
|
`A4`, `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing `height` and `width` in inches. Defaults to `Letter`.
|
||||||
* `scaleFactor` number (optional) - The scale factor of the web page. Can range from 0 to 100.
|
* `margins` Object (optional)
|
||||||
* `pageRanges` Record<string, number> (optional) - The page range to print.
|
* `top` number (optional) - Top margin in inches. Defaults to 1cm (~0.4 inches).
|
||||||
* `from` number - Index of the first page to print (0-based).
|
* `bottom` number (optional) - Bottom margin in inches. Defaults to 1cm (~0.4 inches).
|
||||||
* `to` number - Index of the last page to print (inclusive) (0-based).
|
* `left` number (optional) - Left margin in inches. Defaults to 1cm (~0.4 inches).
|
||||||
* `pageSize` string | Size (optional) - Specify page size of the generated PDF. Can be `A3`,
|
* `right` number (optional) - Right margin in inches. Defaults to 1cm (~0.4 inches).
|
||||||
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and `width` in microns.
|
* `pageRanges` string (optional) - Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
|
||||||
* `printBackground` boolean (optional) - Whether to print CSS backgrounds.
|
* `headerTemplate` string (optional) - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: `date` (formatted print date), `title` (document title), `url` (document location), `pageNumber` (current page number) and `totalPages` (total pages in the document). For example, `<span class=title></span>` would generate span containing the title.
|
||||||
* `printSelectionOnly` boolean (optional) - Whether to print selection only.
|
* `footerTemplate` string (optional) - HTML template for the print footer. Should use the same format as the `headerTemplate`.
|
||||||
|
* `preferCSSPageSize` boolean (optional) - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.
|
||||||
|
|
||||||
Returns `Promise<Buffer>` - Resolves with the generated PDF data.
|
Returns `Promise<Buffer>` - Resolves with the generated PDF data.
|
||||||
|
|
||||||
Prints window's web page as PDF with Chromium's preview printing custom
|
Prints the window's web page as PDF.
|
||||||
settings.
|
|
||||||
|
|
||||||
The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
|
The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
|
||||||
|
|
||||||
By default, an empty `options` will be regarded as:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
{
|
|
||||||
marginsType: 0,
|
|
||||||
printBackground: false,
|
|
||||||
printSelectionOnly: false,
|
|
||||||
landscape: false,
|
|
||||||
pageSize: 'A4',
|
|
||||||
scaleFactor: 100
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Use `page-break-before: always;` CSS style to force to print to a new page.
|
|
||||||
|
|
||||||
An example of `webContents.printToPDF`:
|
An example of `webContents.printToPDF`:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@@ -1504,7 +1463,7 @@ const fs = require('fs')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
|
|
||||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
const win = new BrowserWindow()
|
||||||
win.loadURL('http://github.com')
|
win.loadURL('http://github.com')
|
||||||
|
|
||||||
win.webContents.on('did-finish-load', () => {
|
win.webContents.on('did-finish-load', () => {
|
||||||
@@ -1521,6 +1480,8 @@ win.webContents.on('did-finish-load', () => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
See [Page.printToPdf](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF) for more information.
|
||||||
|
|
||||||
#### `contents.addWorkSpace(path)`
|
#### `contents.addWorkSpace(path)`
|
||||||
|
|
||||||
* `path` string
|
* `path` string
|
||||||
@@ -1635,6 +1596,8 @@ Opens the devtools.
|
|||||||
When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
|
When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
|
||||||
explicitly passing an empty `mode` can force using last used dock state.
|
explicitly passing an empty `mode` can force using last used dock state.
|
||||||
|
|
||||||
|
On Windows, if Windows Control Overlay is enabled, Devtools will be opened with `mode: 'detach'`.
|
||||||
|
|
||||||
#### `contents.closeDevTools()`
|
#### `contents.closeDevTools()`
|
||||||
|
|
||||||
Closes the devtools.
|
Closes the devtools.
|
||||||
@@ -1998,6 +1961,35 @@ This corresponds to the [animationPolicy][] accessibility feature in Chromium.
|
|||||||
|
|
||||||
### Instance Properties
|
### Instance Properties
|
||||||
|
|
||||||
|
#### `contents.ipc` _Readonly_
|
||||||
|
|
||||||
|
An [`IpcMain`](ipc-main.md) scoped to just IPC messages sent from this
|
||||||
|
WebContents.
|
||||||
|
|
||||||
|
IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
|
||||||
|
`ipcRenderer.postMessage` will be delivered in the following order:
|
||||||
|
|
||||||
|
1. `contents.on('ipc-message')`
|
||||||
|
2. `contents.mainFrame.on(channel)`
|
||||||
|
3. `contents.ipc.on(channel)`
|
||||||
|
4. `ipcMain.on(channel)`
|
||||||
|
|
||||||
|
Handlers registered with `invoke` will be checked in the following order. The
|
||||||
|
first one that is defined will be called, the rest will be ignored.
|
||||||
|
|
||||||
|
1. `contents.mainFrame.handle(channel)`
|
||||||
|
2. `contents.handle(channel)`
|
||||||
|
3. `ipcMain.handle(channel)`
|
||||||
|
|
||||||
|
A handler or event listener registered on the WebContents will receive IPC
|
||||||
|
messages sent from any frame, including child frames. In most cases, only the
|
||||||
|
main frame can send IPC messages. However, if the `nodeIntegrationInSubFrames`
|
||||||
|
option is enabled, it is possible for child frames to send IPC messages also.
|
||||||
|
In that case, handlers should check the `senderFrame` property of the IPC event
|
||||||
|
to ensure that the message is coming from the expected frame. Alternatively,
|
||||||
|
register handlers on the appropriate frame directly using the
|
||||||
|
[`WebFrameMain.ipc`](web-frame-main.md#frameipc-readonly) interface.
|
||||||
|
|
||||||
#### `contents.audioMuted`
|
#### `contents.audioMuted`
|
||||||
|
|
||||||
A `boolean` property that determines whether this page is muted.
|
A `boolean` property that determines whether this page is muted.
|
||||||
@@ -2057,7 +2049,13 @@ when the page becomes backgrounded. This also affects the Page Visibility API.
|
|||||||
|
|
||||||
A [`WebFrameMain`](web-frame-main.md) property that represents the top frame of the page's frame hierarchy.
|
A [`WebFrameMain`](web-frame-main.md) property that represents the top frame of the page's frame hierarchy.
|
||||||
|
|
||||||
|
#### `contents.opener` _Readonly_
|
||||||
|
|
||||||
|
A [`WebFrameMain`](web-frame-main.md) property that represents the frame that opened this WebContents, either
|
||||||
|
with open(), or by navigating a link with a target attribute.
|
||||||
|
|
||||||
[keyboardevent]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
|
[keyboardevent]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
|
||||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
[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
|
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||||
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||||
|
[`MessagePortMain`]: message-port-main.md
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ win.loadURL('https://twitter.com')
|
|||||||
|
|
||||||
win.webContents.on(
|
win.webContents.on(
|
||||||
'did-frame-navigate',
|
'did-frame-navigate',
|
||||||
(event, url, isMainFrame, frameProcessId, frameRoutingId) => {
|
(event, url, httpResponseCode, httpStatusText, isMainFrame, frameProcessId, frameRoutingId) => {
|
||||||
const frame = webFrameMain.fromId(frameProcessId, frameRoutingId)
|
const frame = webFrameMain.fromId(frameProcessId, frameRoutingId)
|
||||||
if (frame) {
|
if (frame) {
|
||||||
const code = 'document.body.innerHTML = document.body.innerHTML.replaceAll("heck", "h*ck")'
|
const code = 'document.body.innerHTML = document.body.innerHTML.replaceAll("heck", "h*ck")'
|
||||||
@@ -140,10 +140,45 @@ ipcRenderer.on('port', (e, msg) => {
|
|||||||
|
|
||||||
### Instance Properties
|
### Instance Properties
|
||||||
|
|
||||||
|
#### `frame.ipc` _Readonly_
|
||||||
|
|
||||||
|
An [`IpcMain`](ipc-main.md) instance scoped to the frame.
|
||||||
|
|
||||||
|
IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
|
||||||
|
`ipcRenderer.postMessage` will be delivered in the following order:
|
||||||
|
|
||||||
|
1. `contents.on('ipc-message')`
|
||||||
|
2. `contents.mainFrame.on(channel)`
|
||||||
|
3. `contents.ipc.on(channel)`
|
||||||
|
4. `ipcMain.on(channel)`
|
||||||
|
|
||||||
|
Handlers registered with `invoke` will be checked in the following order. The
|
||||||
|
first one that is defined will be called, the rest will be ignored.
|
||||||
|
|
||||||
|
1. `contents.mainFrame.handle(channel)`
|
||||||
|
2. `contents.handle(channel)`
|
||||||
|
3. `ipcMain.handle(channel)`
|
||||||
|
|
||||||
|
In most cases, only the main frame of a WebContents can send or receive IPC
|
||||||
|
messages. However, if the `nodeIntegrationInSubFrames` option is enabled, it is
|
||||||
|
possible for child frames to send and receive IPC messages also. The
|
||||||
|
[`WebContents.ipc`](web-contents.md#contentsipc-readonly) interface may be more
|
||||||
|
convenient when `nodeIntegrationInSubFrames` is not enabled.
|
||||||
|
|
||||||
#### `frame.url` _Readonly_
|
#### `frame.url` _Readonly_
|
||||||
|
|
||||||
A `string` representing the current URL of the frame.
|
A `string` representing the current URL of the frame.
|
||||||
|
|
||||||
|
#### `frame.origin` _Readonly_
|
||||||
|
|
||||||
|
A `string` representing the current origin of the frame, serialized according
|
||||||
|
to [RFC 6454](https://www.rfc-editor.org/rfc/rfc6454). This may be different
|
||||||
|
from the URL. For instance, if the frame is a child window opened to
|
||||||
|
`about:blank`, then `frame.origin` will return the parent frame's origin, while
|
||||||
|
`frame.url` will return the empty string. Pages without a scheme/host/port
|
||||||
|
triple origin will have the serialized origin of `"null"` (that is, the string
|
||||||
|
containing the letters n, u, l, l).
|
||||||
|
|
||||||
#### `frame.top` _Readonly_
|
#### `frame.top` _Readonly_
|
||||||
|
|
||||||
A `WebFrameMain | null` representing top frame in the frame hierarchy to which `frame`
|
A `WebFrameMain | null` representing top frame in the frame hierarchy to which `frame`
|
||||||
@@ -198,3 +233,4 @@ See also how the [Page Visibility API](browser-window.md#page-visibility) is aff
|
|||||||
|
|
||||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||||
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||||
|
[`MessagePortMain`]: message-port-main.md
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const { session } = require('electron')
|
|||||||
|
|
||||||
// Modify the user agent for all requests to the following urls.
|
// Modify the user agent for all requests to the following urls.
|
||||||
const filter = {
|
const filter = {
|
||||||
urls: ['https://*.github.com/*', '*://electron.github.io']
|
urls: ['https://*.github.com/*', '*://electron.github.io/*']
|
||||||
}
|
}
|
||||||
|
|
||||||
session.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {
|
session.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {
|
||||||
|
|||||||
@@ -556,7 +556,7 @@ Stops any `findInPage` request for the `webview` with the provided `action`.
|
|||||||
* `header` string (optional) - string to be printed as page header.
|
* `header` string (optional) - string to be printed as page header.
|
||||||
* `footer` string (optional) - string to be printed as page footer.
|
* `footer` string (optional) - string to be printed as page footer.
|
||||||
* `pageSize` string | Size (optional) - Specify page size of the printed document. Can be `A3`,
|
* `pageSize` string | Size (optional) - Specify page size of the printed document. Can be `A3`,
|
||||||
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`.
|
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` in microns.
|
||||||
|
|
||||||
Returns `Promise<void>`
|
Returns `Promise<void>`
|
||||||
|
|
||||||
@@ -565,21 +565,21 @@ Prints `webview`'s web page. Same as `webContents.print([options])`.
|
|||||||
### `<webview>.printToPDF(options)`
|
### `<webview>.printToPDF(options)`
|
||||||
|
|
||||||
* `options` Object
|
* `options` Object
|
||||||
* `headerFooter` Record<string, string> (optional) - the header and footer for the PDF.
|
* `landscape` boolean (optional) - Paper orientation.`true` for landscape, `false` for portrait. Defaults to false.
|
||||||
* `title` string - The title for the PDF header.
|
* `displayHeaderFooter` boolean (optional) - Whether to display header and footer. Defaults to false.
|
||||||
* `url` string - the url for the PDF footer.
|
* `printBackground` boolean (optional) - Whether to print background graphics. Defaults to false.
|
||||||
* `landscape` boolean (optional) - `true` for landscape, `false` for portrait.
|
* `scale` number(optional) - Scale of the webpage rendering. Defaults to 1.
|
||||||
* `marginsType` Integer (optional) - Specifies the type of margins to use. Uses 0 for
|
* `pageSize` string | Size (optional) - Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`,
|
||||||
default margin, 1 for no margin, and 2 for minimum margin.
|
`A4`, `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing `height` and `width` in inches. Defaults to `Letter`.
|
||||||
and `width` in microns.
|
* `margins` Object (optional)
|
||||||
* `scaleFactor` number (optional) - The scale factor of the web page. Can range from 0 to 100.
|
* `top` number (optional) - Top margin in inches. Defaults to 1cm (~0.4 inches).
|
||||||
* `pageRanges` Record<string, number> (optional) - The page range to print. On macOS, only the first range is honored.
|
* `bottom` number (optional) - Bottom margin in inches. Defaults to 1cm (~0.4 inches).
|
||||||
* `from` number - Index of the first page to print (0-based).
|
* `left` number (optional) - Left margin in inches. Defaults to 1cm (~0.4 inches).
|
||||||
* `to` number - Index of the last page to print (inclusive) (0-based).
|
* `right` number (optional) - Right margin in inches. Defaults to 1cm (~0.4 inches).
|
||||||
* `pageSize` string | Size (optional) - Specify page size of the generated PDF. Can be `A3`,
|
* `pageRanges` string (optional) - Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
|
||||||
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`
|
* `headerTemplate` string (optional) - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: `date` (formatted print date), `title` (document title), `url` (document location), `pageNumber` (current page number) and `totalPages` (total pages in the document). For example, `<span class=title></span>` would generate span containing the title.
|
||||||
* `printBackground` boolean (optional) - Whether to print CSS backgrounds.
|
* `footerTemplate` string (optional) - HTML template for the print footer. Should use the same format as the `headerTemplate`.
|
||||||
* `printSelectionOnly` boolean (optional) - Whether to print selection only.
|
* `preferCSSPageSize` boolean (optional) - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.
|
||||||
|
|
||||||
Returns `Promise<Uint8Array>` - Resolves with the generated PDF data.
|
Returns `Promise<Uint8Array>` - Resolves with the generated PDF data.
|
||||||
|
|
||||||
@@ -805,33 +805,6 @@ const requestId = webview.findInPage('test')
|
|||||||
console.log(requestId)
|
console.log(requestId)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Event: 'new-window'
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
* `url` string
|
|
||||||
* `frameName` string
|
|
||||||
* `disposition` string - Can be `default`, `foreground-tab`, `background-tab`,
|
|
||||||
`new-window`, `save-to-disk` and `other`.
|
|
||||||
* `options` BrowserWindowConstructorOptions - The options which should be used for creating the new
|
|
||||||
[`BrowserWindow`](browser-window.md).
|
|
||||||
|
|
||||||
Fired when the guest page attempts to open a new browser window.
|
|
||||||
|
|
||||||
The following example code opens the new url in system's default browser.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
const { shell } = require('electron')
|
|
||||||
const webview = document.querySelector('webview')
|
|
||||||
|
|
||||||
webview.addEventListener('new-window', async (e) => {
|
|
||||||
const protocol = (new URL(e.url)).protocol
|
|
||||||
if (protocol === 'http:' || protocol === 'https:') {
|
|
||||||
await shell.openExternal(e.url)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
### Event: 'will-navigate'
|
### Event: 'will-navigate'
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -1020,7 +993,7 @@ Emitted when DevTools is closed.
|
|||||||
|
|
||||||
Emitted when DevTools is focused / opened.
|
Emitted when DevTools is focused / opened.
|
||||||
|
|
||||||
[runtime-enabled-features]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70
|
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||||
[chrome-webview]: https://developer.chrome.com/docs/extensions/reference/webviewTag/
|
[chrome-webview]: https://developer.chrome.com/docs/extensions/reference/webviewTag/
|
||||||
|
|
||||||
### Event: 'context-menu'
|
### Event: 'context-menu'
|
||||||
|
|||||||
@@ -12,6 +12,228 @@ This document uses the following convention to categorize breaking changes:
|
|||||||
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
|
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
|
||||||
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
|
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
|
||||||
|
|
||||||
|
## Planned Breaking API Changes (23.0)
|
||||||
|
|
||||||
|
### Removed: Windows 7 / 8 / 8.1 support
|
||||||
|
|
||||||
|
[Windows 7, Windows 8, and Windows 8.1 are no longer supported](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice). Electron follows the planned Chromium deprecation policy, which will [deprecate Windows 7 support beginning in Chromium 109](https://support.google.com/chrome/thread/185534985/sunsetting-support-for-windows-7-8-8-1-in-early-2023?hl=en).
|
||||||
|
|
||||||
|
Older versions of Electron will continue to run on these operating systems, but Windows 10 or later will be required to run Electron v23.0.0 and higher.
|
||||||
|
|
||||||
|
### Removed: BrowserWindow `scroll-touch-*` events
|
||||||
|
|
||||||
|
The deprecated `scroll-touch-begin`, `scroll-touch-end` and `scroll-touch-edge`
|
||||||
|
events on BrowserWindow have been removed. Instead, use the newly available
|
||||||
|
[`input-event` event](api/web-contents.md#event-input-event) on WebContents.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Removed in Electron 23.0
|
||||||
|
win.on('scroll-touch-begin', scrollTouchBegin)
|
||||||
|
win.on('scroll-touch-edge', scrollTouchEdge)
|
||||||
|
win.on('scroll-touch-end', scrollTouchEnd)
|
||||||
|
|
||||||
|
// Replace with
|
||||||
|
win.webContents.on('input-event', (_, event) => {
|
||||||
|
if (event.type === 'gestureScrollBegin') {
|
||||||
|
scrollTouchBegin()
|
||||||
|
} else if (event.type === 'gestureScrollUpdate') {
|
||||||
|
scrollTouchEdge()
|
||||||
|
} else if (event.type === 'gestureScrollEnd') {
|
||||||
|
scrollTouchEnd()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Removed: `webContents.incrementCapturerCount(stayHidden, stayAwake)`
|
||||||
|
|
||||||
|
The `webContents.incrementCapturerCount(stayHidden, stayAwake)` function has been removed.
|
||||||
|
It is now automatically handled by `webContents.capturePage` when a page capture completes.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const w = new BrowserWindow({ show: false })
|
||||||
|
|
||||||
|
// Removed in Electron 23
|
||||||
|
w.webContents.incrementCapturerCount()
|
||||||
|
w.capturePage().then(image => {
|
||||||
|
console.log(image.toDataURL())
|
||||||
|
w.webContents.decrementCapturerCount()
|
||||||
|
})
|
||||||
|
|
||||||
|
// Replace with
|
||||||
|
w.capturePage().then(image => {
|
||||||
|
console.log(image.toDataURL())
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Removed: `webContents.decrementCapturerCount(stayHidden, stayAwake)`
|
||||||
|
|
||||||
|
The `webContents.decrementCapturerCount(stayHidden, stayAwake)` function has been removed.
|
||||||
|
It is now automatically handled by `webContents.capturePage` when a page capture completes.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const w = new BrowserWindow({ show: false })
|
||||||
|
|
||||||
|
// Removed in Electron 23
|
||||||
|
w.webContents.incrementCapturerCount()
|
||||||
|
w.capturePage().then(image => {
|
||||||
|
console.log(image.toDataURL())
|
||||||
|
w.webContents.decrementCapturerCount()
|
||||||
|
})
|
||||||
|
|
||||||
|
// Replace with
|
||||||
|
w.capturePage().then(image => {
|
||||||
|
console.log(image.toDataURL())
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Planned Breaking API Changes (22.0)
|
||||||
|
|
||||||
|
### Deprecated: `webContents.incrementCapturerCount(stayHidden, stayAwake)`
|
||||||
|
|
||||||
|
`webContents.incrementCapturerCount(stayHidden, stayAwake)` has been deprecated.
|
||||||
|
It is now automatically handled by `webContents.capturePage` when a page capture completes.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const w = new BrowserWindow({ show: false })
|
||||||
|
|
||||||
|
// Removed in Electron 23
|
||||||
|
w.webContents.incrementCapturerCount()
|
||||||
|
w.capturePage().then(image => {
|
||||||
|
console.log(image.toDataURL())
|
||||||
|
w.webContents.decrementCapturerCount()
|
||||||
|
})
|
||||||
|
|
||||||
|
// Replace with
|
||||||
|
w.capturePage().then(image => {
|
||||||
|
console.log(image.toDataURL())
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deprecated: `webContents.decrementCapturerCount(stayHidden, stayAwake)`
|
||||||
|
|
||||||
|
`webContents.decrementCapturerCount(stayHidden, stayAwake)` has been deprecated.
|
||||||
|
It is now automatically handled by `webContents.capturePage` when a page capture completes.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const w = new BrowserWindow({ show: false })
|
||||||
|
|
||||||
|
// Removed in Electron 23
|
||||||
|
w.webContents.incrementCapturerCount()
|
||||||
|
w.capturePage().then(image => {
|
||||||
|
console.log(image.toDataURL())
|
||||||
|
w.webContents.decrementCapturerCount()
|
||||||
|
})
|
||||||
|
|
||||||
|
// Replace with
|
||||||
|
w.capturePage().then(image => {
|
||||||
|
console.log(image.toDataURL())
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Removed: WebContents `new-window` event
|
||||||
|
|
||||||
|
The `new-window` event of WebContents has been removed. It is replaced by [`webContents.setWindowOpenHandler()`](api/web-contents.md#contentssetwindowopenhandlerhandler).
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Removed in Electron 22
|
||||||
|
webContents.on('new-window', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
})
|
||||||
|
|
||||||
|
// Replace with
|
||||||
|
webContents.setWindowOpenHandler((details) => {
|
||||||
|
return { action: 'deny' }
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deprecated: BrowserWindow `scroll-touch-*` events
|
||||||
|
|
||||||
|
The `scroll-touch-begin`, `scroll-touch-end` and `scroll-touch-edge` events on
|
||||||
|
BrowserWindow are deprecated. Instead, use the newly available [`input-event`
|
||||||
|
event](api/web-contents.md#event-input-event) on WebContents.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Deprecated
|
||||||
|
win.on('scroll-touch-begin', scrollTouchBegin)
|
||||||
|
win.on('scroll-touch-edge', scrollTouchEdge)
|
||||||
|
win.on('scroll-touch-end', scrollTouchEnd)
|
||||||
|
|
||||||
|
// Replace with
|
||||||
|
win.webContents.on('input-event', (_, event) => {
|
||||||
|
if (event.type === 'gestureScrollBegin') {
|
||||||
|
scrollTouchBegin()
|
||||||
|
} else if (event.type === 'gestureScrollUpdate') {
|
||||||
|
scrollTouchEdge()
|
||||||
|
} else if (event.type === 'gestureScrollEnd') {
|
||||||
|
scrollTouchEnd()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Planned Breaking API Changes (21.0)
|
||||||
|
|
||||||
|
### Behavior Changed: V8 Memory Cage enabled
|
||||||
|
|
||||||
|
The V8 memory cage has been enabled, which has implications for native modules
|
||||||
|
which wrap non-V8 memory with `ArrayBuffer` or `Buffer`. See the [blog post
|
||||||
|
about the V8 memory cage](https://www.electronjs.org/blog/v8-memory-cage) for
|
||||||
|
more details.
|
||||||
|
|
||||||
|
### API Changed: `webContents.printToPDF()`
|
||||||
|
|
||||||
|
`webContents.printToPDF()` has been modified to conform to [`Page.printToPDF`](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF) in the Chrome DevTools Protocol. This has been changes in order to
|
||||||
|
address changes upstream that made our previous implementation untenable and rife with bugs.
|
||||||
|
|
||||||
|
**Arguments Changed**
|
||||||
|
|
||||||
|
* `pageRanges`
|
||||||
|
|
||||||
|
**Arguments Removed**
|
||||||
|
|
||||||
|
* `printSelectionOnly`
|
||||||
|
* `marginsType`
|
||||||
|
* `headerFooter`
|
||||||
|
* `scaleFactor`
|
||||||
|
|
||||||
|
**Arguments Added**
|
||||||
|
|
||||||
|
* `headerTemplate`
|
||||||
|
* `footerTemplate`
|
||||||
|
* `displayHeaderFooter`
|
||||||
|
* `margins`
|
||||||
|
* `scale`
|
||||||
|
* `preferCSSPageSize`
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Main process
|
||||||
|
const { webContents } = require('electron')
|
||||||
|
|
||||||
|
webContents.printToPDF({
|
||||||
|
landscape: true,
|
||||||
|
displayHeaderFooter: true,
|
||||||
|
printBackground: true,
|
||||||
|
scale: 2,
|
||||||
|
pageSize: 'Ledger',
|
||||||
|
margins: {
|
||||||
|
top: 2,
|
||||||
|
bottom: 2,
|
||||||
|
left: 2,
|
||||||
|
right: 2
|
||||||
|
},
|
||||||
|
pageRanges: '1-5, 8, 11-13',
|
||||||
|
headerTemplate: '<h1>Title</h1>',
|
||||||
|
footerTemplate: '<div><span class="pageNumber"></span></div>',
|
||||||
|
preferCSSPageSize: true
|
||||||
|
}).then(data => {
|
||||||
|
fs.writeFile(pdfPath, data, (error) => {
|
||||||
|
if (error) throw error
|
||||||
|
console.log(`Wrote PDF successfully to ${pdfPath}`)
|
||||||
|
})
|
||||||
|
}).catch(error => {
|
||||||
|
console.log(`Failed to write PDF to ${pdfPath}: `, error)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## Planned Breaking API Changes (20.0)
|
## Planned Breaking API Changes (20.0)
|
||||||
|
|
||||||
### Default Changed: renderers without `nodeIntegration: true` are sandboxed by default
|
### Default Changed: renderers without `nodeIntegration: true` are sandboxed by default
|
||||||
@@ -34,9 +256,19 @@ window manager. There is not a direct equivalent for Wayland, and the known
|
|||||||
workarounds have unacceptable tradeoffs (e.g. Window.is_skip_taskbar in GNOME
|
workarounds have unacceptable tradeoffs (e.g. Window.is_skip_taskbar in GNOME
|
||||||
requires unsafe mode), so Electron is unable to support this feature on Linux.
|
requires unsafe mode), so Electron is unable to support this feature on Linux.
|
||||||
|
|
||||||
|
### API Changed: `session.setDevicePermissionHandler(handler)`
|
||||||
|
|
||||||
|
The handler invoked when `session.setDevicePermissionHandler(handler)` is used
|
||||||
|
has a change to its arguments. This handler no longer is passed a frame
|
||||||
|
[`WebFrameMain`](api/web-frame-main.md), but instead is passed the `origin`, which
|
||||||
|
is the origin that is checking for device permission.
|
||||||
|
|
||||||
## Planned Breaking API Changes (19.0)
|
## Planned Breaking API Changes (19.0)
|
||||||
|
|
||||||
None
|
### Removed: IA32 Linux binaries
|
||||||
|
|
||||||
|
This is a result of Chromium 102.0.4999.0 dropping support for IA32 Linux.
|
||||||
|
This concludes the [removal of support for IA32 Linux](#removed-ia32-linux-support).
|
||||||
|
|
||||||
## Planned Breaking API Changes (18.0)
|
## Planned Breaking API Changes (18.0)
|
||||||
|
|
||||||
@@ -372,7 +604,7 @@ value.
|
|||||||
In Electron 12, `contextIsolation` will be enabled by default. To restore
|
In Electron 12, `contextIsolation` will be enabled by default. To restore
|
||||||
the previous behavior, `contextIsolation: false` must be specified in WebPreferences.
|
the previous behavior, `contextIsolation: false` must be specified in WebPreferences.
|
||||||
|
|
||||||
We [recommend having contextIsolation enabled](tutorial/security.md#3-enable-context-isolation-for-remote-content) for the security of your application.
|
We [recommend having contextIsolation enabled](tutorial/security.md#3-enable-context-isolation) for the security of your application.
|
||||||
|
|
||||||
Another implication is that `require()` cannot be used in the renderer process unless
|
Another implication is that `require()` cannot be used in the renderer process unless
|
||||||
`nodeIntegration` is `true` and `contextIsolation` is `false`.
|
`nodeIntegration` is `true` and `contextIsolation` is `false`.
|
||||||
@@ -1203,6 +1435,10 @@ not present, then the native module will fail to load on Windows, with an error
|
|||||||
message like `Cannot find module`. See the [native module
|
message like `Cannot find module`. See the [native module
|
||||||
guide](/docs/tutorial/using-native-node-modules.md) for more.
|
guide](/docs/tutorial/using-native-node-modules.md) for more.
|
||||||
|
|
||||||
|
### Removed: IA32 Linux support
|
||||||
|
|
||||||
|
Electron 18 will no longer run on 32-bit Linux systems. See [discontinuing support for 32-bit Linux](https://www.electronjs.org/blog/linux-32bit-support) for more information.
|
||||||
|
|
||||||
## Breaking API Changes (3.0)
|
## Breaking API Changes (3.0)
|
||||||
|
|
||||||
The following list includes the breaking API changes in Electron 3.0.
|
The following list includes the breaking API changes in Electron 3.0.
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ See [issues](issues.md) for more information.
|
|||||||
Most pull requests opened against the `electron/electron` repository include
|
Most pull requests opened against the `electron/electron` repository include
|
||||||
changes to either the C/C++ code in the `shell/` folder,
|
changes to either the C/C++ code in the `shell/` folder,
|
||||||
the TypeScript code in the `lib/` folder, the documentation in `docs/`,
|
the TypeScript code in the `lib/` folder, the documentation in `docs/`,
|
||||||
or tests in the `spec/` and `spec-main/` folders.
|
or tests in the `spec/` folder.
|
||||||
|
|
||||||
See [pull requests](pull-requests.md) for more information.
|
See [pull requests](pull-requests.md) for more information.
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ If you want to add a new API module to Electron, you'll want to look in [creatin
|
|||||||
|
|
||||||
Electron has a fully-fledged governance system that oversees activity in Electron and whose working groups are responsible for areas like APIs, releases, and upgrades to Electron's dependencies including Chromium and Node.js. Depending on how frequently and to what end you want to contribute, you may want to consider joining a working group.
|
Electron has a fully-fledged governance system that oversees activity in Electron and whose working groups are responsible for areas like APIs, releases, and upgrades to Electron's dependencies including Chromium and Node.js. Depending on how frequently and to what end you want to contribute, you may want to consider joining a working group.
|
||||||
|
|
||||||
Details about each group and their reponsibilities can be found in the [governance repo](https://github.com/electron/governance).
|
Details about each group and their responsibilities can be found in the [governance repo](https://github.com/electron/governance).
|
||||||
|
|
||||||
## Patches in Electron
|
## Patches in Electron
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ $ ninja -C out/Release electron
|
|||||||
```
|
```
|
||||||
|
|
||||||
This will build all of what was previously 'libchromiumcontent' (i.e. the
|
This will build all of what was previously 'libchromiumcontent' (i.e. the
|
||||||
`content/` directory of `chromium` and its dependencies, incl. WebKit and V8),
|
`content/` directory of `chromium` and its dependencies, incl. Blink and V8),
|
||||||
so it will take a while.
|
so it will take a while.
|
||||||
|
|
||||||
The built executable will be under `./out/Testing`:
|
The built executable will be under `./out/Testing`:
|
||||||
@@ -281,9 +281,22 @@ $ cd electron
|
|||||||
$ gclient sync -f
|
$ gclient sync -f
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This may also happen if you have checked out a branch (as opposed to having a detached head) in `electron/src/`
|
||||||
|
or some other dependency’s repository. If that is the case, a `git checkout --detach HEAD` in the appropriate repository should do the trick.
|
||||||
|
|
||||||
### I'm being asked for a username/password for chromium-internal.googlesource.com
|
### I'm being asked for a username/password for chromium-internal.googlesource.com
|
||||||
|
|
||||||
If you see a prompt for `Username for 'https://chrome-internal.googlesource.com':` when running `gclient sync` on Windows, it's probably because the `DEPOT_TOOLS_WIN_TOOLCHAIN` environment variable is not set to 0. Open `Control Panel` → `System and Security` → `System` → `Advanced system settings` and add a system variable
|
If you see a prompt for `Username for 'https://chrome-internal.googlesource.com':` when running `gclient sync` on Windows, it's probably because the `DEPOT_TOOLS_WIN_TOOLCHAIN` environment variable is not set to 0. Open `Control Panel` → `System and Security` → `System` → `Advanced system settings` and add a system variable
|
||||||
`DEPOT_TOOLS_WIN_TOOLCHAIN` with value `0`. This tells `depot_tools` to use
|
`DEPOT_TOOLS_WIN_TOOLCHAIN` with value `0`. This tells `depot_tools` to use
|
||||||
your locally installed version of Visual Studio (by default, `depot_tools` will
|
your locally installed version of Visual Studio (by default, `depot_tools` will
|
||||||
try to download a Google-internal version that only Googlers have access to).
|
try to download a Google-internal version that only Googlers have access to).
|
||||||
|
|
||||||
|
### `e` Module not found
|
||||||
|
|
||||||
|
If `e` is not recognized despite running `npm i -g @electron/build-tools`, ie:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
Error: Cannot find module '/Users/<user>/.electron_build_tools/src/e'
|
||||||
|
```
|
||||||
|
|
||||||
|
We recommend installing Node through [nvm](https://github.com/nvm-sh/nvm). This allows for easier Node version management, and is often a fix for missing `e` modules.
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user