mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
654 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
258f245e74 | ||
|
|
d0fdf5a374 | ||
|
|
3d82985602 | ||
|
|
93342d9302 | ||
|
|
50094b3a25 | ||
|
|
13284a3a57 | ||
|
|
5da6ee1fc1 | ||
|
|
4de3e451ac | ||
|
|
d27046272e | ||
|
|
9ce7c51247 | ||
|
|
840ac755b8 | ||
|
|
8115520d2a | ||
|
|
92e3b1305c | ||
|
|
93dab148c8 | ||
|
|
e100c22a26 | ||
|
|
4efeaa090a | ||
|
|
93c6c8c103 | ||
|
|
df9a01bb53 | ||
|
|
5c10eb4c26 | ||
|
|
f836ef0f47 | ||
|
|
274f6f75b5 | ||
|
|
2f42c2c76e | ||
|
|
1cf09e7aab | ||
|
|
06580db96d | ||
|
|
337e691089 | ||
|
|
731fe11db6 | ||
|
|
9e4f6bf8b4 | ||
|
|
59328b6f8f | ||
|
|
facc12eafa | ||
|
|
d9ce3ac776 | ||
|
|
6314637ae9 | ||
|
|
00d5c6ad53 | ||
|
|
7ac905dd77 | ||
|
|
d99ab3fb41 | ||
|
|
80ca7be524 | ||
|
|
deb667054c | ||
|
|
22f6abc4f5 | ||
|
|
c023c480bb | ||
|
|
dd24a4b0f6 | ||
|
|
bb612d7a05 | ||
|
|
cf69f9a4ce | ||
|
|
d4eed90145 | ||
|
|
8f05f313ce | ||
|
|
592a1aed0f | ||
|
|
fc2762c66a | ||
|
|
9f48ef1c78 | ||
|
|
574b705f22 | ||
|
|
17c970b6a2 | ||
|
|
1f4ffe4f68 | ||
|
|
d121bcbbb5 | ||
|
|
d2a342c74d | ||
|
|
c19e1ee30e | ||
|
|
508075f870 | ||
|
|
c34103d912 | ||
|
|
7487fe91fe | ||
|
|
7b21bc543b | ||
|
|
6c09c2c644 | ||
|
|
44eb30fa71 | ||
|
|
c528ed5a8d | ||
|
|
15f29aa971 | ||
|
|
312682d655 | ||
|
|
8397716dab | ||
|
|
23075f8620 | ||
|
|
90d94e468e | ||
|
|
5cc6d79d17 | ||
|
|
8f825d35f7 | ||
|
|
05972074e3 | ||
|
|
21ac61270a | ||
|
|
f0500fae4c | ||
|
|
5f2f4182c4 | ||
|
|
ac8db00a70 | ||
|
|
ab5d0f4c8b | ||
|
|
203116867b | ||
|
|
67a67270f5 | ||
|
|
83a3eb64ec | ||
|
|
8b1260184a | ||
|
|
f13ddca55f | ||
|
|
f1c4265072 | ||
|
|
f5de5e9131 | ||
|
|
a73949315c | ||
|
|
189f7e0e4e | ||
|
|
2950f03e83 | ||
|
|
ca417e435c | ||
|
|
5237108396 | ||
|
|
3ae63c9a06 | ||
|
|
8828382b23 | ||
|
|
0e714d19c5 | ||
|
|
aec412e35d | ||
|
|
4b2d791212 | ||
|
|
fd629c16cb | ||
|
|
007c960f3c | ||
|
|
b2636e171a | ||
|
|
e7e1801443 | ||
|
|
0baf9997ad | ||
|
|
e65e989650 | ||
|
|
26a18c26d7 | ||
|
|
a52c88ec4d | ||
|
|
0ee559cd29 | ||
|
|
dfed04b71b | ||
|
|
d628fa07b5 | ||
|
|
f0c7789544 | ||
|
|
d00e869560 | ||
|
|
b70e42024a | ||
|
|
44adc8ddb4 | ||
|
|
9e30fe0f96 | ||
|
|
7180b2b13f | ||
|
|
c734baf8d4 | ||
|
|
a859436f7a | ||
|
|
3144f992f7 | ||
|
|
98f57a20e7 | ||
|
|
f6007654f9 | ||
|
|
84a4a7a944 | ||
|
|
1b6e3596f2 | ||
|
|
573784967c | ||
|
|
d55b399976 | ||
|
|
b8941d084d | ||
|
|
afffbadf5b | ||
|
|
c3bce9c664 | ||
|
|
33f6ff40fc | ||
|
|
777f23af0d | ||
|
|
f6992db54b | ||
|
|
8cdd20e97a | ||
|
|
962f1aa7d4 | ||
|
|
0961044dc8 | ||
|
|
e1f06510f8 | ||
|
|
b6bdbcf485 | ||
|
|
417230a67a | ||
|
|
fe876bd55b | ||
|
|
4e372b888f | ||
|
|
74ef45315b | ||
|
|
f7d8c806ae | ||
|
|
d4de0b5e50 | ||
|
|
35daa4801a | ||
|
|
5db929ffc1 | ||
|
|
f6b81990fc | ||
|
|
7c67c1d0ee | ||
|
|
509efee4af | ||
|
|
7fa87565c0 | ||
|
|
c67c3aaf74 | ||
|
|
cc4db3359d | ||
|
|
5dbb6356ef | ||
|
|
0c5b6bfd30 | ||
|
|
9faf23509d | ||
|
|
b4ae35a63d | ||
|
|
025abfc1ba | ||
|
|
563bb8559f | ||
|
|
30be5bfa4b | ||
|
|
28fa60fbcb | ||
|
|
37c68d56d6 | ||
|
|
da58ded8f9 | ||
|
|
80a3f10b6b | ||
|
|
889abd0c8e | ||
|
|
0305f08888 | ||
|
|
0604f8727c | ||
|
|
551896c4ce | ||
|
|
c11a5dcf29 | ||
|
|
b86eb74fbf | ||
|
|
e49a88ba53 | ||
|
|
4ab817768d | ||
|
|
f730284113 | ||
|
|
6122f4bece | ||
|
|
017628f84d | ||
|
|
eb132d8b3e | ||
|
|
f26025301a | ||
|
|
a79750b871 | ||
|
|
870d8c0307 | ||
|
|
1f22b2bfdc | ||
|
|
e25de07657 | ||
|
|
6bfccca157 | ||
|
|
58c1ce50d4 | ||
|
|
c46ed96421 | ||
|
|
9278459c46 | ||
|
|
a6af3bd8df | ||
|
|
c74780117e | ||
|
|
a6f01ded4d | ||
|
|
25e4475444 | ||
|
|
162d40cd23 | ||
|
|
a73f00cd47 | ||
|
|
897fd34253 | ||
|
|
0d48f3944d | ||
|
|
82bc14362c | ||
|
|
4010890edd | ||
|
|
b10a908187 | ||
|
|
0e7ff69a4e | ||
|
|
f5af20d1d6 | ||
|
|
3f2ccce9e1 | ||
|
|
8e7862ed4b | ||
|
|
48a8fdfdb6 | ||
|
|
e9c39163bf | ||
|
|
dc657515b7 | ||
|
|
8eb4ab0ae1 | ||
|
|
92c8614e14 | ||
|
|
f3ce79936a | ||
|
|
d498d4bf18 | ||
|
|
df21f17131 | ||
|
|
c6d144d550 | ||
|
|
6553c4418f | ||
|
|
ecf981a91a | ||
|
|
b5cfa03a63 | ||
|
|
1bbf71c090 | ||
|
|
97b40e4e45 | ||
|
|
975123b6bf | ||
|
|
011315574c | ||
|
|
cfd848c32f | ||
|
|
81db78daec | ||
|
|
ce0faeed90 | ||
|
|
e6885668d4 | ||
|
|
a1df860b66 | ||
|
|
ba76f6846e | ||
|
|
ce8d301921 | ||
|
|
39f865e4e3 | ||
|
|
e6727fb7bd | ||
|
|
c9564ff648 | ||
|
|
76be3b9211 | ||
|
|
d132800944 | ||
|
|
558bcc65bc | ||
|
|
bf25d484a4 | ||
|
|
d2c4b594bd | ||
|
|
601af0b016 | ||
|
|
130a65d008 | ||
|
|
fe022df628 | ||
|
|
5b47fd7cbf | ||
|
|
9b1913b613 | ||
|
|
36c695ce2a | ||
|
|
afcdf661a0 | ||
|
|
3d01b83daa | ||
|
|
e77d9ff3b9 | ||
|
|
fb35356b47 | ||
|
|
37d21bb80e | ||
|
|
e84539f2e0 | ||
|
|
d2591ed4f8 | ||
|
|
6b54fe37de | ||
|
|
561fe63813 | ||
|
|
9543f8b30a | ||
|
|
cec2c73733 | ||
|
|
2e9305d964 | ||
|
|
0491cc6906 | ||
|
|
badcdd6566 | ||
|
|
a0d0bd60a5 | ||
|
|
c0f0a02419 | ||
|
|
8046f0560a | ||
|
|
2a8961b52f | ||
|
|
36163af228 | ||
|
|
29f42e943e | ||
|
|
4597cb6499 | ||
|
|
4ba78b81c1 | ||
|
|
80e0473649 | ||
|
|
db0d4c8224 | ||
|
|
4fbb58020c | ||
|
|
c9801ab5a5 | ||
|
|
46441c1bd7 | ||
|
|
1cac3354e7 | ||
|
|
57c69ab3ac | ||
|
|
39b9c40a05 | ||
|
|
66a22a28a5 | ||
|
|
17a8b7724b | ||
|
|
c512995426 | ||
|
|
e65341e282 | ||
|
|
d4e53925ba | ||
|
|
f182a600e4 | ||
|
|
dcc6196fe7 | ||
|
|
2bc859b884 | ||
|
|
b8eea7e89b | ||
|
|
6a29e5d116 | ||
|
|
ec85a91472 | ||
|
|
cc136f2acd | ||
|
|
968cb970fc | ||
|
|
17df102a3b | ||
|
|
e1cc78f275 | ||
|
|
b8372fdc29 | ||
|
|
29211a51df | ||
|
|
784172b6ca | ||
|
|
ac6d301015 | ||
|
|
92643a5a1c | ||
|
|
a303813d15 | ||
|
|
dbe0f06c3d | ||
|
|
2b4ce387bc | ||
|
|
023c89265f | ||
|
|
ead13791a8 | ||
|
|
7c2ac6b7c1 | ||
|
|
040ee66678 | ||
|
|
c78ac248dc | ||
|
|
a74d0b29d5 | ||
|
|
0c6b0596b5 | ||
|
|
d97612ed21 | ||
|
|
cad2d8b4aa | ||
|
|
a9924e1c32 | ||
|
|
8594b55dee | ||
|
|
fabc51dc33 | ||
|
|
6f6c1b7ca6 | ||
|
|
f65db1df79 | ||
|
|
ac35787bdb | ||
|
|
358ab79778 | ||
|
|
900fbb99c9 | ||
|
|
434f7749db | ||
|
|
e017d8714e | ||
|
|
d6019634f9 | ||
|
|
d6431a0ff2 | ||
|
|
3c7582173a | ||
|
|
0448888fa5 | ||
|
|
1cda003e4d | ||
|
|
5ee9cc202b | ||
|
|
83d30c5c2a | ||
|
|
bb3fb548d8 | ||
|
|
f77b56e926 | ||
|
|
044302e4ab | ||
|
|
f1c0dc4c24 | ||
|
|
5875e9a5e8 | ||
|
|
cdc9625a86 | ||
|
|
e6db49686b | ||
|
|
ff33fa1970 | ||
|
|
0b85fdf26c | ||
|
|
6b222a2d8a | ||
|
|
b823b74378 | ||
|
|
8b7e10cf4d | ||
|
|
40f82e5ef2 | ||
|
|
946802600b | ||
|
|
40ebdb5c42 | ||
|
|
02a8c0a640 | ||
|
|
f21a21f172 | ||
|
|
eb2a35f0d8 | ||
|
|
b75c7e16a4 | ||
|
|
dcffa7449a | ||
|
|
d54c1c7072 | ||
|
|
d836682ee6 | ||
|
|
e193543ea8 | ||
|
|
2c52d5fe42 | ||
|
|
43dbd1bdf8 | ||
|
|
3814a56d48 | ||
|
|
103d6d7781 | ||
|
|
e296813578 | ||
|
|
2daca0f4d0 | ||
|
|
34156c424c | ||
|
|
c856b5fa53 | ||
|
|
d25fa7b075 | ||
|
|
42aa6b8ea5 | ||
|
|
bded790425 | ||
|
|
b1b8a657c4 | ||
|
|
4716def511 | ||
|
|
34feaf1df0 | ||
|
|
123e8d7038 | ||
|
|
ecd23bb29b | ||
|
|
d16e61dc85 | ||
|
|
f61dedb7e5 | ||
|
|
6017a0de88 | ||
|
|
2a392c11f8 | ||
|
|
4c40ce09fd | ||
|
|
e9cd227b5b | ||
|
|
f065b2ddef | ||
|
|
e021639472 | ||
|
|
7f9b21daa0 | ||
|
|
07ee75b745 | ||
|
|
914aed6495 | ||
|
|
60e963ed86 | ||
|
|
30aa74c71c | ||
|
|
935f6396d5 | ||
|
|
ff71d1cef6 | ||
|
|
794940272b | ||
|
|
3d9d5679c5 | ||
|
|
ad4cb6f8ac | ||
|
|
f489e3054a | ||
|
|
d3f32c7502 | ||
|
|
0c2e2bca92 | ||
|
|
83747ad21c | ||
|
|
84a42a050e | ||
|
|
bb16c6f0be | ||
|
|
0603ef7bfd | ||
|
|
d2727f5aba | ||
|
|
bf89237f60 | ||
|
|
284c1b9539 | ||
|
|
7cdc42f43a | ||
|
|
760c4aeb3e | ||
|
|
98b0ccbdb1 | ||
|
|
430cef8a62 | ||
|
|
8c396d0512 | ||
|
|
1c99a9b425 | ||
|
|
dbf2931f0e | ||
|
|
422190e1ff | ||
|
|
d8167ce138 | ||
|
|
52fd855ad4 | ||
|
|
201fc11b4b | ||
|
|
33ac7dbd48 | ||
|
|
ae323565f7 | ||
|
|
184bccdc7d | ||
|
|
e512669937 | ||
|
|
4be10523e8 | ||
|
|
f714556a12 | ||
|
|
29016b42c7 | ||
|
|
0fc5f18b63 | ||
|
|
2d1bbd2e38 | ||
|
|
93e786d1b5 | ||
|
|
6a0c5a8a65 | ||
|
|
ecb758dae5 | ||
|
|
d4191c4a26 | ||
|
|
aa157c3f05 | ||
|
|
30b5e15ddc | ||
|
|
4379a14335 | ||
|
|
e89abed924 | ||
|
|
c89ce5eecf | ||
|
|
9d18f9d54f | ||
|
|
6181c03df0 | ||
|
|
2d49d82072 | ||
|
|
722903f068 | ||
|
|
554ad93d45 | ||
|
|
d9db9873fd | ||
|
|
c934d1386b | ||
|
|
7f0c6ea47a | ||
|
|
e3c4bbd21f | ||
|
|
f93e33528e | ||
|
|
35455c725d | ||
|
|
10a209ecba | ||
|
|
2aa5a1f494 | ||
|
|
22cb3cd18b | ||
|
|
f6a27973d1 | ||
|
|
939be5eb8a | ||
|
|
a631a8a8b0 | ||
|
|
5c6fa7e420 | ||
|
|
df1432a315 | ||
|
|
1ef803d2ea | ||
|
|
56d1fafe66 | ||
|
|
f7945ade07 | ||
|
|
c4525b4ea6 | ||
|
|
d38c47e748 | ||
|
|
aebb56cb33 | ||
|
|
e6f570d191 | ||
|
|
042ebdd5b0 | ||
|
|
6b6ffbdd10 | ||
|
|
89c04b3c6c | ||
|
|
ae5de3d9c5 | ||
|
|
12e3c85081 | ||
|
|
4ce7ca6cfb | ||
|
|
c6a6f53c8d | ||
|
|
3219812c02 | ||
|
|
e895353f7a | ||
|
|
88508d5166 | ||
|
|
64504536fa | ||
|
|
16caa54248 | ||
|
|
11ce55628e | ||
|
|
87d3f3584c | ||
|
|
6a0221297e | ||
|
|
decb1eb87b | ||
|
|
c27e5fdbb6 | ||
|
|
05b5c197ae | ||
|
|
321395d96e | ||
|
|
eca53aaaf1 | ||
|
|
708cf44d19 | ||
|
|
44221d7452 | ||
|
|
63f1f2d7ce | ||
|
|
bf68405a2f | ||
|
|
55fdc1795c | ||
|
|
46f3491c7d | ||
|
|
20c6677a9c | ||
|
|
1c44bb8e74 | ||
|
|
beaed6c434 | ||
|
|
82424350bf | ||
|
|
09afaec9de | ||
|
|
dfbb88c5f6 | ||
|
|
9b43935b07 | ||
|
|
2c68bad631 | ||
|
|
8dfb1cf78f | ||
|
|
b194030a34 | ||
|
|
183e92a5ae | ||
|
|
e8166db9d7 | ||
|
|
d57cd09f14 | ||
|
|
8243255316 | ||
|
|
501900cdc6 | ||
|
|
cbe751d349 | ||
|
|
9cd882f1fa | ||
|
|
f827acc3be | ||
|
|
d78d7b3a55 | ||
|
|
83bb065b4f | ||
|
|
b8f414f4da | ||
|
|
2e5c005e30 | ||
|
|
704d69a8f9 | ||
|
|
647df1e547 | ||
|
|
0195319b75 | ||
|
|
3402fe712c | ||
|
|
6677c5064f | ||
|
|
6d5cf02abd | ||
|
|
042d25e926 | ||
|
|
2ca2a88afc | ||
|
|
e4213e326b | ||
|
|
fb11a12d5b | ||
|
|
603f9242d9 | ||
|
|
73adeef877 | ||
|
|
3e627f7700 | ||
|
|
9be6b1f7e0 | ||
|
|
65089a69a1 | ||
|
|
a5ca25ba65 | ||
|
|
f31a1c9e4e | ||
|
|
0632d59da0 | ||
|
|
5be9dcad46 | ||
|
|
db911f29ad | ||
|
|
8207f6901d | ||
|
|
125c5a6e9b | ||
|
|
b33f22601e | ||
|
|
fec1c0b68b | ||
|
|
6356cd4018 | ||
|
|
53ee708fe8 | ||
|
|
cba19f06f1 | ||
|
|
ee9045c2e7 | ||
|
|
57dc170e81 | ||
|
|
9717dff4fa | ||
|
|
bbdca48cdb | ||
|
|
818751ff87 | ||
|
|
15d7d4b40f | ||
|
|
30465790b5 | ||
|
|
c075d14920 | ||
|
|
4ccc9e4205 | ||
|
|
77e2e47504 | ||
|
|
508b8d902b | ||
|
|
485adae94c | ||
|
|
a189dc779e | ||
|
|
d64b9c20bd | ||
|
|
ac6bf0b268 | ||
|
|
8ac71fd349 | ||
|
|
e1a19d735e | ||
|
|
7e88585bfb | ||
|
|
8df4faa8f0 | ||
|
|
17c7c5cfdd | ||
|
|
5387b5b9b2 | ||
|
|
822b044068 | ||
|
|
e2132acc5c | ||
|
|
3142b1181b | ||
|
|
7027217dbb | ||
|
|
e9876aecf9 | ||
|
|
077c37c682 | ||
|
|
4316c4125f | ||
|
|
2b3b3fea2e | ||
|
|
a8d542337c | ||
|
|
462de5f97a | ||
|
|
b43859f098 | ||
|
|
d2282ac51a | ||
|
|
01dc50d829 | ||
|
|
0e7d59dd79 | ||
|
|
8970c80520 | ||
|
|
99a4284174 | ||
|
|
f3c53c1f10 | ||
|
|
ebc7d54765 | ||
|
|
b85195ee5f | ||
|
|
ac25f4d2ff | ||
|
|
fd63510ca9 | ||
|
|
bed50bb73c | ||
|
|
69ee443c50 | ||
|
|
4c9638e2b5 | ||
|
|
3ceaf4aa54 | ||
|
|
1f856c25a9 | ||
|
|
dcd6e1f2b8 | ||
|
|
b807cabe1b | ||
|
|
b980d1bd6b | ||
|
|
6fb7066904 | ||
|
|
27ea3fc069 | ||
|
|
515e85079f | ||
|
|
353c63e47a | ||
|
|
9d0d9a1664 | ||
|
|
881ac995da | ||
|
|
3503d3745b | ||
|
|
a0b238a998 | ||
|
|
6aaaabd90f | ||
|
|
22c6c891be | ||
|
|
29c6864ee1 | ||
|
|
4f54d71518 | ||
|
|
0d72bf3ed2 | ||
|
|
6acf34fa4c | ||
|
|
f6f05c34e6 | ||
|
|
d2a82dbd1d | ||
|
|
dae60e01d4 | ||
|
|
c50ded2b71 | ||
|
|
2dd7ad268b | ||
|
|
15c30c5649 | ||
|
|
ea76788b67 | ||
|
|
a80c35d161 | ||
|
|
69f1731bbb | ||
|
|
e50d6e47c4 | ||
|
|
efd003d277 | ||
|
|
137fc65e2f | ||
|
|
ecb7f877a3 | ||
|
|
735d8b84f0 | ||
|
|
a65f7f7d42 | ||
|
|
2cfa41e6e0 | ||
|
|
77038b7bda | ||
|
|
4d1dab849f | ||
|
|
0b055b2fb8 | ||
|
|
53aaeb7a16 | ||
|
|
e0a25cb1e3 | ||
|
|
993eab691f | ||
|
|
a200b15600 | ||
|
|
ba55aaa53b | ||
|
|
1ba46a91b6 | ||
|
|
fa7a29e84b | ||
|
|
e5933c6910 | ||
|
|
2091fd7dd9 | ||
|
|
45170fdbd7 | ||
|
|
fbf32f697f | ||
|
|
459a95aaec | ||
|
|
b1d8057ec9 | ||
|
|
87d67a9365 | ||
|
|
9f4a097e03 | ||
|
|
5de7eb3618 | ||
|
|
7f885bd266 | ||
|
|
bc9816b206 | ||
|
|
633e5d8503 | ||
|
|
9b08fbefe5 | ||
|
|
70e3aa0182 | ||
|
|
a3389d017f | ||
|
|
ce86591459 | ||
|
|
7d56ca7360 | ||
|
|
cd455c8b40 | ||
|
|
acf5d487d2 | ||
|
|
dd781c4f63 | ||
|
|
98683190b4 | ||
|
|
1815b95e74 | ||
|
|
a829ae56b2 | ||
|
|
e6fbbf4325 | ||
|
|
f6df79b927 | ||
|
|
5a8046c994 | ||
|
|
ae5776041e | ||
|
|
f7d9d68e14 | ||
|
|
2c5c51afb9 | ||
|
|
860e14c0da | ||
|
|
31322400e7 | ||
|
|
4ad9bcb8b5 | ||
|
|
29c1248e96 | ||
|
|
a6b9f9d8e5 | ||
|
|
d305fe7d30 | ||
|
|
4dc09ea9dc | ||
|
|
4484e95fc8 | ||
|
|
03e60cce8b | ||
|
|
733d56e908 | ||
|
|
43485b8705 | ||
|
|
bda6378685 | ||
|
|
1b6534b326 | ||
|
|
e9e7eee25e | ||
|
|
7e698df8f3 | ||
|
|
e0611d0946 | ||
|
|
184e72fafd | ||
|
|
3745b76da8 | ||
|
|
bf7dbff858 | ||
|
|
7c10f86c6e | ||
|
|
9803e4d526 | ||
|
|
068b464e13 | ||
|
|
a09694ae85 | ||
|
|
e06a1c2746 | ||
|
|
c5320b3951 | ||
|
|
6cc960f214 | ||
|
|
a4b6fce907 | ||
|
|
8f727b3569 | ||
|
|
95073decd3 | ||
|
|
e8ef1ef252 | ||
|
|
075502477e | ||
|
|
97755bbd85 | ||
|
|
bab69ae4d2 | ||
|
|
443540fd13 | ||
|
|
5e1950ceff |
@@ -158,10 +158,6 @@ env-mas-apple-silicon: &env-mas-apple-silicon
|
||||
TARGET_ARCH: arm64
|
||||
USE_PREBUILT_V8_CONTEXT_SNAPSHOT: 1
|
||||
|
||||
# Misc build configuration options.
|
||||
env-enable-sccache: &env-enable-sccache
|
||||
USE_SCCACHE: true
|
||||
|
||||
env-send-slack-notifications: &env-send-slack-notifications
|
||||
NOTIFY_SLACK: true
|
||||
|
||||
@@ -295,22 +291,10 @@ step-setup-env-for-build: &step-setup-env-for-build
|
||||
# To find `gn` executable.
|
||||
echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/src/buildtools"' >> $BASH_ENV
|
||||
|
||||
if [ "$USE_SCCACHE" == "true" ]; then
|
||||
# https://github.com/mozilla/sccache
|
||||
SCCACHE_PATH="$PWD/src/electron/external_binaries/sccache"
|
||||
echo 'export SCCACHE_PATH="'"$SCCACHE_PATH"'"' >> $BASH_ENV
|
||||
if [ "$CIRCLE_PR_NUMBER" != "" ]; then
|
||||
#if building a fork set readonly access to sccache
|
||||
echo 'export SCCACHE_BUCKET="electronjs-sccache-ci"' >> $BASH_ENV
|
||||
echo 'export SCCACHE_TWO_TIER=true' >> $BASH_ENV
|
||||
fi
|
||||
fi
|
||||
|
||||
step-setup-goma-for-build: &step-setup-goma-for-build
|
||||
run:
|
||||
name: Setup Goma
|
||||
command: |
|
||||
echo 'export USE_GOMA=true' >> $BASH_ENV
|
||||
echo 'export NUMBER_OF_NINJA_PROCESSES=300' >> $BASH_ENV
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
echo 'ulimit -n 10000' >> $BASH_ENV
|
||||
@@ -324,9 +308,10 @@ step-setup-goma-for-build: &step-setup-goma-for-build
|
||||
npm install
|
||||
mkdir third_party
|
||||
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
|
||||
node -e "require('./src/utils/goma.js').ensure()"
|
||||
third_party/goma/goma_ctl.py ensure_start
|
||||
echo 'export GN_GOMA_FILE='`node -e "console.log(require('./src/utils/goma.js').gnFilePath)"` >> $BASH_ENV
|
||||
echo 'export LOCAL_GOMA_DIR='`node -e "console.log(require('./src/utils/goma.js').dir)"` >> $BASH_ENV
|
||||
echo 'export GOMA_FALLBACK_ON_AUTH_FAILURE=true' >> $BASH_ENV
|
||||
cd ..
|
||||
|
||||
step-restore-brew-cache: &step-restore-brew-cache
|
||||
@@ -463,9 +448,6 @@ step-fix-sync-on-mac: &step-fix-sync-on-mac
|
||||
# Fix Clang Install (wrong binary)
|
||||
rm -rf src/third_party/llvm-build
|
||||
python src/tools/clang/scripts/update.py
|
||||
# Fix Framework Header Installs (symlinks not retained)
|
||||
rm -rf src/electron/external_binaries
|
||||
python src/electron/script/update-external-binaries.py
|
||||
fi
|
||||
|
||||
step-install-signing-cert-on-mac: &step-install-signing-cert-on-mac
|
||||
@@ -494,11 +476,7 @@ step-gn-gen-default: &step-gn-gen-default
|
||||
name: Default GN gen
|
||||
command: |
|
||||
cd src
|
||||
if [ "$USE_GOMA" == "true" ]; then
|
||||
gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
else
|
||||
gn gen out/Default --args="import(\"$GN_CONFIG\") cc_wrapper=\"$SCCACHE_PATH\" $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
fi
|
||||
gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
|
||||
step-gn-check: &step-gn-check
|
||||
run:
|
||||
@@ -507,7 +485,6 @@ step-gn-check: &step-gn-check
|
||||
cd src
|
||||
gn check out/Default //electron:electron_lib
|
||||
gn check out/Default //electron:electron_app
|
||||
gn check out/Default //electron:manifests
|
||||
gn check out/Default //electron/shell/common/api:mojo
|
||||
# Check the hunspell filenames
|
||||
node electron/script/gen-hunspell-filenames.js --check
|
||||
@@ -538,12 +515,8 @@ step-electron-build: &step-electron-build
|
||||
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
||||
rm -rf out/Default/clang_x64_v8_arm64/obj
|
||||
|
||||
# Regenerate because we just deleted some ninja files
|
||||
if [ "$USE_GOMA" == "true" ]; then
|
||||
gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
else
|
||||
gn gen out/Default --args="import(\"$GN_CONFIG\") cc_wrapper=\"$SCCACHE_PATH\" $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
fi
|
||||
# Regenerate because we just deleted some ninja files
|
||||
gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
fi
|
||||
ninja -C out/Default electron -j $NUMBER_OF_NINJA_PROCESSES
|
||||
node electron/script/check-symlinks.js
|
||||
@@ -619,11 +592,7 @@ step-electron-maybe-chromedriver-gn-gen: &step-electron-maybe-chromedriver-gn-ge
|
||||
command: |
|
||||
cd src
|
||||
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
|
||||
if [ "$USE_GOMA" == "true" ]; then
|
||||
gn gen out/chromedriver --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") is_component_ffmpeg=false proprietary_codecs=false $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
else
|
||||
gn gen out/chromedriver --args="import(\"$GN_CONFIG\") cc_wrapper=\"$SCCACHE_PATH\" is_component_ffmpeg=false proprietary_codecs=false $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
fi
|
||||
gn gen out/chromedriver --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") is_component_ffmpeg=false proprietary_codecs=false $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
|
||||
fi
|
||||
|
||||
step-electron-chromedriver-build: &step-electron-chromedriver-build
|
||||
@@ -734,11 +703,7 @@ step-ffmpeg-gn-gen: &step-ffmpeg-gn-gen
|
||||
name: ffmpeg GN gen
|
||||
command: |
|
||||
cd src
|
||||
if [ "$USE_GOMA" == "true" ]; then
|
||||
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS"
|
||||
else
|
||||
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") cc_wrapper=\"$SCCACHE_PATH\" $GN_EXTRA_ARGS"
|
||||
fi
|
||||
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS"
|
||||
|
||||
step-ffmpeg-build: &step-ffmpeg-build
|
||||
run:
|
||||
@@ -781,21 +746,16 @@ step-setup-linux-for-headless-testing: &step-setup-linux-for-headless-testing
|
||||
sh -e /etc/init.d/xvfb start
|
||||
fi
|
||||
|
||||
step-show-sccache-stats: &step-show-sccache-stats
|
||||
step-show-goma-stats: &step-show-goma-stats
|
||||
run:
|
||||
shell: /bin/bash
|
||||
name: Check sccache/goma stats after build
|
||||
command: |
|
||||
if [ "$SCCACHE_PATH" != "" ]; then
|
||||
$SCCACHE_PATH -s
|
||||
fi
|
||||
if [ "$USE_GOMA" == "true" ]; then
|
||||
set +e
|
||||
set +o pipefail
|
||||
$LOCAL_GOMA_DIR/goma_ctl.py stat
|
||||
$LOCAL_GOMA_DIR/diagnose_goma_log.py
|
||||
true
|
||||
fi
|
||||
name: Check goma stats after build
|
||||
command: |
|
||||
set +e
|
||||
set +o pipefail
|
||||
$LOCAL_GOMA_DIR/goma_ctl.py stat
|
||||
$LOCAL_GOMA_DIR/diagnose_goma_log.py
|
||||
true
|
||||
when: always
|
||||
|
||||
step-mksnapshot-build: &step-mksnapshot-build
|
||||
@@ -1162,6 +1122,7 @@ steps-checkout-and-save-cache: &steps-checkout-and-save-cache
|
||||
- *step-maybe-early-exit-doc-only-change
|
||||
- *step-depot-tools-get
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-restore-brew-cache
|
||||
- *step-get-more-space-on-mac
|
||||
- *step-install-gnutar-on-mac
|
||||
|
||||
@@ -1203,6 +1164,7 @@ steps-electron-gn-check: &steps-electron-gn-check
|
||||
- *step-maybe-early-exit-doc-only-change
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-setup-env-for-build
|
||||
- *step-setup-goma-for-build
|
||||
- *step-gn-gen-default
|
||||
- *step-gn-check
|
||||
|
||||
@@ -1236,7 +1198,7 @@ steps-electron-ts-compile-for-doc-change: &steps-electron-ts-compile-for-doc-cha
|
||||
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-setup-env-for-build
|
||||
- *step-restore-brew-cache
|
||||
- *step-setup-goma-for-build
|
||||
- *step-get-more-space-on-mac
|
||||
- *step-install-npm-deps-on-mac
|
||||
- *step-fix-sync-on-mac
|
||||
@@ -1245,26 +1207,13 @@ steps-electron-ts-compile-for-doc-change: &steps-electron-ts-compile-for-doc-cha
|
||||
#Compile ts/js to verify doc change didn't break anything
|
||||
- *step-ts-compile
|
||||
|
||||
steps-chromedriver-build: &steps-chromedriver-build
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-setup-env-for-build
|
||||
- *step-fix-sync-on-mac
|
||||
|
||||
- *step-electron-maybe-chromedriver-gn-gen
|
||||
- *step-electron-chromedriver-build
|
||||
- *step-electron-chromedriver-store
|
||||
|
||||
- *step-maybe-notify-slack-failure
|
||||
|
||||
steps-native-tests: &steps-native-tests
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-setup-env-for-build
|
||||
- *step-setup-goma-for-build
|
||||
- *step-gn-gen-default
|
||||
|
||||
- run:
|
||||
@@ -1272,7 +1221,7 @@ steps-native-tests: &steps-native-tests
|
||||
command: |
|
||||
cd src
|
||||
ninja -C out/Default $BUILD_TARGET
|
||||
- *step-show-sccache-stats
|
||||
- *step-show-goma-stats
|
||||
|
||||
- *step-setup-linux-for-headless-testing
|
||||
- run:
|
||||
@@ -1520,7 +1469,6 @@ commands:
|
||||
- run:
|
||||
name: Preserve vendor dirs for release
|
||||
command: |
|
||||
mv src/electron/vendor/boto .
|
||||
mv src/electron/vendor/requests .
|
||||
- run:
|
||||
name: Wipe Electron
|
||||
@@ -1533,9 +1481,7 @@ commands:
|
||||
- run:
|
||||
name: Preserve vendor dirs for release
|
||||
command: |
|
||||
rm -rf src/electron/vendor/boto
|
||||
rm -rf src/electron/vendor/requests
|
||||
mv boto src/electron/vendor
|
||||
mv requests src/electron/vendor/requests
|
||||
- *step-generate-deps-hash-cleanly
|
||||
- *step-mark-sync-done
|
||||
@@ -1580,7 +1526,7 @@ commands:
|
||||
- *step-nodejs-headers-build
|
||||
- *step-nodejs-headers-store
|
||||
|
||||
- *step-show-sccache-stats
|
||||
- *step-show-goma-stats
|
||||
|
||||
# mksnapshot
|
||||
- *step-mksnapshot-build
|
||||
@@ -1668,13 +1614,14 @@ commands:
|
||||
- *step-gclient-sync
|
||||
- *step-delete-git-directories
|
||||
- *step-minimize-workspace-size-from-checkout
|
||||
- *step-fix-sync-on-mac
|
||||
- *step-fix-sync-on-mac
|
||||
- *step-setup-env-for-build
|
||||
- *step-setup-goma-for-build
|
||||
- *step-gn-gen-default
|
||||
|
||||
# Electron app
|
||||
- *step-electron-build
|
||||
- *step-show-sccache-stats
|
||||
- *step-show-goma-stats
|
||||
- *step-maybe-generate-breakpad-symbols
|
||||
- *step-maybe-electron-dist-strip
|
||||
- *step-electron-dist-build
|
||||
@@ -1731,7 +1678,7 @@ jobs:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True --custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True --custom-var=checkout_requests=True'
|
||||
steps:
|
||||
- electron-build:
|
||||
persist: false
|
||||
@@ -1790,7 +1737,7 @@ jobs:
|
||||
<<: *env-linux-2xlarge
|
||||
<<: *env-testing-build
|
||||
<<: *env-macos-build
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac --custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac --custom-var=checkout_requests=True'
|
||||
steps:
|
||||
- electron-build:
|
||||
persist: false
|
||||
@@ -1858,14 +1805,6 @@ jobs:
|
||||
<<: *env-testing-build
|
||||
<<: *steps-electron-gn-check
|
||||
|
||||
linux-x64-chromedriver:
|
||||
<<: *machine-linux-medium
|
||||
environment:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-release-build
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-chromedriver-build
|
||||
|
||||
linux-x64-release:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
@@ -1883,10 +1822,10 @@ jobs:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_requests=True'
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
@@ -1897,8 +1836,8 @@ jobs:
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
@@ -1918,15 +1857,6 @@ jobs:
|
||||
checkout: true
|
||||
use-out-cache: false
|
||||
|
||||
linux-ia32-chromedriver:
|
||||
<<: *machine-linux-medium
|
||||
environment:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-ia32
|
||||
<<: *env-release-build
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-chromedriver-build
|
||||
|
||||
linux-ia32-release:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
@@ -1945,12 +1875,12 @@ jobs:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
<<: *env-linux-2xlarge-release
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_requests=True'
|
||||
<<: *env-ia32
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
<<: *env-32bit-release
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
@@ -1962,9 +1892,9 @@ jobs:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-ia32
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
<<: *env-32bit-release
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
@@ -1985,15 +1915,6 @@ jobs:
|
||||
checkout: true
|
||||
use-out-cache: false
|
||||
|
||||
linux-arm-chromedriver:
|
||||
<<: *machine-linux-medium
|
||||
environment:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-arm
|
||||
<<: *env-release-build
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-chromedriver-build
|
||||
|
||||
linux-arm-release:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
@@ -2014,10 +1935,10 @@ jobs:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-arm
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
<<: *env-32bit-release
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_requests=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
@@ -2029,9 +1950,9 @@ jobs:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-arm
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
<<: *env-32bit-release
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
@@ -2060,15 +1981,6 @@ jobs:
|
||||
<<: *env-testing-build
|
||||
<<: *steps-electron-gn-check
|
||||
|
||||
linux-arm64-chromedriver:
|
||||
<<: *machine-linux-medium
|
||||
environment:
|
||||
<<: *env-linux-medium
|
||||
<<: *env-arm64
|
||||
<<: *env-release-build
|
||||
<<: *env-send-slack-notifications
|
||||
<<: *steps-chromedriver-build
|
||||
|
||||
linux-arm64-release:
|
||||
<<: *machine-linux-2xlarge
|
||||
environment:
|
||||
@@ -2089,9 +2001,9 @@ jobs:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-arm64
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True --custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True --custom-var=checkout_requests=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
@@ -2103,8 +2015,8 @@ jobs:
|
||||
<<: *env-linux-2xlarge-release
|
||||
<<: *env-arm64
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
@@ -2151,9 +2063,9 @@ jobs:
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_requests=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
@@ -2164,10 +2076,10 @@ jobs:
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
<<: *env-apple-silicon
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_requests=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
@@ -2178,8 +2090,8 @@ jobs:
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
@@ -2190,9 +2102,9 @@ jobs:
|
||||
environment:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
<<: *env-apple-silicon
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
@@ -2259,9 +2171,9 @@ jobs:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_requests=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
@@ -2273,9 +2185,9 @@ jobs:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas-apple-silicon
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_requests=True'
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: false
|
||||
@@ -2287,7 +2199,6 @@ jobs:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
steps:
|
||||
- electron-publish:
|
||||
@@ -2300,8 +2211,8 @@ jobs:
|
||||
<<: *env-mac-large-release
|
||||
<<: *env-mas-apple-silicon
|
||||
<<: *env-release-build
|
||||
<<: *env-enable-sccache
|
||||
UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >>
|
||||
<<: *env-ninja-status
|
||||
steps:
|
||||
- electron-publish:
|
||||
attach: true
|
||||
|
||||
@@ -4,4 +4,3 @@
|
||||
APPVEYOR_CLOUD_TOKEN=
|
||||
CIRCLE_TOKEN=
|
||||
ELECTRON_GITHUB_TOKEN=
|
||||
VSTS_TOKEN=
|
||||
@@ -8,45 +8,45 @@
|
||||
"rules": {
|
||||
"semi": ["error", "always"],
|
||||
"no-var": "error",
|
||||
"no-unused-vars": 0,
|
||||
"no-global-assign": 0,
|
||||
"guard-for-in": 2,
|
||||
"no-unused-vars": "off",
|
||||
"no-global-assign": "off",
|
||||
"guard-for-in": "error",
|
||||
"@typescript-eslint/no-unused-vars": ["error", {
|
||||
"vars": "all",
|
||||
"args": "after-used",
|
||||
"ignoreRestSiblings": false
|
||||
"ignoreRestSiblings": true
|
||||
}],
|
||||
"prefer-const": ["error", {
|
||||
"destructuring": "all"
|
||||
}],
|
||||
"standard/no-callback-literal": "off",
|
||||
"node/no-deprecated-api": 0
|
||||
"node/no-deprecated-api": "off"
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"globals": {
|
||||
"standardScheme": "readonly",
|
||||
"globalThis": "readonly",
|
||||
"BUILDFLAG": "readonly",
|
||||
"ENABLE_DESKTOP_CAPTURER": "readonly",
|
||||
"ENABLE_REMOTE_MODULE": "readonly",
|
||||
"ENABLE_VIEWS_API": "readonly",
|
||||
"BigInt": "readonly"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.js",
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": "*.ts",
|
||||
"rules": {
|
||||
"no-undef": "off",
|
||||
"no-redeclare": "off",
|
||||
"@typescript-eslint/no-redeclare": ["error"],
|
||||
"no-use-before-define": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": "*.d.ts",
|
||||
"rules": {
|
||||
"no-useless-constructor": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
"no-useless-constructor": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
9
.github/CODEOWNERS
vendored
9
.github/CODEOWNERS
vendored
@@ -10,3 +10,12 @@ DEPS @electron/wg-upgrades
|
||||
# Releases WG
|
||||
/npm/ @electron/wg-releases
|
||||
/script/release @electron/wg-releases
|
||||
|
||||
# Security WG
|
||||
/lib/browser/rpc-server.ts @electron/wg-security
|
||||
|
||||
# Remote Change Disliker
|
||||
/lib/browser/remote/ @nornagon
|
||||
/lib/renderer/remote/ @nornagon
|
||||
/lib/renderer/api/remote.ts @nornagon
|
||||
/docs/api/remote.md @nornagon
|
||||
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -13,9 +13,7 @@ Contributors guide: https://github.com/electron/electron/blob/master/CONTRIBUTIN
|
||||
- [ ] `npm test` passes
|
||||
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/master/docs/development/testing.md)
|
||||
- [ ] relevant documentation is changed or added
|
||||
- [ ] PR title follows semantic [commit guidelines](https://github.com/electron/electron/blob/master/docs/development/pull-requests.md#commit-message-guidelines)
|
||||
- [ ] [PR release notes](https://github.com/electron/clerk/blob/master/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/master/README.md#examples).
|
||||
- [ ] This is **NOT A BREAKING CHANGE**. Breaking changes may not be merged to master until 11-x-y is branched.
|
||||
|
||||
#### Release Notes
|
||||
|
||||
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -65,4 +65,9 @@ ts-gen
|
||||
|
||||
# Used to accelerate CI builds
|
||||
.depshash
|
||||
.depshash-target
|
||||
.depshash-target
|
||||
|
||||
# Used to accelerate builds after sync
|
||||
patches/mtime-cache.json
|
||||
|
||||
spec/fixtures/logo.png
|
||||
45
BUILD.gn
45
BUILD.gn
@@ -184,7 +184,6 @@ target_gen_default_app_js = "$target_gen_dir/js/default_app"
|
||||
|
||||
typescript_build("default_app_js") {
|
||||
deps = [ ":build_electron_definitions" ]
|
||||
type_root = rebase_path("$target_gen_dir/tsc/electron/typings")
|
||||
|
||||
sources = filenames.default_app_ts_sources
|
||||
|
||||
@@ -266,21 +265,6 @@ if (is_linux) {
|
||||
}
|
||||
}
|
||||
|
||||
source_set("manifests") {
|
||||
sources = [
|
||||
"//electron/shell/app/manifests.cc",
|
||||
"//electron/shell/app/manifests.h",
|
||||
]
|
||||
|
||||
include_dirs = [ "//electron" ]
|
||||
|
||||
deps = [
|
||||
"//electron/shell/common/api:mojo",
|
||||
"//printing/buildflags",
|
||||
"//services/service_manager/public/cpp",
|
||||
]
|
||||
}
|
||||
|
||||
npm_action("electron_version_args") {
|
||||
script = "generate-version-json"
|
||||
|
||||
@@ -303,6 +287,19 @@ templated_file("electron_version_header") {
|
||||
args_files = get_target_outputs(":electron_version_args")
|
||||
}
|
||||
|
||||
action("electron_fuses") {
|
||||
script = "build/fuses/build.py"
|
||||
|
||||
inputs = [ "build/fuses/fuses.json" ]
|
||||
|
||||
outputs = [
|
||||
"$target_gen_dir/fuses.h",
|
||||
"$target_gen_dir/fuses.cc",
|
||||
]
|
||||
|
||||
args = rebase_path(outputs)
|
||||
}
|
||||
|
||||
source_set("electron_lib") {
|
||||
configs += [ "//v8:external_startup_data" ]
|
||||
configs += [ "//third_party/electron_node:node_internals" ]
|
||||
@@ -313,9 +310,9 @@ source_set("electron_lib") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
":electron_fuses",
|
||||
":electron_js2c",
|
||||
":electron_version_header",
|
||||
":manifests",
|
||||
":resources",
|
||||
"buildflags",
|
||||
"chromium_src:chrome",
|
||||
@@ -340,7 +337,6 @@ source_set("electron_lib") {
|
||||
"//components/viz/service",
|
||||
"//content/public/browser",
|
||||
"//content/public/child",
|
||||
"//content/public/common:service_names",
|
||||
"//content/public/gpu",
|
||||
"//content/public/renderer",
|
||||
"//content/public/utility",
|
||||
@@ -495,6 +491,7 @@ source_set("electron_lib") {
|
||||
}
|
||||
}
|
||||
if (is_linux) {
|
||||
libs = [ "xshmfence" ]
|
||||
deps += [
|
||||
":libnotify_loader",
|
||||
"//build/config/linux/gtk",
|
||||
@@ -507,15 +504,13 @@ source_set("electron_lib") {
|
||||
"//ui/wm",
|
||||
]
|
||||
if (use_x11) {
|
||||
sources += filenames.lib_sources_linux_x11
|
||||
deps += [
|
||||
"//ui/gfx/x",
|
||||
"//ui/gtk/x",
|
||||
]
|
||||
}
|
||||
configs += [ ":gio_unix" ]
|
||||
if (use_x11) {
|
||||
deps += [ "//ui/gfx/x" ]
|
||||
}
|
||||
defines += [
|
||||
# Disable warnings for g_settings_list_schemas.
|
||||
"GLIB_DISABLE_DEPRECATION_WARNINGS",
|
||||
@@ -633,6 +628,7 @@ source_set("electron_lib") {
|
||||
"shell/common/extensions/api",
|
||||
"shell/common/extensions/api:extensions_features",
|
||||
"//chrome/browser/resources:component_extension_resources",
|
||||
"//components/update_client:update_client",
|
||||
"//components/zoom",
|
||||
"//extensions/browser",
|
||||
"//extensions/browser:core_api_provider",
|
||||
@@ -652,6 +648,7 @@ source_set("electron_lib") {
|
||||
}
|
||||
if (enable_pdf_viewer) {
|
||||
deps += [
|
||||
"//chrome/browser/resources/pdf:pdf_resources",
|
||||
"//components/pdf/browser",
|
||||
"//components/pdf/renderer",
|
||||
"//pdf:pdf_ppapi",
|
||||
@@ -662,6 +659,8 @@ source_set("electron_lib") {
|
||||
]
|
||||
}
|
||||
|
||||
sources += get_target_outputs(":electron_fuses")
|
||||
|
||||
if (is_win && enable_win_dark_mode_window_ui) {
|
||||
sources += [
|
||||
"shell/browser/win/dark_mode.cc",
|
||||
@@ -993,6 +992,9 @@ if (is_mac) {
|
||||
deps = [
|
||||
":electron_app_framework_bundle_data",
|
||||
":electron_app_resources",
|
||||
":electron_fuses",
|
||||
"//base",
|
||||
"//electron/buildflags",
|
||||
]
|
||||
if (is_mas_build) {
|
||||
deps += [ ":electron_login_helper_app" ]
|
||||
@@ -1145,6 +1147,7 @@ if (is_mac) {
|
||||
"wtsapi32.lib",
|
||||
]
|
||||
|
||||
configs -= [ "//build/config/win:console" ]
|
||||
configs += [
|
||||
"//build/config/win:windowed",
|
||||
"//build/config/win:delayloads",
|
||||
|
||||
57
DEPS
57
DEPS
@@ -14,19 +14,17 @@ gclient_gn_args = [
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'87.0.4280.141',
|
||||
'89.0.4389.128',
|
||||
'node_version':
|
||||
'v12.18.3',
|
||||
'v14.16.0',
|
||||
'nan_version':
|
||||
'2c4ee8a32a299eada3cd6e468bbd0a473bfea96d',
|
||||
'squirrel.mac_version':
|
||||
'a3a5b3f03b824441c014893b18f99a103b2603e9',
|
||||
'cdc0729c8bf8576bfef18629186e1e9ecf1b0d9f',
|
||||
|
||||
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
||||
'pyyaml_version': '3.12',
|
||||
'requests_version': 'e4d59bedfd3c7f4f254f4f5d036587bcd8152458',
|
||||
|
||||
'boto_git': 'https://github.com/boto',
|
||||
'chromium_git': 'https://chromium.googlesource.com',
|
||||
'electron_git': 'https://github.com/electron',
|
||||
'nodejs_git': 'https://github.com/nodejs',
|
||||
@@ -40,8 +38,8 @@ vars = {
|
||||
# To be able to build clean Chromium from sources.
|
||||
'apply_patches': True,
|
||||
|
||||
# Python interface to Amazon Web Services. Is used for releases only.
|
||||
'checkout_boto': False,
|
||||
# To use an mtime cache for patched files to speed up builds.
|
||||
'use_mtime_cache': True,
|
||||
|
||||
# To allow in-house builds to checkout those manually.
|
||||
'checkout_chromium': True,
|
||||
@@ -80,6 +78,8 @@ vars = {
|
||||
False,
|
||||
'checkout_google_benchmark':
|
||||
False,
|
||||
'checkout_clang_tidy':
|
||||
True,
|
||||
}
|
||||
|
||||
deps = {
|
||||
@@ -99,10 +99,6 @@ deps = {
|
||||
'url': (Var("yaml_git")) + '/pyyaml.git@' + (Var("pyyaml_version")),
|
||||
'condition': 'checkout_pyyaml and process_deps',
|
||||
},
|
||||
'src/electron/vendor/boto': {
|
||||
'url': Var('boto_git') + '/boto.git' + '@' + Var('boto_version'),
|
||||
'condition': 'checkout_boto and process_deps',
|
||||
},
|
||||
'src/electron/vendor/requests': {
|
||||
'url': Var('requests_git') + '/requests.git' + '@' + Var('requests_version'),
|
||||
'condition': 'checkout_requests and process_deps',
|
||||
@@ -121,6 +117,23 @@ deps = {
|
||||
}
|
||||
}
|
||||
|
||||
pre_deps_hooks = [
|
||||
{
|
||||
'name': 'generate_mtime_cache',
|
||||
'condition': '(checkout_chromium and apply_patches and use_mtime_cache) and process_deps',
|
||||
'pattern': 'src/electron',
|
||||
'action': [
|
||||
'python3',
|
||||
'src/electron/script/patches-mtime-cache.py',
|
||||
'generate',
|
||||
'--cache-file',
|
||||
'src/electron/patches/mtime-cache.json',
|
||||
'--patches-config',
|
||||
'src/electron/patches/config.json',
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
hooks = [
|
||||
{
|
||||
'name': 'patch_chromium',
|
||||
@@ -132,6 +145,18 @@ hooks = [
|
||||
'src/electron/patches/config.json',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'apply_mtime_cache',
|
||||
'condition': '(checkout_chromium and apply_patches and use_mtime_cache) and process_deps',
|
||||
'pattern': 'src/electron',
|
||||
'action': [
|
||||
'python3',
|
||||
'src/electron/script/patches-mtime-cache.py',
|
||||
'apply',
|
||||
'--cache-file',
|
||||
'src/electron/patches/mtime-cache.json',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'electron_external_binaries',
|
||||
'pattern': 'src/electron/script/update-external-binaries.py',
|
||||
@@ -150,16 +175,6 @@ hooks = [
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npx.py", "yarn@' + (Var("yarn_version")) + '", "install", "--frozen-lockfile"]);',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'setup_boto',
|
||||
'pattern': 'src/electron',
|
||||
'condition': 'checkout_boto and process_deps',
|
||||
'action': [
|
||||
'python3',
|
||||
'-c',
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron", "vendor", "boto")); subprocess.check_call(["python", "setup.py", "build"]);',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'setup_requests',
|
||||
'pattern': 'src/electron',
|
||||
|
||||
@@ -1 +1 @@
|
||||
11.2.2
|
||||
12.0.5
|
||||
@@ -4,6 +4,7 @@
|
||||
[](https://circleci.com/gh/electron/electron/tree/master)
|
||||
[](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/master)
|
||||
[](https://david-dm.org/electron/electron?type=dev)
|
||||
[](https://discord.com/invite/electron)
|
||||
|
||||
:memo: Available Translations: 🇨🇳 🇹🇼 🇧🇷 🇪🇸 🇰🇷 🇯🇵 🇷🇺 🇫🇷 🇹🇭 🇳🇱 🇹🇷 🇮🇩 🇺🇦 🇨🇿 🇮🇹 🇵🇱.
|
||||
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).
|
||||
|
||||
38
appveyor.yml
38
appveyor.yml
@@ -36,6 +36,7 @@ environment:
|
||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
|
||||
GOMA_FALLBACK_ON_AUTH_FAILURE: true
|
||||
notifications:
|
||||
- provider: Webhook
|
||||
url: https://electron-mission-control.herokuapp.com/rest/appveyor-hook
|
||||
@@ -66,10 +67,9 @@ build_script:
|
||||
- update_depot_tools.bat
|
||||
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
|
||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||
- ps: $env:SCCACHE_PATH="$pwd\src\electron\external_binaries\sccache.exe"
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
$env:GCLIENT_EXTRA_ARGS="$env:GCLIENT_EXTRA_ARGS --custom-var=checkout_boto=True --custom-var=checkout_requests=True"
|
||||
$env:GCLIENT_EXTRA_ARGS="$env:GCLIENT_EXTRA_ARGS --custom-var=checkout_requests=True"
|
||||
} else {
|
||||
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
|
||||
}
|
||||
@@ -127,34 +127,32 @@ build_script:
|
||||
}
|
||||
# build time generation of file gen/angle/angle_commit.h depends on
|
||||
# third_party/angle/.git
|
||||
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
|
||||
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
|
||||
$(7z a $zipfile src\third_party\angle\.git)
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-warning "Failed to add third_party\angle\.git; continuing anyway"
|
||||
}
|
||||
}
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -ne 'release') {
|
||||
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
||||
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
|
||||
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
|
||||
}
|
||||
git clone https://github.com/electron/build-tools.git
|
||||
cd build-tools
|
||||
npm install
|
||||
mkdir third_party
|
||||
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
|
||||
$env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
|
||||
$env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
|
||||
cd ..
|
||||
.\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
|
||||
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
||||
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
|
||||
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
|
||||
}
|
||||
- git clone https://github.com/electron/build-tools.git
|
||||
- cd build-tools
|
||||
- npm install
|
||||
- mkdir third_party
|
||||
- ps: >-
|
||||
node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
|
||||
- ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
|
||||
- ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
|
||||
- cd ..
|
||||
- ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
|
||||
- cd src
|
||||
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
|
||||
- if DEFINED GN_GOMA_FILE (gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% ") else (gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") %GN_EXTRA_ARGS% cc_wrapper=\"%SCCACHE_PATH%\"")
|
||||
- gn 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:manifests
|
||||
- gn check out/Default //electron/shell/common/api:mojo
|
||||
- if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
|
||||
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
|
||||
@@ -170,7 +168,7 @@ build_script:
|
||||
- ninja -C out/Default electron:hunspell_dictionaries_zip
|
||||
- ninja -C out/Default electron:electron_chromedriver_zip
|
||||
- ninja -C out/Default third_party/electron_node:headers
|
||||
- if "%GN_CONFIG%"=="testing" ( python %LOCAL_GOMA_DIR%\goma_ctl.py stat )
|
||||
- python %LOCAL_GOMA_DIR%\goma_ctl.py stat
|
||||
- python electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
||||
- appveyor PushArtifact out/Default/windows_toolchain_profile.json
|
||||
- appveyor PushArtifact out/Default/dist.zip
|
||||
|
||||
@@ -93,6 +93,6 @@ steps:
|
||||
condition: always()
|
||||
|
||||
- powershell: |
|
||||
Remove-Item -path $env:APPDATA/Electron* -Recurse
|
||||
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" ]
|
||||
|
||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
|
||||
node_module_version = 85
|
||||
node_module_version = 87
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_typed_array_max_size_in_heap = 0
|
||||
|
||||
101
build/fuses/build.py
Executable file
101
build/fuses/build.py
Executable file
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
SENTINEL = "dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX"
|
||||
|
||||
TEMPLATE_H = """
|
||||
#ifndef ELECTRON_FUSES_H_
|
||||
#define ELECTRON_FUSES_H_
|
||||
|
||||
#if defined(WIN32)
|
||||
#define FUSE_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define FUSE_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
namespace electron {
|
||||
|
||||
namespace fuses {
|
||||
|
||||
extern const volatile char kFuseWire[];
|
||||
|
||||
{getters}
|
||||
|
||||
} // namespace fuses
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // ELECTRON_FUSES_H_
|
||||
"""
|
||||
|
||||
TEMPLATE_CC = """
|
||||
#include "electron/fuses.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
namespace fuses {
|
||||
|
||||
const volatile char kFuseWire[] = { /* sentinel */ {sentinel}, /* fuse_version */ {fuse_version}, /* fuse_wire_length */ {fuse_wire_length}, /* fuse_wire */ {initial_config}};
|
||||
|
||||
{getters}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
"""
|
||||
|
||||
with open(os.path.join(dir_path, "fuses.json"), 'r') as f:
|
||||
fuse_defaults = json.load(f)
|
||||
|
||||
fuse_version = fuse_defaults['_version']
|
||||
del fuse_defaults['_version']
|
||||
del fuse_defaults['_schema']
|
||||
del fuse_defaults['_comment']
|
||||
|
||||
if fuse_version >= pow(2, 8):
|
||||
raise Exception("Fuse version can not exceed one byte in size")
|
||||
|
||||
fuses = fuse_defaults.keys()
|
||||
|
||||
initial_config = ""
|
||||
getters_h = ""
|
||||
getters_cc = ""
|
||||
index = len(SENTINEL) + 1
|
||||
for fuse in fuses:
|
||||
index += 1
|
||||
initial_config += fuse_defaults[fuse]
|
||||
name = ''.join(word.title() for word in fuse.split('_'))
|
||||
getters_h += "FUSE_EXPORT bool Is{name}Enabled();\n".replace("{name}", name)
|
||||
getters_cc += """
|
||||
bool Is{name}Enabled() {
|
||||
return kFuseWire[{index}] == '1';
|
||||
}
|
||||
""".replace("{name}", name).replace("{index}", str(index))
|
||||
|
||||
def c_hex(n):
|
||||
s = hex(n)[2:]
|
||||
return "0x" + s.rjust(2, '0')
|
||||
|
||||
def hex_arr(s):
|
||||
arr = []
|
||||
for char in s:
|
||||
arr.append(c_hex(ord(char)))
|
||||
return ",".join(arr)
|
||||
|
||||
header = TEMPLATE_H.replace("{getters}", getters_h.strip())
|
||||
impl = TEMPLATE_CC.replace("{sentinel}", hex_arr(SENTINEL))
|
||||
impl = impl.replace("{fuse_version}", c_hex(fuse_version))
|
||||
impl = impl.replace("{fuse_wire_length}", c_hex(len(fuses)))
|
||||
impl = impl.replace("{initial_config}", hex_arr(initial_config))
|
||||
impl = impl.replace("{getters}", getters_cc.strip())
|
||||
|
||||
with open(sys.argv[1], 'w') as f:
|
||||
f.write(header)
|
||||
|
||||
with open(sys.argv[2], 'w') as f:
|
||||
f.write(impl)
|
||||
6
build/fuses/fuses.json
Normal file
6
build/fuses/fuses.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"_comment": "Modifying the fuse schema in any breaking way should result in the _version prop being incremented. NEVER remove a fuse or change its meaning, instead mark it as removed with 'r'",
|
||||
"_schema": "0 == off, 1 == on, r == removed fuse",
|
||||
"_version": 1,
|
||||
"run_as_node": "1"
|
||||
}
|
||||
@@ -15,5 +15,12 @@ args = [cmd, "run",
|
||||
try:
|
||||
subprocess.check_output(args, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("NPM script '" + sys.argv[2] + "' failed with code '" + str(e.returncode) + "':\n" + e.output)
|
||||
print(
|
||||
"NPM script '"
|
||||
+ sys.argv[2]
|
||||
+ "' failed with code '"
|
||||
+ str(e.returncode)
|
||||
+ "':\n"
|
||||
+ e.output
|
||||
)
|
||||
sys.exit(e.returncode)
|
||||
|
||||
@@ -11,7 +11,6 @@ import find_depot_tools
|
||||
from vs_toolchain import \
|
||||
SetEnvironmentAndGetRuntimeDllDirs, \
|
||||
SetEnvironmentAndGetSDKDir, \
|
||||
GetVisualStudioVersion, \
|
||||
NormalizePath
|
||||
|
||||
sys.path.append("%s/win_toolchain" % find_depot_tools.add_depot_tools_to_path())
|
||||
@@ -20,10 +19,10 @@ from get_toolchain_if_necessary import CalculateHash
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def cwd(dir):
|
||||
def cwd(directory):
|
||||
curdir = os.getcwd()
|
||||
try:
|
||||
os.chdir(dir)
|
||||
os.chdir(directory)
|
||||
yield
|
||||
finally:
|
||||
os.chdir(curdir)
|
||||
@@ -71,12 +70,18 @@ def windows_profile():
|
||||
win_sdk_dir = SetEnvironmentAndGetSDKDir()
|
||||
path = NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH'])
|
||||
|
||||
# since current windows executable are symbols path dependant,
|
||||
# profile the current directory too
|
||||
return {
|
||||
'pwd': os.getcwd(), # since current windows executable are symbols path dependant, profile the current directory too
|
||||
'pwd': os.getcwd(),
|
||||
'installed_software': windows_installed_software(),
|
||||
'sdks': [
|
||||
{'name': 'vs', 'path': path, 'hash': calculate_hash(path)},
|
||||
{'name': 'wsdk', 'path': win_sdk_dir, 'hash': calculate_hash(win_sdk_dir)}
|
||||
{
|
||||
'name': 'wsdk',
|
||||
'path': win_sdk_dir,
|
||||
'hash': calculate_hash(win_sdk_dir),
|
||||
},
|
||||
],
|
||||
'runtime_lib_dirs': runtime_dll_dirs,
|
||||
}
|
||||
@@ -94,5 +99,5 @@ if __name__ == '__main__':
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option('--output-json', metavar='FILE', default='profile.json',
|
||||
help='write information about toolchain to FILE')
|
||||
options, args = parser.parse_args()
|
||||
sys.exit(main(options))
|
||||
opts, args = parser.parse_args()
|
||||
sys.exit(main(opts))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
def main(argv):
|
||||
cwd = argv[1]
|
||||
|
||||
@@ -12,5 +12,7 @@ subprocess.check_output(["rm", "-rf", dest])
|
||||
subprocess.check_output(["cp", "-a", source, dest])
|
||||
|
||||
# Strip headers, we do not need to ship them
|
||||
subprocess.check_output(["rm", "-r", os.path.join(dest, 'Headers')])
|
||||
subprocess.check_output(["rm", "-r", os.path.join(dest, 'Versions', 'Current', 'Headers')])
|
||||
subprocess.check_output(["rm", "-r", os.path.join(dest, "Headers")])
|
||||
subprocess.check_output(
|
||||
["rm", "-r", os.path.join(dest, "Versions", "Current", "Headers")]
|
||||
)
|
||||
|
||||
@@ -26,19 +26,12 @@ template("typescript_build") {
|
||||
"//electron/typings/internal-electron.d.ts",
|
||||
]
|
||||
|
||||
type_roots = "node_modules/@types,typings"
|
||||
if (defined(invoker.type_root)) {
|
||||
type_roots += "," + invoker.type_root
|
||||
}
|
||||
|
||||
base_out_path = invoker.output_gen_dir + "/electron/"
|
||||
args = [
|
||||
"-p",
|
||||
rebase_path(invoker.tsconfig),
|
||||
"--outDir",
|
||||
rebase_path("$base_out_path" + invoker.output_dir_name),
|
||||
"--typeRoots",
|
||||
type_roots,
|
||||
]
|
||||
|
||||
outputs = []
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
process.env.PRINT_WEBPACK_GRAPH = true;
|
||||
require('./run-compiler');
|
||||
@@ -1,45 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const configPath = process.argv[2];
|
||||
const outPath = path.resolve(process.argv[3]);
|
||||
const config = require(configPath);
|
||||
config.output = {
|
||||
path: path.dirname(outPath),
|
||||
filename: path.basename(outPath)
|
||||
};
|
||||
|
||||
const { wrapInitWithProfilingTimeout, wrapInitWithTryCatch, ...webpackConfig } = config;
|
||||
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
} else if (stats.hasErrors()) {
|
||||
console.error(stats.toString('normal'));
|
||||
process.exit(1);
|
||||
} else {
|
||||
let contents = fs.readFileSync(outPath, 'utf8');
|
||||
if (wrapInitWithTryCatch) {
|
||||
contents = `try {
|
||||
${contents}
|
||||
} catch (err) {
|
||||
console.error('Electron ${webpackConfig.output.filename} script failed to run');
|
||||
console.error(err);
|
||||
}`;
|
||||
}
|
||||
if (wrapInitWithProfilingTimeout) {
|
||||
contents = `function ___electron_webpack_init__() {
|
||||
${contents}
|
||||
};
|
||||
if ((globalThis.process || binding.process).argv.includes("--profile-electron-init")) {
|
||||
setTimeout(___electron_webpack_init__, 0);
|
||||
} else {
|
||||
___electron_webpack_init__();
|
||||
}`;
|
||||
}
|
||||
fs.writeFileSync(outPath, contents);
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
@@ -2,16 +2,12 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const WrapperPlugin = require('wrapper-webpack-plugin');
|
||||
|
||||
const electronRoot = path.resolve(__dirname, '../..');
|
||||
|
||||
const onlyPrintingGraph = !!process.env.PRINT_WEBPACK_GRAPH;
|
||||
|
||||
class AccessDependenciesPlugin {
|
||||
apply (compiler) {
|
||||
// Only hook into webpack when we are printing the dependency graph
|
||||
if (!onlyPrintingGraph) return;
|
||||
|
||||
compiler.hooks.compilation.tap('AccessDependenciesPlugin', compilation => {
|
||||
compilation.hooks.finishModules.tap('AccessDependenciesPlugin', modules => {
|
||||
const filePaths = modules.map(m => m.resource).filter(p => p).map(p => path.relative(electronRoot, p));
|
||||
@@ -21,49 +17,6 @@ class AccessDependenciesPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
const defines = {
|
||||
BUILDFLAG: onlyPrintingGraph ? '(a => a)' : ''
|
||||
};
|
||||
|
||||
const buildFlagsPrefix = '--buildflags=';
|
||||
const buildFlagArg = process.argv.find(arg => arg.startsWith(buildFlagsPrefix));
|
||||
|
||||
if (buildFlagArg) {
|
||||
const buildFlagPath = buildFlagArg.substr(buildFlagsPrefix.length);
|
||||
|
||||
const flagFile = fs.readFileSync(buildFlagPath, 'utf8');
|
||||
for (const line of flagFile.split(/(\r\n|\r|\n)/g)) {
|
||||
const flagMatch = line.match(/#define BUILDFLAG_INTERNAL_(.+?)\(\) \(([01])\)/);
|
||||
if (flagMatch) {
|
||||
const [, flagName, flagValue] = flagMatch;
|
||||
defines[flagName] = JSON.stringify(Boolean(parseInt(flagValue, 10)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ignoredModules = [];
|
||||
|
||||
if (defines.ENABLE_DESKTOP_CAPTURER === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/desktop-capturer',
|
||||
'@electron/internal/browser/api/desktop-capturer',
|
||||
'@electron/internal/renderer/api/desktop-capturer'
|
||||
);
|
||||
}
|
||||
|
||||
if (defines.ENABLE_REMOTE_MODULE === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/remote/server',
|
||||
'@electron/internal/renderer/api/remote'
|
||||
);
|
||||
}
|
||||
|
||||
if (defines.ENABLE_VIEWS_API === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/api/views/image-view.js'
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = ({
|
||||
alwaysHasNode,
|
||||
loadElectronFromAlternateTarget,
|
||||
@@ -79,76 +32,148 @@ module.exports = ({
|
||||
|
||||
const electronAPIFile = path.resolve(electronRoot, 'lib', loadElectronFromAlternateTarget || target, 'api', 'exports', 'electron.ts');
|
||||
|
||||
return ({
|
||||
mode: 'development',
|
||||
devtool: false,
|
||||
entry,
|
||||
target: alwaysHasNode ? 'node' : 'web',
|
||||
output: {
|
||||
filename: `${target}.bundle.js`
|
||||
},
|
||||
wrapInitWithProfilingTimeout,
|
||||
wrapInitWithTryCatch,
|
||||
resolve: {
|
||||
alias: {
|
||||
'@electron/internal': path.resolve(electronRoot, 'lib'),
|
||||
electron$: electronAPIFile,
|
||||
'electron/main$': electronAPIFile,
|
||||
'electron/renderer$': electronAPIFile,
|
||||
'electron/common$': electronAPIFile,
|
||||
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
||||
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||
},
|
||||
extensions: ['.ts', '.js']
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: (moduleName) => !onlyPrintingGraph && ignoredModules.includes(moduleName),
|
||||
loader: 'null-loader'
|
||||
}, {
|
||||
test: /\.ts$/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
configFile: path.resolve(electronRoot, 'tsconfig.electron.json'),
|
||||
transpileOnly: onlyPrintingGraph,
|
||||
ignoreDiagnostics: [
|
||||
// File '{0}' is not under 'rootDir' '{1}'.
|
||||
6059
|
||||
]
|
||||
return (env = {}, argv = {}) => {
|
||||
const onlyPrintingGraph = !!env.PRINT_WEBPACK_GRAPH;
|
||||
const outputFilename = argv['output-filename'] || `${target}.bundle.js`;
|
||||
|
||||
const defines = {
|
||||
BUILDFLAG: onlyPrintingGraph ? '(a => a)' : ''
|
||||
};
|
||||
|
||||
if (env.buildflags) {
|
||||
const flagFile = fs.readFileSync(env.buildflags, 'utf8');
|
||||
for (const line of flagFile.split(/(\r\n|\r|\n)/g)) {
|
||||
const flagMatch = line.match(/#define BUILDFLAG_INTERNAL_(.+?)\(\) \(([01])\)/);
|
||||
if (flagMatch) {
|
||||
const [, flagName, flagValue] = flagMatch;
|
||||
defines[flagName] = JSON.stringify(Boolean(parseInt(flagValue, 10)));
|
||||
}
|
||||
}]
|
||||
},
|
||||
node: {
|
||||
__dirname: false,
|
||||
__filename: false,
|
||||
// We provide our own "timers" import above, any usage of setImmediate inside
|
||||
// one of our renderer bundles should import it from the 'timers' package
|
||||
setImmediate: false
|
||||
},
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
keep_fnames: true
|
||||
}
|
||||
})
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new AccessDependenciesPlugin(),
|
||||
...(targetDeletesNodeGlobals ? [
|
||||
new webpack.ProvidePlugin({
|
||||
process: ['@electron/internal/common/webpack-provider', 'process'],
|
||||
global: ['@electron/internal/common/webpack-provider', '_global'],
|
||||
Buffer: ['@electron/internal/common/webpack-provider', 'Buffer']
|
||||
})
|
||||
] : []),
|
||||
new webpack.ProvidePlugin({
|
||||
Promise: ['@electron/internal/common/webpack-globals-provider', 'Promise']
|
||||
}),
|
||||
new webpack.DefinePlugin(defines)
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const ignoredModules = [];
|
||||
|
||||
if (defines.ENABLE_DESKTOP_CAPTURER === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/desktop-capturer',
|
||||
'@electron/internal/browser/api/desktop-capturer',
|
||||
'@electron/internal/renderer/api/desktop-capturer'
|
||||
);
|
||||
}
|
||||
|
||||
if (defines.ENABLE_REMOTE_MODULE === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/remote/server',
|
||||
'@electron/internal/renderer/api/remote'
|
||||
);
|
||||
}
|
||||
|
||||
if (defines.ENABLE_VIEWS_API === 'false') {
|
||||
ignoredModules.push(
|
||||
'@electron/internal/browser/api/views/image-view.js'
|
||||
);
|
||||
}
|
||||
|
||||
const plugins = [];
|
||||
|
||||
if (onlyPrintingGraph) {
|
||||
plugins.push(new AccessDependenciesPlugin());
|
||||
}
|
||||
|
||||
if (targetDeletesNodeGlobals) {
|
||||
plugins.push(new webpack.ProvidePlugin({
|
||||
process: ['@electron/internal/common/webpack-provider', 'process'],
|
||||
global: ['@electron/internal/common/webpack-provider', '_global'],
|
||||
Buffer: ['@electron/internal/common/webpack-provider', 'Buffer']
|
||||
}));
|
||||
}
|
||||
|
||||
plugins.push(new webpack.ProvidePlugin({
|
||||
Promise: ['@electron/internal/common/webpack-globals-provider', 'Promise']
|
||||
}));
|
||||
|
||||
plugins.push(new webpack.DefinePlugin(defines));
|
||||
|
||||
if (wrapInitWithProfilingTimeout) {
|
||||
plugins.push(new WrapperPlugin({
|
||||
header: 'function ___electron_webpack_init__() {',
|
||||
footer: `
|
||||
};
|
||||
if ((globalThis.process || binding.process).argv.includes("--profile-electron-init")) {
|
||||
setTimeout(___electron_webpack_init__, 0);
|
||||
} else {
|
||||
___electron_webpack_init__();
|
||||
}`
|
||||
}));
|
||||
}
|
||||
|
||||
if (wrapInitWithTryCatch) {
|
||||
plugins.push(new WrapperPlugin({
|
||||
header: 'try {',
|
||||
footer: `
|
||||
} catch (err) {
|
||||
console.error('Electron ${outputFilename} script failed to run');
|
||||
console.error(err);
|
||||
}`
|
||||
}));
|
||||
}
|
||||
|
||||
return {
|
||||
mode: 'development',
|
||||
devtool: false,
|
||||
entry,
|
||||
target: alwaysHasNode ? 'node' : 'web',
|
||||
output: {
|
||||
filename: outputFilename
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@electron/internal': path.resolve(electronRoot, 'lib'),
|
||||
electron$: electronAPIFile,
|
||||
'electron/main$': electronAPIFile,
|
||||
'electron/renderer$': electronAPIFile,
|
||||
'electron/common$': electronAPIFile,
|
||||
// Force timers to resolve to our dependency that doesn't use window.postMessage
|
||||
timers: path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||
},
|
||||
extensions: ['.ts', '.js']
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: (moduleName) => !onlyPrintingGraph && ignoredModules.includes(moduleName),
|
||||
loader: 'null-loader'
|
||||
}, {
|
||||
test: /\.ts$/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
configFile: path.resolve(electronRoot, 'tsconfig.electron.json'),
|
||||
transpileOnly: onlyPrintingGraph,
|
||||
ignoreDiagnostics: [
|
||||
// File '{0}' is not under 'rootDir' '{1}'.
|
||||
6059
|
||||
]
|
||||
}
|
||||
}]
|
||||
},
|
||||
node: {
|
||||
__dirname: false,
|
||||
__filename: false,
|
||||
// We provide our own "timers" import above, any usage of setImmediate inside
|
||||
// one of our renderer bundles should import it from the 'timers' package
|
||||
setImmediate: false
|
||||
},
|
||||
optimization: {
|
||||
minimize: env.mode === 'production',
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
keep_fnames: true
|
||||
}
|
||||
})
|
||||
]
|
||||
},
|
||||
plugins
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -16,17 +16,25 @@ template("webpack_build") {
|
||||
inputs = [
|
||||
invoker.config_file,
|
||||
"//electron/build/webpack/webpack.config.base.js",
|
||||
"//electron/build/webpack/run-compiler.js",
|
||||
"//electron/tsconfig.json",
|
||||
"//electron/yarn.lock",
|
||||
"//electron/typings/internal-ambient.d.ts",
|
||||
"//electron/typings/internal-electron.d.ts",
|
||||
] + invoker.inputs
|
||||
|
||||
mode = "development"
|
||||
if (is_official_build) {
|
||||
mode = "production"
|
||||
}
|
||||
|
||||
args = [
|
||||
"--config",
|
||||
rebase_path(invoker.config_file),
|
||||
rebase_path(invoker.out_file),
|
||||
"--buildflags=" + rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
"--output-filename=" + get_path_info(invoker.out_file, "file"),
|
||||
"--output-path=" + rebase_path(get_path_info(invoker.out_file, "dir")),
|
||||
"--env.buildflags=" +
|
||||
rebase_path("$target_gen_dir/buildflags/buildflags.h"),
|
||||
"--env.mode=" + mode,
|
||||
]
|
||||
deps += [ "buildflags" ]
|
||||
|
||||
|
||||
42
build/zip.py
42
build/zip.py
@@ -9,7 +9,8 @@ EXTENSIONS_TO_SKIP = [
|
||||
'.pdb',
|
||||
'.mojom.js',
|
||||
'.mojom-lite.js',
|
||||
'.info'
|
||||
'.info',
|
||||
'.m.js'
|
||||
]
|
||||
|
||||
PATHS_TO_SKIP = [
|
||||
@@ -19,11 +20,12 @@ PATHS_TO_SKIP = [
|
||||
'./libVkICD_mock_',
|
||||
# Skip because these are outputs that we don't need.
|
||||
'./VkICD_mock_',
|
||||
# Skip because its an output of create_bundle from //build/config/mac/rules.gni
|
||||
# that we don't need
|
||||
# Skip because its an output of create_bundle from
|
||||
# //build/config/mac/rules.gni that we don't need
|
||||
'Electron.dSYM',
|
||||
# Refs https://chromium-review.googlesource.com/c/angle/angle/+/2425197.
|
||||
# Remove this when Angle themselves remove the file: https://issuetracker.google.com/issues/168736059
|
||||
# Remove this when Angle themselves remove the file:
|
||||
# https://issuetracker.google.com/issues/168736059
|
||||
'gen/angle/angle_commit.h',
|
||||
# //chrome/browser:resources depends on this via
|
||||
# //chrome/browser/resources/ssl/ssl_error_assistant, but we don't need to
|
||||
@@ -49,7 +51,12 @@ def skip_path(dep, dist_zip, target_cpu):
|
||||
should_skip = (
|
||||
any(dep.startswith(path) for path in PATHS_TO_SKIP) or
|
||||
any(dep.endswith(ext) for ext in EXTENSIONS_TO_SKIP) or
|
||||
('arm' in target_cpu and dist_zip == 'mksnapshot.zip' and dep == 'snapshot_blob.bin'))
|
||||
(
|
||||
"arm" in target_cpu
|
||||
and dist_zip == "mksnapshot.zip"
|
||||
and dep == "snapshot_blob.bin"
|
||||
)
|
||||
)
|
||||
if should_skip:
|
||||
print("Skipping {}".format(dep))
|
||||
return should_skip
|
||||
@@ -63,7 +70,7 @@ def execute(argv):
|
||||
raise e
|
||||
|
||||
def main(argv):
|
||||
dist_zip, runtime_deps, target_cpu, target_os, flatten_val = argv
|
||||
dist_zip, runtime_deps, target_cpu, _, flatten_val = argv
|
||||
should_flatten = flatten_val == "true"
|
||||
dist_files = set()
|
||||
with open(runtime_deps) as f:
|
||||
@@ -74,17 +81,28 @@ def main(argv):
|
||||
if sys.platform == 'darwin' and not should_flatten:
|
||||
execute(['zip', '-r', '-y', dist_zip] + list(dist_files))
|
||||
else:
|
||||
with zipfile.ZipFile(dist_zip, 'w', zipfile.ZIP_DEFLATED, allowZip64=True) as z:
|
||||
with zipfile.ZipFile(
|
||||
dist_zip, 'w', zipfile.ZIP_DEFLATED, allowZip64=True
|
||||
) as z:
|
||||
for dep in dist_files:
|
||||
if os.path.isdir(dep):
|
||||
for root, dirs, files in os.walk(dep):
|
||||
for file in files:
|
||||
z.write(os.path.join(root, file))
|
||||
for root, _, files in os.walk(dep):
|
||||
for filename in files:
|
||||
z.write(os.path.join(root, filename))
|
||||
else:
|
||||
basename = os.path.basename(dep)
|
||||
dirname = os.path.dirname(dep)
|
||||
arcname = os.path.join(dirname, 'chrome-sandbox') if basename == 'chrome_sandbox' else dep
|
||||
z.write(dep, os.path.basename(arcname) if should_flatten else arcname)
|
||||
arcname = (
|
||||
os.path.join(dirname, 'chrome-sandbox')
|
||||
if basename == 'chrome_sandbox'
|
||||
else dep
|
||||
)
|
||||
z.write(
|
||||
dep,
|
||||
os.path.basename(arcname)
|
||||
if should_flatten
|
||||
else arcname,
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
|
||||
@@ -14,7 +14,6 @@ buildflag_header("buildflags") {
|
||||
"ENABLE_OSR=$enable_osr",
|
||||
"ENABLE_REMOTE_MODULE=$enable_remote_module",
|
||||
"ENABLE_VIEWS_API=$enable_views_api",
|
||||
"ENABLE_PEPPER_FLASH=$enable_pepper_flash",
|
||||
"ENABLE_PDF_VIEWER=$enable_pdf_viewer",
|
||||
"ENABLE_TTS=$enable_tts",
|
||||
"ENABLE_COLOR_CHOOSER=$enable_color_chooser",
|
||||
|
||||
@@ -28,9 +28,6 @@ declare_args() {
|
||||
# Should not be enabled for release build.
|
||||
enable_fake_location_provider = !is_official_build
|
||||
|
||||
# Enable flash plugin support.
|
||||
enable_pepper_flash = true
|
||||
|
||||
# Enable Chrome extensions support.
|
||||
enable_electron_extensions = true
|
||||
|
||||
|
||||
@@ -93,9 +93,18 @@ static_library("chrome") {
|
||||
|
||||
if (is_linux) {
|
||||
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
|
||||
if (use_x11) {
|
||||
sources += [
|
||||
"//chrome/browser/extensions/global_shortcut_listener_x11.cc",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_x11.h",
|
||||
]
|
||||
} else if (use_ozone) {
|
||||
sources += [
|
||||
"//chrome/browser/extensions/global_shortcut_listener_ozone.cc",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_ozone.h",
|
||||
]
|
||||
}
|
||||
sources += [
|
||||
"//chrome/browser/extensions/global_shortcut_listener_x11.cc",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_x11.h",
|
||||
"//chrome/browser/ui/views/status_icons/concat_menu_model.cc",
|
||||
"//chrome/browser/ui/views/status_icons/concat_menu_model.h",
|
||||
"//chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc",
|
||||
@@ -208,8 +217,6 @@ static_library("chrome") {
|
||||
"//chrome/browser/printing/print_view_manager_basic.h",
|
||||
"//chrome/browser/printing/printer_query.cc",
|
||||
"//chrome/browser/printing/printer_query.h",
|
||||
"//chrome/browser/printing/printing_message_filter.cc",
|
||||
"//chrome/browser/printing/printing_message_filter.h",
|
||||
"//chrome/browser/printing/printing_service.cc",
|
||||
"//chrome/browser/printing/printing_service.h",
|
||||
]
|
||||
@@ -307,8 +314,6 @@ source_set("plugins") {
|
||||
sources += [
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc",
|
||||
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
|
||||
]
|
||||
@@ -321,26 +326,6 @@ source_set("plugins") {
|
||||
if (enable_pdf_viewer) {
|
||||
deps += [ "//components/pdf/browser" ]
|
||||
}
|
||||
if (enable_pepper_flash) {
|
||||
sources += [
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc",
|
||||
"//chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h",
|
||||
]
|
||||
if (is_mac) {
|
||||
sources += [
|
||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.h",
|
||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.mm",
|
||||
]
|
||||
frameworks += [ "CoreGraphics.framework" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
deps += [ "//components/services/font/public/cpp" ]
|
||||
}
|
||||
}
|
||||
|
||||
# renderer side
|
||||
sources += [
|
||||
@@ -349,19 +334,7 @@ source_set("plugins") {
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
|
||||
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
|
||||
]
|
||||
if (enable_pepper_flash) {
|
||||
sources += [
|
||||
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_drm_renderer_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_fullscreen_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_fullscreen_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_menu_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_menu_host.h",
|
||||
"//chrome/renderer/pepper/pepper_flash_renderer_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_renderer_host.h",
|
||||
]
|
||||
}
|
||||
if (enable_pepper_flash || enable_pdf_viewer) {
|
||||
if (enable_pdf_viewer) {
|
||||
sources += [
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
|
||||
"//chrome/renderer/pepper/pepper_flash_font_file_host.h",
|
||||
@@ -388,6 +361,7 @@ source_set("chrome_spellchecker") {
|
||||
sources = []
|
||||
deps = []
|
||||
libs = []
|
||||
public_deps = []
|
||||
|
||||
if (enable_builtin_spellchecker) {
|
||||
sources += [
|
||||
@@ -405,7 +379,6 @@ source_set("chrome_spellchecker") {
|
||||
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_service.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_service.h",
|
||||
"//chrome/common/pref_names.h",
|
||||
]
|
||||
|
||||
if (has_spellcheck_panel) {
|
||||
@@ -428,9 +401,11 @@ source_set("chrome_spellchecker") {
|
||||
"//components/spellcheck:buildflags",
|
||||
"//components/sync",
|
||||
]
|
||||
|
||||
public_deps += [ "//chrome/common:constants" ]
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
public_deps += [
|
||||
"//components/spellcheck/browser",
|
||||
"//components/spellcheck/common",
|
||||
"//components/spellcheck/renderer",
|
||||
|
||||
@@ -18,27 +18,20 @@ an issue:
|
||||
|
||||
## Guides and Tutorials
|
||||
|
||||
* [Setting up the Development Environment](tutorial/development-environment.md)
|
||||
* [Setting up macOS](tutorial/development-environment.md#setting-up-macos)
|
||||
* [Setting up Windows](tutorial/development-environment.md#setting-up-windows)
|
||||
* [Setting up Linux](tutorial/development-environment.md#setting-up-linux)
|
||||
* [Choosing an Editor](tutorial/development-environment.md#a-good-editor)
|
||||
* [Creating your First App](tutorial/first-app.md)
|
||||
* [Installing Electron](tutorial/first-app.md#installing-electron)
|
||||
* [Electron Development in a Nutshell](tutorial/first-app.md#electron-development-in-a-nutshell)
|
||||
* [Running Your App](tutorial/first-app.md#running-your-app)
|
||||
* [Boilerplates and CLIs](tutorial/boilerplates-and-clis.md)
|
||||
* [Boilerplate vs CLI](tutorial/boilerplates-and-clis.md#boilerplate-vs-cli)
|
||||
* [electron-forge](tutorial/boilerplates-and-clis.md#electron-forge)
|
||||
* [electron-builder](tutorial/boilerplates-and-clis.md#electron-builder)
|
||||
* [electron-react-boilerplate](tutorial/boilerplates-and-clis.md#electron-react-boilerplate)
|
||||
* [Other Tools and Boilerplates](tutorial/boilerplates-and-clis.md#other-tools-and-boilerplates)
|
||||
* [Application Architecture](tutorial/application-architecture.md)
|
||||
* [Main and Renderer Processes](tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
* [Using Electron's APIs](tutorial/application-architecture.md#using-electron-apis)
|
||||
* [Using Node.js APIs](tutorial/application-architecture.md#using-nodejs-apis)
|
||||
* [Using Native Node.js Modules](tutorial/using-native-node-modules.md)
|
||||
* [Performance Strategies](tutorial/performance.md)
|
||||
### Quickstart
|
||||
|
||||
* [Quick Start Guide](tutorial/quick-start.md)
|
||||
* [Prerequisites](tutorial/quick-start.md#prerequisites)
|
||||
* [Create a basic application](tutorial/quick-start.md#create-a-basic-application)
|
||||
* [Run your application](tutorial/quick-start.md#run-your-application)
|
||||
* [Package and distribute the application](tutorial/quick-start.md#package-and-distribute-the-application)
|
||||
|
||||
### Learning the basics
|
||||
|
||||
* [Electron's Process Model](tutorial/quick-start.md#application-architecture)
|
||||
* [Main and Renderer Processes](tutorial/quick-start.md#main-and-renderer-processes)
|
||||
* [Electron API](tutorial/quick-start.md#electron-api)
|
||||
* [Node.js API](tutorial/quick-start.md#nodejs-api)
|
||||
* Adding Features to Your App
|
||||
* [Notifications](tutorial/notifications.md)
|
||||
* [Recent Documents](tutorial/recent-documents.md)
|
||||
@@ -51,15 +44,26 @@ an issue:
|
||||
* [Represented File for macOS BrowserWindows](tutorial/represented-file.md)
|
||||
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
|
||||
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
|
||||
* [Supporting macOS Dark Mode](tutorial/mojave-dark-mode-guide.md)
|
||||
* [Dark Mode](tutorial/dark-mode.md)
|
||||
* [Web embeds in Electron](tutorial/web-embeds.md)
|
||||
* [Boilerplates and CLIs](tutorial/boilerplates-and-clis.md)
|
||||
* [Boilerplate vs CLI](tutorial/boilerplates-and-clis.md#boilerplate-vs-cli)
|
||||
* [electron-forge](tutorial/boilerplates-and-clis.md#electron-forge)
|
||||
* [electron-builder](tutorial/boilerplates-and-clis.md#electron-builder)
|
||||
* [electron-react-boilerplate](tutorial/boilerplates-and-clis.md#electron-react-boilerplate)
|
||||
* [Other Tools and Boilerplates](tutorial/boilerplates-and-clis.md#other-tools-and-boilerplates)
|
||||
|
||||
### Advanced steps
|
||||
|
||||
* Application Architecture
|
||||
* [Using Native Node.js Modules](tutorial/using-native-node-modules.md)
|
||||
* [Performance Strategies](tutorial/performance.md)
|
||||
* [Security Strategies](tutorial/security.md)
|
||||
* [Accessibility](tutorial/accessibility.md)
|
||||
* [Spectron](tutorial/accessibility.md#spectron)
|
||||
* [Devtron](tutorial/accessibility.md#devtron)
|
||||
* [Enabling Accessibility](tutorial/accessibility.md#enabling-accessibility)
|
||||
* [Manually Enabling Accessibility Features](tutorial/accessibility.md#manually-enabling-accessibility-features)
|
||||
* [Testing and Debugging](tutorial/application-debugging.md)
|
||||
* [Debugging the Main Process](tutorial/debugging-main-process.md)
|
||||
* [Debugging the Main Process with Visual Studio Code](tutorial/debugging-main-process-vscode.md)
|
||||
* [Debugging with Visual Studio Code](tutorial/debugging-vscode.md)
|
||||
* [Using Selenium and WebDriver](tutorial/using-selenium-and-webdriver.md)
|
||||
* [Testing on Headless CI Systems (Travis, Jenkins)](tutorial/testing-on-headless-ci.md)
|
||||
* [DevTools Extension](tutorial/devtools-extension.md)
|
||||
@@ -70,11 +74,6 @@ an issue:
|
||||
* [Mac App Store](tutorial/mac-app-store-submission-guide.md)
|
||||
* [Windows Store](tutorial/windows-store-guide.md)
|
||||
* [Snapcraft](tutorial/snapcraft.md)
|
||||
* [Security](tutorial/security.md)
|
||||
* [Reporting Security Issues](tutorial/security.md#reporting-security-issues)
|
||||
* [Chromium Security Issues and Upgrades](tutorial/security.md#chromium-security-issues-and-upgrades)
|
||||
* [Electron Security Warnings](tutorial/security.md#electron-security-warnings)
|
||||
* [Security Checklist](tutorial/security.md#checklist-security-recommendations)
|
||||
* [Updates](tutorial/updates.md)
|
||||
* [Deploying an Update Server](tutorial/updates.md#deploying-an-update-server)
|
||||
* [Implementing Updates in Your App](tutorial/updates.md#implementing-updates-in-your-app)
|
||||
@@ -92,13 +91,7 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* Electron Releases & Developer Feedback
|
||||
* [Versioning Policy](tutorial/electron-versioning.md)
|
||||
* [Release Timelines](tutorial/electron-timelines.md)
|
||||
* [Packaging App Source Code with asar](tutorial/application-packaging.md)
|
||||
* [Generating asar Archives](tutorial/application-packaging.md#generating-asar-archives)
|
||||
* [Using asar Archives](tutorial/application-packaging.md#using-asar-archives)
|
||||
* [Limitations](tutorial/application-packaging.md#limitations-of-the-node-api)
|
||||
* [Adding Unpacked Files to asar Archives](tutorial/application-packaging.md#adding-unpacked-files-to-asar-archives)
|
||||
* [Testing Widevine CDM](tutorial/testing-widevine-cdm.md)
|
||||
* [Using Pepper Flash Plugin](tutorial/using-pepper-flash-plugin.md)
|
||||
|
||||
---
|
||||
|
||||
@@ -135,6 +128,7 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* [MenuItem](api/menu-item.md)
|
||||
* [net](api/net.md)
|
||||
* [netLog](api/net-log.md)
|
||||
* [nativeTheme](api/native-theme.md)
|
||||
* [Notification](api/notification.md)
|
||||
* [powerMonitor](api/power-monitor.md)
|
||||
* [powerSaveBlocker](api/power-save-blocker.md)
|
||||
@@ -145,19 +139,19 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
* [TouchBar](api/touch-bar.md)
|
||||
* [Tray](api/tray.md)
|
||||
* [webContents](api/web-contents.md)
|
||||
* [webFrameMain](api/web-frame-main.md)
|
||||
|
||||
### Modules for the Renderer Process (Web Page):
|
||||
|
||||
* [contextBridge](api/context-bridge.md)
|
||||
* [desktopCapturer](api/desktop-capturer.md)
|
||||
* [ipcRenderer](api/ipc-renderer.md)
|
||||
* [remote](api/remote.md)
|
||||
* [webFrame](api/web-frame.md)
|
||||
|
||||
### Modules for Both Processes:
|
||||
|
||||
* [clipboard](api/clipboard.md)
|
||||
* [crashReporter](api/crash-reporter.md)
|
||||
* [desktopCapturer](api/desktop-capturer.md)
|
||||
* [nativeImage](api/native-image.md)
|
||||
* [shell](api/shell.md)
|
||||
|
||||
|
||||
45
docs/api/app.md
Normal file → Executable file
45
docs/api/app.md
Normal file → Executable file
@@ -33,10 +33,11 @@ In most cases, you should do everything in the `ready` event handler.
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `launchInfo` Record<string, any> _macOS_
|
||||
* `launchInfo` Record<string, any> | [NotificationResponse](structures/notification-response.md) _macOS_
|
||||
|
||||
Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
|
||||
holds the `userInfo` of the `NSUserNotification` that was used to open the
|
||||
holds the `userInfo` of the `NSUserNotification` or information from
|
||||
[`UNNotificationResponse`](structures/notification-response.md) that was used to open the
|
||||
application, if it was launched from Notification Center. You can also call
|
||||
`app.isReady()` to check if this event has already fired and `app.whenReady()`
|
||||
to get a Promise that is fulfilled when Electron is initialized.
|
||||
@@ -390,7 +391,7 @@ which contains more information about why the render process disappeared. It
|
||||
isn't always because it crashed. The `killed` boolean can be replaced by
|
||||
checking `reason === 'killed'` when you switch to that event.
|
||||
|
||||
#### Event: 'render-process-gone'
|
||||
### Event: 'render-process-gone'
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -405,11 +406,14 @@ Returns:
|
||||
* `oom` - Process ran out of memory
|
||||
* `launch-failed` - Process never successfully launched
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
* `exitCode` Integer - The exit code of the process, unless `reason` is
|
||||
`launch-failed`, in which case `exitCode` will be a platform-specific
|
||||
launch failure error code.
|
||||
|
||||
Emitted when the renderer process unexpectedly disappears. This is normally
|
||||
because it was crashed or killed.
|
||||
|
||||
#### Event: 'child-process-gone'
|
||||
### Event: 'child-process-gone'
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -433,7 +437,8 @@ Returns:
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
* `exitCode` Number - The exit code for the process
|
||||
(e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).
|
||||
* `name` String (optional) - The name of the process. i.e. for plugins it might be Flash.
|
||||
* `serviceName` String (optional) - The non-localized name of the process.
|
||||
* `name` String (optional) - The name of the process.
|
||||
Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc.
|
||||
|
||||
Emitted when the child process unexpectedly disappears. This is normally
|
||||
@@ -502,7 +507,7 @@ Returns:
|
||||
Emitted when `desktopCapturer.getSources()` is called in the renderer process of `webContents`.
|
||||
Calling `event.preventDefault()` will make it return empty sources.
|
||||
|
||||
### Event: 'remote-require'
|
||||
### Event: 'remote-require' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -514,7 +519,7 @@ Emitted when `remote.require()` is called in the renderer process of `webContent
|
||||
Calling `event.preventDefault()` will prevent the module from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Event: 'remote-get-global'
|
||||
### Event: 'remote-get-global' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -526,7 +531,7 @@ Emitted when `remote.getGlobal()` is called in the renderer process of `webConte
|
||||
Calling `event.preventDefault()` will prevent the global from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Event: 'remote-get-builtin'
|
||||
### Event: 'remote-get-builtin' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -538,7 +543,7 @@ Emitted when `remote.getBuiltin()` is called in the renderer process of `webCont
|
||||
Calling `event.preventDefault()` will prevent the module from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Event: 'remote-get-current-window'
|
||||
### Event: 'remote-get-current-window' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -549,7 +554,7 @@ Emitted when `remote.getCurrentWindow()` is called in the renderer process of `w
|
||||
Calling `event.preventDefault()` will prevent the object from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
### Event: 'remote-get-current-web-contents'
|
||||
### Event: 'remote-get-current-web-contents' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -680,7 +685,6 @@ Returns `String` - The current application directory.
|
||||
* `videos` Directory for a user's videos.
|
||||
* `recent` Directory for the user's recent files (Windows only).
|
||||
* `logs` Directory for your app's log folder.
|
||||
* `pepperFlashSystemPlugin` Full path to the system version of the Pepper Flash plugin.
|
||||
* `crashDumps` Directory where crash dumps are stored.
|
||||
|
||||
Returns `String` - A path to a special directory or file associated with `name`. On
|
||||
@@ -858,9 +862,10 @@ This method returns the application name of the default handler for the protocol
|
||||
minimum (e.g. `https://`).
|
||||
|
||||
Returns `Promise<Object>` - Resolve with an object containing the following:
|
||||
* `icon` NativeImage - the display icon of the app handling the protocol.
|
||||
* `path` String - installation path of the app handling the protocol.
|
||||
* `name` String - display name of the app handling the protocol.
|
||||
|
||||
* `icon` NativeImage - the display icon of the app handling the protocol.
|
||||
* `path` String - installation path of the app handling the protocol.
|
||||
* `name` String - display name of the app handling the protocol.
|
||||
|
||||
This method returns a promise that contains the application name, icon and path of the default handler for the protocol
|
||||
(aka URI scheme) of a URL.
|
||||
@@ -924,6 +929,10 @@ re-add a removed item to a custom category earlier than that will result in the
|
||||
entire custom category being omitted from the Jump List. The list of removed
|
||||
items can be obtained using `app.getJumpListSettings()`.
|
||||
|
||||
**Note:** The maximum length of a Jump List item's `description` property is
|
||||
260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
List, nor will it be displayed.
|
||||
|
||||
Here's a very simple example of creating a custom Jump List:
|
||||
|
||||
```javascript
|
||||
@@ -1090,6 +1099,7 @@ Changes the [Application User Model ID][app-user-model-id] to `id`.
|
||||
Sets the activation policy for a given app.
|
||||
|
||||
Activation policy types:
|
||||
|
||||
* 'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.
|
||||
* 'accessory' - The application doesn’t appear in the Dock and doesn’t have a menu bar, but it may be activated programmatically or by clicking on one of its windows.
|
||||
* 'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.
|
||||
@@ -1104,7 +1114,7 @@ Activation policy types:
|
||||
|
||||
Imports the certificate in pkcs12 format into the platform certificate store.
|
||||
`callback` is called with the `result` of import operation, a value of `0`
|
||||
indicates success while any other value indicates failure according to Chromium [net_error_list](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h).
|
||||
indicates success while any other value indicates failure according to Chromium [net_error_list](https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h).
|
||||
|
||||
### `app.disableHardwareAcceleration()`
|
||||
|
||||
@@ -1141,6 +1151,7 @@ For `infoType` equal to `complete`:
|
||||
|
||||
For `infoType` equal to `basic`:
|
||||
Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response:
|
||||
|
||||
```js
|
||||
{
|
||||
auxAttributes:
|
||||
@@ -1170,9 +1181,9 @@ For `infoType` equal to `basic`:
|
||||
|
||||
Using `basic` should be preferred if only basic information like `vendorId` or `driverId` is needed.
|
||||
|
||||
### `app.setBadgeCount(count)` _Linux_ _macOS_
|
||||
### `app.setBadgeCount([count])` _Linux_ _macOS_
|
||||
|
||||
* `count` Integer
|
||||
* `count` Integer (optional) - If a value is provided, set the badge to the provided value otherwise, on macOS, display a plain white dot (e.g. unknown number of notifications). On Linux, if a value is not provided the badge will not display.
|
||||
|
||||
Returns `Boolean` - Whether the call succeeded.
|
||||
|
||||
|
||||
@@ -8,9 +8,6 @@ Process: [Main](../glossary.md#main-process)
|
||||
// In the main process.
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
// Or use `remote` from the renderer process.
|
||||
// const { BrowserWindow } = require('electron').remote
|
||||
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
|
||||
// Load a remote URL
|
||||
@@ -268,7 +265,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
be the absolute file path to the script.
|
||||
When node integration is turned off, the preload script can reintroduce
|
||||
Node global symbols back to the global scope. See example
|
||||
[here](process.md#event-loaded).
|
||||
[here](context-bridge.md#exposing-node-global-symbols).
|
||||
* `sandbox` Boolean (optional) - If set, this will sandbox the renderer
|
||||
associated with the window, making it compatible with the Chromium
|
||||
OS-level sandbox and disabling the Node.js engine. This is not the same as
|
||||
@@ -340,21 +337,19 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
more details.
|
||||
* `contextIsolation` Boolean (optional) - Whether to run Electron APIs and
|
||||
the specified `preload` script in a separate JavaScript context. Defaults
|
||||
to `false`. The context that the `preload` script runs in will still
|
||||
have full access to the `document` and `window` globals but it will use
|
||||
its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.)
|
||||
and will be isolated from any changes made to the global environment
|
||||
by the loaded page. The Electron API will only be available in the
|
||||
`preload` script and not the loaded page. This option should be used when
|
||||
loading potentially untrusted remote content to ensure the loaded content
|
||||
cannot tamper with the `preload` script and any Electron APIs being used.
|
||||
This option uses the same technique used by [Chrome Content Scripts][chrome-content-scripts].
|
||||
You can access this context in the dev tools by selecting the
|
||||
'Electron Isolated Context' entry in the combo box at the top of the
|
||||
Console tab.
|
||||
to `true`. The context that the `preload` script runs in will only have
|
||||
access to its own dedicated `document` and `window` globals, as well as
|
||||
its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.),
|
||||
which are all invisible to the loaded content. The Electron API will only
|
||||
be available in the `preload` script and not the loaded page. This option
|
||||
should be used when loading potentially untrusted remote content to ensure
|
||||
the loaded content cannot tamper with the `preload` script and any
|
||||
Electron APIs being used. This option uses the same technique used by
|
||||
[Chrome Content Scripts][chrome-content-scripts]. You can access this
|
||||
context in the dev tools by selecting the 'Electron Isolated Context'
|
||||
entry in the combo box at the top of the Console tab.
|
||||
* `worldSafeExecuteJavaScript` Boolean (optional) - If true, values returned from `webFrame.executeJavaScript` will be sanitized to ensure JS values
|
||||
can't unsafely cross between worlds when using `contextIsolation`. The default
|
||||
is `false`. In Electron 12, the default will be changed to `true`. _Deprecated_
|
||||
can't unsafely cross between worlds when using `contextIsolation`. Defaults to `true`. _Deprecated_
|
||||
* `nativeWindowOpen` Boolean (optional) - Whether to use native
|
||||
`window.open()`. Defaults to `false`. Child windows will always have node
|
||||
integration disabled unless `nodeIntegrationInSubFrames` is true. **Note:** This option is currently
|
||||
@@ -401,6 +396,11 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `bypassHeatCheck` - Bypass code caching heuristics but with lazy compilation
|
||||
* `bypassHeatCheckAndEagerCompile` - Same as above except compilation is eager.
|
||||
Default policy is `code`.
|
||||
* `enablePreferredSizeMode` Boolean (optional) - Whether to enable
|
||||
preferred size mode. The preferred size is the minimum size needed to
|
||||
contain the layout of the document—without requiring scrolling. Enabling
|
||||
this will cause the `preferred-size-changed` event to be emitted on the
|
||||
`WebContents` when the preferred size changes. Default is `false`.
|
||||
|
||||
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
|
||||
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
|
||||
@@ -466,6 +466,7 @@ window.onbeforeunload = (e) => {
|
||||
e.returnValue = false // equivalent to `return false` but not recommended
|
||||
}
|
||||
```
|
||||
|
||||
_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._
|
||||
|
||||
#### Event: 'closed'
|
||||
@@ -733,7 +734,7 @@ The method will also not return if the extension's manifest is missing or incomp
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.loadExtension(path)`](session.md#sesloadextensionpath).
|
||||
[`ses.loadExtension(path)`](session.md#sesloadextensionpath-options).
|
||||
|
||||
#### `BrowserWindow.removeExtension(name)` _Deprecated_
|
||||
|
||||
@@ -775,7 +776,7 @@ The method will also not return if the extension's manifest is missing or incomp
|
||||
is emitted.
|
||||
|
||||
**Note:** This method is deprecated. Instead, use
|
||||
[`ses.loadExtension(path)`](session.md#sesloadextensionpath).
|
||||
[`ses.loadExtension(path)`](session.md#sesloadextensionpath-options).
|
||||
|
||||
#### `BrowserWindow.removeDevToolsExtension(name)` _Deprecated_
|
||||
|
||||
@@ -863,7 +864,7 @@ A `Boolean` property that determines whether the menu bar should be visible.
|
||||
|
||||
**Note:** If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
|
||||
#### `win.kiosk`
|
||||
#### `win.kiosk`
|
||||
|
||||
A `Boolean` property that determines whether the window is in kiosk mode.
|
||||
|
||||
@@ -1053,7 +1054,7 @@ Returns `Boolean` - Whether the window is in normal state (not maximized, not mi
|
||||
|
||||
* `aspectRatio` Float - The aspect ratio to maintain for some portion of the
|
||||
content view.
|
||||
* `extraSize` [Size](structures/size.md) (optional) _macOS_ - The extra size not to be included while
|
||||
* `extraSize` [Size](structures/size.md) (optional) _macOS_ - The extra size not to be included while
|
||||
maintaining the aspect ratio.
|
||||
|
||||
This will make a window maintain an aspect ratio. The extra size allows a
|
||||
@@ -1372,6 +1373,17 @@ Enters or leaves kiosk mode.
|
||||
|
||||
Returns `Boolean` - Whether the window is in kiosk mode.
|
||||
|
||||
#### `win.isTabletMode()` _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window is in Windows 10 tablet mode.
|
||||
|
||||
Since Windows 10 users can [use their PC as tablet](https://support.microsoft.com/en-us/help/17210/windows-10-use-your-pc-like-a-tablet),
|
||||
under this mode apps can choose to optimize their UI for tablets, such as
|
||||
enlarging the titlebar and hiding titlebar buttons.
|
||||
|
||||
This API returns whether the window is in tablet mode, and the `resize` event
|
||||
can be be used to listen to changes to tablet mode.
|
||||
|
||||
#### `win.getMediaSourceId()`
|
||||
|
||||
Returns `String` - Window id in the format of DesktopCapturerSource's id. For example "window:1234:0".
|
||||
@@ -1392,6 +1404,8 @@ The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
|
||||
|
||||
* `message` Integer
|
||||
* `callback` Function
|
||||
* `wParam` any - The `wParam` provided to the WndProc
|
||||
* `lParam` any - The `lParam` provided to the WndProc
|
||||
|
||||
Hooks a windows message. The `callback` is called when
|
||||
the message is received in the WndProc.
|
||||
@@ -1444,7 +1458,7 @@ Returns `Boolean` - Whether the window's document has been edited.
|
||||
|
||||
Returns `Promise<NativeImage>` - Resolves with a [NativeImage](native-image.md)
|
||||
|
||||
Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.
|
||||
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.
|
||||
|
||||
#### `win.loadURL(url[, options])`
|
||||
|
||||
@@ -1453,7 +1467,7 @@ Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
|
||||
* `httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer URL.
|
||||
* `userAgent` String (optional) - A user agent originating the request.
|
||||
* `extraHeaders` String (optional) - Extra headers separated by "\n"
|
||||
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md) | [UploadBlob[]](structures/upload-blob.md)) (optional)
|
||||
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md)) (optional)
|
||||
* `baseURLForDataURL` String (optional) - Base URL (with trailing path separator) for files to be loaded by the data URL. This is needed only if the specified `url` is a data URL and needs to load other files.
|
||||
|
||||
Returns `Promise<void>` - the promise will resolve when the page has finished loading
|
||||
@@ -1735,7 +1749,9 @@ events.
|
||||
Prevents the window contents from being captured by other apps.
|
||||
|
||||
On macOS it sets the NSWindow's sharingType to NSWindowSharingNone.
|
||||
On Windows it calls SetWindowDisplayAffinity with `WDA_MONITOR`.
|
||||
On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
|
||||
For Windows 10 version 2004 and up the window will be removed from capture entirely,
|
||||
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
|
||||
|
||||
#### `win.setFocusable(focusable)` _macOS_ _Windows_
|
||||
|
||||
@@ -1852,6 +1868,13 @@ Replacement API for setBrowserView supporting work with multi browser views.
|
||||
|
||||
* `browserView` [BrowserView](browser-view.md)
|
||||
|
||||
#### `win.setTopBrowserView(browserView)` _Experimental_
|
||||
|
||||
* `browserView` [BrowserView](browser-view.md)
|
||||
|
||||
Raises `browserView` above other `BrowserView`s attached to `win`.
|
||||
Throws an error if `browserView` is not attached to `win`.
|
||||
|
||||
#### `win.getBrowserViews()` _Experimental_
|
||||
|
||||
Returns `BrowserView[]` - an array of all BrowserViews that have been attached
|
||||
|
||||
@@ -13,30 +13,41 @@ interface and is therefore an [EventEmitter][event-emitter].
|
||||
the request URL. If it is an object, it is expected to fully specify an HTTP request via the
|
||||
following properties:
|
||||
* `method` String (optional) - The HTTP request method. Defaults to the GET
|
||||
method.
|
||||
method.
|
||||
* `url` String (optional) - The request URL. Must be provided in the absolute
|
||||
form with the protocol scheme specified as http or https.
|
||||
form with the protocol scheme specified as http or https.
|
||||
* `session` Session (optional) - The [`Session`](session.md) instance with
|
||||
which the request is associated.
|
||||
which the request is associated.
|
||||
* `partition` String (optional) - The name of the [`partition`](session.md)
|
||||
with which the request is associated. Defaults to the empty string. The
|
||||
`session` option prevails on `partition`. Thus if a `session` is explicitly
|
||||
specified, `partition` is ignored.
|
||||
with which the request is associated. Defaults to the empty string. The
|
||||
`session` option supersedes `partition`. Thus if a `session` is explicitly
|
||||
specified, `partition` is ignored.
|
||||
* `credentials` String (optional) - Can be `include` or `omit`. Whether to
|
||||
send [credentials](https://fetch.spec.whatwg.org/#credentials) with this
|
||||
request. If set to `include`, credentials from the session associated with
|
||||
the request will be used. If set to `omit`, credentials will not be sent
|
||||
with the request (and the `'login'` event will not be triggered in the
|
||||
event of a 401). This matches the behavior of the
|
||||
[fetch](https://fetch.spec.whatwg.org/#concept-request-credentials-mode)
|
||||
option of the same name. If this option is not specified, authentication
|
||||
data from the session will be sent, and cookies will not be sent (unless
|
||||
`useSessionCookies` is set).
|
||||
* `useSessionCookies` Boolean (optional) - Whether to send cookies with this
|
||||
request from the provided session. This will make the `net` request's
|
||||
cookie behavior match a `fetch` request. Default is `false`.
|
||||
* `protocol` String (optional) - The protocol scheme in the form 'scheme:'.
|
||||
Currently supported values are 'http:' or 'https:'. Defaults to 'http:'.
|
||||
request from the provided session. If `credentials` is specified, this
|
||||
option has no effect. Default is `false`.
|
||||
* `protocol` String (optional) - Can be `http:` or `https:`. The protocol
|
||||
scheme in the form 'scheme:'. Defaults to 'http:'.
|
||||
* `host` String (optional) - The server host provided as a concatenation of
|
||||
the hostname and the port number 'hostname:port'.
|
||||
the hostname and the port number 'hostname:port'.
|
||||
* `hostname` String (optional) - The server host name.
|
||||
* `port` Integer (optional) - The server's listening port number.
|
||||
* `path` String (optional) - The path part of the request URL.
|
||||
* `redirect` String (optional) - The redirect mode for this request. Should be
|
||||
one of `follow`, `error` or `manual`. Defaults to `follow`. When mode is `error`,
|
||||
any redirection will be aborted. When mode is `manual` the redirection will be
|
||||
cancelled unless [`request.followRedirect`](#requestfollowredirect) is invoked
|
||||
synchronously during the [`redirect`](#event-redirect) event.
|
||||
* `redirect` String (optional) - Can be `follow`, `error` or `manual`. The
|
||||
redirect mode for this request. When mode is `error`, any redirection will
|
||||
be aborted. When mode is `manual` the redirection will be cancelled unless
|
||||
[`request.followRedirect`](#requestfollowredirect) is invoked synchronously
|
||||
during the [`redirect`](#event-redirect) event. Defaults to `follow`.
|
||||
* `origin` String (optional) - The origin URL of the request.
|
||||
|
||||
`options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
|
||||
strictly follow the Node.js model as described in the
|
||||
@@ -88,6 +99,7 @@ request.on('login', (authInfo, callback) => {
|
||||
callback('username', 'password')
|
||||
})
|
||||
```
|
||||
|
||||
Providing empty credentials will cancel the request and report an authentication
|
||||
error on the response object:
|
||||
|
||||
@@ -129,7 +141,6 @@ Emitted as the last event in the HTTP request-response transaction. The `close`
|
||||
event indicates that no more events will be emitted on either the `request` or
|
||||
`response` objects.
|
||||
|
||||
|
||||
#### Event: 'redirect'
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -64,6 +64,7 @@ Forces the maximum disk space to be used by the disk cache, in bytes.
|
||||
### --enable-api-filtering-logging
|
||||
|
||||
Enables caller stack logging for the following APIs (filtering events):
|
||||
|
||||
- `desktopCapturer.getSources()` / `desktop-capturer-get-sources`
|
||||
- `remote.require()` / `remote-require`
|
||||
- `remote.getGlobal()` / `remote-get-builtin`
|
||||
@@ -79,6 +80,12 @@ This switch can not be used in `app.commandLine.appendSwitch` since it is parsed
|
||||
earlier than user's app is loaded, but you can set the `ELECTRON_ENABLE_LOGGING`
|
||||
environment variable to achieve the same effect.
|
||||
|
||||
## --force-fieldtrials=`trials`
|
||||
|
||||
Field trials to be forcefully enabled or disabled.
|
||||
|
||||
For example: `WebRTC-Audio-Red-For-Opus/Enabled/`
|
||||
|
||||
### --host-rules=`rules`
|
||||
|
||||
A comma-separated list of `rules` that control how hostnames are mapped.
|
||||
@@ -171,14 +178,6 @@ authentication [per Chromium issue](https://bugs.chromium.org/p/chromium/issues/
|
||||
|
||||
Enables remote debugging over HTTP on the specified `port`.
|
||||
|
||||
### --ppapi-flash-path=`path`
|
||||
|
||||
Sets the `path` of the pepper flash plugin.
|
||||
|
||||
### --ppapi-flash-version=`version`
|
||||
|
||||
Sets the `version` of the pepper flash plugin.
|
||||
|
||||
### --v=`log_level`
|
||||
|
||||
Gives the default maximal active V-logging level; 0 is the default. Normally
|
||||
@@ -235,12 +234,13 @@ See the [Debugging the Main Process][debugging-main-process] guide for more deta
|
||||
Aliased to `--debug[=[host:]port`.
|
||||
|
||||
### --inspect-publish-uid=stderr,http
|
||||
|
||||
Specify ways of the inspector web socket url exposure.
|
||||
|
||||
By default inspector websocket url is available in stderr and under /json/list endpoint on http://host:port/json/list.
|
||||
|
||||
[app]: app.md
|
||||
[append-switch]: app.md#appcommandlineappendswitchswitch-value
|
||||
[append-switch]: command-line.md#commandlineappendswitchswitch-value
|
||||
[ready]: app.md#event-ready
|
||||
[play-silent-audio]: https://github.com/atom/atom/pull/9485/files
|
||||
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
||||
|
||||
@@ -33,7 +33,7 @@ page you load in your renderer executes code in this world.
|
||||
|
||||
### Isolated World
|
||||
|
||||
When `contextIsolation` is enabled in your `webPreferences`, 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
|
||||
[security](../tutorial/security.md#3-enable-context-isolation-for-remote-content) docs.
|
||||
|
||||
@@ -44,19 +44,19 @@ The `contextBridge` module has the following methods:
|
||||
### `contextBridge.exposeInMainWorld(apiKey, api)` _Experimental_
|
||||
|
||||
* `apiKey` String - The key to inject the API onto `window` with. The API will be accessible on `window[apiKey]`.
|
||||
* `api` Record<String, any> - Your API object, 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.
|
||||
|
||||
## Usage
|
||||
|
||||
### API Objects
|
||||
### API
|
||||
|
||||
The `api` object provided to [`exposeInMainWorld`](#contextbridgeexposeinmainworldapikey-api-experimental) must be an object
|
||||
The `api` provided to [`exposeInMainWorld`](#contextbridgeexposeinmainworldapikey-api-experimental) must be a `Function`, `String`, `Number`, `Array`, `Boolean`, or an object
|
||||
whose keys are strings and values are a `Function`, `String`, `Number`, `Array`, `Boolean`, or another nested object that meets the same conditions.
|
||||
|
||||
`Function` values are proxied to the other context and all other values are **copied** and **frozen**. Any data / primitives sent in
|
||||
the API object become immutable and updates on either side of the bridge do not result in an update on the other side.
|
||||
the API become immutable and updates on either side of the bridge do not result in an update on the other side.
|
||||
|
||||
An example of a complex API object is shown below:
|
||||
An example of a complex API is shown below:
|
||||
|
||||
```javascript
|
||||
const { contextBridge } = require('electron')
|
||||
@@ -108,5 +108,23 @@ has been included below for completeness:
|
||||
| [Cloneable Types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) | Simple | ✅ | ✅ | See the linked document on cloneable types |
|
||||
| `Symbol` | N/A | ❌ | ❌ | Symbols cannot be copied across contexts so they are dropped |
|
||||
|
||||
|
||||
If the type you care about is not in the above table, it is probably not supported.
|
||||
|
||||
### Exposing Node Global Symbols
|
||||
|
||||
The `contextBridge` can be used by the preload script to give your renderer access to Node APIs.
|
||||
The table of supported types described above also applies to Node APIs that you expose through `contextBridge`.
|
||||
Please note that many Node APIs grant access to local system resources.
|
||||
Be very cautious about which globals and APIs you expose to untrusted remote content.
|
||||
|
||||
```javascript
|
||||
const { contextBridge } = require('electron')
|
||||
const crypto = require('crypto')
|
||||
contextBridge.exposeInMainWorld('nodeCrypto', {
|
||||
sha256sum (data) {
|
||||
const hash = crypto.createHash('sha256')
|
||||
hash.update(data)
|
||||
return hash.digest('hex')
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
@@ -45,6 +45,8 @@ The following events are available on instances of `Cookies`:
|
||||
|
||||
#### Event: 'changed'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `cookie` [Cookie](structures/cookie.md) - The cookie that was changed.
|
||||
* `cause` String - The cause of the change with one of the following values:
|
||||
|
||||
@@ -39,6 +39,37 @@ is an implementation detail driven by Chromium, and it may change in future. In
|
||||
particular, crashpad is newer and will likely eventually replace breakpad on
|
||||
all platforms.
|
||||
|
||||
### Note about Node child processes on Linux
|
||||
|
||||
If you are using the Node.js `child_process` module and want to report crashes
|
||||
from those processes on Linux, there is an extra step you will need to take to
|
||||
properly initialize the crash reporter in the child process. This is not
|
||||
necessary on Mac or Windows, as those platforms use Crashpad, which
|
||||
automatically monitors child processes.
|
||||
|
||||
Since `require('electron')` is not available in Node child processes, the
|
||||
following APIs are available on the `process` object in Node child processes.
|
||||
Note that, on Linux, each Node child process has its own separate instance of
|
||||
the breakpad crash reporter. This is dissimilar to renderer child processes,
|
||||
which have a "stub" breakpad reporter which returns information to the main
|
||||
process for reporting.
|
||||
|
||||
#### `process.crashReporter.start(options)`
|
||||
|
||||
See [`crashReporter.start()`](#crashreporterstartoptions).
|
||||
|
||||
#### `process.crashReporter.getParameters()`
|
||||
|
||||
See [`crashReporter.getParameters()`](#crashreportergetparameters).
|
||||
|
||||
#### `process.crashReporter.addExtraParameter(key, value)`
|
||||
|
||||
See [`crashReporter.addExtraParameter(key, value)`](#crashreporteraddextraparameterkey-value).
|
||||
|
||||
#### `process.crashReporter.removeExtraParameter(key)`
|
||||
|
||||
See [`crashReporter.removeExtraParameter(key)`](#crashreporterremoveextraparameterkey).
|
||||
|
||||
## Methods
|
||||
|
||||
The `crashReporter` module has the following methods:
|
||||
@@ -59,7 +90,7 @@ The `crashReporter` module has the following methods:
|
||||
* `rateLimit` Boolean (optional) _macOS_ _Windows_ - If true, limit the
|
||||
number of crashes uploaded to 1/hour. Default is `false`.
|
||||
* `compress` Boolean (optional) - If true, crash reports will be compressed
|
||||
and uploaded with `Content-Encoding: gzip`. Default is `false`.
|
||||
and uploaded with `Content-Encoding: gzip`. Default is `true`.
|
||||
* `extra` Record<String, String> (optional) - Extra string key/value
|
||||
annotations that will be sent along with crash reports that are generated
|
||||
in the main process. Only string values are supported. Crashes generated in
|
||||
@@ -97,7 +128,7 @@ must be at most 39 bytes long, and values must be no longer than 127 bytes.
|
||||
Keys with names longer than the maximum will be silently ignored. Key values
|
||||
longer than the maximum length will be truncated.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
**Note:** This method is only available in the main process.
|
||||
|
||||
### `crashReporter.getLastCrashReport()`
|
||||
|
||||
@@ -106,7 +137,7 @@ last crash report. Only crash reports that have been uploaded will be returned;
|
||||
even if a crash report is present on disk it will not be returned until it is
|
||||
uploaded. In the case that there are no uploaded reports, `null` is returned.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
**Note:** This method is only available in the main process.
|
||||
|
||||
### `crashReporter.getUploadedReports()`
|
||||
|
||||
@@ -115,14 +146,14 @@ Returns [`CrashReport[]`](structures/crash-report.md):
|
||||
Returns all uploaded crash reports. Each report contains the date and uploaded
|
||||
ID.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
**Note:** This method is only available in the main process.
|
||||
|
||||
### `crashReporter.getUploadToServer()`
|
||||
|
||||
Returns `Boolean` - Whether reports should be submitted to the server. Set through
|
||||
the `start` method or `setUploadToServer`.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
**Note:** This method is only available in the main process.
|
||||
|
||||
### `crashReporter.setUploadToServer(uploadToServer)`
|
||||
|
||||
@@ -131,13 +162,7 @@ the `start` method or `setUploadToServer`.
|
||||
This would normally be controlled by user preferences. This has no effect if
|
||||
called before `start` is called.
|
||||
|
||||
**Note:** Calling this method from the renderer process is deprecated.
|
||||
|
||||
### `crashReporter.getCrashesDirectory()` _Deprecated_
|
||||
|
||||
Returns `String` - The directory where crashes are temporarily stored before being uploaded.
|
||||
|
||||
**Note:** This method is deprecated, use `app.getPath('crashDumps')` instead.
|
||||
**Note:** This method is only available in the main process.
|
||||
|
||||
### `crashReporter.addExtraParameter(key, value)`
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`Desktop
|
||||
which can detected by [`systemPreferences.getMediaAccessStatus`].
|
||||
|
||||
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
|
||||
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-macos
|
||||
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-windows-macos
|
||||
|
||||
## Caveats
|
||||
|
||||
|
||||
@@ -11,14 +11,6 @@ const { dialog } = require('electron')
|
||||
console.log(dialog.showOpenDialog({ properties: ['openFile', 'multiSelections'] }))
|
||||
```
|
||||
|
||||
The Dialog is opened from Electron's main thread. If you want to use the dialog
|
||||
object from a renderer process, remember to access it using the remote:
|
||||
|
||||
```javascript
|
||||
const { dialog } = require('electron').remote
|
||||
console.log(dialog)
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
The `dialog` module has the following methods:
|
||||
@@ -213,9 +205,10 @@ The `filters` specifies an array of file types that can be displayed, see
|
||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
|
||||
|
||||
Returns `Promise<Object>` - Resolve with an object containing the following:
|
||||
* `canceled` Boolean - whether or not the dialog was canceled.
|
||||
* `filePath` String (optional) - If the dialog is canceled, this will be `undefined`.
|
||||
* `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which contains the security scoped bookmark data for the saved file. `securityScopedBookmarks` must be enabled for this to be present. (For return values, see [table here](#bookmarks-array).)
|
||||
|
||||
* `canceled` Boolean - whether or not the dialog was canceled.
|
||||
* `filePath` String (optional) - If the dialog is canceled, this will be `undefined`.
|
||||
* `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which contains the security scoped bookmark data for the saved file. `securityScopedBookmarks` must be enabled for this to be present. (For return values, see [table here](#bookmarks-array).)
|
||||
|
||||
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
|
||||
|
||||
@@ -229,6 +222,7 @@ expanding and collapsing the dialog.
|
||||
|
||||
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
|
||||
* `options` Object
|
||||
* `message` String - Content of the message box.
|
||||
* `type` String (optional) - Can be `"none"`, `"info"`, `"error"`, `"question"` or
|
||||
`"warning"`. On Windows, `"question"` displays the same icon as `"info"`, unless
|
||||
you set an icon using the `"icon"` option. On macOS, both `"warning"` and
|
||||
@@ -238,7 +232,6 @@ expanding and collapsing the dialog.
|
||||
* `defaultId` Integer (optional) - Index of the button in the buttons array which will
|
||||
be selected by default when the message box opens.
|
||||
* `title` String (optional) - Title of the message box, some platforms will not show it.
|
||||
* `message` String - Content of the message box.
|
||||
* `detail` String (optional) - Extra information of the message.
|
||||
* `checkboxLabel` String (optional) - If provided, the message box will
|
||||
include a checkbox with the given label.
|
||||
@@ -275,6 +268,7 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
|
||||
|
||||
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
|
||||
* `options` Object
|
||||
* `message` String - Content of the message box.
|
||||
* `type` String (optional) - Can be `"none"`, `"info"`, `"error"`, `"question"` or
|
||||
`"warning"`. On Windows, `"question"` displays the same icon as `"info"`, unless
|
||||
you set an icon using the `"icon"` option. On macOS, both `"warning"` and
|
||||
@@ -284,7 +278,6 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
|
||||
* `defaultId` Integer (optional) - Index of the button in the buttons array which will
|
||||
be selected by default when the message box opens.
|
||||
* `title` String (optional) - Title of the message box, some platforms will not show it.
|
||||
* `message` String - Content of the message box.
|
||||
* `detail` String (optional) - Extra information of the message.
|
||||
* `checkboxLabel` String (optional) - If provided, the message box will
|
||||
include a checkbox with the given label.
|
||||
@@ -310,11 +303,12 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
|
||||
via `Alt-W` on Windows and Linux.
|
||||
|
||||
Returns `Promise<Object>` - resolves with a promise containing the following properties:
|
||||
* `response` Number - The index of the clicked button.
|
||||
* `checkboxChecked` Boolean - The checked state of the checkbox if
|
||||
|
||||
* `response` Number - The index of the clicked button.
|
||||
* `checkboxChecked` Boolean - The checked state of the checkbox if
|
||||
`checkboxLabel` was set. Otherwise `false`.
|
||||
|
||||
Shows a message box, it will block the process until the message box is closed.
|
||||
Shows a message box.
|
||||
|
||||
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ The `downloadItem` object has the following methods:
|
||||
* `path` String - Set the save file path of the download item.
|
||||
|
||||
The API is only available in session's `will-download` callback function.
|
||||
If `path` doesn't exist, Electron will try to make the directory recursively.
|
||||
If user doesn't set the save path via the API, Electron will use the original
|
||||
routine to determine the save path; this usually prompts a save dialog.
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@ Don't use the global menu bar on Linux.
|
||||
Set the trash implementation on Linux. Default is `gio`.
|
||||
|
||||
Options:
|
||||
|
||||
* `gvfs-trash`
|
||||
* `trash-cli`
|
||||
* `kioclient5`
|
||||
@@ -115,7 +116,6 @@ Options:
|
||||
The following environment variables are intended primarily for development and
|
||||
debugging purposes.
|
||||
|
||||
|
||||
### `ELECTRON_ENABLE_LOGGING`
|
||||
|
||||
Prints Chrome's internal logging to the console.
|
||||
|
||||
@@ -15,7 +15,7 @@ extension capabilities.
|
||||
|
||||
Electron only supports loading unpacked extensions (i.e., `.crx` files do not
|
||||
work). Extensions are installed per-`session`. To load an extension, call
|
||||
[`ses.loadExtension`](session.md#sesloadextensionpath):
|
||||
[`ses.loadExtension`](session.md#sesloadextensionpath-options):
|
||||
|
||||
```js
|
||||
const { session } = require('electron')
|
||||
@@ -74,6 +74,7 @@ The following methods of `chrome.runtime` are supported:
|
||||
|
||||
- `chrome.runtime.getBackgroundPage`
|
||||
- `chrome.runtime.getManifest`
|
||||
- `chrome.runtime.getPlatformInfo`
|
||||
- `chrome.runtime.getURL`
|
||||
- `chrome.runtime.connect`
|
||||
- `chrome.runtime.sendMessage`
|
||||
|
||||
@@ -12,7 +12,6 @@ options on the [`BrowserWindow`](browser-window.md) class.
|
||||
To create a frameless window, you need to set `frame` to `false` in
|
||||
[BrowserWindow](browser-window.md)'s `options`:
|
||||
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow({ width: 800, height: 600, frame: false })
|
||||
@@ -83,12 +82,15 @@ win.show()
|
||||
* The `blur` filter only applies to the web page, so there is no way to apply
|
||||
blur effect to the content below the window (i.e. other applications open on
|
||||
the user's system).
|
||||
* On Windows operating systems, transparent windows will not work when DWM is
|
||||
* The window will not be transparent when DevTools is opened.
|
||||
* On Windows operating systems,
|
||||
* transparent windows will not work when DWM is
|
||||
disabled.
|
||||
* transparent windows can not be maximized using the Windows system menu or by double clicking the title bar. The reasoning behind this can be seen on [this pull request](https://github.com/electron/electron/pull/28207).
|
||||
* On Linux, users have to put `--enable-transparent-visuals --disable-gpu` in
|
||||
the command line to disable GPU and allow ARGB to make transparent window,
|
||||
this is caused by an upstream bug that [alpha channel doesn't work on some
|
||||
NVidia drivers](https://code.google.com/p/chromium/issues/detail?id=369209) on
|
||||
NVidia drivers](https://bugs.chromium.org/p/chromium/issues/detail?id=369209) on
|
||||
Linux.
|
||||
* On Mac, the native window shadow will not be shown on a transparent window.
|
||||
|
||||
@@ -112,13 +114,19 @@ optional parameter can be used to forward mouse move messages to the web page,
|
||||
allowing events such as `mouseleave` to be emitted:
|
||||
|
||||
```javascript
|
||||
const win = require('electron').remote.getCurrentWindow()
|
||||
const { ipcRenderer } = require('electron')
|
||||
const el = document.getElementById('clickThroughElement')
|
||||
el.addEventListener('mouseenter', () => {
|
||||
win.setIgnoreMouseEvents(true, { forward: true })
|
||||
ipcRenderer.send('set-ignore-mouse-events', true, { forward: true })
|
||||
})
|
||||
el.addEventListener('mouseleave', () => {
|
||||
win.setIgnoreMouseEvents(false)
|
||||
ipcRenderer.send('set-ignore-mouse-events', false)
|
||||
})
|
||||
|
||||
// Main process
|
||||
const { ipcMain } = require('electron')
|
||||
ipcMain.on('set-ignore-mouse-events', (event, ...args) => {
|
||||
BrowserWindow.fromWebContents(event.sender).setIgnoreMouseEvents(...args)
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ applicative code.
|
||||
|
||||
#### Event: 'end'
|
||||
|
||||
Indicates that response body has ended.
|
||||
Indicates that response body has ended. Must be placed before 'data' event.
|
||||
|
||||
#### Event: 'aborted'
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ The main process should listen for `channel` with
|
||||
[`ipcMain.handle()`](ipc-main.md#ipcmainhandlechannel-listener).
|
||||
|
||||
For example:
|
||||
|
||||
```javascript
|
||||
// Renderer process
|
||||
ipcRenderer.invoke('some-name', someArgument).then((result) => {
|
||||
@@ -161,6 +162,7 @@ The transferred `MessagePort` objects will be available in the main process as
|
||||
property of the emitted event.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
// Renderer process
|
||||
const { port1, port2 } = new MessageChannel()
|
||||
|
||||
@@ -14,7 +14,7 @@ See [`Menu`](menu.md) for examples.
|
||||
* `menuItem` MenuItem
|
||||
* `browserWindow` [BrowserWindow](browser-window.md) | undefined - This will not be defined if no window is open.
|
||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `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).
|
||||
* `type` String (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
|
||||
`radio`.
|
||||
@@ -31,6 +31,7 @@ See [`Menu`](menu.md) for examples.
|
||||
menu items.
|
||||
* `registerAccelerator` Boolean (optional) _Linux_ _Windows_ - If false, the accelerator won't be registered
|
||||
with the system, but it will still be displayed. Defaults to true.
|
||||
* `sharingItem` SharingItem (optional) _macOS_ - The item to share when the `role` is `shareMenu`.
|
||||
* `submenu` (MenuItemConstructorOptions[] | [Menu](menu.md)) (optional) - Should be specified
|
||||
for `submenu` type menu items. If `submenu` is specified, the `type: 'submenu'` can be omitted.
|
||||
If the value is not a [`Menu`](menu.md) then it will be automatically converted to one using
|
||||
@@ -87,6 +88,7 @@ The `role` property can have following values:
|
||||
* `resetZoom` - Reset the focused page's zoom level to the original size.
|
||||
* `zoomIn` - Zoom in the focused page by 10%.
|
||||
* `zoomOut` - Zoom out the focused page by 10%.
|
||||
* `toggleSpellChecker` - Enable/disable builtin spell checker.
|
||||
* `fileMenu` - Whole default "File" menu (Close / Quit)
|
||||
* `editMenu` - Whole default "Edit" menu (Undo, Copy, etc.).
|
||||
* `viewMenu` - Whole default "View" menu (Reload, Toggle Developer Tools, etc.)
|
||||
@@ -112,6 +114,7 @@ The following additional roles are available on _macOS_:
|
||||
* `services` - The submenu is a ["Services"](https://developer.apple.com/documentation/appkit/nsapplication/1428608-servicesmenu?language=objc) menu. This is only intended for use in the Application Menu and is *not* the same as the "Services" submenu used in context menus in macOS apps, which is not implemented in Electron.
|
||||
* `recentDocuments` - The submenu is an "Open Recent" menu.
|
||||
* `clearRecentDocuments` - Map to the `clearRecentDocuments` action.
|
||||
* `shareMenu` - The submenu is [share menu][ShareMenu]. The `sharingItem` property must also be set to indicate the item to share.
|
||||
|
||||
When specifying a `role` on macOS, `label` and `accelerator` are the only
|
||||
options that will affect the menu item. All other options will be ignored.
|
||||
@@ -136,6 +139,7 @@ A `String` indicating the item's visible label.
|
||||
|
||||
A `Function` that is fired when the MenuItem receives a click event.
|
||||
It can be called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
|
||||
|
||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||
* `focusedWindow` [BrowserWindow](browser-window.md)
|
||||
* `focusedWebContents` [WebContents](web-contents.md)
|
||||
@@ -200,6 +204,12 @@ system or just displayed.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
#### `menuItem.sharingItem` _macOS_
|
||||
|
||||
A `SharingItem` indicating the item to share when the `role` is `shareMenu`.
|
||||
|
||||
This property can be dynamically changed.
|
||||
|
||||
#### `menuItem.commandId`
|
||||
|
||||
A `Number` indicating an item's sequential unique id.
|
||||
@@ -207,3 +217,5 @@ A `Number` indicating an item's sequential unique id.
|
||||
#### `menuItem.menu`
|
||||
|
||||
A `Menu` that the item is a part of.
|
||||
|
||||
[ShareMenu]: https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/
|
||||
|
||||
@@ -141,13 +141,7 @@ can have a submenu.
|
||||
|
||||
## Examples
|
||||
|
||||
The `Menu` class is only available in the main process, but you can also use it
|
||||
in the render process via the [`remote`](remote.md) module.
|
||||
|
||||
### Main process
|
||||
|
||||
An example of creating the application menu in the main process with the
|
||||
simple template API:
|
||||
An example of creating the application menu with the simple template API:
|
||||
|
||||
```javascript
|
||||
const { app, Menu } = require('electron')
|
||||
@@ -257,26 +251,36 @@ Menu.setApplicationMenu(menu)
|
||||
|
||||
### Render process
|
||||
|
||||
Below is an example of creating a menu dynamically in a web page
|
||||
(render process) by using the [`remote`](remote.md) module, and showing it when
|
||||
the user right clicks the page:
|
||||
To create menus initiated by the renderer process, send the required
|
||||
information to the main process using IPC and have the main process display the
|
||||
menu on behalf of the renderer.
|
||||
|
||||
```html
|
||||
<!-- index.html -->
|
||||
<script>
|
||||
const { remote } = require('electron')
|
||||
const { Menu, MenuItem } = remote
|
||||
|
||||
const menu = new Menu()
|
||||
menu.append(new MenuItem({ label: 'MenuItem1', click() { console.log('item 1 clicked') } }))
|
||||
menu.append(new MenuItem({ type: 'separator' }))
|
||||
menu.append(new MenuItem({ label: 'MenuItem2', type: 'checkbox', checked: true }))
|
||||
Below is an example of showing a menu when the user right clicks the page:
|
||||
|
||||
```js
|
||||
// renderer
|
||||
window.addEventListener('contextmenu', (e) => {
|
||||
e.preventDefault()
|
||||
menu.popup({ window: remote.getCurrentWindow() })
|
||||
}, false)
|
||||
</script>
|
||||
ipcRenderer.send('show-context-menu')
|
||||
})
|
||||
|
||||
ipcRenderer.on('context-menu-command', (e, command) => {
|
||||
// ...
|
||||
})
|
||||
|
||||
// main
|
||||
ipcMain.on('show-context-menu', (event) => {
|
||||
const template = [
|
||||
{
|
||||
label: 'Menu Item 1',
|
||||
click: () => { event.sender.send('context-menu-command', 'menu-item-1') }
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{ label: 'Menu Item 2', type: 'checkbox', checked: true }
|
||||
]
|
||||
const menu = Menu.buildFromTemplate(template)
|
||||
menu.popup(BrowserWindow.fromWebContents(event.sender))
|
||||
})
|
||||
```
|
||||
|
||||
## Notes on macOS Application Menu
|
||||
|
||||
@@ -12,10 +12,21 @@ channel messaging.
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
// Main process
|
||||
const { port1, port2 } = new MessageChannelMain()
|
||||
w.webContents.postMessage('port', null, [port2])
|
||||
port1.postMessage({ some: 'message' })
|
||||
|
||||
// Renderer process
|
||||
const { ipcRenderer } = require('electron')
|
||||
ipcRenderer.on('port', (e) => {
|
||||
// e.ports is a list of ports sent along with this message
|
||||
e.ports[0].on('message', (messageEvent) => {
|
||||
console.log(messageEvent.data)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
### Instance Properties
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
## Modernization
|
||||
|
||||
The Electron team is currently undergoing an initiative to modernize our API in a few concrete ways. These include: updating our modules to use idiomatic JS properties instead of separate `getPropertyX` and `setpropertyX`, converting callbacks to promises, and removing some other anti-patterns present in our APIs. The current status of the Promise initiative can be tracked in the [promisification](promisification.md) tracking file.
|
||||
|
||||
As we work to perform these updates, we seek to create the least disruptive amount of change at any given time, so as many changes as possible will be introduced in a backward compatible manner and deprecated after enough time has passed to give users a chance to upgrade their API calls.
|
||||
|
||||
This document and its child documents will be updated to reflect the latest status of our API changes.
|
||||
|
||||
* [Promisification](promisification.md)
|
||||
* [Property Updates](property-updates.md)
|
||||
@@ -1,42 +0,0 @@
|
||||
## Promisification
|
||||
|
||||
The Electron team recently underwent an initiative to convert callback-based APIs to Promise-based ones. See converted functions below:
|
||||
|
||||
- [app.getFileIcon(path[, options], callback)](https://github.com/electron/electron/blob/master/docs/api/app.md#getFileIcon)
|
||||
- [contents.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#capturePage)
|
||||
- [contents.executeJavaScript(code[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#executeJavaScript)
|
||||
- [contents.printToPDF(options, callback)](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#printToPDF)
|
||||
- [contents.savePage(fullPath, saveType, callback)](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#savePage)
|
||||
- [contentTracing.getCategories(callback)](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#getCategories)
|
||||
- [contentTracing.startRecording(options, callback)](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#startRecording)
|
||||
- [contentTracing.stopRecording(resultFilePath, callback)](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#stopRecording)
|
||||
- [contentTracing.getTraceBufferUsage(callback)](https://github.com/electron/electron/blob/master/docs/api/content-tracing.md#getTraceBufferUsage)
|
||||
- [cookies.flushStore(callback)](https://github.com/electron/electron/blob/master/docs/api/cookies.md#flushStore)
|
||||
- [cookies.get(filter, callback)](https://github.com/electron/electron/blob/master/docs/api/cookies.md#get)
|
||||
- [cookies.remove(url, name, callback)](https://github.com/electron/electron/blob/master/docs/api/cookies.md#remove)
|
||||
- [cookies.set(details, callback)](https://github.com/electron/electron/blob/master/docs/api/cookies.md#set)
|
||||
- [debugger.sendCommand(method[, commandParams, callback])](https://github.com/electron/electron/blob/master/docs/api/debugger.md#sendCommand)
|
||||
- [desktopCapturer.getSources(options, callback)](https://github.com/electron/electron/blob/master/docs/api/desktop-capturer.md#getSources)
|
||||
- [dialog.showOpenDialog([browserWindow, ]options[, callback])](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showOpenDialog)
|
||||
- [dialog.showSaveDialog([browserWindow, ]options[, callback])](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showSaveDialog)
|
||||
- [inAppPurchase.purchaseProduct(productID, quantity, callback)](https://github.com/electron/electron/blob/master/docs/api/in-app-purchase.md#purchaseProduct)
|
||||
- [inAppPurchase.getProducts(productIDs, callback)](https://github.com/electron/electron/blob/master/docs/api/in-app-purchase.md#getProducts)
|
||||
- [dialog.showMessageBox([browserWindow, ]options[, callback])](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showMessageBox)
|
||||
- [dialog.showCertificateTrustDialog([browserWindow, ]options, callback)](https://github.com/electron/electron/blob/master/docs/api/dialog.md#showCertificateTrustDialog)
|
||||
- [netLog.stopLogging([callback])](https://github.com/electron/electron/blob/master/docs/api/net-log.md#stopLogging)
|
||||
- [protocol.isProtocolHandled(scheme, callback)](https://github.com/electron/electron/blob/master/docs/api/protocol.md#isProtocolHandled)
|
||||
- [ses.clearHostResolverCache([callback])](https://github.com/electron/electron/blob/master/docs/api/session.md#clearHostResolverCache)
|
||||
- [ses.clearStorageData([options, callback])](https://github.com/electron/electron/blob/master/docs/api/session.md#clearStorageData)
|
||||
- [ses.setProxy(config, callback)](https://github.com/electron/electron/blob/master/docs/api/session.md#setProxy)
|
||||
- [ses.resolveProxy(url, callback)](https://github.com/electron/electron/blob/master/docs/api/session.md#resolveProxy)
|
||||
- [ses.getCacheSize(callback)](https://github.com/electron/electron/blob/master/docs/api/session.md#getCacheSize)
|
||||
- [ses.clearAuthCache(options[, callback])](https://github.com/electron/electron/blob/master/docs/api/session.md#clearAuthCache)
|
||||
- [ses.clearCache(callback)](https://github.com/electron/electron/blob/master/docs/api/session.md#clearCache)
|
||||
- [ses.getBlobData(identifier, callback)](https://github.com/electron/electron/blob/master/docs/api/session.md#getBlobData)
|
||||
- [shell.openExternal(url[, options, callback])](https://github.com/electron/electron/blob/master/docs/api/shell.md#openExternal)
|
||||
- [webFrame.executeJavaScript(code[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/web-frame.md#executeJavaScript)
|
||||
- [webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/web-frame.md#executeJavaScriptInIsolatedWorld)
|
||||
- [webviewTag.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/webview-tag.md#capturePage)
|
||||
- [webviewTag.executeJavaScript(code[, userGesture, callback])](https://github.com/electron/electron/blob/master/docs/api/webview-tag.md#executeJavaScript)
|
||||
- [webviewTag.printToPDF(options, callback)](https://github.com/electron/electron/blob/master/docs/api/webview-tag.md#printToPDF)
|
||||
- [win.capturePage([rect, ]callback)](https://github.com/electron/electron/blob/master/docs/api/browser-window.md#capturePage)
|
||||
@@ -1,41 +0,0 @@
|
||||
## Property Updates
|
||||
|
||||
The Electron team is currently undergoing an initiative to convert separate getter and setter functions in Electron to bespoke properties with `get` and `set` functionality. During this transition period, both the new properties and old getters and setters of these functions will work correctly and be documented.
|
||||
|
||||
## Candidates
|
||||
|
||||
* `BrowserWindow`
|
||||
* `menubarVisible`
|
||||
* `crashReporter` module
|
||||
* `uploadToServer`
|
||||
* `webFrame` modules
|
||||
* `zoomFactor`
|
||||
* `zoomLevel`
|
||||
* `audioMuted`
|
||||
* `<webview>`
|
||||
* `zoomFactor`
|
||||
* `zoomLevel`
|
||||
* `audioMuted`
|
||||
|
||||
## Converted Properties
|
||||
|
||||
* `app` module
|
||||
* `accessibilitySupport`
|
||||
* `applicationMenu`
|
||||
* `badgeCount`
|
||||
* `name`
|
||||
* `DownloadItem` class
|
||||
* `savePath`
|
||||
* `BrowserWindow` module
|
||||
* `autohideMenuBar`
|
||||
* `resizable`
|
||||
* `maximizable`
|
||||
* `minimizable`
|
||||
* `fullscreenable`
|
||||
* `movable`
|
||||
* `closable`
|
||||
* `backgroundThrottling`
|
||||
* `NativeImage`
|
||||
* `isMacTemplateImage`
|
||||
* `SystemPreferences` module
|
||||
* `appLevelAppearance`
|
||||
@@ -34,6 +34,7 @@ Setting this property to `system` will remove the override and
|
||||
everything will be reset to the OS default. By default `themeSource` is `system`.
|
||||
|
||||
Settings this property to `dark` will have the following effects:
|
||||
|
||||
* `nativeTheme.shouldUseDarkColors` will be `true` when accessed
|
||||
* Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.
|
||||
* Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.
|
||||
@@ -41,6 +42,7 @@ Settings this property to `dark` will have the following effects:
|
||||
* The `updated` event will be emitted
|
||||
|
||||
Settings this property to `light` will have the following effects:
|
||||
|
||||
* `nativeTheme.shouldUseDarkColors` will be `false` when accessed
|
||||
* Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.
|
||||
* Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.
|
||||
@@ -49,6 +51,7 @@ Settings this property to `light` will have the following effects:
|
||||
|
||||
The usage of this property should align with a classic "dark mode" state machine in your application
|
||||
where the user has three options.
|
||||
|
||||
* `Follow OS` --> `themeSource = 'system'`
|
||||
* `Dark Mode` --> `themeSource = 'dark'`
|
||||
* `Light Mode` --> `themeSource = 'light'`
|
||||
|
||||
@@ -8,7 +8,7 @@ The `net` module is a client-side API for issuing HTTP(S) requests. It is
|
||||
similar to the [HTTP](https://nodejs.org/api/http.html) and
|
||||
[HTTPS](https://nodejs.org/api/https.html) modules of Node.js but uses
|
||||
Chromium's native networking library instead of the Node.js implementation,
|
||||
offering better support for web proxies.
|
||||
offering better support for web proxies. It also supports checking network status.
|
||||
|
||||
The following is a non-exhaustive list of why you may consider using the `net`
|
||||
module instead of the native Node.js modules:
|
||||
@@ -62,3 +62,25 @@ Creates a [`ClientRequest`](./client-request.md) instance using the provided
|
||||
`options` which are directly forwarded to the `ClientRequest` constructor.
|
||||
The `net.request` method would be used to issue both secure and insecure HTTP
|
||||
requests according to the specified protocol scheme in the `options` object.
|
||||
|
||||
### `net.isOnline()`
|
||||
|
||||
Returns `Boolean` - Whether there is currently internet connection.
|
||||
|
||||
A return value of `false` is a pretty strong indicator that the user
|
||||
won't be able to connect to remote sites. However, a return value of
|
||||
`true` is inconclusive; even if some link is up, it is uncertain
|
||||
whether a particular connection attempt to a particular remote site
|
||||
will be successful.
|
||||
|
||||
## Properties
|
||||
|
||||
### `net.online` _Readonly_
|
||||
|
||||
A `Boolean` property. Whether there is currently internet connection.
|
||||
|
||||
A return value of `false` is a pretty strong indicator that the user
|
||||
won't be able to connect to remote sites. However, a return value of
|
||||
`true` is inconclusive; even if some link is up, it is uncertain
|
||||
whether a particular connection attempt to a particular remote site
|
||||
will be successful.
|
||||
|
||||
@@ -29,9 +29,9 @@ Returns `Boolean` - Whether or not desktop notifications are supported on the cu
|
||||
### `new Notification([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `title` String - A title for the notification, which will be shown at the top of the notification window when it is shown.
|
||||
* `title` String (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.
|
||||
* `subtitle` String (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
|
||||
* `body` String - The body text of the notification, which will be displayed below the title or subtitle.
|
||||
* `body` String (optional) - The body text of the notification, which will be displayed below the title or subtitle.
|
||||
* `silent` Boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.
|
||||
* `icon` (String | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
|
||||
* `hasReply` Boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
|
||||
@@ -41,6 +41,7 @@ Returns `Boolean` - Whether or not desktop notifications are supported on the cu
|
||||
* `urgency` String (optional) _Linux_ - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
|
||||
* `actions` [NotificationAction[]](structures/notification-action.md) (optional) _macOS_ - Actions to add to the notification. Please read the available actions and limitations in the `NotificationAction` documentation.
|
||||
* `closeButtonText` String (optional) _macOS_ - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.
|
||||
* `toastXml` String (optional) _Windows_ - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.
|
||||
|
||||
### Instance Events
|
||||
|
||||
@@ -94,6 +95,15 @@ Returns:
|
||||
* `event` Event
|
||||
* `index` Number - The index of the action that was activated.
|
||||
|
||||
#### Event: 'failed' _Windows_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `error` String - The error encountered during execution of the `show()` method.
|
||||
|
||||
Emitted when an error is encountered while creating and showing the native notification.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
Objects created with `new Notification` have the following instance methods:
|
||||
@@ -162,6 +172,10 @@ If `timeoutType` is set to 'never', the notification never expires. It stays ope
|
||||
|
||||
A [`NotificationAction[]`](structures/notification-action.md) property representing the actions of the notification.
|
||||
|
||||
#### `notification.toastXml` _Windows_
|
||||
|
||||
A `String` property representing the custom Toast XML of the notification.
|
||||
|
||||
### Playing Sounds
|
||||
|
||||
On macOS, you can specify the name of the sound you'd like to play when the
|
||||
|
||||
@@ -39,6 +39,14 @@ Emitted when the system is about to lock the screen.
|
||||
|
||||
Emitted as soon as the systems screen is unlocked.
|
||||
|
||||
### Event: 'user-did-become-active' _macOS_
|
||||
|
||||
Emitted when a login session is activated. See [documentation](https://developer.apple.com/documentation/appkit/nsworkspacesessiondidbecomeactivenotification?language=objc) for more information.
|
||||
|
||||
### Event: 'user-did-resign-active' _macOS_
|
||||
|
||||
Emitted when a login session is deactivated. See [documentation](https://developer.apple.com/documentation/appkit/nsworkspacesessiondidresignactivenotification?language=objc) for more information.
|
||||
|
||||
## Methods
|
||||
|
||||
The `powerMonitor` module has the following methods:
|
||||
@@ -57,3 +65,18 @@ before considered idle. `locked` is available on supported systems only.
|
||||
Returns `Integer` - Idle time in seconds
|
||||
|
||||
Calculate system idle time in seconds.
|
||||
|
||||
### `powerMonitor.isOnBatteryPower()`
|
||||
|
||||
Returns `Boolean` - Whether the system is on battery power.
|
||||
|
||||
To monitor for changes in this property, use the `on-battery` and `on-ac`
|
||||
events.
|
||||
|
||||
## Properties
|
||||
|
||||
### `powerMonitor.onBatteryPower`
|
||||
|
||||
A `Boolean` property. True if the system is on battery power.
|
||||
|
||||
See [`powerMonitor.isOnBatteryPower()`](#powermonitorisonbatterypower).
|
||||
|
||||
@@ -11,6 +11,7 @@ It adds the following events, properties, and methods:
|
||||
## Sandbox
|
||||
|
||||
In sandboxed renderers the `process` object contains only a subset of the APIs:
|
||||
|
||||
- `crash()`
|
||||
- `hang()`
|
||||
- `getCreationTime()`
|
||||
@@ -41,19 +42,6 @@ In sandboxed renderers the `process` object contains only a subset of the APIs:
|
||||
Emitted when Electron has loaded its internal initialization script and is
|
||||
beginning to load the web page or the main script.
|
||||
|
||||
It can be used by the preload script to add removed Node global symbols back to
|
||||
the global scope when node integration is turned off:
|
||||
|
||||
```javascript
|
||||
// preload.js
|
||||
const _setImmediate = setImmediate
|
||||
const _clearImmediate = clearImmediate
|
||||
process.once('loaded', () => {
|
||||
global.setImmediate = _setImmediate
|
||||
global.clearImmediate = _clearImmediate
|
||||
})
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
### `process.defaultApp` _Readonly_
|
||||
@@ -104,6 +92,7 @@ A `Boolean` that controls whether or not deprecations printed to `stderr` includ
|
||||
This property is instead of the `--trace-deprecation` command line flag.
|
||||
|
||||
### `process.traceProcessWarnings`
|
||||
|
||||
A `Boolean` that controls whether or not process warnings printed to `stderr` include
|
||||
their stack trace. Setting this to `true` will print stack traces for process warnings
|
||||
(including deprecations). This property is instead of the `--trace-warnings` command
|
||||
|
||||
@@ -112,7 +112,7 @@ expect streaming responses.
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
* `request` ProtocolRequest
|
||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||
* `callback` Function
|
||||
* `response` (String | [ProtocolResponse](structures/protocol-response.md))
|
||||
|
||||
@@ -133,7 +133,7 @@ from protocols that follow the "generic URI syntax" like `file:`.
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
* `request` ProtocolRequest
|
||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||
* `callback` Function
|
||||
* `response` (Buffer | [ProtocolResponse](structures/protocol-response.md))
|
||||
|
||||
@@ -157,7 +157,7 @@ protocol.registerBufferProtocol('atom', (request, callback) => {
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
* `request` ProtocolRequest
|
||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||
* `callback` Function
|
||||
* `response` (String | [ProtocolResponse](structures/protocol-response.md))
|
||||
|
||||
@@ -173,7 +173,7 @@ property.
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
* `request` ProtocolRequest
|
||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||
* `callback` Function
|
||||
* `response` ProtocolResponse
|
||||
|
||||
@@ -188,7 +188,7 @@ should be called with an object that has the `url` property.
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
* `request` ProtocolRequest
|
||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||
* `callback` Function
|
||||
* `response` (ReadableStream | [ProtocolResponse](structures/protocol-response.md))
|
||||
|
||||
@@ -251,7 +251,7 @@ Returns `Boolean` - Whether `scheme` is already registered.
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
* `request` ProtocolRequest
|
||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||
* `callback` Function
|
||||
* `response` (String | [ProtocolResponse](structures/protocol-response.md))
|
||||
|
||||
@@ -264,7 +264,7 @@ which sends a file as a response.
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
* `request` ProtocolRequest
|
||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||
* `callback` Function
|
||||
* `response` (String | [ProtocolResponse](structures/protocol-response.md))
|
||||
|
||||
@@ -277,7 +277,7 @@ which sends a `String` as a response.
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
* `request` ProtocolRequest
|
||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||
* `callback` Function
|
||||
* `response` (Buffer | [ProtocolResponse](structures/protocol-response.md))
|
||||
|
||||
@@ -290,7 +290,7 @@ which sends a `Buffer` as a response.
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
* `request` ProtocolRequest
|
||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||
* `callback` Function
|
||||
* `response` [ProtocolResponse](structures/protocol-response.md)
|
||||
|
||||
@@ -303,7 +303,7 @@ which sends a new HTTP request as a response.
|
||||
|
||||
* `scheme` String
|
||||
* `handler` Function
|
||||
* `request` ProtocolRequest
|
||||
* `request` [ProtocolRequest](structures/protocol-request.md)
|
||||
* `callback` Function
|
||||
* `response` (ReadableStream | [ProtocolResponse](structures/protocol-response.md))
|
||||
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
|
||||
Process: [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
> ⚠️ WARNING ⚠️
|
||||
> The `remote` module is [deprecated](https://github.com/electron/electron/issues/21408).
|
||||
> Instead of `remote`, use [`ipcRenderer`](ipc-renderer.md) and
|
||||
> [`ipcMain`](ipc-main.md).
|
||||
>
|
||||
> Read more about why the `remote` module is deprecated [here](https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31).
|
||||
>
|
||||
> If you still want to use `remote` despite the performance and security
|
||||
> concerns, see [@electron/remote](https://github.com/electron/remote).
|
||||
|
||||
The `remote` module provides a simple way to do inter-process communication
|
||||
(IPC) between the renderer process (web page) and the main process.
|
||||
|
||||
@@ -25,6 +35,7 @@ win.loadURL('https://github.com')
|
||||
you can use [webContents.executeJavaScript](web-contents.md#contentsexecutejavascriptcode-usergesture).
|
||||
|
||||
**Note:** The remote module can be disabled for security reasons in the following contexts:
|
||||
|
||||
- [`BrowserWindow`](browser-window.md) - by setting the `enableRemoteModule` option to `false`.
|
||||
- [`<webview>`](webview-tag.md) - by setting the `enableremotemodule` attribute to `false`.
|
||||
|
||||
@@ -140,11 +151,32 @@ console.log(app)
|
||||
|
||||
The `remote` module has the following methods:
|
||||
|
||||
### `remote.require(module)`
|
||||
### `remote.getCurrentWindow()`
|
||||
|
||||
* `module` String
|
||||
Returns [`BrowserWindow`](browser-window.md) - The window to which this web page
|
||||
belongs.
|
||||
|
||||
Returns `any` - The object returned by `require(module)` in the main process.
|
||||
**Note:** Do not use `removeAllListeners` on [`BrowserWindow`](browser-window.md).
|
||||
Use of this can remove all [`blur`](https://developer.mozilla.org/en-US/docs/Web/Events/blur)
|
||||
listeners, disable click events on touch bar buttons, and other unintended
|
||||
consequences.
|
||||
|
||||
### `remote.getCurrentWebContents()`
|
||||
|
||||
Returns [`WebContents`](web-contents.md) - The web contents of this web page.
|
||||
|
||||
### `remote.getGlobal(name)`
|
||||
|
||||
* `name` String
|
||||
|
||||
Returns `any` - The global variable of `name` (e.g. `global[name]`) in the main
|
||||
process.
|
||||
|
||||
## Properties
|
||||
|
||||
### `remote.require`
|
||||
|
||||
A `NodeJS.Require` function equivalent to `require(module)` in the main process.
|
||||
Modules specified by their relative path will resolve relative to the entrypoint
|
||||
of the main process.
|
||||
|
||||
@@ -176,29 +208,6 @@ module.exports = 'bar'
|
||||
const foo = require('electron').remote.require('./foo') // bar
|
||||
```
|
||||
|
||||
### `remote.getCurrentWindow()`
|
||||
|
||||
Returns [`BrowserWindow`](browser-window.md) - The window to which this web page
|
||||
belongs.
|
||||
|
||||
**Note:** Do not use `removeAllListeners` on [`BrowserWindow`](browser-window.md).
|
||||
Use of this can remove all [`blur`](https://developer.mozilla.org/en-US/docs/Web/Events/blur)
|
||||
listeners, disable click events on touch bar buttons, and other unintended
|
||||
consequences.
|
||||
|
||||
### `remote.getCurrentWebContents()`
|
||||
|
||||
Returns [`WebContents`](web-contents.md) - The web contents of this web page.
|
||||
|
||||
### `remote.getGlobal(name)`
|
||||
|
||||
* `name` String
|
||||
|
||||
Returns `any` - The global variable of `name` (e.g. `global[name]`) in the main
|
||||
process.
|
||||
|
||||
## Properties
|
||||
|
||||
### `remote.process` _Readonly_
|
||||
|
||||
A `NodeJS.Process` object. The `process` object in the main process. This is the same as
|
||||
|
||||
@@ -88,26 +88,17 @@ and preload.js:
|
||||
|
||||
```js
|
||||
// This file is loaded whenever a javascript context is created. It runs in a
|
||||
// private scope that can access a subset of Electron renderer APIs. We must be
|
||||
// careful to not leak any objects into the global scope!
|
||||
const { ipcRenderer, remote } = require('electron')
|
||||
const fs = remote.require('fs')
|
||||
|
||||
// read a configuration file using the `fs` module
|
||||
const buf = fs.readFileSync('allowed-popup-urls.json')
|
||||
const allowedUrls = JSON.parse(buf.toString('utf8'))
|
||||
// private scope that can access a subset of Electron renderer APIs. Without
|
||||
// contextIsolation enabled, it's possible to accidentally leak privileged
|
||||
// globals like ipcRenderer to web content.
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
const defaultWindowOpen = window.open
|
||||
|
||||
function customWindowOpen (url, ...args) {
|
||||
if (allowedUrls.indexOf(url) === -1) {
|
||||
ipcRenderer.sendSync('blocked-popup-notification', location.origin, url)
|
||||
return null
|
||||
}
|
||||
return defaultWindowOpen(url, ...args)
|
||||
window.open = function customWindowOpen (url, ...args) {
|
||||
ipcRenderer.send('report-window-open', location.origin, url, args)
|
||||
return defaultWindowOpen(url + '?from_electron=1', ...args)
|
||||
}
|
||||
|
||||
window.open = customWindowOpen
|
||||
```
|
||||
|
||||
Important things to notice in the preload script:
|
||||
@@ -115,8 +106,6 @@ Important things to notice in the preload script:
|
||||
- Even though the sandboxed renderer doesn't have Node.js running, it still has
|
||||
access to a limited node-like environment: `Buffer`, `process`, `setImmediate`,
|
||||
`clearImmediate` and `require` are available.
|
||||
- The preload script can indirectly access all APIs from the main process through the
|
||||
`remote` and `ipcRenderer` modules.
|
||||
- The preload script must be contained in a single script, but it is possible to have
|
||||
complex preload code composed with multiple modules by using a tool like
|
||||
webpack or browserify. An example of using browserify is below.
|
||||
@@ -144,15 +133,12 @@ following modules:
|
||||
- `desktopCapturer`
|
||||
- `ipcRenderer`
|
||||
- `nativeImage`
|
||||
- `remote`
|
||||
- `webFrame`
|
||||
- `events`
|
||||
- `timers`
|
||||
- `url`
|
||||
|
||||
More may be added as needed to expose more Electron APIs in the sandbox, but any
|
||||
module in the main process can already be used through
|
||||
`electron.remote.require`.
|
||||
More may be added as needed to expose more Electron APIs in the sandbox.
|
||||
|
||||
## Rendering untrusted content
|
||||
|
||||
|
||||
@@ -91,6 +91,41 @@ session.defaultSession.on('will-download', (event, item, webContents) => {
|
||||
})
|
||||
```
|
||||
|
||||
#### Event: 'extension-loaded'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `extension` [Extension](structures/extension.md)
|
||||
|
||||
Emitted after an extension is loaded. This occurs whenever an extension is
|
||||
added to the "enabled" set of extensions. This includes:
|
||||
|
||||
- Extensions being loaded from `Session.loadExtension`.
|
||||
- Extensions being reloaded:
|
||||
* from a crash.
|
||||
* if the extension requested it ([`chrome.runtime.reload()`](https://developer.chrome.com/extensions/runtime#method-reload)).
|
||||
|
||||
#### Event: 'extension-unloaded'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `extension` [Extension](structures/extension.md)
|
||||
|
||||
Emitted after an extension is unloaded. This occurs when
|
||||
`Session.removeExtension` is called.
|
||||
|
||||
#### Event: 'extension-ready'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `extension` [Extension](structures/extension.md)
|
||||
|
||||
Emitted after an extension is loaded and all necessary browser state is
|
||||
initialized to support the start of the extension's background page.
|
||||
|
||||
#### Event: 'preconnect'
|
||||
|
||||
Returns:
|
||||
@@ -144,6 +179,76 @@ Emitted when a hunspell dictionary file download fails. For details
|
||||
on the failure you should collect a netlog and inspect the download
|
||||
request.
|
||||
|
||||
#### Event: 'select-serial-port' _Experimental_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `portList` [SerialPort[]](structures/serial-port.md)
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
* `callback` Function
|
||||
* `portId` String
|
||||
|
||||
Emitted when a serial port needs to be selected when a call to
|
||||
`navigator.serial.requestPort` is made. `callback` should be called with
|
||||
`portId` to be selected, passing an empty string to `callback` will
|
||||
cancel the request. Additionally, permissioning on `navigator.serial` can
|
||||
be managed by using [ses.setPermissionCheckHandler(handler)](#sessetpermissioncheckhandlerhandler)
|
||||
with the `serial` permission.
|
||||
|
||||
Because this is an experimental feature it is disabled by default. To enable this feature, you
|
||||
will need to use the `--enable-features=ElectronSerialChooser` command line switch. Additionally
|
||||
because this is an experimental Chromium feature you will need to set `enableBlinkFeatures: 'Serial'`
|
||||
on the `webPreferences` property when opening a BrowserWindow.
|
||||
|
||||
```javascript
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
|
||||
let win = null
|
||||
app.commandLine.appendSwitch('enable-features', 'ElectronSerialChooser')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
enableBlinkFeatures: 'Serial'
|
||||
}
|
||||
})
|
||||
win.webContents.session.on('select-serial-port', (event, portList, callback) => {
|
||||
event.preventDefault()
|
||||
const selectedPort = portList.find((device) => {
|
||||
return device.vendorId === 0x2341 && device.productId === 0x0043
|
||||
})
|
||||
if (!selectedPort) {
|
||||
callback('')
|
||||
} else {
|
||||
callback(result1.portId)
|
||||
}
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
#### Event: 'serial-port-added' _Experimental_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `port` [SerialPort](structures/serial-port.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.
|
||||
|
||||
#### Event: 'serial-port-removed' _Experimental_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `port` [SerialPort](structures/serial-port.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.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The following methods are available on instances of `Session`:
|
||||
@@ -179,6 +284,27 @@ Writes any unwritten DOMStorage data to disk.
|
||||
#### `ses.setProxy(config)`
|
||||
|
||||
* `config` Object
|
||||
* `mode` String (optional) - The proxy mode. Should be one of `direct`,
|
||||
`auto_detect`, `pac_script`, `fixed_servers` or `system`. If it's
|
||||
unspecified, it will be automatically determined based on other specified
|
||||
options.
|
||||
* `direct`
|
||||
In direct mode all connections are created directly, without any proxy involved.
|
||||
* `auto_detect`
|
||||
In auto_detect mode the proxy configuration is determined by a PAC script that can
|
||||
be downloaded at http://wpad/wpad.dat.
|
||||
* `pac_script`
|
||||
In pac_script mode the proxy configuration is determined by a PAC script that is
|
||||
retrieved from the URL specified in the `pacScript`. This is the default mode
|
||||
if `pacScript` is specified.
|
||||
* `fixed_servers`
|
||||
In fixed_servers mode the proxy configuration is specified in `proxyRules`.
|
||||
This is the default mode if `proxyRules` is specified.
|
||||
* `system`
|
||||
In system mode the proxy configuration is taken from the operating system.
|
||||
Note that the system mode is different from setting no proxy configuration.
|
||||
In the latter case, Electron falls back to the system settings
|
||||
only if no command-line options influence the proxy configuration.
|
||||
* `pacScript` String (optional) - The URL associated with the PAC file.
|
||||
* `proxyRules` String (optional) - Rules indicating which proxies to use.
|
||||
* `proxyBypassRules` String (optional) - Rules indicating which URLs should
|
||||
@@ -188,9 +314,12 @@ Returns `Promise<void>` - Resolves when the proxy setting process is complete.
|
||||
|
||||
Sets the proxy settings.
|
||||
|
||||
When `pacScript` and `proxyRules` are provided together, the `proxyRules`
|
||||
When `mode` is unspecified, `pacScript` and `proxyRules` are provided together, the `proxyRules`
|
||||
option is ignored and `pacScript` configuration is applied.
|
||||
|
||||
You may need `ses.closeAllConnections` to close currently in flight connections to prevent
|
||||
pooled sockets using previous proxy from being reused by future requests.
|
||||
|
||||
The `proxyRules` has to follow the rules below:
|
||||
|
||||
```sh
|
||||
@@ -226,7 +355,7 @@ The `proxyBypassRules` is a comma separated list of rules described below:
|
||||
"foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
|
||||
"https://x.*.y.com:99"
|
||||
|
||||
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
|
||||
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
|
||||
|
||||
Match a particular domain suffix.
|
||||
|
||||
@@ -259,6 +388,10 @@ The `proxyBypassRules` is a comma separated list of rules described below:
|
||||
|
||||
Returns `Promise<String>` - Resolves with the proxy information for `url`.
|
||||
|
||||
#### `ses.forceReloadProxyConfig()`
|
||||
|
||||
Returns `Promise<void>` - Resolves when the all internal states of proxy service is reset and the latest proxy configuration is reapplied if it's already available. The pac script will be fetched from `pacScript` again if the proxy mode is `pac_script`.
|
||||
|
||||
#### `ses.setDownloadPath(path)`
|
||||
|
||||
* `path` String - The download location.
|
||||
@@ -300,6 +433,12 @@ window.webContents.session.enableNetworkEmulation({ offline: true })
|
||||
|
||||
Preconnects the given number of sockets to an origin.
|
||||
|
||||
#### `ses.closeAllConnections()`
|
||||
|
||||
Returns `Promise<void>` - Resolves when all connections are closed.
|
||||
|
||||
**Note:** It will terminate / fail all requests currently in flight.
|
||||
|
||||
#### `ses.disableNetworkEmulation()`
|
||||
|
||||
Disables any network emulation already active for the `session`. Resets to
|
||||
@@ -316,7 +455,7 @@ the original network configuration.
|
||||
* `errorCode` Integer - Error code.
|
||||
* `callback` Function
|
||||
* `verificationResult` Integer - Value can be one of certificate error codes
|
||||
from [here](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h).
|
||||
from [here](https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h).
|
||||
Apart from the certificate error codes, the following special codes can be used.
|
||||
* `0` - Indicates success and disables Certificate Transparency verification.
|
||||
* `-2` - Indicates failure.
|
||||
@@ -344,6 +483,8 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
|
||||
})
|
||||
```
|
||||
|
||||
> **NOTE:** The result of this procedure is cached by the network service.
|
||||
|
||||
#### `ses.setPermissionRequestHandler(handler)`
|
||||
|
||||
* `handler` Function | null
|
||||
@@ -351,6 +492,7 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
|
||||
* `permission` String - The type of requested permission.
|
||||
* `clipboard-read` - Request access to read from the clipboard.
|
||||
* `media` - Request access to media devices such as camera, microphone and speakers.
|
||||
* `display-capture` - Request access to capture the screen.
|
||||
* `mediaKeySystem` - Request access to DRM protected content.
|
||||
* `geolocation` - Request access to user's current location.
|
||||
* `notifications` - Request notification creation and the ability to display them in the user's system tray.
|
||||
@@ -387,7 +529,7 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
|
||||
|
||||
* `handler` Function\<Boolean> | null
|
||||
* `webContents` [WebContents](web-contents.md) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin.
|
||||
* `permission` String - Enum of 'media'.
|
||||
* `permission` String - Type of permission check. Valid values are `midiSysex`, `notifications`, `geolocation`, `media`,`mediaKeySystem`,`midi`, `pointerLock`, `fullscreen`, `openExternal`, or `serial`.
|
||||
* `requestingOrigin` String - The origin URL of the permission check
|
||||
* `details` Object - Some properties are only available on certain permission types.
|
||||
* `securityOrigin` String - The security origin of the `media` check.
|
||||
@@ -459,6 +601,29 @@ will be temporary.
|
||||
|
||||
Returns `String` - The user agent for this session.
|
||||
|
||||
#### `ses.setSSLConfig(config)`
|
||||
|
||||
* `config` Object
|
||||
* `minVersion` String (optional) - Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. The
|
||||
minimum SSL version to allow when connecting to remote servers. Defaults to
|
||||
`tls1`.
|
||||
* `maxVersion` String (optional) - Can be `tls1.2` or `tls1.3`. The maximum SSL version
|
||||
to allow when connecting to remote servers. Defaults to `tls1.3`.
|
||||
* `disabledCipherSuites` Integer[] (optional) - List of cipher suites which
|
||||
should be explicitly prevented from being used in addition to those
|
||||
disabled by the net built-in policy.
|
||||
Supported literal forms: 0xAABB, where AA is `cipher_suite[0]` and BB is
|
||||
`cipher_suite[1]`, as defined in RFC 2246, Section 7.4.1.2. Unrecognized but
|
||||
parsable cipher suites in this form will not return an error.
|
||||
Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify 0x0004, while to
|
||||
disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002.
|
||||
Note that TLSv1.3 ciphers cannot be disabled using this mechanism.
|
||||
|
||||
Sets the SSL configuration for the session. All subsequent network requests
|
||||
will use the new configuration. Existing network connections (such as WebSocket
|
||||
connections) will not be terminated, but old sockets in the pool will not be
|
||||
reused for new connections.
|
||||
|
||||
#### `ses.getBlobData(identifier)`
|
||||
|
||||
* `identifier` String - Valid UUID.
|
||||
@@ -511,6 +676,16 @@ this session just before normal `preload` scripts run.
|
||||
Returns `String[]` an array of paths to preload scripts that have been
|
||||
registered.
|
||||
|
||||
#### `ses.setSpellCheckerEnabled(enable)`
|
||||
|
||||
* `enable` Boolean
|
||||
|
||||
Sets whether to enable the builtin spell checker.
|
||||
|
||||
#### `ses.isSpellCheckerEnabled()`
|
||||
|
||||
Returns `Boolean` - Whether the builtin spell checker is enabled.
|
||||
|
||||
#### `ses.setSpellCheckerLanguages(languages)`
|
||||
|
||||
* `languages` String[] - An array of language codes to enable the spellchecker for.
|
||||
@@ -568,9 +743,13 @@ will not work on non-persistent (in-memory) sessions.
|
||||
|
||||
**Note:** On macOS and Windows 10 this word will be removed from the OS custom dictionary as well
|
||||
|
||||
#### `ses.loadExtension(path)`
|
||||
#### `ses.loadExtension(path[, options])`
|
||||
|
||||
* `path` String - Path to a directory containing an unpacked Chrome extension
|
||||
* `options` Object (optional)
|
||||
* `allowFileAccess` Boolean - Whether to allow the extension to read local files over `file://`
|
||||
protocol and inject content scripts into `file://` pages. This is required e.g. for loading
|
||||
devtools extensions on `file://` URLs. Defaults to false.
|
||||
|
||||
Returns `Promise<Extension>` - resolves when the extension is loaded.
|
||||
|
||||
@@ -593,7 +772,11 @@ const { app, session } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
app.on('ready', async () => {
|
||||
await session.defaultSession.loadExtension(path.join(__dirname, 'react-devtools'))
|
||||
await session.defaultSession.loadExtension(
|
||||
path.join(__dirname, 'react-devtools'),
|
||||
// allowFileAccess is required to load the devtools extension on file:// URLs.
|
||||
{ allowFileAccess: true }
|
||||
)
|
||||
// Note that in order to use the React DevTools extension, you'll need to
|
||||
// download and unzip a copy of the extension.
|
||||
})
|
||||
@@ -639,7 +822,11 @@ The following properties are available on instances of `Session`:
|
||||
#### `ses.availableSpellCheckerLanguages` _Readonly_
|
||||
|
||||
A `String[]` array which consists of all the known available spell checker languages. Providing a language
|
||||
code to the `setSpellCheckerLanaguages` API that isn't in this array will result in an error.
|
||||
code to the `setSpellCheckerLanguages` API that isn't in this array will result in an error.
|
||||
|
||||
#### `ses.spellCheckerEnabled`
|
||||
|
||||
A `Boolean` indicating whether builtin spell checker is enabled.
|
||||
|
||||
#### `ses.cookies` _Readonly_
|
||||
|
||||
@@ -663,12 +850,12 @@ const path = require('path')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const protocol = session.fromPartition('some-partition').protocol
|
||||
protocol.registerFileProtocol('atom', (request, callback) => {
|
||||
if (!protocol.registerFileProtocol('atom', (request, callback) => {
|
||||
const url = request.url.substr(7)
|
||||
callback({ path: path.normalize(`${__dirname}/${url}`) })
|
||||
}, (error) => {
|
||||
if (error) console.error('Failed to register protocol')
|
||||
})
|
||||
})) {
|
||||
console.error('Failed to register protocol')
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
45
docs/api/share-menu.md
Normal file
45
docs/api/share-menu.md
Normal file
@@ -0,0 +1,45 @@
|
||||
## Class: ShareMenu
|
||||
|
||||
> Create share menu on macOS.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
The `ShareMenu` class creates [Share Menu][share-menu] on macOS, which can be
|
||||
used to share information from the current context to apps, social media
|
||||
accounts, and other services.
|
||||
|
||||
For including the share menu as a submenu of other menus, please use the
|
||||
`shareMenu` role of [`MenuItem`](menu-item.md).
|
||||
|
||||
### `new ShareMenu(sharingItem)`
|
||||
|
||||
* `sharingItem` SharingItem - The item to share.
|
||||
|
||||
Creates a new share menu.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The `shareMenu` object has the following instance methods:
|
||||
|
||||
#### `shareMenu.popup([options])`
|
||||
|
||||
* `options` PopupOptions (optional)
|
||||
* `browserWindow` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
|
||||
* `x` Number (optional) - Default is the current mouse cursor position.
|
||||
Must be declared if `y` is declared.
|
||||
* `y` Number (optional) - Default is the current mouse cursor position.
|
||||
Must be declared if `x` is declared.
|
||||
* `positioningItem` Number (optional) _macOS_ - The index of the menu item to
|
||||
be positioned under the mouse cursor at the specified coordinates. Default
|
||||
is -1.
|
||||
* `callback` Function (optional) - Called when menu is closed.
|
||||
|
||||
Pops up this menu as a context menu in the [`BrowserWindow`](browser-window.md).
|
||||
|
||||
#### `shareMenu.closePopup([browserWindow])`
|
||||
|
||||
* `browserWindow` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
|
||||
|
||||
Closes the context menu in the `browserWindow`.
|
||||
|
||||
[share-menu]: https://developer.apple.com/design/human-interface-guidelines/macos/extensions/share-extensions/
|
||||
@@ -45,15 +45,27 @@ Returns `Promise<void>`
|
||||
|
||||
Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent).
|
||||
|
||||
### `shell.moveItemToTrash(fullPath[, deleteOnFail])`
|
||||
### `shell.moveItemToTrash(fullPath[, deleteOnFail])` _Deprecated_
|
||||
|
||||
* `fullPath` String
|
||||
* `deleteOnFail` Boolean (optional) - Whether or not to unilaterally remove the item if the Trash is disabled or unsupported on the volume. _macOS_
|
||||
|
||||
Returns `Boolean` - Whether the item was successfully moved to the trash or otherwise deleted.
|
||||
|
||||
> NOTE: This method is deprecated. Use `shell.trashItem` instead.
|
||||
|
||||
Move the given file to trash and returns a boolean status for the operation.
|
||||
|
||||
### `shell.trashItem(path)`
|
||||
|
||||
* `path` String - path to the item to be moved to the trash.
|
||||
|
||||
Returns `Promise<void>` - Resolves when the operation has been completed.
|
||||
Rejects if there was an error while deleting the requested item.
|
||||
|
||||
This moves a path to the OS-specific trash location (Trash on macOS, Recycle
|
||||
Bin on Windows, and a desktop-environment-specific location on Linux).
|
||||
|
||||
### `shell.beep()`
|
||||
|
||||
Play the beep sound.
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* `colorSpace` String - represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions
|
||||
* `colorDepth` Number - The number of bits per pixel.
|
||||
* `depthPerComponent` Number - The number of bits per color component.
|
||||
* `displayFrequency` Number - The display refresh rate.
|
||||
* `bounds` [Rectangle](rectangle.md)
|
||||
* `size` [Size](size.md)
|
||||
* `workArea` [Rectangle](rectangle.md)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* `frameId` Integer - The ID of the renderer frame that sent this message
|
||||
* `returnValue` any - Set this to the value to be returned in a synchronous message
|
||||
* `sender` WebContents - Returns the `webContents` that sent the message
|
||||
* `senderFrame` WebFrameMain _Readonly_ - The frame that sent this message
|
||||
* `ports` MessagePortMain[] - A list of MessagePorts that were transferred with this message
|
||||
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
|
||||
* `channel` String
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
* `processId` Integer - The internal ID of the renderer process that sent this message
|
||||
* `frameId` Integer - The ID of the renderer frame that sent this message
|
||||
* `sender` WebContents - Returns the `webContents` that sent the message
|
||||
* `senderFrame` WebFrameMain _Readonly_ - The frame that sent this message
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
* `senderId` Integer - The `webContents.id` that sent the message, you can call `event.sender.sendTo(event.senderId, ...)` to reply to the message, see [ipcRenderer.sendTo][ipc-renderer-sendto] for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set `event.senderId` to `0`.
|
||||
* `ports` MessagePort[] - A list of MessagePorts that were transferred with this message
|
||||
|
||||
[ipc-renderer-sendto]: #ipcrenderersendtowindowid-channel--arg1-arg2-
|
||||
[ipc-renderer-sendto]: ../ipc-renderer.md#ipcrenderersendtowebcontentsid-channel-args
|
||||
|
||||
@@ -19,3 +19,7 @@
|
||||
property set then its `type` is assumed to be `tasks`. If the `name` property
|
||||
is set but the `type` property is omitted then the `type` is assumed to be
|
||||
`custom`.
|
||||
|
||||
**Note:** The maximum length of a Jump List item's `description` property is
|
||||
260 characters. Beyond this limit, the item will not be added to the Jump
|
||||
List, nor will it be displayed.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* `title` String (optional) - The text to be displayed for the item in the Jump List.
|
||||
Should only be set if `type` is `task`.
|
||||
* `description` String (optional) - Description of the task (displayed in a tooltip).
|
||||
Should only be set if `type` is `task`.
|
||||
Should only be set if `type` is `task`. Maximum length 260 characters.
|
||||
* `iconPath` String (optional) - The absolute path to an icon to be displayed in a
|
||||
Jump List, which can be an arbitrary resource file that contains an icon
|
||||
(e.g. `.ico`, `.exe`, `.dll`). You can usually specify `process.execPath` to
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# NewWindowWebContentsEvent Object extends `Event`
|
||||
|
||||
* `newGuest` BrowserWindow (optional)
|
||||
|
||||
|
||||
7
docs/api/structures/notification-response.md
Normal file
7
docs/api/structures/notification-response.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# NotificationResponse Object
|
||||
|
||||
* `actionIdentifier` String - The identifier string of the action that the user selected.
|
||||
* `date` Number - The delivery date of the notification.
|
||||
* `identifier` String - The unique identifier for this notification request.
|
||||
* `userInfo` Record<String, any> - A dictionary of custom information associated with the notification.
|
||||
* `userText` String (optional) - The text entered or chosen by the user.
|
||||
@@ -11,7 +11,8 @@
|
||||
* `Pepper Plugin`
|
||||
* `Pepper Plugin Broker`
|
||||
* `Unknown`
|
||||
* `name` String (optional) - The name of the process. i.e. for plugins it might be Flash.
|
||||
* `serviceName` String (optional) - The non-localized name of the process.
|
||||
* `name` String (optional) - The name of the process.
|
||||
Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc.
|
||||
* `cpu` [CPUUsage](cpu-usage.md) - CPU usage of the process.
|
||||
* `creationTime` Number - Creation time for this process.
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* `session` Session (optional) - The session used for requesting URL, by default
|
||||
the HTTP request will reuse the current session. Setting `session` to `null`
|
||||
would use a random independent session. This is only used for URL responses.
|
||||
* `uploadData` ProtocolResponseUploadData (optional) - The data used as upload data. This is only
|
||||
* `uploadData` [ProtocolResponseUploadData](protocol-response-upload-data.md) (optional) - The data used as upload data. This is only
|
||||
used for URL responses when `method` is `"POST"`.
|
||||
|
||||
[net-error]: https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h
|
||||
[net-error]: https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h
|
||||
|
||||
10
docs/api/structures/serial-port.md
Normal file
10
docs/api/structures/serial-port.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# SerialPort Object
|
||||
|
||||
* `portId` String - Unique identifier for the port.
|
||||
* `portName` String - Name of the port.
|
||||
* `displayName` String - A string suitable for display to the user for describing this device.
|
||||
* `vendorId` String - Optional USB vendor ID.
|
||||
* `productId` String - Optional USB product ID.
|
||||
* `serialNumber` String - The USB device serial number.
|
||||
* `usbDriverName` String (optional) - Represents a single serial port on macOS can be enumerated by multiple drivers.
|
||||
* `deviceInstanceId` String (optional) - A stable identifier on Windows that can be used for device permissions.
|
||||
5
docs/api/structures/sharing-item.md
Normal file
5
docs/api/structures/sharing-item.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# SharingItem Object
|
||||
|
||||
* `texts` String[] (optional) - An array of text to share.
|
||||
* `filePaths` String[] (optional) - An array of files to share.
|
||||
* `urls` String[] (optional) - An array of URLs to share.
|
||||
@@ -13,3 +13,5 @@ target's icon.
|
||||
DLL or EXE. Default is 0.
|
||||
* `appUserModelId` String (optional) - The Application User Model ID. Default
|
||||
is empty.
|
||||
* `toastActivatorClsid` String (optional) - The Application Toast Activator CLSID. Needed
|
||||
for participating in Action Center.
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# UploadBlob Object
|
||||
|
||||
* `type` String - `blob`.
|
||||
* `blobUUID` String - UUID of blob data to upload.
|
||||
@@ -1,6 +1,6 @@
|
||||
# UploadFile Object
|
||||
|
||||
* `type` String - `file`.
|
||||
* `type` 'file' - `file`.
|
||||
* `filePath` String - Path of file to be uploaded.
|
||||
* `offset` Integer - Defaults to `0`.
|
||||
* `length` Integer - Number of bytes to read from `offset`.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# UploadRawData Object
|
||||
|
||||
* `type` String - `rawData`.
|
||||
* `type` 'rawData' - `rawData`.
|
||||
* `bytes` Buffer - Data to be uploaded.
|
||||
|
||||
@@ -9,11 +9,11 @@ the [native modules](../tutorial/using-native-node-modules.md)).
|
||||
Electron also provides some extra built-in modules for developing native
|
||||
desktop applications. Some modules are only available in the main process, some
|
||||
are only available in the renderer process (web page), and some can be used in
|
||||
both processes.
|
||||
either process type.
|
||||
|
||||
The basic rule is: if a module is [GUI][gui] or low-level system related, then
|
||||
it should be only available in the main process. You need to be familiar with
|
||||
the concept of [main process vs. renderer process](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
the concept of [main process vs. renderer process](../tutorial/quick-start.md#main-and-renderer-processes)
|
||||
scripts to be able to use those modules.
|
||||
|
||||
The main process script is like a normal Node.js script:
|
||||
@@ -29,21 +29,21 @@ app.whenReady().then(() => {
|
||||
```
|
||||
|
||||
The renderer process is no different than a normal web page, except for the
|
||||
extra ability to use node modules:
|
||||
extra ability to use node modules if `nodeIntegration` is enabled:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
const { app } = require('electron').remote
|
||||
console.log(app.getVersion())
|
||||
const fs = require('fs')
|
||||
console.log(fs.readFileSync(__filename, 'utf8'))
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
To run your app, read [Run your app](../tutorial/first-app.md#running-your-app).
|
||||
To run your app, read [Run your app](../tutorial/quick-start.md#run-your-application).
|
||||
|
||||
## Destructuring assignment
|
||||
|
||||
|
||||
@@ -51,8 +51,6 @@ Returns:
|
||||
|
||||
Returns `Boolean` - Whether the system is in Dark Mode.
|
||||
|
||||
**Note:** On macOS 10.15 Catalina in order for this API to return the correct value when in the "automatic" dark mode setting you must either have `NSRequiresAquaSystemAppearance=false` in your `Info.plist` or be on Electron `>=7.0.0`. See the [dark mode guide](../tutorial/mojave-dark-mode-guide.md) for more information.
|
||||
|
||||
**Deprecated:** Should use the new [`nativeTheme.shouldUseDarkColors`](native-theme.md#nativethemeshouldusedarkcolors-readonly) API.
|
||||
|
||||
### `systemPreferences.isSwipeTrackingFromScrollEventsEnabled()` _macOS_
|
||||
@@ -132,6 +130,8 @@ This is necessary for events such as `NSUserDefaultsDidChangeNotification`.
|
||||
* `userInfo` Record<String, unknown>
|
||||
* `object` String
|
||||
|
||||
Returns `Number` - The ID of this subscription
|
||||
|
||||
Same as `subscribeNotification`, but uses `NSWorkspace.sharedWorkspace.notificationCenter`.
|
||||
This is necessary for events such as `NSWorkspaceDidActivateApplicationNotification`.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Create a button in the touch bar for native macOS applications
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBarButton(options)`
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Create a color picker in the touch bar for native macOS applications
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBarColorPicker(options)`
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Create a group in the touch bar for native macOS applications
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBarGroup(options)`
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Create a label in the touch bar for native macOS applications
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBarLabel(options)`
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
>
|
||||
> Note: Only one instance of this class can be added per TouchBar.
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBarOtherItemsProxy()`
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Create a popover in the touch bar for native macOS applications
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBarPopover(options)`
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Create a scrubber (a scrollable selector)
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBarScrubber(options)`
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Create a segmented control (a button group) where one button has a selected state
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBarSegmentedControl(options)`
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Create a slider in the touch bar for native macOS applications
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBarSlider(options)`
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Create a spacer between two items in the touch bar for native macOS applications
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBarSpacer(options)`
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Create TouchBar layouts for native macOS applications
|
||||
|
||||
Process: [Main](../tutorial/application-architecture.md#main-and-renderer-processes)
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### `new TouchBar(options)`
|
||||
|
||||
|
||||
@@ -52,12 +52,12 @@ app.whenReady().then(() => {
|
||||
appIcon.setContextMenu(contextMenu)
|
||||
})
|
||||
```
|
||||
|
||||
* On Windows it is recommended to use `ICO` icons to get best visual effects.
|
||||
|
||||
If you want to keep exact same behaviors on all platforms, you should not
|
||||
rely on the `click` event and always attach a context menu to the tray icon.
|
||||
|
||||
|
||||
### `new Tray(image, [guid])`
|
||||
|
||||
* `image` ([NativeImage](native-image.md) | String)
|
||||
|
||||
@@ -71,7 +71,7 @@ Returns:
|
||||
* `frameRoutingId` Integer
|
||||
|
||||
This event is like `did-finish-load` but emitted when the load failed.
|
||||
The full list of error codes and their meaning is available [here](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h).
|
||||
The full list of error codes and their meaning is available [here](https://source.chromium.org/chromium/chromium/src/+/master:net/base/net_error_list.h).
|
||||
|
||||
#### Event: 'did-fail-provisional-load'
|
||||
|
||||
@@ -135,7 +135,7 @@ Returns:
|
||||
|
||||
Emitted when page receives favicon urls.
|
||||
|
||||
#### Event: 'new-window'
|
||||
#### Event: 'new-window' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -156,6 +156,8 @@ Returns:
|
||||
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 requests to open a new window for a `url`. It could be
|
||||
requested by `window.open` or an external link like `<a target='_blank'>`.
|
||||
|
||||
@@ -190,6 +192,39 @@ myBrowserWindow.webContents.on('new-window', (event, url, frameName, disposition
|
||||
})
|
||||
```
|
||||
|
||||
#### Event: 'did-create-window'
|
||||
|
||||
Returns:
|
||||
* `window` BrowserWindow
|
||||
* `details` Object
|
||||
* `url` String - URL for the created window.
|
||||
* `frameName` String - Name given to the created window in the
|
||||
`window.open()` call.
|
||||
* `options` BrowserWindowConstructorOptions - The options used to create the
|
||||
BrowserWindow. They are merged in increasing precedence: options inherited
|
||||
from the parent, parsed options from the `features` string from
|
||||
`window.open()`, and options given by
|
||||
[`webContents.setWindowOpenHandler`](web-contents.md#contentssetwindowopenhandlerhandler).
|
||||
Unrecognized options are not filtered out.
|
||||
* `additionalFeatures` String[] - The non-standard features (features not
|
||||
handled Chromium or Electron) _Deprecated_
|
||||
* `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`.
|
||||
* `disposition` String - Can be `default`, `foreground-tab`,
|
||||
`background-tab`, `new-window`, `save-to-disk` and `other`.
|
||||
|
||||
Emitted _after_ successful creation of a window via `window.open` in the renderer.
|
||||
Not emitted if the creation of the window is canceled from
|
||||
[`webContents.setWindowOpenHandler`](web-contents.md#contentssetwindowopenhandlerhandler).
|
||||
|
||||
See [`window.open()`](window-open.md) for more details and how to use this in conjunction with `webContents.setWindowOpenHandler`.
|
||||
|
||||
#### Event: 'will-navigate'
|
||||
|
||||
Returns:
|
||||
@@ -220,7 +255,7 @@ Returns:
|
||||
* `frameProcessId` Integer
|
||||
* `frameRoutingId` Integer
|
||||
|
||||
Emitted when any frame (including main) starts navigating. `isInplace` will be
|
||||
Emitted when any frame (including main) starts navigating. `isInPlace` will be
|
||||
`true` for in-page navigations.
|
||||
|
||||
#### Event: 'will-redirect'
|
||||
@@ -367,6 +402,9 @@ Returns:
|
||||
* `oom` - Process ran out of memory
|
||||
* `launch-failed` - Process never successfully launched
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
* `exitCode` Integer - The exit code of the process, unless `reason` is
|
||||
`launch-failed`, in which case `exitCode` will be a platform-specific
|
||||
launch failure error code.
|
||||
|
||||
Emitted when the renderer process unexpectedly disappears. This is normally
|
||||
because it was crashed or killed.
|
||||
@@ -439,6 +477,7 @@ Emitted when the window leaves a full-screen state triggered by HTML API.
|
||||
#### Event: 'zoom-changed'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `zoomDirection` String - Can be `in` or `out`.
|
||||
|
||||
@@ -785,7 +824,7 @@ Returns:
|
||||
Emitted when `desktopCapturer.getSources()` is called in the renderer process.
|
||||
Calling `event.preventDefault()` will make it return empty sources.
|
||||
|
||||
#### Event: 'remote-require'
|
||||
#### Event: 'remote-require' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -796,7 +835,7 @@ Emitted when `remote.require()` is called in the renderer process.
|
||||
Calling `event.preventDefault()` will prevent the module from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
#### Event: 'remote-get-global'
|
||||
#### Event: 'remote-get-global' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -807,7 +846,7 @@ Emitted when `remote.getGlobal()` is called in the renderer process.
|
||||
Calling `event.preventDefault()` will prevent the global from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
#### Event: 'remote-get-builtin'
|
||||
#### Event: 'remote-get-builtin' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -818,7 +857,7 @@ Emitted when `remote.getBuiltin()` is called in the renderer process.
|
||||
Calling `event.preventDefault()` will prevent the module from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
#### Event: 'remote-get-current-window'
|
||||
#### Event: 'remote-get-current-window' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -828,7 +867,7 @@ Emitted when `remote.getCurrentWindow()` is called in the renderer process.
|
||||
Calling `event.preventDefault()` will prevent the object from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
#### Event: 'remote-get-current-web-contents'
|
||||
#### Event: 'remote-get-current-web-contents' _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -838,6 +877,19 @@ Emitted when `remote.getCurrentWebContents()` is called in the renderer process.
|
||||
Calling `event.preventDefault()` will prevent the object from being returned.
|
||||
Custom value can be returned by setting `event.returnValue`.
|
||||
|
||||
#### Event: 'preferred-size-changed'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `preferredSize` [Size](structures/size.md) - The minimum size needed to
|
||||
contain the layout of the document—without requiring scrolling.
|
||||
|
||||
Emitted when the `WebContents` preferred size has changed.
|
||||
|
||||
This event will only be emitted when `enablePreferredSizeMode` is set to `true`
|
||||
in `webPreferences`.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
#### `contents.loadURL(url[, options])`
|
||||
@@ -847,7 +899,7 @@ Custom value can be returned by setting `event.returnValue`.
|
||||
* `httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer url.
|
||||
* `userAgent` String (optional) - A user agent originating the request.
|
||||
* `extraHeaders` String (optional) - Extra headers separated by "\n".
|
||||
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md) | [UploadBlob[]](structures/upload-blob.md)) (optional)
|
||||
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md)) (optional)
|
||||
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
|
||||
|
||||
Returns `Promise<void>` - the promise will resolve when the page has finished loading
|
||||
@@ -1110,6 +1162,23 @@ Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
|
||||
|
||||
Ignore application menu shortcuts while this web contents is focused.
|
||||
|
||||
#### `contents.setWindowOpenHandler(handler)`
|
||||
|
||||
* `handler` Function<{action: 'deny'} | {action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions}>
|
||||
* `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`.
|
||||
* `frameName` String - Name of the window provided in `window.open()`
|
||||
* `features` String - Comma separated list of window features provided to `window.open()`.
|
||||
|
||||
Returns `{action: 'deny'} | {action: 'allow', 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.
|
||||
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
|
||||
the same effect as returning `{action: 'deny'}`.
|
||||
|
||||
Called before creating a window when `window.open()` is called from the
|
||||
renderer. See [`window.open()`](window-open.md) for more details and how to use this in conjunction with `did-create-window`.
|
||||
|
||||
#### `contents.setAudioMuted(muted)`
|
||||
|
||||
* `muted` Boolean
|
||||
@@ -1146,6 +1215,10 @@ increment above or below represents zooming 20% larger or smaller to default
|
||||
limits of 300% and 50% of original size, respectively. The formula for this is
|
||||
`scale := 1.2 ^ level`.
|
||||
|
||||
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> zoom level for a specific domain propagates across all instances of windows with
|
||||
> the same domain. Differentiating the window URLs will make zoom work per-window.
|
||||
|
||||
#### `contents.getZoomLevel()`
|
||||
|
||||
Returns `Number` - the current zoom level.
|
||||
@@ -1237,12 +1310,6 @@ Inserts `text` to the focused element.
|
||||
defaults to `false`.
|
||||
* `matchCase` Boolean (optional) - Whether search should be case-sensitive,
|
||||
defaults to `false`.
|
||||
* `wordStart` Boolean (optional) - Whether to look only at the start of words.
|
||||
defaults to `false`.
|
||||
* `medialCapitalAsWordStart` Boolean (optional) - When combined with `wordStart`,
|
||||
accepts a match in the middle of a word if the match begins with an
|
||||
uppercase letter followed by a lowercase or non-letter.
|
||||
Accepts several other intra-word matches, defaults to `false`.
|
||||
|
||||
Returns `Integer` - The request id used for the request.
|
||||
|
||||
@@ -1325,7 +1392,7 @@ Returns [`PrinterInfo[]`](structures/printer-info.md)
|
||||
* `pagesPerSheet` Number (optional) - The number of pages to print per page sheet.
|
||||
* `collate` Boolean (optional) - Whether the web page should be collated.
|
||||
* `copies` Number (optional) - The number of copies of the web page to print.
|
||||
* `pageRanges` Object[] (optional) - The page range to print. On macOS, only one range is honored.
|
||||
* `pageRanges` Object[] (optional) - The page range to print. On macOS, only one range is honored.
|
||||
* `from` Number - Index of the first page to print (0-based).
|
||||
* `to` Number - Index of the last page to print (inclusive) (0-based).
|
||||
* `duplexMode` String (optional) - Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or `longEdge`.
|
||||
@@ -1482,7 +1549,7 @@ An example of showing devtools in a `<webview>` tag:
|
||||
<webview id="browser" src="https://github.com"></webview>
|
||||
<webview id="devtools" src="about:blank"></webview>
|
||||
<script>
|
||||
const { webContents } = require('electron').remote
|
||||
const { ipcRenderer } = require('electron')
|
||||
const emittedOnce = (element, eventName) => new Promise(resolve => {
|
||||
element.addEventListener(eventName, event => resolve(event), { once: true })
|
||||
})
|
||||
@@ -1491,16 +1558,26 @@ An example of showing devtools in a `<webview>` tag:
|
||||
const browserReady = emittedOnce(browserView, 'dom-ready')
|
||||
const devtoolsReady = emittedOnce(devtoolsView, 'dom-ready')
|
||||
Promise.all([browserReady, devtoolsReady]).then(() => {
|
||||
const browser = webContents.fromId(browserView.getWebContentsId())
|
||||
const devtools = webContents.fromId(devtoolsView.getWebContentsId())
|
||||
browser.setDevToolsWebContents(devtools)
|
||||
browser.openDevTools()
|
||||
const targetId = browserView.getWebContentsId()
|
||||
const devtoolsId = devtoolsView.getWebContentsId()
|
||||
ipcRenderer.send('open-devtools', targetId, devtoolsId)
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```js
|
||||
// Main process
|
||||
const { ipcMain, webContents } = require('electron')
|
||||
ipcMain.on('open-devtools', (event, targetContentsId, devtoolsContentsId) => {
|
||||
const target = webContents.fromId(targetContentsId)
|
||||
const devtools = webContents.fromId(devtoolsContentsId)
|
||||
target.setDevToolsWebContents(devtools)
|
||||
target.openDevTools()
|
||||
})
|
||||
```
|
||||
|
||||
An example of showing devtools in a `BrowserWindow`:
|
||||
|
||||
```js
|
||||
@@ -1670,6 +1747,7 @@ process by accessing the `ports` property of the emitted event. When they
|
||||
arrive in the renderer, they will be native DOM `MessagePort` objects.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
// Main process
|
||||
const { port1, port2 } = new MessageChannelMain()
|
||||
@@ -1930,3 +2008,7 @@ A [`Debugger`](debugger.md) instance for this webContents.
|
||||
|
||||
A `Boolean` property that determines whether or not this WebContents will throttle animations and timers
|
||||
when the page becomes backgrounded. This also affects the Page Visibility API.
|
||||
|
||||
#### `contents.mainFrame` _Readonly_
|
||||
|
||||
A [`WebFrameMain`](web-frame-main.md) property that represents the top frame of the page's frame hierarchy.
|
||||
|
||||
184
docs/api/web-frame-main.md
Normal file
184
docs/api/web-frame-main.md
Normal file
@@ -0,0 +1,184 @@
|
||||
# webFrameMain
|
||||
|
||||
> Control web pages and iframes.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
The `webFrameMain` module can be used to lookup frames across existing
|
||||
[`WebContents`](web-contents.md) instances. Navigation events are the common
|
||||
use case.
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow, webFrameMain } = require('electron')
|
||||
|
||||
const win = new BrowserWindow({ width: 800, height: 1500 })
|
||||
win.loadURL('https://twitter.com')
|
||||
|
||||
win.webContents.on(
|
||||
'did-frame-navigate',
|
||||
(event, url, isMainFrame, frameProcessId, frameRoutingId) => {
|
||||
const frame = webFrameMain.fromId(frameProcessId, frameRoutingId)
|
||||
if (frame) {
|
||||
const code = 'document.body.innerHTML = document.body.innerHTML.replaceAll("heck", "h*ck")'
|
||||
frame.executeJavaScript(code)
|
||||
}
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
You can also access frames of existing pages by using the `mainFrame` property
|
||||
of [`WebContents`](web-contents.md).
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
async function main () {
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
await win.loadURL('https://reddit.com')
|
||||
|
||||
const youtubeEmbeds = win.webContents.mainFrame.frames.filter((frame) => {
|
||||
try {
|
||||
const url = new URL(frame.url)
|
||||
return url.host === 'www.youtube.com'
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
console.log(youtubeEmbeds)
|
||||
}
|
||||
|
||||
main()
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
These methods can be accessed from the `webFrameMain` module:
|
||||
|
||||
### `webFrameMain.fromId(processId, routingId)`
|
||||
|
||||
* `processId` Integer - An `Integer` representing the internal ID of the process which owns the frame.
|
||||
* `routingId` Integer - An `Integer` representing the unique frame ID in the
|
||||
current renderer process. Routing IDs can be retrieved from `WebFrameMain`
|
||||
instances (`frame.routingId`) and are also passed by frame
|
||||
specific `WebContents` navigation events (e.g. `did-frame-navigate`).
|
||||
|
||||
Returns `WebFrameMain | undefined` - A frame with the given process and routing IDs,
|
||||
or `undefined` if there is no WebFrameMain associated with the given IDs.
|
||||
|
||||
## Class: WebFrameMain
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
### Instance Methods
|
||||
|
||||
#### `frame.executeJavaScript(code[, userGesture])`
|
||||
|
||||
* `code` String
|
||||
* `userGesture` Boolean (optional) - Default is `false`.
|
||||
|
||||
Returns `Promise<unknown>` - A promise that resolves with the result of the executed
|
||||
code or is rejected if execution throws or results in a rejected promise.
|
||||
|
||||
Evaluates `code` in page.
|
||||
|
||||
In the browser window some HTML APIs like `requestFullScreen` can only be
|
||||
invoked by a gesture from the user. Setting `userGesture` to `true` will remove
|
||||
this limitation.
|
||||
|
||||
#### `frame.reload()`
|
||||
|
||||
Returns `boolean` - Whether the reload was initiated successfully. Only results in `false` when the frame has no history.
|
||||
|
||||
#### `frame.send(channel, ...args)`
|
||||
|
||||
* `channel` String
|
||||
* `...args` any[]
|
||||
|
||||
Send an asynchronous message to the renderer process via `channel`, along with
|
||||
arguments. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
The renderer process can handle the message by listening to `channel` with the
|
||||
[`ipcRenderer`](ipc-renderer.md) module.
|
||||
|
||||
#### `frame.postMessage(channel, message, [transfer])`
|
||||
|
||||
* `channel` String
|
||||
* `message` any
|
||||
* `transfer` MessagePortMain[] (optional)
|
||||
|
||||
Send a message to the renderer process, optionally transferring ownership of
|
||||
zero or more [`MessagePortMain`][] objects.
|
||||
|
||||
The transferred `MessagePortMain` objects will be available in the renderer
|
||||
process by accessing the `ports` property of the emitted event. When they
|
||||
arrive in the renderer, they will be native DOM `MessagePort` objects.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
// Main process
|
||||
const { port1, port2 } = new MessageChannelMain()
|
||||
webContents.mainFrame.postMessage('port', { message: 'hello' }, [port1])
|
||||
|
||||
// Renderer process
|
||||
ipcRenderer.on('port', (e, msg) => {
|
||||
const [port] = e.ports
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
### Instance Properties
|
||||
|
||||
#### `frame.url` _Readonly_
|
||||
|
||||
A `string` representing the current URL of the frame.
|
||||
|
||||
#### `frame.top` _Readonly_
|
||||
|
||||
A `WebFrameMain | null` representing top frame in the frame hierarchy to which `frame`
|
||||
belongs.
|
||||
|
||||
#### `frame.parent` _Readonly_
|
||||
|
||||
A `WebFrameMain | null` representing parent frame of `frame`, the property would be
|
||||
`null` if `frame` is the top frame in the frame hierarchy.
|
||||
|
||||
#### `frame.frames` _Readonly_
|
||||
|
||||
A `WebFrameMain[]` collection containing the direct descendents of `frame`.
|
||||
|
||||
#### `frame.framesInSubtree` _Readonly_
|
||||
|
||||
A `WebFrameMain[]` collection containing every frame in the subtree of `frame`,
|
||||
including itself. This can be useful when traversing through all frames.
|
||||
|
||||
#### `frame.frameTreeNodeId` _Readonly_
|
||||
|
||||
An `Integer` representing the id of the frame's internal FrameTreeNode
|
||||
instance. This id is browser-global and uniquely identifies a frame that hosts
|
||||
content. The identifier is fixed at the creation of the frame and stays
|
||||
constant for the lifetime of the frame. When the frame is removed, the id is
|
||||
not used again.
|
||||
|
||||
#### `frame.name` _Readonly_
|
||||
|
||||
A `String` representing the frame name.
|
||||
|
||||
#### `frame.osProcessId` _Readonly_
|
||||
|
||||
An `Integer` representing the operating system `pid` of the process which owns this frame.
|
||||
|
||||
#### `frame.processId` _Readonly_
|
||||
|
||||
An `Integer` representing the Chromium internal `pid` of the process which owns this frame.
|
||||
This is not the same as the OS process ID; to read that use `frame.osProcessId`.
|
||||
|
||||
#### `frame.routingId` _Readonly_
|
||||
|
||||
An `Integer` representing the unique frame id in the current renderer process.
|
||||
Distinct `WebFrameMain` instances that refer to the same underlying frame will
|
||||
have the same `routingId`.
|
||||
@@ -41,6 +41,10 @@ Changes the zoom level to the specified level. The original size is 0 and each
|
||||
increment above or below represents zooming 20% larger or smaller to default
|
||||
limits of 300% and 50% of original size, respectively.
|
||||
|
||||
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> zoom level for a specific domain propagates across all instances of windows with
|
||||
> the same domain. Differentiating the window URLs will make zoom work per-window.
|
||||
|
||||
### `webFrame.getZoomLevel()`
|
||||
|
||||
Returns `Number` - The current zoom level.
|
||||
@@ -171,6 +175,7 @@ reject and the `result` would be `undefined`. This is because Chromium does not
|
||||
dispatch errors of isolated worlds to foreign worlds.
|
||||
|
||||
### `webFrame.setIsolatedWorldInfo(worldId, info)`
|
||||
|
||||
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electrons `contextIsolation` feature. Chrome extensions reserve the range of IDs in `[1 << 20, 1 << 29)`. You can provide any integer here.
|
||||
* `info` Object
|
||||
* `securityOrigin` String (optional) - Security origin for the isolated world.
|
||||
@@ -253,6 +258,20 @@ renderer process.
|
||||
|
||||
Returns `WebFrame` - that has the supplied `routingId`, `null` if not found.
|
||||
|
||||
### `webFrame.isWordMisspelled(word)`
|
||||
|
||||
* `word` String - The word to be spellchecked.
|
||||
|
||||
Returns `Boolean` - True if the word is misspelled according to the built in
|
||||
spellchecker, false otherwise. If no dictionary is loaded, always return false.
|
||||
|
||||
### `webFrame.getWordSuggestions(word)`
|
||||
|
||||
* `word` String - The misspelled word.
|
||||
|
||||
Returns `String[]` - A list of suggested words for a given word. If the word
|
||||
is spelled correctly, the result will be empty.
|
||||
|
||||
## Properties
|
||||
|
||||
### `webFrame.top` _Readonly_
|
||||
|
||||
@@ -51,6 +51,8 @@ The following methods are available on instances of `WebRequest`:
|
||||
* `url` String
|
||||
* `method` String
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `resourceType` String
|
||||
* `referrer` String
|
||||
* `timestamp` Double
|
||||
@@ -94,6 +96,8 @@ Some examples of valid `urls`:
|
||||
* `url` String
|
||||
* `method` String
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `resourceType` String
|
||||
* `referrer` String
|
||||
* `timestamp` Double
|
||||
@@ -121,6 +125,8 @@ The `callback` has to be called with a `response` object.
|
||||
* `url` String
|
||||
* `method` String
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `resourceType` String
|
||||
* `referrer` String
|
||||
* `timestamp` Double
|
||||
@@ -141,6 +147,8 @@ response are visible by the time this listener is fired.
|
||||
* `url` String
|
||||
* `method` String
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `resourceType` String
|
||||
* `referrer` String
|
||||
* `timestamp` Double
|
||||
@@ -173,6 +181,8 @@ The `callback` has to be called with a `response` object.
|
||||
* `url` String
|
||||
* `method` String
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `resourceType` String
|
||||
* `referrer` String
|
||||
* `timestamp` Double
|
||||
@@ -197,6 +207,8 @@ and response headers are available.
|
||||
* `url` String
|
||||
* `method` String
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `resourceType` String
|
||||
* `referrer` String
|
||||
* `timestamp` Double
|
||||
@@ -222,6 +234,8 @@ redirect is about to occur.
|
||||
* `url` String
|
||||
* `method` String
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `resourceType` String
|
||||
* `referrer` String
|
||||
* `timestamp` Double
|
||||
@@ -245,6 +259,8 @@ completed.
|
||||
* `url` String
|
||||
* `method` String
|
||||
* `webContentsId` Integer (optional)
|
||||
* `webContents` WebContents (optional)
|
||||
* `frame` WebFrameMain (optional)
|
||||
* `resourceType` String
|
||||
* `referrer` String
|
||||
* `timestamp` Double
|
||||
|
||||
@@ -137,7 +137,7 @@ This option is disabled by default in the guest page.
|
||||
```
|
||||
|
||||
A `Boolean`. When this attribute is `false` the guest page in `webview` will not have access
|
||||
to the [`remote`](remote.md) module. The remote module is available by default.
|
||||
to the [`remote`](remote.md) module. The remote module is unavailable by default.
|
||||
|
||||
### `plugins`
|
||||
|
||||
@@ -274,7 +274,7 @@ webview.addEventListener('dom-ready', () => {
|
||||
* `httpReferrer` (String | [Referrer](structures/referrer.md)) (optional) - An HTTP Referrer url.
|
||||
* `userAgent` String (optional) - A user agent originating the request.
|
||||
* `extraHeaders` String (optional) - Extra headers separated by "\n"
|
||||
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md) | [UploadBlob[]](structures/upload-blob.md)) (optional)
|
||||
* `postData` ([UploadRawData[]](structures/upload-raw-data.md) | [UploadFile[]](structures/upload-file.md)) (optional)
|
||||
* `baseURLForDataURL` String (optional) - Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the specified `url` is a data url and needs to load other files.
|
||||
|
||||
Returns `Promise<void>` - The promise will resolve when the page has finished loading
|
||||
@@ -519,12 +519,6 @@ Inserts `text` to the focused element.
|
||||
defaults to `false`.
|
||||
* `matchCase` Boolean (optional) - Whether search should be case-sensitive,
|
||||
defaults to `false`.
|
||||
* `wordStart` Boolean (optional) - Whether to look only at the start of words.
|
||||
defaults to `false`.
|
||||
* `medialCapitalAsWordStart` Boolean (optional) - When combined with `wordStart`,
|
||||
accepts a match in the middle of a word if the match begins with an
|
||||
uppercase letter followed by a lowercase or non-letter.
|
||||
Accepts several other intra-word matches, defaults to `false`.
|
||||
|
||||
Returns `Integer` - The request id used for the request.
|
||||
|
||||
@@ -587,7 +581,7 @@ Prints `webview`'s web page. Same as `webContents.print([options])`.
|
||||
default margin, 1 for no margin, and 2 for minimum margin.
|
||||
and `width` in microns.
|
||||
* `scaleFactor` Number (optional) - The scale factor of the web page. Can range from 0 to 100.
|
||||
* `pageRanges` Record<string, number> (optional) - The page range to print.
|
||||
* `pageRanges` Record<string, number> (optional) - The page range to print. On macOS, only the first range is honored.
|
||||
* `from` Number - Index of the first page to print (0-based).
|
||||
* `to` Number - Index of the last page to print (inclusive) (0-based).
|
||||
* `pageSize` String | Size (optional) - Specify page size of the generated PDF. Can be `A3`,
|
||||
@@ -648,6 +642,10 @@ increment above or below represents zooming 20% larger or smaller to default
|
||||
limits of 300% and 50% of original size, respectively. The formula for this is
|
||||
`scale := 1.2 ^ level`.
|
||||
|
||||
> **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that the
|
||||
> zoom level for a specific domain propagates across all instances of windows with
|
||||
> the same domain. Differentiating the window URLs will make zoom work per-window.
|
||||
|
||||
### `<webview>.getZoomFactor()`
|
||||
|
||||
Returns `Number` - the current zoom factor.
|
||||
|
||||
@@ -1,18 +1,34 @@
|
||||
# `window.open` Function
|
||||
# Opening windows from the renderer
|
||||
|
||||
> Open a new window and load a URL.
|
||||
There are several ways to control how windows are created from trusted or
|
||||
untrusted content within a renderer. Windows can be created from the renderer in two ways:
|
||||
|
||||
When `window.open` is called to create a new window in a web page, a new instance
|
||||
of [`BrowserWindow`](browser-window.md) will be created for the `url` and a proxy will be returned
|
||||
to `window.open` to let the page have limited control over it.
|
||||
- clicking on links or submitting forms adorned with `target=_blank`
|
||||
- JavaScript calling `window.open()`
|
||||
|
||||
The proxy has limited standard functionality implemented to be
|
||||
compatible with traditional web pages. For full control of the new window
|
||||
you should create a `BrowserWindow` directly.
|
||||
In non-sandboxed renderers, or when `nativeWindowOpen` is false (the default), this results in the creation of a
|
||||
[`BrowserWindowProxy`](browser-window-proxy.md), a light wrapper around
|
||||
`BrowserWindow`.
|
||||
|
||||
The newly created `BrowserWindow` will inherit the parent window's options by
|
||||
default. To override inherited options you can set them in the `features`
|
||||
string.
|
||||
However, when the `sandbox` (or directly, `nativeWindowOpen`) option is set, a
|
||||
`Window` instance is created, as you'd expect in the browser. For same-origin
|
||||
content, the new window is created within the same process, enabling the parent
|
||||
to access the child window directly. This can be very useful for app sub-windows that act
|
||||
as preference panels, or similar, as the parent can render to the sub-window
|
||||
directly, as if it were a `div` in the parent.
|
||||
|
||||
Electron pairs this native Chrome `Window` with a BrowserWindow under the hood.
|
||||
You can take advantage of all the customization available when creating a
|
||||
BrowserWindow in the main process by using `webContents.setWindowOpenHandler()`
|
||||
for renderer-created windows.
|
||||
|
||||
BrowserWindow constructor options are set by, in increasing precedence
|
||||
order: options inherited from the parent, parsed options
|
||||
from the `features` string from `window.open()`, security-related webPreferences
|
||||
inherited from the parent, and options given by
|
||||
[`webContents.setWindowOpenHandler`](web-contents.md#contentssetwindowopenhandlerhandler).
|
||||
Note that `webContents.setWindowOpenHandler` has final say and full privilege
|
||||
because it is invoked in the main process.
|
||||
|
||||
### `window.open(url[, frameName][, features])`
|
||||
|
||||
@@ -20,15 +36,22 @@ string.
|
||||
* `frameName` String (optional)
|
||||
* `features` String (optional)
|
||||
|
||||
Returns [`BrowserWindowProxy`](browser-window-proxy.md) - Creates a new window
|
||||
and returns an instance of `BrowserWindowProxy` class.
|
||||
Returns [`BrowserWindowProxy`](browser-window-proxy.md) | [`Window`](https://developer.mozilla.org/en-US/docs/Web/API/Window)
|
||||
|
||||
The `features` string follows the format of standard browser, but each feature
|
||||
has to be a field of `BrowserWindow`'s options. These are the features you can set via `features` string: `zoomFactor`, `nodeIntegration`, `preload`, `javascript`, `contextIsolation`, `webviewTag`.
|
||||
`features` is a comma-separated key-value list, following the standard format of
|
||||
the browser. Electron will parse `BrowserWindowConstructorOptions` out of this
|
||||
list where possible, for convenience. For full control and better ergonomics,
|
||||
consider using `webContents.setWindowOpenHandler` to customize the
|
||||
BrowserWindow creation.
|
||||
|
||||
A subset of `WebPreferences` can be set directly,
|
||||
unnested, from the features string: `zoomFactor`, `nodeIntegration`, `preload`,
|
||||
`javascript`, `contextIsolation`, and `webviewTag`.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
window.open('https://github.com', '_blank', 'nodeIntegration=no')
|
||||
window.open('https://github.com', '_blank', 'top=500,left=200,frame=false,nodeIntegration=no')
|
||||
```
|
||||
|
||||
**Notes:**
|
||||
@@ -40,60 +63,74 @@ window.open('https://github.com', '_blank', 'nodeIntegration=no')
|
||||
* JavaScript will always be disabled in the opened `window` if it is disabled on
|
||||
the parent window.
|
||||
* Non-standard features (that are not handled by Chromium or Electron) given in
|
||||
`features` will be passed to any registered `webContent`'s `new-window` event
|
||||
handler in the `additionalFeatures` argument.
|
||||
`features` will be passed to any registered `webContents`'s
|
||||
`did-create-window` event handler in the `additionalFeatures` argument.
|
||||
|
||||
### `window.opener.postMessage(message, targetOrigin)`
|
||||
To customize or cancel the creation of the window, you can optionally set an
|
||||
override handler with `webContents.setWindowOpenHandler()` from the main
|
||||
process. Returning `false` cancels the window, while returning an object sets
|
||||
the `BrowserWindowConstructorOptions` used when creating the window. Note that
|
||||
this is more powerful than passing options through the feature string, as the
|
||||
renderer has more limited privileges in deciding security preferences than the
|
||||
main process.
|
||||
|
||||
* `message` String
|
||||
* `targetOrigin` String
|
||||
|
||||
Sends a message to the parent window with the specified origin or `*` for no
|
||||
origin preference.
|
||||
|
||||
### Using Chrome's `window.open()` implementation
|
||||
|
||||
If you want to use Chrome's built-in `window.open()` implementation, set
|
||||
`nativeWindowOpen` to `true` in the `webPreferences` options object.
|
||||
|
||||
Native `window.open()` allows synchronous access to opened windows so it is
|
||||
convenient choice if you need to open a dialog or a preferences window.
|
||||
|
||||
This option can also be set on `<webview>` tags as well:
|
||||
|
||||
```html
|
||||
<webview webpreferences="nativeWindowOpen=yes"></webview>
|
||||
```
|
||||
|
||||
The creation of the `BrowserWindow` is customizable via `WebContents`'s
|
||||
`new-window` event.
|
||||
### `BrowserWindowProxy` example
|
||||
|
||||
```javascript
|
||||
// main process
|
||||
|
||||
// main.js
|
||||
const mainWindow = new BrowserWindow()
|
||||
|
||||
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
||||
if (url.startsWith('https://github.com/')) {
|
||||
return { action: 'allow' }
|
||||
}
|
||||
return { action: 'deny' }
|
||||
})
|
||||
|
||||
mainWindow.webContents.on('did-create-window', (childWindow) => {
|
||||
// For example...
|
||||
childWindow.webContents('will-navigate', (e) => {
|
||||
e.preventDefault()
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
```javascript
|
||||
// renderer.js
|
||||
const windowProxy = window.open('https://github.com/', null, 'minimizable=false')
|
||||
windowProxy.postMessage('hi', '*')
|
||||
```
|
||||
|
||||
### Native `Window` example
|
||||
|
||||
```javascript
|
||||
// main.js
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nativeWindowOpen: true
|
||||
}
|
||||
})
|
||||
mainWindow.webContents.on('new-window', (event, url, frameName, disposition, options, additionalFeatures) => {
|
||||
if (frameName === 'modal') {
|
||||
// open window as modal
|
||||
event.preventDefault()
|
||||
Object.assign(options, {
|
||||
modal: true,
|
||||
parent: mainWindow,
|
||||
width: 100,
|
||||
height: 100
|
||||
})
|
||||
event.newGuest = new BrowserWindow(options)
|
||||
|
||||
// In this example, only windows with the `about:blank` url will be created.
|
||||
// All other urls will be blocked.
|
||||
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
||||
if (url === 'about:blank') {
|
||||
return {
|
||||
frame: false,
|
||||
fullscreenable: false,
|
||||
backgroundColor: 'black',
|
||||
webPreferences: {
|
||||
preload: 'my-child-window-preload-script.js'
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
```
|
||||
|
||||
```javascript
|
||||
// renderer process (mainWindow)
|
||||
const modal = window.open('', 'modal')
|
||||
modal.document.write('<h1>Hello</h1>')
|
||||
const childWindow = window.open('', 'modal')
|
||||
childWindow.document.write('<h1>Hello</h1>')
|
||||
```
|
||||
|
||||
@@ -6,14 +6,153 @@ Breaking changes will be documented here, and deprecation warnings added to JS c
|
||||
|
||||
This document uses the following convention to categorize breaking changes:
|
||||
|
||||
- **API Changed:** An API was changed in such a way that code that has not been updated is guaranteed to throw an exception.
|
||||
- **Behavior Changed:** The behavior of Electron has changed, but not in such a way that an exception will necessarily be thrown.
|
||||
- **Default Changed:** Code depending on the old default may break, not necessarily throwing an exception. The old behavior can be restored by explicitly specifying the value.
|
||||
- **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.
|
||||
* **API Changed:** An API was changed in such a way that code that has not been updated is guaranteed to throw an exception.
|
||||
* **Behavior Changed:** The behavior of Electron has changed, but not in such a way that an exception will necessarily be thrown.
|
||||
* **Default Changed:** Code depending on the old default may break, not necessarily throwing an exception. The old behavior can be restored by explicitly specifying the value.
|
||||
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
|
||||
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
|
||||
|
||||
## Planned Breaking API Changes (14.0)
|
||||
|
||||
### API Changed: `window.(open)`
|
||||
|
||||
The optional parameter `frameName` will no longer set the title of the window. This now follows the specification described by the [native documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters) under the corresponding parameter `windowName`.
|
||||
|
||||
If you were using this parameter to set the title of a window, you can instead use [win.setTitle(title)](https://www.electronjs.org/docs/api/browser-window#winsettitletitle).
|
||||
|
||||
### Removed: `worldSafeExecuteJavaScript`
|
||||
|
||||
In Electron 14, `worldSafeExecuteJavaScript` will be removed. There is no alternative, please
|
||||
ensure your code works with this property enabled. It has been enabled by default since Electron
|
||||
12.
|
||||
|
||||
You will be affected by this change if you use either `webFrame.executeJavaScript` or `webFrame.executeJavaScriptInIsolatedWorld`. You will need to ensure that values returned by either of those methods are supported by the [Context Bridge API](api/context-bridge.md#parameter--error--return-type-support) as these methods use the same value passing semantics.
|
||||
|
||||
## Planned Breaking API Changes (13.0)
|
||||
|
||||
### API Changed: `session.setPermissionCheckHandler(handler)`
|
||||
|
||||
The `handler` methods first parameter was previously always a `webContents`, it can now sometimes be `null`. You should use the `requestingOrigin`, `embeddingOrigin` and `securityOrigin` properties to respond to the permission check correctly. As the `webContents` can be `null` it can no longer be relied on.
|
||||
|
||||
```js
|
||||
// Old code
|
||||
session.setPermissionCheckHandler((webContents, permission) => {
|
||||
if (webContents.getURL().startsWith('https://google.com/') && permission === 'notification') {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
// Replace with
|
||||
session.setPermissionCheckHandler((webContents, permission, requestingOrigin) => {
|
||||
if (new URL(requestingOrigin).hostname === 'google.com' && permission === 'notification') {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
```
|
||||
|
||||
### Removed: `shell.moveItemToTrash()`
|
||||
|
||||
The deprecated synchronous `shell.moveItemToTrash()` API has been removed. Use
|
||||
the asynchronous `shell.trashItem()` instead.
|
||||
|
||||
```js
|
||||
// Removed in Electron 13
|
||||
shell.moveItemToTrash(path)
|
||||
// Replace with
|
||||
shell.trashItem(path).then(/* ... */)
|
||||
```
|
||||
|
||||
### Removed: `BrowserWindow` extension APIs
|
||||
|
||||
The deprecated extension APIs have been removed:
|
||||
|
||||
* `BrowserWindow.addExtension(path)`
|
||||
* `BrowserWindow.addDevToolsExtension(path)`
|
||||
* `BrowserWindow.removeExtension(name)`
|
||||
* `BrowserWindow.removeDevToolsExtension(name)`
|
||||
* `BrowserWindow.getExtensions()`
|
||||
* `BrowserWindow.getDevToolsExtensions()`
|
||||
|
||||
Use the session APIs instead:
|
||||
|
||||
* `ses.loadExtension(path)`
|
||||
* `ses.removeExtension(extension_id)`
|
||||
* `ses.getAllExtensions()`
|
||||
|
||||
```js
|
||||
// Removed in Electron 13
|
||||
BrowserWindow.addExtension(path)
|
||||
BrowserWindow.addDevToolsExtension(path)
|
||||
// Replace with
|
||||
session.defaultSession.loadExtension(path)
|
||||
```
|
||||
|
||||
```js
|
||||
// Removed in Electron 13
|
||||
BrowserWindow.removeExtension(name)
|
||||
BrowserWindow.removeDevToolsExtension(name)
|
||||
// Replace with
|
||||
session.defaultSession.removeExtension(extension_id)
|
||||
```
|
||||
|
||||
```js
|
||||
// Removed in Electron 13
|
||||
BrowserWindow.getExtensions()
|
||||
BrowserWindow.getDevToolsExtensions()
|
||||
// Replace with
|
||||
session.defaultSession.getAllExtensions()
|
||||
```
|
||||
|
||||
### Removed: methods in `systemPreferences`
|
||||
|
||||
The following `systemPreferences` methods have been deprecated:
|
||||
|
||||
* `systemPreferences.isDarkMode()`
|
||||
* `systemPreferences.isInvertedColorScheme()`
|
||||
* `systemPreferences.isHighContrastColorScheme()`
|
||||
|
||||
Use the following `nativeTheme` properties instead:
|
||||
|
||||
* `nativeTheme.shouldUseDarkColors`
|
||||
* `nativeTheme.shouldUseInvertedColorScheme`
|
||||
* `nativeTheme.shouldUseHighContrastColors`
|
||||
|
||||
```js
|
||||
// Removed in Electron 13
|
||||
systemPreferences.isDarkMode()
|
||||
// Replace with
|
||||
nativeTheme.shouldUseDarkColors
|
||||
|
||||
// Removed in Electron 13
|
||||
systemPreferences.isInvertedColorScheme()
|
||||
// Replace with
|
||||
nativeTheme.shouldUseInvertedColorScheme
|
||||
|
||||
// Removed in Electron 13
|
||||
systemPreferences.isHighContrastColorScheme()
|
||||
// Replace with
|
||||
nativeTheme.shouldUseHighContrastColors
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (12.0)
|
||||
|
||||
### Removed: Pepper Flash support
|
||||
|
||||
Chromium has removed support for Flash, and so we must follow suit. See
|
||||
Chromium's [Flash Roadmap](https://www.chromium.org/flash-roadmap) for more
|
||||
details.
|
||||
|
||||
### Default Changed: `worldSafeExecuteJavaScript` defaults to `true`
|
||||
|
||||
In Electron 12, `worldSafeExecuteJavaScript` will be enabled by default. To restore
|
||||
the previous behavior, `worldSafeExecuteJavaScript: false` must be specified in WebPreferences.
|
||||
Please note that setting this option to `false` is **insecure**.
|
||||
|
||||
This option will be removed in Electron 14 so please migrate your code to support the default
|
||||
value.
|
||||
|
||||
### Default Changed: `contextIsolation` defaults to `true`
|
||||
|
||||
In Electron 12, `contextIsolation` will be enabled by default. To restore
|
||||
@@ -21,19 +160,34 @@ the previous behavior, `contextIsolation: false` must be specified in WebPrefere
|
||||
|
||||
We [recommend having contextIsolation enabled](https://github.com/electron/electron/blob/master/docs/tutorial/security.md#3-enable-context-isolation-for-remote-content) for the security of your application.
|
||||
|
||||
Another implication is that `require()` cannot be used in the renderer process unless
|
||||
`nodeIntegration` is `true` and `contextIsolation` is `false`.
|
||||
|
||||
For more details see: https://github.com/electron/electron/issues/23506
|
||||
|
||||
### Removed: `crashReporter.getCrashesDirectory()`
|
||||
|
||||
The `crashReporter.getCrashesDirectory` method has been removed. Usage
|
||||
should be replaced by `app.getPath('crashDumps')`.
|
||||
|
||||
```js
|
||||
// Removed in Electron 12
|
||||
crashReporter.getCrashesDirectory()
|
||||
// Replace with
|
||||
app.getPath('crashDumps')
|
||||
```
|
||||
|
||||
### Removed: `crashReporter` methods in the renderer process
|
||||
|
||||
The following `crashReporter` methods are no longer available in the renderer
|
||||
process:
|
||||
|
||||
- `crashReporter.start`
|
||||
- `crashReporter.getLastCrashReport`
|
||||
- `crashReporter.getUploadedReports`
|
||||
- `crashReporter.getUploadToServer`
|
||||
- `crashReporter.setUploadToServer`
|
||||
- `crashReporter.getCrashesDirectory`
|
||||
* `crashReporter.start`
|
||||
* `crashReporter.getLastCrashReport`
|
||||
* `crashReporter.getUploadedReports`
|
||||
* `crashReporter.getUploadToServer`
|
||||
* `crashReporter.setUploadToServer`
|
||||
* `crashReporter.getCrashesDirectory`
|
||||
|
||||
They should be called only from the main process.
|
||||
|
||||
@@ -50,9 +204,46 @@ If your crash ingestion server does not support compressed payloads, you can
|
||||
turn off compression by specifying `{ compress: false }` in the crash reporter
|
||||
options.
|
||||
|
||||
### Deprecated: `remote` module
|
||||
|
||||
The `remote` module is deprecated in Electron 12, and will be removed in
|
||||
Electron 14. It is replaced by the
|
||||
[`@electron/remote`](https://github.com/electron/remote) module.
|
||||
|
||||
```js
|
||||
// Deprecated in Electron 12:
|
||||
const { BrowserWindow } = require('electron').remote
|
||||
```
|
||||
|
||||
```js
|
||||
// Replace with:
|
||||
const { BrowserWindow } = require('@electron/remote')
|
||||
|
||||
// In the main process:
|
||||
require('@electron/remote/main').initialize()
|
||||
```
|
||||
|
||||
### Deprecated: `shell.moveItemToTrash()`
|
||||
|
||||
The synchronous `shell.moveItemToTrash()` has been replaced by the new,
|
||||
asynchronous `shell.trashItem()`.
|
||||
|
||||
```js
|
||||
// Deprecated in Electron 12
|
||||
shell.moveItemToTrash(path)
|
||||
// Replace with
|
||||
shell.trashItem(path).then(/* ... */)
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (11.0)
|
||||
|
||||
There are no breaking changes planned for 11.0.
|
||||
### Removed: `BrowserView.{destroy, fromId, fromWebContents, getAllViews}` and `id` property of `BrowserView`
|
||||
|
||||
The experimental APIs `BrowserView.{destroy, fromId, fromWebContents, getAllViews}`
|
||||
have now been removed. Additionally, the `id` property of `BrowserView`
|
||||
has also been removed.
|
||||
|
||||
For more detailed information, see [#23578](https://github.com/electron/electron/pull/23578).
|
||||
|
||||
## Planned Breaking API Changes (10.0)
|
||||
|
||||
@@ -87,12 +278,12 @@ app.getPath('crashDumps')
|
||||
Calling the following `crashReporter` methods from the renderer process is
|
||||
deprecated:
|
||||
|
||||
- `crashReporter.start`
|
||||
- `crashReporter.getLastCrashReport`
|
||||
- `crashReporter.getUploadedReports`
|
||||
- `crashReporter.getUploadToServer`
|
||||
- `crashReporter.setUploadToServer`
|
||||
- `crashReporter.getCrashesDirectory`
|
||||
* `crashReporter.start`
|
||||
* `crashReporter.getLastCrashReport`
|
||||
* `crashReporter.getUploadedReports`
|
||||
* `crashReporter.getUploadToServer`
|
||||
* `crashReporter.setUploadToServer`
|
||||
* `crashReporter.getCrashesDirectory`
|
||||
|
||||
The only non-deprecated methods remaining in the `crashReporter` module in the
|
||||
renderer are `addExtraParameter`, `removeExtraParameter` and `getParameters`.
|
||||
@@ -134,6 +325,7 @@ We [recommend moving away from the remote
|
||||
module](https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31).
|
||||
|
||||
### `protocol.unregisterProtocol`
|
||||
|
||||
### `protocol.uninterceptProtocol`
|
||||
|
||||
The APIs are now synchronous and the optional callback is no longer needed.
|
||||
@@ -146,14 +338,23 @@ protocol.unregisterProtocol(scheme)
|
||||
```
|
||||
|
||||
### `protocol.registerFileProtocol`
|
||||
|
||||
### `protocol.registerBufferProtocol`
|
||||
|
||||
### `protocol.registerStringProtocol`
|
||||
|
||||
### `protocol.registerHttpProtocol`
|
||||
|
||||
### `protocol.registerStreamProtocol`
|
||||
|
||||
### `protocol.interceptFileProtocol`
|
||||
|
||||
### `protocol.interceptStringProtocol`
|
||||
|
||||
### `protocol.interceptBufferProtocol`
|
||||
|
||||
### `protocol.interceptHttpProtocol`
|
||||
|
||||
### `protocol.interceptStreamProtocol`
|
||||
|
||||
The APIs are now synchronous and the optional callback is no longer needed.
|
||||
@@ -198,6 +399,7 @@ For more detailed information see [#18397](https://github.com/electron/electron/
|
||||
### Deprecated: `BrowserWindow` extension APIs
|
||||
|
||||
The following extension APIs have been deprecated:
|
||||
|
||||
* `BrowserWindow.addExtension(path)`
|
||||
* `BrowserWindow.addDevToolsExtension(path)`
|
||||
* `BrowserWindow.removeExtension(name)`
|
||||
@@ -206,6 +408,7 @@ The following extension APIs have been deprecated:
|
||||
* `BrowserWindow.getDevToolsExtensions()`
|
||||
|
||||
Use the session APIs instead:
|
||||
|
||||
* `ses.loadExtension(path)`
|
||||
* `ses.removeExtension(extension_id)`
|
||||
* `ses.getAllExtensions()`
|
||||
@@ -286,9 +489,10 @@ Clone Algorithm][SCA], the same algorithm used to serialize messages for
|
||||
`postMessage`. This brings about a 2x performance improvement for large
|
||||
messages, but also brings some breaking changes in behavior.
|
||||
|
||||
- Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any
|
||||
* Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any
|
||||
such values, over IPC will now throw an exception, instead of silently
|
||||
converting the functions to `undefined`.
|
||||
|
||||
```js
|
||||
// Previously:
|
||||
ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
|
||||
@@ -298,23 +502,25 @@ ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
|
||||
ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
|
||||
// => throws Error("() => {} could not be cloned.")
|
||||
```
|
||||
- `NaN`, `Infinity` and `-Infinity` will now be correctly serialized, instead
|
||||
|
||||
* `NaN`, `Infinity` and `-Infinity` will now be correctly serialized, instead
|
||||
of being converted to `null`.
|
||||
- Objects containing cyclic references will now be correctly serialized,
|
||||
* Objects containing cyclic references will now be correctly serialized,
|
||||
instead of being converted to `null`.
|
||||
- `Set`, `Map`, `Error` and `RegExp` values will be correctly serialized,
|
||||
* `Set`, `Map`, `Error` and `RegExp` values will be correctly serialized,
|
||||
instead of being converted to `{}`.
|
||||
- `BigInt` values will be correctly serialized, instead of being converted to
|
||||
* `BigInt` values will be correctly serialized, instead of being converted to
|
||||
`null`.
|
||||
- Sparse arrays will be serialized as such, instead of being converted to dense
|
||||
* Sparse arrays will be serialized as such, instead of being converted to dense
|
||||
arrays with `null`s.
|
||||
- `Date` objects will be transferred as `Date` objects, instead of being
|
||||
* `Date` objects will be transferred as `Date` objects, instead of being
|
||||
converted to their ISO string representation.
|
||||
- Typed Arrays (such as `Uint8Array`, `Uint16Array`, `Uint32Array` and so on)
|
||||
* Typed Arrays (such as `Uint8Array`, `Uint16Array`, `Uint32Array` and so on)
|
||||
will be transferred as such, instead of being converted to Node.js `Buffer`.
|
||||
- Node.js `Buffer` objects will be transferred as `Uint8Array`s. You can
|
||||
* Node.js `Buffer` objects will be transferred as `Uint8Array`s. You can
|
||||
convert a `Uint8Array` back to a Node.js `Buffer` by wrapping the underlying
|
||||
`ArrayBuffer`:
|
||||
|
||||
```js
|
||||
Buffer.from(value.buffer, value.byteOffset, value.byteLength)
|
||||
```
|
||||
@@ -380,6 +586,7 @@ limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined
|
||||
### Deprecated events in `systemPreferences`
|
||||
|
||||
The following `systemPreferences` events have been deprecated:
|
||||
|
||||
* `inverted-color-scheme-changed`
|
||||
* `high-contrast-color-scheme-changed`
|
||||
|
||||
@@ -397,11 +604,13 @@ nativeTheme.on('updated', () => { /* ... */ })
|
||||
### Deprecated: methods in `systemPreferences`
|
||||
|
||||
The following `systemPreferences` methods have been deprecated:
|
||||
|
||||
* `systemPreferences.isDarkMode()`
|
||||
* `systemPreferences.isInvertedColorScheme()`
|
||||
* `systemPreferences.isHighContrastColorScheme()`
|
||||
|
||||
Use the following `nativeTheme` properties instead:
|
||||
|
||||
* `nativeTheme.shouldUseDarkColors`
|
||||
* `nativeTheme.shouldUseInvertedColorScheme`
|
||||
* `nativeTheme.shouldUseHighContrastColors`
|
||||
@@ -496,6 +705,7 @@ the folder, similarly to Chrome, Firefox, and Edge
|
||||
([link to MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)).
|
||||
|
||||
As an illustration, take a folder with this structure:
|
||||
|
||||
```console
|
||||
folder
|
||||
├── file1
|
||||
@@ -504,11 +714,13 @@ folder
|
||||
```
|
||||
|
||||
In Electron <=6, this would return a `FileList` with a `File` object for:
|
||||
|
||||
```console
|
||||
path/to/folder
|
||||
```
|
||||
|
||||
In Electron 7, this now returns a `FileList` with a `File` object for:
|
||||
|
||||
```console
|
||||
/path/to/folder/file3
|
||||
/path/to/folder/file2
|
||||
@@ -519,6 +731,55 @@ Note that `webkitdirectory` no longer exposes the path to the selected folder.
|
||||
If you require the path to the selected folder rather than the folder contents,
|
||||
see the `dialog.showOpenDialog` API ([link](https://github.com/electron/electron/blob/master/docs/api/dialog.md#dialogshowopendialogbrowserwindow-options)).
|
||||
|
||||
### API Changed: Callback-based versions of promisified APIs
|
||||
|
||||
Electron 5 and Electron 6 introduced Promise-based versions of existing
|
||||
asynchronous APIs and deprecated their older, callback-based counterparts.
|
||||
In Electron 7, all deprecated callback-based APIs are now removed.
|
||||
|
||||
These functions now only return Promises:
|
||||
|
||||
* `app.getFileIcon()` [#15742](https://github.com/electron/electron/pull/15742)
|
||||
* `app.dock.show()` [#16904](https://github.com/electron/electron/pull/16904)
|
||||
* `contentTracing.getCategories()` [#16583](https://github.com/electron/electron/pull/16583)
|
||||
* `contentTracing.getTraceBufferUsage()` [#16600](https://github.com/electron/electron/pull/16600)
|
||||
* `contentTracing.startRecording()` [#16584](https://github.com/electron/electron/pull/16584)
|
||||
* `contentTracing.stopRecording()` [#16584](https://github.com/electron/electron/pull/16584)
|
||||
* `contents.executeJavaScript()` [#17312](https://github.com/electron/electron/pull/17312)
|
||||
* `cookies.flushStore()` [#16464](https://github.com/electron/electron/pull/16464)
|
||||
* `cookies.get()` [#16464](https://github.com/electron/electron/pull/16464)
|
||||
* `cookies.remove()` [#16464](https://github.com/electron/electron/pull/16464)
|
||||
* `cookies.set()` [#16464](https://github.com/electron/electron/pull/16464)
|
||||
* `debugger.sendCommand()` [#16861](https://github.com/electron/electron/pull/16861)
|
||||
* `dialog.showCertificateTrustDialog()` [#17181](https://github.com/electron/electron/pull/17181)
|
||||
* `inAppPurchase.getProducts()` [#17355](https://github.com/electron/electron/pull/17355)
|
||||
* `inAppPurchase.purchaseProduct()`[#17355](https://github.com/electron/electron/pull/17355)
|
||||
* `netLog.stopLogging()` [#16862](https://github.com/electron/electron/pull/16862)
|
||||
* `session.clearAuthCache()` [#17259](https://github.com/electron/electron/pull/17259)
|
||||
* `session.clearCache()` [#17185](https://github.com/electron/electron/pull/17185)
|
||||
* `session.clearHostResolverCache()` [#17229](https://github.com/electron/electron/pull/17229)
|
||||
* `session.clearStorageData()` [#17249](https://github.com/electron/electron/pull/17249)
|
||||
* `session.getBlobData()` [#17303](https://github.com/electron/electron/pull/17303)
|
||||
* `session.getCacheSize()` [#17185](https://github.com/electron/electron/pull/17185)
|
||||
* `session.resolveProxy()` [#17222](https://github.com/electron/electron/pull/17222)
|
||||
* `session.setProxy()` [#17222](https://github.com/electron/electron/pull/17222)
|
||||
* `shell.openExternal()` [#16176](https://github.com/electron/electron/pull/16176)
|
||||
* `webContents.loadFile()` [#15855](https://github.com/electron/electron/pull/15855)
|
||||
* `webContents.loadURL()` [#15855](https://github.com/electron/electron/pull/15855)
|
||||
* `webContents.hasServiceWorker()` [#16535](https://github.com/electron/electron/pull/16535)
|
||||
* `webContents.printToPDF()` [#16795](https://github.com/electron/electron/pull/16795)
|
||||
* `webContents.savePage()` [#16742](https://github.com/electron/electron/pull/16742)
|
||||
* `webFrame.executeJavaScript()` [#17312](https://github.com/electron/electron/pull/17312)
|
||||
* `webFrame.executeJavaScriptInIsolatedWorld()` [#17312](https://github.com/electron/electron/pull/17312)
|
||||
* `webviewTag.executeJavaScript()` [#17312](https://github.com/electron/electron/pull/17312)
|
||||
* `win.capturePage()` [#15743](https://github.com/electron/electron/pull/15743)
|
||||
|
||||
These functions now have two forms, synchronous and Promise-based asynchronous:
|
||||
|
||||
* `dialog.showMessageBox()`/`dialog.showMessageBoxSync()` [#17298](https://github.com/electron/electron/pull/17298)
|
||||
* `dialog.showOpenDialog()`/`dialog.showOpenDialogSync()` [#16973](https://github.com/electron/electron/pull/16973)
|
||||
* `dialog.showSaveDialog()`/`dialog.showSaveDialogSync()` [#17054](https://github.com/electron/electron/pull/17054)
|
||||
|
||||
## Planned Breaking API Changes (6.0)
|
||||
|
||||
### API Changed: `win.setMenu(null)` is now `win.removeMenu()`
|
||||
@@ -530,19 +791,6 @@ win.setMenu(null)
|
||||
win.removeMenu()
|
||||
```
|
||||
|
||||
### API Changed: `contentTracing.getTraceBufferUsage()` is now a promise
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
contentTracing.getTraceBufferUsage((percentage, value) => {
|
||||
// do something
|
||||
})
|
||||
// Replace with
|
||||
contentTracing.getTraceBufferUsage().then(infoObject => {
|
||||
// infoObject has percentage and value fields
|
||||
})
|
||||
```
|
||||
|
||||
### API Changed: `electron.screen` in the renderer process should be accessed via `remote`
|
||||
|
||||
```js
|
||||
@@ -663,7 +911,9 @@ webFrame.setIsolatedWorldInfo(
|
||||
```
|
||||
|
||||
### API Changed: `webFrame.setSpellCheckProvider` now takes an asynchronous callback
|
||||
|
||||
The `spellCheck` callback is now asynchronous, and `autoCorrectWord` parameter has been removed.
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
webFrame.setSpellCheckProvider('en-US', true, {
|
||||
@@ -679,6 +929,31 @@ webFrame.setSpellCheckProvider('en-US', {
|
||||
})
|
||||
```
|
||||
|
||||
### API Changed: `webContents.getZoomLevel` and `webContents.getZoomFactor` are now synchronous
|
||||
|
||||
`webContents.getZoomLevel` and `webContents.getZoomFactor` no longer take callback parameters,
|
||||
instead directly returning their number values.
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
webContents.getZoomLevel((level) => {
|
||||
console.log(level)
|
||||
})
|
||||
// Replace with
|
||||
const level = webContents.getZoomLevel()
|
||||
console.log(level)
|
||||
```
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
webContents.getZoomFactor((factor) => {
|
||||
console.log(factor)
|
||||
})
|
||||
// Replace with
|
||||
const factor = webContents.getZoomFactor()
|
||||
console.log(factor)
|
||||
```
|
||||
|
||||
## Planned Breaking API Changes (4.0)
|
||||
|
||||
The following list includes the breaking API changes made in Electron 4.0.
|
||||
|
||||
@@ -4,14 +4,15 @@ These guides are intended for people working on the Electron project itself.
|
||||
For guides on Electron app development, see
|
||||
[/docs/README.md](../README.md#guides-and-tutorials).
|
||||
|
||||
* [Code of Conduct](../../CODE_OF_CONDUCT.md)
|
||||
* [Contributing to Electron](../../CONTRIBUTING.md)
|
||||
* [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md)
|
||||
* [Contributing to Electron](https://github.com/electron/electron/blob/master/CONTRIBUTING.md)
|
||||
* [Issues](issues.md)
|
||||
* [Pull Requests](pull-requests.md)
|
||||
* [Documentation Styleguide](coding-style.md#documentation)
|
||||
* [Source Code Directory Structure](source-code-directory-structure.md)
|
||||
* [Coding Style](coding-style.md)
|
||||
* [Using clang-format on C++ Code](clang-format.md)
|
||||
* [Using clang-tidy on C++ Code](clang-tidy.md)
|
||||
* [Build System Overview](build-system-overview.md)
|
||||
* [Build Instructions (macOS)](build-instructions-macos.md)
|
||||
* [Build Instructions (Windows)](build-instructions-windows.md)
|
||||
|
||||
@@ -49,7 +49,7 @@ Example Use Case:
|
||||
* Master VHD URI - use URI obtained @ end of previous step
|
||||
* Location use `East US`
|
||||
|
||||
6. Log back into Azure and find the VM you just created in Homee < Virtual Machines < `$YOUR_NEW_VM`
|
||||
6. Log back into Azure and find the VM you just created in Home < Virtual Machines < `$YOUR_NEW_VM`
|
||||
* You can download a RDP (Remote Desktop) file to access the VM.
|
||||
|
||||
7. Using Microsoft Remote Desktop, click `Connect` to connect to the VM.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user