mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
950 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d948ccd1d7 | ||
|
|
88e53e5aaa | ||
|
|
86e4cced1f | ||
|
|
2f313e0aea | ||
|
|
3369263815 | ||
|
|
20af00374a | ||
|
|
31db3524f0 | ||
|
|
ff3e6dfa73 | ||
|
|
a9c099765f | ||
|
|
f94ab39e6a | ||
|
|
dd631c67eb | ||
|
|
5e636f4b98 | ||
|
|
c865244bb8 | ||
|
|
b431f02373 | ||
|
|
ce178d4b9d | ||
|
|
1d383c0613 | ||
|
|
195f88c013 | ||
|
|
4d5e0adf5a | ||
|
|
3a4210cc2a | ||
|
|
204f5fbcca | ||
|
|
8a96928c21 | ||
|
|
d47f7c3270 | ||
|
|
b04d5722b8 | ||
|
|
4e52a67279 | ||
|
|
5d66da33d3 | ||
|
|
8836c828ed | ||
|
|
81e4364106 | ||
|
|
afe59c52a3 | ||
|
|
c58b1fe256 | ||
|
|
2c0166bbdd | ||
|
|
9041201a1a | ||
|
|
1d085d53c0 | ||
|
|
eb8c6a8efd | ||
|
|
b87c39d761 | ||
|
|
32c7b35da6 | ||
|
|
ac7389d71a | ||
|
|
fd3d252315 | ||
|
|
5b9088a7cf | ||
|
|
656ae251b5 | ||
|
|
9db73546fa | ||
|
|
4ad543c61e | ||
|
|
2cf35c04df | ||
|
|
ceb29151d7 | ||
|
|
9330ec2b80 | ||
|
|
a2d4b65e19 | ||
|
|
d5c911b930 | ||
|
|
41b7ab3c2c | ||
|
|
ab6c822602 | ||
|
|
12f0352abc | ||
|
|
94660650a7 | ||
|
|
9b5b6156ee | ||
|
|
caaaa349e8 | ||
|
|
7dafaf1d21 | ||
|
|
9f1b24de95 | ||
|
|
75b9ab7050 | ||
|
|
ad66542cf7 | ||
|
|
08aa4522c9 | ||
|
|
cb2fa85b0d | ||
|
|
0e7e4fef29 | ||
|
|
ad472783f8 | ||
|
|
19cfa2a8d3 | ||
|
|
c4bd63b420 | ||
|
|
6acb443b91 | ||
|
|
d3e5b791a5 | ||
|
|
96bd258b0f | ||
|
|
23d0d409b4 | ||
|
|
ad94c7472e | ||
|
|
f3df14c7ae | ||
|
|
bd1c7487ba | ||
|
|
bc4d3dc578 | ||
|
|
05ef36db59 | ||
|
|
b852f1de13 | ||
|
|
3e36f7a245 | ||
|
|
d623e7cd44 | ||
|
|
42435fcad8 | ||
|
|
bd90898181 | ||
|
|
c20701b600 | ||
|
|
8272ea5b5f | ||
|
|
6317ef75a1 | ||
|
|
e5cb1872f5 | ||
|
|
25e3fadd56 | ||
|
|
6adf6b8b7d | ||
|
|
d67ff0fe0e | ||
|
|
49e63948b7 | ||
|
|
8dae8da778 | ||
|
|
b762563257 | ||
|
|
9ccf1b569b | ||
|
|
653bb602e2 | ||
|
|
94a5b304d0 | ||
|
|
a22384c9ff | ||
|
|
96eeddd46b | ||
|
|
7a776198db | ||
|
|
93a9512ce1 | ||
|
|
843dd5c33f | ||
|
|
b812e78f51 | ||
|
|
b080dab28c | ||
|
|
c451a90cfb | ||
|
|
b32ffe0ab2 | ||
|
|
adfc0f55bc | ||
|
|
6852bfb86e | ||
|
|
6d3e56d70f | ||
|
|
f70161856c | ||
|
|
736749522b | ||
|
|
9964e3f389 | ||
|
|
8c4c4fb4f0 | ||
|
|
0565d22597 | ||
|
|
87fd06bc96 | ||
|
|
4079d60021 | ||
|
|
6cc75d9f92 | ||
|
|
af5be47aa7 | ||
|
|
b2454eeb52 | ||
|
|
1ee98b4a73 | ||
|
|
e74a402976 | ||
|
|
8e5a88799c | ||
|
|
0b846b2f13 | ||
|
|
25539dcb73 | ||
|
|
2a4aaa9661 | ||
|
|
793da44151 | ||
|
|
4c28b23b06 | ||
|
|
952603d9ae | ||
|
|
32b45e7783 | ||
|
|
514c1e6d4b | ||
|
|
67b04b4040 | ||
|
|
415387cc2c | ||
|
|
0826770b20 | ||
|
|
c2e22abf08 | ||
|
|
9c28c8f637 | ||
|
|
478d405d42 | ||
|
|
0b616b3e2e | ||
|
|
49711d12f8 | ||
|
|
fe56f1dda6 | ||
|
|
f10c8e6dd5 | ||
|
|
27c1fc87e3 | ||
|
|
be08ff1665 | ||
|
|
547e50c699 | ||
|
|
a06170648c | ||
|
|
88fdf8ccf5 | ||
|
|
d12be5d392 | ||
|
|
e62cd6a5fa | ||
|
|
c412f7ddf1 | ||
|
|
0afec38c81 | ||
|
|
38f0a8e85b | ||
|
|
0aa7b7f712 | ||
|
|
23bd9166d7 | ||
|
|
c374f20fd1 | ||
|
|
b5839f42a2 | ||
|
|
2dcfefa577 | ||
|
|
b045ee77af | ||
|
|
32c2736c07 | ||
|
|
91d1bd651e | ||
|
|
c8177f8418 | ||
|
|
b8c086613f | ||
|
|
2e80a2e447 | ||
|
|
936a1659f6 | ||
|
|
d7289cbb55 | ||
|
|
aab0c66817 | ||
|
|
e671c2c053 | ||
|
|
c7778a8f2f | ||
|
|
c35803aee1 | ||
|
|
9f2fc5d72c | ||
|
|
a65fe57342 | ||
|
|
473219bfbe | ||
|
|
a8196fbc18 | ||
|
|
6b8ca86459 | ||
|
|
7290d77cdc | ||
|
|
426d45cd85 | ||
|
|
79298d37cd | ||
|
|
2a44b1a20f | ||
|
|
6f331e4f6a | ||
|
|
dc71541641 | ||
|
|
a4de4793dd | ||
|
|
f7509d590c | ||
|
|
42ab97f905 | ||
|
|
faf2871efe | ||
|
|
ea4e92f64d | ||
|
|
15d792aded | ||
|
|
70f05a1579 | ||
|
|
2d40fad79e | ||
|
|
edabc96e75 | ||
|
|
4a45196ff1 | ||
|
|
0bd661bd99 | ||
|
|
b9e709039e | ||
|
|
c63430c5d0 | ||
|
|
60bcf42edf | ||
|
|
d5f9654c12 | ||
|
|
d2fb214a54 | ||
|
|
6294f811a7 | ||
|
|
30ae6f45a4 | ||
|
|
60ef8ac58d | ||
|
|
6c42564337 | ||
|
|
479fc57cef | ||
|
|
b2fb14fd48 | ||
|
|
d8f90444aa | ||
|
|
045331666c | ||
|
|
0ac42125d2 | ||
|
|
ce04014739 | ||
|
|
19bd97d80c | ||
|
|
ea2e34c4c3 | ||
|
|
5f6498d13a | ||
|
|
e3c1292548 | ||
|
|
b3e53839a4 | ||
|
|
f3e9f10cad | ||
|
|
2c8927a9a2 | ||
|
|
c6786aed26 | ||
|
|
5b3b09fb7f | ||
|
|
9f5924c5ea | ||
|
|
25f5d764ac | ||
|
|
941c72fcfe | ||
|
|
663d389925 | ||
|
|
b8e3477092 | ||
|
|
035c784b6c | ||
|
|
8faf8a3535 | ||
|
|
331125d35a | ||
|
|
7316ebde79 | ||
|
|
c3340ad21c | ||
|
|
1e84816c96 | ||
|
|
58c6ea5de8 | ||
|
|
34be80602c | ||
|
|
ce40be475b | ||
|
|
5f7bd36119 | ||
|
|
0f19193afd | ||
|
|
06b3b0ea15 | ||
|
|
32f973b010 | ||
|
|
ad2c2a055b | ||
|
|
3069ef3827 | ||
|
|
d70b1c68fe | ||
|
|
3ba4a35c9c | ||
|
|
2c4c1a3dd9 | ||
|
|
a4d8974556 | ||
|
|
b7d4759c19 | ||
|
|
d6ecc65df3 | ||
|
|
98b67cdb69 | ||
|
|
eb37822e03 | ||
|
|
8751f485c5 | ||
|
|
bfef6a54f0 | ||
|
|
5fd403b571 | ||
|
|
abe8c7168a | ||
|
|
5c32d18248 | ||
|
|
c1da7b5238 | ||
|
|
5b75a4a4be | ||
|
|
57e36afc7e | ||
|
|
a4ea27de36 | ||
|
|
7ba879711a | ||
|
|
f057b0e494 | ||
|
|
fa01a20f9b | ||
|
|
579f7a1899 | ||
|
|
920a82a4de | ||
|
|
b501c40bd6 | ||
|
|
672aa1c67f | ||
|
|
b305784aa3 | ||
|
|
c4efeef92c | ||
|
|
96b41d0930 | ||
|
|
1f652f08f8 | ||
|
|
d12c157242 | ||
|
|
68873fbadb | ||
|
|
526d748b7e | ||
|
|
54109cb04d | ||
|
|
542f30b54b | ||
|
|
07ea340314 | ||
|
|
524d6a5d79 | ||
|
|
a0431e1265 | ||
|
|
647299fa9f | ||
|
|
ee5d52440b | ||
|
|
d4a79bc4c0 | ||
|
|
e37f69c467 | ||
|
|
df6faec72e | ||
|
|
691ddb3f67 | ||
|
|
b4e1b840cd | ||
|
|
6f12b67582 | ||
|
|
33f5fa3c56 | ||
|
|
6f88108132 | ||
|
|
05a7f5f492 | ||
|
|
b878a5ea4c | ||
|
|
8756ff0349 | ||
|
|
20c5a3b9e1 | ||
|
|
ddb62e8d7c | ||
|
|
077e35c576 | ||
|
|
eb63062889 | ||
|
|
cac6db76a0 | ||
|
|
9257c315ac | ||
|
|
031480c3db | ||
|
|
9f9d3e98bf | ||
|
|
ae639186e3 | ||
|
|
6e4690574d | ||
|
|
c83dc5be92 | ||
|
|
63cb360df0 | ||
|
|
b311235165 | ||
|
|
6cd2623a87 | ||
|
|
9aa81de83d | ||
|
|
0f246b6be7 | ||
|
|
5be76fd4ea | ||
|
|
a315283f88 | ||
|
|
b741cbf3d7 | ||
|
|
031c0d6951 | ||
|
|
3639a82915 | ||
|
|
7fe2cad354 | ||
|
|
de2e12343e | ||
|
|
69598ae5c6 | ||
|
|
0f0a7e6b1e | ||
|
|
a0dcb55d6c | ||
|
|
ee35482d97 | ||
|
|
8317553cd4 | ||
|
|
ebf98e8af4 | ||
|
|
cfe350a534 | ||
|
|
854dcb3247 | ||
|
|
882ce295ee | ||
|
|
1ac31e18b7 | ||
|
|
957717e483 | ||
|
|
d1ccfea882 | ||
|
|
232ca04edd | ||
|
|
2888e46b7a | ||
|
|
4464a04f35 | ||
|
|
37baff1e31 | ||
|
|
dde19b0583 | ||
|
|
e2b9cd7b7c | ||
|
|
ecd398f8bd | ||
|
|
21f544392b | ||
|
|
5c93682a89 | ||
|
|
1db64c9e51 | ||
|
|
3a747eddbb | ||
|
|
51504aee64 | ||
|
|
360e8a2eb8 | ||
|
|
4447a63f20 | ||
|
|
ceb3b0cf54 | ||
|
|
89607e647d | ||
|
|
c8e2a6261e | ||
|
|
e9814e016b | ||
|
|
dc9654c03c | ||
|
|
fce3426675 | ||
|
|
637cf8a02b | ||
|
|
daab432fb6 | ||
|
|
50dac1d908 | ||
|
|
d4f915e428 | ||
|
|
72bccd1305 | ||
|
|
9439388b7b | ||
|
|
b0fee4b067 | ||
|
|
7c33fc0c5c | ||
|
|
f263a3f755 | ||
|
|
1af3a71fdb | ||
|
|
9f2371fc4e | ||
|
|
f658c1aeb4 | ||
|
|
c196121467 | ||
|
|
133ac9a323 | ||
|
|
a326408bce | ||
|
|
2085111c43 | ||
|
|
7ae8d54265 | ||
|
|
c5574c8667 | ||
|
|
6cf8abc3b3 | ||
|
|
46a4864b08 | ||
|
|
7956b45323 | ||
|
|
63bcbd4ff5 | ||
|
|
3b5ca91a40 | ||
|
|
80282ba972 | ||
|
|
7ddb3dd184 | ||
|
|
0cee5cc1c1 | ||
|
|
048d770a0e | ||
|
|
b3fdb242f0 | ||
|
|
38d908ee6a | ||
|
|
416b850dd2 | ||
|
|
714e068cba | ||
|
|
0a0689587a | ||
|
|
83c4633b21 | ||
|
|
a33063c8a7 | ||
|
|
c478d45713 | ||
|
|
74686a9cb3 | ||
|
|
473a90f99f | ||
|
|
15e9f22fda | ||
|
|
ee44155f7a | ||
|
|
bf64b34475 | ||
|
|
26dbd2218e | ||
|
|
38e46abf0b | ||
|
|
67f7bf4a23 | ||
|
|
02f040c765 | ||
|
|
9b841e4594 | ||
|
|
a40957f2bc | ||
|
|
a6121f527c | ||
|
|
71a31d553f | ||
|
|
1a309fd55f | ||
|
|
73527e54c5 | ||
|
|
2ef0827767 | ||
|
|
76bcab07e6 | ||
|
|
5a5b6abd2c | ||
|
|
4ce5a48076 | ||
|
|
7b61e6044a | ||
|
|
048f06c7f5 | ||
|
|
06868c938f | ||
|
|
22e8fc6379 | ||
|
|
427c139eff | ||
|
|
6a881520ee | ||
|
|
5a2c451c0b | ||
|
|
f47fbccf1a | ||
|
|
eb419946ad | ||
|
|
1b204a4369 | ||
|
|
ee2de310f5 | ||
|
|
e81aa83a14 | ||
|
|
96cae44f32 | ||
|
|
757e7a91a9 | ||
|
|
6faef05095 | ||
|
|
ee65a190fa | ||
|
|
da45f0341a | ||
|
|
c6517c0b7f | ||
|
|
2c92573978 | ||
|
|
fa7326af64 | ||
|
|
aca96553fc | ||
|
|
37592cdaee | ||
|
|
64e48ad0e6 | ||
|
|
68566583f0 | ||
|
|
6a56aa2240 | ||
|
|
7e8c1108e0 | ||
|
|
f5ce5f8218 | ||
|
|
28e44b31ca | ||
|
|
606ca98df0 | ||
|
|
acd2eabdfd | ||
|
|
07972c2892 | ||
|
|
70079d1c8a | ||
|
|
4def69876f | ||
|
|
61a2c7bd16 | ||
|
|
f53262d58f | ||
|
|
8c15619905 | ||
|
|
4a66bed930 | ||
|
|
8dabb3fe33 | ||
|
|
3f88934025 | ||
|
|
296dcc3405 | ||
|
|
5f6de7053a | ||
|
|
6c1eb46f68 | ||
|
|
05cde0d945 | ||
|
|
696c94c08a | ||
|
|
4284691cb3 | ||
|
|
2ab56802cb | ||
|
|
353d12b231 | ||
|
|
cbd734faf9 | ||
|
|
cf282c177f | ||
|
|
e8c8afb1b4 | ||
|
|
dd0d06448c | ||
|
|
3527fdc291 | ||
|
|
a6b9d68897 | ||
|
|
e1e7ec737f | ||
|
|
4fd03f59f4 | ||
|
|
e64e0f00ca | ||
|
|
1bfead2f6b | ||
|
|
c79f1ee720 | ||
|
|
e18c369e4a | ||
|
|
1953ab3bf2 | ||
|
|
d998bf9fed | ||
|
|
40eff3a778 | ||
|
|
9dd089fc56 | ||
|
|
5e2bd0e55f | ||
|
|
95b8be4cc4 | ||
|
|
d48f99fd6e | ||
|
|
3a9b934cc5 | ||
|
|
768f372675 | ||
|
|
9e3f0d5190 | ||
|
|
5a297f409f | ||
|
|
57335cea69 | ||
|
|
3331f51571 | ||
|
|
f122268ca8 | ||
|
|
bfc817fd28 | ||
|
|
2bd83d0e89 | ||
|
|
f29f3418ed | ||
|
|
c87a0077dd | ||
|
|
23c1dcea46 | ||
|
|
41e64d2469 | ||
|
|
5fdc24d3bf | ||
|
|
64dc86c8c2 | ||
|
|
9d1ec6b0eb | ||
|
|
8919480ebc | ||
|
|
bb9e68beee | ||
|
|
88c1f2caf7 | ||
|
|
88375be2b2 | ||
|
|
2aa69505f9 | ||
|
|
e78fe7c8da | ||
|
|
7a7b944c74 | ||
|
|
09f5a2b741 | ||
|
|
cbf50eabd9 | ||
|
|
90a74139c1 | ||
|
|
3a6cc1b786 | ||
|
|
f5fde13b14 | ||
|
|
c6d429d533 | ||
|
|
73df925241 | ||
|
|
269f4ba2bb | ||
|
|
9b304beb54 | ||
|
|
5ffad09e91 | ||
|
|
b694315cd3 | ||
|
|
8566315902 | ||
|
|
cd94ab9de3 | ||
|
|
09ebadaf5b | ||
|
|
990189ab35 | ||
|
|
049e536c5f | ||
|
|
7fe2f25341 | ||
|
|
c79809ddb9 | ||
|
|
b3edf86914 | ||
|
|
7044122f5d | ||
|
|
b7bcce9576 | ||
|
|
2560776888 | ||
|
|
d5d5fef931 | ||
|
|
6b158872fc | ||
|
|
a4ef2d4356 | ||
|
|
14cc902ad8 | ||
|
|
a62a367b9f | ||
|
|
8d67f16512 | ||
|
|
59cb78e9aa | ||
|
|
032552df57 | ||
|
|
1913926ebc | ||
|
|
dc979388ba | ||
|
|
bcabc25b93 | ||
|
|
ab6d22c958 | ||
|
|
806925ee79 | ||
|
|
a46b50fc7b | ||
|
|
517a5915d7 | ||
|
|
1de38af8cc | ||
|
|
66a95db3df | ||
|
|
7b779c6e6a | ||
|
|
429dfd7054 | ||
|
|
03f7a85cfb | ||
|
|
2d2a753dd9 | ||
|
|
028e3889f0 | ||
|
|
47eb123649 | ||
|
|
45ab098079 | ||
|
|
6cfc05ded2 | ||
|
|
40e0e8e499 | ||
|
|
beff8b8b51 | ||
|
|
311723396a | ||
|
|
d39d75321a | ||
|
|
55201d7db6 | ||
|
|
ac46d5b16e | ||
|
|
a1fb069624 | ||
|
|
3aa33dd220 | ||
|
|
9b74d0d54a | ||
|
|
018fc2ca46 | ||
|
|
e286b78df7 | ||
|
|
f77bd19a70 | ||
|
|
cff63d32a0 | ||
|
|
a8e7696674 | ||
|
|
5fc689dc4e | ||
|
|
895bdc0ee0 | ||
|
|
c99f1d317e | ||
|
|
315e3e325d | ||
|
|
8acce4279b | ||
|
|
c8943cdc3c | ||
|
|
f74f009648 | ||
|
|
467409458e | ||
|
|
f5e5bcd943 | ||
|
|
db4d01c517 | ||
|
|
5abce7ec08 | ||
|
|
18907389da | ||
|
|
ba8f80267c | ||
|
|
2abea22b4b | ||
|
|
cde2aae6b5 | ||
|
|
97fa8c824c | ||
|
|
2658cae3ea | ||
|
|
e3b30a825c | ||
|
|
aa26e8b946 | ||
|
|
9a5cd4c8d2 | ||
|
|
138af75ff8 | ||
|
|
13cb21a684 | ||
|
|
620ac9c2b4 | ||
|
|
417f9e27e1 | ||
|
|
0abbb35c4e | ||
|
|
7b28cd33cb | ||
|
|
4e88633d89 | ||
|
|
eb0e55c514 | ||
|
|
b155ebeeb3 | ||
|
|
820dab295f | ||
|
|
956127ee5e | ||
|
|
43fa9166c9 | ||
|
|
9f23bb581e | ||
|
|
2b890827ef | ||
|
|
3ac3fbdbfb | ||
|
|
0090616f7b | ||
|
|
8099e6137d | ||
|
|
e74b21bff5 | ||
|
|
825e67140e | ||
|
|
19223952a8 | ||
|
|
58115c1cae | ||
|
|
86258c6cff | ||
|
|
b29f0b9348 | ||
|
|
e06b0aa73b | ||
|
|
db91673f23 | ||
|
|
c73e34fb9e | ||
|
|
221ce70699 | ||
|
|
9055b5cf6d | ||
|
|
93788e76e0 | ||
|
|
16d4ace800 | ||
|
|
5273930f76 | ||
|
|
dceabf231b | ||
|
|
1ecfcc8c70 | ||
|
|
6c6bff81ac | ||
|
|
8dad0c7aaa | ||
|
|
eb100cdf9e | ||
|
|
b085dac15b | ||
|
|
a7e26fdc61 | ||
|
|
d67f25ce43 | ||
|
|
dfac05805d | ||
|
|
6025ae7b12 | ||
|
|
8efa45d12d | ||
|
|
1f44f47de1 | ||
|
|
5c2c30142c | ||
|
|
5bd7b6ad50 | ||
|
|
2cf64d0200 | ||
|
|
2aa7ab821c | ||
|
|
1b2c6a33b3 | ||
|
|
67642312f4 | ||
|
|
032353b14f | ||
|
|
d21519ed2e | ||
|
|
50178d4836 | ||
|
|
5d696c5c69 | ||
|
|
01448e1235 | ||
|
|
812de5d3bf | ||
|
|
ec2c1db0e4 | ||
|
|
b92163d226 | ||
|
|
c2e77e4429 | ||
|
|
ec87917f58 | ||
|
|
d1c5c760d0 | ||
|
|
9b4ba7993c | ||
|
|
1dc1ef6091 | ||
|
|
8de925c4c2 | ||
|
|
df1d3156a0 | ||
|
|
c75c3ef616 | ||
|
|
bb2ab01f99 | ||
|
|
2fad53e66b | ||
|
|
c250cd6e7c | ||
|
|
f80a17c5be | ||
|
|
5e11be6898 | ||
|
|
ebd55c1147 | ||
|
|
2ce90f8806 | ||
|
|
b3e7657159 | ||
|
|
23066f8cce | ||
|
|
de3c1fae7f | ||
|
|
94ec4ecabe | ||
|
|
c16a186de0 | ||
|
|
8da9a3c416 | ||
|
|
8d9ba87e05 | ||
|
|
c85648a8a1 | ||
|
|
0c87471c12 | ||
|
|
f3cf2566c1 | ||
|
|
9b534e9aab | ||
|
|
3f72f07a7f | ||
|
|
e26fa9090d | ||
|
|
39d19d23d1 | ||
|
|
0a09f27735 | ||
|
|
8dae38639a | ||
|
|
87bd0501c4 | ||
|
|
ccff140046 | ||
|
|
e1eb9519f5 | ||
|
|
ad34d7fc32 | ||
|
|
4945a9fce9 | ||
|
|
7f320eef0e | ||
|
|
513c8536c0 | ||
|
|
82ff142f9c | ||
|
|
509587eb81 | ||
|
|
80af35e0cd | ||
|
|
f054d5862c | ||
|
|
8a2ba597bb | ||
|
|
e543fe702c | ||
|
|
2470ef2e91 | ||
|
|
fe956f87ec | ||
|
|
1c0a21a8bc | ||
|
|
2f03d393c3 | ||
|
|
712d77dc8b | ||
|
|
bf978e09e4 | ||
|
|
4ac4b34ae9 | ||
|
|
01ed55ff02 | ||
|
|
ef690c035d | ||
|
|
969b4d1dd3 | ||
|
|
a9e695d05f | ||
|
|
b7b0992768 | ||
|
|
d3922f95e6 | ||
|
|
9457c796b1 | ||
|
|
37e34395de | ||
|
|
4f815d8469 | ||
|
|
e099edc2c2 | ||
|
|
5e942cea8d | ||
|
|
ead8f2bbcd | ||
|
|
efe6e7b04d | ||
|
|
cc0312567e | ||
|
|
593f1774e9 | ||
|
|
0653e31767 | ||
|
|
b18fb96ecf | ||
|
|
26d9ef9403 | ||
|
|
c32bea5ae0 | ||
|
|
7f0ec3091e | ||
|
|
597a8b5ec7 | ||
|
|
c25f0a1779 | ||
|
|
bac15ef86f | ||
|
|
297b81fa1d | ||
|
|
913ec1e0d0 | ||
|
|
d090b0cd2d | ||
|
|
1e0b87732f | ||
|
|
9abdfc11a9 | ||
|
|
ae6f08d56e | ||
|
|
26014d19e1 | ||
|
|
e83c299454 | ||
|
|
b136819371 | ||
|
|
c46a386970 | ||
|
|
6f2fe7560a | ||
|
|
e459114149 | ||
|
|
624ba4f642 | ||
|
|
63f08fcdb0 | ||
|
|
3f5833ce5d | ||
|
|
ffe2182883 | ||
|
|
e510af77b2 | ||
|
|
afc59aefb7 | ||
|
|
b0fe3e20e6 | ||
|
|
eb2d2264d0 | ||
|
|
104088b86b | ||
|
|
11cd0db86b | ||
|
|
8bf74164e2 | ||
|
|
eaa18041e1 | ||
|
|
d2a94e6b13 | ||
|
|
42999f42f2 | ||
|
|
dfd2135647 | ||
|
|
7c45c2fdef | ||
|
|
2cac40444b | ||
|
|
f566e562a3 | ||
|
|
0e61709fa7 | ||
|
|
2b316f3843 | ||
|
|
660e566201 | ||
|
|
999f7df158 | ||
|
|
816bc5c8a7 | ||
|
|
99f1b96c4f | ||
|
|
334ea36f38 | ||
|
|
c485c1e4b0 | ||
|
|
b2652beceb | ||
|
|
3ec17a88ba | ||
|
|
5dee8a5717 | ||
|
|
ace0284eef | ||
|
|
5ccc043d86 | ||
|
|
fd31a99ef0 | ||
|
|
ff1f224d96 | ||
|
|
0b26d7a0e2 | ||
|
|
5f59c6ddfe | ||
|
|
a9f2a52ce0 | ||
|
|
d84e2e3972 | ||
|
|
49bd74ff0e | ||
|
|
d395799917 | ||
|
|
6e9a23a884 | ||
|
|
0979fb7eee | ||
|
|
9ab06af786 | ||
|
|
6087f89aac | ||
|
|
432ae81823 | ||
|
|
2c23e44ed9 | ||
|
|
7be1905023 | ||
|
|
20e3c519dd | ||
|
|
8a0a41b9ef | ||
|
|
93da8e2b3d | ||
|
|
196fceabdb | ||
|
|
0d16be9560 | ||
|
|
137622931b | ||
|
|
cd096289e9 | ||
|
|
88e32ef231 | ||
|
|
bff16e027a | ||
|
|
a453f2ae6c | ||
|
|
8b523cf88a | ||
|
|
65ebb6e547 | ||
|
|
c29e4b096d | ||
|
|
8cdfd30ba5 | ||
|
|
81ae154714 | ||
|
|
504cdb13f0 | ||
|
|
b601f3a031 | ||
|
|
96b42bddb8 | ||
|
|
cc9436f288 | ||
|
|
bedc5f7da9 | ||
|
|
96c3fec855 | ||
|
|
cad73732c0 | ||
|
|
39475f9404 | ||
|
|
8589ab27a4 | ||
|
|
f537366387 | ||
|
|
d7161742d2 | ||
|
|
6e88b6b445 | ||
|
|
614079654c | ||
|
|
51015c5b48 | ||
|
|
c621a36320 | ||
|
|
e37ad09330 | ||
|
|
bfe256891c | ||
|
|
0f5ff1f5bb | ||
|
|
e96a042223 | ||
|
|
5cbbd489d5 | ||
|
|
805a55099b | ||
|
|
654338693f | ||
|
|
a9e3dabc8a | ||
|
|
609403fba6 | ||
|
|
6b55584923 | ||
|
|
81e6f317c9 | ||
|
|
7d4e0ad7b0 | ||
|
|
35ebbb5f6e | ||
|
|
c819fbe852 | ||
|
|
c03288f458 | ||
|
|
90d62e5b98 | ||
|
|
b3947d6a83 | ||
|
|
eed72c35d7 | ||
|
|
79e936aea8 | ||
|
|
01fdb80f7c | ||
|
|
04debd5890 | ||
|
|
af138dab55 | ||
|
|
f212ed85dd | ||
|
|
99de0975c3 | ||
|
|
41d8247ffc | ||
|
|
217ed9aabc | ||
|
|
538c4763cf | ||
|
|
3bc5302d78 | ||
|
|
987300c97a | ||
|
|
27ce6a9cd3 | ||
|
|
832c926712 | ||
|
|
ae9424d93a | ||
|
|
1dcda7b809 | ||
|
|
bdc84d0bfb | ||
|
|
4b8e1588b4 | ||
|
|
4eee71ffbf | ||
|
|
bdb20d53cb | ||
|
|
7e61cd0dfb | ||
|
|
2542c51c48 | ||
|
|
92c3a4e4c2 | ||
|
|
4e809f0048 | ||
|
|
d04072d1eb | ||
|
|
cddbddc543 | ||
|
|
c57db7f163 | ||
|
|
94c6b256de | ||
|
|
f6c523db13 | ||
|
|
080fdb3817 | ||
|
|
181f663cf1 | ||
|
|
1eda92859f | ||
|
|
f54bc1cb2e | ||
|
|
b7d25ccb77 | ||
|
|
c89debd19a | ||
|
|
ef6d4a46c2 | ||
|
|
81e9dab52f | ||
|
|
698120daf0 | ||
|
|
c61020e9d3 | ||
|
|
6144408f3a | ||
|
|
7825d043f2 | ||
|
|
c6a8b7f959 | ||
|
|
6a3922d330 | ||
|
|
f7e3e1f97a | ||
|
|
ab0bf6d238 | ||
|
|
6667969887 | ||
|
|
12b00ca942 | ||
|
|
1f43af5cea | ||
|
|
268094e0ef | ||
|
|
9ccd6aa0dd | ||
|
|
46b6bcd99b | ||
|
|
4bc7b3b1a4 | ||
|
|
5e525b3e0f | ||
|
|
612e3f7ff7 | ||
|
|
991a56135d | ||
|
|
3bd829aee0 | ||
|
|
674779899e | ||
|
|
3f49f984e6 | ||
|
|
b7defaaf6a | ||
|
|
f10f44acf5 | ||
|
|
d258797d05 | ||
|
|
fb214a599e | ||
|
|
a4c0f26f06 | ||
|
|
145b4fae94 | ||
|
|
cd1b15a155 | ||
|
|
1dc02e6dbc | ||
|
|
0851697cb7 | ||
|
|
bd11be98aa | ||
|
|
a54d438e18 | ||
|
|
b33558d822 | ||
|
|
43e6d7fe88 | ||
|
|
8f1c51eaea | ||
|
|
090786b037 | ||
|
|
dba3927b4e | ||
|
|
56d10aeef7 | ||
|
|
6a76540cb6 | ||
|
|
2c002a3342 | ||
|
|
42ac64284f | ||
|
|
2595cb5698 | ||
|
|
c3bb73a711 | ||
|
|
e59095423e | ||
|
|
db21391156 | ||
|
|
12df0e8994 | ||
|
|
ca0cf5415e | ||
|
|
33f2ec6355 | ||
|
|
680399f476 | ||
|
|
d0c7a91a50 | ||
|
|
27b2747b61 | ||
|
|
9b1f698770 | ||
|
|
efa1818cb4 | ||
|
|
246187a20f | ||
|
|
4c54cfc692 | ||
|
|
5d892a557f | ||
|
|
49fe2604b3 | ||
|
|
28466a39d8 | ||
|
|
e1824c00a9 | ||
|
|
b5798326e8 | ||
|
|
fee84de782 | ||
|
|
e8fa248571 | ||
|
|
ba5ee79af8 | ||
|
|
69eac0d9d2 | ||
|
|
9713fa09e7 | ||
|
|
f654da9f56 | ||
|
|
ef03c4b7bb | ||
|
|
13df748f02 | ||
|
|
04dbd5c53f | ||
|
|
398c5d553d | ||
|
|
39f0bd3e82 | ||
|
|
2dffc9f6eb | ||
|
|
bc0a2d1b28 | ||
|
|
1749af9707 | ||
|
|
57507ca37c | ||
|
|
7861e9f728 | ||
|
|
84cbc1d6c0 | ||
|
|
03debb4ef9 | ||
|
|
ed3b69ffb1 | ||
|
|
0fb3c8cb7c | ||
|
|
58840f39bb | ||
|
|
da29ce355f | ||
|
|
7a9e6659f0 | ||
|
|
9eb89b4ac7 | ||
|
|
fec54c9c5d | ||
|
|
67169a5d0c | ||
|
|
eebea63bed | ||
|
|
9c7a216814 | ||
|
|
a8861e6a66 | ||
|
|
8a9a5d69b6 | ||
|
|
761a4deab3 | ||
|
|
50cc54e50b | ||
|
|
da2401ff39 | ||
|
|
c3d0fed9ed | ||
|
|
c0982d7316 | ||
|
|
f0396c19be | ||
|
|
33a9d898a6 | ||
|
|
cfd230d7f1 | ||
|
|
ee674acca4 | ||
|
|
8f043bbdaa | ||
|
|
750005f02b | ||
|
|
0bb227f8a4 | ||
|
|
40d9f828d4 | ||
|
|
49f2071e22 | ||
|
|
f08be2162a | ||
|
|
45e452557b | ||
|
|
df94cc1b13 | ||
|
|
bd28b876a0 | ||
|
|
e959137a4b | ||
|
|
d0800aa200 | ||
|
|
3011a0f14f | ||
|
|
ee64c6ab86 | ||
|
|
79277cc383 | ||
|
|
e78b902a7d | ||
|
|
e8c4e6f0b3 | ||
|
|
2e785899dd | ||
|
|
115b57649e | ||
|
|
b80429ab7f | ||
|
|
c190e64012 | ||
|
|
3a6cafaf0a | ||
|
|
c76b0b70c1 | ||
|
|
c71cdce0b7 | ||
|
|
a5f87cee6b | ||
|
|
bf66fe51f6 |
1325
.circleci/config.yml
1325
.circleci/config.yml
File diff suppressed because it is too large
Load Diff
@@ -6,9 +6,11 @@
|
||||
"browser": true
|
||||
},
|
||||
"rules": {
|
||||
"semi": ["error", "always"],
|
||||
"no-var": "error",
|
||||
"no-unused-vars": 0,
|
||||
"no-global-assign": 0,
|
||||
"guard-for-in": 2,
|
||||
"@typescript-eslint/no-unused-vars": ["error", {
|
||||
"vars": "all",
|
||||
"args": "after-used",
|
||||
|
||||
11
.gitattributes
vendored
11
.gitattributes
vendored
@@ -1,3 +1,14 @@
|
||||
# `git apply` and friends don't understand CRLF, even on windows. Force those
|
||||
# files to be checked out with LF endings even if core.autocrlf is true.
|
||||
*.patch text eol=lf
|
||||
patches/**/.patches merge=union
|
||||
|
||||
# Source code and markdown files should always use LF as line ending.
|
||||
*.cc text eol=lf
|
||||
*.mm text eol=lf
|
||||
*.h text eol=lf
|
||||
*.js text eol=lf
|
||||
*.ts text eol=lf
|
||||
*.py text eol=lf
|
||||
*.ps1 text eol=lf
|
||||
*.md text eol=lf
|
||||
|
||||
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -11,6 +11,7 @@
|
||||
|
||||
# Upgrades WG
|
||||
/patches/ @electron/wg-upgrades
|
||||
DEPS @electron/wg-upgrades
|
||||
|
||||
# Docs & Tooling WG
|
||||
/default_app/ @electron/wg-docs-tools
|
||||
|
||||
2
.github/config.yml
vendored
2
.github/config.yml
vendored
@@ -29,13 +29,11 @@ firstPRMergeComment: >
|
||||
# Users authorized to run manual trop backports
|
||||
authorizedUsers:
|
||||
- alexeykuzmin
|
||||
- BinaryMuse
|
||||
- ckerr
|
||||
- codebytere
|
||||
- deepak1556
|
||||
- jkleinsc
|
||||
- MarshallOfSound
|
||||
- miniak
|
||||
- nitsakh
|
||||
- nornagon
|
||||
- zcbenz
|
||||
|
||||
10
.github/main.workflow
vendored
10
.github/main.workflow
vendored
@@ -1,10 +0,0 @@
|
||||
workflow "Clerk" {
|
||||
#TODO(codebytere): make this work properly on pull_request
|
||||
on = "repository_dispatch"
|
||||
resolves = "Check release notes"
|
||||
}
|
||||
|
||||
action "Check release notes" {
|
||||
uses = "electron/clerk@master"
|
||||
secrets = [ "GITHUB_TOKEN" ]
|
||||
}
|
||||
25
.github/stale.yml
vendored
25
.github/stale.yml
vendored
@@ -1,25 +0,0 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 45
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- fixme/bug
|
||||
- fixme/crash
|
||||
- fixme/regression
|
||||
- fixme/security
|
||||
- blocked
|
||||
- blocking-stable
|
||||
- needs-review
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity and is not currently prioritized. It will be closed
|
||||
in a week if no further activity occurs :)
|
||||
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: >
|
||||
If you still think this issue is relevant, please ping a maintainer or
|
||||
leave a comment!
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -58,7 +58,7 @@ spec/.hash
|
||||
.eslintcache
|
||||
|
||||
# Generated native addon files
|
||||
/spec/fixtures/native-addon/echo/build/
|
||||
/spec-main/fixtures/native-addon/echo/build/
|
||||
|
||||
# If someone runs tsc this is where stuff will end up
|
||||
ts-gen
|
||||
|
||||
223
BUILD.gn
223
BUILD.gn
@@ -1,9 +1,11 @@
|
||||
import("//build/config/locales.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("//build/config/win/manifest.gni")
|
||||
import("//components/spellcheck/spellcheck_build_features.gni")
|
||||
import("//content/public/app/mac_helpers.gni")
|
||||
import("//pdf/features.gni")
|
||||
import("//printing/buildflags/buildflags.gni")
|
||||
import("//testing/test.gni")
|
||||
import("//third_party/ffmpeg/ffmpeg_options.gni")
|
||||
import("//tools/generate_library_loader/generate_library_loader.gni")
|
||||
import("//tools/grit/grit_rule.gni")
|
||||
@@ -20,12 +22,14 @@ import("buildflags/buildflags.gni")
|
||||
import("electron_paks.gni")
|
||||
import("filenames.auto.gni")
|
||||
import("filenames.gni")
|
||||
import("filenames.hunspell.gni")
|
||||
|
||||
if (is_mac) {
|
||||
import("//build/config/mac/rules.gni")
|
||||
import("//third_party/icu/config.gni")
|
||||
import("//ui/gl/features.gni")
|
||||
import("//v8/gni/v8.gni")
|
||||
import("build/rules.gni")
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
@@ -60,6 +64,10 @@ config("branding") {
|
||||
]
|
||||
}
|
||||
|
||||
config("electron_lib_config") {
|
||||
include_dirs = [ "." ]
|
||||
}
|
||||
|
||||
# We geneate the definitions twice here, once in //electron/electron.d.ts
|
||||
# and once in $target_gen_dir
|
||||
# The one in $target_gen_dir is used for the actual TSC build later one
|
||||
@@ -141,7 +149,7 @@ webpack_build("electron_content_script_bundle") {
|
||||
out_file = "$target_gen_dir/js2c/content_script_bundle.js"
|
||||
}
|
||||
|
||||
copy("atom_js2c_copy") {
|
||||
copy("electron_js2c_copy") {
|
||||
sources = [
|
||||
"lib/common/asar.js",
|
||||
"lib/common/asar_init.js",
|
||||
@@ -151,12 +159,12 @@ copy("atom_js2c_copy") {
|
||||
]
|
||||
}
|
||||
|
||||
action("atom_js2c") {
|
||||
action("electron_js2c") {
|
||||
deps = [
|
||||
":atom_js2c_copy",
|
||||
":electron_browser_bundle",
|
||||
":electron_content_script_bundle",
|
||||
":electron_isolated_renderer_bundle",
|
||||
":electron_js2c_copy",
|
||||
":electron_renderer_bundle",
|
||||
":electron_sandboxed_renderer_bundle",
|
||||
":electron_worker_bundle",
|
||||
@@ -178,7 +186,7 @@ action("atom_js2c") {
|
||||
|
||||
inputs = sources + [ "//third_party/electron_node/tools/js2c.py" ]
|
||||
outputs = [
|
||||
"$root_gen_dir/atom_natives.cc",
|
||||
"$root_gen_dir/electron_natives.cc",
|
||||
]
|
||||
|
||||
script = "tools/js2c.py"
|
||||
@@ -280,6 +288,7 @@ if (is_linux) {
|
||||
"notify_notification_add_action",
|
||||
"notify_notification_set_image_from_pixbuf",
|
||||
"notify_notification_set_timeout",
|
||||
"notify_notification_set_urgency",
|
||||
"notify_notification_set_hint_string",
|
||||
"notify_notification_show",
|
||||
"notify_notification_close",
|
||||
@@ -300,14 +309,6 @@ source_set("manifests") {
|
||||
"//printing/buildflags",
|
||||
"//services/service_manager/public/cpp",
|
||||
]
|
||||
|
||||
if (enable_basic_printing) {
|
||||
deps += [ "//components/services/pdf_compositor/public/cpp:manifest" ]
|
||||
}
|
||||
|
||||
if (enable_print_preview) {
|
||||
deps += [ "//chrome/services/printing/public/cpp:manifest" ]
|
||||
}
|
||||
}
|
||||
|
||||
npm_action("electron_version_args") {
|
||||
@@ -340,25 +341,34 @@ source_set("electron_lib") {
|
||||
configs += [ "//v8:external_startup_data" ]
|
||||
configs += [ "//third_party/electron_node:node_internals" ]
|
||||
|
||||
public_configs = [ ":branding" ]
|
||||
public_configs = [
|
||||
":branding",
|
||||
":electron_lib_config",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":atom_js2c",
|
||||
":electron_js2c",
|
||||
":electron_version_header",
|
||||
":manifests",
|
||||
":resources",
|
||||
"buildflags",
|
||||
"chromium_src:chrome",
|
||||
"chromium_src:chrome_spellchecker",
|
||||
"native_mate",
|
||||
"shell/common/api:mojo",
|
||||
"//base:base_static",
|
||||
"//base/allocator:buildflags",
|
||||
"//chrome/app:command_ids",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//chrome/services/printing/public/mojom",
|
||||
"//components/certificate_transparency",
|
||||
"//components/language/core/browser",
|
||||
"//components/net_log",
|
||||
"//components/network_hints/browser",
|
||||
"//components/network_hints/common:mojo_bindings",
|
||||
"//components/network_hints/renderer",
|
||||
"//components/network_session_configurator/common",
|
||||
"//components/prefs",
|
||||
"//components/spellcheck/renderer",
|
||||
"//components/viz/host",
|
||||
"//components/viz/service",
|
||||
"//content/public/browser",
|
||||
@@ -371,27 +381,25 @@ source_set("electron_lib") {
|
||||
"//device/bluetooth/public/cpp",
|
||||
"//gin",
|
||||
"//media/capture/mojom:video_capture",
|
||||
"//media/mojo/interfaces",
|
||||
"//media/mojo/mojom",
|
||||
"//net:extras",
|
||||
"//net:net_resources",
|
||||
"//net:net_with_v8",
|
||||
"//ppapi/host",
|
||||
"//ppapi/proxy",
|
||||
"//ppapi/shared_impl",
|
||||
"//printing/buildflags",
|
||||
"//services/audio/public/mojom:constants",
|
||||
"//services/device/public/cpp/geolocation",
|
||||
"//services/device/public/mojom",
|
||||
"//services/proxy_resolver:lib",
|
||||
"//services/video_capture/public/mojom:constants",
|
||||
"//services/viz/privileged/interfaces/compositing",
|
||||
"//services/viz/privileged/mojom/compositing",
|
||||
"//skia",
|
||||
"//third_party/blink/public:blink",
|
||||
"//third_party/boringssl",
|
||||
"//third_party/electron_node:node_lib",
|
||||
"//third_party/leveldatabase",
|
||||
"//third_party/libyuv",
|
||||
"//third_party/webrtc_overrides:init_webrtc",
|
||||
"//third_party/webrtc_overrides:webrtc_component",
|
||||
"//third_party/widevine/cdm:headers",
|
||||
"//ui/base/idle",
|
||||
"//ui/events:dom_keycode_converter",
|
||||
@@ -479,12 +487,25 @@ source_set("electron_lib") {
|
||||
"//content/common:mac_helpers",
|
||||
"//ui/accelerated_widget_mac",
|
||||
]
|
||||
|
||||
libs = [
|
||||
"AVFoundation.framework",
|
||||
"Carbon.framework",
|
||||
"LocalAuthentication.framework",
|
||||
"QuartzCore.framework",
|
||||
"Quartz.framework",
|
||||
"Security.framework",
|
||||
"SecurityInterface.framework",
|
||||
"ServiceManagement.framework",
|
||||
"StoreKit.framework",
|
||||
]
|
||||
|
||||
sources += [
|
||||
"shell/browser/ui/views/autofill_popup_view.cc",
|
||||
"shell/browser/ui/views/autofill_popup_view.h",
|
||||
]
|
||||
if (is_mas_build) {
|
||||
sources += [ "shell/browser/api/atom_api_app_mas.mm" ]
|
||||
sources += [ "shell/browser/api/electron_api_app_mas.mm" ]
|
||||
sources -= [
|
||||
"shell/browser/auto_updater_mac.mm",
|
||||
"shell/common/crash_reporter/crash_reporter_mac.h",
|
||||
@@ -528,6 +549,20 @@ source_set("electron_lib") {
|
||||
]
|
||||
|
||||
sources += filenames.lib_sources_nss
|
||||
sources += [
|
||||
"shell/browser/ui/gtk/app_indicator_icon.cc",
|
||||
"shell/browser/ui/gtk/app_indicator_icon.h",
|
||||
"shell/browser/ui/gtk/app_indicator_icon_menu.cc",
|
||||
"shell/browser/ui/gtk/app_indicator_icon_menu.h",
|
||||
"shell/browser/ui/gtk/gtk_status_icon.cc",
|
||||
"shell/browser/ui/gtk/gtk_status_icon.h",
|
||||
"shell/browser/ui/gtk/menu_util.cc",
|
||||
"shell/browser/ui/gtk/menu_util.h",
|
||||
"shell/browser/ui/gtk/status_icon.cc",
|
||||
"shell/browser/ui/gtk/status_icon.h",
|
||||
"shell/browser/ui/gtk_util.cc",
|
||||
"shell/browser/ui/gtk_util.h",
|
||||
]
|
||||
}
|
||||
if (is_win) {
|
||||
libs += [ "dwmapi.lib" ]
|
||||
@@ -579,39 +614,51 @@ source_set("electron_lib") {
|
||||
]
|
||||
deps += [
|
||||
"//components/viz/service",
|
||||
"//services/viz/public/interfaces",
|
||||
"//services/viz/public/mojom",
|
||||
"//ui/compositor",
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_remote_module) {
|
||||
sources += [
|
||||
"shell/common/api/remote/object_life_monitor.cc",
|
||||
"shell/common/api/remote/object_life_monitor.h",
|
||||
"shell/common/api/remote/remote_callback_freer.cc",
|
||||
"shell/common/api/remote/remote_callback_freer.h",
|
||||
"shell/common/api/remote/remote_object_freer.cc",
|
||||
"shell/common/api/remote/remote_object_freer.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_desktop_capturer) {
|
||||
if (is_component_build && is_win) {
|
||||
if (is_component_build && !is_linux) {
|
||||
# On windows the implementation relies on unexported
|
||||
# DxgiDuplicatorController class.
|
||||
# DxgiDuplicatorController class. On macOS the implementation
|
||||
# relies on unexported webrtc::GetWindowOwnerPid method.
|
||||
deps += [ "//third_party/webrtc/modules/desktop_capture" ]
|
||||
}
|
||||
sources += [
|
||||
"shell/browser/api/atom_api_desktop_capturer.cc",
|
||||
"shell/browser/api/atom_api_desktop_capturer.h",
|
||||
"shell/browser/api/electron_api_desktop_capturer.cc",
|
||||
"shell/browser/api/electron_api_desktop_capturer.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_view_api) {
|
||||
sources += [
|
||||
"shell/browser/api/views/atom_api_box_layout.cc",
|
||||
"shell/browser/api/views/atom_api_box_layout.h",
|
||||
"shell/browser/api/views/atom_api_button.cc",
|
||||
"shell/browser/api/views/atom_api_button.h",
|
||||
"shell/browser/api/views/atom_api_label_button.cc",
|
||||
"shell/browser/api/views/atom_api_label_button.h",
|
||||
"shell/browser/api/views/atom_api_layout_manager.cc",
|
||||
"shell/browser/api/views/atom_api_layout_manager.h",
|
||||
"shell/browser/api/views/atom_api_md_text_button.cc",
|
||||
"shell/browser/api/views/atom_api_md_text_button.h",
|
||||
"shell/browser/api/views/atom_api_resize_area.cc",
|
||||
"shell/browser/api/views/atom_api_resize_area.h",
|
||||
"shell/browser/api/views/atom_api_text_field.cc",
|
||||
"shell/browser/api/views/atom_api_text_field.h",
|
||||
"shell/browser/api/views/electron_api_box_layout.cc",
|
||||
"shell/browser/api/views/electron_api_box_layout.h",
|
||||
"shell/browser/api/views/electron_api_button.cc",
|
||||
"shell/browser/api/views/electron_api_button.h",
|
||||
"shell/browser/api/views/electron_api_label_button.cc",
|
||||
"shell/browser/api/views/electron_api_label_button.h",
|
||||
"shell/browser/api/views/electron_api_layout_manager.cc",
|
||||
"shell/browser/api/views/electron_api_layout_manager.h",
|
||||
"shell/browser/api/views/electron_api_md_text_button.cc",
|
||||
"shell/browser/api/views/electron_api_md_text_button.h",
|
||||
"shell/browser/api/views/electron_api_resize_area.cc",
|
||||
"shell/browser/api/views/electron_api_resize_area.h",
|
||||
"shell/browser/api/views/electron_api_text_field.cc",
|
||||
"shell/browser/api/views/electron_api_text_field.h",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -659,6 +706,12 @@ if (is_mac) {
|
||||
electron_framework_version = "A"
|
||||
electron_version = read_file("ELECTRON_VERSION", "trim string")
|
||||
|
||||
mac_xib_bundle_data("electron_xibs") {
|
||||
sources = [
|
||||
"shell/common/resources/mac/MainMenu.xib",
|
||||
]
|
||||
}
|
||||
|
||||
bundle_data("electron_framework_resources") {
|
||||
public_deps = [
|
||||
":packed_resources",
|
||||
@@ -669,7 +722,6 @@ if (is_mac) {
|
||||
public_deps += [ "//third_party/icu:icudata" ]
|
||||
}
|
||||
if (v8_use_external_startup_data) {
|
||||
sources += [ "$root_out_dir/natives_blob.bin" ]
|
||||
public_deps += [ "//v8" ]
|
||||
if (use_v8_context_snapshot) {
|
||||
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
@@ -766,6 +818,7 @@ if (is_mac) {
|
||||
"Libraries",
|
||||
]
|
||||
public_deps = [
|
||||
":electron_framework_libraries",
|
||||
":electron_lib",
|
||||
]
|
||||
deps = [
|
||||
@@ -773,6 +826,7 @@ if (is_mac) {
|
||||
":electron_framework_libraries",
|
||||
":electron_framework_resources",
|
||||
":electron_swiftshader_library",
|
||||
":electron_xibs",
|
||||
]
|
||||
if (!is_mas_build) {
|
||||
deps += [ ":electron_crashpad_helper" ]
|
||||
@@ -786,18 +840,7 @@ if (is_mac) {
|
||||
|
||||
include_dirs = [ "." ]
|
||||
sources = filenames.framework_sources
|
||||
|
||||
libs = [
|
||||
"AVFoundation.framework",
|
||||
"Carbon.framework",
|
||||
"LocalAuthentication.framework",
|
||||
"QuartzCore.framework",
|
||||
"Quartz.framework",
|
||||
"Security.framework",
|
||||
"SecurityInterface.framework",
|
||||
"ServiceManagement.framework",
|
||||
"StoreKit.framework",
|
||||
]
|
||||
libs = []
|
||||
|
||||
if (enable_osr) {
|
||||
libs += [ "IOSurface.framework" ]
|
||||
@@ -831,7 +874,7 @@ if (is_mac) {
|
||||
}
|
||||
defines = [ "HELPER_EXECUTABLE" ]
|
||||
sources = filenames.app_sources
|
||||
sources += [ "shell/common/atom_constants.cc" ]
|
||||
sources += [ "shell/common/electron_constants.cc" ]
|
||||
include_dirs = [ "." ]
|
||||
info_plist = "shell/renderer/resources/mac/Info.plist"
|
||||
extra_substitutions =
|
||||
@@ -952,7 +995,7 @@ if (is_mac) {
|
||||
mac_app_bundle("electron_app") {
|
||||
output_name = electron_product_name
|
||||
sources = filenames.app_sources
|
||||
sources += [ "shell/common/atom_constants.cc" ]
|
||||
sources += [ "shell/common/electron_constants.cc" ]
|
||||
include_dirs = [ "." ]
|
||||
deps = [
|
||||
":electron_app_framework_bundle_data",
|
||||
@@ -1181,6 +1224,37 @@ if (is_mac) {
|
||||
}
|
||||
}
|
||||
|
||||
test("shell_browser_ui_unittests") {
|
||||
sources = [
|
||||
"//electron/shell/browser/ui/accelerator_util_unittests.cc",
|
||||
"//electron/shell/browser/ui/run_all_unittests.cc",
|
||||
]
|
||||
|
||||
configs += [ ":electron_lib_config" ]
|
||||
|
||||
deps = [
|
||||
":electron_lib",
|
||||
"//base",
|
||||
"//base/test:test_support",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
"//ui/base",
|
||||
"//ui/strings",
|
||||
]
|
||||
|
||||
if (is_mac) {
|
||||
# Resolve paths owing to different test executable locations
|
||||
ldflags = [
|
||||
"-F",
|
||||
rebase_path("external_binaries", root_build_dir),
|
||||
"-rpath",
|
||||
"@loader_path",
|
||||
"-rpath",
|
||||
"@executable_path/" + rebase_path("external_binaries", root_build_dir),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
template("dist_zip") {
|
||||
_runtime_deps_target = "${target_name}__deps"
|
||||
_runtime_deps_file =
|
||||
@@ -1208,9 +1282,14 @@ template("dist_zip") {
|
||||
"outputs",
|
||||
"testonly",
|
||||
])
|
||||
flatten = false
|
||||
if (defined(invoker.flatten)) {
|
||||
flatten = invoker.flatten
|
||||
}
|
||||
args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
|
||||
target_cpu,
|
||||
target_os,
|
||||
"$flatten",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1285,17 +1364,41 @@ dist_zip("electron_chromedriver_zip") {
|
||||
]
|
||||
}
|
||||
|
||||
mksnapshot_deps = [
|
||||
":licenses",
|
||||
"//tools/v8_context_snapshot:v8_context_snapshot_generator($v8_snapshot_toolchain)",
|
||||
"//v8:mksnapshot($v8_snapshot_toolchain)",
|
||||
]
|
||||
|
||||
group("electron_mksnapshot") {
|
||||
public_deps = mksnapshot_deps
|
||||
}
|
||||
|
||||
dist_zip("electron_mksnapshot_zip") {
|
||||
data_deps = [
|
||||
"//v8:mksnapshot($v8_snapshot_toolchain)",
|
||||
"//tools/v8_context_snapshot:v8_context_snapshot_generator",
|
||||
":licenses",
|
||||
]
|
||||
data_deps = mksnapshot_deps
|
||||
outputs = [
|
||||
"$root_build_dir/mksnapshot.zip",
|
||||
]
|
||||
}
|
||||
|
||||
copy("hunspell_dictionaries") {
|
||||
sources = hunspell_dictionaries + hunspell_licenses
|
||||
outputs = [
|
||||
"$target_gen_dir/electron_hunspell/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
|
||||
dist_zip("hunspell_dictionaries_zip") {
|
||||
data_deps = [
|
||||
":hunspell_dictionaries",
|
||||
]
|
||||
flatten = true
|
||||
|
||||
outputs = [
|
||||
"$root_build_dir/hunspell_dictionaries.zip",
|
||||
]
|
||||
}
|
||||
|
||||
group("electron") {
|
||||
public_deps = [
|
||||
":electron_app",
|
||||
|
||||
@@ -20,13 +20,11 @@ Issues are created [here](https://github.com/electron/electron/issues/new).
|
||||
* [Triaging a Bug Report](https://electronjs.org/docs/development/issues#triaging-a-bug-report)
|
||||
* [Resolving a Bug Report](https://electronjs.org/docs/development/issues#resolving-a-bug-report)
|
||||
|
||||
### Issue Maintenance and Closure
|
||||
* If an issue is inactive for 45 days (no activity of any kind), it will be
|
||||
marked for closure with `stale`.
|
||||
* If after this label is applied, no further activity occurs in the next 7 days,
|
||||
the issue will be closed.
|
||||
* If an issue has been closed and you still feel it's relevant, feel free to
|
||||
ping a maintainer or add a comment!
|
||||
### Issue Closure
|
||||
|
||||
Bug reports will be closed if the issue has been inactive and the latest affected version no longer receives support. At the moment, Electron maintains its three latest major versions, with a new major version being released every 12 weeks. (For more information on Electron's release cadence, see [this blog post](https://electronjs.org/blog/12-week-cadence).)
|
||||
|
||||
_If an issue has been closed and you still feel it's relevant, feel free to ping a maintainer or add a comment!_
|
||||
|
||||
### Languages
|
||||
|
||||
|
||||
13
DEPS
13
DEPS
@@ -5,14 +5,15 @@ gclient_gn_args = [
|
||||
'checkout_android_native_support',
|
||||
'checkout_libaom',
|
||||
'checkout_nacl',
|
||||
'checkout_oculus_sdk'
|
||||
'checkout_oculus_sdk',
|
||||
'checkout_openxr'
|
||||
]
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'9eecb7a9f652bbf84f6437b49c70922b65b38bf3',
|
||||
'80.0.3987.163',
|
||||
'node_version':
|
||||
'v12.6.0',
|
||||
'v12.13.0',
|
||||
'nan_version':
|
||||
'2ee313aaca52e2b478965ac50eb5082520380d1b',
|
||||
|
||||
@@ -60,6 +61,8 @@ vars = {
|
||||
True,
|
||||
'checkout_oculus_sdk':
|
||||
False,
|
||||
'checkout_openxr':
|
||||
False,
|
||||
'build_with_chromium':
|
||||
True,
|
||||
'checkout_android':
|
||||
@@ -111,7 +114,7 @@ hooks = [
|
||||
'pattern': 'src/electron/script/update-external-binaries.py',
|
||||
'condition': 'download_external_binaries',
|
||||
'action': [
|
||||
'python',
|
||||
'python3',
|
||||
'src/electron/script/update-external-binaries.py',
|
||||
],
|
||||
},
|
||||
@@ -149,3 +152,5 @@ hooks = [
|
||||
recursedeps = [
|
||||
'src',
|
||||
]
|
||||
|
||||
# Touch DEPS to bust cache
|
||||
|
||||
@@ -1 +1 @@
|
||||
7.0.0-nightly.20190731
|
||||
8.5.3
|
||||
12
README.md
12
README.md
@@ -58,13 +58,13 @@ npm start
|
||||
|
||||
## Resources for learning Electron
|
||||
|
||||
- [electronjs.org/docs](https://electronjs.org/docs) - all of Electron's documentation
|
||||
- [electronjs.org/docs](https://electronjs.org/docs) - All of Electron's documentation
|
||||
- [electron/fiddle](https://github.com/electron/fiddle) - A tool to build, run, and package small Electron experiments
|
||||
- [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - a very basic starter Electron app
|
||||
- [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - sample starter apps created by the community
|
||||
- [electron/simple-samples](https://github.com/electron/simple-samples) - small applications with ideas for taking them further
|
||||
- [electron/electron-api-demos](https://github.com/electron/electron-api-demos) - an Electron app that teaches you how to use Electron
|
||||
- [hokein/electron-sample-apps](https://github.com/hokein/electron-sample-apps) - small demo apps for the various Electron APIs
|
||||
- [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - A very basic starter Electron app
|
||||
- [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - Sample starter apps created by the community
|
||||
- [electron/simple-samples](https://github.com/electron/simple-samples) - Small applications with ideas for taking them further
|
||||
- [electron/electron-api-demos](https://github.com/electron/electron-api-demos) - An Electron app that teaches you how to use Electron
|
||||
- [hokein/electron-sample-apps](https://github.com/hokein/electron-sample-apps) - Small demo apps for the various Electron APIs
|
||||
|
||||
## Programmatic usage
|
||||
|
||||
|
||||
64
appveyor.yml
64
appveyor.yml
@@ -29,7 +29,7 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: libcc-20
|
||||
image: vs2017-15.9-10.0.18362
|
||||
image: vs2019-16.3-10.0.18362
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
@@ -50,6 +50,14 @@ build_script:
|
||||
- ps: >-
|
||||
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
|
||||
Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
|
||||
} else {
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
|
||||
$result = node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
|
||||
Write-Output $result
|
||||
if ($result.ExitCode -eq 0) {
|
||||
Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
|
||||
}
|
||||
}
|
||||
- echo "Building $env:GN_CONFIG build"
|
||||
- git config --global core.longpaths true
|
||||
@@ -60,7 +68,7 @@ build_script:
|
||||
- ps: $env:SCCACHE_PATH="$pwd\src\electron\external_binaries\sccache.exe"
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
$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_boto=True --custom-var=checkout_requests=True"
|
||||
} else {
|
||||
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
|
||||
}
|
||||
@@ -70,25 +78,58 @@ build_script:
|
||||
--unmanaged
|
||||
%GCLIENT_EXTRA_ARGS%
|
||||
"https://github.com/electron/electron"
|
||||
- gclient sync --with_branch_heads --with_tags --reset
|
||||
- gclient sync --with_branch_heads --with_tags --ignore_locks --break_repo_locks
|
||||
- ps: >-
|
||||
if ($env:SAVE_GCLIENT_SRC -eq 'true') {
|
||||
# archive current source for future use
|
||||
# only run on x64/woa to avoid contention saving
|
||||
if ($(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\WebKit\LayoutTests! -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30;$LASTEXITCODE -ne 0)) {
|
||||
Write-warning "Could not save source to shared drive; continuing anyway"
|
||||
}
|
||||
}
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -ne 'release') {
|
||||
if (Test-Path 'env:RAW_GOMA_AUTH') {
|
||||
$env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
|
||||
$env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
|
||||
}
|
||||
git clone https://github.com/electron/build-tools.git
|
||||
cd build-tools
|
||||
npm install
|
||||
mkdir third_party
|
||||
node -e "require('./src/utils/goma.js').downloadAndPrepare()"
|
||||
$env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
|
||||
$env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
|
||||
cd ..
|
||||
.\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
|
||||
}
|
||||
- cd src
|
||||
- ps: $env:BUILD_CONFIG_PATH="//electron/build/args/%GN_CONFIG%.gn"
|
||||
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") %GN_EXTRA_ARGS%"
|
||||
- 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 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
|
||||
- ninja -C out/Default electron:electron_app
|
||||
- if "%GN_CONFIG%"=="testing" ( python C:\Users\electron\depot_tools\post_build_ninja_summary.py -C out\Default )
|
||||
- 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:\Users\electron\depot_tools\post_build_ninja_summary.py -C out\Default )
|
||||
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
|
||||
- ninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
||||
- ninja -C out/Default electron:electron_dist_zip
|
||||
- ninja -C out/Default shell_browser_ui_unittests
|
||||
- ninja -C out/Default electron:electron_mksnapshot_zip
|
||||
- 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 )
|
||||
- appveyor PushArtifact out/Default/dist.zip
|
||||
- appveyor PushArtifact out/Default/shell_browser_ui_unittests.exe
|
||||
- appveyor PushArtifact out/Default/chromedriver.zip
|
||||
- appveyor PushArtifact out/ffmpeg/ffmpeg.zip
|
||||
- 7z a node_headers.zip out\Default\gen\node_headers
|
||||
- appveyor PushArtifact node_headers.zip
|
||||
- appveyor PushArtifact out/Default/mksnapshot.zip
|
||||
- appveyor PushArtifact out/Default/hunspell_dictionaries.zip
|
||||
- appveyor PushArtifact out/Default/electron.lib
|
||||
- ps: >-
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
# Needed for msdia140.dll on 64-bit windows
|
||||
@@ -99,13 +140,18 @@ build_script:
|
||||
if ($env:GN_CONFIG -eq 'release') {
|
||||
python electron\script\zip-symbols.py
|
||||
appveyor PushArtifact out/Default/symbols.zip
|
||||
} else {
|
||||
# It's useful to have pdb files when debugging testing builds that are
|
||||
# built on CI.
|
||||
7z a pdb.zip out\Default\*.pdb
|
||||
appveyor PushArtifact pdb.zip
|
||||
}
|
||||
- python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
||||
test_script:
|
||||
# Workaround for https://github.com/appveyor/ci/issues/2420
|
||||
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
|
||||
- ps: >-
|
||||
if ((-Not (Test-Path Env:\ELECTRON_RELEASE)) -And ($env:GN_CONFIG -in "testing", "release")) {
|
||||
if ((-Not (Test-Path Env:\TEST_WOA)) -And (-Not (Test-Path Env:\ELECTRON_RELEASE)) -And ($env:GN_CONFIG -in "testing", "release")) {
|
||||
$env:RUN_TESTS="true"
|
||||
}
|
||||
- ps: >-
|
||||
@@ -133,4 +179,6 @@ deploy_script:
|
||||
Write-Output "Uploading Electron release distribution to github releases"
|
||||
& python script\release\uploaders\upload.py
|
||||
}
|
||||
} elseif (Test-Path Env:\TEST_WOA) {
|
||||
node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
|
||||
}
|
||||
|
||||
93
azure-pipelines-woa.yml
Normal file
93
azure-pipelines-woa.yml
Normal file
@@ -0,0 +1,93 @@
|
||||
steps:
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy Files to: src\electron'
|
||||
inputs:
|
||||
TargetFolder: src\electron
|
||||
|
||||
- script: |
|
||||
cd src\electron
|
||||
node script/yarn.js install --frozen-lockfile
|
||||
displayName: 'Yarn install'
|
||||
|
||||
- powershell: |
|
||||
$localArtifactPath = "$pwd\dist.zip"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/dist.zip"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\Default -y $localArtifactPath
|
||||
displayName: 'Download and extract dist.zip for test'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
$localArtifactPath = "$pwd\src\out\Default\shell_browser_ui_unittests.exe"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/shell_browser_ui_unittests.exe"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
displayName: 'Download and extract native test executables for test'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
$localArtifactPath = "$pwd\ffmpeg.zip"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/ffmpeg.zip"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\ffmpeg $localArtifactPath
|
||||
displayName: 'Download and extract ffmpeg.zip for test'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
$localArtifactPath = "$pwd\src\node_headers.zip"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/node_headers.zip"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
cd src
|
||||
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y node_headers.zip
|
||||
displayName: 'Download node headers for test'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
$localArtifactPath = "$pwd\src\out\Default\electron.lib"
|
||||
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/electron.lib"
|
||||
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
|
||||
displayName: 'Download electron.lib for test'
|
||||
env:
|
||||
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
|
||||
|
||||
- powershell: |
|
||||
New-Item src\out\Default\gen\node_headers\Release -Type directory
|
||||
Copy-Item -path src\out\Default\electron.lib -destination src\out\Default\gen\node_headers\Release\node.lib
|
||||
displayName: 'Setup node headers'
|
||||
|
||||
- script: |
|
||||
cd src
|
||||
set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
||||
set npm_config_arch=arm64
|
||||
cd electron
|
||||
node script/yarn test -- --ci --enable-logging --verbose
|
||||
displayName: 'Run Electron tests'
|
||||
env:
|
||||
ELECTRON_OUT_DIR: Default
|
||||
IGNORE_YARN_INSTALL_ERROR: 1
|
||||
ELECTRON_TEST_RESULTS_DIR: junit
|
||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: 'Publish Test Results'
|
||||
inputs:
|
||||
testResultsFiles: '*.xml'
|
||||
searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/'
|
||||
condition: always()
|
||||
|
||||
- script: |
|
||||
cd src
|
||||
echo "Verifying non proprietary ffmpeg"
|
||||
python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
||||
displayName: 'Verify ffmpeg'
|
||||
|
||||
- powershell: |
|
||||
Get-Process | Where Name –Like "electron*" | Stop-Process
|
||||
Get-Process | Where Name –Like "MicrosoftEdge*" | Stop-Process
|
||||
Get-Process | Where Name –Like "msedge*" | Stop-Process
|
||||
displayName: 'Kill processes left running from last test run'
|
||||
condition: always()
|
||||
@@ -1,14 +1,19 @@
|
||||
is_electron_build = true
|
||||
use_jumbo_build = true
|
||||
root_extra_deps = [ "//electron" ]
|
||||
|
||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
|
||||
node_module_version = 75
|
||||
node_module_version = 76
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_typed_array_max_size_in_heap = 0
|
||||
v8_embedder_string = "-electron.0"
|
||||
|
||||
# TODO: this breaks native modules. See e.g. https://www.github.com/nodejs/node/pull/30463
|
||||
# We can probably enable this as long as we make sure node native modules
|
||||
# also build with the relevant #defines (V8_COMPRESS_POINTERS etc.)
|
||||
v8_enable_pointer_compression = false
|
||||
v8_enable_31bit_smis_on_64bit_arch = false
|
||||
|
||||
# TODO: this breaks mksnapshot
|
||||
v8_enable_snapshot_native_code_counters = false
|
||||
|
||||
@@ -18,9 +23,8 @@ ffmpeg_branding = "Chrome"
|
||||
|
||||
enable_basic_printing = true
|
||||
angle_enable_vulkan_validation_layers = false
|
||||
dawn_enable_vulkan_validation_layers = false
|
||||
|
||||
is_cfi = false
|
||||
|
||||
# TODO: Remove this and update CI to contain 10.14 SDK once
|
||||
# crbug.com/986701 is fixed.
|
||||
mac_sdk_min = "10.13"
|
||||
enable_osr = true
|
||||
|
||||
@@ -5,4 +5,3 @@ is_debug = false
|
||||
is_component_build = false
|
||||
is_component_ffmpeg = false
|
||||
symbol_level = 1
|
||||
use_jumbo_build = true
|
||||
|
||||
98
build/rules.gni
Normal file
98
build/rules.gni
Normal file
@@ -0,0 +1,98 @@
|
||||
import("//build/config/mac/mac_sdk.gni")
|
||||
|
||||
# Template to compile .xib and .storyboard files.
|
||||
# (copied from src/build/config/ios/rules.gni)
|
||||
#
|
||||
# Arguments
|
||||
#
|
||||
# sources:
|
||||
# list of string, sources to compile
|
||||
#
|
||||
# ibtool_flags:
|
||||
# (optional) list of string, additional flags to pass to the ibtool
|
||||
template("compile_ib_files") {
|
||||
action_foreach(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
||||
assert(defined(invoker.sources),
|
||||
"sources must be specified for $target_name")
|
||||
assert(defined(invoker.output_extension),
|
||||
"output_extension must be specified for $target_name")
|
||||
|
||||
ibtool_flags = []
|
||||
if (defined(invoker.ibtool_flags)) {
|
||||
ibtool_flags = invoker.ibtool_flags
|
||||
}
|
||||
|
||||
_output_extension = invoker.output_extension
|
||||
|
||||
script = "//build/config/ios/compile_ib_files.py"
|
||||
sources = invoker.sources
|
||||
outputs = [
|
||||
"$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
|
||||
]
|
||||
args = [
|
||||
"--input",
|
||||
"{{source}}",
|
||||
"--output",
|
||||
rebase_path(
|
||||
"$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
|
||||
root_build_dir),
|
||||
]
|
||||
args += ibtool_flags
|
||||
}
|
||||
}
|
||||
|
||||
# Template is copied here from Chromium but was removed in
|
||||
# https://chromium-review.googlesource.com/c/chromium/src/+/1637981
|
||||
# Template to compile and package Mac XIB files as bundle data.
|
||||
# Arguments
|
||||
# sources:
|
||||
# list of string, sources to comiple
|
||||
# output_path:
|
||||
# (optional) string, the path to use for the outputs list in the
|
||||
# bundle_data step. If unspecified, defaults to bundle_resources_dir.
|
||||
template("mac_xib_bundle_data") {
|
||||
_target_name = target_name
|
||||
_compile_target_name = _target_name + "_compile_ibtool"
|
||||
|
||||
compile_ib_files(_compile_target_name) {
|
||||
forward_variables_from(invoker, [ "testonly" ])
|
||||
visibility = [ ":$_target_name" ]
|
||||
sources = invoker.sources
|
||||
output_extension = "nib"
|
||||
ibtool_flags = [
|
||||
"--minimum-deployment-target",
|
||||
mac_deployment_target,
|
||||
|
||||
# TODO(rsesek): Enable this once all the bots are on Xcode 7+.
|
||||
# "--target-device",
|
||||
# "mac",
|
||||
]
|
||||
}
|
||||
|
||||
bundle_data(_target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
||||
|
||||
public_deps = [
|
||||
":$_compile_target_name",
|
||||
]
|
||||
sources = get_target_outputs(":$_compile_target_name")
|
||||
|
||||
_output_path = "{{bundle_resources_dir}}"
|
||||
if (defined(invoker.output_path)) {
|
||||
_output_path = invoker.output_path
|
||||
}
|
||||
|
||||
outputs = [
|
||||
"$_output_path/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
|
||||
@@ -9,7 +10,9 @@ config.output = {
|
||||
filename: path.basename(outPath)
|
||||
}
|
||||
|
||||
webpack(config, (err, stats) => {
|
||||
const { wrapInitWithProfilingTimeout, wrapInitWithTryCatch, ...webpackConfig } = config;
|
||||
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
@@ -17,6 +20,26 @@ webpack(config, (err, stats) => {
|
||||
console.error(stats.toString('normal'))
|
||||
process.exit(1)
|
||||
} else {
|
||||
let contents = fs.readFileSync(outPath, 'utf8');
|
||||
if (wrapInitWithTryCatch) {
|
||||
contents = `try {
|
||||
${contents}
|
||||
} catch (err) {
|
||||
console.error('Electron ${webpackConfig.output.filename} script failed to run');
|
||||
console.error(err);
|
||||
}`;
|
||||
}
|
||||
if (wrapInitWithProfilingTimeout) {
|
||||
contents = `function ___electron_webpack_init__() {
|
||||
${contents}
|
||||
};
|
||||
if ((globalThis.process || binding.process).argv.includes("--profile-electron-init")) {
|
||||
setTimeout(___electron_webpack_init__, 0);
|
||||
} else {
|
||||
___electron_webpack_init__();
|
||||
}`;
|
||||
}
|
||||
fs.writeFileSync(outPath, contents)
|
||||
process.exit(0)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -24,7 +24,9 @@ module.exports = ({
|
||||
alwaysHasNode,
|
||||
loadElectronFromAlternateTarget,
|
||||
targetDeletesNodeGlobals,
|
||||
target
|
||||
target,
|
||||
wrapInitWithProfilingTimeout,
|
||||
wrapInitWithTryCatch
|
||||
}) => {
|
||||
let entry = path.resolve(electronRoot, 'lib', target, 'init.ts')
|
||||
if (!fs.existsSync(entry)) {
|
||||
@@ -39,10 +41,12 @@ module.exports = ({
|
||||
output: {
|
||||
filename: `${target}.bundle.js`
|
||||
},
|
||||
wrapInitWithProfilingTimeout,
|
||||
wrapInitWithTryCatch,
|
||||
resolve: {
|
||||
alias: {
|
||||
'@electron/internal': path.resolve(electronRoot, 'lib'),
|
||||
'electron': path.resolve(electronRoot, 'lib', loadElectronFromAlternateTarget || target, 'api', 'exports', 'electron.js'),
|
||||
'electron': path.resolve(electronRoot, 'lib', loadElectronFromAlternateTarget || target, 'api', 'exports', 'electron.ts'),
|
||||
// Force timers to resolve to our dependency that doens't use window.postMessage
|
||||
'timers': path.resolve(electronRoot, 'node_modules', 'timers-browserify', 'main.js')
|
||||
},
|
||||
@@ -74,7 +78,10 @@ module.exports = ({
|
||||
global: ['@electron/internal/renderer/webpack-provider', '_global'],
|
||||
Buffer: ['@electron/internal/renderer/webpack-provider', 'Buffer'],
|
||||
})
|
||||
] : [])
|
||||
] : []),
|
||||
new webpack.ProvidePlugin({
|
||||
Promise: ['@electron/internal/common/webpack-globals-provider', 'Promise'],
|
||||
}),
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'isolated_renderer',
|
||||
alwaysHasNode: false
|
||||
alwaysHasNode: false,
|
||||
wrapInitWithTryCatch: true
|
||||
})
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'renderer',
|
||||
alwaysHasNode: true,
|
||||
targetDeletesNodeGlobals: true
|
||||
targetDeletesNodeGlobals: true,
|
||||
wrapInitWithProfilingTimeout: true,
|
||||
wrapInitWithTryCatch: true
|
||||
})
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
module.exports = require('./webpack.config.base')({
|
||||
target: 'sandboxed_renderer',
|
||||
alwaysHasNode: false
|
||||
alwaysHasNode: false,
|
||||
wrapInitWithProfilingTimeout: true,
|
||||
wrapInitWithTryCatch: true
|
||||
})
|
||||
|
||||
@@ -2,5 +2,6 @@ module.exports = require('./webpack.config.base')({
|
||||
target: 'worker',
|
||||
loadElectronFromAlternateTarget: 'renderer',
|
||||
alwaysHasNode: true,
|
||||
targetDeletesNodeGlobals: true
|
||||
targetDeletesNodeGlobals: true,
|
||||
wrapInitWithTryCatch: true
|
||||
})
|
||||
|
||||
@@ -16,6 +16,7 @@ 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",
|
||||
|
||||
16
build/zip.py
16
build/zip.py
@@ -16,6 +16,10 @@ PATHS_TO_SKIP = [
|
||||
'./libVkICD_mock_', #Skipping because these are outputs that we don't need
|
||||
'./VkICD_mock_', #Skipping because these are outputs that we don't need
|
||||
|
||||
# Skipping because its an output of create_bundle from //build/config/mac/rules.gni
|
||||
# that we don't need
|
||||
'Electron.dSYM',
|
||||
|
||||
# //chrome/browser:resources depends on this via
|
||||
# //chrome/browser/resources/ssl/ssl_error_assistant, but we don't need to
|
||||
# ship it.
|
||||
@@ -46,19 +50,19 @@ def execute(argv):
|
||||
raise e
|
||||
|
||||
def main(argv):
|
||||
dist_zip, runtime_deps, target_cpu, target_os = argv
|
||||
dist_zip, runtime_deps, target_cpu, target_os, flatten_val = argv
|
||||
should_flatten = flatten_val == "true"
|
||||
dist_files = set()
|
||||
with open(runtime_deps) as f:
|
||||
for dep in f.readlines():
|
||||
dep = dep.strip()
|
||||
dist_files.add(dep)
|
||||
if sys.platform == 'darwin':
|
||||
if not skip_path(dep, dist_zip, target_cpu):
|
||||
dist_files.add(dep)
|
||||
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:
|
||||
for dep in dist_files:
|
||||
if skip_path(dep, dist_zip, target_cpu):
|
||||
continue
|
||||
if os.path.isdir(dep):
|
||||
for root, dirs, files in os.walk(dep):
|
||||
for file in files:
|
||||
@@ -67,7 +71,7 @@ def main(argv):
|
||||
basename = os.path.basename(dep)
|
||||
dirname = os.path.dirname(dep)
|
||||
arcname = os.path.join(dirname, 'chrome-sandbox') if basename == 'chrome_sandbox' else dep
|
||||
z.write(dep, arcname)
|
||||
z.write(dep, os.path.basename(arcname) if should_flatten else arcname)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
|
||||
@@ -12,12 +12,15 @@ buildflag_header("buildflags") {
|
||||
"ENABLE_DESKTOP_CAPTURER=$enable_desktop_capturer",
|
||||
"ENABLE_RUN_AS_NODE=$enable_run_as_node",
|
||||
"ENABLE_OSR=$enable_osr",
|
||||
"ENABLE_REMOTE_MODULE=$enable_remote_module",
|
||||
"ENABLE_VIEW_API=$enable_view_api",
|
||||
"ENABLE_PEPPER_FLASH=$enable_pepper_flash",
|
||||
"ENABLE_PDF_VIEWER=$enable_pdf_viewer",
|
||||
"ENABLE_TTS=$enable_tts",
|
||||
"ENABLE_COLOR_CHOOSER=$enable_color_chooser",
|
||||
"ENABLE_ELECTRON_EXTENSIONS=$enable_electron_extensions",
|
||||
"ENABLE_BUILTIN_SPELLCHECKER=$enable_builtin_spellchecker",
|
||||
"ENABLE_PICTURE_IN_PICTURE=$enable_picture_in_picture",
|
||||
"OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ declare_args() {
|
||||
|
||||
enable_osr = true
|
||||
|
||||
enable_remote_module = true
|
||||
|
||||
enable_view_api = false
|
||||
|
||||
enable_pdf_viewer = false
|
||||
@@ -18,6 +20,8 @@ declare_args() {
|
||||
|
||||
enable_color_chooser = true
|
||||
|
||||
enable_picture_in_picture = true
|
||||
|
||||
# Provide a fake location provider for mocking
|
||||
# the geolocation responses. Disable it if you
|
||||
# need to test with chromium's location provider.
|
||||
@@ -29,4 +33,7 @@ declare_args() {
|
||||
|
||||
# Enable Chrome extensions support.
|
||||
enable_electron_extensions = false
|
||||
|
||||
# Enable Spellchecker support
|
||||
enable_builtin_spellchecker = true
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/ui.gni")
|
||||
import("//components/spellcheck/spellcheck_build_features.gni")
|
||||
import("//electron/buildflags/buildflags.gni")
|
||||
import("//printing/buildflags/buildflags.gni")
|
||||
import("//third_party/widevine/cdm/widevine.gni")
|
||||
@@ -31,14 +32,25 @@ static_library("chrome") {
|
||||
"//chrome/browser/icon_loader_win.cc",
|
||||
"//chrome/browser/icon_manager.cc",
|
||||
"//chrome/browser/icon_manager.h",
|
||||
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
|
||||
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
|
||||
"//chrome/browser/net/chrome_mojo_proxy_resolver_factory.cc",
|
||||
"//chrome/browser/net/chrome_mojo_proxy_resolver_factory.h",
|
||||
"//chrome/browser/net/proxy_config_monitor.cc",
|
||||
"//chrome/browser/net/proxy_config_monitor.h",
|
||||
"//chrome/browser/net/proxy_service_factory.cc",
|
||||
"//chrome/browser/net/proxy_service_factory.h",
|
||||
"//chrome/browser/predictors/preconnect_manager.cc",
|
||||
"//chrome/browser/predictors/preconnect_manager.h",
|
||||
"//chrome/browser/predictors/predictors_features.cc",
|
||||
"//chrome/browser/predictors/predictors_features.h",
|
||||
"//chrome/browser/predictors/proxy_lookup_client_impl.cc",
|
||||
"//chrome/browser/predictors/proxy_lookup_client_impl.h",
|
||||
"//chrome/browser/predictors/resolve_host_client_impl.cc",
|
||||
"//chrome/browser/predictors/resolve_host_client_impl.h",
|
||||
"//chrome/browser/ssl/security_state_tab_helper.cc",
|
||||
"//chrome/browser/ssl/security_state_tab_helper.h",
|
||||
"//chrome/browser/ssl/tls_deprecation_config.cc",
|
||||
"//chrome/browser/ui/autofill/popup_view_common.cc",
|
||||
"//chrome/browser/ui/autofill/popup_view_common.h",
|
||||
"//chrome/browser/win/chrome_process_finder.cc",
|
||||
@@ -55,6 +67,7 @@ static_library("chrome") {
|
||||
"//content/public/browser",
|
||||
]
|
||||
deps = [
|
||||
"//chrome/browser:resource_prefetch_predictor_proto",
|
||||
"//components/feature_engagement:buildflags",
|
||||
]
|
||||
|
||||
@@ -63,6 +76,14 @@ static_library("chrome") {
|
||||
sources += [
|
||||
"//chrome/browser/extensions/global_shortcut_listener_x11.cc",
|
||||
"//chrome/browser/extensions/global_shortcut_listener_x11.h",
|
||||
"//chrome/browser/ui/views/status_icons/concat_menu_model.cc",
|
||||
"//chrome/browser/ui/views/status_icons/concat_menu_model.h",
|
||||
"//chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc",
|
||||
"//chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h",
|
||||
]
|
||||
public_deps += [
|
||||
"//components/dbus/menu",
|
||||
"//components/dbus/thread_linux",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -126,10 +147,6 @@ static_library("chrome") {
|
||||
sources += [
|
||||
"//chrome/browser/speech/tts_controller_delegate_impl.cc",
|
||||
"//chrome/browser/speech/tts_controller_delegate_impl.h",
|
||||
"//chrome/browser/speech/tts_message_filter.cc",
|
||||
"//chrome/browser/speech/tts_message_filter.h",
|
||||
"//chrome/renderer/tts_dispatcher.cc",
|
||||
"//chrome/renderer/tts_dispatcher.h",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -159,17 +176,21 @@ static_library("chrome") {
|
||||
"//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",
|
||||
]
|
||||
|
||||
public_deps += [
|
||||
"//chrome/services/printing:lib",
|
||||
"//components/printing/browser",
|
||||
"//components/printing/renderer",
|
||||
"//components/services/pdf_compositor/public/cpp:factory",
|
||||
"//components/services/pdf_compositor",
|
||||
"//components/services/pdf_compositor/public/cpp",
|
||||
"//components/services/pdf_compositor/public/mojom",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//components/printing/common",
|
||||
"//components/services/pdf_compositor",
|
||||
"//printing",
|
||||
]
|
||||
|
||||
@@ -182,4 +203,85 @@ static_library("chrome") {
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (enable_picture_in_picture) {
|
||||
sources += [
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc",
|
||||
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/back_to_tab_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/close_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_views.cc",
|
||||
"//chrome/browser/ui/views/overlay/overlay_window_views.h",
|
||||
"//chrome/browser/ui/views/overlay/playback_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/playback_image_button.h",
|
||||
"//chrome/browser/ui/views/overlay/resize_handle_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/resize_handle_button.h",
|
||||
"//chrome/browser/ui/views/overlay/skip_ad_label_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/skip_ad_label_button.h",
|
||||
"//chrome/browser/ui/views/overlay/track_image_button.cc",
|
||||
"//chrome/browser/ui/views/overlay/track_image_button.h",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//chrome/app/vector_icons",
|
||||
"//components/vector_icons:vector_icons",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# This source set is just so we don't have to depend on all of //chrome/browser
|
||||
# You may have to add new files here during the upgrade if //chrome/browser/spellchecker
|
||||
# gets more files
|
||||
source_set("chrome_spellchecker") {
|
||||
sources = []
|
||||
deps = []
|
||||
libs = []
|
||||
|
||||
if (enable_builtin_spellchecker) {
|
||||
sources += [
|
||||
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.cc",
|
||||
"//chrome/browser/spellchecker/spell_check_host_chrome_impl.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_custom_dictionary.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_custom_dictionary.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_factory.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_factory.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_language_blacklist_policy_handler.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_language_policy_handler.h",
|
||||
"//chrome/browser/spellchecker/spellcheck_service.cc",
|
||||
"//chrome/browser/spellchecker/spellcheck_service.h",
|
||||
]
|
||||
|
||||
if (has_spellcheck_panel) {
|
||||
sources += [
|
||||
"//chrome/browser/spellchecker/spell_check_panel_host_impl.cc",
|
||||
"//chrome/browser/spellchecker/spell_check_panel_host_impl.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (use_browser_spellchecker) {
|
||||
sources += [
|
||||
"//chrome/browser/spellchecker/spelling_request.cc",
|
||||
"//chrome/browser/spellchecker/spelling_request.h",
|
||||
]
|
||||
}
|
||||
|
||||
deps += [
|
||||
"//base:base_static",
|
||||
"//components/language/core/browser",
|
||||
"//components/spellcheck:buildflags",
|
||||
"//components/sync",
|
||||
]
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
"//components/spellcheck/browser",
|
||||
"//components/spellcheck/common",
|
||||
"//components/spellcheck/renderer",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -37,10 +37,8 @@ net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
|
||||
// public and private slot.
|
||||
// Redirect any slot usage to this persistent slot on Linux.
|
||||
g_nss_cert_database = new net::NSSCertDatabase(
|
||||
crypto::ScopedPK11Slot(
|
||||
crypto::GetPersistentNSSKeySlot()) /* public slot */,
|
||||
crypto::ScopedPK11Slot(
|
||||
crypto::GetPersistentNSSKeySlot()) /* private slot */);
|
||||
crypto::ScopedPK11Slot(PK11_GetInternalKeySlot()) /* public slot */,
|
||||
crypto::ScopedPK11Slot(PK11_GetInternalKeySlot()) /* private slot */);
|
||||
}
|
||||
return g_nss_cert_database;
|
||||
}
|
||||
@@ -73,7 +71,7 @@ net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
|
||||
void CertificateManagerModel::Create(content::BrowserContext* browser_context,
|
||||
const CreationCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&CertificateManagerModel::GetCertDBOnIOThread,
|
||||
browser_context->GetResourceContext(), callback));
|
||||
@@ -86,7 +84,7 @@ CertificateManagerModel::CertificateManagerModel(
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
}
|
||||
|
||||
CertificateManagerModel::~CertificateManagerModel() {}
|
||||
CertificateManagerModel::~CertificateManagerModel() = default;
|
||||
|
||||
int CertificateManagerModel::ImportFromPKCS12(
|
||||
PK11SlotInfo* slot_info,
|
||||
@@ -146,7 +144,7 @@ void CertificateManagerModel::DidGetCertDBOnIOThread(
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
|
||||
bool is_user_db_available = !!cert_db->GetPublicSlot();
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&CertificateManagerModel::DidGetCertDBOnUIThread, cert_db,
|
||||
is_user_db_available, callback));
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/common/atom_command_line.h"
|
||||
#include "shell/common/electron_command_line.h"
|
||||
|
||||
#include "base/base_paths.h"
|
||||
#include "base/bind.h"
|
||||
@@ -93,7 +93,6 @@
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "net/base/network_interfaces.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
||||
#if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
||||
#include "ui/views/linux_ui/linux_ui.h"
|
||||
@@ -185,7 +184,7 @@ int WaitSocketForRead(int fd, const base::TimeDelta& timeout) {
|
||||
FD_ZERO(&read_fds);
|
||||
FD_SET(fd, &read_fds);
|
||||
|
||||
return HANDLE_EINTR(select(fd + 1, &read_fds, NULL, NULL, &tv));
|
||||
return HANDLE_EINTR(select(fd + 1, &read_fds, nullptr, nullptr, &tv));
|
||||
}
|
||||
|
||||
// Read a message from a socket fd, with an optional timeout.
|
||||
@@ -705,7 +704,7 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK(
|
||||
if (shutdown(fd_, SHUT_WR) < 0)
|
||||
PLOG(ERROR) << "shutdown() failed";
|
||||
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&ProcessSingleton::LinuxWatcher::RemoveSocketReader,
|
||||
parent_, this));
|
||||
@@ -827,7 +826,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
||||
return PROCESS_NONE;
|
||||
to_send.append(current_dir.value());
|
||||
|
||||
const std::vector<std::string>& argv = electron::AtomCommandLine::argv();
|
||||
const std::vector<std::string>& argv = electron::ElectronCommandLine::argv();
|
||||
for (std::vector<std::string>::const_iterator it = argv.begin();
|
||||
it != argv.end(); ++it) {
|
||||
to_send.push_back(kTokenDelimiter);
|
||||
@@ -885,10 +884,9 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() {
|
||||
|
||||
void ProcessSingleton::StartListeningOnSocket() {
|
||||
watcher_ = new LinuxWatcher(this);
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&ProcessSingleton::LinuxWatcher::StartListening, watcher_,
|
||||
sock_));
|
||||
base::PostTask(FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&ProcessSingleton::LinuxWatcher::StartListening,
|
||||
watcher_, sock_));
|
||||
}
|
||||
|
||||
void ProcessSingleton::OnBrowserReady() {
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "chrome/browser/win/chrome_process_finder.h"
|
||||
#include "content/public/common/result_codes.h"
|
||||
#include "net/base/escape.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/win/hwnd_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -54,6 +54,7 @@ component("pepper_flash") {
|
||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.h",
|
||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.mm",
|
||||
]
|
||||
libs = [ "CoreGraphics.framework" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
deps += [ "//components/services/font/public/cpp" ]
|
||||
|
||||
@@ -1,48 +1,50 @@
|
||||
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron'
|
||||
import * as path from 'path'
|
||||
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
|
||||
let mainWindow: BrowserWindow | null = null
|
||||
let mainWindow: BrowserWindow | null = null;
|
||||
|
||||
app.allowRendererProcessReuse = true;
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', () => {
|
||||
app.quit()
|
||||
})
|
||||
app.quit();
|
||||
});
|
||||
|
||||
function decorateURL (url: string) {
|
||||
// safely add `?utm_source=default_app
|
||||
const parsedUrl = new URL(url)
|
||||
parsedUrl.searchParams.append('utm_source', 'default_app')
|
||||
return parsedUrl.toString()
|
||||
const parsedUrl = new URL(url);
|
||||
parsedUrl.searchParams.append('utm_source', 'default_app');
|
||||
return parsedUrl.toString();
|
||||
}
|
||||
|
||||
// Find the shortest path to the electron binary
|
||||
const absoluteElectronPath = process.execPath
|
||||
const relativeElectronPath = path.relative(process.cwd(), absoluteElectronPath)
|
||||
const absoluteElectronPath = process.execPath;
|
||||
const relativeElectronPath = path.relative(process.cwd(), absoluteElectronPath);
|
||||
const electronPath = absoluteElectronPath.length < relativeElectronPath.length
|
||||
? absoluteElectronPath
|
||||
: relativeElectronPath
|
||||
: relativeElectronPath;
|
||||
|
||||
const indexPath = path.resolve(app.getAppPath(), 'index.html')
|
||||
const indexPath = path.resolve(app.getAppPath(), 'index.html');
|
||||
|
||||
function isTrustedSender (webContents: Electron.WebContents) {
|
||||
if (webContents !== (mainWindow && mainWindow.webContents)) {
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
|
||||
const parsedUrl = new URL(webContents.getURL())
|
||||
const urlPath = process.platform === 'win32'
|
||||
// Strip the prefixed "/" that occurs on windows
|
||||
? path.resolve(parsedUrl.pathname.substr(1))
|
||||
: parsedUrl.pathname
|
||||
return parsedUrl.protocol === 'file:' && urlPath === indexPath
|
||||
try {
|
||||
return url.fileURLToPath(webContents.getURL()) === indexPath;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ipcMain.handle('bootstrap', (event) => {
|
||||
return isTrustedSender(event.sender) ? electronPath : null
|
||||
})
|
||||
return isTrustedSender(event.sender) ? electronPath : null;
|
||||
});
|
||||
|
||||
async function createWindow () {
|
||||
await app.whenReady()
|
||||
await app.whenReady();
|
||||
|
||||
const options: Electron.BrowserWindowConstructorOptions = {
|
||||
width: 900,
|
||||
@@ -57,46 +59,46 @@ async function createWindow () {
|
||||
},
|
||||
useContentSize: true,
|
||||
show: false
|
||||
}
|
||||
};
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
options.icon = path.join(__dirname, 'icon.png')
|
||||
options.icon = path.join(__dirname, 'icon.png');
|
||||
}
|
||||
|
||||
mainWindow = new BrowserWindow(options)
|
||||
mainWindow.on('ready-to-show', () => mainWindow!.show())
|
||||
mainWindow = new BrowserWindow(options);
|
||||
mainWindow.on('ready-to-show', () => mainWindow!.show());
|
||||
|
||||
mainWindow.webContents.on('new-window', (event, url) => {
|
||||
event.preventDefault()
|
||||
shell.openExternal(decorateURL(url))
|
||||
})
|
||||
event.preventDefault();
|
||||
shell.openExternal(decorateURL(url));
|
||||
});
|
||||
|
||||
mainWindow.webContents.session.setPermissionRequestHandler((webContents, permission, done) => {
|
||||
const parsedUrl = new URL(webContents.getURL())
|
||||
const parsedUrl = new URL(webContents.getURL());
|
||||
|
||||
const options: Electron.MessageBoxOptions = {
|
||||
title: 'Permission Request',
|
||||
message: `Allow '${parsedUrl.origin}' to access '${permission}'?`,
|
||||
buttons: ['OK', 'Cancel'],
|
||||
cancelId: 1
|
||||
}
|
||||
};
|
||||
|
||||
dialog.showMessageBox(mainWindow!, options).then(({ response }) => {
|
||||
done(response === 0)
|
||||
})
|
||||
})
|
||||
done(response === 0);
|
||||
});
|
||||
});
|
||||
|
||||
return mainWindow
|
||||
return mainWindow;
|
||||
}
|
||||
|
||||
export const loadURL = async (appUrl: string) => {
|
||||
mainWindow = await createWindow()
|
||||
mainWindow.loadURL(appUrl)
|
||||
mainWindow.focus()
|
||||
}
|
||||
mainWindow = await createWindow();
|
||||
mainWindow.loadURL(appUrl);
|
||||
mainWindow.focus();
|
||||
};
|
||||
|
||||
export const loadFile = async (appPath: string) => {
|
||||
mainWindow = await createWindow()
|
||||
mainWindow.loadFile(appPath)
|
||||
mainWindow.focus()
|
||||
}
|
||||
mainWindow = await createWindow();
|
||||
mainWindow.loadFile(appPath);
|
||||
mainWindow.focus();
|
||||
};
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
<head>
|
||||
<title>Electron</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self'; connect-src 'self'" />
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-6PH54BfkNq/EMMhUY7nhHf3c+AxloOwfy7hWyT01CM8='; style-src 'self'; img-src 'self'; connect-src 'self'" />
|
||||
<link href="./styles.css" type="text/css" rel="stylesheet" />
|
||||
<link href="./octicon/build.css" type="text/css" rel="stylesheet" />
|
||||
<script defer src="./index.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -84,6 +83,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<script>
|
||||
window.electronDefaultApp.initialize()
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,30 +0,0 @@
|
||||
async function getOcticonSvg (name: string) {
|
||||
try {
|
||||
const response = await fetch(`octicon/${name}.svg`)
|
||||
const div = document.createElement('div')
|
||||
div.innerHTML = await response.text()
|
||||
return div
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSVG (element: HTMLSpanElement) {
|
||||
for (const cssClass of element.classList) {
|
||||
if (cssClass.startsWith('octicon-')) {
|
||||
const icon = await getOcticonSvg(cssClass.substr(8))
|
||||
if (icon) {
|
||||
for (const elemClass of element.classList) {
|
||||
icon.classList.add(elemClass)
|
||||
}
|
||||
element.before(icon)
|
||||
element.remove()
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const element of document.querySelectorAll<HTMLSpanElement>('.octicon')) {
|
||||
loadSVG(element)
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import { app, dialog } from 'electron'
|
||||
import { app, dialog } from 'electron';
|
||||
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import * as url from 'url'
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
|
||||
type DefaultAppOptions = {
|
||||
file: null | string;
|
||||
@@ -14,10 +14,10 @@ type DefaultAppOptions = {
|
||||
modules: string[];
|
||||
}
|
||||
|
||||
const Module = require('module')
|
||||
const Module = require('module');
|
||||
|
||||
// Parse command line options.
|
||||
const argv = process.argv.slice(1)
|
||||
const argv = process.argv.slice(1);
|
||||
|
||||
const option: DefaultAppOptions = {
|
||||
file: null,
|
||||
@@ -27,50 +27,50 @@ const option: DefaultAppOptions = {
|
||||
interactive: false,
|
||||
abi: false,
|
||||
modules: []
|
||||
}
|
||||
};
|
||||
|
||||
let nextArgIsRequire = false
|
||||
let nextArgIsRequire = false;
|
||||
|
||||
for (const arg of argv) {
|
||||
if (nextArgIsRequire) {
|
||||
option.modules.push(arg)
|
||||
nextArgIsRequire = false
|
||||
continue
|
||||
option.modules.push(arg);
|
||||
nextArgIsRequire = false;
|
||||
continue;
|
||||
} else if (arg === '--version' || arg === '-v') {
|
||||
option.version = true
|
||||
break
|
||||
option.version = true;
|
||||
break;
|
||||
} else if (arg.match(/^--app=/)) {
|
||||
option.file = arg.split('=')[1]
|
||||
break
|
||||
option.file = arg.split('=')[1];
|
||||
break;
|
||||
} else if (arg === '--interactive' || arg === '-i' || arg === '-repl') {
|
||||
option.interactive = true
|
||||
option.interactive = true;
|
||||
} else if (arg === '--test-type=webdriver') {
|
||||
option.webdriver = true
|
||||
option.webdriver = true;
|
||||
} else if (arg === '--require' || arg === '-r') {
|
||||
nextArgIsRequire = true
|
||||
continue
|
||||
nextArgIsRequire = true;
|
||||
continue;
|
||||
} else if (arg === '--abi' || arg === '-a') {
|
||||
option.abi = true
|
||||
continue
|
||||
option.abi = true;
|
||||
continue;
|
||||
} else if (arg === '--no-help') {
|
||||
option.noHelp = true
|
||||
continue
|
||||
option.noHelp = true;
|
||||
continue;
|
||||
} else if (arg[0] === '-') {
|
||||
continue
|
||||
continue;
|
||||
} else {
|
||||
option.file = arg
|
||||
break
|
||||
option.file = arg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextArgIsRequire) {
|
||||
console.error('Invalid Usage: --require [file]\n\n"file" is required')
|
||||
process.exit(1)
|
||||
console.error('Invalid Usage: --require [file]\n\n"file" is required');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Set up preload modules
|
||||
if (option.modules.length > 0) {
|
||||
Module._preloadModules(option.modules)
|
||||
Module._preloadModules(option.modules);
|
||||
}
|
||||
|
||||
function loadApplicationPackage (packagePath: string) {
|
||||
@@ -79,102 +79,102 @@ function loadApplicationPackage (packagePath: string) {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
value: true
|
||||
})
|
||||
});
|
||||
|
||||
try {
|
||||
// Override app name and version.
|
||||
packagePath = path.resolve(packagePath)
|
||||
const packageJsonPath = path.join(packagePath, 'package.json')
|
||||
let appPath
|
||||
packagePath = path.resolve(packagePath);
|
||||
const packageJsonPath = path.join(packagePath, 'package.json');
|
||||
let appPath;
|
||||
if (fs.existsSync(packageJsonPath)) {
|
||||
let packageJson
|
||||
let packageJson;
|
||||
try {
|
||||
packageJson = require(packageJsonPath)
|
||||
packageJson = require(packageJsonPath);
|
||||
} catch (e) {
|
||||
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${e.message}`)
|
||||
return
|
||||
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${e.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packageJson.version) {
|
||||
app.setVersion(packageJson.version)
|
||||
app.setVersion(packageJson.version);
|
||||
}
|
||||
if (packageJson.productName) {
|
||||
app.name = packageJson.productName
|
||||
app.name = packageJson.productName;
|
||||
} else if (packageJson.name) {
|
||||
app.name = packageJson.name
|
||||
app.name = packageJson.name;
|
||||
}
|
||||
appPath = packagePath
|
||||
appPath = packagePath;
|
||||
}
|
||||
|
||||
try {
|
||||
const filePath = Module._resolveFilename(packagePath, module, true)
|
||||
app._setDefaultAppPaths(appPath || path.dirname(filePath))
|
||||
const filePath = Module._resolveFilename(packagePath, module, true);
|
||||
app._setDefaultAppPaths(appPath || path.dirname(filePath));
|
||||
} catch (e) {
|
||||
showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${e.message}`)
|
||||
return
|
||||
showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${e.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Run the app.
|
||||
Module._load(packagePath, module, true)
|
||||
Module._load(packagePath, module, true);
|
||||
} catch (e) {
|
||||
console.error('App threw an error during load')
|
||||
console.error(e.stack || e)
|
||||
throw e
|
||||
console.error('App threw an error during load');
|
||||
console.error(e.stack || e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
function showErrorMessage (message: string) {
|
||||
app.focus()
|
||||
dialog.showErrorBox('Error launching app', message)
|
||||
process.exit(1)
|
||||
app.focus();
|
||||
dialog.showErrorBox('Error launching app', message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
async function loadApplicationByURL (appUrl: string) {
|
||||
const { loadURL } = await import('./default_app')
|
||||
loadURL(appUrl)
|
||||
const { loadURL } = await import('./default_app');
|
||||
loadURL(appUrl);
|
||||
}
|
||||
|
||||
async function loadApplicationByFile (appPath: string) {
|
||||
const { loadFile } = await import('./default_app')
|
||||
loadFile(appPath)
|
||||
const { loadFile } = await import('./default_app');
|
||||
loadFile(appPath);
|
||||
}
|
||||
|
||||
function startRepl () {
|
||||
if (process.platform === 'win32') {
|
||||
console.error('Electron REPL not currently supported on Windows')
|
||||
process.exit(1)
|
||||
console.error('Electron REPL not currently supported on Windows');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// prevent quitting
|
||||
app.on('window-all-closed', () => {})
|
||||
app.on('window-all-closed', () => {});
|
||||
|
||||
const repl = require('repl')
|
||||
const repl = require('repl');
|
||||
repl.start('> ').on('exit', () => {
|
||||
process.exit(0)
|
||||
})
|
||||
process.exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
// Start the specified app if there is one specified in command line, otherwise
|
||||
// start the default app.
|
||||
if (option.file && !option.webdriver) {
|
||||
const file = option.file
|
||||
const protocol = url.parse(file).protocol
|
||||
const extension = path.extname(file)
|
||||
const file = option.file;
|
||||
const protocol = url.parse(file).protocol;
|
||||
const extension = path.extname(file);
|
||||
if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') {
|
||||
loadApplicationByURL(file)
|
||||
loadApplicationByURL(file);
|
||||
} else if (extension === '.html' || extension === '.htm') {
|
||||
loadApplicationByFile(path.resolve(file))
|
||||
loadApplicationByFile(path.resolve(file));
|
||||
} else {
|
||||
loadApplicationPackage(file)
|
||||
loadApplicationPackage(file);
|
||||
}
|
||||
} else if (option.version) {
|
||||
console.log('v' + process.versions.electron)
|
||||
process.exit(0)
|
||||
console.log('v' + process.versions.electron);
|
||||
process.exit(0);
|
||||
} else if (option.abi) {
|
||||
console.log(process.versions.modules)
|
||||
process.exit(0)
|
||||
console.log(process.versions.modules);
|
||||
process.exit(0);
|
||||
} else if (option.interactive) {
|
||||
startRepl()
|
||||
startRepl();
|
||||
} else {
|
||||
if (!option.noHelp) {
|
||||
const welcomeMessage = `
|
||||
@@ -192,10 +192,10 @@ Options:
|
||||
-i, --interactive Open a REPL to the main process.
|
||||
-r, --require Module to preload (option can be repeated).
|
||||
-v, --version Print the version.
|
||||
-a, --abi Print the Node ABI version.`
|
||||
-a, --abi Print the Node ABI version.`;
|
||||
|
||||
console.log(welcomeMessage)
|
||||
console.log(welcomeMessage);
|
||||
}
|
||||
|
||||
loadApplicationByFile('index.html')
|
||||
loadApplicationByFile('index.html');
|
||||
}
|
||||
|
||||
@@ -1,20 +1,53 @@
|
||||
import { ipcRenderer } from 'electron'
|
||||
import { ipcRenderer, contextBridge } from 'electron';
|
||||
|
||||
async function getOcticonSvg (name: string) {
|
||||
try {
|
||||
const response = await fetch(`octicon/${name}.svg`);
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = await response.text();
|
||||
return div;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSVG (element: HTMLSpanElement) {
|
||||
for (const cssClass of element.classList) {
|
||||
if (cssClass.startsWith('octicon-')) {
|
||||
const icon = await getOcticonSvg(cssClass.substr(8));
|
||||
if (icon) {
|
||||
for (const elemClass of element.classList) {
|
||||
icon.classList.add(elemClass);
|
||||
}
|
||||
element.before(icon);
|
||||
element.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function initialize () {
|
||||
const electronPath = await ipcRenderer.invoke('bootstrap')
|
||||
const electronPath = await ipcRenderer.invoke('bootstrap');
|
||||
|
||||
function replaceText (selector: string, text: string) {
|
||||
const element = document.querySelector<HTMLElement>(selector)
|
||||
const element = document.querySelector<HTMLElement>(selector);
|
||||
if (element) {
|
||||
element.innerText = text
|
||||
element.innerText = text;
|
||||
}
|
||||
}
|
||||
|
||||
replaceText('.electron-version', `Electron v${process.versions.electron}`)
|
||||
replaceText('.chrome-version', `Chromium v${process.versions.chrome}`)
|
||||
replaceText('.node-version', `Node v${process.versions.node}`)
|
||||
replaceText('.v8-version', `v8 v${process.versions.v8}`)
|
||||
replaceText('.command-example', `${electronPath} path-to-app`)
|
||||
replaceText('.electron-version', `Electron v${process.versions.electron}`);
|
||||
replaceText('.chrome-version', `Chromium v${process.versions.chrome}`);
|
||||
replaceText('.node-version', `Node v${process.versions.node}`);
|
||||
replaceText('.v8-version', `v8 v${process.versions.v8}`);
|
||||
replaceText('.command-example', `${electronPath} path-to-app`);
|
||||
|
||||
for (const element of document.querySelectorAll<HTMLSpanElement>('.octicon')) {
|
||||
loadSVG(element);
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initialize)
|
||||
contextBridge.exposeInMainWorld('electronDefaultApp', {
|
||||
initialize
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ These individual tutorials expand on topics discussed in the guide above.
|
||||
|
||||
* [Synopsis](api/synopsis.md)
|
||||
* [Process Object](api/process.md)
|
||||
* [Supported Chrome Command Line Switches](api/chrome-command-line-switches.md)
|
||||
* [Supported Command Line Switches](api/command-line-switches.md)
|
||||
* [Environment Variables](api/environment-variables.md)
|
||||
* [Breaking API Changes](api/breaking-changes.md)
|
||||
|
||||
@@ -134,6 +134,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)
|
||||
* [Notification](api/notification.md)
|
||||
* [powerMonitor](api/power-monitor.md)
|
||||
* [powerSaveBlocker](api/power-save-blocker.md)
|
||||
* [protocol](api/protocol.md)
|
||||
|
||||
145
docs/api/app.md
145
docs/api/app.md
@@ -32,7 +32,7 @@ In most cases, you should do everything in the `ready` event handler.
|
||||
|
||||
Returns:
|
||||
|
||||
* `launchInfo` Object _macOS_
|
||||
* `launchInfo` unknown _macOS_
|
||||
|
||||
Emitted when Electron has finished initializing. On macOS, `launchInfo` holds
|
||||
the `userInfo` of the `NSUserNotification` that was used to open the application,
|
||||
@@ -146,7 +146,7 @@ Returns:
|
||||
* `event` Event
|
||||
* `type` String - A string identifying the activity. Maps to
|
||||
[`NSUserActivity.activityType`][activity-type].
|
||||
* `userInfo` Object - Contains app-specific state stored by the activity on
|
||||
* `userInfo` unknown - Contains app-specific state stored by the activity on
|
||||
another device.
|
||||
|
||||
Emitted during [Handoff][handoff] when an activity from a different device wants
|
||||
@@ -189,7 +189,7 @@ Returns:
|
||||
* `event` Event
|
||||
* `type` String - A string identifying the activity. Maps to
|
||||
[`NSUserActivity.activityType`][activity-type].
|
||||
* `userInfo` Object - Contains app-specific state stored by the activity.
|
||||
* `userInfo` unknown - Contains app-specific state stored by the activity.
|
||||
|
||||
Emitted during [Handoff][handoff] after an activity from this device was successfully
|
||||
resumed on another one.
|
||||
@@ -201,7 +201,7 @@ Returns:
|
||||
* `event` Event
|
||||
* `type` String - A string identifying the activity. Maps to
|
||||
[`NSUserActivity.activityType`][activity-type].
|
||||
* `userInfo` Object - Contains app-specific state stored by the activity.
|
||||
* `userInfo` unknown - Contains app-specific state stored by the activity.
|
||||
|
||||
Emitted when [Handoff][handoff] is about to be resumed on another device. If you need to update the state to be transferred, you should call `event.preventDefault()` immediately, construct a new `userInfo` dictionary and call `app.updateCurrentActiviy()` in a timely manner. Otherwise, the operation will fail and `continue-activity-error` will be called.
|
||||
|
||||
@@ -314,10 +314,8 @@ Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
* `request` Object
|
||||
* `method` String
|
||||
* `authenticationResponseDetails` Object
|
||||
* `url` URL
|
||||
* `referrer` URL
|
||||
* `authInfo` Object
|
||||
* `isProxy` Boolean
|
||||
* `scheme` String
|
||||
@@ -325,8 +323,8 @@ Returns:
|
||||
* `port` Integer
|
||||
* `realm` String
|
||||
* `callback` Function
|
||||
* `username` String
|
||||
* `password` String
|
||||
* `username` String (optional)
|
||||
* `password` String (optional)
|
||||
|
||||
Emitted when `webContents` wants to do basic auth.
|
||||
|
||||
@@ -337,12 +335,16 @@ should prevent the default behavior with `event.preventDefault()` and call
|
||||
```javascript
|
||||
const { app } = require('electron')
|
||||
|
||||
app.on('login', (event, webContents, request, authInfo, callback) => {
|
||||
app.on('login', (event, webContents, details, authInfo, callback) => {
|
||||
event.preventDefault()
|
||||
callback('username', 'secret')
|
||||
})
|
||||
```
|
||||
|
||||
If `callback` is called without a username or password, the authentication
|
||||
request will be cancelled and the authentication error will be returned to the
|
||||
page.
|
||||
|
||||
### Event: 'gpu-info-update'
|
||||
|
||||
Emitted whenever there is a GPU info update.
|
||||
@@ -366,6 +368,25 @@ Returns:
|
||||
|
||||
Emitted when the renderer process of `webContents` crashes or is killed.
|
||||
|
||||
#### Event: 'render-process-gone'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
* `details` Object
|
||||
* `reason` String - The reason the render process is gone. Possible values:
|
||||
* `clean-exit` - Process exited with an exit code of zero
|
||||
* `abnormal-exit` - Process exited with a non-zero exit code
|
||||
* `killed` - Process was sent a SIGTERM or otherwise killed externally
|
||||
* `crashed` - Process crashed
|
||||
* `oom` - Process ran out of memory
|
||||
* `launch-failure` - Process never successfully launched
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
|
||||
Emitted when the renderer process unexpectedly dissapears. This is normally
|
||||
because it was crashed or killed.
|
||||
|
||||
### Event: 'accessibility-support-changed' _macOS_ _Windows_
|
||||
|
||||
Returns:
|
||||
@@ -390,7 +411,7 @@ Emitted when Electron has created a new `session`.
|
||||
```javascript
|
||||
const { app } = require('electron')
|
||||
|
||||
app.on('session-created', (event, session) => {
|
||||
app.on('session-created', (session) => {
|
||||
console.log(session)
|
||||
})
|
||||
```
|
||||
@@ -562,11 +583,17 @@ Returns `Promise<void>` - fulfilled when Electron is initialized.
|
||||
May be used as a convenient alternative to checking `app.isReady()`
|
||||
and subscribing to the `ready` event if the app is not ready yet.
|
||||
|
||||
### `app.focus()`
|
||||
### `app.focus([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `steal` Boolean _macOS_ - Make the receiver the active app even if another app is
|
||||
currently active.
|
||||
|
||||
On Linux, focuses on the first visible window. On macOS, makes the application
|
||||
the active app. On Windows, focuses on the application's first window.
|
||||
|
||||
You should seek to use the `steal` option as sparingly as possible.
|
||||
|
||||
### `app.hide()` _macOS_
|
||||
|
||||
Hides all application windows without minimizing them.
|
||||
@@ -582,7 +609,7 @@ them.
|
||||
|
||||
Sets or creates a directory your app's logs which can then be manipulated with `app.getPath()` or `app.setPath(pathName, newPath)`.
|
||||
|
||||
Calling `app.setAppLogsPath()` without a `path` parameter will result in this directory being set to `/Library/Logs/YourAppName` on _macOS_, and inside the `userData` directory on _Linux_ and _Windows_.
|
||||
Calling `app.setAppLogsPath()` without a `path` parameter will result in this directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the `userData` directory on _Linux_ and _Windows_.
|
||||
|
||||
### `app.getAppPath()`
|
||||
|
||||
@@ -614,6 +641,8 @@ Returns `String` - The current application directory.
|
||||
Returns `String` - A path to a special directory or file associated with `name`. On
|
||||
failure, an `Error` is thrown.
|
||||
|
||||
If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being called first, a default log directory will be created equivalent to calling `app.setAppLogsPath()` without a `path` parameter.
|
||||
|
||||
### `app.getFileIcon(path[, options])`
|
||||
|
||||
* `path` String
|
||||
@@ -665,21 +694,19 @@ to the npm modules spec. You should usually also specify a `productName`
|
||||
field, which is your application's full capitalized name, and which will be
|
||||
preferred over `name` by Electron.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.setName(name)`
|
||||
|
||||
* `name` String
|
||||
|
||||
Overrides the current application's name.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
**Note:** This function overrides the name used internally by Electron; it does not affect the name that the OS uses.
|
||||
|
||||
### `app.getLocale()`
|
||||
|
||||
Returns `String` - The current application locale. Possible return values are documented [here](locales.md).
|
||||
|
||||
To set the locale, you'll want to use a command line switch at app startup, which may be found [here](https://github.com/electron/electron/blob/master/docs/api/chrome-command-line-switches.md).
|
||||
To set the locale, you'll want to use a command line switch at app startup, which may be found [here](https://github.com/electron/electron/blob/master/docs/api/command-line-switches.md).
|
||||
|
||||
**Note:** When distributing your packaged app, you have to also ship the
|
||||
`locales` folder.
|
||||
@@ -707,34 +734,34 @@ Clears the recent documents list.
|
||||
|
||||
### `app.setAsDefaultProtocolClient(protocol[, path, args])`
|
||||
|
||||
* `protocol` String - The name of your protocol, without `://`. If you want your
|
||||
app to handle `electron://` links, call this method with `electron` as the
|
||||
parameter.
|
||||
* `path` String (optional) _Windows_ - Defaults to `process.execPath`
|
||||
* `args` String[] (optional) _Windows_ - Defaults to an empty array
|
||||
* `protocol` String - The name of your protocol, without `://`. For example,
|
||||
if you want your app to handle `electron://` links, call this method with
|
||||
`electron` as the parameter.
|
||||
* `path` String (optional) _Windows_ - The path to the Electron executable.
|
||||
Defaults to `process.execPath`
|
||||
* `args` String[] (optional) _Windows_ - Arguments passed to the executable.
|
||||
Defaults to an empty array
|
||||
|
||||
Returns `Boolean` - Whether the call succeeded.
|
||||
|
||||
This method sets the current executable as the default handler for a protocol
|
||||
(aka URI scheme). It allows you to integrate your app deeper into the operating
|
||||
system. Once registered, all links with `your-protocol://` will be opened with
|
||||
the current executable. The whole link, including protocol, will be passed to
|
||||
your application as a parameter.
|
||||
|
||||
On Windows, you can provide optional parameters path, the path to your executable,
|
||||
and args, an array of arguments to be passed to your executable when it launches.
|
||||
Sets the current executable as the default handler for a protocol (aka URI
|
||||
scheme). It allows you to integrate your app deeper into the operating system.
|
||||
Once registered, all links with `your-protocol://` will be opened with the
|
||||
current executable. The whole link, including protocol, will be passed to your
|
||||
application as a parameter.
|
||||
|
||||
**Note:** On macOS, you can only register protocols that have been added to
|
||||
your app's `info.plist`, which can not be modified at runtime. You can however
|
||||
change the file with a simple text editor or script during build time.
|
||||
Please refer to [Apple's documentation][CFBundleURLTypes] for details.
|
||||
your app's `info.plist`, which cannot be modified at runtime. However, you can
|
||||
change the file during build time via [Electron Forge][electron-forge],
|
||||
[Electron Packager][electron-packager], or by editing `info.plist` with a text
|
||||
editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
|
||||
|
||||
**Note:** In a Windows Store environment (when packaged as an `appx`) this API
|
||||
will return `true` for all calls but the registry key it sets won't be accessible
|
||||
by other applications. In order to register your Windows Store application
|
||||
as a default protocol handler you must [declare the protocol in your manifest](https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
|
||||
|
||||
The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally.
|
||||
The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internally.
|
||||
|
||||
### `app.removeAsDefaultProtocolClient(protocol[, path, args])` _macOS_ _Windows_
|
||||
|
||||
@@ -753,10 +780,8 @@ protocol (aka URI scheme). If so, it will remove the app as the default handler.
|
||||
* `path` String (optional) _Windows_ - Defaults to `process.execPath`
|
||||
* `args` String[] (optional) _Windows_ - Defaults to an empty array
|
||||
|
||||
Returns `Boolean`
|
||||
|
||||
This method checks if the current executable is the default handler for a protocol
|
||||
(aka URI scheme). If so, it will return true. Otherwise, it will return false.
|
||||
Returns `Boolean` - Whether the current executable is the default handler for a
|
||||
protocol (aka URI scheme).
|
||||
|
||||
**Note:** On macOS, you can use this method to check if the app has been
|
||||
registered as the default protocol handler for a protocol. You can also verify
|
||||
@@ -764,7 +789,22 @@ this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
|
||||
macOS machine. Please refer to
|
||||
[Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details.
|
||||
|
||||
The API uses the Windows Registry and LSCopyDefaultHandlerForURLScheme internally.
|
||||
The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme` internally.
|
||||
|
||||
### `app.getApplicationNameForProtocol(url)`
|
||||
|
||||
* `url` String - a URL with the protocol name to check. Unlike the other
|
||||
methods in this family, this accepts an entire URL, including `://` at a
|
||||
minimum (e.g. `https://`).
|
||||
|
||||
Returns `String` - Name of the application handling the protocol, or an empty
|
||||
string if there is no handler. For instance, if Electron is the default
|
||||
handler of the URL, this could be `Electron` on Windows and Mac. However,
|
||||
don't rely on the precise format which is not guaranteed to remain unchanged.
|
||||
Expect a different format on Linux, possibly with a `.desktop` suffix.
|
||||
|
||||
This method returns the application name of the default handler for the protocol
|
||||
(aka URI scheme) of a URL.
|
||||
|
||||
### `app.setUserTasks(tasks)` _Windows_
|
||||
|
||||
@@ -949,7 +989,7 @@ allow multiple instances of the application to once again run side by side.
|
||||
|
||||
* `type` String - Uniquely identifies the activity. Maps to
|
||||
[`NSUserActivity.activityType`][activity-type].
|
||||
* `userInfo` Object - App-specific state to store for use by another device.
|
||||
* `userInfo` any - App-specific state to store for use by another device.
|
||||
* `webpageURL` String (optional) - The webpage to load in a browser if no suitable app is
|
||||
installed on the resuming device. The scheme must be `http` or `https`.
|
||||
|
||||
@@ -972,7 +1012,7 @@ Marks the current [Handoff][handoff] user activity as inactive without invalidat
|
||||
|
||||
* `type` String - Uniquely identifies the activity. Maps to
|
||||
[`NSUserActivity.activityType`][activity-type].
|
||||
* `userInfo` Object - App-specific state to store for use by another device.
|
||||
* `userInfo` any - App-specific state to store for use by another device.
|
||||
|
||||
Updates the current activity if its type matches `type`, merging the entries from
|
||||
`userInfo` into its current `userInfo` dictionary.
|
||||
@@ -1069,14 +1109,10 @@ On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
|
||||
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
|
||||
for more information please read [Desktop Environment Integration][unity-requirement].
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.getBadgeCount()` _Linux_ _macOS_
|
||||
|
||||
Returns `Integer` - The current value displayed in the counter badge.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.isUnityRunning()` _Linux_
|
||||
|
||||
Returns `Boolean` - Whether the current desktop environment is Unity launcher.
|
||||
@@ -1151,8 +1187,6 @@ technologies, such as screen readers, has been detected. See
|
||||
https://www.chromium.org/developers/design-documents/accessibility for more
|
||||
details.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.setAccessibilitySupportEnabled(enabled)` _macOS_ _Windows_
|
||||
|
||||
* `enabled` Boolean - Enable or disable [accessibility tree](https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree) rendering
|
||||
@@ -1164,26 +1198,25 @@ This API must be called after the `ready` event is emitted.
|
||||
|
||||
**Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `app.showAboutPanel()` _macOS_ _Linux_
|
||||
### `app.showAboutPanel()`
|
||||
|
||||
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`.
|
||||
|
||||
### `app.setAboutPanelOptions(options)` _macOS_ _Linux_
|
||||
### `app.setAboutPanelOptions(options)`
|
||||
|
||||
* `options` Object
|
||||
* `applicationName` String (optional) - The app's name.
|
||||
* `applicationVersion` String (optional) - The app's version.
|
||||
* `copyright` String (optional) - Copyright information.
|
||||
* `version` String (optional) _macOS_ - The app's build version number.
|
||||
* `credits` String (optional) _macOS_ - Credit information.
|
||||
* `credits` String (optional) _macOS_ _Windows_ - Credit information.
|
||||
* `authors` String[] (optional) _Linux_ - List of app authors.
|
||||
* `website` String (optional) _Linux_ - The app's website.
|
||||
* `iconPath` String (optional) _Linux_ - Path to the app's icon. Will be shown as 64x64 pixels while retaining aspect ratio.
|
||||
* `iconPath` String (optional) _Linux_ _Windows_ - Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
|
||||
|
||||
Set the about panel options. This will override the values defined in the app's
|
||||
`.plist` file on MacOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
|
||||
Set the about panel options. This will override the values defined in the app's `.plist` file on MacOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
|
||||
|
||||
If you do not set `credits` but still wish to surface them in your app, AppKit will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in that order, in the bundle returned by the NSBundle class method main. The first file found is used, and if none is found, the info area is left blank. See Apple [documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc) for more information.
|
||||
|
||||
### `app.isEmojiPanelSupported()`
|
||||
|
||||
@@ -1304,6 +1337,8 @@ A `Boolean` property that returns `true` if the app is packaged, `false` otherw
|
||||
[dock-menu]:https://developer.apple.com/macos/human-interface-guidelines/menus/dock-menus/
|
||||
[tasks]:https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
|
||||
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
|
||||
[electron-forge]: https://www.electronforge.io/
|
||||
[electron-packager]: https://github.com/electron/electron-packager
|
||||
[CFBundleURLTypes]: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115
|
||||
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme
|
||||
[handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html
|
||||
|
||||
@@ -103,7 +103,7 @@ The `autoUpdater` object has the following methods:
|
||||
|
||||
* `options` Object
|
||||
* `url` String
|
||||
* `headers` Object (optional) _macOS_ - HTTP request headers.
|
||||
* `headers` Record<String, String> (optional) _macOS_ - HTTP request headers.
|
||||
* `serverType` String (optional) _macOS_ - Either `json` or `default`, see the [Squirrel.Mac][squirrel-mac]
|
||||
README for more information.
|
||||
|
||||
|
||||
@@ -6,6 +6,108 @@ Breaking changes will be documented here, and deprecation warnings added to JS c
|
||||
|
||||
The `FIXME` string is used in code comments to denote things that should be fixed for future releases. See https://github.com/electron/electron/search?q=fixme
|
||||
|
||||
## Planned Breaking API Changes (8.0)
|
||||
|
||||
### Values sent over IPC are now serialized with Structured Clone Algorithm
|
||||
|
||||
The algorithm used to serialize objects sent over IPC (through
|
||||
`ipcRenderer.send`, `ipcRenderer.sendSync`, `WebContents.send` and related
|
||||
methods) has been switched from a custom algorithm to V8's built-in [Structured
|
||||
Clone Algorithm][SCA], the same algorithm used to serialize messages for
|
||||
`postMessage`. This brings about a 2x performance improvement for large
|
||||
messages, but also brings some breaking changes in behavior.
|
||||
|
||||
- Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any
|
||||
such values, over IPC will now throw an exception, instead of silently
|
||||
converting the functions to `undefined`.
|
||||
```js
|
||||
// Previously:
|
||||
ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
|
||||
// => results in { value: 3 } arriving in the main process
|
||||
|
||||
// From Electron 8:
|
||||
ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
|
||||
// => throws Error("() => {} could not be cloned.")
|
||||
```
|
||||
- `NaN`, `Infinity` and `-Infinity` will now be correctly serialized, instead
|
||||
of being converted to `null`.
|
||||
- Objects containing cyclic references will now be correctly serialized,
|
||||
instead of being converted to `null`.
|
||||
- `Set`, `Map`, `Error` and `RegExp` values will be correctly serialized,
|
||||
instead of being converted to `{}`.
|
||||
- `BigInt` values will be correctly serialized, instead of being converted to
|
||||
`null`.
|
||||
- Sparse arrays will be serialized as such, instead of being converted to dense
|
||||
arrays with `null`s.
|
||||
- `Date` objects will be transferred as `Date` objects, instead of being
|
||||
converted to their ISO string representation.
|
||||
- Typed Arrays (such as `Uint8Array`, `Uint16Array`, `Uint32Array` and so on)
|
||||
will be transferred as such, instead of being converted to Node.js `Buffer`.
|
||||
- Node.js `Buffer` objects will be transferred as `Uint8Array`s. You can
|
||||
convert a `Uint8Array` back to a Node.js `Buffer` by wrapping the underlying
|
||||
`ArrayBuffer`:
|
||||
```js
|
||||
Buffer.from(value.buffer, value.byteOffset, value.byteLength)
|
||||
```
|
||||
|
||||
Sending any objects that aren't native JS types, such as DOM objects (e.g.
|
||||
`Element`, `Location`, `DOMMatrix`), Node.js objects (e.g. `process.env`,
|
||||
`Stream`), or Electron objects (e.g. `WebContents`, `BrowserWindow`,
|
||||
`WebFrame`) is deprecated. In Electron 8, these objects will be serialized as
|
||||
before with a DeprecationWarning message, but starting in Electron 9, sending
|
||||
these kinds of objects will throw a 'could not be cloned' error.
|
||||
|
||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||
|
||||
### `<webview>.getWebContents()`
|
||||
|
||||
This API is implemented using the `remote` module, which has both performance
|
||||
and security implications. Therefore its usage should be explicit.
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
webview.getWebContents()
|
||||
// Replace with
|
||||
const { remote } = require('electron')
|
||||
remote.webContents.fromId(webview.getWebContentsId())
|
||||
```
|
||||
|
||||
However, it is recommended to avoid using the `remote` module altogether.
|
||||
|
||||
```js
|
||||
// main
|
||||
const { ipcMain, webContents } = require('electron')
|
||||
|
||||
const getGuestForWebContents = function (webContentsId, contents) {
|
||||
const guest = webContents.fromId(webContentsId)
|
||||
if (!guest) {
|
||||
throw new Error(`Invalid webContentsId: ${webContentsId}`)
|
||||
}
|
||||
if (guest.hostWebContents !== contents) {
|
||||
throw new Error(`Access denied to webContents`)
|
||||
}
|
||||
return guest
|
||||
}
|
||||
|
||||
ipcMain.handle('openDevTools', (event, webContentsId) => {
|
||||
const guest = getGuestForWebContents(webContentsId, event.sender)
|
||||
guest.openDevTools()
|
||||
})
|
||||
|
||||
// renderer
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
ipcRenderer.invoke('openDevTools', webview.getWebContentsId())
|
||||
```
|
||||
|
||||
### `webFrame.setLayoutZoomLevelLimits()`
|
||||
|
||||
Chromium has removed support for changing the layout zoom level limits, and it
|
||||
is beyond Electron's capacity to maintain it. The function will emit a warning
|
||||
in Electron 8.x, and cease to exist in Electron 9.x. The layout zoom level
|
||||
limits are now fixed at a minimum of 0.25 and a maximum of 5.0, as defined
|
||||
[here](https://chromium.googlesource.com/chromium/src/+/938b37a6d2886bf8335fc7db792f1eb46c65b2ae/third_party/blink/common/page/page_zoom.cc#11).
|
||||
|
||||
## Planned Breaking API Changes (7.0)
|
||||
|
||||
### Node Headers URL
|
||||
@@ -50,7 +152,7 @@ const idleTime = getSystemIdleTime()
|
||||
### webFrame Isolated World APIs
|
||||
|
||||
```js
|
||||
// Removed in Elecron 7.0
|
||||
// Removed in Electron 7.0
|
||||
webFrame.setIsolatedWorldContentSecurityPolicy(worldId, csp)
|
||||
webFrame.setIsolatedWorldHumanReadableName(worldId, name)
|
||||
webFrame.setIsolatedWorldSecurityOrigin(worldId, securityOrigin)
|
||||
@@ -68,6 +170,40 @@ webFrame.setIsolatedWorldInfo(
|
||||
|
||||
This property was removed in Chromium 77, and as such is no longer available.
|
||||
|
||||
### `webkitdirectory` attribute for `<input type="file"/>`
|
||||

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

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

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

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

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

|
||||
Note that `webkitdirectory` no longer exposes the path to the selected folder.
|
||||
If you require the path to the selected folder rather than the folder contents,
|
||||
see the `dialog.showOpenDialog` API ([link](https://github.com/electron/electron/blob/master/docs/api/dialog.md#dialogshowopendialogbrowserwindow-options)).
|
||||
|
||||
## Planned Breaking API Changes (6.0)
|
||||
|
||||
### `win.setMenu(null)`
|
||||
|
||||
@@ -51,6 +51,9 @@ This event is usually emitted after the `did-finish-load` event, but for
|
||||
pages with many remote resources, it may be emitted before the `did-finish-load`
|
||||
event.
|
||||
|
||||
Please note that using this event implies that the renderer will be considered "visible" and
|
||||
paint even though `show` is false. This event will never fire if you use `paintWhenInitiallyHidden: false`
|
||||
|
||||
## Setting `backgroundColor`
|
||||
|
||||
For a complex app, the `ready-to-show` event could be emitted too late, making
|
||||
@@ -184,6 +187,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
leave it undefined so the executable's icon will be used.
|
||||
* `show` Boolean (optional) - Whether window should be shown when created. Default is
|
||||
`true`.
|
||||
* `paintWhenInitiallyHidden` Boolean (optional) - Whether the renderer should be active when `show` is `false` and it has just been created. In order for `document.visibilityState` to work correctly on first load with `show: false` you should set this to `false`. Setting this to `false` will cause the `ready-to-show` event to not fire. Default is `true`.
|
||||
* `frame` Boolean (optional) - Specify `false` to create a
|
||||
[Frameless Window](frameless-window.md). Default is `true`.
|
||||
* `parent` BrowserWindow (optional) - Specify parent window. Default is `null`.
|
||||
@@ -202,8 +206,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `backgroundColor` String (optional) - Window's background color as a hexadecimal value,
|
||||
like `#66CD00` or `#FFF` or `#80FFFFFF` (alpha in #AARRGGBB format is supported if
|
||||
`transparent` is set to `true`). Default is `#FFF` (white).
|
||||
* `hasShadow` Boolean (optional) - Whether window should have a shadow. This is only
|
||||
implemented on macOS. Default is `true`.
|
||||
* `hasShadow` Boolean (optional) - Whether window should have a shadow. Default is `true`.
|
||||
* `opacity` Number (optional) - Set the initial opacity of the window, between 0.0 (fully
|
||||
transparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.
|
||||
* `darkTheme` Boolean (optional) - Forces using dark theme for the window, only works on
|
||||
@@ -226,6 +229,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
unless hovered over in the top left of the window. These custom buttons prevent
|
||||
issues with mouse events that occur with the standard window toolbar buttons.
|
||||
**Note:** This option is currently experimental.
|
||||
* `trafficLightPosition` [Point](structures/point.md) (optional) - Set a custom position for the traffic light buttons. Can only be used with `titleBarStyle` set to `hidden`
|
||||
* `fullscreenWindowTitle` Boolean (optional) - Shows the title in the
|
||||
title bar in full screen mode on macOS for all `titleBarStyle` options.
|
||||
Default is `false`.
|
||||
@@ -269,8 +273,6 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
OS-level sandbox and disabling the Node.js engine. This is not the same as
|
||||
the `nodeIntegration` option and the APIs available to the preload script
|
||||
are more limited. Read more about the option [here](sandbox-option.md).
|
||||
**Note:** This option is currently experimental and may change or be
|
||||
removed in future Electron releases.
|
||||
* `enableRemoteModule` Boolean (optional) - Whether to enable the [`remote`](remote.md) module.
|
||||
Default is `true`.
|
||||
* `session` [Session](session.md#class-session) (optional) - Sets the session used by the
|
||||
@@ -370,6 +372,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
consecutive dialog protection is triggered. If not defined the default
|
||||
message would be used, note that currently the default message is in
|
||||
English and not localized.
|
||||
* `disableDialogs` Boolean (optional) - Whether to disable dialogs
|
||||
completely. Overrides `safeDialogs`. Default is `false`.
|
||||
* `navigateOnDragDrop` Boolean (optional) - Whether dragging and dropping a
|
||||
file or link onto the page causes a navigation. Default is `false`.
|
||||
* `autoplayPolicy` String (optional) - Autoplay policy to apply to
|
||||
@@ -379,6 +383,20 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||
* `disableHtmlFullscreenWindowResize` Boolean (optional) - Whether to
|
||||
prevent the window from resizing when entering HTML Fullscreen. Default
|
||||
is `false`.
|
||||
* `accessibleTitle` String (optional) - An alternative title string provided only
|
||||
to accessibility tools such as screen readers. This string is not directly
|
||||
visible to users.
|
||||
* `spellcheck` Boolean (optional) - Whether to enable the builtin spellchecker.
|
||||
Default is `false`.
|
||||
* `enableWebSQL` Boolean (optional) - Whether to enable the [WebSQL api](https://www.w3.org/TR/webdatabase/).
|
||||
Default is `true`.
|
||||
* `v8CacheOptions` String (optional) - Enforces the v8 code caching policy
|
||||
used by blink. Accepted values are
|
||||
* `none` - Disables code caching
|
||||
* `code` - Heuristic based code caching
|
||||
* `bypassHeatCheck` - Bypass code caching heuristics but with lazy compilation
|
||||
* `bypassHeatCheckAndEagerCompile` - Same as above except compilation is eager.
|
||||
Default policy is `code`.
|
||||
|
||||
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
|
||||
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
|
||||
@@ -485,6 +503,9 @@ Emitted when the window is hidden.
|
||||
Emitted when the web page has been rendered (while not being shown) and window can be displayed without
|
||||
a visual flash.
|
||||
|
||||
Please note that using this event implies that the renderer will be considered "visible" and
|
||||
paint even though `show` is false. This event will never fire if you use `paintWhenInitiallyHidden: false`
|
||||
|
||||
#### Event: 'maximize'
|
||||
|
||||
Emitted when window is maximized.
|
||||
@@ -506,7 +527,7 @@ Emitted when the window is restored from a minimized state.
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `newBounds` [`Rectangle`](structures/rectangle.md) - Size the window is being resized to.
|
||||
* `newBounds` [Rectangle](structures/rectangle.md) - Size the window is being resized to.
|
||||
|
||||
Emitted before the window is resized. Calling `event.preventDefault()` will prevent the window from being resized.
|
||||
|
||||
@@ -516,14 +537,14 @@ Note that this is only emitted when the window is being resized manually. Resizi
|
||||
|
||||
Emitted after the window has been resized.
|
||||
|
||||
#### Event: 'will-move' _Windows_
|
||||
#### Event: 'will-move' _macOS_ _Windows_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `newBounds` [`Rectangle`](structures/rectangle.md) - Location the window is being moved to.
|
||||
* `newBounds` [Rectangle](structures/rectangle.md) - Location the window is being moved to.
|
||||
|
||||
Emitted before the window is moved. Calling `event.preventDefault()` will prevent the window from being moved.
|
||||
Emitted before the window is moved. On Windows, calling `event.preventDefault()` will prevent the window from being moved.
|
||||
|
||||
Note that this is only emitted when the window is being resized manually. Resizing the window with `setBounds`/`setSize` will not emit this event.
|
||||
|
||||
@@ -614,6 +635,12 @@ Returns:
|
||||
|
||||
Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`, `left`.
|
||||
|
||||
The method underlying this event is built to handle older macOS-style trackpad swiping,
|
||||
where the content on the screen doesn't move with the swipe. Most macOS trackpads are not
|
||||
configured to allow this kind of swiping anymore, so in order for it to emit properly the
|
||||
'Swipe between pages' preference in `System Preferences > Trackpad > More Gestures` must be
|
||||
set to 'Swipe with two or three fingers'.
|
||||
|
||||
#### Event: 'rotate-gesture' _macOS_
|
||||
|
||||
Returns:
|
||||
@@ -655,7 +682,8 @@ Returns `BrowserWindow | null` - The window that is focused in this application,
|
||||
|
||||
* `webContents` [WebContents](web-contents.md)
|
||||
|
||||
Returns `BrowserWindow` - The window that owns the given `webContents`.
|
||||
Returns `BrowserWindow | null` - The window that owns the given `webContents`
|
||||
or `null` if the contents are not owned by a window.
|
||||
|
||||
#### `BrowserWindow.fromBrowserView(browserView)`
|
||||
|
||||
@@ -691,7 +719,7 @@ is emitted.
|
||||
|
||||
#### `BrowserWindow.getExtensions()`
|
||||
|
||||
Returns `Object` - The keys are the extension names and each value is
|
||||
Returns `Record<String, ExtensionInfo>` - The keys are the extension names and each value is
|
||||
an Object containing `name` and `version` properties.
|
||||
|
||||
**Note:** This API cannot be called before the `ready` event of the `app` module
|
||||
@@ -724,7 +752,7 @@ is emitted.
|
||||
|
||||
#### `BrowserWindow.getDevToolsExtensions()`
|
||||
|
||||
Returns `Object` - The keys are the extension names and each value is
|
||||
Returns `Record<string, ExtensionInfo>` - The keys are the extension names and each value is
|
||||
an Object containing `name` and `version` properties.
|
||||
|
||||
To check if a DevTools extension is installed you can run the following:
|
||||
@@ -821,6 +849,12 @@ const menu = Menu.buildFromTemplate(template)
|
||||
Menu.setApplicationMenu(menu)
|
||||
```
|
||||
|
||||
#### `win.accessibleTitle`
|
||||
|
||||
A `String` property that defines an alternative title provided only to
|
||||
accessibility tools such as screen readers. This string is not directly
|
||||
visible to users.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
Objects created with `new BrowserWindow` have the following instance methods:
|
||||
@@ -1027,7 +1061,7 @@ Disable or enable the window.
|
||||
|
||||
#### `win.isEnabled()`
|
||||
|
||||
Returns Boolean - whether the window is enabled.
|
||||
Returns `Boolean` - whether the window is enabled.
|
||||
|
||||
#### `win.setSize(width, height[, animate])`
|
||||
|
||||
@@ -1079,15 +1113,11 @@ Returns `Integer[]` - Contains the window's maximum width and height.
|
||||
|
||||
* `resizable` Boolean
|
||||
|
||||
Sets whether the window can be manually resized by user.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
Sets whether the window can be manually resized by the user.
|
||||
|
||||
#### `win.isResizable()`
|
||||
|
||||
Returns `Boolean` - Whether the window can be manually resized by user.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
Returns `Boolean` - Whether the window can be manually resized by the user.
|
||||
|
||||
#### `win.setMovable(movable)` _macOS_ _Windows_
|
||||
|
||||
@@ -1095,41 +1125,29 @@ Returns `Boolean` - Whether the window can be manually resized by user.
|
||||
|
||||
Sets whether the window can be moved by user. On Linux does nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isMovable()` _macOS_ _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window can be moved by user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMinimizable(minimizable)` _macOS_ _Windows_
|
||||
|
||||
* `minimizable` Boolean
|
||||
|
||||
Sets whether the window can be manually minimized by user. On Linux does
|
||||
nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
Sets whether the window can be manually minimized by user. On Linux does nothing.
|
||||
|
||||
#### `win.isMinimizable()` _macOS_ _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window can be manually minimized by user
|
||||
Returns `Boolean` - Whether the window can be manually minimized by the user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMaximizable(maximizable)` _macOS_ _Windows_
|
||||
|
||||
* `maximizable` Boolean
|
||||
|
||||
Sets whether the window can be manually maximized by user. On Linux does
|
||||
nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
Sets whether the window can be manually maximized by user. On Linux does nothing.
|
||||
|
||||
#### `win.isMaximizable()` _macOS_ _Windows_
|
||||
|
||||
@@ -1137,23 +1155,15 @@ Returns `Boolean` - Whether the window can be manually maximized by user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setFullScreenable(fullscreenable)`
|
||||
|
||||
* `fullscreenable` Boolean
|
||||
|
||||
Sets whether the maximize/zoom window button toggles fullscreen mode or
|
||||
maximizes the window.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
||||
|
||||
#### `win.isFullScreenable()`
|
||||
|
||||
Returns `Boolean` - Whether the maximize/zoom window button toggles fullscreen mode or
|
||||
maximizes the window.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
Returns `Boolean` - Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
|
||||
|
||||
#### `win.setClosable(closable)` _macOS_ _Windows_
|
||||
|
||||
@@ -1161,16 +1171,12 @@ maximizes the window.
|
||||
|
||||
Sets whether the window can be manually closed by user. On Linux does nothing.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.isClosable()` _macOS_ _Windows_
|
||||
|
||||
Returns `Boolean` - Whether the window can be manually closed by user.
|
||||
|
||||
On Linux always returns `true`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setAlwaysOnTop(flag[, level][, relativeLevel])`
|
||||
|
||||
* `flag` Boolean
|
||||
@@ -1194,6 +1200,14 @@ can not be focused on.
|
||||
|
||||
Returns `Boolean` - Whether the window is always on top of other windows.
|
||||
|
||||
#### `win.moveAbove(mediaSourceId)`
|
||||
|
||||
* `mediaSourceId` String - Window id in the format of DesktopCapturerSource's id. For example "window:1869:0".
|
||||
|
||||
Moves window above the source window in the sense of z-order. If the
|
||||
`mediaSourceId` is not of type window or if the window does not exist then
|
||||
this method throws an error.
|
||||
|
||||
#### `win.moveTop()`
|
||||
|
||||
Moves window to top(z-order) regardless of focus
|
||||
@@ -1266,6 +1280,15 @@ Enters or leaves the kiosk mode.
|
||||
|
||||
Returns `Boolean` - Whether the window is in kiosk mode.
|
||||
|
||||
#### `win.getMediaSourceId()`
|
||||
|
||||
Returns `String` - Window id in the format of DesktopCapturerSource's id. For example "window:1234:0".
|
||||
|
||||
More precisely the format is `window:id:other_id` where `id` is `HWND` on
|
||||
Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
|
||||
Linux. `other_id` is used to identify web contents (tabs) so within the same
|
||||
top level window.
|
||||
|
||||
#### `win.getNativeWindowHandle()`
|
||||
|
||||
Returns `Buffer` - The platform-specific handle of the window.
|
||||
@@ -1381,7 +1404,7 @@ win.loadURL('http://localhost:8000/post', {
|
||||
|
||||
* `filePath` String
|
||||
* `options` Object (optional)
|
||||
* `query` Object (optional) - Passed to `url.format()`.
|
||||
* `query` Record<String, String> (optional) - Passed to `url.format()`.
|
||||
* `search` String (optional) - Passed to `url.format()`.
|
||||
* `hash` String (optional) - Passed to `url.format()`.
|
||||
|
||||
@@ -1437,29 +1460,27 @@ screen readers
|
||||
Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
|
||||
convey some sort of application status or to passively notify the user.
|
||||
|
||||
#### `win.setHasShadow(hasShadow)` _macOS_
|
||||
#### `win.setHasShadow(hasShadow)`
|
||||
|
||||
* `hasShadow` Boolean
|
||||
|
||||
Sets whether the window should have a shadow. On Windows and Linux does
|
||||
nothing.
|
||||
Sets whether the window should have a shadow.
|
||||
|
||||
#### `win.hasShadow()` _macOS_
|
||||
#### `win.hasShadow()`
|
||||
|
||||
Returns `Boolean` - Whether the window has a shadow.
|
||||
|
||||
On Windows and Linux always returns
|
||||
`true`.
|
||||
|
||||
#### `win.setOpacity(opacity)` _Windows_ _macOS_
|
||||
|
||||
* `opacity` Number - between 0.0 (fully transparent) and 1.0 (fully opaque)
|
||||
|
||||
Sets the opacity of the window. On Linux does nothing.
|
||||
Sets the opacity of the window. On Linux, does nothing. Out of bound number
|
||||
values are clamped to the [0, 1] range.
|
||||
|
||||
#### `win.getOpacity()` _Windows_ _macOS_
|
||||
#### `win.getOpacity()`
|
||||
|
||||
Returns `Number` - between 0.0 (fully transparent) and 1.0 (fully opaque)
|
||||
Returns `Number` - between 0.0 (fully transparent) and 1.0 (fully opaque). On
|
||||
Linux, always returns 1.
|
||||
|
||||
#### `win.setShape(rects)` _Windows_ _Linux_ _Experimental_
|
||||
|
||||
@@ -1548,7 +1569,7 @@ Same as `webContents.showDefinitionForSelection()`.
|
||||
|
||||
#### `win.setIcon(icon)` _Windows_ _Linux_
|
||||
|
||||
* `icon` [NativeImage](native-image.md)
|
||||
* `icon` [NativeImage](native-image.md) | String
|
||||
|
||||
Changes window icon.
|
||||
|
||||
@@ -1567,23 +1588,17 @@ This cannot be called when `titleBarStyle` is set to `customButtonsOnHover`.
|
||||
Sets whether the window menu bar should hide itself automatically. Once set the
|
||||
menu bar will only show when users press the single `Alt` key.
|
||||
|
||||
If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
|
||||
hide it immediately.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't hide it immediately.
|
||||
|
||||
#### `win.isMenuBarAutoHide()`
|
||||
|
||||
Returns `Boolean` - Whether menu bar automatically hides itself.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `win.setMenuBarVisibility(visible)` _Windows_ _Linux_
|
||||
|
||||
* `visible` Boolean
|
||||
|
||||
Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
|
||||
can still bring up the menu bar by pressing the single `Alt` key.
|
||||
Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
|
||||
|
||||
#### `win.isMenuBarVisible()`
|
||||
|
||||
@@ -1594,7 +1609,7 @@ Returns `Boolean` - Whether the menu bar is visible.
|
||||
* `visible` Boolean
|
||||
* `options` Object (optional)
|
||||
* `visibleOnFullScreen` Boolean (optional) _macOS_ - Sets whether
|
||||
the window should be visible above fullscreen windows
|
||||
the window should be visible above fullscreen windows _deprecated_
|
||||
|
||||
Sets whether the window should be visible on all workspaces.
|
||||
|
||||
@@ -1702,6 +1717,17 @@ will remove the vibrancy effect on the window.
|
||||
Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` have been
|
||||
deprecated and will be removed in an upcoming version of macOS.
|
||||
|
||||
#### `win.setTrafficLightPosition(position)` _macOS_
|
||||
|
||||
* `position` [Point](structures/point.md)
|
||||
|
||||
Set a custom position for the traffic light buttons. Can only be used with `titleBarStyle` set to `hidden`.
|
||||
|
||||
#### `win.getTrafficLightPosition()` _macOS_
|
||||
|
||||
Returns `Point` - The current position for the traffic light buttons. Can only be used with `titleBarStyle`
|
||||
set to `hidden`.
|
||||
|
||||
#### `win.setTouchBar(touchBar)` _macOS_ _Experimental_
|
||||
|
||||
* `touchBar` TouchBar | null
|
||||
@@ -1715,14 +1741,14 @@ removed in future Electron releases.
|
||||
|
||||
#### `win.setBrowserView(browserView)` _Experimental_
|
||||
|
||||
* `browserView` [BrowserView](browser-view.md) | null - Attach browserView to win.
|
||||
If there is some other browserViews was attached they will be removed from
|
||||
* `browserView` [BrowserView](browser-view.md) | null - Attach `browserView` to `win`.
|
||||
If there are other `BrowserView`s attached, they will be removed from
|
||||
this window.
|
||||
|
||||
#### `win.getBrowserView()` _Experimental_
|
||||
|
||||
Returns `BrowserView | null` - an BrowserView what is attached. Returns `null`
|
||||
if none is attached. Throw error if multiple BrowserViews is attached.
|
||||
Returns `BrowserView | null` - The `BrowserView` attached to `win`. Returns `null`
|
||||
if one is not attached. Throws an error if multiple `BrowserView`s are attached.
|
||||
|
||||
#### `win.addBrowserView(browserView)` _Experimental_
|
||||
|
||||
|
||||
@@ -16,12 +16,15 @@ following properties:
|
||||
method.
|
||||
* `url` String (optional) - The request URL. Must be provided in the absolute
|
||||
form with the protocol scheme specified as http or https.
|
||||
* `session` Object (optional) - The [`Session`](session.md) instance with
|
||||
* `session` Session (optional) - The [`Session`](session.md) instance with
|
||||
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.
|
||||
* `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:'.
|
||||
* `host` String (optional) - The server host provided as a concatenation of
|
||||
@@ -32,8 +35,8 @@ the hostname and the port number 'hostname:port'.
|
||||
* `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
|
||||
deferred until [`request.followRedirect`](#requestfollowredirect) is invoked. Listen for the [`redirect`](#event-redirect) event in
|
||||
this mode to get more details about the redirect request.
|
||||
cancelled unless [`request.followRedirect`](#requestfollowredirect) is invoked
|
||||
synchronously during the [`redirect`](#event-redirect) event.
|
||||
|
||||
`options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
|
||||
strictly follow the Node.js model as described in the
|
||||
@@ -70,8 +73,8 @@ Returns:
|
||||
* `port` Integer
|
||||
* `realm` String
|
||||
* `callback` Function
|
||||
* `username` String
|
||||
* `password` String
|
||||
* `username` String (optional)
|
||||
* `password` String (optional)
|
||||
|
||||
Emitted when an authenticating proxy is asking for user credentials.
|
||||
|
||||
@@ -134,10 +137,13 @@ Returns:
|
||||
* `statusCode` Integer
|
||||
* `method` String
|
||||
* `redirectUrl` String
|
||||
* `responseHeaders` Object
|
||||
* `responseHeaders` Record<String, String[]>
|
||||
|
||||
Emitted when there is redirection and the mode is `manual`. Calling
|
||||
[`request.followRedirect`](#requestfollowredirect) will continue with the redirection.
|
||||
Emitted when the server returns a redirect response (e.g. 301 Moved
|
||||
Permanently). Calling [`request.followRedirect`](#requestfollowredirect) will
|
||||
continue with the redirection. If this event is handled,
|
||||
[`request.followRedirect`](#requestfollowredirect) must be called
|
||||
**synchronously**, otherwise the request will be cancelled.
|
||||
|
||||
### Instance Properties
|
||||
|
||||
@@ -158,7 +164,7 @@ internally buffered inside Electron process memory.
|
||||
#### `request.setHeader(name, value)`
|
||||
|
||||
* `name` String - An extra HTTP header name.
|
||||
* `value` Object - An extra HTTP header value.
|
||||
* `value` String - An extra HTTP header value.
|
||||
|
||||
Adds an extra HTTP header. The header name will be issued as-is without
|
||||
lowercasing. It can be called only before first write. Calling this method after
|
||||
@@ -169,7 +175,7 @@ the first write will throw an error. If the passed value is not a `String`, its
|
||||
|
||||
* `name` String - Specify an extra header name.
|
||||
|
||||
Returns `Object` - The value of a previously set extra header name.
|
||||
Returns `String` - The value of a previously set extra header name.
|
||||
|
||||
#### `request.removeHeader(name)`
|
||||
|
||||
@@ -214,7 +220,8 @@ response object,it will emit the `aborted` event.
|
||||
|
||||
#### `request.followRedirect()`
|
||||
|
||||
Continues any deferred redirection request when the redirection mode is `manual`.
|
||||
Continues any pending redirection. Can only be called during a `'redirect'`
|
||||
event.
|
||||
|
||||
#### `request.getUploadProgress()`
|
||||
|
||||
|
||||
@@ -4,18 +4,12 @@
|
||||
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
The following example shows how to write a string to the clipboard:
|
||||
|
||||
```javascript
|
||||
const { clipboard } = require('electron')
|
||||
clipboard.writeText('Example String')
|
||||
```
|
||||
|
||||
On Linux, there is also a `selection` clipboard. To manipulate it
|
||||
you need to pass `selection` to each method:
|
||||
|
||||
```javascript
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
clipboard.writeText('Example String', 'selection')
|
||||
console.log(clipboard.readText('selection'))
|
||||
```
|
||||
@@ -28,56 +22,106 @@ The `clipboard` module has the following methods:
|
||||
|
||||
### `clipboard.readText([type])`
|
||||
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Returns `String` - The content in the clipboard as plain text.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
clipboard.writeText('hello i am a bit of text!')
|
||||
|
||||
const text = clipboard.readText()
|
||||
console.log(text)
|
||||
// hello i am a bit of text!'
|
||||
```
|
||||
|
||||
### `clipboard.writeText(text[, type])`
|
||||
|
||||
* `text` String
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Writes the `text` into the clipboard as plain text.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
const text = 'hello i am a bit of text!'
|
||||
clipboard.writeText(text)
|
||||
```
|
||||
|
||||
### `clipboard.readHTML([type])`
|
||||
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Returns `String` - The content in the clipboard as markup.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
clipboard.writeHTML('<b>Hi</b>')
|
||||
const html = clipboard.readHTML()
|
||||
|
||||
console.log(html)
|
||||
// <meta charset='utf-8'><b>Hi</b>
|
||||
```
|
||||
|
||||
### `clipboard.writeHTML(markup[, type])`
|
||||
|
||||
* `markup` String
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Writes `markup` to the clipboard.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
clipboard.writeHTML('<b>Hi</b')
|
||||
```
|
||||
|
||||
### `clipboard.readImage([type])`
|
||||
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Returns [`NativeImage`](native-image.md) - The image content in the clipboard.
|
||||
|
||||
### `clipboard.writeImage(image[, type])`
|
||||
|
||||
* `image` [NativeImage](native-image.md)
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Writes `image` to the clipboard.
|
||||
|
||||
### `clipboard.readRTF([type])`
|
||||
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Returns `String` - The content in the clipboard as RTF.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
clipboard.writeRTF('{\\rtf1\\ansi{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\pard\nThis is some {\\b bold} text.\\par\n}')
|
||||
|
||||
const rtf = clipboard.readRTF()
|
||||
console.log(rtf)
|
||||
// {\\rtf1\\ansi{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\pard\nThis is some {\\b bold} text.\\par\n}
|
||||
```
|
||||
|
||||
### `clipboard.writeRTF(text[, type])`
|
||||
|
||||
* `text` String
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Writes the `text` into the clipboard in RTF.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
const rtf = '{\\rtf1\\ansi{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\pard\nThis is some {\\b bold} text.\\par\n}'
|
||||
clipboard.writeRTF(rtf)
|
||||
```
|
||||
|
||||
### `clipboard.readBookmark()` _macOS_ _Windows_
|
||||
|
||||
Returns `Object`:
|
||||
@@ -93,7 +137,7 @@ bookmark is unavailable.
|
||||
|
||||
* `title` String
|
||||
* `url` String
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Writes the `title` and `url` into the clipboard as a bookmark.
|
||||
|
||||
@@ -102,7 +146,9 @@ you can use `clipboard.write` to write both a bookmark and fallback text to the
|
||||
clipboard.
|
||||
|
||||
```js
|
||||
clipboard.write({
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
clipboard.writeBookmark({
|
||||
text: 'https://electronjs.org',
|
||||
bookmark: 'Electron Homepage'
|
||||
})
|
||||
@@ -110,39 +156,50 @@ clipboard.write({
|
||||
|
||||
### `clipboard.readFindText()` _macOS_
|
||||
|
||||
Returns `String` - The text on the find pasteboard. This method uses synchronous
|
||||
IPC when called from the renderer process. The cached value is reread from the
|
||||
find pasteboard whenever the application is activated.
|
||||
Returns `String` - The text on the find pasteboard, which is the pasteboard that holds information about the current state of the active application’s find panel.
|
||||
|
||||
This method uses synchronous IPC when called from the renderer process.
|
||||
The cached value is reread from the find pasteboard whenever the application is activated.
|
||||
|
||||
### `clipboard.writeFindText(text)` _macOS_
|
||||
|
||||
* `text` String
|
||||
|
||||
Writes the `text` into the find pasteboard as plain text. This method uses
|
||||
synchronous IPC when called from the renderer process.
|
||||
Writes the `text` into the find pasteboard (the pasteboard that holds information about the current state of the active application’s find panel) as plain text. This method uses synchronous IPC when called from the renderer process.
|
||||
|
||||
### `clipboard.clear([type])`
|
||||
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Clears the clipboard content.
|
||||
|
||||
### `clipboard.availableFormats([type])`
|
||||
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Returns `String[]` - An array of supported formats for the clipboard `type`.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
const formats = clipboard.availableFormats()
|
||||
console.log(formats)
|
||||
// [ 'text/plain', 'text/html' ]
|
||||
```
|
||||
|
||||
### `clipboard.has(format[, type])` _Experimental_
|
||||
|
||||
* `format` String
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Returns `Boolean` - Whether the clipboard supports the specified `format`.
|
||||
|
||||
```javascript
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
console.log(clipboard.has('<p>selection</p>'))
|
||||
|
||||
const hasFormat = clipboard.has('<p>selection</p>')
|
||||
console.log(hasFormat)
|
||||
// 'true' or 'false
|
||||
```
|
||||
|
||||
### `clipboard.read(format)` _Experimental_
|
||||
@@ -157,14 +214,33 @@ Returns `String` - Reads `format` type from the clipboard.
|
||||
|
||||
Returns `Buffer` - Reads `format` type from the clipboard.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
const buffer = Buffer.from('this is binary', 'utf8')
|
||||
clipboard.writeBuffer('public.utf8-plain-text', buffer)
|
||||
|
||||
const ret = clipboard.readBuffer('public.utf8-plain-text')
|
||||
|
||||
console.log(buffer.equals(out))
|
||||
// true
|
||||
```
|
||||
|
||||
### `clipboard.writeBuffer(format, buffer[, type])` _Experimental_
|
||||
|
||||
* `format` String
|
||||
* `buffer` Buffer
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
Writes the `buffer` into the clipboard as `format`.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
const buffer = Buffer.from('writeBuffer', 'utf8')
|
||||
clipboard.writeBuffer('public.utf8-plain-text', buffer)
|
||||
```
|
||||
|
||||
### `clipboard.write(data[, type])`
|
||||
|
||||
* `data` Object
|
||||
@@ -173,10 +249,29 @@ Writes the `buffer` into the clipboard as `format`.
|
||||
* `image` [NativeImage](native-image.md) (optional)
|
||||
* `rtf` String (optional)
|
||||
* `bookmark` String (optional) - The title of the URL at `text`.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`. `selection` is only available on Linux.
|
||||
* `type` String (optional) - Can be `selection` or `clipboard`; default is 'clipboard'. `selection` is only available on Linux.
|
||||
|
||||
```javascript
|
||||
const { clipboard } = require('electron')
|
||||
clipboard.write({ text: 'test', html: '<b>test</b>' })
|
||||
```
|
||||
Writes `data` to the clipboard.
|
||||
|
||||
```js
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
clipboard.write({
|
||||
text: 'test',
|
||||
html: '<b>Hi</b>',
|
||||
rtf: '{\\rtf1\\utf8 text}',
|
||||
bookmark: 'a title'
|
||||
})
|
||||
|
||||
console.log(clipboard.readText())
|
||||
// 'test'
|
||||
|
||||
console.log(clipboard.readHTML())
|
||||
// <meta charset='utf-8'><b>Hi</b>
|
||||
|
||||
console.log(clipboard.readRTF())
|
||||
// '{\\rtf1\\utf8 text}'
|
||||
|
||||
console.log(clipboard.readBookmark())
|
||||
// { title: 'a title', url: 'test' }
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Supported Chrome Command Line Switches
|
||||
# Supported Command Line Switches
|
||||
|
||||
> Command line switches supported by Electron.
|
||||
|
||||
@@ -28,6 +28,10 @@ Disables the disk cache for HTTP requests.
|
||||
|
||||
Disable HTTP/2 and SPDY/3.1 protocols.
|
||||
|
||||
### --disable-ntlm-v2
|
||||
|
||||
Disables NTLM v2 for posix platforms, no effect elsewhere.
|
||||
|
||||
## --lang
|
||||
|
||||
Set a custom locale.
|
||||
@@ -181,6 +185,17 @@ logging level for all code in the source files under a `foo/bar` directory.
|
||||
|
||||
This switch only works when `--enable-logging` is also passed.
|
||||
|
||||
## --enable-api-filtering-logging
|
||||
|
||||
Enables caller stack logging for the following APIs (filtering events):
|
||||
- `desktopCapturer.getSources()` / `desktop-capturer-get-sources`
|
||||
- `remote.require()` / `remote-require`
|
||||
- `remote.getGlobal()` / `remote-get-builtin`
|
||||
- `remote.getBuiltin()` / `remote-get-global`
|
||||
- `remote.getCurrentWindow()` / `remote-get-current-window`
|
||||
- `remote.getCurrentWebContents()` / `remote-get-current-web-contents`
|
||||
- `remote.getGuestWebContents()` / `remote-get-guest-web-contents`
|
||||
|
||||
## --no-sandbox
|
||||
|
||||
Disables Chromium sandbox, which is now enabled by default.
|
||||
@@ -12,7 +12,7 @@ app.commandLine.hasSwitch('disable-gpu')
|
||||
```
|
||||
|
||||
For more information on what kinds of flags and switches you can use, check
|
||||
out the [Chrome Command Line Switches](./chrome-command-line-switches.md)
|
||||
out the [Command Line Switches](./command-line-switches.md)
|
||||
document.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
@@ -38,6 +38,9 @@ Get a set of category groups. The category groups can change as new code paths
|
||||
are reached. See also the [list of built-in tracing
|
||||
categories](https://chromium.googlesource.com/chromium/src/+/master/base/trace_event/builtin_categories.h).
|
||||
|
||||
> **NOTE:** Electron adds a non-default tracing category called `"electron"`.
|
||||
> This category can be used to capture Electron-specific tracing events.
|
||||
|
||||
### `contentTracing.startRecording(options)`
|
||||
|
||||
* `options` ([TraceConfig](structures/trace-config.md) | [TraceCategoriesAndOptions](structures/trace-categories-and-options.md))
|
||||
@@ -74,6 +77,9 @@ will be returned in the promise.
|
||||
|
||||
Returns `Promise<Object>` - Resolves with an object containing the `value` and `percentage` of trace buffer maximum usage
|
||||
|
||||
* `value` Number
|
||||
* `percentage` Number
|
||||
|
||||
Get the maximum usage across processes of trace buffer as a percentage of the
|
||||
full state.
|
||||
|
||||
|
||||
112
docs/api/context-bridge.md
Normal file
112
docs/api/context-bridge.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# contextBridge
|
||||
|
||||
> Create a safe, bi-directional, synchronous bridge across isolated contexts
|
||||
|
||||
Process: [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
An example of exposing an API to a renderer from an isolated preload script is given below:
|
||||
|
||||
```javascript
|
||||
// Preload (Isolated World)
|
||||
const { contextBridge, ipcRenderer } = require('electron')
|
||||
|
||||
contextBridge.exposeInMainWorld(
|
||||
'electron',
|
||||
{
|
||||
doThing: () => ipcRenderer.send('do-a-thing')
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
```javascript
|
||||
// Renderer (Main World)
|
||||
|
||||
window.electron.doThing()
|
||||
```
|
||||
|
||||
## Glossary
|
||||
|
||||
### Main World
|
||||
|
||||
The "Main World" is the JavaScript context that your main renderer code runs in. By default, the
|
||||
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
|
||||
"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.
|
||||
|
||||
## Methods
|
||||
|
||||
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.
|
||||
|
||||
## Usage
|
||||
|
||||
### API Objects
|
||||
|
||||
The `api` object provided to [`exposeInMainWorld`](#contextbridgeexposeinmainworldapikey-api-experimental) must be an object
|
||||
whose keys are strings and values are a `Function`, `String`, `Number`, `Array`, `Boolean`, or another nested object that meets the same conditions.
|
||||
|
||||
`Function` values are proxied to the other context and all other values are **copied** and **frozen**. Any data / primitives sent in
|
||||
the API object become immutable and updates on either side of the bridge do not result in an update on the other side.
|
||||
|
||||
An example of a complex API object is shown below:
|
||||
|
||||
```javascript
|
||||
const { contextBridge } = require('electron')
|
||||
|
||||
contextBridge.exposeInMainWorld(
|
||||
'electron',
|
||||
{
|
||||
doThing: () => ipcRenderer.send('do-a-thing'),
|
||||
myPromises: [Promise.resolve(), Promise.reject(new Error('whoops'))],
|
||||
anAsyncFunction: async () => 123,
|
||||
data: {
|
||||
myFlags: ['a', 'b', 'c'],
|
||||
bootTime: 1234
|
||||
},
|
||||
nestedAPI: {
|
||||
evenDeeper: {
|
||||
youCanDoThisAsMuchAsYouWant: {
|
||||
fn: () => ({
|
||||
returnData: 123
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
### API Functions
|
||||
|
||||
`Function` values that you bind through the `contextBridge` are proxied through Electron to ensure that contexts remain isolated. This
|
||||
results in some key limitations that we've outlined below.
|
||||
|
||||
#### Parameter / Error / Return Type support
|
||||
|
||||
Because parameters, errors and return values are **copied** when they are sent over the bridge, there are only certain types that can be used.
|
||||
At a high level, if the type you want to use can be serialized and deserialized into the same object it will work. A table of type support
|
||||
has been included below for completeness:
|
||||
|
||||
| Type | Complexity | Parameter Support | Return Value Support | Limitations |
|
||||
| ---- | ---------- | ----------------- | -------------------- | ----------- |
|
||||
| `String` | Simple | ✅ | ✅ | N/A |
|
||||
| `Number` | Simple | ✅ | ✅ | N/A |
|
||||
| `Boolean` | Simple | ✅ | ✅ | N/A |
|
||||
| `Object` | Complex | ✅ | ✅ | Keys must be supported using only "Simple" types in this table. Values must be supported in this table. Prototype modifications are dropped. Sending custom classes will copy values but not the prototype. |
|
||||
| `Array` | Complex | ✅ | ✅ | Same limitations as the `Object` type |
|
||||
| `Error` | Complex | ✅ | ✅ | Errors that are thrown are also copied, this can result in the message and stack trace of the error changing slightly due to being thrown in a different context |
|
||||
| `Promise` | Complex | ✅ | ✅ | Promises are only proxied if they are the return value or exact parameter. Promises nested in arrays or objects will be dropped. |
|
||||
| `Function` | Complex | ✅ | ✅ | Prototype modifications are dropped. Sending classes or constructors will not work. |
|
||||
| [Cloneable Types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) | Simple | ✅ | ✅ | See the linked document on cloneable types |
|
||||
| `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.
|
||||
@@ -48,7 +48,7 @@ The `crashReporter` module has the following methods:
|
||||
* `productName` String (optional) - Defaults to `app.name`.
|
||||
* `uploadToServer` Boolean (optional) - Whether crash reports should be sent to the server. Default is `true`.
|
||||
* `ignoreSystemCrashHandler` Boolean (optional) - Default is `false`.
|
||||
* `extra` Object (optional) - An object you can define that will be sent along with the
|
||||
* `extra` Record<String, String> (optional) - An object you can define that will be sent along with the
|
||||
report. Only string properties are sent correctly. Nested objects are not
|
||||
supported. When using Windows, the property names and values must be fewer than 64 characters.
|
||||
* `crashesDirectory` String (optional) - Directory to store the crash reports temporarily (only used when the crash reporter is started via `process.crashReporter.start`).
|
||||
@@ -119,6 +119,10 @@ Remove a extra parameter from the current set of parameters so that it will not
|
||||
|
||||
See all of the current parameters being passed to the crash reporter.
|
||||
|
||||
### `crashReporter.getCrashesDirectory()`
|
||||
|
||||
Returns `String` - The directory where crashes are temporarily stored before being uploaded.
|
||||
|
||||
## Crash Report Payload
|
||||
|
||||
The crash reporter will send the following data to the `submitURL` as
|
||||
|
||||
@@ -50,8 +50,10 @@ Returns:
|
||||
|
||||
* `event` Event
|
||||
* `method` String - Method name.
|
||||
* `params` Object - Event parameters defined by the 'parameters'
|
||||
* `params` any - Event parameters defined by the 'parameters'
|
||||
attribute in the remote debugging protocol.
|
||||
* `sessionId` String - Unique identifier of attached debugging session,
|
||||
will match the value sent from `debugger.sendCommand`.
|
||||
|
||||
Emitted whenever the debugging target issues an instrumentation event.
|
||||
|
||||
@@ -74,11 +76,16 @@ Returns `Boolean` - Whether a debugger is attached to the `webContents`.
|
||||
|
||||
Detaches the debugger from the `webContents`.
|
||||
|
||||
#### `debugger.sendCommand(method[, commandParams])`
|
||||
#### `debugger.sendCommand(method[, commandParams, sessionId])`
|
||||
|
||||
* `method` String - Method name, should be one of the methods defined by the
|
||||
[remote debugging protocol][rdp].
|
||||
* `commandParams` Object (optional) - JSON object with request parameters.
|
||||
* `commandParams` any (optional) - JSON object with request parameters.
|
||||
* `sessionId` String (optional) - send command to the target with associated
|
||||
debugging session id. The initial value can be obtained by sending
|
||||
[Target.attachToTarget][attachToTarget] message.
|
||||
|
||||
[attachToTarget]: https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget
|
||||
|
||||
Returns `Promise<any>` - A promise that resolves with the response defined by
|
||||
the 'returns' attribute of the command description in the remote debugging protocol
|
||||
|
||||
@@ -91,7 +91,11 @@ The `desktopCapturer` module has the following methods:
|
||||
|
||||
Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`DesktopCapturerSource`](structures/desktop-capturer-source.md) objects, each `DesktopCapturerSource` represents a screen or an individual window that can be captured.
|
||||
|
||||
**Note** Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
|
||||
which can detected by [`systemPreferences.getMediaAccessStatus`].
|
||||
|
||||
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
|
||||
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-macos
|
||||
|
||||
## Caveats
|
||||
|
||||
|
||||
@@ -48,10 +48,13 @@ The `dialog` module has the following methods:
|
||||
their target path.
|
||||
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
||||
as a directory instead of a file.
|
||||
* `dontAddToRecent` _Windows_ - Do not add the item being opened to the recent documents list.
|
||||
* `message` String (optional) _macOS_ - Message to display above input
|
||||
boxes.
|
||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
|
||||
|
||||
Returns `String[] | undefined`, the file paths chosen by the user; if the dialog is cancelled it returns `undefined`.
|
||||
|
||||
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
|
||||
|
||||
The `filters` specifies an array of file types that can be displayed or
|
||||
@@ -108,6 +111,7 @@ dialog.showOpenDialogSync(mainWindow, {
|
||||
their target path.
|
||||
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
||||
as a directory instead of a file.
|
||||
* `dontAddToRecent` _Windows_ - Do not add the item being opened to the recent documents list.
|
||||
* `message` String (optional) _macOS_ - Message to display above input
|
||||
boxes.
|
||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create [security scoped bookmarks](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store.
|
||||
@@ -116,7 +120,7 @@ Returns `Promise<Object>` - Resolve with an object containing the following:
|
||||
|
||||
* `canceled` Boolean - whether or not the dialog was canceled.
|
||||
* `filePaths` String[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.
|
||||
* `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the `filePaths` array of base64 encoded strings which contains security scoped bookmark data. `securityScopedBookmarks` must be enabled for this to be populated.
|
||||
* `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the `filePaths` array of base64 encoded strings which contains security scoped bookmark data. `securityScopedBookmarks` must be enabled for this to be populated. (For return values, see [table here](#bookmarks-array).)
|
||||
|
||||
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
|
||||
|
||||
@@ -169,6 +173,13 @@ dialog.showOpenDialog(mainWindow, {
|
||||
displayed in front of the filename text field.
|
||||
* `showsTagField` Boolean (optional) _macOS_ - Show the tags input box,
|
||||
defaults to `true`.
|
||||
* `properties` String[] (optional)
|
||||
* `showHiddenFiles` - Show hidden files in dialog.
|
||||
* `createDirectory` _macOS_ - Allow creating new directories from dialog.
|
||||
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
||||
as a directory instead of a file.
|
||||
* `showOverwriteConfirmation` _Linux_ - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.
|
||||
* `dontAddToRecent` _Windows_ - Do not add the item being saved to the recent documents list.
|
||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
|
||||
|
||||
Returns `String | undefined`, the path of the file chosen by the user; if the dialog is cancelled it returns `undefined`.
|
||||
@@ -191,14 +202,20 @@ The `filters` specifies an array of file types that can be displayed, see
|
||||
* `message` String (optional) _macOS_ - Message to display above text fields.
|
||||
* `nameFieldLabel` String (optional) _macOS_ - Custom label for the text
|
||||
displayed in front of the filename text field.
|
||||
* `showsTagField` Boolean (optional) _macOS_ - Show the tags input box,
|
||||
defaults to `true`.
|
||||
* `showsTagField` Boolean (optional) _macOS_ - Show the tags input box, defaults to `true`.
|
||||
* `properties` String[] (optional)
|
||||
* `showHiddenFiles` - Show hidden files in dialog.
|
||||
* `createDirectory` _macOS_ - Allow creating new directories from dialog.
|
||||
* `treatPackageAsDirectory` _macOS_ - Treat packages, such as `.app` folders,
|
||||
as a directory instead of a file.
|
||||
* `showOverwriteConfirmation` _Linux_ - Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists.
|
||||
* `dontAddToRecent` _Windows_ - Do not add the item being saved to the recent documents list.
|
||||
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
|
||||
|
||||
Returns `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.
|
||||
* `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.
|
||||
|
||||
@@ -227,7 +244,7 @@ expanding and collapsing the dialog.
|
||||
include a checkbox with the given label.
|
||||
* `checkboxChecked` Boolean (optional) - Initial checked state of the
|
||||
checkbox. `false` by default.
|
||||
* `icon` [NativeImage](native-image.md) (optional)
|
||||
* `icon` ([NativeImage](native-image.md) | String) (optional)
|
||||
* `cancelId` Integer (optional) - The index of the button to be used to cancel the dialog, via
|
||||
the `Esc` key. By default this is assigned to the first button with "cancel" or "no" as the
|
||||
label. If no such labeled buttons exist and this option is not set, `0` will be used as the
|
||||
@@ -252,6 +269,7 @@ Shows a message box, it will block the process until the message box is closed.
|
||||
It returns the index of the clicked button.
|
||||
|
||||
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
|
||||
If `browserWindow` is not shown dialog will not be attached to it. In such case It will be displayed as independed window.
|
||||
|
||||
### `dialog.showMessageBox([browserWindow, ]options)`
|
||||
|
||||
@@ -333,6 +351,17 @@ On Windows the options are more limited, due to the Win32 APIs used:
|
||||
* The `browserWindow` argument is ignored since it is not possible to make
|
||||
this confirmation dialog modal.
|
||||
|
||||
## Bookmarks array
|
||||
|
||||
`showOpenDialog`, `showOpenDialogSync`, `showSaveDialog`, and `showSaveDialogSync` will return a `bookmarks` array.
|
||||
|
||||
| Build Type | securityScopedBookmarks boolean | Return Type | Return Value |
|
||||
|------------|---------------------------------|:-----------:|--------------------------------|
|
||||
| macOS mas | True | Success | `['LONGBOOKMARKSTRING']` |
|
||||
| macOS mas | True | Error | `['']` (array of empty string) |
|
||||
| macOS mas | False | NA | `[]` (empty array) |
|
||||
| non mas | any | NA | `[]` (empty array) |
|
||||
|
||||
## Sheets
|
||||
|
||||
On macOS, dialogs are presented as sheets attached to a window if you provide
|
||||
|
||||
@@ -18,6 +18,8 @@ app.dock.bounce()
|
||||
* `type` String (optional) - Can be `critical` or `informational`. The default is
|
||||
`informational`
|
||||
|
||||
Returns `Integer` - an ID representing the request.
|
||||
|
||||
When `critical` is passed, the dock icon will bounce until either the
|
||||
application becomes active or the request is canceled.
|
||||
|
||||
@@ -25,7 +27,7 @@ When `informational` is passed, the dock icon will bounce for one second.
|
||||
However, the request remains active until either the application becomes active
|
||||
or the request is canceled.
|
||||
|
||||
Returns `Integer` an ID representing the request.
|
||||
**Nota Bene:** This method can only be used while the app is not focused; when the app is focused it will return -1.
|
||||
|
||||
#### `dock.cancelBounce(id)` _macOS_
|
||||
|
||||
|
||||
@@ -82,16 +82,12 @@ The API is only available in session's `will-download` callback function.
|
||||
If user doesn't set the save path via the API, Electron will use the original
|
||||
routine to determine the save path; this usually prompts a save dialog.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md): use the `savePath` property instead.**
|
||||
|
||||
#### `downloadItem.getSavePath()`
|
||||
|
||||
Returns `String` - The save path of the download item. This will be either the path
|
||||
set via `downloadItem.setSavePath(path)` or the path selected from the shown
|
||||
save dialog.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md): use the `savePath` property instead.**
|
||||
|
||||
#### `downloadItem.setSaveDialogOptions(options)`
|
||||
|
||||
* `options` SaveDialogOptions - Set the save file dialog options. This object has the same
|
||||
|
||||
@@ -44,7 +44,12 @@ Unsupported options are:
|
||||
--use-openssl-ca
|
||||
```
|
||||
|
||||
`NODE_OPTIONS` are explicitly disallowed in packaged apps.
|
||||
`NODE_OPTIONS` are explicitly disallowed in packaged apps, except for the following:
|
||||
|
||||
```sh
|
||||
--max-http-header-size
|
||||
--http-parser
|
||||
```
|
||||
|
||||
### `GOOGLE_API_KEY`
|
||||
|
||||
@@ -123,3 +128,14 @@ the one downloaded by `npm install`. Usage:
|
||||
```sh
|
||||
export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Debug
|
||||
```
|
||||
|
||||
## Set By Electron
|
||||
|
||||
Electron sets some variables in your environment at runtime.
|
||||
|
||||
### `ORIGINAL_XDG_CURRENT_DESKTOP`
|
||||
|
||||
This variable is set to the value of `XDG_CURRENT_DESKTOP` that your application
|
||||
originally launched with. Electron sometimes modifies the value of `XDG_CURRENT_DESKTOP`
|
||||
to affect other logic within Chromium so if you want access to the _original_ value
|
||||
you should look up this environment variable instead.
|
||||
|
||||
@@ -51,7 +51,7 @@ A `String` representing the HTTP status message.
|
||||
|
||||
#### `response.headers`
|
||||
|
||||
An `Object` representing the response HTTP headers. The `headers` object is
|
||||
An `Record<string, string[]>` representing the response HTTP headers. The `headers` object is
|
||||
formatted as follows:
|
||||
|
||||
* All header names are lowercased.
|
||||
|
||||
@@ -77,6 +77,7 @@ only the next time a message is sent to `channel`, after which it is removed.
|
||||
|
||||
* `channel` String
|
||||
* `listener` Function
|
||||
* `...args` any[]
|
||||
|
||||
Removes the specified `listener` from the listener array for the specified
|
||||
`channel`.
|
||||
@@ -90,7 +91,7 @@ Removes listeners of the specified `channel`.
|
||||
### `ipcMain.handle(channel, listener)`
|
||||
|
||||
* `channel` String
|
||||
* `listener` Function<Promise> | Function<any>
|
||||
* `listener` Function<Promise<void> | any>
|
||||
* `event` IpcMainInvokeEvent
|
||||
* `...args` any[]
|
||||
|
||||
@@ -122,7 +123,7 @@ WebContents is the source of the invoke request.
|
||||
### `ipcMain.handleOnce(channel, listener)`
|
||||
|
||||
* `channel` String
|
||||
* `listener` Function<Promise> | Function<any>
|
||||
* `listener` Function<Promise<void> | any>
|
||||
* `event` IpcMainInvokeEvent
|
||||
* `...args` any[]
|
||||
|
||||
@@ -147,4 +148,4 @@ found in the [`ipc-main-invoke-event`](structures/ipc-main-invoke-event.md)
|
||||
structure docs.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[web-contents-send]: web-contents.md#contentssendchannel-args
|
||||
[web-contents-send]: web-contents.md#contentssendchannel-arg1-arg2-
|
||||
|
||||
@@ -55,9 +55,15 @@ Removes all listeners, or those of the specified `channel`.
|
||||
* `channel` String
|
||||
* `...args` any[]
|
||||
|
||||
Send a message to the main process asynchronously via `channel`, you can also
|
||||
send arbitrary arguments. Arguments will be serialized as JSON internally and
|
||||
hence no functions or prototype chain will be included.
|
||||
Send an asynchronous message to the main process via `channel`, along with
|
||||
arguments. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
|
||||
> special Electron objects is deprecated, and will begin throwing an exception
|
||||
> starting with Electron 9.
|
||||
|
||||
The main process handles it by listening for `channel` with the
|
||||
[`ipcMain`](ipc-main.md) module.
|
||||
@@ -69,9 +75,15 @@ The main process handles it by listening for `channel` with the
|
||||
|
||||
Returns `Promise<any>` - Resolves with the response from the main process.
|
||||
|
||||
Send a message to the main process asynchronously via `channel` and expect an
|
||||
asynchronous result. Arguments will be serialized as JSON internally and
|
||||
hence no functions or prototype chain will be included.
|
||||
Send a message to the main process via `channel` and expect a result
|
||||
asynchronously. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
|
||||
> special Electron objects is deprecated, and will begin throwing an exception
|
||||
> starting with Electron 9.
|
||||
|
||||
The main process should listen for `channel` with
|
||||
[`ipcMain.handle()`](ipc-main.md#ipcmainhandlechannel-listener).
|
||||
@@ -97,15 +109,23 @@ ipcMain.handle('some-name', async (event, someArgument) => {
|
||||
|
||||
Returns `any` - The value sent back by the [`ipcMain`](ipc-main.md) handler.
|
||||
|
||||
Send a message to the main process synchronously via `channel`, you can also
|
||||
send arbitrary arguments. Arguments will be serialized in JSON internally and
|
||||
hence no functions or prototype chain will be included.
|
||||
Send a message to the main process via `channel` and expect a result
|
||||
synchronously. Arguments will be serialized with the [Structured Clone
|
||||
Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
|
||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||
throw an exception.
|
||||
|
||||
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
|
||||
> special Electron objects is deprecated, and will begin throwing an exception
|
||||
> starting with Electron 9.
|
||||
|
||||
The main process handles it by listening for `channel` with [`ipcMain`](ipc-main.md) module,
|
||||
and replies by setting `event.returnValue`.
|
||||
|
||||
**Note:** Sending a synchronous message will block the whole renderer process,
|
||||
unless you know what you are doing you should never use it.
|
||||
> :warning: **WARNING**: Sending a synchronous message will block the whole
|
||||
> renderer process until the reply is received, so use this method only as a
|
||||
> last resort. It's much better to use the asynchronous version,
|
||||
> [`invoke()`](ipc-renderer.md#ipcrendererinvokechannel-args).
|
||||
|
||||
### `ipcRenderer.sendTo(webContentsId, channel, ...args)`
|
||||
|
||||
@@ -129,3 +149,5 @@ The documentation for the `event` object passed to the `callback` can be found
|
||||
in the [`ipc-renderer-event`](structures/ipc-renderer-event.md) structure docs.
|
||||
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||
|
||||
@@ -12,9 +12,9 @@ See [`Menu`](menu.md) for examples.
|
||||
* `click` Function (optional) - Will be called with
|
||||
`click(menuItem, browserWindow, event)` when the menu item is clicked.
|
||||
* `menuItem` MenuItem
|
||||
* `browserWindow` [BrowserWindow](browser-window.md)
|
||||
* `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`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
* `role` String (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||
`click` property will be ignored. See [roles](#roles).
|
||||
* `type` String (optional) - Can be `normal`, `separator`, `submenu`, `checkbox` or
|
||||
`radio`.
|
||||
@@ -69,6 +69,7 @@ a `type`.
|
||||
The `role` property can have following values:
|
||||
|
||||
* `undo`
|
||||
* `about` - Trigger a native about panel (custom message box on Window, which does not provide its own).
|
||||
* `redo`
|
||||
* `cut`
|
||||
* `copy`
|
||||
@@ -82,7 +83,7 @@ The `role` property can have following values:
|
||||
* `reload` - Reload the current window.
|
||||
* `forceReload` - Reload the current window ignoring the cache.
|
||||
* `toggleDevTools` - Toggle developer tools in the current window.
|
||||
* `toggleFullScreen` - Toggle full screen mode on the current window.
|
||||
* `togglefullscreen` - Toggle full screen mode on the current window.
|
||||
* `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%.
|
||||
@@ -94,7 +95,6 @@ The `role` property can have following values:
|
||||
The following additional roles are available on _macOS_:
|
||||
|
||||
* `appMenu` - Whole default "App" menu (About, Services, etc.)
|
||||
* `about` - Map to the `orderFrontStandardAboutPanel` action.
|
||||
* `hide` - Map to the `hide` action.
|
||||
* `hideOthers` - Map to the `hideOtherApplications` action.
|
||||
* `unhide` - Map to the `unhideAllApplications` action.
|
||||
@@ -152,7 +152,7 @@ A `String` indicating the type of the item. Can be `normal`, `separator`, `subme
|
||||
|
||||
#### `menuItem.role`
|
||||
|
||||
A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteandmatchstyle`, `delete`, `selectall`, `reload`, `forcereload`, `toggledevtools`, `resetzoom`, `zoomin`, `zoomout`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideothers`, `unhide`, `quit`, `startspeaking`, `stopspeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu` or `windowMenu`
|
||||
A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`, `stopSpeaking`, `close`, `minimize`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
|
||||
|
||||
#### `menuItem.accelerator`
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
The Electron team is currently undergoing an initiative to convert callback-based functions in Electron to return Promises. During this transition period, both the callback and Promise-based versions of these functions will work correctly, and will both be documented.
|
||||
|
||||
To enable deprecation warnings for these updated functions, use the `process.enablePromiseAPI` runtime flag.
|
||||
To enable deprecation warnings for these updated functions, use the [`process.enablePromiseAPIs` runtime flag](../process.md#processenablepromiseapis).
|
||||
|
||||
When a majority of affected functions are migrated, this flag will be enabled by default and all developers will be able to see these deprecation warnings. At that time, the callback-based versions will also be removed from documentation. This document will be continuously updated as more functions are converted.
|
||||
|
||||
|
||||
@@ -45,9 +45,3 @@ The Electron team is currently undergoing an initiative to convert separate gett
|
||||
* `isMacTemplateImage`
|
||||
* `SystemPreferences` module
|
||||
* `appLevelAppearance`
|
||||
* `webContents` module
|
||||
* `audioMuted`
|
||||
* `frameRate`
|
||||
* `userAgent`
|
||||
* `zoomFactor`
|
||||
* `zoomLevel`
|
||||
|
||||
@@ -14,11 +14,11 @@ image file path as a `String`:
|
||||
const { BrowserWindow, Tray } = require('electron')
|
||||
|
||||
const appIcon = new Tray('/Users/somebody/images/icon.png')
|
||||
let win = new BrowserWindow({ icon: '/Users/somebody/images/window.png' })
|
||||
const win = new BrowserWindow({ icon: '/Users/somebody/images/window.png' })
|
||||
console.log(appIcon, win)
|
||||
```
|
||||
|
||||
Or read the image from the clipboard which returns a `NativeImage`:
|
||||
Or read the image from the clipboard, which returns a `NativeImage`:
|
||||
|
||||
```javascript
|
||||
const { clipboard, Tray } = require('electron')
|
||||
@@ -33,19 +33,19 @@ Currently `PNG` and `JPEG` image formats are supported. `PNG` is recommended
|
||||
because of its support for transparency and lossless compression.
|
||||
|
||||
On Windows, you can also load `ICO` icons from file paths. For best visual
|
||||
quality it is recommended to include at least the following sizes in the:
|
||||
quality, it is recommended to include at least the following sizes in the:
|
||||
|
||||
* Small icon
|
||||
* 16x16 (100% DPI scale)
|
||||
* 20x20 (125% DPI scale)
|
||||
* 24x24 (150% DPI scale)
|
||||
* 32x32 (200% DPI scale)
|
||||
* 16x16 (100% DPI scale)
|
||||
* 20x20 (125% DPI scale)
|
||||
* 24x24 (150% DPI scale)
|
||||
* 32x32 (200% DPI scale)
|
||||
* Large icon
|
||||
* 32x32 (100% DPI scale)
|
||||
* 40x40 (125% DPI scale)
|
||||
* 48x48 (150% DPI scale)
|
||||
* 64x64 (200% DPI scale)
|
||||
* 256x256
|
||||
* 32x32 (100% DPI scale)
|
||||
* 40x40 (125% DPI scale)
|
||||
* 48x48 (150% DPI scale)
|
||||
* 64x64 (200% DPI scale)
|
||||
* 256x256
|
||||
|
||||
Check the *Size requirements* section in [this article][icons].
|
||||
|
||||
@@ -56,7 +56,7 @@ Check the *Size requirements* section in [this article][icons].
|
||||
On platforms that have high-DPI support such as Apple Retina displays, you can
|
||||
append `@2x` after image's base filename to mark it as a high resolution image.
|
||||
|
||||
For example if `icon.png` is a normal image that has standard resolution, then
|
||||
For example, if `icon.png` is a normal image that has standard resolution, then
|
||||
`icon@2x.png` will be treated as a high resolution image that has double DPI
|
||||
density.
|
||||
|
||||
@@ -73,11 +73,11 @@ images/
|
||||
|
||||
```javascript
|
||||
const { Tray } = require('electron')
|
||||
let appIcon = new Tray('/Users/somebody/images/icon.png')
|
||||
const appIcon = new Tray('/Users/somebody/images/icon.png')
|
||||
console.log(appIcon)
|
||||
```
|
||||
|
||||
Following suffixes for DPI are also supported:
|
||||
The following suffixes for DPI are also supported:
|
||||
|
||||
* `@1x`
|
||||
* `@1.25x`
|
||||
@@ -97,7 +97,7 @@ Template images consist of black and an alpha channel.
|
||||
Template images are not intended to be used as standalone images and are usually
|
||||
mixed with other content to create the desired final appearance.
|
||||
|
||||
The most common case is to use template images for a menu bar icon so it can
|
||||
The most common case is to use template images for a menu bar icon, so it can
|
||||
adapt to both light and dark menu bars.
|
||||
|
||||
**Note:** Template image is only supported on macOS.
|
||||
@@ -132,7 +132,7 @@ a valid image.
|
||||
```javascript
|
||||
const nativeImage = require('electron').nativeImage
|
||||
|
||||
let image = nativeImage.createFromPath('/Users/somebody/images/icon.png')
|
||||
const image = nativeImage.createFromPath('/Users/somebody/images/icon.png')
|
||||
console.log(image)
|
||||
```
|
||||
|
||||
@@ -180,7 +180,8 @@ Creates a new `NativeImage` instance from the NSImage that maps to the
|
||||
given image name. See [`System Icons`](https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/system-icons/)
|
||||
for a list of possible values.
|
||||
|
||||
The `hslShift` is applied to the image with the following rules
|
||||
The `hslShift` is applied to the image with the following rules:
|
||||
|
||||
* `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map
|
||||
to 0 and 360 on the hue color wheel (red).
|
||||
* `hsl_shift[1]` (saturation): A saturation shift for the image, with the
|
||||
@@ -248,9 +249,9 @@ Returns `String` - The data URL of the image.
|
||||
|
||||
Returns `Buffer` - A [Buffer][buffer] that contains the image's raw bitmap pixel data.
|
||||
|
||||
The difference between `getBitmap()` and `toBitmap()` is, `getBitmap()` does not
|
||||
The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does not
|
||||
copy the bitmap data, so you have to use the returned Buffer immediately in
|
||||
current event loop tick, otherwise the data might be changed or destroyed.
|
||||
current event loop tick; otherwise the data might be changed or destroyed.
|
||||
|
||||
#### `image.getNativeHandle()` _macOS_
|
||||
|
||||
@@ -275,14 +276,10 @@ Returns [`Size`](structures/size.md)
|
||||
|
||||
Marks the image as a template image.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `image.isTemplateImage()`
|
||||
|
||||
Returns `Boolean` - Whether the image is a template image.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `image.crop(rect)`
|
||||
|
||||
* `rect` [Rectangle](structures/rectangle.md) - The area of the image to crop.
|
||||
@@ -295,7 +292,7 @@ Returns `NativeImage` - The cropped image.
|
||||
* `width` Integer (optional) - Defaults to the image's width.
|
||||
* `height` Integer (optional) - Defaults to the image's height.
|
||||
* `quality` String (optional) - The desired quality of the resize image.
|
||||
Possible values are `good`, `better` or `best`. The default is `best`.
|
||||
Possible values are `good`, `better`, or `best`. The default is `best`.
|
||||
These values express a desired quality/speed tradeoff. They are translated
|
||||
into an algorithm-specific method that depends on the capabilities
|
||||
(CPU, GPU) of the underlying platform. It is possible for all three methods
|
||||
@@ -328,9 +325,9 @@ can be called on empty images.
|
||||
|
||||
[buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer
|
||||
|
||||
## Properties
|
||||
### Instance Properties
|
||||
|
||||
### `nativeImage.isMacTemplateImage` _macOS_
|
||||
#### `nativeImage.isMacTemplateImage` _macOS_
|
||||
|
||||
A `Boolean` property that determines whether the image is considered a [template image](https://developer.apple.com/documentation/appkit/nsimage/1520017-template).
|
||||
|
||||
|
||||
66
docs/api/native-theme.md
Normal file
66
docs/api/native-theme.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# nativeTheme
|
||||
|
||||
> Read and respond to changes in Chromium's native color theme.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
## Events
|
||||
|
||||
The `nativeTheme` module emits the following events:
|
||||
|
||||
### Event: 'updated'
|
||||
|
||||
Emitted when something in the underlying NativeTheme has changed. This normally
|
||||
means that either the value of `shouldUseDarkColors`,
|
||||
`shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed.
|
||||
You will have to check them to determine which one has changed.
|
||||
|
||||
## Properties
|
||||
|
||||
The `nativeTheme` module has the following properties:
|
||||
|
||||
### `nativeTheme.shouldUseDarkColors` _Readonly_
|
||||
|
||||
A `Boolean` for if the OS / Chromium currently has a dark mode enabled or is
|
||||
being instructed to show a dark-style UI. If you want to modify this value you
|
||||
should use `themeSource` below.
|
||||
|
||||
### `nativeTheme.themeSource`
|
||||
|
||||
A `String` property that can be `system`, `light` or `dark`. It is used to override and supercede
|
||||
the value that Chromium has chosen to use internally.
|
||||
|
||||
Setting this property to `system` will remove the override and
|
||||
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.
|
||||
* The [`prefers-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) CSS query will match `dark` mode.
|
||||
* 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.
|
||||
* The [`prefers-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) CSS query will match `light` mode.
|
||||
* The `updated` event will be emitted
|
||||
|
||||
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'`
|
||||
|
||||
Your application should then always use `shouldUseDarkColors` to determine what CSS to apply.
|
||||
|
||||
### `nativeTheme.shouldUseHighContrastColors` _macOS_ _Windows_ _Readonly_
|
||||
|
||||
A `Boolean` for if the OS / Chromium currently has high-contrast mode enabled
|
||||
or is being instructed to show a high-constrast UI.
|
||||
|
||||
### `nativeTheme.shouldUseInvertedColorScheme` _macOS_ _Windows_ _Readonly_
|
||||
|
||||
A `Boolean` for if the OS / Chromium currently has an inverted color scheme
|
||||
or is being instructed to use an inverted color scheme.
|
||||
@@ -15,7 +15,7 @@ app.on('ready', async () => {
|
||||
})
|
||||
```
|
||||
|
||||
See [`--log-net-log`](chrome-command-line-switches.md#--log-net-logpath) to log network events throughout the app's lifecycle.
|
||||
See [`--log-net-log`](command-line-switches.md#--log-net-logpath) to log network events throughout the app's lifecycle.
|
||||
|
||||
**Note:** All methods unless specified can only be used after the `ready` event
|
||||
of the `app` module gets emitted.
|
||||
|
||||
@@ -54,7 +54,7 @@ The `net` module has the following methods:
|
||||
|
||||
### `net.request(options)`
|
||||
|
||||
* `options` (Object | String) - The `ClientRequest` constructor options.
|
||||
* `options` (ClientRequestConstructorOptions | String) - The `ClientRequest` constructor options.
|
||||
|
||||
Returns [`ClientRequest`](./client-request.md)
|
||||
|
||||
|
||||
@@ -35,8 +35,10 @@ Returns `Boolean` - Whether or not desktop notifications are supported on the cu
|
||||
* `silent` Boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.
|
||||
* `icon` (String | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
|
||||
* `hasReply` Boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
|
||||
* `timeoutType` String (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
|
||||
* `replyPlaceholder` String (optional) _macOS_ - The placeholder to write in the inline reply input field.
|
||||
* `sound` String (optional) _macOS_ - The name of the sound file to play when the notification is shown.
|
||||
* `urgency` String (optional) _Linux_ - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
|
||||
* `actions` [NotificationAction[]](structures/notification-action.md) (optional) _macOS_ - Actions to add to the notification. Please read the available actions and limitations in the `NotificationAction` documentation.
|
||||
* `closeButtonText` String (optional) _macOS_ - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.
|
||||
|
||||
@@ -144,6 +146,18 @@ A `Boolean` property representing whether the notification is silent.
|
||||
|
||||
A `Boolean` property representing whether the notification has a reply action.
|
||||
|
||||
#### `notification.urgency` _Linux_
|
||||
|
||||
A `String` property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.
|
||||
|
||||
Default is 'low' - see [NotifyUrgency](https://developer.gnome.org/notification-spec/#urgency-levels) for more information.
|
||||
|
||||
#### `notification.timeoutType` _Linux_ _Windows_
|
||||
|
||||
A `String` property representing the type of timeout duration for the notification. Can be 'default' or 'never'.
|
||||
|
||||
If `timeoutType` is set to 'never', the notification never expires. It stays open until closed by the calling API or the user.
|
||||
|
||||
#### `notification.actions`
|
||||
|
||||
A [`NotificationAction[]`](structures/notification-action.md) property representing the actions of the notification.
|
||||
|
||||
@@ -24,19 +24,19 @@ app.on('ready', () => {
|
||||
|
||||
The `powerMonitor` module emits the following events:
|
||||
|
||||
### Event: 'suspend'
|
||||
### Event: 'suspend' _macOS_ _Windows_
|
||||
|
||||
Emitted when the system is suspending.
|
||||
|
||||
### Event: 'resume'
|
||||
### Event: 'resume' _macOS_ _Windows_
|
||||
|
||||
Emitted when system is resuming.
|
||||
|
||||
### Event: 'on-ac' _Windows_
|
||||
### Event: 'on-ac' _macOS_ _Windows_
|
||||
|
||||
Emitted when the system changes to AC power.
|
||||
|
||||
### Event: 'on-battery' _Windows_
|
||||
### Event: 'on-battery' _macOS_ _Windows_
|
||||
|
||||
Emitted when system changes to battery power.
|
||||
|
||||
|
||||
@@ -217,11 +217,15 @@ that all statistics are reported in Kilobytes.
|
||||
|
||||
Returns `String` - The version of the host operating system.
|
||||
|
||||
Examples:
|
||||
Example:
|
||||
|
||||
* `macOS` -> `10.13.6`
|
||||
* `Windows` -> `10.0.17763`
|
||||
* `Linux` -> `4.15.0-45-generic`
|
||||
```js
|
||||
const version = process.getSystemVersion()
|
||||
console.log(version)
|
||||
// On macOS -> '10.13.6'
|
||||
// On Windows -> '10.0.17763'
|
||||
// On Linux -> '4.15.0-45-generic'
|
||||
```
|
||||
|
||||
**Note:** It returns the actual operating system version instead of kernel version on macOS unlike `os.release()`.
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ should be called with either a `String` or an object that has the `data`,
|
||||
* `redirectRequest` Object
|
||||
* `url` String
|
||||
* `method` String (optional)
|
||||
* `session` Object (optional)
|
||||
* `session` Session | null (optional)
|
||||
* `uploadData` [ProtocolResponseUploadData](structures/protocol-response-upload-data.md) (optional)
|
||||
* `completion` Function (optional)
|
||||
* `error` Error
|
||||
@@ -388,10 +388,8 @@ which sends a `Buffer` as a response.
|
||||
* `redirectRequest` Object
|
||||
* `url` String
|
||||
* `method` String (optional)
|
||||
* `session` Object | null (optional)
|
||||
* `uploadData` Object (optional)
|
||||
* `contentType` String - MIME type of the content.
|
||||
* `data` String - Content to be sent.
|
||||
* `session` Session | null (optional)
|
||||
* `uploadData` [ProtocolResponseUploadData](structures/protocol-response-upload-data.md) (optional)
|
||||
* `completion` Function (optional)
|
||||
* `error` Error
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ property, so writing `let { screen } = require('electron')` will not work.
|
||||
|
||||
An example of creating a window that fills the whole screen:
|
||||
|
||||
```javascript
|
||||
```javascript fiddle='docs/fiddles/screen/fit-screen'
|
||||
const { app, BrowserWindow, screen } = require('electron')
|
||||
|
||||
let win
|
||||
|
||||
@@ -91,6 +91,59 @@ session.defaultSession.on('will-download', (event, item, webContents) => {
|
||||
})
|
||||
```
|
||||
|
||||
#### Event: 'preconnect'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `preconnectUrl` String - The URL being requested for preconnection by the
|
||||
renderer.
|
||||
* `allowCredentials` Boolean - True if the renderer is requesting that the
|
||||
connection include credentials (see the
|
||||
[spec](https://w3c.github.io/resource-hints/#preconnect) for more details.)
|
||||
|
||||
Emitted when a render process requests preconnection to a URL, generally due to
|
||||
a [resource hint](https://w3c.github.io/resource-hints/).
|
||||
|
||||
#### Event: 'spellcheck-dictionary-initialized'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `languageCode` String - The language code of the dictionary file
|
||||
|
||||
Emitted when a hunspell dictionary file has been successfully initialized. This
|
||||
occurs after the file has been downloaded.
|
||||
|
||||
#### Event: 'spellcheck-dictionary-download-begin'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `languageCode` String - The language code of the dictionary file
|
||||
|
||||
Emitted when a hunspell dictionary file starts downloading
|
||||
|
||||
#### Event: 'spellcheck-dictionary-download-success'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `languageCode` String - The language code of the dictionary file
|
||||
|
||||
Emitted when a hunspell dictionary file has been successfully downloaded
|
||||
|
||||
#### Event: 'spellcheck-dictionary-download-failure'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `languageCode` String - The language code of the dictionary file
|
||||
|
||||
Emitted when a hunspell dictionary file download fails. For details
|
||||
on the failure you should collect a netlog and inspect the download
|
||||
request.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
The following methods are available on instances of `Session`:
|
||||
@@ -125,9 +178,9 @@ Writes any unwritten DOMStorage data to disk.
|
||||
#### `ses.setProxy(config)`
|
||||
|
||||
* `config` Object
|
||||
* `pacScript` String - The URL associated with the PAC file.
|
||||
* `proxyRules` String - Rules indicating which proxies to use.
|
||||
* `proxyBypassRules` String - Rules indicating which URLs should
|
||||
* `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
|
||||
bypass the proxy settings.
|
||||
|
||||
Returns `Promise<void>` - Resolves when the proxy setting process is complete.
|
||||
@@ -238,6 +291,14 @@ window.webContents.session.enableNetworkEmulation({
|
||||
window.webContents.session.enableNetworkEmulation({ offline: true })
|
||||
```
|
||||
|
||||
#### `ses.preconnect(options)`
|
||||
|
||||
* `options` Object
|
||||
* `url` String - URL for preconnect. Only the origin is relevant for opening the socket.
|
||||
* `numSockets` Number (optional) - number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
|
||||
|
||||
Preconnects the given number of sockets to an origin.
|
||||
|
||||
#### `ses.disableNetworkEmulation()`
|
||||
|
||||
Disables any network emulation already active for the `session`. Resets to
|
||||
@@ -245,7 +306,7 @@ the original network configuration.
|
||||
|
||||
#### `ses.setCertificateVerifyProc(proc)`
|
||||
|
||||
* `proc` Function
|
||||
* `proc` Function | null
|
||||
* `request` Object
|
||||
* `hostname` String
|
||||
* `certificate` [Certificate](structures/certificate.md)
|
||||
@@ -386,6 +447,17 @@ Returns `String` - The user agent for this session.
|
||||
|
||||
Returns `Promise<Buffer>` - resolves with blob data.
|
||||
|
||||
#### `ses.downloadURL(url)`
|
||||
|
||||
* `url` String
|
||||
|
||||
Initiates a download of the resource at `url`.
|
||||
The API will generate a [DownloadItem](download-item.md) that can be accessed
|
||||
with the [will-download](#event-will-download) event.
|
||||
|
||||
**Note:** This does not perform any security checks that relate to a page's origin,
|
||||
unlike [`webContents.downloadURL`](web-contents.md#contentsdownloadurlurl).
|
||||
|
||||
#### `ses.createInterruptedDownload(options)`
|
||||
|
||||
* `options` Object
|
||||
@@ -394,8 +466,8 @@ Returns `Promise<Buffer>` - resolves with blob data.
|
||||
* `mimeType` String (optional)
|
||||
* `offset` Integer - Start range for the download.
|
||||
* `length` Integer - Total length of the download.
|
||||
* `lastModified` String - Last-Modified header value.
|
||||
* `eTag` String - ETag header value.
|
||||
* `lastModified` String (optional) - Last-Modified header value.
|
||||
* `eTag` String (optional) - ETag header value.
|
||||
* `startTime` Double (optional) - Time when download was started in
|
||||
number of seconds since UNIX epoch.
|
||||
|
||||
@@ -423,10 +495,57 @@ this session just before normal `preload` scripts run.
|
||||
Returns `String[]` an array of paths to preload scripts that have been
|
||||
registered.
|
||||
|
||||
#### `ses.setSpellCheckerLanguages(languages)`
|
||||
|
||||
* `languages` String[] - An array of language codes to enable the spellchecker for.
|
||||
|
||||
The built in spellchecker does not automatically detect what language a user is typing in. In order for the
|
||||
spell checker to correctly check their words you must call this API with an array of language codes. You can
|
||||
get the list of supported language codes with the `ses.availableSpellCheckerLanguages` property.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and will detect your language automatically. This API is a no-op on macOS.
|
||||
|
||||
#### `ses.getSpellCheckerLanguages()`
|
||||
|
||||
Returns `String[]` - An array of language codes the spellchecker is enabled for. If this list is empty the spellchecker
|
||||
will fallback to using `en-US`. By default on launch if this setting is an empty list Electron will try to populate this
|
||||
setting with the current OS locale. This setting is persisted across restarts.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and has it's own list of languages. This API is a no-op on macOS.
|
||||
|
||||
#### `ses.setSpellCheckerDictionaryDownloadURL(url)`
|
||||
|
||||
* `url` String - A base URL for Electron to download hunspell dictionaries from.
|
||||
|
||||
By default Electron will download hunspell dictionaries from the Chromium CDN. If you want to override this
|
||||
behavior you can use this API to point the dictionary downloader at your own hosted version of the hunspell
|
||||
dictionaries. We publish a `hunspell_dictionaries.zip` file with each release which contains the files you need
|
||||
to host here, the file server must be **case insensitive** you must upload each file twice, once with the case it
|
||||
has in the ZIP file and once with the filename as all lower case.
|
||||
|
||||
If the files present in `hunspell_dictionaries.zip` are available at `https://example.com/dictionaries/language-code.bdic`
|
||||
then you should call this api with `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`. Please
|
||||
note the trailing slash. The URL to the dictionaries is formed as `${url}${filename}`.
|
||||
|
||||
**Note:** On macOS the OS spellchecker is used and therefore we do not download any dictionary files. This API is a no-op on macOS.
|
||||
|
||||
#### `ses.addWordToSpellCheckerDictionary(word)`
|
||||
|
||||
* `word` String - The word you want to add to the dictionary
|
||||
|
||||
Returns `Boolean` - Whether the word was successfully written to the custom dictionary.
|
||||
|
||||
**Note:** On macOS and Windows 10 this word will be written to the OS custom dictionary as well
|
||||
|
||||
### Instance Properties
|
||||
|
||||
The following properties are available on instances of `Session`:
|
||||
|
||||
#### `ses.availableSpellCheckerLanguages` _Readonly_
|
||||
|
||||
A `String[]` array which consists of all the known available spell checker languages. Providing a language
|
||||
code to the `setSpellCheckerLanaguages` API that isn't in this array will result in an error.
|
||||
|
||||
#### `ses.cookies` _Readonly_
|
||||
|
||||
A [`Cookies`](cookies.md) object for this session.
|
||||
|
||||
@@ -43,11 +43,12 @@ 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)`
|
||||
### `shell.moveItemToTrash(fullPath[, deleteOnFail])`
|
||||
|
||||
* `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.
|
||||
Returns `Boolean` - Whether the item was successfully moved to the trash or otherwise deleted.
|
||||
|
||||
Move the given file to trash and returns a boolean status for the operation.
|
||||
|
||||
|
||||
4
docs/api/structures/extension-info.md
Normal file
4
docs/api/structures/extension-info.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# ExtensionInfo Object
|
||||
|
||||
* `name` String
|
||||
* `version` String
|
||||
@@ -1,6 +1,6 @@
|
||||
# InputEvent Object
|
||||
|
||||
* `modifiers` String[] - An array of modifiers of the event, can
|
||||
be `shift`, `control`, `alt`, `meta`, `isKeypad`, `isAutoRepeat`,
|
||||
`leftButtonDown`, `middleButtonDown`, `rightButtonDown`, `capsLock`,
|
||||
`numLock`, `left`, `right`.
|
||||
* `modifiers` String[] (optional) - An array of modifiers of the event, can
|
||||
be `shift`, `control`, `ctrl`, `alt`, `meta`, `command`, `cmd`, `isKeypad`,
|
||||
`isAutoRepeat`, `leftButtonDown`, `middleButtonDown`, `rightButtonDown`,
|
||||
`capsLock`, `numLock`, `left`, `right`.
|
||||
|
||||
4
docs/api/structures/new-window-event.md
Normal file
4
docs/api/structures/new-window-event.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# NewWindowEvent Object extends `Event`
|
||||
|
||||
* `newGuest` BrowserWindow (optional)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# ProtocolResponseUploadData Object
|
||||
|
||||
* `contentType` String - MIME type of the content.
|
||||
* `data` String - Content to be sent.
|
||||
* `data` String | Buffer - Content to be sent.
|
||||
|
||||
4
docs/api/structures/shared-worker-info.md
Normal file
4
docs/api/structures/shared-worker-info.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# SharedWorkerInfo Object
|
||||
|
||||
* `id` String - The unique id of the shared worker.
|
||||
* `url` String - The url of the shared worker.
|
||||
@@ -19,7 +19,7 @@
|
||||
include in the trace. If not specified, trace all processes.
|
||||
* `histogram_names` String[] (optional) - a list of [histogram][] names to report
|
||||
with the trace.
|
||||
* `memory_dump_config` Object (optional) - if the
|
||||
* `memory_dump_config` Record<String, any> (optional) - if the
|
||||
`disabled-by-default-memory-infra` category is enabled, this contains
|
||||
optional additional configuration for data collection. See the [Chromium
|
||||
memory-infra docs][memory-infra docs] for more information.
|
||||
|
||||
@@ -27,28 +27,34 @@ Returns:
|
||||
|
||||
* `event` Event
|
||||
|
||||
### Event: 'inverted-color-scheme-changed' _Windows_
|
||||
### Event: 'inverted-color-scheme-changed' _Windows_ _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `invertedColorScheme` Boolean - `true` if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is being used, `false` otherwise.
|
||||
|
||||
### Event: 'high-contrast-color-scheme-changed' _Windows_
|
||||
**Deprecated:** Should use the new [`updated`](native-theme.md#event-updated) event on the `nativeTheme` module.
|
||||
|
||||
### Event: 'high-contrast-color-scheme-changed' _Windows_ _Deprecated_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `highContrastColorScheme` Boolean - `true` if a high contrast theme is being used, `false` otherwise.
|
||||
|
||||
**Deprecated:** Should use the new [`updated`](native-theme.md#event-updated) event on the `nativeTheme` module.
|
||||
|
||||
## Methods
|
||||
|
||||
### `systemPreferences.isDarkMode()` _macOS_ _Windows_
|
||||
### `systemPreferences.isDarkMode()` _macOS_ _Windows_ _Deprecated_
|
||||
|
||||
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_
|
||||
|
||||
Returns `Boolean` - Whether the Swipe between pages setting is on.
|
||||
@@ -56,7 +62,7 @@ Returns `Boolean` - Whether the Swipe between pages setting is on.
|
||||
### `systemPreferences.postNotification(event, userInfo[, deliverImmediately])` _macOS_
|
||||
|
||||
* `event` String
|
||||
* `userInfo` Object
|
||||
* `userInfo` Record<String, any>
|
||||
* `deliverImmediately` Boolean (optional) - `true` to post notifications immediately even when the subscribing app is inactive.
|
||||
|
||||
Posts `event` as native notifications of macOS. The `userInfo` is an Object
|
||||
@@ -65,7 +71,7 @@ that contains the user information dictionary sent along with the notification.
|
||||
### `systemPreferences.postLocalNotification(event, userInfo)` _macOS_
|
||||
|
||||
* `event` String
|
||||
* `userInfo` Object
|
||||
* `userInfo` Record<String, any>
|
||||
|
||||
Posts `event` as native notifications of macOS. The `userInfo` is an Object
|
||||
that contains the user information dictionary sent along with the notification.
|
||||
@@ -73,7 +79,7 @@ that contains the user information dictionary sent along with the notification.
|
||||
### `systemPreferences.postWorkspaceNotification(event, userInfo)` _macOS_
|
||||
|
||||
* `event` String
|
||||
* `userInfo` Object
|
||||
* `userInfo` Record<String, any>
|
||||
|
||||
Posts `event` as native notifications of macOS. The `userInfo` is an Object
|
||||
that contains the user information dictionary sent along with the notification.
|
||||
@@ -83,7 +89,7 @@ that contains the user information dictionary sent along with the notification.
|
||||
* `event` String
|
||||
* `callback` Function
|
||||
* `event` String
|
||||
* `userInfo` Object
|
||||
* `userInfo` Record<String, unknown>
|
||||
* `object` String
|
||||
|
||||
Returns `Number` - The ID of this subscription
|
||||
@@ -110,7 +116,7 @@ example values of `event` are:
|
||||
* `event` String
|
||||
* `callback` Function
|
||||
* `event` String
|
||||
* `userInfo` Object
|
||||
* `userInfo` Record<String, unknown>
|
||||
* `object` String
|
||||
|
||||
Returns `Number` - The ID of this subscription
|
||||
@@ -123,7 +129,7 @@ This is necessary for events such as `NSUserDefaultsDidChangeNotification`.
|
||||
* `event` String
|
||||
* `callback` Function
|
||||
* `event` String
|
||||
* `userInfo` Object
|
||||
* `userInfo` Record<String, unknown>
|
||||
* `object` String
|
||||
|
||||
Same as `subscribeNotification`, but uses `NSWorkspace.sharedWorkspace.notificationCenter`.
|
||||
@@ -149,7 +155,7 @@ Same as `unsubscribeNotification`, but removes the subscriber from `NSWorkspace.
|
||||
|
||||
### `systemPreferences.registerDefaults(defaults)` _macOS_
|
||||
|
||||
* `defaults` Object - a dictionary of (`key: value`) user defaults
|
||||
* `defaults` Record<String, String | Boolean | Number> - a dictionary of (`key: value`) user defaults
|
||||
|
||||
Add the specified defaults to your application's `NSUserDefaults`.
|
||||
|
||||
@@ -285,7 +291,7 @@ This API is only available on macOS 10.14 Mojave or newer.
|
||||
* `window-frame` - Window frame.
|
||||
* `window-text` - Text in windows.
|
||||
* On **macOS**
|
||||
* `alternate-selected-control-text` - The text on a selected surface in a list or table.
|
||||
* `alternate-selected-control-text` - The text on a selected surface in a list or table. _deprecated_
|
||||
* `control-background` - The background of a large interface element, such as a browser or table.
|
||||
* `control` - The surface of a control.
|
||||
* `control-text` -The text of a control that isn’t disabled.
|
||||
@@ -304,7 +310,7 @@ This API is only available on macOS 10.14 Mojave or newer.
|
||||
* `selected-content-background` - The background for selected content in a key window or view.
|
||||
* `selected-control` - The surface of a selected control.
|
||||
* `selected-control-text` - The text of a selected control.
|
||||
* `selected-menu-item` - The text of a selected menu.
|
||||
* `selected-menu-item-text` - The text of a selected menu.
|
||||
* `selected-text-background` - The background of selected text.
|
||||
* `selected-text` - Selected text.
|
||||
* `separator` - A separator between different sections of content.
|
||||
@@ -322,6 +328,8 @@ This API is only available on macOS 10.14 Mojave or newer.
|
||||
Returns `String` - The system color setting in RGB hexadecimal form (`#ABCDEF`).
|
||||
See the [Windows docs][windows-colors] and the [MacOS docs][macos-colors] for more details.
|
||||
|
||||
The following colors are only available on macOS 10.14: `find-highlight`, `selected-content-background`, `separator`, `unemphasized-selected-content-background`, `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
|
||||
|
||||
[windows-colors]:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx
|
||||
[macos-colors]:https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#dynamic-system-colors
|
||||
|
||||
@@ -342,14 +350,18 @@ Returns `String` - The standard system color formatted as `#RRGGBBAA`.
|
||||
|
||||
Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility settings like 'Increase contrast' and 'Reduce transparency'. See [Apple Documentation](https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors) for more details.
|
||||
|
||||
### `systemPreferences.isInvertedColorScheme()` _Windows_
|
||||
### `systemPreferences.isInvertedColorScheme()` _Windows_ _Deprecated_
|
||||
|
||||
Returns `Boolean` - `true` if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, `false` otherwise.
|
||||
|
||||
### `systemPreferences.isHighContrastColorScheme()` _macOS_ _Windows_
|
||||
**Deprecated:** Should use the new [`nativeTheme.shouldUseInvertedColorScheme`](native-theme.md#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly) API.
|
||||
|
||||
### `systemPreferences.isHighContrastColorScheme()` _macOS_ _Windows_ _Deprecated_
|
||||
|
||||
Returns `Boolean` - `true` if a high contrast theme is active, `false` otherwise.
|
||||
|
||||
**Deprecated:** Should use the new [`nativeTheme.shouldUseHighContrastColors`](native-theme.md#nativethemeshouldusehighcontrastcolors-macos-windows-readonly) API.
|
||||
|
||||
### `systemPreferences.getEffectiveAppearance()` _macOS_
|
||||
|
||||
Returns `String` - Can be `dark`, `light` or `unknown`.
|
||||
@@ -357,15 +369,7 @@ Returns `String` - Can be `dark`, `light` or `unknown`.
|
||||
Gets the macOS appearance setting that is currently applied to your application,
|
||||
maps to [NSApplication.effectiveAppearance](https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc)
|
||||
|
||||
Please note that until Electron is built targeting the 10.14 SDK, your application's
|
||||
`effectiveAppearance` will default to 'light' and won't inherit the OS preference. In
|
||||
the interim in order for your application to inherit the OS preference you must set the
|
||||
`NSRequiresAquaSystemAppearance` key in your apps `Info.plist` to `false`. If you are
|
||||
using `electron-packager` or `electron-forge` just set the `enableDarwinDarkMode`
|
||||
packager option to `true`. See the [Electron Packager API](https://github.com/electron/electron-packager/blob/master/docs/api.md#darwindarkmodesupport)
|
||||
for more details.
|
||||
|
||||
### `systemPreferences.getAppLevelAppearance()` _macOS_
|
||||
### `systemPreferences.getAppLevelAppearance()` _macOS_ _Deprecated_
|
||||
|
||||
Returns `String` | `null` - Can be `dark`, `light` or `unknown`.
|
||||
|
||||
@@ -373,25 +377,19 @@ Gets the macOS appearance setting that you have declared you want for
|
||||
your application, maps to [NSApplication.appearance](https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc).
|
||||
You can use the `setAppLevelAppearance` API to set this value.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `systemPreferences.setAppLevelAppearance(appearance)` _macOS_
|
||||
### `systemPreferences.setAppLevelAppearance(appearance)` _macOS_ _Deprecated_
|
||||
|
||||
* `appearance` String | null - Can be `dark` or `light`
|
||||
|
||||
Sets the appearance setting for your application, this should override the
|
||||
system default and override the value of `getEffectiveAppearance`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `systemPreferences.canPromptTouchID()` _macOS_
|
||||
|
||||
Returns `Boolean` - whether or not this device has the ability to use Touch ID.
|
||||
|
||||
**NOTE:** This API will return `false` on macOS systems older than Sierra 10.12.2.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
### `systemPreferences.promptTouchID(reason)` _macOS_
|
||||
|
||||
* `reason` String - The reason you are asking for Touch ID authentication
|
||||
@@ -418,13 +416,18 @@ This API itself will not protect your user data; rather, it is a mechanism to al
|
||||
|
||||
Returns `Boolean` - `true` if the current process is a trusted accessibility client and `false` if it is not.
|
||||
|
||||
### `systemPreferences.getMediaAccessStatus(mediaType)` _macOS_
|
||||
### `systemPreferences.getMediaAccessStatus(mediaType)` _Windows_ _macOS_
|
||||
|
||||
* `mediaType` String - `microphone` or `camera`.
|
||||
* `mediaType` String - Can be `microphone`, `camera` or `screen`.
|
||||
|
||||
Returns `String` - Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
|
||||
|
||||
This user consent was not required until macOS 10.14 Mojave, so this method will always return `granted` if your system is running 10.13 High Sierra or lower.
|
||||
This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return `granted`.
|
||||
macOS 10.14 Mojave or higher requires consent for `microphone` and `camera` access.
|
||||
macOS 10.15 Catalina or higher requires consent for `screen` access.
|
||||
|
||||
Windows 10 has a global setting controlling `microphone` and `camera` access for all win32 applications.
|
||||
It will always return `granted` for `screen` and for all media types on older versions of Windows.
|
||||
|
||||
### `systemPreferences.askForMediaAccess(mediaType)` _macOS_
|
||||
|
||||
@@ -450,10 +453,17 @@ Returns an object with system animation settings.
|
||||
|
||||
### `systemPreferences.appLevelAppearance` _macOS_
|
||||
|
||||
A `String` property that determines the macOS appearance setting for
|
||||
A `String` property that can be `dark`, `light` or `unknown`. It determines the macOS appearance setting for
|
||||
your application. This maps to values in: [NSApplication.appearance](https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc). Setting this will override the
|
||||
system default as well as the value of `getEffectiveAppearance`.
|
||||
|
||||
Possible values that can be set are `dark` and `light`, and possible return values are `dark`, `light`, and `unknown`.
|
||||
|
||||
This property is only available on macOS 10.14 Mojave or newer.
|
||||
|
||||
### `systemPreferences.effectiveAppearance` _macOS_ _Readonly_
|
||||
|
||||
A `String` property that can be `dark`, `light` or `unknown`.
|
||||
|
||||
Returns the macOS appearance setting that is currently applied to your application,
|
||||
maps to [NSApplication.effectiveAppearance](https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc)
|
||||
|
||||
@@ -8,16 +8,23 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
|
||||
|
||||
* `options` Object
|
||||
* `label` String (optional) - Button text.
|
||||
* `accessibilityLabel` String (optional) - A short description of the button for use by screenreaders like VoiceOver.
|
||||
* `backgroundColor` String (optional) - Button background color in hex format,
|
||||
i.e `#ABCDEF`.
|
||||
* `icon` [NativeImage](native-image.md) | String (optional) - Button icon.
|
||||
* `iconPosition` String (optional) - Can be `left`, `right` or `overlay`.
|
||||
* `iconPosition` String (optional) - Can be `left`, `right` or `overlay`. Defaults to `overlay`.
|
||||
* `click` Function (optional) - Function to call when the button is clicked.
|
||||
|
||||
When defining `accessibilityLabel`, ensure you have considered macOS [best practices](https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc).
|
||||
|
||||
### Instance Properties
|
||||
|
||||
The following properties are available on instances of `TouchBarButton`:
|
||||
|
||||
#### `touchBarButton.accessibilityLabel`
|
||||
|
||||
A `String` representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.
|
||||
|
||||
#### `touchBarButton.label`
|
||||
|
||||
A `String` representing the button's current text. Changing this value immediately updates the button
|
||||
|
||||
@@ -8,8 +8,11 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
|
||||
|
||||
* `options` Object
|
||||
* `label` String (optional) - Text to display.
|
||||
* `accessibilityLabel` String (optional) - A short description of the button for use by screenreaders like VoiceOver.
|
||||
* `textColor` String (optional) - Hex color of text, i.e `#ABCDEF`.
|
||||
|
||||
When defining `accessibilityLabel`, ensure you have considered macOS [best practices](https://developer.apple.com/documentation/appkit/nsaccessibilitybutton/1524910-accessibilitylabel?language=objc).
|
||||
|
||||
### Instance Properties
|
||||
|
||||
The following properties are available on instances of `TouchBarLabel`:
|
||||
@@ -19,6 +22,10 @@ The following properties are available on instances of `TouchBarLabel`:
|
||||
A `String` representing the label's current text. Changing this value immediately updates the label in
|
||||
the touch bar.
|
||||
|
||||
#### `touchBarLabel.accessibilityLabel`
|
||||
|
||||
A `String` representing the description of the label to be read by a screen reader.
|
||||
|
||||
#### `touchBarLabel.textColor`
|
||||
|
||||
A `String` hex code representing the label's current text color. Changing this value immediately updates the
|
||||
|
||||
@@ -9,7 +9,7 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
|
||||
* `options` Object
|
||||
* `label` String (optional) - Popover button text.
|
||||
* `icon` [NativeImage](native-image.md) (optional) - Popover button icon.
|
||||
* `items` [TouchBar](touch-bar.md) (optional) - Items to display in the popover.
|
||||
* `items` [TouchBar](touch-bar.md) - Items to display in the popover.
|
||||
* `showCloseButton` Boolean (optional) - `true` to display a close button
|
||||
on the left of the popover, `false` to not show it. Default is `true`.
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
|
||||
* `selectedIndex` Integer - The index of the item the user selected.
|
||||
* `highlight` Function (optional) - Called when the user taps any item.
|
||||
* `highlightedIndex` Integer - The index of the item the user touched.
|
||||
* `selectedStyle` String (optional) - Selected item style. Defaults to `null`.
|
||||
* `overlayStyle` String (optional) - Selected overlay item style. Defaults to `null`.
|
||||
* `selectedStyle` String (optional) - Selected item style. Can be `background`, `outline` or `none`. Defaults to `none`.
|
||||
* `overlayStyle` String (optional) - Selected overlay item style. Can be `background`, `outline` or `none`. Defaults to `none`.
|
||||
* `showArrowButtons` Boolean (optional) - Defaults to `false`.
|
||||
* `mode` String (optional) - Defaults to `free`.
|
||||
* `mode` String (optional) - Can be `fixed` or `free`. The default is `free`.
|
||||
* `continuous` Boolean (optional) - Defaults to `true`.
|
||||
|
||||
### Instance Properties
|
||||
@@ -34,7 +34,7 @@ updates the control in the touch bar. Possible values:
|
||||
|
||||
* `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
|
||||
* `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
|
||||
* `null` - Actually null, not a string, removes all styles.
|
||||
* `none` - Removes all styles.
|
||||
|
||||
#### `touchBarScrubber.overlayStyle`
|
||||
|
||||
@@ -44,7 +44,7 @@ touch bar. Possible values:
|
||||
|
||||
* `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
|
||||
* `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
|
||||
* `null` - Actually null, not a string, removes all styles.
|
||||
* `none` - Removes all styles.
|
||||
|
||||
#### `touchBarScrubber.showArrowButtons`
|
||||
|
||||
|
||||
@@ -10,23 +10,23 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
|
||||
* `segmentStyle` String (optional) - Style of the segments:
|
||||
* `automatic` - Default. The appearance of the segmented control is
|
||||
automatically determined based on the type of window in which the control
|
||||
is displayed and the position within the window.
|
||||
* `rounded` - The control is displayed using the rounded style.
|
||||
is displayed and the position within the window. Maps to `NSSegmentStyleAutomatic`.
|
||||
* `rounded` - The control is displayed using the rounded style. Maps to `NSSegmentStyleRounded`.
|
||||
* `textured-rounded` - The control is displayed using the textured rounded
|
||||
style.
|
||||
* `round-rect` - The control is displayed using the round rect style.
|
||||
style. Maps to `NSSegmentStyleTexturedRounded`.
|
||||
* `round-rect` - The control is displayed using the round rect style. Maps to `NSSegmentStyleRoundRect`.
|
||||
* `textured-square` - The control is displayed using the textured square
|
||||
style.
|
||||
* `capsule` - The control is displayed using the capsule style.
|
||||
* `small-square` - The control is displayed using the small square style.
|
||||
style. Maps to `NSSegmentStyleTexturedSquare`.
|
||||
* `capsule` - The control is displayed using the capsule style. Maps to `NSSegmentStyleCapsule`.
|
||||
* `small-square` - The control is displayed using the small square style. Maps to `NSSegmentStyleSmallSquare`.
|
||||
* `separated` - The segments in the control are displayed very close to each
|
||||
other but not touching.
|
||||
other but not touching. Maps to `NSSegmentStyleSeparated`.
|
||||
* `mode` String (optional) - The selection mode of the control:
|
||||
* `single` - Default. One item selected at a time, selecting one deselects the previously selected item.
|
||||
* `multiple` - Multiple items can be selected at a time.
|
||||
* `buttons` - Make the segments act as buttons, each segment can be pressed and released but never marked as active.
|
||||
* `single` - Default. One item selected at a time, selecting one deselects the previously selected item. Maps to `NSSegmentSwitchTrackingSelectOne`.
|
||||
* `multiple` - Multiple items can be selected at a time. Maps to `NSSegmentSwitchTrackingSelectAny`.
|
||||
* `buttons` - Make the segments act as buttons, each segment can be pressed and released but never marked as active. Maps to `NSSegmentSwitchTrackingMomentary`.
|
||||
* `segments` [SegmentedControlSegment[]](structures/segmented-control-segment.md) - An array of segments to place in this control.
|
||||
* `selectedIndex` Integer (optional) - The index of the currently selected segment, will update automatically with user interaction. When the mode is multiple it will be the last selected item.
|
||||
* `selectedIndex` Integer (optional) - The index of the currently selected segment, will update automatically with user interaction. When the mode is `multiple` it will be the last selected item.
|
||||
* `change` Function (optional) - Called when the user selects a new segment.
|
||||
* `selectedIndex` Integer - The index of the segment the user selected.
|
||||
* `isSelected` Boolean - Whether as a result of user selection the segment is selected or not.
|
||||
|
||||
@@ -8,6 +8,6 @@ Process: [Main](../tutorial/application-architecture.md#main-and-renderer-proces
|
||||
|
||||
* `options` Object
|
||||
* `size` String (optional) - Size of spacer, possible values are:
|
||||
* `small` - Small space between items.
|
||||
* `large` - Large space between items.
|
||||
* `flexible` - Take up all available space.
|
||||
* `small` - Small space between items. Maps to `NSTouchBarItemIdentifierFixedSpaceSmall`. This is the default.
|
||||
* `large` - Large space between items. Maps to `NSTouchBarItemIdentifierFixedSpaceLarge`.
|
||||
* `flexible` - Take up all available space. Maps to `NSTouchBarItemIdentifierFlexibleSpace`.
|
||||
|
||||
@@ -222,12 +222,31 @@ Returns `Boolean` - Whether double click events will be ignored.
|
||||
#### `tray.displayBalloon(options)` _Windows_
|
||||
|
||||
* `options` Object
|
||||
* `icon` ([NativeImage](native-image.md) | String) (optional) -
|
||||
* `icon` ([NativeImage](native-image.md) | String) (optional) - Icon to use when `iconType` is `custom`.
|
||||
* `iconType` String (optional) - Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
|
||||
* `title` String
|
||||
* `content` String
|
||||
* `largeIcon` Boolean (optional) - The large version of the icon should be used. Default is `true`. Maps to [`NIIF_LARGE_ICON`][NIIF_LARGE_ICON].
|
||||
* `noSound` Boolean (optional) - Do not play the associated sound. Default is `false`. Maps to [`NIIF_NOSOUND`][NIIF_NOSOUND].
|
||||
* `respectQuietTime` Boolean (optional) - Do not display the balloon notification if the current user is in "quiet time". Default is `false`. Maps to [`NIIF_RESPECT_QUIET_TIME`][NIIF_RESPECT_QUIET_TIME].
|
||||
|
||||
Displays a tray balloon.
|
||||
|
||||
[NIIF_NOSOUND]: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_nosound-0x00000010
|
||||
[NIIF_LARGE_ICON]: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_large_icon-0x00000020
|
||||
[NIIF_RESPECT_QUIET_TIME]: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#niif_respect_quiet_time-0x00000080
|
||||
|
||||
#### `tray.removeBalloon()` _Windows_
|
||||
|
||||
Removes a tray balloon.
|
||||
|
||||
#### `tray.focus()` _Windows_
|
||||
|
||||
Returns focus to the taskbar notification area.
|
||||
Notification area icons should use this message when they have completed their UI operation.
|
||||
For example, if the icon displays a shortcut menu, but the user presses ESC to cancel it,
|
||||
use `tray.focus()` to return focus to the notification area.
|
||||
|
||||
#### `tray.popUpContextMenu([menu, position])` _macOS_ _Windows_
|
||||
|
||||
* `menu` Menu (optional)
|
||||
|
||||
@@ -138,12 +138,12 @@ Emitted when page receives favicon urls.
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `event` NewWindowEvent
|
||||
* `url` String
|
||||
* `frameName` String
|
||||
* `disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
|
||||
`new-window`, `save-to-disk` and `other`.
|
||||
* `options` Object - The options which will be used for creating the new
|
||||
* `options` BrowserWindowConstructorOptions - The options which will be used for creating the new
|
||||
[`BrowserWindow`](browser-window.md).
|
||||
* `additionalFeatures` String[] - The non-standard features (features not handled
|
||||
by Chromium or Electron) given to `window.open()`.
|
||||
@@ -334,6 +334,24 @@ Returns:
|
||||
|
||||
Emitted when the renderer process crashes or is killed.
|
||||
|
||||
#### Event: 'render-process-gone'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `details` Object
|
||||
* `reason` String - The reason the render process is gone. Possible values:
|
||||
* `clean-exit` - Process exited with an exit code of zero
|
||||
* `abnormal-exit` - Process exited with a non-zero exit code
|
||||
* `killed` - Process was sent a SIGTERM or otherwise killed externally
|
||||
* `crashed` - Process crashed
|
||||
* `oom` - Process ran out of memory
|
||||
* `launch-failure` - Process never successfully launched
|
||||
* `integrity-failure` - Windows code integrity checks failed
|
||||
|
||||
Emitted when the renderer process unexpectedly dissapears. This is normally
|
||||
because it was crashed or killed.
|
||||
|
||||
#### Event: 'unresponsive'
|
||||
|
||||
Emitted when the web page becomes unresponsive.
|
||||
@@ -366,6 +384,7 @@ Returns:
|
||||
* `key` String - Equivalent to [KeyboardEvent.key][keyboardevent].
|
||||
* `code` String - Equivalent to [KeyboardEvent.code][keyboardevent].
|
||||
* `isAutoRepeat` Boolean - Equivalent to [KeyboardEvent.repeat][keyboardevent].
|
||||
* `isComposing` Boolean - Equivalent to [KeyboardEvent.isComposing][keyboardevent].
|
||||
* `shift` Boolean - Equivalent to [KeyboardEvent.shiftKey][keyboardevent].
|
||||
* `control` Boolean - Equivalent to [KeyboardEvent.controlKey][keyboardevent].
|
||||
* `alt` Boolean - Equivalent to [KeyboardEvent.altKey][keyboardevent].
|
||||
@@ -454,10 +473,8 @@ The usage is the same with [the `select-client-certificate` event of
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `request` Object
|
||||
* `method` String
|
||||
* `authenticationResponseDetails` Object
|
||||
* `url` URL
|
||||
* `referrer` URL
|
||||
* `authInfo` Object
|
||||
* `isProxy` Boolean
|
||||
* `scheme` String
|
||||
@@ -465,8 +482,8 @@ Returns:
|
||||
* `port` Integer
|
||||
* `realm` String
|
||||
* `callback` Function
|
||||
* `username` String
|
||||
* `password` String
|
||||
* `username` String (optional)
|
||||
* `password` String (optional)
|
||||
|
||||
Emitted when `webContents` wants to do basic auth.
|
||||
|
||||
@@ -481,7 +498,7 @@ Returns:
|
||||
* `requestId` Integer
|
||||
* `activeMatchOrdinal` Integer - Position of the active match.
|
||||
* `matches` Integer - Number of Matches.
|
||||
* `selectionArea` Object - Coordinates of first match region.
|
||||
* `selectionArea` Rectangle - Coordinates of first match region.
|
||||
* `finalUpdate` Boolean
|
||||
|
||||
Emitted when a result is available for
|
||||
@@ -570,6 +587,9 @@ Returns:
|
||||
* `titleText` String - Title or alt text of the selection that the context
|
||||
was invoked on.
|
||||
* `misspelledWord` String - The misspelled word under the cursor, if any.
|
||||
* `dictionarySuggestions` String[] - An array of suggested words to show the
|
||||
user to replace the `misspelledWord`. Only available if there is a misspelled
|
||||
word and spellchecker is enabled.
|
||||
* `frameCharset` String - The character encoding of the frame on which the
|
||||
menu was invoked.
|
||||
* `inputFieldType` String - If the context menu was invoked on an input
|
||||
@@ -669,10 +689,10 @@ Emitted when the devtools window instructs the webContents to reload
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `webPreferences` Object - The web preferences that will be used by the guest
|
||||
* `webPreferences` WebPreferences - The web preferences that will be used by the guest
|
||||
page. This object can be modified to adjust the preferences for the guest
|
||||
page.
|
||||
* `params` Object - The other `<webview>` parameters such as the `src` URL.
|
||||
* `params` Record<string, string> - The other `<webview>` parameters such as the `src` URL.
|
||||
This object can be modified to adjust the parameters of the guest page.
|
||||
|
||||
Emitted when a `<webview>`'s web contents is being attached to this web
|
||||
@@ -705,8 +725,7 @@ Returns:
|
||||
* `line` Integer
|
||||
* `sourceId` String
|
||||
|
||||
Emitted when the associated window logs a console message. Will not be emitted
|
||||
for windows with *offscreen rendering* enabled.
|
||||
Emitted when the associated window logs a console message.
|
||||
|
||||
#### Event: 'preload-error'
|
||||
|
||||
@@ -842,7 +861,7 @@ webContents.loadURL('https://github.com', options)
|
||||
|
||||
* `filePath` String
|
||||
* `options` Object (optional)
|
||||
* `query` Object (optional) - Passed to `url.format()`.
|
||||
* `query` Record<String, String> (optional) - Passed to `url.format()`.
|
||||
* `search` String (optional) - Passed to `url.format()`.
|
||||
* `hash` String (optional) - Passed to `url.format()`.
|
||||
|
||||
@@ -882,10 +901,10 @@ Returns `String` - The URL of the current web page.
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
let win = new BrowserWindow({ width: 800, height: 600 })
|
||||
win.loadURL('http://github.com')
|
||||
|
||||
let currentURL = win.webContents.getURL()
|
||||
console.log(currentURL)
|
||||
win.loadURL('http://github.com').then(() => {
|
||||
const currentURL = win.webContents.getURL()
|
||||
console.log(currentURL)
|
||||
})
|
||||
```
|
||||
|
||||
#### `contents.getTitle()`
|
||||
@@ -978,14 +997,10 @@ Returns `Boolean` - Whether the renderer process has crashed.
|
||||
|
||||
Overrides the user agent for this web page.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getUserAgent()`
|
||||
|
||||
Returns `String` - The user agent for this web page.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.insertCSS(css[, options])`
|
||||
|
||||
* `css` String
|
||||
@@ -1042,6 +1057,17 @@ contents.executeJavaScript('fetch("https://jsonplaceholder.typicode.com/users/1"
|
||||
})
|
||||
```
|
||||
|
||||
#### `contents.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])`
|
||||
|
||||
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electron's `contextIsolation` feature. You can provide any integer here.
|
||||
* `scripts` [WebSource[]](structures/web-source.md)
|
||||
* `userGesture` Boolean (optional) - Default is `false`.
|
||||
|
||||
Returns `Promise<any>` - A promise that resolves with the result of the executed code
|
||||
or is rejected if the result of the code is a rejected promise.
|
||||
|
||||
Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
|
||||
|
||||
#### `contents.setIgnoreMenuShortcuts(ignore)` _Experimental_
|
||||
|
||||
* `ignore` Boolean
|
||||
@@ -1054,33 +1080,27 @@ Ignore application menu shortcuts while this web contents is focused.
|
||||
|
||||
Mute the audio on the current web page.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.isAudioMuted()`
|
||||
|
||||
Returns `Boolean` - Whether this page has been muted.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.isCurrentlyAudible()`
|
||||
|
||||
Returns `Boolean` - Whether audio is currently playing.
|
||||
|
||||
#### `contents.setZoomFactor(factor)`
|
||||
|
||||
* `factor` Number - Zoom factor.
|
||||
* `factor` Double - Zoom factor; default is 1.0.
|
||||
|
||||
Changes the zoom factor to the specified factor. Zoom factor is
|
||||
zoom percent divided by 100, so 300% = 3.0.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
The factor must be greater than 0.0.
|
||||
|
||||
#### `contents.getZoomFactor()`
|
||||
|
||||
Returns `Number` - the current zoom factor.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.setZoomLevel(level)`
|
||||
|
||||
* `level` Number - Zoom level.
|
||||
@@ -1090,14 +1110,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`.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getZoomLevel()`
|
||||
|
||||
Returns `Number` - the current zoom level.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.setVisualZoomLevelLimits(minimumLevel, maximumLevel)`
|
||||
|
||||
* `minimumLevel` Number
|
||||
@@ -1113,7 +1129,7 @@ Sets the maximum and minimum pinch-to-zoom level.
|
||||
> contents.setVisualZoomLevelLimits(1, 3)
|
||||
> ```
|
||||
|
||||
#### `contents.setLayoutZoomLevelLimits(minimumLevel, maximumLevel)`
|
||||
#### `contents.setLayoutZoomLevelLimits(minimumLevel, maximumLevel)` _Deprecated_
|
||||
|
||||
* `minimumLevel` Number
|
||||
* `maximumLevel` Number
|
||||
@@ -1122,6 +1138,8 @@ Returns `Promise<void>`
|
||||
|
||||
Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
|
||||
|
||||
**Deprecated:** This API is no longer supported by Chromium.
|
||||
|
||||
#### `contents.undo()`
|
||||
|
||||
Executes the editing command `undo` in web page.
|
||||
@@ -1234,11 +1252,34 @@ 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.
|
||||
|
||||
#### `contents.isBeingCaptured()`
|
||||
|
||||
Returns `Boolean` - Whether this page is being captured. It returns true when the capturer count
|
||||
is large then 0.
|
||||
|
||||
#### `contents.incrementCapturerCount([size, stayHidden])`
|
||||
|
||||
* `size` [Size](structures/size.md) (optional) - The perferred size for the capturer.
|
||||
* `stayHidden` Boolean (optional) - Keep the page hidden instead of visible.
|
||||
|
||||
Increase the capturer count by one. The page is considered visible when its browser window is
|
||||
hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that `stayHidden` is set to true.
|
||||
|
||||
This also affects the Page Visibility API.
|
||||
|
||||
#### `contents.decrementCapturerCount([stayHidden])`
|
||||
|
||||
* `stayHidden` Boolean (optional) - Keep the page in hidden state instead of visible.
|
||||
|
||||
Decrease the capturer count by one. The page will be set to hidden or occluded state when its
|
||||
browser window is hidden or occluded and the capturer count reaches zero. If you want to
|
||||
decrease the hidden capturer count instead you should set `stayHidden` to true.
|
||||
|
||||
#### `contents.getPrinters()`
|
||||
|
||||
Get the system printer list.
|
||||
|
||||
Returns [`PrinterInfo[]`](structures/printer-info.md).
|
||||
Returns [`PrinterInfo[]`](structures/printer-info.md)
|
||||
|
||||
#### `contents.print([options], [callback])`
|
||||
|
||||
@@ -1246,7 +1287,7 @@ Returns [`PrinterInfo[]`](structures/printer-info.md).
|
||||
* `silent` Boolean (optional) - Don't ask user for print settings. Default is `false`.
|
||||
* `printBackground` Boolean (optional) - Prints the background color and image of
|
||||
the web page. Default is `false`.
|
||||
* `deviceName` String (optional) - Set the printer device name to use. Default is `''`.
|
||||
* `deviceName` String (optional) - Set the printer device name to use. Must be the system-defined name and not the 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
|
||||
* `color` Boolean (optional) - Set whether the printed web page will be in color or grayscale. Default is `true`.
|
||||
* `margins` Object (optional)
|
||||
* `marginType` String (optional) - Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen, you will also need to specify `top`, `bottom`, `left`, and `right`.
|
||||
@@ -1264,16 +1305,14 @@ Returns [`PrinterInfo[]`](structures/printer-info.md).
|
||||
* `dpi` Object (optional)
|
||||
* `horizontal` Number (optional) - The horizontal dpi.
|
||||
* `vertical` Number (optional) - The vertical dpi.
|
||||
* `header` String (optional) - String to be printed as page header.
|
||||
* `footer` String (optional) - String to be printed as page footer.
|
||||
* `callback` Function (optional)
|
||||
* `success` Boolean - Indicates success of the print call.
|
||||
* `failureReason` String - Called back if the print fails; can be `cancelled` or `failed`.
|
||||
* `failureReason` String - Error description called back if the print fails.
|
||||
|
||||
Prints window's web page. When `silent` is set to `true`, Electron will pick
|
||||
the system's default printer if `deviceName` is empty and the default settings
|
||||
for printing.
|
||||
|
||||
Calling `window.print()` in web page is equivalent to calling
|
||||
`webContents.print({ silent: false, printBackground: false, deviceName: '' })`.
|
||||
the system's default printer if `deviceName` is empty and the default settings for printing.
|
||||
|
||||
Use `page-break-before: always;` CSS style to force to print to a new page.
|
||||
|
||||
@@ -1329,12 +1368,13 @@ win.loadURL('http://github.com')
|
||||
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
// Use default printing options
|
||||
win.webContents.printToPDF({}, (error, data) => {
|
||||
if (error) throw error
|
||||
win.webContents.printToPDF({}).then(data => {
|
||||
fs.writeFile('/tmp/print.pdf', data, (error) => {
|
||||
if (error) throw error
|
||||
console.log('Write PDF successfully.')
|
||||
})
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
})
|
||||
```
|
||||
@@ -1463,6 +1503,16 @@ Starts inspecting element at position (`x`, `y`).
|
||||
|
||||
Opens the developer tools for the shared worker context.
|
||||
|
||||
#### `contents.inspectSharedWorkerById(workerId)`
|
||||
|
||||
* `workerId` String
|
||||
|
||||
Inspects the shared worker based on its ID.
|
||||
|
||||
#### `contents.getAllSharedWorkers()`
|
||||
|
||||
Returns [`SharedWorkerInfo[]`](structures/shared-worker-info.md) - Information about all Shared Workers.
|
||||
|
||||
#### `contents.inspectServiceWorker()`
|
||||
|
||||
Opens the developer tools for the service worker context.
|
||||
@@ -1472,9 +1522,15 @@ Opens the developer tools for the service worker context.
|
||||
* `channel` String
|
||||
* `...args` any[]
|
||||
|
||||
Send an asynchronous message to renderer process via `channel`, you can also
|
||||
send arbitrary arguments. Arguments will be serialized in JSON internally and
|
||||
hence no functions or prototype chain will be included.
|
||||
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.
|
||||
|
||||
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
|
||||
> special Electron objects is deprecated, and will begin throwing an exception
|
||||
> starting with Electron 9.
|
||||
|
||||
The renderer process can handle the message by listening to `channel` with the
|
||||
[`ipcRenderer`](ipc-renderer.md) module.
|
||||
@@ -1515,8 +1571,14 @@ app.on('ready', () => {
|
||||
* `...args` any[]
|
||||
|
||||
Send an asynchronous message to a specific frame in a renderer process via
|
||||
`channel`. Arguments will be serialized
|
||||
as JSON internally and as such no functions or prototype chains will be included.
|
||||
`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.
|
||||
|
||||
> **NOTE**: Sending non-standard JavaScript types such as DOM objects or
|
||||
> special Electron objects is deprecated, and will begin throwing an exception
|
||||
> starting with Electron 9.
|
||||
|
||||
The renderer process can handle the message by listening to `channel` with the
|
||||
[`ipcRenderer`](ipc-renderer.md) module.
|
||||
@@ -1563,13 +1625,6 @@ Disable device emulation enabled by `webContents.enableDeviceEmulation`.
|
||||
#### `contents.sendInputEvent(inputEvent)`
|
||||
|
||||
* `inputEvent` [MouseInputEvent](structures/mouse-input-event.md) | [MouseWheelInputEvent](structures/mouse-wheel-input-event.md) | [KeyboardInputEvent](structures/keyboard-input-event.md)
|
||||
* `type` String (**required**) - The type of the event, can be `mouseDown`,
|
||||
`mouseUp`, `mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel`,
|
||||
`mouseMove`, `keyDown`, `keyUp` or `char`.
|
||||
* `modifiers` String[] - An array of modifiers of the event, can
|
||||
include `shift`, `control`, `alt`, `meta`, `isKeypad`, `isAutoRepeat`,
|
||||
`leftButtonDown`, `middleButtonDown`, `rightButtonDown`, `capsLock`,
|
||||
`numLock`, `left`, `right`.
|
||||
|
||||
Sends an input `event` to the page.
|
||||
**Note:** The [`BrowserWindow`](browser-window.md) containing the contents needs to be focused for
|
||||
@@ -1602,8 +1657,8 @@ End subscribing for frame presentation events.
|
||||
|
||||
* `item` Object
|
||||
* `file` String[] | String - The path(s) to the file(s) being dragged.
|
||||
* `icon` [NativeImage](native-image.md) - The image must be non-empty on
|
||||
macOS.
|
||||
* `icon` [NativeImage](native-image.md) | String - The image must be
|
||||
non-empty on macOS.
|
||||
|
||||
Sets the `item` as dragging item for current drag-drop operation, `file` is the
|
||||
absolute path of the file to be dragged, and `icon` is the image showing under
|
||||
@@ -1661,14 +1716,10 @@ Returns `Boolean` - If *offscreen rendering* is enabled returns whether it is cu
|
||||
If *offscreen rendering* is enabled sets the frame rate to the specified number.
|
||||
Only values between 1 and 60 are accepted.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.getFrameRate()`
|
||||
|
||||
Returns `Integer` - If *offscreen rendering* is enabled returns the current frame rate.
|
||||
|
||||
**[Deprecated](modernization/property-updates.md)**
|
||||
|
||||
#### `contents.invalidate()`
|
||||
|
||||
Schedules a full repaint of the window this web contents is in.
|
||||
@@ -1774,7 +1825,7 @@ A [`WebContents`](web-contents.md) instance that might own this `WebContents`.
|
||||
|
||||
#### `contents.devToolsWebContents` _Readonly_
|
||||
|
||||
A `WebContents` of DevTools for this `WebContents`.
|
||||
A `WebContents | null` property that represents the of DevTools `WebContents` associated with a given `WebContents`.
|
||||
|
||||
**Note:** Users should never store this object because it may become `null`
|
||||
when the DevTools has been closed.
|
||||
@@ -1785,3 +1836,5 @@ A [`Debugger`](debugger.md) instance for this webContents.
|
||||
|
||||
[keyboardevent]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
|
||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||
|
||||
@@ -22,11 +22,13 @@ The `WebFrame` class has the following instance methods:
|
||||
|
||||
### `webFrame.setZoomFactor(factor)`
|
||||
|
||||
* `factor` Number - Zoom factor.
|
||||
* `factor` Double - Zoom factor; default is 1.0.
|
||||
|
||||
Changes the zoom factor to the specified factor. Zoom factor is
|
||||
zoom percent divided by 100, so 300% = 3.0.
|
||||
|
||||
The factor must be greater than 0.0.
|
||||
|
||||
### `webFrame.getZoomFactor()`
|
||||
|
||||
Returns `Number` - The current zoom factor.
|
||||
@@ -56,13 +58,15 @@ Sets the maximum and minimum pinch-to-zoom level.
|
||||
> webFrame.setVisualZoomLevelLimits(1, 3)
|
||||
> ```
|
||||
|
||||
### `webFrame.setLayoutZoomLevelLimits(minimumLevel, maximumLevel)`
|
||||
### `webFrame.setLayoutZoomLevelLimits(minimumLevel, maximumLevel)` _Deprecated_
|
||||
|
||||
* `minimumLevel` Number
|
||||
* `maximumLevel` Number
|
||||
|
||||
Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
|
||||
|
||||
**Deprecated:** This API is no longer supported by Chromium.
|
||||
|
||||
### `webFrame.setSpellCheckProvider(language, provider)`
|
||||
|
||||
* `language` String
|
||||
@@ -74,6 +78,17 @@ Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
|
||||
|
||||
Sets a provider for spell checking in input fields and text areas.
|
||||
|
||||
If you want to use this method you must disable the builtin spellchecker when you
|
||||
construct the window.
|
||||
|
||||
```js
|
||||
const mainWindow = new BrowserWindow({
|
||||
webPreferences: {
|
||||
spellcheck: false
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
The `provider` must be an object that has a `spellCheck` method that accepts
|
||||
an array of individual words for spellchecking.
|
||||
The `spellCheck` function runs asynchronously and calls the `callback` function
|
||||
@@ -139,10 +154,14 @@ this limitation.
|
||||
* `userGesture` Boolean (optional) - Default is `false`.
|
||||
|
||||
Returns `Promise<any>` - A promise that resolves with the result of the executed code
|
||||
or is rejected if the result of the code is a rejected promise.
|
||||
or is rejected if execution could not start.
|
||||
|
||||
Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
|
||||
|
||||
Note that when the execution of script fails, the returned promise will not
|
||||
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
|
||||
|
||||
@@ -99,16 +99,16 @@ Some examples of valid `urls`:
|
||||
* `timestamp` Double
|
||||
* `requestHeaders` Record<string, string>
|
||||
* `callback` Function
|
||||
* `response` Object
|
||||
* `beforeSendResponse` Object
|
||||
* `cancel` Boolean (optional)
|
||||
* `requestHeaders` Record<string, string> (optional) - When provided, request will be made
|
||||
* `requestHeaders` Record<string, string | string[]> (optional) - When provided, request will be made
|
||||
with these headers.
|
||||
|
||||
The `listener` will be called with `listener(details, callback)` before sending
|
||||
an HTTP request, once the request headers are available. This may occur after a
|
||||
TCP connection is made to the server, but before any http data is sent.
|
||||
|
||||
The `callback` has to be called with an `response` object.
|
||||
The `callback` has to be called with a `response` object.
|
||||
|
||||
#### `webRequest.onSendHeaders([filter, ]listener)`
|
||||
|
||||
@@ -146,11 +146,12 @@ response are visible by the time this listener is fired.
|
||||
* `timestamp` Double
|
||||
* `statusLine` String
|
||||
* `statusCode` Integer
|
||||
* `responseHeaders` Record<string, string> (optional)
|
||||
* `requestHeaders` Record<string, string>
|
||||
* `responseHeaders` Record<string, string[]> (optional)
|
||||
* `callback` Function
|
||||
* `response` Object
|
||||
* `headersReceivedResponse` Object
|
||||
* `cancel` Boolean (optional)
|
||||
* `responseHeaders` Record<string, string> (optional) - When provided, the server is assumed
|
||||
* `responseHeaders` Record<string, string | string[]> (optional) - When provided, the server is assumed
|
||||
to have responded with these headers.
|
||||
* `statusLine` String (optional) - Should be provided when overriding
|
||||
`responseHeaders` to change header status otherwise original response
|
||||
@@ -159,7 +160,7 @@ response are visible by the time this listener is fired.
|
||||
The `listener` will be called with `listener(details, callback)` when HTTP
|
||||
response headers of a request have been received.
|
||||
|
||||
The `callback` has to be called with an `response` object.
|
||||
The `callback` has to be called with a `response` object.
|
||||
|
||||
#### `webRequest.onResponseStarted([filter, ]listener)`
|
||||
|
||||
@@ -175,7 +176,7 @@ The `callback` has to be called with an `response` object.
|
||||
* `resourceType` String
|
||||
* `referrer` String
|
||||
* `timestamp` Double
|
||||
* `responseHeaders` Record<string, string> (optional)
|
||||
* `responseHeaders` Record<string, string[]> (optional)
|
||||
* `fromCache` Boolean - Indicates whether the response was fetched from disk
|
||||
cache.
|
||||
* `statusCode` Integer
|
||||
@@ -201,10 +202,11 @@ and response headers are available.
|
||||
* `timestamp` Double
|
||||
* `redirectURL` String
|
||||
* `statusCode` Integer
|
||||
* `statusLine` String
|
||||
* `ip` String (optional) - The server IP address that the request was
|
||||
actually sent to.
|
||||
* `fromCache` Boolean
|
||||
* `responseHeaders` Record<string, string> (optional)
|
||||
* `responseHeaders` Record<string, string[]> (optional)
|
||||
|
||||
The `listener` will be called with `listener(details)` when a server initiated
|
||||
redirect is about to occur.
|
||||
@@ -223,10 +225,11 @@ redirect is about to occur.
|
||||
* `resourceType` String
|
||||
* `referrer` String
|
||||
* `timestamp` Double
|
||||
* `responseHeaders` Record<string, string> (optional)
|
||||
* `responseHeaders` Record<string, string[]> (optional)
|
||||
* `fromCache` Boolean
|
||||
* `statusCode` Integer
|
||||
* `statusLine` String
|
||||
* `error` String
|
||||
|
||||
The `listener` will be called with `listener(details)` when a request is
|
||||
completed.
|
||||
|
||||
@@ -565,7 +565,7 @@ Prints `webview`'s web page. Same as `webContents.print([options])`.
|
||||
* `printSelectionOnly` Boolean (optional) - Whether to print selection only.
|
||||
* `landscape` Boolean (optional) - `true` for landscape, `false` for portrait.
|
||||
|
||||
Returns `Promise<Buffer>` - Resolves with the generated PDF data.
|
||||
Returns `Promise<Uint8Array>` - Resolves with the generated PDF data.
|
||||
|
||||
Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
|
||||
|
||||
@@ -593,7 +593,7 @@ examples.
|
||||
|
||||
### `<webview>.sendInputEvent(event)`
|
||||
|
||||
* `event` Object
|
||||
* `event` [MouseInputEvent](structures/mouse-input-event.md) | [MouseWheelInputEvent](structures/mouse-wheel-input-event.md) | [KeyboardInputEvent](structures/keyboard-input-event.md)
|
||||
|
||||
Returns `Promise<void>`
|
||||
|
||||
@@ -635,7 +635,7 @@ Returns `Promise<void>`
|
||||
|
||||
Sets the maximum and minimum pinch-to-zoom level.
|
||||
|
||||
### `<webview>.setLayoutZoomLevelLimits(minimumLevel, maximumLevel)`
|
||||
### `<webview>.setLayoutZoomLevelLimits(minimumLevel, maximumLevel)` _Deprecated_
|
||||
|
||||
* `minimumLevel` Number
|
||||
* `maximumLevel` Number
|
||||
@@ -644,11 +644,13 @@ Returns `Promise<void>`
|
||||
|
||||
Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
|
||||
|
||||
**Deprecated:** This API is no longer supported by Chromium.
|
||||
|
||||
### `<webview>.showDefinitionForSelection()` _macOS_
|
||||
|
||||
Shows pop-up dictionary that searches the selected word on the page.
|
||||
|
||||
### `<webview>.getWebContents()`
|
||||
### `<webview>.getWebContents()` _Deprecated_
|
||||
|
||||
Returns [`WebContents`](web-contents.md) - The web contents associated with
|
||||
this `webview`.
|
||||
@@ -767,7 +769,7 @@ Returns:
|
||||
* `requestId` Integer
|
||||
* `activeMatchOrdinal` Integer - Position of the active match.
|
||||
* `matches` Integer - Number of Matches.
|
||||
* `selectionArea` Object - Coordinates of first match region.
|
||||
* `selectionArea` Rectangle - Coordinates of first match region.
|
||||
* `finalUpdate` Boolean
|
||||
|
||||
Fired when a result is available for
|
||||
@@ -791,7 +793,7 @@ Returns:
|
||||
* `frameName` String
|
||||
* `disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
|
||||
`new-window`, `save-to-disk` and `other`.
|
||||
* `options` Object - The options which should be used for creating the new
|
||||
* `options` BrowserWindowConstructorOptions - The options which should be used for creating the new
|
||||
[`BrowserWindow`](browser-window.md).
|
||||
|
||||
Fired when the guest page attempts to open a new browser window.
|
||||
@@ -872,7 +874,7 @@ webview.addEventListener('close', () => {
|
||||
Returns:
|
||||
|
||||
* `channel` String
|
||||
* `args` Array
|
||||
* `args` any[]
|
||||
|
||||
Fired when the guest page has sent an asynchronous message to embedder page.
|
||||
|
||||
|
||||
@@ -22,6 +22,5 @@ For guides on Electron app development, see
|
||||
* [Debugging on Windows](debug-instructions-windows.md)
|
||||
* [Debugging on macOS](debugging-instructions-macos.md)
|
||||
* [Setting Up Symbol Server in Debugger](setting-up-symbol-server.md)
|
||||
* [Upgrading Chromium](upgrading-chromium.md)
|
||||
* [Upgrading Crashpad](upgrading-crashpad.md)
|
||||
* [Patches](patches.md)
|
||||
* [Upgrading Node](upgrading-node.md)
|
||||
|
||||
@@ -46,7 +46,7 @@ You can avoid much of the wait by reusing Electron CI's build output via
|
||||
optional steps (listed below) and these two environment variables:
|
||||
|
||||
```sh
|
||||
export SCCACHE_BUCKET="electronjs-sccache"
|
||||
export SCCACHE_BUCKET="electronjs-sccache-ci"
|
||||
export SCCACHE_TWO_TIER=true
|
||||
```
|
||||
|
||||
@@ -72,6 +72,7 @@ origin URLs.
|
||||
$ cd src/electron
|
||||
$ git remote remove origin
|
||||
$ git remote add origin https://github.com/electron/electron
|
||||
$ git checkout master
|
||||
$ git branch --set-upstream-to=origin/master
|
||||
$ cd -
|
||||
```
|
||||
@@ -226,20 +227,9 @@ under `src/` directory.
|
||||
|
||||
```sh
|
||||
$ ninja -C out/Debug third_party/electron_node:headers
|
||||
# Install the test modules with the generated headers
|
||||
$ (cd electron/spec && npm i --nodedir=../../out/Debug/gen/node_headers)
|
||||
```
|
||||
|
||||
Then, run Electron with `electron/spec` as the argument:
|
||||
|
||||
```sh
|
||||
# on Mac:
|
||||
$ ./out/Debug/Electron.app/Contents/MacOS/Electron electron/spec
|
||||
# on Windows:
|
||||
$ ./out/Debug/electron.exe electron/spec
|
||||
# on Linux:
|
||||
$ ./out/Debug/electron electron/spec
|
||||
```
|
||||
You can now [run the tests](testing.md#unit-tests).
|
||||
|
||||
If you're debugging something, it can be helpful to pass some extra flags to
|
||||
the Electron binary:
|
||||
|
||||
@@ -5,8 +5,15 @@ Follow the guidelines below for building Electron on Windows.
|
||||
## Prerequisites
|
||||
|
||||
* Windows 10 / Server 2012 R2 or higher
|
||||
* Visual Studio 2017 15.7.2 or higher - [download VS 2017 Community Edition for
|
||||
* Visual Studio 2017 15.7.2 or higher - [download VS 2019 Community Edition for
|
||||
free](https://www.visualstudio.com/vs/)
|
||||
* See [the Chromium build documentation](https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#visual-studio) for more details on which Visual Studio
|
||||
components are required.
|
||||
* If your Visual Studio is installed in a directory other than the default, you'll need to
|
||||
set a few environment variables to point the toolchains to your installation path.
|
||||
* `vs2019_install = DRIVE:\path\to\Microsoft Visual Studio\2019\Community`
|
||||
(replace `2019` and `Community` with your installed versions)
|
||||
* `WINDOWSSDKDIR = DRIVE:\path\to\Windows Kits\10`
|
||||
* [Python 2.7.10 or higher](http://www.python.org/download/releases/2.7/)
|
||||
* Contrary to the `depot_tools` setup instructions linked below, you will need
|
||||
to use your locally installed Python with at least version 2.7.10 (with
|
||||
@@ -113,3 +120,10 @@ This can happen during build, when Debugging Tools for Windows has been installe
|
||||
### ImportError: No module named win32file
|
||||
|
||||
Make sure you have installed `pywin32` with `pip install pywin32`.
|
||||
|
||||
### Build Scripts Hang Until Keypress
|
||||
|
||||
This bug is a "feature" of Windows' command prompt. It happens when clicking inside the prompt window with
|
||||
`QuickEdit` enabled and is intended to allow selecting and copying output text easily.
|
||||
Since each accidental click will pause the build process, you might want to disable this
|
||||
feature in the command prompt properties.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Issues In Electron
|
||||
|
||||
* [How to Contribute in Issues](#how-to-contribute-in-issues)
|
||||
* [How to Contribute to Issues](#how-to-contribute-to-issues)
|
||||
* [Asking for General Help](#asking-for-general-help)
|
||||
* [Submitting a Bug Report](#submitting-a-bug-report)
|
||||
* [Triaging a Bug Report](#triaging-a-bug-report)
|
||||
* [Resolving a Bug Report](#resolving-a-bug-report)
|
||||
|
||||
## How to Contribute in Issues
|
||||
## How to Contribute to Issues
|
||||
|
||||
For any issue, there are fundamentally three ways an individual can
|
||||
contribute:
|
||||
@@ -75,7 +75,7 @@ If you believe that you have found a bug in Electron, please fill out this
|
||||
form to the best of your ability.
|
||||
|
||||
The two most important pieces of information needed to evaluate the report are
|
||||
a description of the bug and a simple test case to recreate it. It easier to fix
|
||||
a description of the bug and a simple test case to recreate it. It is easier to fix
|
||||
a bug if it can be reproduced.
|
||||
|
||||
See [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve).
|
||||
@@ -92,7 +92,7 @@ are not helpful or professional. To many, such responses are annoying and
|
||||
unfriendly.
|
||||
|
||||
Contributors are encouraged to solve issues collaboratively and help one
|
||||
another make progress. If encounter an issue that you feel is invalid, or
|
||||
another make progress. If you encounter an issue that you feel is invalid, or
|
||||
which contains incorrect information, explain *why* you feel that way with
|
||||
additional supporting context, and be willing to be convinced that you may
|
||||
be wrong. By doing so, we can often reach the correct outcome faster.
|
||||
|
||||
89
docs/development/patches.md
Normal file
89
docs/development/patches.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# Patches in Electron
|
||||
|
||||
Electron is built on two major upstream projects: Chromium and Node.js. Each of these projects has several of their own dependencies, too. We try our best to use these dependencies exactly as they are but sometimes we can't achieve our goals without patching those upstream dependencies to fit our use cases.
|
||||
|
||||
## Patch justification
|
||||
|
||||
Every patch in Electron is a maintenance burden. When upstream code changes, patches can break—sometimes without even a patch conflict or a compilation error. It's an ongoing effort to keep our patch set up-to-date and effective. So we strive to keep our patch count at a minimum. To that end, every patch must describe its reason for existence in its commit message. That reason must be one of the following:
|
||||
|
||||
1. The patch is temporary, and is intended to be (or has been) committed upstream or otherwise eventually removed. Include a link to an upstream PR or code review if available, or a procedure for verifying whether the patch is still needed at a later date.
|
||||
2. The patch allows the code to compile in the Electron environment, but cannot be upstreamed because it's Electron-specific (e.g. patching out references to Chrome's `Profile`). Include reasoning about why the change cannot be implemented without a patch (e.g. by subclassing or copying the code).
|
||||
3. The patch makes Electron-specific changes in functionality which are fundamentally incompatible with upstream.
|
||||
|
||||
In general, all the upstream projects we work with are friendly folks and are often happy to accept refactorings that allow the code in question to be compatible with both Electron and the upstream project. (See e.g. [this](https://chromium-review.googlesource.com/c/chromium/src/+/1637040) change in Chromium, which allowed us to remove a patch that did the same thing, or [this](https://github.com/nodejs/node/pull/22110) change in Node, which was a no-op for Node but fixed a bug in Electron.) **We should aim to upstream changes whenever we can, and avoid indefinite-lifetime patches**.
|
||||
|
||||
## Patch system
|
||||
|
||||
If you find yourself in the unfortunate position of having to make a change which can only be made through patching an upstream project, you'll need to know how to manage patches in Electron.
|
||||
|
||||
All patches to upstream projects in Electron are contained in the `patches/` directory. Each subdirectory of `patches/` contains several patch files, along with a `.patches` file which lists the order in which the patches should be applied. Think of these files as making up a series of git commits that are applied on top of the upstream project after we check it out.
|
||||
|
||||
```text
|
||||
patches
|
||||
├── config.json <-- this describes which patchset directory is applied to what project
|
||||
├── chromium
|
||||
│ ├── .patches
|
||||
│ ├── accelerator.patch
|
||||
│ ├── add_contentgpuclient_precreatemessageloop_callback.patch
|
||||
│ ⋮
|
||||
├── node
|
||||
│ ├── .patches
|
||||
│ ├── add_openssl_is_boringssl_guard_to_oaep_hash_check.patch
|
||||
│ ├── build_add_gn_build_files.patch
|
||||
│ ⋮
|
||||
⋮
|
||||
```
|
||||
|
||||
To help manage these patch sets, we provide two tools: `git-import-patches` and `git-export-patches`. `git-import-patches` imports a set of patch files into a git repository by applying each patch in the correct order and creating a commit for each one. `git-export-patches` does the reverse; it exports a series of git commits in a repository into a set of files in a directory and an accompanying `.patches` file.
|
||||
|
||||
> Side note: the reason we use a `.patches` file to maintain the order of applied patches, rather than prepending a number like `001-` to each file, is because it reduces conflicts related to patch ordering. It prevents the situation where two PRs both add a patch at the end of the series with the same numbering and end up both getting merged resulting in a duplicate identifier, and it also reduces churn when a patch is added or deleted in the middle of the series.
|
||||
|
||||
### Usage
|
||||
|
||||
#### Adding a new patch
|
||||
```bash session
|
||||
$ cd src/third_party/electron_node
|
||||
$ vim some/code/file.cc
|
||||
$ git commit
|
||||
$ ../../electron/script/git-export-patches -o ../../electron/patches/node
|
||||
```
|
||||
|
||||
> **NOTE**: `git-export-patches` ignores any uncommitted files, so you must create a commit if you want your changes to be exported. The subject line of the commit message will be used to derive the patch file name, and the body of the commit message should include the reason for the patch's existence.
|
||||
|
||||
Re-exporting patches will sometimes cause shasums in unrelated patches to change. This is generally harmless and can be ignored (but go ahead and add those changes to your PR, it'll stop them from showing up for other people).
|
||||
|
||||
#### Editing an existing patch
|
||||
```bash session
|
||||
$ cd src/v8
|
||||
$ vim some/code/file.cc
|
||||
$ git log
|
||||
# Find the commit sha of the patch you want to edit.
|
||||
$ git commit --fixup [COMMIT_SHA]
|
||||
$ git rebase --autosquash -i [COMMIT_SHA]^
|
||||
$ ../electron/script/git-export-patches -o ../electron/patches/v8
|
||||
```
|
||||
|
||||
#### Removing a patch
|
||||
```bash session
|
||||
$ vim src/electron/patches/node/.patches
|
||||
# Delete the line with the name of the patch you want to remove
|
||||
$ cd src/third_party/electron_node
|
||||
$ git reset --hard refs/patches/upstream-head
|
||||
$ ../../electron/script/git-import-patches ../../electron/patches/node
|
||||
$ ../../electron/script/git-export-patches -o ../../electron/patches/node
|
||||
```
|
||||
|
||||
Note that `git-import-patches` will mark the commit that was `HEAD` when it was run as `refs/patches/upstream-head`. This lets you keep track of which commits are from Electron patches (those that come after `refs/patches/upstream-head`) and which commits are in upstream (those before `refs/patches/upstream-head`).
|
||||
|
||||
#### Resolving conflicts
|
||||
When updating an upstream dependency, patches may fail to apply cleanly. Often, the conflict can be resolved automatically by git with a 3-way merge. You can instruct `git-import-patches` to use the 3-way merge algorithm by passing the `-3` argument:
|
||||
|
||||
```bash session
|
||||
$ cd src/third_party/electron_node
|
||||
# If the patch application failed midway through, you can reset it with:
|
||||
$ git am --abort
|
||||
# And then retry with 3-way merge:
|
||||
$ ../../electron/script/git-import-patches -3 ../../electron/patches/node
|
||||
```
|
||||
|
||||
If `git-import-patches -3` encounters a merge conflict that it can't resolve automatically, it will pause and allow you to resolve the conflict manually. Once you have resolved the conflict, `git add` the resolved files and continue to apply the rest of the patches by running `git am --continue`.
|
||||
@@ -48,3 +48,12 @@ would run `npm run test -- -g ipc`.
|
||||
1. Push the Windows key and search for _Manage optional features_.
|
||||
1. Click _Add a feature_.
|
||||
1. Select _Japanese Supplemental Fonts_ and click _Install_.
|
||||
|
||||
|
||||
Some tests which rely on precise pixel measurements may not work correctly on
|
||||
devices with Hi-DPI screen settings due to floating point precision errors.
|
||||
To run these tests correctly, make sure the device is set to 100% scaling.
|
||||
|
||||
To configure display scaling:
|
||||
1. Push the Windows key and search for _Display settings_.
|
||||
1. Under _Scale and layout_, make sure that the device is set to 100%.
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
# Upgrading Chromium
|
||||
|
||||
This is an overview of the steps needed to upgrade Chromium in Electron.
|
||||
|
||||
- Upgrade libcc to a new Chromium version
|
||||
- Make Electron code compatible with the new libcc
|
||||
- Update Electron dependencies (crashpad, NodeJS, etc.) if needed
|
||||
- Make internal builds of libcc and electron
|
||||
- Update Electron docs if necessary
|
||||
|
||||
|
||||
## Upgrade `libcc` to a new Chromium version
|
||||
|
||||
1. Get the code and initialize the project:
|
||||
```sh
|
||||
$ git clone git@github.com:electron/libchromiumcontent.git
|
||||
$ cd libchromiumcontent
|
||||
$ ./script/bootstrap -v
|
||||
```
|
||||
2. Update the Chromium snapshot
|
||||
- Choose a version number from [OmahaProxy](https://omahaproxy.appspot.com/)
|
||||
and update the `VERSION` file with it
|
||||
- This can be done manually by visiting OmahaProxy in a browser, or automatically:
|
||||
- One-liner for the latest stable mac version: `curl -so- https://omahaproxy.appspot.com/mac > VERSION`
|
||||
- One-liner for the latest win64 beta version: `curl -so- https://omahaproxy.appspot.com/all | grep "win64,beta" | awk -F, 'NR==1{print $3}' > VERSION`
|
||||
- run `$ ./script/update`
|
||||
- Brew some tea -- this may run for 30m or more.
|
||||
- It will probably fail applying patches.
|
||||
3. Fix `*.patch` files in the `patches/` and `patches-mas/` folders.
|
||||
4. (Optional) `script/update` applies patches, but if multiple tries are needed
|
||||
you can manually run the same script that `update` calls:
|
||||
`$ ./script/apply-patches`
|
||||
- There is a second script, `script/patch.py` that may be useful.
|
||||
Read `./script/patch.py -h` for more information.
|
||||
5. Run the build when all patches can be applied without errors
|
||||
- `$ ./script/build`
|
||||
- If some patches are no longer compatible with the Chromium code,
|
||||
fix compilation errors.
|
||||
6. When the build succeeds, create a `dist` for Electron
|
||||
- `$ ./script/create-dist --no_zip`
|
||||
- It will create a `dist/main` folder in the libcc repo's root.
|
||||
You will need this to build Electron.
|
||||
7. (Optional) Update script contents if there are errors resulting from files
|
||||
that were removed or renamed. (`--no_zip` prevents script from create `dist`
|
||||
archives. You don't need them.)
|
||||
|
||||
|
||||
## Update Electron's code
|
||||
|
||||
1. Get the code:
|
||||
```sh
|
||||
$ git clone git@github.com:electron/electron.git
|
||||
$ cd electron
|
||||
```
|
||||
2. If you have libcc built on your machine in its own repo,
|
||||
tell Electron to use it:
|
||||
```sh
|
||||
$ ./script/bootstrap.py -v \
|
||||
--libcc_source_path <libcc_folder>/src \
|
||||
--libcc_shared_library_path <libcc_folder>/shared_library \
|
||||
--libcc_static_library_path <libcc_folder>/static_library
|
||||
```
|
||||
3. If you haven't yet built libcc but it's already supposed to be upgraded
|
||||
to a new Chromium, bootstrap Electron as usual
|
||||
`$ ./script/bootstrap.py -v`
|
||||
- Ensure that libcc submodule (`vendor/libchromiumcontent`) points to the
|
||||
right revision
|
||||
|
||||
4. Set `CLANG_REVISION` in `script/update-clang.sh` to match the version
|
||||
Chromium is using.
|
||||
- Located in `electron/libchromiumcontent/src/tools/clang/scripts/update.py`
|
||||
|
||||
5. Checkout Chromium if you haven't already:
|
||||
- https://chromium.googlesource.com/chromium/src.git/+/{VERSION}/tools/clang/scripts/update.py
|
||||
- (Replace the `{VERSION}` placeholder in the url above to the Chromium
|
||||
version libcc uses.)
|
||||
6. Build Electron.
|
||||
- Try to build Debug version first: `$ ./script/build.py -c D`
|
||||
- You will need it to run tests
|
||||
7. Fix compilation and linking errors
|
||||
8. Ensure that Release build can be built too
|
||||
- `$ ./script/build.py -c R`
|
||||
- Often the Release build will have different linking errors that you'll
|
||||
need to fix.
|
||||
- Some compilation and linking errors are caused by missing source/object
|
||||
files in the libcc `dist`
|
||||
9. Update `./script/create-dist` in the libcc repo, recreate a `dist`, and
|
||||
run Electron bootstrap script once again.
|
||||
|
||||
### Tips for fixing compilation errors
|
||||
- Fix build config errors first
|
||||
- Fix fatal errors first, like missing files and errors related to compiler
|
||||
flags or defines
|
||||
- Try to identify complex errors as soon as possible.
|
||||
- Ask for help if you're not sure how to fix them
|
||||
- Disable all Electron features, fix the build, then enable them one by one
|
||||
- Add more build flags to disable features in build-time.
|
||||
|
||||
When a Debug build of Electron succeeds, run the tests:
|
||||
`$ npm run test`
|
||||
Fix the failing tests.
|
||||
|
||||
Follow all the steps above to fix Electron code on all supported platforms.
|
||||
|
||||
|
||||
## Updating Crashpad
|
||||
|
||||
If there are any compilation errors related to the Crashpad, it probably means
|
||||
you need to update the fork to a newer revision. See
|
||||
[Upgrading Crashpad](upgrading-crashpad.md)
|
||||
for instructions on how to do that.
|
||||
|
||||
|
||||
## Updating NodeJS
|
||||
|
||||
Upgrade `vendor/node` to the Node release that corresponds to the v8 version
|
||||
used in the new Chromium release. See the v8 versions in Node on
|
||||
|
||||
See [Upgrading Node](upgrading-node.md)
|
||||
for instructions on this.
|
||||
|
||||
## Verify ffmpeg support
|
||||
|
||||
Electron ships with a version of `ffmpeg` that includes proprietary codecs by
|
||||
default. A version without these codecs is built and distributed with each
|
||||
release as well. Each Chrome upgrade should verify that switching this version
|
||||
is still supported.
|
||||
|
||||
You can verify Electron's support for multiple `ffmpeg` builds by loading the
|
||||
following page. It should work with the default `ffmpeg` library distributed
|
||||
with Electron and not work with the `ffmpeg` library built without proprietary
|
||||
codecs.
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Proprietary Codec Check</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Checking if Electron is using proprietary codecs by loading video from http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4</p>
|
||||
<p id="outcome"></p>
|
||||
<video style="display:none" src="http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4" autoplay></video>
|
||||
<script>
|
||||
const video = document.querySelector('video')
|
||||
video.addEventListener('error', ({ target }) => {
|
||||
if (target.error.code === target.error.MEDIA_ERR_SRC_NOT_SUPPORTED) {
|
||||
document.querySelector('#outcome').textContent = 'Not using proprietary codecs, video emitted source not supported error event.'
|
||||
} else {
|
||||
document.querySelector('#outcome').textContent = `Unexpected error: ${target.error.code}`
|
||||
}
|
||||
})
|
||||
video.addEventListener('playing', () => {
|
||||
document.querySelector('#outcome').textContent = 'Using proprietary codecs, video started playing.'
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## Useful links
|
||||
|
||||
- [Chrome Release Schedule](https://www.chromium.org/developers/calendar)
|
||||
- [OmahaProxy](http://omahaproxy.appspot.com)
|
||||
- [Chromium Issue Tracker](https://bugs.chromium.org/p/chromium)
|
||||
@@ -1,39 +0,0 @@
|
||||
# Upgrading Crashpad
|
||||
|
||||
1. Get the version of crashpad that we're going to use.
|
||||
- `libcc/src/third_party/crashpad/README.chromium` will have a line `Revision:` with a checksum
|
||||
- We need to check out the corresponding branch.
|
||||
- Clone Google's crashpad (https://chromium.googlesource.com/crashpad/crashpad)
|
||||
- `git clone https://chromium.googlesource.com/crashpad/crashpad`
|
||||
- Check out the branch with the revision checksum:
|
||||
- `git checkout <revision checksum>`
|
||||
- Add electron's crashpad fork as a remote
|
||||
- `git remote add electron https://github.com/electron/crashpad`
|
||||
- Check out a new branch for the update
|
||||
- `git checkout -b electron-crashpad-vA.B.C.D`
|
||||
- `A.B.C.D` is the Chromium version found in `libcc/VERSION`
|
||||
and will be something like `62.0.3202.94`
|
||||
|
||||
2. Make a checklist of the Electron patches that need to be applied
|
||||
with `git log --oneline`
|
||||
- Or view https://github.com/electron/crashpad/commits/previous-branch-name
|
||||
|
||||
3. For each patch:
|
||||
- In `electron-crashpad-vA.B.C.D`, cherry-pick the patch's checksum
|
||||
- `git cherry-pick <checksum>`
|
||||
- Resolve any conflicts
|
||||
- Make sure it builds then add, commit, and push work to electron's crashpad fork
|
||||
- `git push electron electron-crashpad-vA.B.C.D`
|
||||
|
||||
4. Update Electron to build the new crashpad:
|
||||
- `cd vendor/crashpad`
|
||||
- `git fetch`
|
||||
- `git checkout electron-crashpad-v62.0.3202.94`
|
||||
5. Regenerate Ninja files against both targets
|
||||
- From Electron root's root, run `script/update.py`
|
||||
- `script/build.py -c D --target=crashpad_client`
|
||||
- `script/build.py -c D --target=crashpad_handler`
|
||||
- Both should build with no errors
|
||||
6. Push changes to submodule reference
|
||||
- (From electron root) `git add vendor/crashpad`
|
||||
- `git push origin upgrade-to-chromium-62`
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user