Merge autoland to mozilla-central. a=merge

This commit is contained in:
Dorel Luca 2020-11-13 11:58:20 +02:00
Родитель 14c18cae4f 119d8f1aa7
Коммит 44e6dfd7e0
604 изменённых файлов: 30110 добавлений и 7174 удалений

Просмотреть файл

@ -856,6 +856,144 @@ afb520e82a88987cbb7ba9666cbc24f6473255cc # gecko-dev
# 10d5143647cfda21649cf254adcb21d116524c5d - Sylvestre Ledru - Bug 1489454 - Remove all trailing whitespaces (again) r=Ehsan
b8543d174a16b7247f5de49ccfb55bd3b679b0c2 # cinnabar
aa37bde79bb4cccec902e118ceeae32526bf3c1f # gecko-dev
# 10d90fa56710390d54d44f25d05054e62e08af03 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/builtin, part 1. r=anba
c41acde79808f03755336848965131678634dc85 # cinnabar
87fd9cfafc20cbbfc06548fc24cfec9a1870610c # gecko-dev
# 422abc78931ce85a2950b6b2e554981f5354d5c1 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/builtin, part 2. r=jorendorff
1e317d5a90cb57d05364cdf4fcf8bbb23397d348 # cinnabar
49add130b66b4a23c3608bc8081dff573f03a319 # gecko-dev
# 506e668e28645f38b226ea203aed38b5b5f0b0e5 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/builtin, part 3. r=evilpie
263a82e96d545bbbf2757c3d28710d70a474358a # cinnabar
e4fdfe59485644f16d48f4d51d3da8b0e0c497aa # gecko-dev
# 3fa402809570cf52220fd946081de01d7d117174 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/builtin/intl. r=jorendorff
510afab44ff9e644889ef77627cb27055f60dfc5 # cinnabar
83fddc286519e2b694dfce3d6eda389d2b20cbbb # gecko-dev
# 6c382d4ab0d0deb714f15300afea2c52dff94e47 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/frontend, part 1. r=Yoric
f763621f8f75f644f35719085f8de9d5f58f026b # cinnabar
abfdb3755683ac6872f74180a4d81a0f57a40afc # gecko-dev
# f758714e4ed9a93b2db83be95fb669f53658a58b - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/frontend, part 2. r=arai
7b1cfd2f75e21d8895e82f83058ab22c14d35425 # cinnabar
a1fe41d1fe1b8356e019935433af17c9a351d727 # gecko-dev
# 719bd7da3367b47f19800b1761ecbd5d97a49fa2 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/frontend, part 3. r=arai
194d77249d1019a113c8c2d221dfa56f7c3c9227 # cinnabar
00d085e8e7ed2d4c54369100f219263dd6b5ac84 # gecko-dev
# 9f7beee7269b10833e0ca8446195cc354dac63c3 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/frontend, part 4. r=jorendorff
0a12af94e9df7de9b9631cdf532a90c669098ed9 # cinnabar
30819202972a99ccaa0dac17f9be539d59ffda9a # gecko-dev
# 3ba56e06507e0c78c679261c3d0424decb3f7b29 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/gc, part 1. r=sfink
853dbaf41cec847177067906f7df1b839db0b63c # cinnabar
c4600c73ca9a904d79b31c10beaf21f53a9c046b # gecko-dev
# d27cd3305320b12ad93f0837090a0913d0f31e76 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/gc, part 2. r=jonco
bd701e90f0665b8a57646028a282b06249a7c602 # cinnabar
cc2932b2cc876c1177bf0da3eb1af982ad33356d # gecko-dev
# 68e5c74b6e90baf1212846920435dbe0ae17f346 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/gc, part 3. r=jorendorff
9af52fd55db34b2a150b3ae95ac1db3b280bab26 # cinnabar
f4059955f755f209cab7a482f26d585379ce6109 # gecko-dev
# 5150b70229209c5d020eef82819f5b8d5aebda0e - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/gc, part 4. r=sfink
c3bfbf81e01f505fdc4e2bb8ab757e226d331daf # cinnabar
75ce27e2a1f2a8b8b2a9166b10c82f8da8e32fdc # gecko-dev
# bc503aa87b272bdcef98a35c9759e25a15031241 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/proxy. r=evilpie
5bce1ead253ac0fbce289333515344b9950e8a9a # cinnabar
a35f4bcc40e6e8972b9ebbf7e54f1f78d3b523ac # gecko-dev
# 847f8ad07bd59db3f23243baf924dfe8682297d6 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/util. r=anba
992dd7fe7a9ab9931afb18a6946bfb60620e2d5f # cinnabar
b5680387949c9b2e2c0b1183e1f66a1c57bb1a62 # gecko-dev
# 062a7185253dd2c253c5a3a2e9f177be37483252 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/threading. r=khyperia
a912058789341807eb79b93c9d33209969e2f07f # cinnabar
ef8a7283769a01a7f0f900a6967140ae419f502a # gecko-dev
# 48c78757dc15531f94c8fd67dd70bc467e74543e - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 1. r=tcampbell
44a9a6f702494f9bb09128184af0520b1aa934cd # cinnabar
567b7fa6464908329b964c7aea808ac5f2378b9b # gecko-dev
# 9f1df06ee3066e30ca84e270e37087f632969ca6 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 2. r=mgaudet
8ea64a2037641a746744e19de73e04dcb92115f3 # cinnabar
9795462b0332a067e95e8279c93b9ae640c5132d # gecko-dev
# 236cf9e1bd84919f1f7603d579c667a14a1ffd92 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 3. r=nbp
8019492f133ecb2ce6d31b89168f38377468108c # cinnabar
c0820042edede6a1b473616eedb9bbfe74c4c6d8 # gecko-dev
# 78d8957d12e298347c2cebe535ae565763ba361f - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 4. r=luke
692ed3edf55bdd0feada279dc20244caae7beaf3 # cinnabar
24c7ee16090183001dc6be9e8282c7028a018b72 # gecko-dev
# f24489d307bedccd634b994043138d14bfc90d04 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 5. r=bbouvier
30e7db9d251f78efe55e5cd9e6b24d26781cfccf # cinnabar
6f9df7f3959c9453ee5d6be984c01befecf78fd8 # gecko-dev
# b5b33a78679f204f9284dc126ca96c2c619acf71 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 6. r=jorendorff
8a05d0b4ef511ac7cf2e016f57cce1291e942356 # cinnabar
143fc0eb5429f8cfd9a006b409e1e3dbc2326484 # gecko-dev
# 3810b18e5e79dc6a5204a2df01bfaafc40f0573e - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 7. r=jorendorff
eafc0144130b26077147d3b148f0952840961011 # cinnabar
8f0240d2d4f77b1260aea53605500b741ecbe06e # gecko-dev
# bde61aedfb5c51a2a761037be694df136ede49cd - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 8. r=sfink
3065d22e344fdb0ebc35a33f68ab8b67e81df373 # cinnabar
673c78483c4b26d3d3eca7c88ff1ae53693a47ac # gecko-dev
# 045f3d6c75024958390a18753f3698f9d177ec61 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 9. r=khyperia
bde6f1d7a1bdd140997a0203c2bed845df2084bd # cinnabar
028b2fe50ec55d5356ed42b605caf00ac796e334 # gecko-dev
# 6b3a95df3c123910eeab97cb7cd7cbf0884bd413 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 10. r=lth
9c17bb9e1a54a7d2ccb6fc10417eded49fdd53f7 # cinnabar
e0f3b60f0ebd12c55c4e8fe498b4d7207fce7a45 # gecko-dev
# 219721735c51630107ce70c295c26b88bb87ab3a - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 11. r=tcampbell
a1476db76ec77599b7c05e50c07664df868de966 # cinnabar
83b65ddc57b0f634121fbeb744616522a6e61a64 # gecko-dev
# 710ba7b57cd3b7febccd5f390081f614ebe2df3c - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 12. r=bbouvier
ca8a87bab2ece7e21d4804ef9f912673d73e5864 # cinnabar
408417dc41534d02d81c5cd01ee10ec5a25f6e6d # gecko-dev
# 9a67686aabe8131742f00bdcf6919b5a2cc48f9a - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/wasm, part 1. r=bbouvier
0402619df3dff2d9a1f1042de74de47313f73964 # cinnabar
454914989e256770dffa85d458c4d4d62ed1e16c # gecko-dev
# ed9bb62ebea140a50e38c08e663b0550a1c3c5da - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/wasm, part 2. r=lth
1097cd66f526459baf6ef8b97aa0f64000c4727e # cinnabar
d8b0f9131315795c86416caa70ef15ebcf181b4a # gecko-dev
# ab68962c6c3ffb885da31f617301cb63b6fa73af - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/wasm, part 3. r=luke
141eec133a1f5fb6a5eb29eae0924a147db93070 # cinnabar
9f36b27569493443d8a9fe2f39893dc77b33c7e9 # gecko-dev
# 20142eb6afd6c14610943833a5e7bdbceb4dfb8a - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/wasm, part 4. r=luke
7005d0acdf71a64e47e3ee41c1f7e32876cfdb73 # cinnabar
880273a48556a60292b1ac86ab54459b4e93ceb8 # gecko-dev
# e3a9c003c9c5d3d6484fa88ba07bdd7c0ff183d5 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/wasm, part 5. r=bbouvier
e6eee1f918ef3599e46a00fb2e3768df72f3fae5 # cinnabar
1f6e5f662c2e25b26bed01e21d270a3837894a25 # gecko-dev
# 817b7142d4d965f9ab591a33268e2a59d29e4aed - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 1. r=tcampbell
508299042dad5003f0dffe9d6f116850c9749c61 # cinnabar
6687723eb70e34868de04d54033af160522969b2 # gecko-dev
# 6a52f517bdb44b42b677c7c50a67d9306b3ed935 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 2. r=mgaudet
d1e685d044c8fca37a8d43de5756785b3a656ef4 # cinnabar
050dae31d56078d1aefb26d46bac745d01e76687 # gecko-dev
# 19ae9ff093caf9f9071277549c5aac056db90587 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 3. r=nbp
3cbd3d56eb335503e75aa0b60fdb98d0fc49df04 # cinnabar
8ea27917d04209baf22ba34424e1a7eb03b555c7 # gecko-dev
# bc2538bb2e9d925b17f45e1570cb6441ab6f8e3d - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 4. r=bbouvier
4ece55ae7439abd851cb1bfaed17b1ffd01f9c2a # cinnabar
b8be6d2660acfc4b9f3876b543cb0d053394a6d9 # gecko-dev
# 8fd55df51b25f080dcbf749bd9127f7fea3b36f4 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 5. r=tcampbell
ba023df7fbb92fedc02a25c8533ed3069fc5ebb0 # cinnabar
6f1da9c980346d15d1f48824291fbe9fade5d523 # gecko-dev
# a946ea065650ac0422ad82c272496ff6290f5410 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 6. r=evilpie
70bb821ec3c99cc9d2ba89c477d80b54be408f3a # cinnabar
08d5c21a3fb65ea70f888d2ae598719579eddd3a # gecko-dev
# fead9919a173160ff1d66715cd34e17ac0d11bce - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 7. r=jandem
990bd0b32bfe0af0af336b9f48c2298866387a38 # cinnabar
3d374e57a9db84da89011c35c5c90589018bafa3 # gecko-dev
# e620cff42c301ca3ee5e50856c185bad2695c39b - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 8. r=jandem
5327992dab5ad666442c9d395718a4c1548c589c # cinnabar
840e24b445ecf65b80a63da3085a57e2cddef550 # gecko-dev
# c56540cb6e028b2eb724d6316b5b47c9adcee0e1 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/shell. r=jandem
29b1224fe8ef4253182f3b4ad0496b92d465aaac # cinnabar
28eb0626a17403b176fa26926098c085eb3f6d0b # gecko-dev
# a6baf63a4fd58b89dd1aad32a840aeb1288cb5f1 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/js*. r=jandem
94fa5a0b50427f8781183a16c2fba2687c397ed3 # cinnabar
670c162df38c900555ac978d0b4fe127a237f94f # gecko-dev
# f2bedf1fe932f1bb3277a4db1e11fbb02b3242d8 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/public. r=jandem
9cd3054445b0a33973f96dd7ca9ceee46ead9295 # cinnabar
ab644b087f3dcb920bef3ef031a9d88d819f453e # gecko-dev
# cab441a582e82e1875fd9271b78f3b5e8462376d - Jan de Mooij - Bug 1490589 - Add braces for if-statements in make_unicode.py. r=arai
6405c10911d23d46162756480df72b72dbc8724f # cinnabar
816b6b6516c3ad86944e24fdd80fb319bdbb9ff3 # gecko-dev
# 91fc6c048c077c12a9326cb6825ea9e12158764d - Jan de Mooij - Bug 1490594 - Always use braces for if/for/while statements in jsapi-tests. r=luke
47b588c2e9bdb05f966064b284f2127e55090268 # cinnabar
eabefc7394c64a6996df8b03815814a2896344bb # gecko-dev
# ec5fe5d123b1baac235d978858c5226f7c8d9ed0 - Jan de Mooij - Bug 1490594 - Always use braces for if/for/while statements in jsapi-tests. r=luke
85768612d1bb1629ad44105b136ddc8ceb6b7d19 # cinnabar
df77c423a5d18e3a997563b47c50a3c0b55f68e9 # gecko-dev
# ea73513d7c2555142333f4667a37788023f92f2a - Mark Banner - Bug 1489980 - Editor ESLint for editor/ - Initial setup adding configs for tests. r=masayuki
44a478c9f2df808c2f72f682869aacf562cc62e0 # cinnabar
3720c020c0c84345fe7d76923bd05fb64eaa1f3a # gecko-dev
@ -865,6 +1003,36 @@ d5e3a6a9e5c07a45fde5dc5bae33673615e13455 # gecko-dev
# 0d8eb8a0c2b4ad081ffad8ecf172b82d16c38d01 - Mark Banner - Bug 1489980 - Enable ESLint for editor/ - Manual fixes. r=masayuki
475e2a9c818bdbad9946dda3ecc3ffcfc15e560a # cinnabar
e824d800fb547242e168c8f12be8c5fa5cfc120d # gecko-dev
# 7bbf9560f451422023e71284069254309eb9ca78 - Jan de Mooij - Bug 1490993 part 1 - Always use braces for if/for/while statements in js/src/jit/x64. r=mgaudet
7865f48fc78ee80ec4edacbdd213219a83becb25 # cinnabar
ea80c8629f4b334929d7109a8cdd80daefcb39dd # gecko-dev
# 3c10148fb9a8056c216f1c3f1fba8d6fec35a9c8 - Jan de Mooij - Bug 1490993 part 2 - Always use braces for if/for/while statements in js/src/jit/x86. r=tcampbell
44ef4ab655da65b6691278b22f8c4d1182581ba6 # cinnabar
92beda17be976a7108e62c3324d39c3011479293 # gecko-dev
# e6cce3b04ab699ce80f5b90321308f66eb43d562 - Jan de Mooij - Bug 1490993 part 3 - Always use braces for if/for/while statements in js/src/jit/x86-shared. r=nbp
a7e3a882e9f308a01c9fde47a3925b6ebf8b80dd # cinnabar
7c02dd463269ec8d0958b0ad4a7836c506c1189f # gecko-dev
# 63a03fced45b169986a591310bd6572594a10fa0 - Jan de Mooij - Bug 1490993 part 4 - Always use braces for if/for/while statements in js/src/jit/arm. r=tcampbell
c83df309c6f55cf78af30a6b1ec6dee5852238f5 # cinnabar
dd59f602e2b97bbb0fe73ba95057725d2d5d37ef # gecko-dev
# 371ea54455859baa1f9a5dd2d70772e04d6829bd - Jan de Mooij - Bug 1490993 part 5 - Always use braces for if/for/while statements in js/src/jit/arm64. r=luke
e1a46ea06d169f4ecf4b2bb9c792bfa590b1a48b # cinnabar
f75dda188ab0ab5b689f798653a7a0c0feea5cf7 # gecko-dev
# 0667570cb938dd973aaef61ccd31f0a74ce57a9b - Jan de Mooij - Bug 1490993 part 6 - Always use braces for if/for/while statements in js/src/jit/{mips32,mips64,mips-shared}. r=tcampbell
896960aa1c65e74e9e8da244ec98fa66c1d00d3e # cinnabar
a493a8cfe853d78c3b0c902ab4a69e36848b63f4 # gecko-dev
# 765542d6237ecf99af924f61485d7fe19f4f722c - Tooru Fujisawa <arai_a@mac.com> - Bug 1490548 - Always use braces for if/for/while statements in BinAST auto-generated code r=Yoric
5eed8696724393673b7f7d3fc920a6f439de99aa # cinnabar
9bc0d5d15d945aff731a60942893ed1079b38407 # gecko-dev
# a2f6f03530301e5fa6357815265f782400c612d9 - Jan de Mooij - Bug 1492416 - Always use braces for if/for/while statements in js/src/ds. r=arai
d9c9de62d8efc091cb3e3acb61bf627b85637c26 # cinnabar
0143ee21c0f84a697c0f71ff8cd9799120b58449 # gecko-dev
# 146575efb1c65085c56ee57d7cdc1de54c0f600b - Jan de Mooij - Bug 1496033 - Add missing {} in js/src. r=bbouvier
27c6e55f56fe42ae55077eee6147805c8048c547 # cinnabar
05cdba23d9bf753f243cc8342bc7bfab4880709b # gecko-dev
# b60cb229416c3a4d2744611cf89051f574ced95e - Jan de Mooij - Bug 1489242 - Add {} to example code in comments. r=jorendorff
a7ba6fc3c543b1cd42d4006ffed4340a0977496a # cinnabar
0811112d770e8e12dcb81fc79068c90a16a793e3 # gecko-dev
# b4d7770b8661338c878166beca941eeb830f6041 - Paul Adenot - Bug 1497254 - clang-format MediaEngineWebRTCAudio.{cpp,h} and MediaEnginePrefs.h. r=pehrsons
03412b0f475fa8911d0abcf700c820152fb76984 # cinnabar
3c9ac6a32de8d50b0a15a57d20b8d4889f1a57e6 # gecko-dev

Просмотреть файл

@ -283,9 +283,65 @@ ee957e55c91e5a68849eef53e9a4bfacdf9d1a12 - Mark Banner - Bug 1475004 - Enable ES
d7fcfbc15cfe5e33cce5a12ff009e9b6aec07811 - Mark Banner - Bug 1486739 - Add missing dangling commas in browser/, services/, taskcluster/ and toolkit/. r=mossop
1bc6d1a2d201a3e8d3d726fc87d7fb5670bbce1c - Mark Banner - Bug 1486739 - Enable ESLint rule comma-dangle for browser/, services/, taskcluster/ and toolkit/ directories. r=mossop
10d5143647cfda21649cf254adcb21d116524c5d - Sylvestre Ledru - Bug 1489454 - Remove all trailing whitespaces (again) r=Ehsan
10d90fa56710390d54d44f25d05054e62e08af03 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/builtin, part 1. r=anba
422abc78931ce85a2950b6b2e554981f5354d5c1 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/builtin, part 2. r=jorendorff
506e668e28645f38b226ea203aed38b5b5f0b0e5 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/builtin, part 3. r=evilpie
3fa402809570cf52220fd946081de01d7d117174 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/builtin/intl. r=jorendorff
6c382d4ab0d0deb714f15300afea2c52dff94e47 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/frontend, part 1. r=Yoric
f758714e4ed9a93b2db83be95fb669f53658a58b - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/frontend, part 2. r=arai
719bd7da3367b47f19800b1761ecbd5d97a49fa2 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/frontend, part 3. r=arai
9f7beee7269b10833e0ca8446195cc354dac63c3 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/frontend, part 4. r=jorendorff
3ba56e06507e0c78c679261c3d0424decb3f7b29 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/gc, part 1. r=sfink
d27cd3305320b12ad93f0837090a0913d0f31e76 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/gc, part 2. r=jonco
68e5c74b6e90baf1212846920435dbe0ae17f346 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/gc, part 3. r=jorendorff
5150b70229209c5d020eef82819f5b8d5aebda0e - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/gc, part 4. r=sfink
bc503aa87b272bdcef98a35c9759e25a15031241 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/proxy. r=evilpie
847f8ad07bd59db3f23243baf924dfe8682297d6 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/util. r=anba
062a7185253dd2c253c5a3a2e9f177be37483252 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/threading. r=khyperia
48c78757dc15531f94c8fd67dd70bc467e74543e - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 1. r=tcampbell
9f1df06ee3066e30ca84e270e37087f632969ca6 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 2. r=mgaudet
236cf9e1bd84919f1f7603d579c667a14a1ffd92 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 3. r=nbp
78d8957d12e298347c2cebe535ae565763ba361f - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 4. r=luke
f24489d307bedccd634b994043138d14bfc90d04 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 5. r=bbouvier
b5b33a78679f204f9284dc126ca96c2c619acf71 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 6. r=jorendorff
3810b18e5e79dc6a5204a2df01bfaafc40f0573e - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 7. r=jorendorff
bde61aedfb5c51a2a761037be694df136ede49cd - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 8. r=sfink
045f3d6c75024958390a18753f3698f9d177ec61 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 9. r=khyperia
6b3a95df3c123910eeab97cb7cd7cbf0884bd413 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 10. r=lth
219721735c51630107ce70c295c26b88bb87ab3a - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 11. r=tcampbell
710ba7b57cd3b7febccd5f390081f614ebe2df3c - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/vm, part 12. r=bbouvier
9a67686aabe8131742f00bdcf6919b5a2cc48f9a - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/wasm, part 1. r=bbouvier
ed9bb62ebea140a50e38c08e663b0550a1c3c5da - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/wasm, part 2. r=lth
ab68962c6c3ffb885da31f617301cb63b6fa73af - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/wasm, part 3. r=luke
20142eb6afd6c14610943833a5e7bdbceb4dfb8a - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/wasm, part 4. r=luke
e3a9c003c9c5d3d6484fa88ba07bdd7c0ff183d5 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/wasm, part 5. r=bbouvier
817b7142d4d965f9ab591a33268e2a59d29e4aed - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 1. r=tcampbell
6a52f517bdb44b42b677c7c50a67d9306b3ed935 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 2. r=mgaudet
19ae9ff093caf9f9071277549c5aac056db90587 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 3. r=nbp
bc2538bb2e9d925b17f45e1570cb6441ab6f8e3d - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 4. r=bbouvier
8fd55df51b25f080dcbf749bd9127f7fea3b36f4 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 5. r=tcampbell
a946ea065650ac0422ad82c272496ff6290f5410 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 6. r=evilpie
fead9919a173160ff1d66715cd34e17ac0d11bce - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 7. r=jandem
e620cff42c301ca3ee5e50856c185bad2695c39b - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/jit, part 8. r=jandem
c56540cb6e028b2eb724d6316b5b47c9adcee0e1 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/shell. r=jandem
a6baf63a4fd58b89dd1aad32a840aeb1288cb5f1 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/src/js*. r=jandem
f2bedf1fe932f1bb3277a4db1e11fbb02b3242d8 - Jan de Mooij - Bug 1488698 - Always use braces for if/for/while statements in js/public. r=jandem
cab441a582e82e1875fd9271b78f3b5e8462376d - Jan de Mooij - Bug 1490589 - Add braces for if-statements in make_unicode.py. r=arai
91fc6c048c077c12a9326cb6825ea9e12158764d - Jan de Mooij - Bug 1490594 - Always use braces for if/for/while statements in jsapi-tests. r=luke
ec5fe5d123b1baac235d978858c5226f7c8d9ed0 - Jan de Mooij - Bug 1490594 - Always use braces for if/for/while statements in jsapi-tests. r=luke
ea73513d7c2555142333f4667a37788023f92f2a - Mark Banner - Bug 1489980 - Editor ESLint for editor/ - Initial setup adding configs for tests. r=masayuki
de36f39840c64a50ccc45f8c0593d8dcd651dfc2 - Mark Banner - Bug 1489980 - Enable ESLint for editor/ - automatic fixes r=masayuki
0d8eb8a0c2b4ad081ffad8ecf172b82d16c38d01 - Mark Banner - Bug 1489980 - Enable ESLint for editor/ - Manual fixes. r=masayuki
7bbf9560f451422023e71284069254309eb9ca78 - Jan de Mooij - Bug 1490993 part 1 - Always use braces for if/for/while statements in js/src/jit/x64. r=mgaudet
3c10148fb9a8056c216f1c3f1fba8d6fec35a9c8 - Jan de Mooij - Bug 1490993 part 2 - Always use braces for if/for/while statements in js/src/jit/x86. r=tcampbell
e6cce3b04ab699ce80f5b90321308f66eb43d562 - Jan de Mooij - Bug 1490993 part 3 - Always use braces for if/for/while statements in js/src/jit/x86-shared. r=nbp
63a03fced45b169986a591310bd6572594a10fa0 - Jan de Mooij - Bug 1490993 part 4 - Always use braces for if/for/while statements in js/src/jit/arm. r=tcampbell
371ea54455859baa1f9a5dd2d70772e04d6829bd - Jan de Mooij - Bug 1490993 part 5 - Always use braces for if/for/while statements in js/src/jit/arm64. r=luke
0667570cb938dd973aaef61ccd31f0a74ce57a9b - Jan de Mooij - Bug 1490993 part 6 - Always use braces for if/for/while statements in js/src/jit/{mips32,mips64,mips-shared}. r=tcampbell
765542d6237ecf99af924f61485d7fe19f4f722c - Tooru Fujisawa <arai_a@mac.com> - Bug 1490548 - Always use braces for if/for/while statements in BinAST auto-generated code r=Yoric
a2f6f03530301e5fa6357815265f782400c612d9 - Jan de Mooij - Bug 1492416 - Always use braces for if/for/while statements in js/src/ds. r=arai
146575efb1c65085c56ee57d7cdc1de54c0f600b - Jan de Mooij - Bug 1496033 - Add missing {} in js/src. r=bbouvier
b60cb229416c3a4d2744611cf89051f574ced95e - Jan de Mooij - Bug 1489242 - Add {} to example code in comments. r=jorendorff
b4d7770b8661338c878166beca941eeb830f6041 - Paul Adenot - Bug 1497254 - clang-format MediaEngineWebRTCAudio.{cpp,h} and MediaEnginePrefs.h. r=pehrsons
edc4ae8f78e2fb02647d7cd85cb19830a17dcd1d - Mark Banner - Bug 1486741 - Enable ESLint rule comma-dangle for all of mozilla-central (automatic fixes). r=mossop
988056e6d0543949b91fd7501ab4140f88e087e6 - Mark Banner - Bug 1486741 - Enable ESLint rule comma-dangle for all of mozilla-central (manual fixes). r=mossop

65
Cargo.lock сгенерированный
Просмотреть файл

@ -1,5 +1,11 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "adler"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
[[package]]
name = "adler32"
version = "1.0.4"
@ -511,12 +517,11 @@ checksum = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427"
[[package]]
name = "cc"
version = "1.0.47"
version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"
checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381"
dependencies = [
"jobserver",
"num_cpus",
]
[[package]]
@ -1459,11 +1464,11 @@ checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
[[package]]
name = "flate2"
version = "1.0.12"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad3c5233c9a940c8719031b423d7e6c16af66e031cb0420b0896f5245bf181d3"
checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129"
dependencies = [
"cfg-if 0.1.10",
"cfg-if 1.0.0",
"crc32fast",
"libc",
"miniz_oxide",
@ -1567,6 +1572,7 @@ dependencies = [
"chrono",
"crossbeam-channel",
"ffi-support",
"glean",
"glean-core",
"log",
"nsstring",
@ -1591,6 +1597,7 @@ version = "0.1.0"
dependencies = [
"cstr",
"fog",
"glean",
"glean-core",
"log",
"nserror",
@ -2099,10 +2106,26 @@ dependencies = [
]
[[package]]
name = "glean-core"
version = "31.4.0"
name = "glean"
version = "33.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4bade418d78159f19dcd26e380b48ff04f43b8cb457aa64711a15693c09e481"
checksum = "d3a923bbc7c67c1699fe237a027af35e5040d022dcde3856536aea072f08b40d"
dependencies = [
"crossbeam-channel",
"glean-core",
"inherent",
"log",
"once_cell",
"serde",
"serde_json",
"thiserror",
]
[[package]]
name = "glean-core"
version = "33.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "697a501731036b0f4f053f503805a61688ed66d91c77252124a64a7b665d8d5b"
dependencies = [
"bincode",
"chrono",
@ -2110,7 +2133,7 @@ dependencies = [
"flate2",
"log",
"once_cell",
"rkv 0.10.4",
"rkv 0.15.0",
"serde",
"serde_json",
"uuid",
@ -2426,6 +2449,17 @@ dependencies = [
"adler32",
]
[[package]]
name = "inherent"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2db418475edf9eb55fec92b7527be6d9a7b880bff6651cb0c0345af57f1cadf"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "inplace_it"
version = "0.3.2"
@ -3056,11 +3090,12 @@ dependencies = [
[[package]]
name = "miniz_oxide"
version = "0.3.2"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7108aff85b876d06f22503dcce091e29f76733b2bfdd91eebce81f5e68203a10"
checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
dependencies = [
"adler32",
"adler",
"autocfg 1.0.1",
]
[[package]]
@ -3603,9 +3638,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.4.0"
version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
[[package]]
name = "opaque-debug"

Просмотреть файл

@ -554,8 +554,12 @@ using namespace mozilla::a11y;
} else {
mGeckoAccessible.AsProxy()->Name(title);
}
// remove listmarker for clean label
return nsCocoaUtils::ToNSString(Substring(title, 1, title.Length()));
// XXX: When parsing outlines built with ul/lu's, we
// include the bullet in this description even
// though webkit doesn't. Not all outlines are built with
// ul/lu's so we can't strip the first character here.
return nsCocoaUtils::ToNSString(title);
}
@end

Просмотреть файл

@ -242,11 +242,6 @@ addAccessibleTask(
is(outChildren[1].getAttributeValue("AXSubrole"), "AXOutlineRow");
const outRows = outline.getAttributeValue("AXRows");
for (let i = 0; i < outRows.length; i++) {
console.log(i);
console.log(outRows[i].getAttributeValue("AXDescription"));
console.log("\n");
}
is(outRows.length, 9, "Outline has nine rows");
is(
outRows[0].getAttributeValue("AXDisclosing"),
@ -374,3 +369,36 @@ addAccessibleTask(
);
}
);
// Test outline that isn't built with li/uls gets correct desc
addAccessibleTask(
`
<div role="tree" id="tree" tabindex="0" aria-label="My drive" aria-activedescendant="myfiles">
<div id="myfiles" role="treeitem" aria-label="My files" aria-selected="true" aria-expanded="false">My files</div>
<div role="treeitem" aria-label="Shared items" aria-selected="false" aria-expanded="false">Shared items</div>
</div>
`,
async (browser, accDoc) => {
const tree = getNativeInterface(accDoc, "tree");
is(tree.getAttributeValue("AXRole"), "AXOutline", "Correct role for tree");
const treeItems = tree.getAttributeValue("AXChildren");
is(treeItems.length, 2, "Outline has two direct children");
is(treeItems[0].getAttributeValue("AXSubrole"), "AXOutlineRow");
is(treeItems[1].getAttributeValue("AXSubrole"), "AXOutlineRow");
const outRows = tree.getAttributeValue("AXRows");
is(outRows.length, 2, "Outline has two rows");
is(
outRows[0].getAttributeValue("AXDescription"),
"My files",
"files labelled correctly"
);
is(
outRows[1].getAttributeValue("AXDescription"),
"Shared items",
"shared items labelled correctly"
);
}
);

Просмотреть файл

@ -30,6 +30,8 @@ ChromeUtils.defineModuleGetter(
const MAX_LOCAL_SUGGESTIONS = 3;
const MAX_SUGGESTIONS = 6;
const SEARCH_ENGINE_PLACEHOLDER_ICON =
"chrome://browser/skin/search-engine-placeholder.png";
// Set of all ContentSearch actors, used to broadcast messages to all of them.
let gContentSearchActors = new Set();
@ -343,12 +345,9 @@ let ContentSearch = {
let pref = Services.prefs.getStringPref("browser.search.hiddenOneOffs");
let hiddenList = pref ? pref.split(",") : [];
for (let engine of await Services.search.getVisibleEngines()) {
let uri = engine.getIconURLBySize(16, 16);
let iconData = await this._maybeConvertURIToArrayBuffer(uri);
state.engines.push({
name: engine.name,
iconData,
iconData: await this._getEngineIconURL(engine),
hidden: hiddenList.includes(engine.name),
isAppProvided: engine.isAppProvided,
});
@ -527,18 +526,21 @@ let ContentSearch = {
async _currentEngineObj(usePrivate) {
let engine =
Services.search[usePrivate ? "defaultPrivateEngine" : "defaultEngine"];
let favicon = engine.getIconURLBySize(16, 16);
let obj = {
name: engine.name,
iconData: await this._maybeConvertURIToArrayBuffer(favicon),
iconData: await this._getEngineIconURL(engine),
isAppProvided: engine.isAppProvided,
};
return obj;
},
_maybeConvertURIToArrayBuffer(uri) {
if (!uri) {
return Promise.resolve(null);
/**
* Converts the engine's icon into an appropriate URL for display at
*/
async _getEngineIconURL(engine) {
let url = engine.getIconURLBySize(16, 16);
if (!url) {
return SEARCH_ENGINE_PLACEHOLDER_ICON;
}
// The uri received here can be of two types
@ -548,25 +550,25 @@ let ContentSearch = {
// If the URI is not a data: URI, there's no point in converting
// it to an arraybuffer (which is used to optimize passing the data
// accross processes): we can just pass the original URI, which is cheaper.
if (!uri.startsWith("data:")) {
return Promise.resolve(uri);
if (!url.startsWith("data:")) {
return url;
}
return new Promise(resolve => {
let xhr = new XMLHttpRequest();
xhr.open("GET", uri, true);
xhr.open("GET", url, true);
xhr.responseType = "arraybuffer";
xhr.onload = () => {
resolve(xhr.response);
};
xhr.onerror = xhr.onabort = xhr.ontimeout = () => {
resolve(null);
resolve(SEARCH_ENGINE_PLACEHOLDER_ICON);
};
try {
// This throws if the URI is erroneously encoded.
xhr.send();
} catch (err) {
resolve(null);
resolve(SEARCH_ENGINE_PLACEHOLDER_ICON);
}
});
},

Просмотреть файл

@ -561,12 +561,7 @@ pref("browser.tabs.delayHidingAudioPlayingIconMS", 3000);
// for about: pages. This pref name did not age well: we will have multiple
// types of privileged content processes, each with different privileges.
// types of privleged content processes, each with different privleges.
#if defined(MOZ_CODE_COVERAGE) && defined(XP_LINUX)
// Disabled on Linux ccov builds due to bug 1621269.
pref("browser.tabs.remote.separatePrivilegedContentProcess", false);
#else
pref("browser.tabs.remote.separatePrivilegedContentProcess", true);
#endif
pref("browser.tabs.remote.separatePrivilegedContentProcess", true);
#if defined(NIGHTLY_BUILD) && !defined(MOZ_ASAN)
// This pref will cause assertions when a remoteType triggers a process switch
@ -1401,7 +1396,11 @@ pref("browser.newtabpage.activity-stream.discoverystream.spocs-endpoint", "");
// List of regions that do not get stories, regardless of locale-list-config.
pref("browser.newtabpage.activity-stream.discoverystream.region-stories-block", "FR");
// List of locales that get stories, regardless of region-stories-config.
pref("browser.newtabpage.activity-stream.discoverystream.locale-list-config", "en-US,en-CA,en-GB");
#ifdef NIGHTLY_BUILD
pref("browser.newtabpage.activity-stream.discoverystream.locale-list-config", "en-US,en-CA,en-GB");
#else
pref("browser.newtabpage.activity-stream.discoverystream.locale-list-config", "");
#endif
// List of regions that get stories by default.
pref("browser.newtabpage.activity-stream.discoverystream.region-stories-config", "US,DE,CA,GB,IE,CH,AT,BE,IN");

Просмотреть файл

@ -38,9 +38,6 @@ support-files =
page_style_sample.html
ssl_error_reports.sjs
print_postdata.sjs
searchSuggestionEngine.sjs
searchSuggestionEngine.xml
searchSuggestionEngine2.xml
test_bug462673.html
test_bug628179.html
title_test.svg
@ -298,10 +295,6 @@ skip-if = (os == 'mac') || (verify && (os == 'mac')) || (os == 'win' && debug) |
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_save_video_frame.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_contentSearchUI.js]
support-files =
contentSearchUI.html
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_selectTabAtIndex.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_ssl_error_reports.js]

Просмотреть файл

@ -1,9 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function handleRequest(req, resp) {
let suffixes = ["foo", "bar"];
let data = [req.queryString, suffixes.map(s => req.queryString + s)];
resp.setHeader("Content-Type", "application/json", false);
resp.write(JSON.stringify(data));
}

Просмотреть файл

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>browser_searchSuggestionEngine searchSuggestionEngine.xml</ShortName>
<Url type="application/x-suggestions+json" method="GET" template="http://mochi.test:8888/browser/browser/base/content/test/general/searchSuggestionEngine.sjs?{searchTerms}"/>
<Url type="text/html" method="GET" template="http://mochi.test:8888/" rel="searchform"/>
</SearchPlugin>

Просмотреть файл

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>browser_searchSuggestionEngine searchSuggestionEngine2.xml</ShortName>
<Url type="application/x-suggestions+json" method="GET" template="http://mochi.test:8888/browser/browser/base/content/test/general/searchSuggestionEngine.sjs?{searchTerms}"/>
<Url type="text/html" method="GET" template="http://www.browser-searchSuggestionEngine.com/searchSuggestionEngine2&amp;terms={searchTerms}" rel="searchform"/>
</SearchPlugin>

Просмотреть файл

@ -88,6 +88,7 @@ add_task(async function testWritesSizeValuesOnChange() {
"CssToDevPixelScaling",
"SpringsCSSSpan",
"SearchbarCSSSpan",
"Theme",
];
// Remove all of the registry values to ensure old tests aren't giving us false

Просмотреть файл

@ -1,14 +1,31 @@
[DEFAULT]
tags = audiochannel
support-files =
almostSilentAudioTrack.webm
audio.ogg
audioEndedDuringPlaying.webm
file_almostSilentAudioTrack.html
file_autoplay_media.html
file_empty.html
file_mediaPlayback.html
file_mediaPlayback2.html
file_mediaPlaybackFrame.html
file_mediaPlaybackFrame2.html
file_silentAudioTrack.html
file_webAudio.html
gizmo.mp4
head.js
noaudio.webm
silentAudioTrack.webm
[browser_destroy_iframe.js]
[browser_mediaplayback_audibility_change.js]
[browser_mediaPlayback.js]
[browser_mediaPlayback_mute.js]
[browser_mute.js]
[browser_mute2.js]
[browser_mute_webAudio.js]
[browser_sound_indicator_silent_video.js]
[browser_webaudio_audibility_change.js]
[browser_webAudio_hideSoundPlayingIcon.js]
[browser_webAudio_silentData.js]

Просмотреть файл

@ -1,7 +1,5 @@
const PAGE =
"https://example.com/browser/toolkit/content/tests/browser/file_mediaPlayback.html";
const FRAME =
"https://example.com/browser/toolkit/content/tests/browser/file_mediaPlaybackFrame.html";
const PAGE = GetTestWebBasedURL("file_mediaPlayback.html");
const FRAME = GetTestWebBasedURL("file_mediaPlaybackFrame.html");
function wait_for_event(browser, event) {
return BrowserTestUtils.waitForEvent(browser, event, false, event => {

Просмотреть файл

@ -1,7 +1,5 @@
const PAGE =
"https://example.com/browser/toolkit/content/tests/browser/file_mediaPlayback2.html";
const FRAME =
"https://example.com/browser/toolkit/content/tests/browser/file_mediaPlaybackFrame2.html";
const PAGE = GetTestWebBasedURL("file_mediaPlayback2.html");
const FRAME = GetTestWebBasedURL("file_mediaPlaybackFrame2.html");
function wait_for_event(browser, event) {
return BrowserTestUtils.waitForEvent(browser, event, false, event => {

Просмотреть файл

@ -5,16 +5,7 @@ if (!gMultiProcessBrowser) {
PromiseTestUtils.expectUncaughtRejection(/is no longer, usable/);
}
const PAGE =
"https://example.com/browser/toolkit/content/tests/browser/file_webAudio.html";
async function click_icon(tab) {
let icon = tab.soundPlayingIcon;
await hover_icon(icon, document.getElementById("tabbrowser-tab-tooltip"));
EventUtils.synthesizeMouseAtCenter(icon, { button: 0 });
leave_icon(icon);
}
const PAGE = GetTestWebBasedURL("file_webAudio.html");
function start_webAudio() {
var startButton = content.document.getElementById("start");
@ -35,7 +26,6 @@ function stop_webAudio() {
}
add_task(async function setup_test_preference() {
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
await SpecialPowers.pushPrefEnv({
set: [
["media.useAudioChannelService.testing", true],
@ -54,11 +44,11 @@ add_task(async function mute_web_audio() {
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
info("- tab should be audible -");
await waitForTabPlayingEvent(tab, true);
await waitForTabSoundIndicatorAppears(tab);
info("- mute browser -");
ok(!tab.linkedBrowser.audioMuted, "Audio should not be muted by default");
await click_icon(tab);
await clickIcon(tab.soundPlayingIcon);
ok(tab.linkedBrowser.audioMuted, "Audio should be muted now");
info("- stop web audip -");
@ -69,11 +59,11 @@ add_task(async function mute_web_audio() {
info("- unmute browser -");
ok(tab.linkedBrowser.audioMuted, "Audio should be muted now");
await click_icon(tab);
await clickIcon(tab.soundPlayingIcon);
ok(!tab.linkedBrowser.audioMuted, "Audio should be unmuted now");
info("- tab should be audible -");
await waitForTabPlayingEvent(tab, true);
await waitForTabSoundIndicatorAppears(tab);
info("- remove tab -");
BrowserTestUtils.removeTab(tab);

Просмотреть файл

@ -1,7 +1,7 @@
const SILENT_PAGE =
"https://example.com/browser/toolkit/content/tests/browser/file_silentAudioTrack.html";
const ALMOST_SILENT_PAGE =
"https://example.com/browser/toolkit/content/tests/browser/file_almostSilentAudioTrack.html";
const SILENT_PAGE = GetTestWebBasedURL("file_silentAudioTrack.html");
const ALMOST_SILENT_PAGE = GetTestWebBasedURL(
"file_almostSilentAudioTrack.html"
);
function check_audio_playing_state(isPlaying) {
let autoPlay = content.document.getElementById("autoplay");
@ -37,7 +37,7 @@ add_task(async function should_not_show_sound_indicator_for_silent_video() {
);
info("- tab should not have sound indicator before playing silent video -");
await waitForTabPlayingEvent(tab, false);
await waitForTabSoundIndicatorDisappears(tab);
info("- loading autoplay silent video -");
BrowserTestUtils.loadURI(tab.linkedBrowser, SILENT_PAGE);
@ -49,7 +49,7 @@ add_task(async function should_not_show_sound_indicator_for_silent_video() {
);
info("- tab should not have sound indicator after playing silent video -");
await waitForTabPlayingEvent(tab, false);
await waitForTabSoundIndicatorDisappears(tab);
info("- remove tab -");
BrowserTestUtils.removeTab(tab);
@ -66,7 +66,7 @@ add_task(
info(
"- tab should not have sound indicator before playing almost silent video -"
);
await waitForTabPlayingEvent(tab, false);
await waitForTabSoundIndicatorDisappears(tab);
info("- loading autoplay almost silent video -");
BrowserTestUtils.loadURI(tab.linkedBrowser, ALMOST_SILENT_PAGE);
@ -80,7 +80,7 @@ add_task(
info(
"- tab should not have sound indicator after playing almost silent video -"
);
await waitForTabPlayingEvent(tab, false);
await waitForTabSoundIndicatorDisappears(tab);
info("- remove tab -");
BrowserTestUtils.removeTab(tab);

Просмотреть файл

@ -39,13 +39,13 @@ async function testResumeRunningAudioContext() {
});
info(`- wait for 'sound-playing' icon showing -`);
await waitForTabPlayingEvent(tab, true);
await waitForTabSoundIndicatorAppears(tab);
info(`- resume AudioContext -`);
await SpecialPowers.spawn(browser, [], resumeAudioContext);
info(`- 'sound-playing' icon should still exist -`);
await waitForTabPlayingEvent(tab, true);
await waitForTabSoundIndicatorAppears(tab);
info(`- remove tab -`);
await BrowserTestUtils.removeTab(tab);

Просмотреть файл

@ -50,7 +50,7 @@ add_task(async function testSilentAudioContext() {
// reason of no showing sound indicator is because of silent web audio, or
// because the indicator is just not showing yet.
await new Promise(r => setTimeout(r, 1000));
await waitForTabPlayingEvent(tab, false);
await waitForTabSoundIndicatorDisappears(tab);
info(`- remove tab -`);
await BrowserTestUtils.removeTab(tab);

Просмотреть файл

@ -0,0 +1,14 @@
<!DOCTYPE html>
<body>
<script type="text/javascript">
var audio = new Audio();
audio.oncanplay = function() {
audio.oncanplay = null;
audio.play();
};
audio.src = "audio.ogg";
audio.loop = true;
audio.id = "v";
document.body.appendChild(audio);
</script>
</body>

Просмотреть файл

@ -0,0 +1,18 @@
<!DOCTYPE html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
</head>
<body>
<video id="autoplay" src="silentAudioTrack.webm"></video>
<script type="text/javascript">
// In linux debug on try server, sometimes the download process would fail, so
// we can't activate the "auto-play" or playing after receving "oncanplay".
// Therefore, we just call play here.
var video = document.getElementById("autoplay");
video.loop = true;
video.play();
</script>
</body>

Просмотреть файл

@ -0,0 +1,29 @@
<!DOCTYPE html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
</head>
<body>
<pre id=state></pre>
<button id="start" onclick="start_webaudio()">Start</button>
<button id="stop" onclick="stop_webaudio()">Stop</button>
<script type="text/javascript">
var ac = new AudioContext();
var dest = ac.destination;
var osc = ac.createOscillator();
osc.connect(dest);
osc.start();
document.querySelector("pre").innerText = ac.state;
ac.onstatechange = function() {
document.querySelector("pre").innerText = ac.state;
}
function start_webaudio() {
ac.resume();
}
function stop_webaudio() {
ac.suspend();
}
</script>
</body>

Просмотреть файл

@ -60,7 +60,7 @@ async function waitForTabSoundIndicatorDisappears(tab) {
/**
* Return a new foreground tab loading with an empty file.
* @param needObserver
* @param {boolean} needObserver
* If true, sets an observer property on the returned tab. This property
* exposes `hasEverUpdated()` which will return a bool indicating if the
* sound indicator has ever updated.
@ -91,3 +91,62 @@ function createSoundIndicatorObserver(tab) {
},
};
}
/**
* Sythesize mouse hover on the given icon, which would sythesize `mouseover`
* and `mousemove` event on that. Return a promise that will be resolved when
* the tooptip element shows.
* @param {tab icon} icon
* the icon on which we want to mouse hover
* @param {tooltip element} tooltip
* the tab tooltip elementss
*/
function hoverIcon(icon, tooltip) {
disableNonTestMouse(true);
let popupShownPromise = BrowserTestUtils.waitForEvent(tooltip, "popupshown");
EventUtils.synthesizeMouse(icon, 1, 1, { type: "mouseover" });
EventUtils.synthesizeMouse(icon, 2, 2, { type: "mousemove" });
EventUtils.synthesizeMouse(icon, 3, 3, { type: "mousemove" });
EventUtils.synthesizeMouse(icon, 4, 4, { type: "mousemove" });
return popupShownPromise;
}
/**
* Leave mouse from the given icon, which would sythesize `mouseout`
* and `mousemove` event on that.
* @param {tab icon} icon
* the icon on which we want to mouse hover
* @param {tooltip element} tooltip
* the tab tooltip elementss
*/
function leaveIcon(icon) {
EventUtils.synthesizeMouse(icon, 0, 0, { type: "mouseout" });
EventUtils.synthesizeMouseAtCenter(document.documentElement, {
type: "mousemove",
});
EventUtils.synthesizeMouseAtCenter(document.documentElement, {
type: "mousemove",
});
EventUtils.synthesizeMouseAtCenter(document.documentElement, {
type: "mousemove",
});
disableNonTestMouse(false);
}
/**
* Sythesize mouse click on the given icon.
* @param {tab icon} icon
* the icon on which we want to mouse hover
*/
async function clickIcon(icon) {
await hoverIcon(icon, document.getElementById("tabbrowser-tab-tooltip"));
EventUtils.synthesizeMouseAtCenter(icon, { button: 0 });
leaveIcon(icon);
}
function disableNonTestMouse(disable) {
let utils = window.windowUtils;
utils.disableNonTestMouseEvents(disable);
}

Двоичные данные
browser/base/content/test/tabMediaIndicator/silentAudioTrack.webm Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -91,9 +91,6 @@ browser.jar:
content/browser/sanitize.xhtml (content/sanitize.xhtml)
content/browser/sanitizeDialog.js (content/sanitizeDialog.js)
content/browser/sanitizeDialog.css (content/sanitizeDialog.css)
content/browser/contentSearchUI.js (content/contentSearchUI.js)
content/browser/contentSearchHandoffUI.js (content/contentSearchHandoffUI.js)
content/browser/contentSearchUI.css (content/contentSearchUI.css)
content/browser/tabbrowser.css (content/tabbrowser.css)
content/browser/tabbrowser.js (content/tabbrowser.js)
content/browser/tabbrowser-tab.js (content/tabbrowser-tab.js)

Просмотреть файл

@ -25,6 +25,10 @@ const { TelemetryController } = ChromeUtils.import(
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
let parserUtils = Cc["@mozilla.org/parserutils;1"].getService(
Ci.nsIParserUtils
);
const PREF_ION_ID = "toolkit.telemetry.pioneerId";
const PREF_ION_NEW_STUDIES_AVAILABLE =
"toolkit.telemetry.pioneer-new-studies-available";
@ -34,8 +38,8 @@ const PREF_ION_COMPLETED_STUDIES =
/**
* Remote Settings keys for general content, and available studies.
*/
const CONTENT_COLLECTION_KEY = "pioneer-content-v1";
const STUDY_ADDON_COLLECTION_KEY = "pioneer-study-addons-v1";
const CONTENT_COLLECTION_KEY = "pioneer-content-v2";
const STUDY_ADDON_COLLECTION_KEY = "pioneer-study-addons-v2";
const STUDY_LEAVE_REASONS = {
USER_ABANDONED: "user-abandoned",
@ -46,6 +50,28 @@ const PREF_TEST_CACHED_CONTENT = "toolkit.pioneer.testCachedContent";
const PREF_TEST_CACHED_ADDONS = "toolkit.pioneer.testCachedAddons";
const PREF_TEST_ADDONS = "toolkit.pioneer.testAddons";
/**
* Use the in-tree HTML Sanitizer to ensure that HTML from remote-settings is safe to use.
* Note that RS does use content-signing, we're doing this extra step as an in-depth security measure.
*
* @param {string} htmlString - unsanitized HTML (content-signed by remote-settings)
* @returns {DocumentFragment} - sanitized DocumentFragment
*/
function sanitizeHtml(htmlString) {
const content = document.createElement("div");
const contentFragment = parserUtils.parseFragment(
htmlString,
Ci.nsIParserUtils.SanitizerDropForms |
Ci.nsIParserUtils.SanitizerAllowStyle |
Ci.nsIParserUtils.SanitizerLogRemovals,
false,
Services.io.newURI("about:ion"),
content
);
return contentFragment;
}
function showEnrollmentStatus() {
const ionId = Services.prefs.getStringPref(PREF_ION_ID, null);
@ -170,7 +196,6 @@ async function showAvailableStudies(cachedAddons) {
let addon;
let install;
if (Cu.isInAutomation) {
console.debug(defaultAddon);
install = {
install: async () => {
if (
@ -264,15 +289,13 @@ async function showAvailableStudies(cachedAddons) {
`[id=${joinOrLeave}-study-consent]`
);
// Clears out any existing children with a single #text node.
// Clears out any existing children with a single #text node
consentText.textContent = "";
for (const line of cachedAddon[`${joinOrLeave}StudyConsent`].split(
"\n"
)) {
const li = document.createElement("li");
li.textContent = line;
consentText.appendChild(li);
}
const contentFragment = sanitizeHtml(
cachedAddon[`${joinOrLeave}StudyConsent`]
);
consentText.appendChild(contentFragment);
dialog.showModal();
dialog.scrollTop = 0;
@ -284,26 +307,12 @@ async function showAvailableStudies(cachedAddons) {
const studyDesc = document.createElement("div");
studyDesc.setAttribute("class", "card-description");
const contentFragment = sanitizeHtml(cachedAddon.description);
studyDesc.appendChild(contentFragment);
study.appendChild(studyDesc);
const shortDesc = document.createElement("p");
shortDesc.textContent = cachedAddon.description;
studyDesc.appendChild(shortDesc);
const privacyPolicyLink = document.createElement("a");
privacyPolicyLink.href = cachedAddon.privacyPolicy.spec;
privacyPolicyLink.textContent = "privacy policy";
const privacyPolicy = document.createElement("p");
const privacyPolicyStart = document.createElement("span");
privacyPolicyStart.textContent = "You can always find the ";
privacyPolicy.append(privacyPolicyStart);
privacyPolicy.append(privacyPolicyLink);
const privacyPolicyEnd = document.createElement("span");
privacyPolicyEnd.textContent = " at our website.";
privacyPolicy.append(privacyPolicyEnd);
studyDesc.appendChild(privacyPolicy);
const studyDataCollected = document.createElement("div");
studyDataCollected.setAttribute("class", "card-data-collected");
study.appendChild(studyDataCollected);
@ -602,38 +611,26 @@ function removeBadge() {
// Updates Ion HTML page contents from RemoteSettings.
function updateContents(contents) {
for (const section of ["title", "joinIonConsent", "leaveIonConsent"]) {
for (const section of [
"title",
"summary",
"details",
"data",
"joinIonConsent",
"leaveIonConsent",
]) {
if (contents && section in contents) {
// Generate a corresponding dom-id style ID for a camel-case domId style JS attribute.
// Dynamically set the tag type based on which section is getting updated.
let tagType = "li";
if (section === "title") {
tagType = "p";
}
const domId = section
.split(/(?=[A-Z])/)
.join("-")
.toLowerCase();
// Clears out any existing children with a single #text node.
document.getElementById(domId).textContent = "";
for (const line of contents[section].split("\n")) {
const entry = document.createElement(tagType);
entry.textContent = line;
document.getElementById(domId).appendChild(entry);
}
}
}
if ("privacyPolicy" in contents) {
const privacyPolicyLinks = document.getElementsByClassName(
"privacy-policy"
);
for (const privacyPolicyLink of privacyPolicyLinks) {
const privacyPolicyFormattedLink = Services.urlFormatter.formatURL(
contents.privacyPolicy
);
privacyPolicyLink.href = privacyPolicyFormattedLink;
const contentFragment = sanitizeHtml(contents[section]);
document.getElementById(domId).appendChild(contentFragment);
}
}
}

Просмотреть файл

@ -7,8 +7,7 @@
"summary",
"details",
"joinIonConsent",
"leaveIonConsent",
"privacyPolicy"
"leaveIonConsent"
],
"properties": {
"title": {
@ -35,11 +34,6 @@
"$id": "#root/leaveIonConsent",
"title": "LeaveIonconsent",
"type": "string"
},
"privacyPolicy": {
"$id": "#root/privacyPolicy",
"title": "Privacypolicy",
"type": "string"
}
}
}

Просмотреть файл

@ -33,12 +33,14 @@ const PREF_TEST_ADDONS = "toolkit.pioneer.testAddons";
const CACHED_CONTENT = [
{
title: "test title\ntest title line 2",
summary: "test summary\ntest summary line 2",
details: "1. test details\n2. test details line 2\n3. test details line 3",
joinIonConsent: "test join consent\njoin consent line 2",
leaveIonConsent: "test leave consent\ntest leave consent line 2",
privacyPolicy: "http://localhost",
title: "<b>test title</b><p>test title line 2</p>",
summary: "<p>test summary</p>test summary line 2",
details:
"<ol><li>test details</li><li>test details line 2</li><li>test details line</li></ol>",
data: "<b>test data</b>",
joinIonConsent: "<p>test join consent</p><p>join consent line 2</p>",
leaveIonConsent:
"<p>test leave consent</p><p>test leave consent line 2</p>",
},
];
@ -73,8 +75,8 @@ const CACHED_ADDONS = [
},
isDefault: false,
studyEnded: true,
joinStudyConsent: "test123",
leaveStudyConsent: "test345",
joinStudyConsent: "<b>test123</b>",
leaveStudyConsent: `<a href="test345">test345</a>`,
},
{
addon_id: "ion-v2-default-example@mozilla.org",
@ -557,8 +559,8 @@ add_task(async function testAboutPage() {
await joinDialogOpen;
ok(
content.document.getElementById("join-study-consent").textContent ==
cachedAddon.joinStudyConsent,
content.document.getElementById("join-study-consent").innerHTML ==
`${cachedAddon.joinStudyConsent}`,
"Join consent text matches remote settings data."
);
@ -625,8 +627,8 @@ add_task(async function testAboutPage() {
await leaveDialogOpen;
ok(
content.document.getElementById("leave-study-consent").textContent ==
cachedAddon.leaveStudyConsent,
content.document.getElementById("leave-study-consent").innerHTML ==
`${cachedAddon.leaveStudyConsent}`,
"Leave consent text matches remote settings data."
);
@ -965,11 +967,72 @@ add_task(async function testContentReplacement() {
},
async function taskFn(browser) {
// Check that text was updated from Remote Settings.
console.log("debug:", content.document.getElementById("title").innerHTML);
ok(
content.document.getElementById("title").textContent ==
"test titletest title line 2",
content.document.getElementById("title").innerHTML ==
"<b>test title</b><p>test title line 2</p>",
"Title was replaced correctly."
);
ok(
content.document.getElementById("summary").innerHTML ==
"<p>test summary</p>test summary line 2",
"Summary was replaced correctly."
);
ok(
content.document.getElementById("details").innerHTML ==
"<ol><li>test details</li><li>test details line 2</li><li>test details line</li></ol>",
"Details was replaced correctly."
);
ok(
content.document.getElementById("data").innerHTML == "<b>test data</b>",
"Data was replaced correctly."
);
ok(
content.document.getElementById("join-ion-consent").innerHTML ==
"<p>test join consent</p><p>join consent line 2</p>",
"Join consent was replaced correctly."
);
ok(
content.document.getElementById("leave-ion-consent").innerHTML ==
"<p>test leave consent</p><p>test leave consent line 2</p>",
"Leave consent was replaced correctly."
);
}
);
});
add_task(async function testBadContentReplacement() {
const cachedContent = JSON.stringify([
{
joinIonConsent: "<script>alert('failed')</script>",
leaveIonConsent: `<a href="blob:blah">blob</a>`,
},
]);
await SpecialPowers.pushPrefEnv({
set: [
[PREF_TEST_CACHED_CONTENT, cachedContent],
[PREF_TEST_ADDONS, "[]"],
],
clear: [[PREF_ION_ID, ""]],
});
await BrowserTestUtils.withNewTab(
{
url: "about:ion",
gBrowser,
},
async function taskFn(browser) {
// Check that text was updated from Remote Settings.
ok(
content.document.getElementById("join-ion-consent").innerHTML == "",
"Script tags are skipped."
);
ok(
content.document.getElementById("leave-ion-consent").innerHTML ==
"<a>blob</a>",
"Bad HREFs are stripped."
);
}
);
});

Просмотреть файл

@ -14,7 +14,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
DEFAULT_SITES: "resource://activity-stream/lib/DefaultSites.jsm",
ExperimentAPI: "resource://messaging-system/experiments/ExperimentAPI.jsm",
shortURL: "resource://activity-stream/lib/ShortURL.jsm",
Services: "resource://gre/modules/Services.jsm",
TippyTopProvider: "resource://activity-stream/lib/TippyTopProvider.jsm",
});
@ -190,8 +189,8 @@ class AboutWelcomeChild extends JSWindowActorChild {
defineAs: "AWGetSelectedTheme",
});
Cu.exportFunction(this.AWWaitForRegionChange.bind(this), window, {
defineAs: "AWWaitForRegionChange",
Cu.exportFunction(this.AWGetRegion.bind(this), window, {
defineAs: "AWGetRegion",
});
Cu.exportFunction(this.AWSelectTheme.bind(this), window, {
@ -366,21 +365,8 @@ class AboutWelcomeChild extends JSWindowActorChild {
return this.wrapPromise(this.sendQuery("AWPage:WAIT_FOR_MIGRATION_CLOSE"));
}
AWWaitForRegionChange() {
return this.wrapPromise(
new Promise(resolve =>
Services.prefs.addObserver(SEARCH_REGION_PREF, function observer(
subject,
topic,
data
) {
if (data === SEARCH_REGION_PREF && topic === "nsPref:changed") {
Services.prefs.removeObserver(SEARCH_REGION_PREF, observer);
resolve(searchRegion);
}
})
)
);
AWGetRegion() {
return this.wrapPromise(this.sendQuery("AWPage:GET_REGION"));
}
/**

Просмотреть файл

@ -22,6 +22,8 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AboutWelcomeTelemetry:
"resource://activity-stream/aboutwelcome/lib/AboutWelcomeTelemetry.jsm",
AttributionCode: "resource:///modules/AttributionCode.jsm",
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
Region: "resource://gre/modules/Region.jsm",
});
XPCOMUtils.defineLazyGetter(this, "log", () => {
@ -141,6 +143,42 @@ class AboutWelcomeObserver {
}
}
class RegionHomeObserver {
observe(aSubject, aTopic, aData) {
switch (aTopic) {
case Region.REGION_TOPIC:
if (aData === Region.REGION_UPDATED) {
Services.obs.removeObserver(this, Region.REGION_TOPIC);
this.regionHomeDeferred.resolve(Region.home);
this.regionHomeDeferred = null;
}
break;
}
}
promiseRegionHome() {
// Add observer and create promise that should be resolved
// with region or rejected inside didDestroy if user exits
// before region is available
if (!this.regionHomeDeferred) {
Services.obs.addObserver(this, Region.REGION_TOPIC);
this.regionHomeDeferred = PromiseUtils.defer();
}
return this.regionHomeDeferred.promise;
}
stop() {
if (this.regionHomeDeferred) {
Services.obs.removeObserver(this, Region.REGION_TOPIC);
// Reject unresolved deferred promise on exit
this.regionHomeDeferred.reject(
new Error("Unresolved region home promise")
);
this.regionHomeDeferred = null;
}
}
}
class AboutWelcomeParent extends JSWindowActorParent {
constructor() {
super();
@ -151,6 +189,7 @@ class AboutWelcomeParent extends JSWindowActorParent {
if (this.AboutWelcomeObserver) {
this.AboutWelcomeObserver.stop();
}
this.RegionHomeObserver?.stop();
Telemetry.sendTelemetry({
event: "SESSION_END",
@ -222,7 +261,14 @@ class AboutWelcomeParent extends JSWindowActorParent {
key => LIGHT_WEIGHT_THEMES[key] === activeTheme?.id
);
return themeShortName?.toLowerCase();
case "AWPage:GET_REGION":
if (Region.home !== null) {
return Region.home;
}
if (!this.RegionHomeObserver) {
this.RegionHomeObserver = new RegionHomeObserver(this);
}
return this.RegionHomeObserver.promiseRegionHome();
case "AWPage:WAIT_FOR_MIGRATION_CLOSE":
return new Promise(resolve =>
Services.ww.registerNotification(function observer(subject, topic) {

Просмотреть файл

@ -388,7 +388,7 @@ const MultiStageAboutWelcome = props => {
const [region, setRegion] = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(null);
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
(async () => {
setRegion((await window.AWWaitForRegionChange()));
setRegion((await window.AWGetRegion()));
})();
}, []); // Get the active theme so the rendering code can make it selected
// by default.

Просмотреть файл

@ -64,7 +64,7 @@ export const MultiStageAboutWelcome = props => {
const [region, setRegion] = useState(null);
useEffect(() => {
(async () => {
setRegion(await window.AWWaitForRegionChange());
setRegion(await window.AWGetRegion());
})();
}, []);

Просмотреть файл

@ -695,8 +695,9 @@ add_task(async function testExtensionControlledHomepageUninstalledAddon() {
},
};
let jsonFileName = "extension-settings.json";
let storePath = OS.Path.join(OS.Constants.Path.profileDir, jsonFileName);
await OS.File.writeAtomic(storePath, JSON.stringify(storeData));
let storePath = PathUtils.join(await PathUtils.getProfileDir(), jsonFileName);
await IOUtils.writeAtomicUTF8(storePath, JSON.stringify(storeData));
// Reload the ExtensionSettingsStore so it will read the file on disk. Don't
// finalize the current store since it will overwrite our file.
@ -712,7 +713,7 @@ add_task(async function testExtensionControlledHomepageUninstalledAddon() {
await checkHomepageEnabled();
// Remove the bad store file that we used.
await OS.File.remove(storePath);
await IOUtils.remove(storePath);
// Reload the ExtensionSettingsStore again so it clears the data we added.
// Don't finalize the current store since it will write out the bad data.

Просмотреть файл

@ -42,7 +42,11 @@ ContentSearchHandoffUIController.prototype = {
URL.revokeObjectURL(this._engineIcon);
}
if (engine.iconData) {
// We only show the engines icon for app provided engines, otherwise show
// a default. xref https://bugzilla.mozilla.org/show_bug.cgi?id=1449338#c19
if (!engine.isAppProvided) {
this._engineIcon = "chrome://browser/skin/search-glass.svg";
} else if (engine.iconData) {
this._engineIcon = this._getFaviconURIFromIconData(engine.iconData);
} else {
this._engineIcon = "chrome://mozapps/skin/places/defaultFavicon.svg";

Просмотреть файл

@ -8,8 +8,6 @@ this.ContentSearchUIController = (function() {
const MAX_DISPLAYED_SUGGESTIONS = 6;
const SUGGESTION_ID_PREFIX = "searchSuggestion";
const ONE_OFF_ID_PREFIX = "oneOff";
const DEFAULT_INPUT_ICON = "chrome://browser/skin/search-glass.svg";
const HTML_NS = "http://www.w3.org/1999/xhtml";
/**
@ -19,21 +17,22 @@ this.ContentSearchUIController = (function() {
* The UI consists of an html:table that's inserted into the DOM after the given
* text box and styled so that it appears as a dropdown below the text box.
*
* @param inputElement
* @param {DOMElement} inputElement
* Search suggestions will be based on the text in this text box.
* Assumed to be an html:input.
* @param tableParent
* @param {DOMElement} tableParent
* The suggestion table is appended as a child to this element. Since
* the table is absolutely positioned and its top and left values are set
* to be relative to the top and left of the page, either the parent and
* all its ancestors should not be positioned elements (i.e., their
* positions should be "static"), or the parent's position should be the
* top left of the page.
* @param healthReportKey
* This will be sent with the search data for FHR to record the search.
* @param searchPurpose
* @param {string} healthReportKey
* This will be sent with the search data for BrowserUsageTelemetry to
* record the search.
* @param {string} searchPurpose
* Sent with search data, see nsISearchEngine.getSubmission.
* @param idPrefix
* @param {sring} idPrefix
* The IDs of elements created by the object will be prefixed with this
* string.
*/
@ -688,11 +687,12 @@ this.ContentSearchUIController = (function() {
},
_updateDefaultEngineIcon() {
// We only show the engines icon for default engines, otherwise show
// a default; default engines have isAppProvided
// We only show the engine's own icon for app provided engines, otherwise show
// a default. xref https://bugzilla.mozilla.org/show_bug.cgi?id=1449338#c19
let icon = this.defaultEngine.isAppProvided
? this.defaultEngine.icon
: DEFAULT_INPUT_ICON;
: "chrome://browser/skin/search-glass.svg";
document.body.style.setProperty(
"--newtab-search-icon",
"url(" + icon + ")"

Просмотреть файл

@ -5,6 +5,9 @@
browser.jar:
content/browser/search/autocomplete-popup.js (content/autocomplete-popup.js)
content/browser/search/searchbar.js (content/searchbar.js)
content/browser/contentSearchUI.js (content/contentSearchUI.js)
content/browser/contentSearchHandoffUI.js (content/contentSearchHandoffUI.js)
content/browser/contentSearchUI.css (content/contentSearchUI.css)
search-extensions/ (extensions/**)
% resource search-extensions %search-extensions/ contentaccessible=yes

Просмотреть файл

@ -21,6 +21,11 @@ support-files =
[browser_addEngine.js]
[browser_contentContextMenu.js]
support-files = browser_contentContextMenu.xhtml
[browser_contentSearchUI.js]
support-files =
contentSearchUI.html
searchSuggestionEngine.sjs
[browser_contentSearchUI_default.js]
[browser_contextmenu.js]
skip-if = (os == "win" && processor == "aarch64") # disabled on aarch64 due to 1531590
[browser_contextSearchTabPosition.js]

Просмотреть файл

@ -2,20 +2,16 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_PAGE_BASENAME = "contentSearchUI.html";
const TEST_CONTENT_SCRIPT_BASENAME = "contentSearchUI.js";
const TEST_ENGINE_PREFIX = "browser_searchSuggestionEngine";
const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
const TEST_ENGINE_2_BASENAME = "searchSuggestionEngine2.xml";
const TEST_ENGINE1_NAME = "searchSuggestionEngine1";
const TEST_ENGINE2_NAME = "searchSuggestionEngine2";
const TEST_MSG = "ContentSearchUIControllerTest";
XPCOMUtils.defineLazyModuleGetters(this, {
ContentSearch: "resource:///actors/ContentSearchParent.jsm",
FormHistoryTestUtils: "resource://testing-common/FormHistoryTestUtils.jsm",
SearchTestUtils: "resource://testing-common/SearchTestUtils.jsm",
});
SearchTestUtils.init(Assert, registerCleanupFunction);
requestLongerTimeout(2);
function waitForSuggestions() {
@ -198,8 +194,64 @@ async function msg(type, data = null) {
return getCurrentState();
}
/**
* Focusses the in-content search bar.
*
* @returns {Promise}
* A promise that is resolved once the focus is complete.
*/
function focusContentSearchBar() {
return SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
content.gController.input.focus();
});
}
let extension1;
let extension2;
let currentEngineName;
add_task(async function setup() {
let originalOnMessageSearch = ContentSearch._onMessageSearch;
let originalOnMessageManageEngines = ContentSearch._onMessageManageEngines;
ContentSearch._onMessageSearch = () => {};
ContentSearch._onMessageManageEngines = () => {};
currentEngineName = (await Services.search.getDefault()).name;
let currentEngines = await Services.search.getVisibleEngines();
extension1 = await SearchTestUtils.installSearchExtension({
id: TEST_ENGINE1_NAME,
name: TEST_ENGINE1_NAME,
suggest_url:
"https://example.com/browser/browser/components/search/test/browser/searchSuggestionEngine.sjs",
suggest_url_get_params: "query={searchTerms}",
});
extension2 = await SearchTestUtils.installSearchExtension({
id: TEST_ENGINE2_NAME,
name: TEST_ENGINE2_NAME,
suggest_url:
"https://example.com/browser/browser/components/search/test/browser/searchSuggestionEngine.sjs",
suggest_url_get_params: "query={searchTerms}",
});
let engine1 = Services.search.getEngineByName(TEST_ENGINE1_NAME);
await Services.search.setDefault(engine1);
for (let engine of currentEngines) {
await Services.search.removeEngine(engine);
}
registerCleanupFunction(async () => {
ContentSearch._onMessageSearch = originalOnMessageSearch;
ContentSearch._onMessageManageEngines = originalOnMessageManageEngines;
});
await promiseTab();
});
add_task(async function emptyInput() {
await setUp();
await focusContentSearchBar();
let state = await msg("key", { key: "x", waitForSuggestions: true });
checkState(state, "x", ["xfoo", "xbar"], -1);
@ -211,7 +263,7 @@ add_task(async function emptyInput() {
});
add_task(async function blur() {
await setUp();
await focusContentSearchBar();
let state = await msg("key", { key: "x", waitForSuggestions: true });
checkState(state, "x", ["xfoo", "xbar"], -1);
@ -226,7 +278,7 @@ add_task(async function blur() {
});
add_task(async function upDownKeys() {
await setUp();
await focusContentSearchBar();
let state = await msg("key", { key: "x", waitForSuggestions: true });
checkState(state, "x", ["xfoo", "xbar"], -1);
@ -267,7 +319,7 @@ add_task(async function upDownKeys() {
});
add_task(async function rightLeftKeys() {
await setUp();
await focusContentSearchBar();
let state = await msg("key", { key: "x", waitForSuggestions: true });
checkState(state, "x", ["xfoo", "xbar"], -1);
@ -318,7 +370,7 @@ add_task(async function rightLeftKeys() {
});
add_task(async function tabKey() {
await setUp();
await focusContentSearchBar();
await msg("key", { key: "x", waitForSuggestions: true });
let state = await msg("key", "VK_TAB");
@ -333,7 +385,7 @@ add_task(async function tabKey() {
state = await msg("key", { key: "VK_TAB", modifiers: { shiftKey: true } });
checkState(state, "x", [], -1);
await setUp();
await focusContentSearchBar();
await msg("key", { key: "VK_DOWN", waitForSuggestions: true });
@ -342,7 +394,7 @@ add_task(async function tabKey() {
}
checkState(state, "x", [], -1);
await setUp();
await focusContentSearchBar();
await msg("key", { key: "VK_DOWN", waitForSuggestions: true });
state = await msg("key", "VK_DOWN");
@ -376,7 +428,7 @@ add_task(async function tabKey() {
});
add_task(async function cycleSuggestions() {
await setUp();
await focusContentSearchBar();
await msg("key", { key: "x", waitForSuggestions: true });
let cycle = async function(aSelectedButtonIndex) {
@ -426,7 +478,7 @@ add_task(async function cycleSuggestions() {
});
add_task(async function cycleOneOffs() {
await setUp();
await focusContentSearchBar();
await msg("key", { key: "x", waitForSuggestions: true });
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
@ -488,7 +540,7 @@ add_task(async function cycleOneOffs() {
});
add_task(async function mouse() {
await setUp();
await focusContentSearchBar();
let state = await msg("key", { key: "x", waitForSuggestions: true });
checkState(state, "x", ["xfoo", "xbar"], -1);
@ -509,7 +561,7 @@ add_task(async function mouse() {
checkState(state, "x", ["xfoo", "xbar"], -1);
await msg("reset");
await setUp();
await focusContentSearchBar();
state = await msg("key", { key: "x", waitForSuggestions: true });
checkState(state, "x", ["xfoo", "xbar"], -1);
@ -527,7 +579,7 @@ add_task(async function mouse() {
});
add_task(async function formHistory() {
await setUp();
await focusContentSearchBar();
// Type an X and add it to form history.
let state = await msg("key", { key: "x", waitForSuggestions: true });
@ -602,7 +654,7 @@ add_task(async function formHistory() {
});
add_task(async function cycleEngines() {
await setUp();
await focusContentSearchBar();
await msg("key", { key: "VK_DOWN", waitForSuggestions: true });
let promiseEngineChange = function(newEngineName) {
@ -619,13 +671,11 @@ add_task(async function cycleEngines() {
});
};
let p = promiseEngineChange(
TEST_ENGINE_PREFIX + " " + TEST_ENGINE_2_BASENAME
);
let p = promiseEngineChange(TEST_ENGINE2_NAME);
await msg("key", { key: "VK_DOWN", modifiers: { accelKey: true } });
await p;
p = promiseEngineChange(TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME);
p = promiseEngineChange(TEST_ENGINE1_NAME);
await msg("key", { key: "VK_UP", modifiers: { accelKey: true } });
await p;
@ -633,7 +683,7 @@ add_task(async function cycleEngines() {
});
add_task(async function search() {
await setUp();
await focusContentSearchBar();
let modifiers = {};
["altKey", "ctrlKey", "metaKey", "shiftKey"].forEach(
@ -646,7 +696,7 @@ add_task(async function search() {
await msg("key", { key: "VK_RETURN", modifiers });
let mesg = await p;
let eventData = {
engineName: TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME,
engineName: TEST_ENGINE1_NAME,
searchString: "x",
healthReportKey: "test",
searchPurpose: "test",
@ -655,7 +705,7 @@ add_task(async function search() {
SimpleTest.isDeeply(eventData, mesg, "Search event data");
await promiseTab();
await setUp();
await focusContentSearchBar();
// Test typing a query, then selecting a suggestion and pressing enter.
p = waitForSearch();
@ -665,7 +715,7 @@ add_task(async function search() {
await msg("key", { key: "VK_RETURN", modifiers });
mesg = await p;
eventData.searchString = "xfoo";
eventData.engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME;
eventData.engineName = TEST_ENGINE1_NAME;
eventData.selection = {
index: 1,
kind: "key",
@ -673,7 +723,7 @@ add_task(async function search() {
SimpleTest.isDeeply(eventData, mesg, "Search event data");
await promiseTab();
await setUp();
await focusContentSearchBar();
// Test typing a query, then selecting a one-off button and pressing enter.
p = waitForSearch();
@ -684,11 +734,11 @@ add_task(async function search() {
mesg = await p;
delete eventData.selection;
eventData.searchString = "x";
eventData.engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_2_BASENAME;
eventData.engineName = TEST_ENGINE2_NAME;
SimpleTest.isDeeply(eventData, mesg, "Search event data");
await promiseTab();
await setUp();
await focusContentSearchBar();
// Test typing a query and clicking the search engine header.
p = waitForSearch();
@ -698,11 +748,11 @@ add_task(async function search() {
await msg("click", { eltIdx: -1, modifiers });
mesg = await p;
eventData.originalEvent = modifiers;
eventData.engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME;
eventData.engineName = TEST_ENGINE1_NAME;
SimpleTest.isDeeply(eventData, mesg, "Search event data");
await promiseTab();
await setUp();
await focusContentSearchBar();
// Test typing a query and then clicking a suggestion.
await msg("key", { key: "x", waitForSuggestions: true });
@ -718,7 +768,7 @@ add_task(async function search() {
SimpleTest.isDeeply(eventData, mesg, "Search event data");
await promiseTab();
await setUp();
await focusContentSearchBar();
// Test typing a query and then clicking a one-off button.
await msg("key", { key: "x", waitForSuggestions: true });
@ -727,12 +777,12 @@ add_task(async function search() {
await msg("click", { eltIdx: 3, modifiers });
mesg = await p;
eventData.searchString = "x";
eventData.engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_2_BASENAME;
eventData.engineName = TEST_ENGINE2_NAME;
delete eventData.selection;
SimpleTest.isDeeply(eventData, mesg, "Search event data");
await promiseTab();
await setUp();
await focusContentSearchBar();
// Test selecting a suggestion, then clicking a one-off without deselecting the
// suggestion, using the keyboard.
@ -752,7 +802,7 @@ add_task(async function search() {
SimpleTest.isDeeply(eventData, mesg, "Search event data");
await promiseTab();
await setUp();
await focusContentSearchBar();
// Test searching when using IME composition.
let state = await msg("startComposition", { data: "" });
@ -778,12 +828,12 @@ add_task(async function search() {
mesg = await p;
eventData.searchString = "x";
eventData.originalEvent = modifiers;
eventData.engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME;
eventData.engineName = TEST_ENGINE1_NAME;
delete eventData.selection;
SimpleTest.isDeeply(eventData, mesg, "Search event data");
await promiseTab();
await setUp();
await focusContentSearchBar();
state = await msg("startComposition", { data: "" });
checkState(state, "", [], -1);
@ -841,7 +891,7 @@ add_task(async function search() {
SimpleTest.isDeeply(eventData, mesg, "Search event data");
await promiseTab();
await setUp();
await focusContentSearchBar();
// Remove form history entries.
// Wait for Satchel.
@ -871,12 +921,12 @@ add_task(async function search() {
checkState(state, "x", ["xfoo", "xbar"], -1);
await promiseTab();
await setUp();
await focusContentSearchBar();
await msg("reset");
});
add_task(async function settings() {
await setUp();
await focusContentSearchBar();
await msg("key", { key: "VK_DOWN", waitForSuggestions: true });
await msg("key", "VK_UP");
let p = waitForSearchSettings();
@ -886,30 +936,16 @@ add_task(async function settings() {
await msg("reset");
});
var gDidInitialSetUp = false;
async function setUp(aNoEngine) {
if (!gDidInitialSetUp) {
var { ContentSearch } = ChromeUtils.import(
"resource:///actors/ContentSearchParent.jsm"
);
let originalOnMessageSearch = ContentSearch._onMessageSearch;
let originalOnMessageManageEngines = ContentSearch._onMessageManageEngines;
ContentSearch._onMessageSearch = () => {};
ContentSearch._onMessageManageEngines = () => {};
registerCleanupFunction(() => {
ContentSearch._onMessageSearch = originalOnMessageSearch;
ContentSearch._onMessageManageEngines = originalOnMessageManageEngines;
});
await setUpEngines();
await promiseTab();
gDidInitialSetUp = true;
}
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
content.gController.input.focus();
});
}
add_task(async function cleanup() {
// Extensions must be unloaded before registerCleanupFunction runs, so
// unload them here.
Services.search.restoreDefaultEngines();
await Services.search.setDefault(
Services.search.getEngineByName(currentEngineName)
);
await extension1.unload();
await extension2.unload();
});
function checkState(
actualState,
@ -968,10 +1004,9 @@ async function promiseTab() {
openTrustedLinkIn(pageURL, "current");
await loadedPromise;
const engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME;
await SpecialPowers.spawn(
window.gBrowser.selectedBrowser,
[engineName],
[TEST_ENGINE1_NAME],
engineNameChild => {
Services.search.defaultEngine = Services.search.getEngineByName(
engineNameChild
@ -999,27 +1034,3 @@ async function promiseTab() {
}
);
}
async function setUpEngines() {
info("Removing default search engines");
let currentEngineName = (await Services.search.getDefault()).name;
let currentEngines = await Services.search.getVisibleEngines();
info("Adding test search engines");
let rootDir = getRootDirectory(gTestPath);
let engine1 = await SearchTestUtils.promiseNewSearchEngine(
rootDir + TEST_ENGINE_BASENAME
);
await SearchTestUtils.promiseNewSearchEngine(
rootDir + TEST_ENGINE_2_BASENAME
);
await Services.search.setDefault(engine1);
for (let engine of currentEngines) {
await Services.search.removeEngine(engine);
}
registerCleanupFunction(async () => {
Services.search.restoreDefaultEngines();
await Services.search.setDefault(
Services.search.getEngineByName(currentEngineName)
);
});
}

Просмотреть файл

@ -0,0 +1,116 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_ENGINE_NAME = "searchSuggestionEngine";
const HANDOFF_PREF =
"browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar";
let extension;
let defaultEngine;
let addedEngine;
add_task(async function setup() {
defaultEngine = await Services.search.getDefault();
extension = await SearchTestUtils.installSearchExtension({
id: TEST_ENGINE_NAME,
name: TEST_ENGINE_NAME,
suggest_url:
"https://example.com/browser/browser/components/search/test/browser/searchSuggestionEngine.sjs",
suggest_url_get_params: "query={searchTerms}",
});
addedEngine = await Services.search.getEngineByName(TEST_ENGINE_NAME);
registerCleanupFunction(async () => {
await Services.search.setDefault(defaultEngine);
});
});
// async function runAboutNewTabTest(expectedIcon)
async function ensureIcon(tab, expectedIcon) {
await SpecialPowers.spawn(tab.linkedBrowser, [expectedIcon], async function(
icon
) {
await ContentTaskUtils.waitForCondition(() => !content.document.hidden);
let computedStyle = content.window.getComputedStyle(content.document.body);
await ContentTaskUtils.waitForCondition(
() => computedStyle.getPropertyValue("--newtab-search-icon") != "null",
"Search Icon not set."
);
Assert.equal(
computedStyle.getPropertyValue("--newtab-search-icon"),
`url(${icon})`,
"Should have the expected icon"
);
});
}
async function runNewTabTest() {
let tab = await BrowserTestUtils.openNewForegroundTab({
url: "about:newtab",
gBrowser,
waitForLoad: false,
});
let engineIcon = defaultEngine.getIconURLBySize(16, 16);
await ensureIcon(tab, engineIcon);
await Services.search.setDefault(addedEngine);
// We only show the engine's own icon for app provided engines, otherwise show
// a default. xref https://bugzilla.mozilla.org/show_bug.cgi?id=1449338#c19
await ensureIcon(tab, "chrome://browser/skin/search-glass.svg");
await Services.search.setDefault(defaultEngine);
BrowserTestUtils.removeTab(tab);
}
add_task(async function test_content_search_icon() {
SpecialPowers.pushPrefEnv({
set: [[HANDOFF_PREF, true]],
});
await runNewTabTest();
});
add_task(async function test_content_search_icon_no_handoff() {
SpecialPowers.pushPrefEnv({
set: [[HANDOFF_PREF, false]],
});
await runNewTabTest();
});
add_task(async function test_content_search_icon_in_private_window() {
let win = await BrowserTestUtils.openNewBrowserWindow({
private: true,
waitForTabURL: "about:privatebrowsing",
});
let tab = win.gBrowser.selectedTab;
let engineIcon = defaultEngine.getIconURLBySize(16, 16);
await ensureIcon(tab, engineIcon);
await Services.search.setDefault(addedEngine);
// We only show the engine's own icon for app provided engines, otherwise show
// a default. xref https://bugzilla.mozilla.org/show_bug.cgi?id=1449338#c19
await ensureIcon(tab, "chrome://browser/skin/search-glass.svg");
await Services.search.setDefault(defaultEngine);
await BrowserTestUtils.closeWindow(win);
});
add_task(async function cleanup() {
// Extensions must be unloaded before registerCleanupFunction runs, so
// unload them here.
await extension.unload();
});

Просмотреть файл

@ -1,8 +1,5 @@
// Tests that keyboard navigation in the search panel works as designed.
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
const searchPopup = document.getElementById("PopupSearchAutoComplete");
const oneOffsContainer = searchPopup.searchOneOffsContainer;

Просмотреть файл

@ -2,15 +2,20 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
XPCOMUtils.defineLazyModuleGetters(this, {
AddonTestUtils: "resource://testing-common/AddonTestUtils.jsm",
CustomizableUITestUtils:
"resource://testing-common/CustomizableUITestUtils.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
SearchTestUtils: "resource://testing-common/SearchTestUtils.jsm",
SearchUtils: "resource://gre/modules/SearchUtils.jsm",
UrlbarSearchUtils: "resource:///modules/UrlbarSearchUtils.jsm",
});
let gCUITestUtils = new CustomizableUITestUtils(window);
AddonTestUtils.initMochitest(this);
SearchTestUtils.init(this);
/**
* Recursively compare two objects and check that every property of expectedObj has the same value
* on actualObj.

Просмотреть файл

@ -0,0 +1,50 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
let gTimer;
function handleRequest(req, resp) {
// Parse the query params. If the params aren't in the form "foo=bar", then
// treat the entire query string as a search string.
let params = req.queryString.split("&").reduce((memo, pair) => {
let [key, val] = pair.split("=");
if (!val) {
// This part isn't in the form "foo=bar". Treat it as the search string
// (the "query").
val = key;
key = "query";
}
memo[decode(key)] = decode(val);
return memo;
}, {});
let timeout = parseInt(params.timeout);
if (timeout) {
// Write the response after a timeout.
resp.processAsync();
gTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
gTimer.init(
() => {
writeResponse(params, resp);
resp.finish();
},
timeout,
Ci.nsITimer.TYPE_ONE_SHOT
);
return;
}
writeResponse(params, resp);
}
function writeResponse(params, resp) {
// Echo back the search string with "foo" and "bar" appended.
let suffixes = ["foo", "bar"];
let data = [params.query, suffixes.map(s => params.query + s)];
resp.setHeader("Content-Type", "application/json", false);
resp.write(JSON.stringify(data));
}
function decode(str) {
return decodeURIComponent(str.replace(/\+/g, encodeURIComponent(" ")));
}

Просмотреть файл

@ -36,7 +36,7 @@ XPCOMUtils.defineLazyGetter(this, "SearchTestUtils", () => {
const { SearchTestUtils: module } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
module.init(Assert, registerCleanupFunction);
module.init(this);
return module;
});

Просмотреть файл

@ -42,7 +42,7 @@ XPCOMUtils.defineLazyGetter(this, "SearchTestUtils", () => {
const { SearchTestUtils: module } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
module.init(Assert, registerCleanupFunction);
module.init(this);
return module;
});

Просмотреть файл

@ -221,9 +221,9 @@ add_task(async function badImage() {
);
ok(!!expectedEngine, "Sanity check: engine should be in expected state");
ok(
expectedEngine.iconData === null,
"Sanity check: icon array buffer of engine in expected state " +
"should be null: " +
expectedEngine.iconData ===
"chrome://browser/skin/search-engine-placeholder.png",
"Sanity check: icon of engine in expected state should be the placeholder: " +
expectedEngine.iconData
);
checkMsg(finalCurrentStateMsg, {
@ -492,7 +492,9 @@ async function constructEngineObj(engine) {
function iconDataFromURI(uri) {
if (!uri) {
return Promise.resolve(null);
return Promise.resolve(
"chrome://browser/skin/search-engine-placeholder.png"
);
}
if (!uri.startsWith("data:")) {
@ -505,7 +507,7 @@ function iconDataFromURI(uri) {
xhr.open("GET", uri, true);
xhr.responseType = "arraybuffer";
xhr.onerror = () => {
resolve(null);
resolve("chrome://browser/skin/search-engine-placeholder.png");
};
xhr.onload = () => {
arrayBufferIconTested = true;
@ -514,7 +516,7 @@ function iconDataFromURI(uri) {
try {
xhr.send();
} catch (err) {
resolve(null);
resolve("chrome://browser/skin/search-engine-placeholder.png");
}
});
}

Просмотреть файл

@ -27,7 +27,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
});
let gCUITestUtils = new CustomizableUITestUtils(window);
SearchTestUtils.init(Assert, registerCleanupFunction);
SearchTestUtils.init(this);
var gHttpServer = null;
var gRequests = [];

Просмотреть файл

@ -103,6 +103,8 @@ p {
opacity: 1;
transition: opacity 500ms;
width: 100%;
-moz-context-properties: fill;
fill: rgba(12, 12, 13, 0.4);
}
.search-handoff-button.focused {

Просмотреть файл

@ -98,7 +98,7 @@ Anyway, the build system spawns thousands of new processes during a
build. Parts of the build that rely on rapid spawning of new processes
are slow on Windows as a result. This is most pronounced when running
*configure*. The configure file is a giant shell script and shell
scripts rely heavily on new processes. This is why configure on Windows
scripts rely heavily on new processes. This is why configure
can run over a minute slower on Windows.
Another reason Windows builds are slower is because Windows lacks proper

Просмотреть файл

@ -43,7 +43,7 @@ const SEARCH_CONFIG = [
];
async function setupSearchService() {
SearchTestUtils.init(Assert, registerCleanupFunction);
SearchTestUtils.init(this);
Services.prefs.setBoolPref("browser.search.modernConfig", true);
AddonTestUtils.init(this);

Просмотреть файл

@ -321,7 +321,7 @@ void AnimationEffect::GetComputedTimingAsDict(
void AnimationEffect::UpdateTiming(const OptionalEffectTiming& aTiming,
ErrorResult& aRv) {
TimingParams timing =
TimingParams::MergeOptionalEffectTiming(mTiming, aTiming, mDocument, aRv);
TimingParams::MergeOptionalEffectTiming(mTiming, aTiming, aRv);
if (aRv.Failed()) {
return;
}

Просмотреть файл

@ -835,8 +835,7 @@ already_AddRefed<KeyframeEffect> KeyframeEffect::ConstructKeyframeEffect(
return nullptr;
}
TimingParams timingParams =
TimingParams::FromOptionsUnion(aOptions, doc, aRv);
TimingParams timingParams = TimingParams::FromOptionsUnion(aOptions, aRv);
if (aRv.Failed()) {
return nullptr;
}

Просмотреть файл

@ -444,8 +444,8 @@ static bool ConvertKeyframeSequence(JSContext* aCx, dom::Document* aDocument,
}
if (!parseEasingResult.Failed()) {
keyframe->mTimingFunction = TimingParams::ParseEasing(
keyframeDict.mEasing, aDocument, parseEasingResult);
keyframe->mTimingFunction =
TimingParams::ParseEasing(keyframeDict.mEasing, parseEasingResult);
// Even if the above fails, we still need to continue reading off all the
// properties since checking the validity of easing should be treated as
// a separate step that happens *after* all the other processing in this
@ -1099,7 +1099,7 @@ static void GetKeyframeListFromPropertyIndexedKeyframe(
FallibleTArray<Maybe<ComputedTimingFunction>> easings;
auto parseAndAppendEasing = [&](const nsString& easingString,
ErrorResult& aRv) {
auto easing = TimingParams::ParseEasing(easingString, aDocument, aRv);
auto easing = TimingParams::ParseEasing(easingString, aRv);
if (!aRv.Failed() && !easings.AppendElement(std::move(easing), fallible)) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
}

Просмотреть файл

@ -38,7 +38,6 @@ const dom::EffectTiming& GetTimingProperties(
template <class OptionsType>
/* static */
TimingParams TimingParams::FromOptionsType(const OptionsType& aOptions,
dom::Document* aDocument,
ErrorResult& aRv) {
TimingParams result;
@ -55,7 +54,7 @@ TimingParams TimingParams::FromOptionsType(const OptionsType& aOptions,
result.Update();
} else {
const dom::EffectTiming& timing = GetTimingProperties(aOptions);
result = FromEffectTiming(timing, aDocument, aRv);
result = FromEffectTiming(timing, aRv);
}
return result;
@ -64,21 +63,20 @@ TimingParams TimingParams::FromOptionsType(const OptionsType& aOptions,
/* static */
TimingParams TimingParams::FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
dom::Document* aDocument, ErrorResult& aRv) {
return FromOptionsType(aOptions, aDocument, aRv);
ErrorResult& aRv) {
return FromOptionsType(aOptions, aRv);
}
/* static */
TimingParams TimingParams::FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
dom::Document* aDocument, ErrorResult& aRv) {
return FromOptionsType(aOptions, aDocument, aRv);
ErrorResult& aRv) {
return FromOptionsType(aOptions, aRv);
}
/* static */
TimingParams TimingParams::FromEffectTiming(
const dom::EffectTiming& aEffectTiming, dom::Document* aDocument,
ErrorResult& aRv) {
const dom::EffectTiming& aEffectTiming, ErrorResult& aRv) {
TimingParams result;
Maybe<StickyTimeDuration> duration =
@ -95,7 +93,7 @@ TimingParams TimingParams::FromEffectTiming(
return result;
}
Maybe<ComputedTimingFunction> easing =
TimingParams::ParseEasing(aEffectTiming.mEasing, aDocument, aRv);
TimingParams::ParseEasing(aEffectTiming.mEasing, aRv);
if (aRv.Failed()) {
return result;
}
@ -117,7 +115,7 @@ TimingParams TimingParams::FromEffectTiming(
/* static */
TimingParams TimingParams::MergeOptionalEffectTiming(
const TimingParams& aSource, const dom::OptionalEffectTiming& aEffectTiming,
dom::Document* aDocument, ErrorResult& aRv) {
ErrorResult& aRv) {
MOZ_ASSERT(!aRv.Failed(), "Initially return value should be ok");
TimingParams result = aSource;
@ -150,8 +148,7 @@ TimingParams TimingParams::MergeOptionalEffectTiming(
Maybe<ComputedTimingFunction> easing;
if (aEffectTiming.mEasing.WasPassed()) {
easing = TimingParams::ParseEasing(aEffectTiming.mEasing.Value(), aDocument,
aRv);
easing = TimingParams::ParseEasing(aEffectTiming.mEasing.Value(), aRv);
if (aRv.Failed()) {
return result;
}
@ -193,12 +190,9 @@ TimingParams TimingParams::MergeOptionalEffectTiming(
/* static */
Maybe<ComputedTimingFunction> TimingParams::ParseEasing(
const nsAString& aEasing, dom::Document* aDocument, ErrorResult& aRv) {
MOZ_ASSERT(aDocument);
const nsAString& aEasing, ErrorResult& aRv) {
nsTimingFunction timingFunction;
RefPtr<URLExtraData> url = ServoCSSParser::GetURLExtraData(aDocument);
if (!ServoCSSParser::ParseEasing(aEasing, url, timingFunction)) {
if (!ServoCSSParser::ParseEasing(aEasing, timingFunction)) {
aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(
NS_ConvertUTF16toUTF8(aEasing));
return Nothing();

Просмотреть файл

@ -23,7 +23,6 @@
namespace mozilla {
namespace dom {
class Document;
class UnrestrictedDoubleOrKeyframeEffectOptions;
class UnrestrictedDoubleOrKeyframeAnimationOptions;
} // namespace dom
@ -57,16 +56,14 @@ struct TimingParams {
template <class OptionsType>
static TimingParams FromOptionsType(const OptionsType& aOptions,
dom::Document* aDocument,
ErrorResult& aRv);
static TimingParams FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
dom::Document* aDocument, ErrorResult& aRv);
ErrorResult& aRv);
static TimingParams FromOptionsUnion(
const dom::UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
dom::Document* aDocument, ErrorResult& aRv);
ErrorResult& aRv);
static TimingParams FromEffectTiming(const dom::EffectTiming& aEffectTiming,
dom::Document* aDocument,
ErrorResult& aRv);
// Returns a copy of |aSource| where each timing property in |aSource| that
// is also specified in |aEffectTiming| is replaced with the value from
@ -76,8 +73,7 @@ struct TimingParams {
// true and an unmodified copy of |aSource| will be returned.
static TimingParams MergeOptionalEffectTiming(
const TimingParams& aSource,
const dom::OptionalEffectTiming& aEffectTiming, dom::Document* aDocument,
ErrorResult& aRv);
const dom::OptionalEffectTiming& aEffectTiming, ErrorResult& aRv);
// Range-checks and validates an UnrestrictedDoubleOrString or
// OwningUnrestrictedDoubleOrString object and converts to a
@ -123,7 +119,6 @@ struct TimingParams {
}
static Maybe<ComputedTimingFunction> ParseEasing(const nsAString& aEasing,
dom::Document* aDocument,
ErrorResult& aRv);
static StickyTimeDuration CalcActiveDuration(

Просмотреть файл

@ -40,117 +40,104 @@ using namespace mozilla;
using namespace mozilla::dom;
using mozilla::AutoJSContext;
enum class IsRemoveNotification {
Yes,
No,
};
#define NOTIFY_PRESSHELL_IF(condition_, forEach_) \
if (condition_) { \
if (PresShell* presShell = doc->GetObservingPresShell()) { \
forEach_(presShell); \
} \
}
#ifdef DEBUG
# define COMPOSED_DOC_DECL \
const bool wasInComposedDoc = !!node->GetComposedDoc();
#else
# define COMPOSED_DOC_DECL
#endif
#define DEFINE_NOTIFIERS(func_, params_) \
auto notifyPresShell = [&](PresShell* aPresShell) { \
aPresShell->func_ params_; \
}; \
auto notifyObserver = [&](nsIMutationObserver* aObserver) { \
aObserver->func_ params_; \
};
#define CALL_BINDING_MANAGER(func_, params_) \
do { \
} while (0)
static inline nsINode* ForEachAncestorObserver(
nsINode* aNode, FunctionRef<void(nsIMutationObserver*)> aFunc) {
nsINode* last;
nsINode* node = aNode;
do {
nsAutoTObserverArray<nsIMutationObserver*, 1>* observers =
node->GetMutationObservers();
if (observers && !observers->IsEmpty()) {
for (nsIMutationObserver* obs : observers->ForwardRange()) {
aFunc(obs);
}
}
last = node;
if (ShadowRoot* shadow = ShadowRoot::FromNode(node)) {
node = shadow->GetHost();
} else {
node = node->GetParentNode();
}
} while (node);
return last;
}
// This macro expects the ownerDocument of content_ to be in scope as
// |Document* doc|
#define IMPL_MUTATION_NOTIFICATION(func_, content_, params_, remove_) \
PR_BEGIN_MACRO \
bool needsEnterLeave = doc->MayHaveDOMMutationObservers(); \
if (needsEnterLeave) { \
nsDOMMutationObserver::EnterMutationHandling(); \
} \
nsINode* node = content_; \
COMPOSED_DOC_DECL \
NS_ASSERTION(node->OwnerDoc() == doc, "Bogus document"); \
if (remove_ == IsRemoveNotification::Yes && node->GetComposedDoc()) { \
if (PresShell* presShell = doc->GetObservingPresShell()) { \
presShell->func_ params_; \
} \
} \
CALL_BINDING_MANAGER(func_, params_); \
nsINode* last; \
do { \
nsINode::nsSlots* slots = node->GetExistingSlots(); \
if (slots && !slots->mMutationObservers.IsEmpty()) { \
NS_OBSERVER_ARRAY_NOTIFY_OBSERVERS(slots->mMutationObservers, func_, \
params_); \
} \
last = node; \
if (ShadowRoot* shadow = ShadowRoot::FromNode(node)) { \
node = shadow->GetHost(); \
} else { \
node = node->GetParentNode(); \
} \
} while (node); \
/* Whitelist NativeAnonymousChildListChange removal notifications from \
* the assertion since it runs from UnbindFromTree, and thus we don't \
* reach the document, but doesn't matter. */ \
MOZ_ASSERT((last == doc) == wasInComposedDoc || \
(remove_ == IsRemoveNotification::Yes && \
!strcmp(#func_, "NativeAnonymousChildListChange"))); \
if (remove_ == IsRemoveNotification::No && last == doc) { \
if (PresShell* presShell = doc->GetObservingPresShell()) { \
presShell->func_ params_; \
} \
} \
if (needsEnterLeave) { \
nsDOMMutationObserver::LeaveMutationHandling(); \
} \
PR_END_MACRO
static inline void NotifyRemovalImpl(
nsINode* aNode, FunctionRef<void(PresShell*)> aNotifyPresShell,
FunctionRef<void(nsIMutationObserver*)> aNotifyObserver) {
Document* doc = aNode->OwnerDoc();
nsDOMMutationEnterLeave enterLeave(doc);
NOTIFY_PRESSHELL_IF(aNode->GetComposedDoc(), aNotifyPresShell);
DebugOnly<nsINode*> last = ForEachAncestorObserver(aNode, aNotifyObserver);
MOZ_ASSERT((last == doc) == !!aNode->GetComposedDoc());
}
#define IMPL_ANIMATION_NOTIFICATION(func_, content_, params_) \
PR_BEGIN_MACRO \
bool needsEnterLeave = doc->MayHaveDOMMutationObservers(); \
if (needsEnterLeave) { \
nsDOMMutationObserver::EnterMutationHandling(); \
} \
nsINode* node = content_; \
do { \
nsINode::nsSlots* slots = node->GetExistingSlots(); \
if (slots && !slots->mMutationObservers.IsEmpty()) { \
NS_OBSERVER_ARRAY_NOTIFY_OBSERVERS_WITH_QI( \
slots->mMutationObservers, nsIAnimationObserver, func_, params_); \
} \
if (ShadowRoot* shadow = ShadowRoot::FromNode(node)) { \
node = shadow->GetHost(); \
} else { \
node = node->GetParentNode(); \
} \
} while (node); \
if (needsEnterLeave) { \
nsDOMMutationObserver::LeaveMutationHandling(); \
} \
static inline void NotifyRemovalImplNoAssert(
nsINode* aNode, FunctionRef<void(PresShell*)> aNotifyPresShell,
FunctionRef<void(nsIMutationObserver*)> aNotifyObserver) {
Document* doc = aNode->OwnerDoc();
nsDOMMutationEnterLeave enterLeave(doc);
NOTIFY_PRESSHELL_IF(aNode->GetComposedDoc(), aNotifyPresShell);
ForEachAncestorObserver(aNode, aNotifyObserver);
}
static inline void NotifyNonRemovalImpl(
nsINode* aNode, FunctionRef<void(PresShell*)> aNotifyPresShell,
FunctionRef<void(nsIMutationObserver*)> aNotifyObserver) {
Document* doc = aNode->OwnerDoc();
nsDOMMutationEnterLeave enterLeave(doc);
nsINode* last = ForEachAncestorObserver(aNode, aNotifyObserver);
NOTIFY_PRESSHELL_IF(last == doc, aNotifyPresShell);
MOZ_ASSERT((last == doc) == !!aNode->GetComposedDoc());
}
#define IMPL_ANIMATION_NOTIFICATION(func_, content_, params_) \
PR_BEGIN_MACRO \
nsDOMMutationEnterLeave enterLeave(doc); \
auto forEach = [&](nsIMutationObserver* aObserver) { \
if (nsCOMPtr<nsIAnimationObserver> obs = do_QueryInterface(aObserver)) { \
obs->func_ params_; \
} \
}; \
ForEachAncestorObserver(content_, forEach); \
PR_END_MACRO
namespace mozilla {
void MutationObservers::NotifyCharacterDataWillChange(
nsIContent* aContent, const CharacterDataChangeInfo& aInfo) {
Document* doc = aContent->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(CharacterDataWillChange, aContent,
(aContent, aInfo), IsRemoveNotification::No);
DEFINE_NOTIFIERS(CharacterDataWillChange, (aContent, aInfo));
NotifyNonRemovalImpl(aContent, notifyPresShell, notifyObserver);
}
void MutationObservers::NotifyCharacterDataChanged(
nsIContent* aContent, const CharacterDataChangeInfo& aInfo) {
Document* doc = aContent->OwnerDoc();
doc->Changed();
IMPL_MUTATION_NOTIFICATION(CharacterDataChanged, aContent, (aContent, aInfo),
IsRemoveNotification::No);
aContent->OwnerDoc()->Changed();
DEFINE_NOTIFIERS(CharacterDataChanged, (aContent, aInfo));
NotifyNonRemovalImpl(aContent, notifyPresShell, notifyObserver);
}
void MutationObservers::NotifyAttributeWillChange(Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) {
Document* doc = aElement->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(AttributeWillChange, aElement,
(aElement, aNameSpaceID, aAttribute, aModType),
IsRemoveNotification::No);
DEFINE_NOTIFIERS(AttributeWillChange,
(aElement, aNameSpaceID, aAttribute, aModType));
NotifyNonRemovalImpl(aElement, notifyPresShell, notifyObserver);
}
void MutationObservers::NotifyAttributeChanged(Element* aElement,
@ -158,48 +145,45 @@ void MutationObservers::NotifyAttributeChanged(Element* aElement,
nsAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aOldValue) {
Document* doc = aElement->OwnerDoc();
doc->Changed();
IMPL_MUTATION_NOTIFICATION(
AttributeChanged, aElement,
(aElement, aNameSpaceID, aAttribute, aModType, aOldValue),
IsRemoveNotification::No);
aElement->OwnerDoc()->Changed();
DEFINE_NOTIFIERS(AttributeChanged,
(aElement, aNameSpaceID, aAttribute, aModType, aOldValue));
NotifyNonRemovalImpl(aElement, notifyPresShell, notifyObserver);
}
void MutationObservers::NotifyAttributeSetToCurrentValue(Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute) {
Document* doc = aElement->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(AttributeSetToCurrentValue, aElement,
(aElement, aNameSpaceID, aAttribute),
IsRemoveNotification::No);
DEFINE_NOTIFIERS(AttributeSetToCurrentValue,
(aElement, aNameSpaceID, aAttribute));
NotifyNonRemovalImpl(aElement, notifyPresShell, notifyObserver);
}
void MutationObservers::NotifyContentAppended(nsIContent* aContainer,
nsIContent* aFirstNewContent) {
Document* doc = aContainer->OwnerDoc();
doc->Changed();
IMPL_MUTATION_NOTIFICATION(ContentAppended, aContainer, (aFirstNewContent),
IsRemoveNotification::No);
aContainer->OwnerDoc()->Changed();
DEFINE_NOTIFIERS(ContentAppended, (aFirstNewContent));
NotifyNonRemovalImpl(aContainer, notifyPresShell, notifyObserver);
}
void MutationObservers::NotifyNativeAnonymousChildListChange(
nsIContent* aContent, bool aIsRemove) {
Document* doc = aContent->OwnerDoc();
auto isRemove =
aIsRemove ? IsRemoveNotification::Yes : IsRemoveNotification::No;
IMPL_MUTATION_NOTIFICATION(NativeAnonymousChildListChange, aContent,
(aContent, aIsRemove), isRemove);
DEFINE_NOTIFIERS(NativeAnonymousChildListChange, (aContent, aIsRemove));
if (aIsRemove) {
// It doesn't reach the document since it runs from UnbindFromTree
NotifyRemovalImplNoAssert(aContent, notifyPresShell, notifyObserver);
} else {
NotifyNonRemovalImpl(aContent, notifyPresShell, notifyObserver);
}
}
void MutationObservers::NotifyContentInserted(nsINode* aContainer,
nsIContent* aChild) {
MOZ_ASSERT(aContainer->IsContent() || aContainer->IsDocument(),
"container must be an nsIContent or an Document");
Document* doc = aContainer->OwnerDoc();
doc->Changed();
IMPL_MUTATION_NOTIFICATION(ContentInserted, aContainer, (aChild),
IsRemoveNotification::No);
aContainer->OwnerDoc()->Changed();
DEFINE_NOTIFIERS(ContentInserted, (aChild));
NotifyNonRemovalImpl(aContainer, notifyPresShell, notifyObserver);
}
void MutationObservers::NotifyContentRemoved(nsINode* aContainer,
@ -207,13 +191,11 @@ void MutationObservers::NotifyContentRemoved(nsINode* aContainer,
nsIContent* aPreviousSibling) {
MOZ_ASSERT(aContainer->IsContent() || aContainer->IsDocument(),
"container must be an nsIContent or an Document");
Document* doc = aContainer->OwnerDoc();
doc->Changed();
aContainer->OwnerDoc()->Changed();
MOZ_ASSERT(aChild->GetParentNode() == aContainer,
"We expect the parent link to be still around at this point");
IMPL_MUTATION_NOTIFICATION(ContentRemoved, aContainer,
(aChild, aPreviousSibling),
IsRemoveNotification::Yes);
DEFINE_NOTIFIERS(ContentRemoved, (aChild, aPreviousSibling));
NotifyRemovalImpl(aContainer, notifyPresShell, notifyObserver);
}
} // namespace mozilla

Просмотреть файл

@ -119,10 +119,11 @@ class MutationObservers {
* @see nsIMutationObserver::ParentChainChanged
*/
static inline void NotifyParentChainChanged(nsIContent* aContent) {
nsINode::nsSlots* slots = aContent->GetExistingSlots();
if (slots && !slots->mMutationObservers.IsEmpty()) {
NS_OBSERVER_ARRAY_NOTIFY_OBSERVERS(slots->mMutationObservers,
ParentChainChanged, (aContent));
nsAutoTObserverArray<nsIMutationObserver*, 1>* observers =
aContent->GetMutationObservers();
if (observers && !observers->IsEmpty()) {
NS_OBSERVER_ARRAY_NOTIFY_OBSERVERS(*observers, ParentChainChanged,
(aContent));
}
}

Просмотреть файл

@ -455,50 +455,6 @@ nsContentPermissionRequester::~nsContentPermissionRequester() {
mListener = nullptr;
}
NS_IMETHODIMP
nsContentPermissionRequester::GetVisibility(
nsIContentPermissionRequestCallback* aCallback) {
NS_ENSURE_ARG_POINTER(aCallback);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(mWindow);
if (!window) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDocShell> docshell = window->GetDocShell();
if (!docshell) {
return NS_ERROR_FAILURE;
}
bool isActive = false;
docshell->GetIsActive(&isActive);
aCallback->NotifyVisibility(isActive);
return NS_OK;
}
NS_IMETHODIMP
nsContentPermissionRequester::SetOnVisibilityChange(
nsIContentPermissionRequestCallback* aCallback) {
mListener->SetCallback(aCallback);
if (!aCallback) {
mListener->RemoveListener();
}
return NS_OK;
}
NS_IMETHODIMP
nsContentPermissionRequester::GetOnVisibilityChange(
nsIContentPermissionRequestCallback** aCallback) {
NS_ENSURE_ARG_POINTER(aCallback);
nsCOMPtr<nsIContentPermissionRequestCallback> callback =
mListener->GetCallback();
callback.forget(aCallback);
return NS_OK;
}
static nsIPrincipal* GetTopLevelPrincipal(nsPIDOMWindowInner* aWindow) {
MOZ_ASSERT(aWindow);
@ -791,34 +747,6 @@ NS_IMPL_ISUPPORTS(
nsContentPermissionRequestProxy::nsContentPermissionRequesterProxy,
nsIContentPermissionRequester)
NS_IMETHODIMP
nsContentPermissionRequestProxy::nsContentPermissionRequesterProxy ::
GetVisibility(nsIContentPermissionRequestCallback* aCallback) {
NS_ENSURE_ARG_POINTER(aCallback);
mGetCallback = aCallback;
mWaitGettingResult = true;
Unused << mParent->SendGetVisibility();
return NS_OK;
}
NS_IMETHODIMP
nsContentPermissionRequestProxy::nsContentPermissionRequesterProxy ::
SetOnVisibilityChange(nsIContentPermissionRequestCallback* aCallback) {
mOnChangeCallback = aCallback;
return NS_OK;
}
NS_IMETHODIMP
nsContentPermissionRequestProxy::nsContentPermissionRequesterProxy ::
GetOnVisibilityChange(nsIContentPermissionRequestCallback** aCallback) {
NS_ENSURE_ARG_POINTER(aCallback);
nsCOMPtr<nsIContentPermissionRequestCallback> callback = mOnChangeCallback;
callback.forget(aCallback);
return NS_OK;
}
void nsContentPermissionRequestProxy::nsContentPermissionRequesterProxy ::
NotifyVisibilityResult(const bool& aIsVisible) {
if (mWaitGettingResult) {
@ -844,7 +772,7 @@ nsContentPermissionRequestProxy::~nsContentPermissionRequestProxy() = default;
nsresult nsContentPermissionRequestProxy::Init(
const nsTArray<PermissionRequest>& requests) {
mPermissionRequests = requests.Clone();
mRequester = new nsContentPermissionRequesterProxy(mParent);
mRequester = new nsContentPermissionRequesterProxy();
nsCOMPtr<nsIContentPermissionPrompt> prompt =
do_GetService(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID);
@ -1081,18 +1009,6 @@ mozilla::ipc::IPCResult RemotePermissionRequest::RecvNotifyResult(
return IPC_OK();
}
mozilla::ipc::IPCResult RemotePermissionRequest::RecvGetVisibility() {
nsCOMPtr<nsIDocShell> docshell = mWindow->GetDocShell();
if (!docshell) {
return IPC_FAIL_NO_REASON(this);
}
bool isActive = false;
docshell->GetIsActive(&isActive);
Unused << SendNotifyVisibility(isActive);
return IPC_OK();
}
void RemotePermissionRequest::Destroy() {
if (!IPCOpen()) {
return;

Просмотреть файл

@ -192,16 +192,13 @@ class nsContentPermissionRequestProxy : public nsIContentPermissionRequest {
NS_DECL_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUESTER
explicit nsContentPermissionRequesterProxy(
ContentPermissionRequestParent* aParent)
: mParent(aParent), mWaitGettingResult(false) {}
explicit nsContentPermissionRequesterProxy() : mWaitGettingResult(false) {}
void NotifyVisibilityResult(const bool& aIsVisible);
private:
virtual ~nsContentPermissionRequesterProxy() = default;
ContentPermissionRequestParent* mParent;
bool mWaitGettingResult;
nsCOMPtr<nsIContentPermissionRequestCallback> mGetCallback;
nsCOMPtr<nsIContentPermissionRequestCallback> mOnChangeCallback;

Просмотреть файл

@ -9068,8 +9068,9 @@ bool nsContentUtils::ComputeIsSecureContext(nsIChannel* aChannel) {
return false;
}
const RefPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
if (principal->IsSystemPrincipal()) {
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
// If the load would've been sandboxed, treat this load as an untrusted
// load, as system code considers sandboxed resources insecure.
return !loadInfo->GetLoadingSandboxed();
@ -9079,6 +9080,13 @@ bool nsContentUtils::ComputeIsSecureContext(nsIChannel* aChannel) {
return false;
}
if (const RefPtr<WindowContext> windowContext =
WindowContext::GetById(loadInfo->GetInnerWindowID())) {
if (!windowContext->GetIsSecureContext()) {
return false;
}
}
return principal->GetIsOriginPotentiallyTrustworthy();
}

Просмотреть файл

@ -875,4 +875,22 @@ inline nsDOMMutationObserver* nsMutationReceiverBase::Observer() {
: static_cast<nsDOMMutationObserver*>(mObserver);
}
class MOZ_RAII nsDOMMutationEnterLeave {
public:
explicit nsDOMMutationEnterLeave(mozilla::dom::Document* aDoc)
: mNeeded(aDoc->MayHaveDOMMutationObservers()) {
if (mNeeded) {
nsDOMMutationObserver::EnterMutationHandling();
}
}
~nsDOMMutationEnterLeave() {
if (mNeeded) {
nsDOMMutationObserver::LeaveMutationHandling();
}
}
private:
const bool mNeeded;
};
#endif

Просмотреть файл

@ -365,7 +365,6 @@ class nsINode : public mozilla::dom::EventTarget {
// always safe to call no matter which object it was invoked on.
void AddSizeOfIncludingThis(nsWindowSizes& aSizes, size_t* aNodeSize) const;
friend class mozilla::dom::MutationObservers;
friend class nsNodeWeakReference;
friend class nsNodeSupportsWeakRefTearoff;
friend class AttrArray;
@ -1109,6 +1108,10 @@ class nsINode : public mozilla::dom::EventTarget {
}
}
nsAutoTObserverArray<nsIMutationObserver*, 1>* GetMutationObservers() {
return HasSlots() ? &GetExistingSlots()->mMutationObservers : nullptr;
}
/**
* Helper methods to access ancestor node(s) of type T.
* The implementations of the methods are in mozilla/dom/AncestorIterator.h.
@ -2123,10 +2126,6 @@ class nsINode : public mozilla::dom::EventTarget {
return GetExistingSlots();
}
nsAutoTObserverArray<nsIMutationObserver*, 1>* GetMutationObservers() {
return HasSlots() ? &GetExistingSlots()->mMutationObservers : nullptr;
}
/**
* Invalidate cached child array inside mChildNodes
* of type nsParentNodeChildContentList.

Просмотреть файл

@ -44,15 +44,6 @@ interface nsIContentPermissionRequestCallback : nsISupports {
*/
[scriptable, uuid(f8577124-6a5f-486f-ae04-c5bcae911eb5)]
interface nsIContentPermissionRequester : nsISupports {
/**
* The function to get the visibility.
*/
void getVisibility(in nsIContentPermissionRequestCallback callback);
/**
* The callback to get the notification of visibility change.
*/
attribute nsIContentPermissionRequestCallback onVisibilityChange;
};
/**

Просмотреть файл

@ -13,6 +13,7 @@
#include "ContentChild.h"
#include "GeckoProfiler.h"
#include "HandlerServiceChild.h"
#include "nsXPLookAndFeel.h"
#include "mozilla/Attributes.h"
#include "mozilla/BackgroundHangMonitor.h"
#include "mozilla/BenchmarkStorageChild.h"
@ -620,6 +621,16 @@ mozilla::ipc::IPCResult ContentChild::RecvSetXPCOMProcessAttributes(
return IPC_OK();
}
class nsGtkNativeInitRunnable : public Runnable {
public:
nsGtkNativeInitRunnable() : Runnable("nsGtkNativeInitRunnable") {}
NS_IMETHOD Run() override {
LookAndFeel::NativeInit();
return NS_OK;
}
};
bool ContentChild::Init(MessageLoop* aIOLoop, base::ProcessId aParentPid,
const char* aParentBuildID,
UniquePtr<IPC::Channel> aChannel, uint64_t aChildID,
@ -1219,6 +1230,14 @@ void ContentChild::InitXPCOM(
// background thread since we'll likely need database information very soon.
BackgroundChild::Startup();
#ifdef MOZ_WIDGET_GTK
// LookAndFeel::NativeInit takes a long time to run on Linux, here we schedule
// it as soon as possible after BackgroundChild::Startup to give
// it chance to run ahead of ConstructBrowser
nsCOMPtr<nsIRunnable> event = new nsGtkNativeInitRunnable();
NS_DispatchToMainThreadQueue(event.forget(), EventQueuePriority::Idle);
#endif
#if defined(XP_WIN)
// DLL services untrusted modules processing depends on
// BackgroundChild::Startup having been called

Просмотреть файл

@ -18,7 +18,6 @@ parent:
async Destroy();
child:
async GetVisibility();
async NotifyResult(bool allow, PermissionChoice[] choices);
async __delete__();
};

Просмотреть файл

@ -51,7 +51,6 @@ bool RemoteDecoderModule::SupportsMimeType(
bool RemoteDecoderModule::Supports(
const SupportDecoderParams& aParams,
DecoderDoctorDiagnostics* aDiagnostics) const {
bool supports =
RemoteDecoderManagerChild::Supports(mLocation, aParams, aDiagnostics);
MOZ_LOG(sPDMLog, LogLevel::Debug,

Просмотреть файл

@ -13,9 +13,9 @@ class nsISerialEventTarget;
namespace mozilla {
namespace ipc {
class PBackgroundChild;
class PBackgroundParent;
} // namespace ipc
class PBackgroundChild;
class PBackgroundParent;
} // namespace ipc
namespace dom {

Просмотреть файл

@ -76,6 +76,13 @@ ServiceWorkerInterceptController::ShouldPrepareForIntercept(
return NS_OK;
}
// Check if we're in a secure context, unless service worker testing is
// enabled.
if (!nsContentUtils::ComputeIsSecureContext(aChannel) &&
!StaticPrefs::dom_serviceWorkers_testing_enabled()) {
return NS_OK;
}
// Then check to see if we are allowed to control the window.
// It is important to check for the availability of the service worker first
// to avoid showing warnings about the use of third-party cookies in the UI

Просмотреть файл

@ -565,8 +565,11 @@ nsresult StorageDBThread::OpenAndUpdateDatabase() {
rv = OpenDatabaseConnection();
NS_ENSURE_SUCCESS(rv, rv);
rv = TryJournalMode();
NS_ENSURE_SUCCESS(rv, rv);
// SQLite doesn't support WAL journals for in-memory databases.
if (mPrivateBrowsingId == 0) {
rv = TryJournalMode();
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
@ -992,7 +995,8 @@ nsresult StorageDBThread::DBOperation::Perform(StorageDBThread* aThread) {
nsCOMPtr<mozIStorageStatement> stmt =
aThread->mWorkerStatements.GetCachedStatement(
"SELECT SUM(LENGTH(key) + LENGTH(value)) FROM webappsstore2 "
"WHERE (originAttributes || ':' || originKey) LIKE :usageOrigin");
"WHERE (originAttributes || ':' || originKey) LIKE :usageOrigin "
"ESCAPE '\\'");
NS_ENSURE_STATE(stmt);
mozStorageStatementScoper scope(stmt);
@ -1008,9 +1012,16 @@ nsresult StorageDBThread::DBOperation::Perform(StorageDBThread* aThread) {
// matching with "_" as a single-character wildcard match and "%" any
// sequence of zero or more characters. So by suffixing the reversed
// eTLD+1 and using "%" we get our case-insensitive (domain names are
// case-insensitive) matching.
// case-insensitive) matching. Note that although legal domain names
// don't include "_" or "%", file origins can include them, so we need
// to escape our OriginScope for correctness.
nsAutoCString originScopeEscaped;
rv = stmt->EscapeUTF8StringForLIKE(mUsage->OriginScope(), '\\',
originScopeEscaped);
NS_ENSURE_SUCCESS(rv, rv);
rv = stmt->BindUTF8StringByName("usageOrigin"_ns,
mUsage->OriginScope() + "%"_ns);
originScopeEscaped + "%"_ns);
NS_ENSURE_SUCCESS(rv, rv);
bool exists;

Просмотреть файл

@ -8,6 +8,7 @@
#include "mozilla/webgpu/PWebGPUChild.h"
#include "mozilla/MozPromise.h"
#include "mozilla/WeakPtr.h"
namespace mozilla {
namespace dom {
@ -26,7 +27,7 @@ typedef MozPromise<RawId, Maybe<ipc::ResponseRejectReason>, true> RawIdPromise;
ffi::WGPUByteBuf* ToFFI(ipc::ByteBuf* x);
class WebGPUChild final : public PWebGPUChild {
class WebGPUChild final : public PWebGPUChild, public SupportsWeakPtr {
public:
friend class layers::CompositorBridgeChild;

Просмотреть файл

@ -707,10 +707,10 @@ void BufferTextureHost::PushResourceUpdates(
? &wr::TransactionBuilder::AddExternalImage
: &wr::TransactionBuilder::UpdateExternalImage;
auto imageType =
UseExternalTextures() || gfx::gfxVars::UseSoftwareWebRender()
? wr::ExternalImageType::TextureHandle(wr::TextureTarget::Rect)
: wr::ExternalImageType::Buffer();
auto imageType = UseExternalTextures() || gfx::gfxVars::UseSoftwareWebRender()
? wr::ExternalImageType::TextureHandle(
wr::ImageBufferKind::TextureRect)
: wr::ExternalImageType::Buffer();
if (GetFormat() != gfx::SurfaceFormat::YUV) {
MOZ_ASSERT(aImageKeys.length() == 1);

Просмотреть файл

@ -1012,11 +1012,11 @@ void DXGITextureHostD3D11::PushResourceUpdates(
MOZ_ASSERT(aImageKeys.length() == 1);
wr::ImageDescriptor descriptor(mSize, GetFormat());
auto imageType =
gfx::gfxVars::UseSoftwareWebRender()
? wr::ExternalImageType::TextureHandle(wr::TextureTarget::Rect)
: wr::ExternalImageType::TextureHandle(
wr::TextureTarget::External);
auto imageType = gfx::gfxVars::UseSoftwareWebRender()
? wr::ExternalImageType::TextureHandle(
wr::ImageBufferKind::TextureRect)
: wr::ExternalImageType::TextureHandle(
wr::ImageBufferKind::TextureExternal);
(aResources.*method)(aImageKeys[0], descriptor, aExtID, imageType, 0);
break;
}
@ -1034,11 +1034,11 @@ void DXGITextureHostD3D11::PushResourceUpdates(
mFormat == gfx::SurfaceFormat::NV12
? gfx::SurfaceFormat::R8G8
: gfx::SurfaceFormat::R16G16);
auto imageType =
gfx::gfxVars::UseSoftwareWebRender()
? wr::ExternalImageType::TextureHandle(wr::TextureTarget::Rect)
: wr::ExternalImageType::TextureHandle(
wr::TextureTarget::External);
auto imageType = gfx::gfxVars::UseSoftwareWebRender()
? wr::ExternalImageType::TextureHandle(
wr::ImageBufferKind::TextureRect)
: wr::ExternalImageType::TextureHandle(
wr::ImageBufferKind::TextureExternal);
(aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
(aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
break;
@ -1286,10 +1286,11 @@ void DXGIYCbCrTextureHostD3D11::PushResourceUpdates(
auto method = aOp == TextureHost::ADD_IMAGE
? &wr::TransactionBuilder::AddExternalImage
: &wr::TransactionBuilder::UpdateExternalImage;
auto imageType =
gfx::gfxVars::UseSoftwareWebRender()
? wr::ExternalImageType::TextureHandle(wr::TextureTarget::Rect)
: wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
auto imageType = gfx::gfxVars::UseSoftwareWebRender()
? wr::ExternalImageType::TextureHandle(
wr::ImageBufferKind::TextureRect)
: wr::ExternalImageType::TextureHandle(
wr::ImageBufferKind::TextureExternal);
// y
wr::ImageDescriptor descriptor0(mSizeY, gfx::SurfaceFormat::A8);

Просмотреть файл

@ -135,7 +135,7 @@ void DMABUFTextureHostOGL::PushResourceUpdates(
? &wr::TransactionBuilder::AddExternalImage
: &wr::TransactionBuilder::UpdateExternalImage;
auto imageType =
wr::ExternalImageType::TextureHandle(wr::TextureTarget::Default);
wr::ExternalImageType::TextureHandle(wr::ImageBufferKind::Texture2D);
switch (mSurface->GetFormat()) {
case gfx::SurfaceFormat::R8G8B8X8:

Просмотреть файл

@ -166,7 +166,7 @@ void MacIOSurfaceTextureHostOGL::PushResourceUpdates(
? &wr::TransactionBuilder::AddExternalImage
: &wr::TransactionBuilder::UpdateExternalImage;
auto imageType =
wr::ExternalImageType::TextureHandle(wr::TextureTarget::Rect);
wr::ExternalImageType::TextureHandle(wr::ImageBufferKind::TextureRect);
switch (GetFormat()) {
case gfx::SurfaceFormat::B8G8R8A8:

Просмотреть файл

@ -671,8 +671,8 @@ void SurfaceTextureHost::PushResourceUpdates(
auto method = aOp == TextureHost::ADD_IMAGE
? &wr::TransactionBuilder::AddExternalImage
: &wr::TransactionBuilder::UpdateExternalImage;
auto imageType =
wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
auto imageType = wr::ExternalImageType::TextureHandle(
wr::ImageBufferKind::TextureExternal);
switch (GetFormat()) {
case gfx::SurfaceFormat::R8G8B8X8:
@ -969,8 +969,8 @@ void AndroidHardwareBufferTextureHost::PushResourceUpdates(
auto method = aOp == TextureHost::ADD_IMAGE
? &wr::TransactionBuilder::AddExternalImage
: &wr::TransactionBuilder::UpdateExternalImage;
auto imageType =
wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
auto imageType = wr::ExternalImageType::TextureHandle(
wr::ImageBufferKind::TextureExternal);
switch (GetFormat()) {
case gfx::SurfaceFormat::R8G8B8X8:
@ -1181,8 +1181,8 @@ void EGLImageTextureHost::PushResourceUpdates(
auto method = aOp == TextureHost::ADD_IMAGE
? &wr::TransactionBuilder::AddExternalImage
: &wr::TransactionBuilder::UpdateExternalImage;
auto imageType =
wr::ExternalImageType::TextureHandle(wr::TextureTarget::External);
auto imageType = wr::ExternalImageType::TextureHandle(
wr::ImageBufferKind::TextureExternal);
gfx::SurfaceFormat format =
mHasAlpha ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::R8G8B8X8;

Просмотреть файл

@ -709,7 +709,7 @@ bool WebRenderBridgeParent::AddSharedExternalImage(
auto imageType =
mApi->GetBackendType() == WebRenderBackend::SOFTWARE
? wr::ExternalImageType::TextureHandle(wr::TextureTarget::Default)
? wr::ExternalImageType::TextureHandle(wr::ImageBufferKind::Texture2D)
: wr::ExternalImageType::Buffer();
wr::ImageDescriptor descriptor(dSurf->GetSize(), dSurf->Stride(),
dSurf->GetFormat());
@ -823,7 +823,7 @@ bool WebRenderBridgeParent::UpdateSharedExternalImage(
auto imageType =
mApi->GetBackendType() == WebRenderBackend::SOFTWARE
? wr::ExternalImageType::TextureHandle(wr::TextureTarget::Default)
? wr::ExternalImageType::TextureHandle(wr::ImageBufferKind::Texture2D)
: wr::ExternalImageType::Buffer();
wr::ImageDescriptor descriptor(dSurf->GetSize(), dSurf->Stride(),
dSurf->GetFormat());

Просмотреть файл

@ -97,14 +97,13 @@ pub fn lut_interp_linear16(mut input_value: u16, mut table: &[u16]) -> u16 {
}
/* same as above but takes an input_value from 0..PRECACHE_OUTPUT_MAX
* and returns a uint8_t value representing a range from 0..1 */
unsafe extern "C" fn lut_interp_linear_precache_output(
fn lut_interp_linear_precache_output(
mut input_value: u32,
mut table: *const u16,
mut length: i32,
mut table: &[u16]
) -> u8 {
/* Start scaling input_value to the length of the array: PRECACHE_OUTPUT_MAX*(length-1).
* We'll divide out the PRECACHE_OUTPUT_MAX next */
let mut value: u32 = input_value * (length - 1) as libc::c_uint;
let mut value: u32 = input_value * (table.len() - 1) as libc::c_uint;
/* equivalent to ceil(value/PRECACHE_OUTPUT_MAX) */
let mut upper: u32 =
(value + PRECACHE_OUTPUT_MAX as libc::c_uint - 1) / PRECACHE_OUTPUT_MAX as libc::c_uint;
@ -113,10 +112,9 @@ unsafe extern "C" fn lut_interp_linear_precache_output(
/* interp is the distance from upper to value scaled to 0..PRECACHE_OUTPUT_MAX */
let mut interp: u32 = value % PRECACHE_OUTPUT_MAX as libc::c_uint;
/* the table values range from 0..65535 */
value = *table.offset(upper as isize) as libc::c_uint * interp
+ *table.offset(lower as isize) as libc::c_uint
* (PRECACHE_OUTPUT_MAX as libc::c_uint - interp); // 0..(65535*PRECACHE_OUTPUT_MAX)
/* round and scale */
value = table[upper as usize] as libc::c_uint * interp
+ table[lower as usize] as libc::c_uint * (PRECACHE_OUTPUT_MAX as libc::c_uint - interp); // 0..(65535*PRECACHE_OUTPUT_MAX)
/* round and scale */
value = value + (PRECACHE_OUTPUT_MAX * 65535 / 255 / 2) as libc::c_uint; // scale to 0..255
value = value / (PRECACHE_OUTPUT_MAX * 65535 / 255) as libc::c_uint;
return value as u8;
@ -384,41 +382,34 @@ fn invert_lut(mut table: &[u16], mut out_length: i32) -> Vec<u16> {
}
return output;
}
unsafe extern "C" fn compute_precache_pow(mut output: *mut u8, mut gamma: f32) {
fn compute_precache_pow(output: &mut [u8; PRECACHE_OUTPUT_SIZE], mut gamma: f32) {
let mut v: u32 = 0;
while v < PRECACHE_OUTPUT_SIZE as u32 {
//XXX: don't do integer/float conversion... and round?
*output.offset(v as isize) =
output[v as usize] =
(255.0f64 * (v as f64 / PRECACHE_OUTPUT_MAX as f64).powf(gamma as f64)) as u8;
v = v + 1
}
}
#[no_mangle]
pub unsafe extern "C" fn compute_precache_lut(
mut output: *mut u8,
mut table: *mut u16,
mut length: i32,
pub fn compute_precache_lut(
mut output: &mut [u8; PRECACHE_OUTPUT_SIZE],
mut table: &[u16],
) {
let mut v: u32 = 0;
while v < PRECACHE_OUTPUT_SIZE as u32 {
*output.offset(v as isize) = lut_interp_linear_precache_output(v, table, length);
output[v as usize] = lut_interp_linear_precache_output(v, table);
v = v + 1
}
}
#[no_mangle]
pub unsafe extern "C" fn compute_precache_linear(mut output: *mut u8) {
pub fn compute_precache_linear(mut output: &mut[u8; PRECACHE_OUTPUT_SIZE]) {
let mut v: u32 = 0;
while v < PRECACHE_OUTPUT_SIZE as u32 {
//XXX: round?
*output.offset(v as isize) = (v / (PRECACHE_OUTPUT_SIZE / 256) as libc::c_uint) as u8;
output[v as usize] = (v / (PRECACHE_OUTPUT_SIZE / 256) as libc::c_uint) as u8;
v = v + 1
}
}
#[no_mangle]
pub unsafe extern "C" fn compute_precache(
mut trc: &curveType,
mut output: &mut [u8; PRECACHE_OUTPUT_SIZE],
) -> bool {
pub fn compute_precache(mut trc: &curveType, mut output: &mut [u8; PRECACHE_OUTPUT_SIZE]) -> bool {
match trc {
curveType::Parametric(params) => {
let mut gamma_table = Vec::with_capacity(256);
@ -439,14 +430,14 @@ pub unsafe extern "C" fn compute_precache(
inverted_size = 256
}
let mut inverted = invert_lut(&gamma_table_uint, inverted_size);
compute_precache_lut(output.as_mut_ptr(), inverted.as_mut_ptr(), inverted_size);
compute_precache_lut(output, &inverted);
}
curveType::Curve(data) => {
if data.len() == 0 {
compute_precache_linear(output.as_mut_ptr());
compute_precache_linear(output);
} else if data.len() == 1 {
compute_precache_pow(
output.as_mut_ptr(),
output,
(1.0f64 / u8Fixed8Number_to_float(data[0]) as f64) as f32,
);
} else {
@ -459,11 +450,7 @@ pub unsafe extern "C" fn compute_precache(
inverted_size_0 = 256
} //XXX turn this conversion into a function
let mut inverted_0 = invert_lut(data, inverted_size_0);
compute_precache_lut(
output.as_mut_ptr(),
inverted_0.as_mut_ptr(),
inverted_size_0,
);
compute_precache_lut(output, &inverted_0);
}
}
}

Просмотреть файл

@ -114,7 +114,7 @@ impl Example for App {
id: ExternalImageId(0),
channel_index: 0,
image_type: ExternalImageType::TextureHandle(
TextureTarget::Default,
ImageBufferKind::Texture2D,
),
}),
None,
@ -126,7 +126,7 @@ impl Example for App {
id: ExternalImageId(1),
channel_index: 0,
image_type: ExternalImageType::TextureHandle(
TextureTarget::Default,
ImageBufferKind::Texture2D,
),
}),
None,
@ -138,7 +138,7 @@ impl Example for App {
id: ExternalImageId(2),
channel_index: 0,
image_type: ExternalImageType::TextureHandle(
TextureTarget::Default,
ImageBufferKind::Texture2D,
),
}),
None,
@ -150,7 +150,7 @@ impl Example for App {
id: ExternalImageId(3),
channel_index: 0,
image_type: ExternalImageType::TextureHandle(
TextureTarget::Default,
ImageBufferKind::Texture2D,
),
}),
None,

Просмотреть файл

@ -9,7 +9,6 @@ varying vec2 vClipMaskImageUv;
flat varying vec4 vClipMaskUvRect;
flat varying vec4 vClipMaskUvInnerRect;
flat varying float vLayer;
#ifdef WR_VERTEX_SHADER
@ -52,7 +51,6 @@ void main(void) {
cmi.shared.device_pixel_scale
);
vLocalPos = vi.local_pos;
vLayer = res.layer;
vClipMaskImageUv = (vi.local_pos.xy - cmi.tile_rect.p0 * vi.local_pos.w) / cmi.tile_rect.size;
vec2 texture_size = vec2(textureSize(sColor0, 0));
@ -79,7 +77,7 @@ void main(void) {
vec2 source_uv = clamp(
clamped_mask_uv / vLocalPos.w * vClipMaskUvRect.zw + vClipMaskUvRect.xy,
vClipMaskUvInnerRect.xy, vClipMaskUvInnerRect.zw);
float clip_alpha = texture(sColor0, vec3(source_uv, vLayer)).r; //careful: texture has type A8
float clip_alpha = texture(sColor0, source_uv).r; //careful: texture has type A8
oFragColor = vec4(alpha * clip_alpha, 1.0, 1.0, 1.0);
}
#endif

Просмотреть файл

@ -11,7 +11,6 @@ flat varying vec4 v_uv_bounds;
// Interpolated UV coordinates to sample.
varying vec2 v_uv;
flat varying float v_layer;
#ifdef WR_FEATURE_GLYPH_TRANSFORM
@ -256,7 +255,6 @@ void main() {
vec2 st1 = res.uv_rect.zw / texture_size;
v_uv = mix(st0, st1, f);
v_layer = res.layer;
v_uv_bounds = (res.uv_rect + vec4(0.5, 0.5, -0.5, -0.5)) / texture_size.xyxy;
}
@ -267,7 +265,7 @@ void main() {
Fragment text_fs(void) {
Fragment frag;
vec3 tc = vec3(clamp(v_uv, v_uv_bounds.xy, v_uv_bounds.zw), v_layer);
vec2 tc = clamp(v_uv, v_uv_bounds.xy, v_uv_bounds.zw);
vec4 mask = texture(sColor0, tc);
mask.rgb = mask.rgb * v_mask_swizzle.x + mask.aaa * v_mask_swizzle.y;

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use api::{AlphaType, ClipMode, ExternalImageType, ImageRendering};
use api::{AlphaType, ClipMode, ExternalImageType, ImageRendering, ImageBufferKind};
use api::{FontInstanceFlags, YuvColorSpace, YuvFormat, ColorDepth, ColorRange, PremultipliedColorF};
use api::units::*;
use crate::clip::{ClipDataStore, ClipNodeFlags, ClipNodeRange, ClipItemKind, ClipStore};
@ -26,7 +26,7 @@ use crate::prim_store::image::ImageSource;
use crate::render_target::RenderTargetContext;
use crate::render_task_graph::{RenderTaskId, RenderTaskGraph};
use crate::render_task::RenderTaskAddress;
use crate::renderer::{BlendMode, ImageBufferKind, ShaderColorMode};
use crate::renderer::{BlendMode, ShaderColorMode};
use crate::renderer::{BLOCKS_PER_UV_RECT, MAX_VERTEX_TEXTURE_WIDTH};
use crate::resource_cache::{CacheItem, GlyphFetchResult, ImageProperties, ImageRequest, ResourceCache};
use crate::space::SpaceMapper;
@ -788,7 +788,6 @@ impl BatchBuilder {
batch_features: BatchFeatures,
ctx: &RenderTargetContext,
gpu_cache: &mut GpuCache,
render_tasks: &RenderTaskGraph,
prim_headers: &mut PrimitiveHeaders,
) {
let batch_params = BrushBatchParameters::shared(
@ -828,7 +827,6 @@ impl BatchBuilder {
prim_header_index,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_info.clip_task_index,
prim_vis_mask,
@ -914,7 +912,6 @@ impl BatchBuilder {
let clip_task_address = ctx.get_prim_clip_task_address(
prim_info.clip_task_index,
render_tasks,
);
if is_chased {
@ -992,6 +989,9 @@ impl BatchBuilder {
);
}
// TODO: it would be less error-prone to get this info from the texture cache.
let image_buffer_kind = ImageBufferKind::Texture2D;
let non_segmented_blend_mode = if !common_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
@ -1009,7 +1009,7 @@ impl BatchBuilder {
};
let batch_params = BrushBatchParameters::instanced(
BrushBatchKind::Image(ImageBufferKind::Texture2DArray),
BrushBatchKind::Image(image_buffer_kind),
ImageBrushData {
color_mode: ShaderColorMode::Image,
alpha_type: AlphaType::PremultipliedAlpha,
@ -1036,7 +1036,6 @@ impl BatchBuilder {
prim_header_index,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_info.clip_task_index,
prim_vis_mask,
@ -1388,7 +1387,6 @@ impl BatchBuilder {
// Get clip task, if set, for the picture primitive.
let child_clip_task_address = ctx.get_prim_clip_task_address(
child_prim_info.clip_task_index,
render_tasks,
);
let prim_header = PrimitiveHeader {
@ -1857,8 +1855,8 @@ impl BatchBuilder {
BlendMode::PremultipliedAlpha,
BatchTextures::no_texture(),
);
let backdrop_task_address = render_tasks.get_task_address(backdrop_id);
let source_task_address = render_tasks.get_task_address(cache_task_id);
let backdrop_task_address: RenderTaskAddress = backdrop_id.into();
let source_task_address: RenderTaskAddress = cache_task_id.into();
let prim_header_index = prim_headers.push(&prim_header, z_id, [
mode as u32 as i32,
backdrop_task_address.0 as i32,
@ -1948,7 +1946,6 @@ impl BatchBuilder {
prim_header_index,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_info.clip_task_index,
prim_vis_mask,
@ -2076,7 +2073,6 @@ impl BatchBuilder {
prim_header_index,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_info.clip_task_index,
prim_vis_mask,
@ -2134,7 +2130,6 @@ impl BatchBuilder {
prim_header_index,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_info.clip_task_index,
prim_vis_mask,
@ -2151,7 +2146,6 @@ impl BatchBuilder {
batch_features,
ctx,
gpu_cache,
render_tasks,
prim_headers);
return;
}
@ -2258,7 +2252,6 @@ impl BatchBuilder {
prim_header_index,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_info.clip_task_index,
prim_vis_mask,
@ -2275,7 +2268,6 @@ impl BatchBuilder {
batch_features,
ctx,
gpu_cache,
render_tasks,
prim_headers);
return;
}
@ -2379,7 +2371,6 @@ impl BatchBuilder {
prim_header_index,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_info.clip_task_index,
prim_vis_mask,
@ -2563,7 +2554,6 @@ impl BatchBuilder {
prim_header_index,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_info.clip_task_index,
prim_vis_mask,
@ -2644,7 +2634,6 @@ impl BatchBuilder {
prim_header_index,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_info.clip_task_index,
prim_vis_mask,
@ -2725,7 +2714,6 @@ impl BatchBuilder {
prim_header_index,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_info.clip_task_index,
prim_vis_mask,
@ -2824,7 +2812,6 @@ impl BatchBuilder {
features: BatchFeatures,
bounding_rect: &PictureRect,
transform_kind: TransformedRectKind,
render_tasks: &RenderTaskGraph,
z_id: ZBufferId,
prim_opacity: PrimitiveOpacity,
clip_task_index: ClipTaskIndex,
@ -2838,7 +2825,6 @@ impl BatchBuilder {
let clip_task_address = match ctx.get_clip_task_address(
clip_task_index,
segment_index,
render_tasks,
) {
Some(clip_task_address) => clip_task_address,
None => return,
@ -2883,7 +2869,6 @@ impl BatchBuilder {
prim_header_index: PrimitiveHeaderIndex,
bounding_rect: &PictureRect,
transform_kind: TransformedRectKind,
render_tasks: &RenderTaskGraph,
z_id: ZBufferId,
clip_task_index: ClipTaskIndex,
prim_vis_mask: PrimitiveVisibilityMask,
@ -2909,7 +2894,6 @@ impl BatchBuilder {
features,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_opacity,
clip_task_index,
@ -2935,7 +2919,6 @@ impl BatchBuilder {
features,
bounding_rect,
transform_kind,
render_tasks,
z_id,
prim_opacity,
clip_task_index,
@ -2954,7 +2937,6 @@ impl BatchBuilder {
};
let clip_task_address = ctx.get_prim_clip_task_address(
clip_task_index,
render_tasks,
).unwrap();
self.add_brush_instance_to_batches(
batch_key,
@ -3574,6 +3556,7 @@ pub fn get_buffer_kind(texture: TextureSource) -> ImageBufferKind {
}
}
}
TextureSource::TextureCache(..) => ImageBufferKind::Texture2D,
_ => ImageBufferKind::Texture2DArray,
}
}
@ -3587,11 +3570,10 @@ impl<'a, 'rc> RenderTargetContext<'a, 'rc> {
&self,
clip_task_index: ClipTaskIndex,
offset: i32,
render_tasks: &RenderTaskGraph,
) -> Option<RenderTaskAddress> {
let address = match self.scratch.clip_mask_instances[clip_task_index.0 as usize + offset as usize] {
ClipMaskKind::Mask(task_id) => {
render_tasks.get_task_address(task_id)
task_id.into()
}
ClipMaskKind::None => {
OPAQUE_TASK_ADDRESS
@ -3609,12 +3591,10 @@ impl<'a, 'rc> RenderTargetContext<'a, 'rc> {
fn get_prim_clip_task_address(
&self,
clip_task_index: ClipTaskIndex,
render_tasks: &RenderTaskGraph,
) -> Option<RenderTaskAddress> {
self.get_clip_task_address(
clip_task_index,
0,
render_tasks,
)
}
}

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use api::{ColorF, YuvColorSpace, YuvFormat, ImageRendering, ExternalImageId};
use api::{ColorF, YuvColorSpace, YuvFormat, ImageRendering, ExternalImageId, ImageBufferKind};
use api::units::*;
use crate::batch::{resolve_image, get_buffer_kind};
use euclid::Transform3D;
@ -11,7 +11,6 @@ use crate::gpu_types::{ZBufferId, ZBufferIdGenerator};
use crate::internal_types::TextureSource;
use crate::picture::{ImageDependency, ResolvedSurfaceTexture, TileCacheInstance, TileId, TileSurface};
use crate::prim_store::DeferredResolve;
use crate::renderer::ImageBufferKind;
use crate::resource_cache::{ImageRequest, ResourceCache};
use crate::util::Preallocator;
use crate::tile_cache::PictureCacheDebugInfo;

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use api::{ColorU, ColorF, ImageFormat, TextureTarget};
use api::{ColorU, ColorF, ImageFormat, ImageBufferKind};
use api::units::*;
use crate::debug_font_data;
use crate::device::{Device, Program, Texture, TextureSlot, VertexDescriptor, ShaderError, VAO};
@ -140,7 +140,7 @@ impl DebugRenderer {
let tri_vao = device.create_vao(&DESC_COLOR);
let font_texture = device.create_texture(
TextureTarget::Array,
ImageBufferKind::Texture2DArray,
ImageFormat::R8,
debug_font_data::BMP_WIDTH,
debug_font_data::BMP_HEIGHT,

Просмотреть файл

@ -4,7 +4,7 @@
use super::super::shader_source::{OPTIMIZED_SHADERS, UNOPTIMIZED_SHADERS};
use api::{ColorF, ImageDescriptor, ImageFormat};
use api::{MixBlendMode, TextureTarget, VoidPtrToSizeFn};
use api::{MixBlendMode, ImageBufferKind, VoidPtrToSizeFn};
use api::units::*;
use euclid::default::Transform3D;
use gleam::gl;
@ -150,12 +150,12 @@ fn depth_target_size_in_bytes(dimensions: &DeviceIntSize) -> usize {
(pixels as usize) * 4
}
pub fn get_gl_target(target: TextureTarget) -> gl::GLuint {
pub fn get_gl_target(target: ImageBufferKind) -> gl::GLuint {
match target {
TextureTarget::Default => gl::TEXTURE_2D,
TextureTarget::Array => gl::TEXTURE_2D_ARRAY,
TextureTarget::Rect => gl::TEXTURE_RECTANGLE,
TextureTarget::External => gl::TEXTURE_EXTERNAL_OES,
ImageBufferKind::Texture2D => gl::TEXTURE_2D,
ImageBufferKind::Texture2DArray => gl::TEXTURE_2D_ARRAY,
ImageBufferKind::TextureRect => gl::TEXTURE_RECTANGLE,
ImageBufferKind::TextureExternal => gl::TEXTURE_EXTERNAL_OES,
}
}
@ -383,7 +383,7 @@ pub struct ExternalTexture {
impl ExternalTexture {
pub fn new(
id: u32,
target: TextureTarget,
target: ImageBufferKind,
swizzle: Swizzle,
uv_rect: TexelRect,
) -> Self {
@ -2215,7 +2215,7 @@ impl Device {
pub fn create_texture(
&mut self,
target: TextureTarget,
target: ImageBufferKind,
format: ImageFormat,
mut width: i32,
mut height: i32,
@ -3087,7 +3087,7 @@ impl Device {
}
pub fn attach_read_texture_external(
&mut self, texture_id: gl::GLuint, target: TextureTarget, layer_id: i32
&mut self, texture_id: gl::GLuint, target: ImageBufferKind, layer_id: i32
) {
self.attach_read_texture_raw(texture_id, get_gl_target(target), layer_id)
}

Просмотреть файл

@ -878,7 +878,7 @@ pub fn build_render_pass(
ctx.break_advanced_blend_batches,
ctx.batch_lookback_count,
task_id,
render_tasks.get_task_address(task_id),
task_id.into(),
vis_mask,
0,
));

Просмотреть файл

@ -1153,7 +1153,7 @@ mod test_glyph_rasterizer {
let mut glyph_rasterizer = GlyphRasterizer::new(workers).unwrap();
let mut glyph_cache = GlyphCache::new();
let mut gpu_cache = GpuCache::new_for_testing();
let mut texture_cache = TextureCache::new_for_testing(2048, 1024, FORMAT);
let mut texture_cache = TextureCache::new_for_testing(2048, FORMAT);
let mut render_task_cache = RenderTaskCache::new();
let mut render_task_tree = RenderTaskGraph::new(FrameId::INVALID, &RenderTaskGraphCounters::new());
let mut font_file =
@ -1205,7 +1205,7 @@ mod test_glyph_rasterizer {
glyph_rasterizer.resolve_glyphs(
&mut glyph_cache,
&mut TextureCache::new_for_testing(4096, 1024, FORMAT),
&mut TextureCache::new_for_testing(4096, FORMAT),
&mut gpu_cache,
&mut render_task_cache,
&mut render_task_tree,

Просмотреть файл

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use api::{ColorF, DocumentId, ExternalImageData, ExternalImageId, PrimitiveFlags};
use api::{ImageFormat, NotificationRequest, Shadow, FilterOp};
use api::{ColorF, DocumentId, ExternalImageData, ExternalImageId, ExternalImageType, PrimitiveFlags};
use api::{ImageFormat, NotificationRequest, Shadow, FilterOp, ImageBufferKind};
use api::units::*;
use api;
use crate::render_api::DebugCommand;
@ -287,6 +287,31 @@ pub enum TextureSource {
Dummy,
}
impl TextureSource {
pub fn image_buffer_kind(&self) -> ImageBufferKind {
match *self {
TextureSource::TextureCache(..) => ImageBufferKind::Texture2D,
TextureSource::External(external_image) => {
match external_image.image_type {
ExternalImageType::TextureHandle(kind) => kind,
// Raw buffer external textures go to the texture cache.
ExternalImageType::Buffer => ImageBufferKind::Texture2D,
}
},
// Render tasks use texture arrays for now.
TextureSource::PrevPassAlpha
| TextureSource::PrevPassColor
| TextureSource::RenderTaskCache(..)
| TextureSource::Dummy => ImageBufferKind::Texture2DArray,
TextureSource::Invalid => ImageBufferKind::Texture2D,
}
}
}
#[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
@ -323,6 +348,7 @@ pub struct TextureCacheAllocInfo {
pub layer_count: i32,
pub format: ImageFormat,
pub filter: TextureFilter,
pub target: ImageBufferKind,
/// Indicates whether this corresponds to one of the shared texture caches.
pub is_shared_cache: bool,
/// If true, this texture requires a depth target.
@ -334,10 +360,6 @@ pub struct TextureCacheAllocInfo {
pub enum TextureCacheAllocationKind {
/// Performs an initial texture allocation.
Alloc(TextureCacheAllocInfo),
/// Reallocates the texture. The existing live texture with the same id
/// will be deallocated and its contents blitted over. The new size must
/// be greater than the old size.
Realloc(TextureCacheAllocInfo),
/// Reallocates the texture without preserving its contents.
Reset(TextureCacheAllocInfo),
/// Frees the texture and the corresponding cache ID.
@ -434,28 +456,6 @@ impl TextureUpdateList {
});
}
/// Pushes a reallocation operation onto the list, potentially coalescing
/// with previous operations.
pub fn push_realloc(&mut self, id: CacheTextureId, info: TextureCacheAllocInfo) {
self.debug_assert_coalesced(id);
// Coallesce this realloc into a previous alloc or realloc, if available.
if let Some(cur) = self.allocations.iter_mut().find(|x| x.id == id) {
match cur.kind {
TextureCacheAllocationKind::Alloc(ref mut i) => *i = info,
TextureCacheAllocationKind::Realloc(ref mut i) => *i = info,
TextureCacheAllocationKind::Reset(ref mut i) => *i = info,
TextureCacheAllocationKind::Free => panic!("Reallocating freed texture"),
}
return
}
self.allocations.push(TextureCacheAllocation {
id,
kind: TextureCacheAllocationKind::Realloc(info),
});
}
/// Pushes a reallocation operation onto the list, potentially coalescing
/// with previous operations.
pub fn push_reset(&mut self, id: CacheTextureId, info: TextureCacheAllocInfo) {
@ -470,10 +470,6 @@ impl TextureUpdateList {
TextureCacheAllocationKind::Alloc(ref mut i) => *i = info,
TextureCacheAllocationKind::Reset(ref mut i) => *i = info,
TextureCacheAllocationKind::Free => panic!("Resetting freed texture"),
TextureCacheAllocationKind::Realloc(_) => {
// Reset takes precedence over realloc
cur.kind = TextureCacheAllocationKind::Reset(info);
}
}
return
}
@ -499,7 +495,6 @@ impl TextureUpdateList {
match removed_kind {
Some(TextureCacheAllocationKind::Alloc(..)) => { /* no-op! */ },
Some(TextureCacheAllocationKind::Free) => panic!("Double free"),
Some(TextureCacheAllocationKind::Realloc(..)) |
Some(TextureCacheAllocationKind::Reset(..)) |
None => {
self.allocations.push(TextureCacheAllocation {

Просмотреть файл

@ -396,7 +396,7 @@ impl RenderTarget for ColorRenderTarget {
ctx.break_advanced_blend_batches,
ctx.batch_lookback_count,
*task_id,
render_tasks.get_task_address(*task_id),
(*task_id).into(),
PrimitiveVisibilityMask::all(),
prealloc_batch_count,
);
@ -459,16 +459,16 @@ impl RenderTarget for ColorRenderTarget {
add_blur_instances(
&mut self.vertical_blurs,
BlurDirection::Vertical,
render_tasks.get_task_address(task_id),
render_tasks.get_task_address(task.children[0]),
task_id.into(),
task.children[0].into(),
);
}
RenderTaskKind::HorizontalBlur(..) => {
add_blur_instances(
&mut self.horizontal_blurs,
BlurDirection::Horizontal,
render_tasks.get_task_address(task_id),
render_tasks.get_task_address(task.children[0]),
task_id.into(),
task.children[0].into(),
);
}
RenderTaskKind::Picture(..) => {
@ -646,16 +646,16 @@ impl RenderTarget for AlphaRenderTarget {
add_blur_instances(
&mut self.vertical_blurs,
BlurDirection::Vertical,
render_tasks.get_task_address(task_id),
render_tasks.get_task_address(task.children[0]),
task_id.into(),
task.children[0].into(),
);
}
RenderTaskKind::HorizontalBlur(..) => {
add_blur_instances(
&mut self.horizontal_blurs,
BlurDirection::Horizontal,
render_tasks.get_task_address(task_id),
render_tasks.get_task_address(task.children[0]),
task_id.into(),
task.children[0].into(),
);
}
RenderTaskKind::CacheMask(ref task_info) => {
@ -761,9 +761,9 @@ impl TextureCacheRenderTarget {
render_tasks: &mut RenderTaskGraph,
) {
profile_scope!("add_task");
let task_address = render_tasks.get_task_address(task_id);
let src_task_address = render_tasks[task_id].children.get(0).map(|src_task_id| {
render_tasks.get_task_address(*src_task_id)
let task_address = task_id.into();
let src_task_address = render_tasks[task_id].children.get(0).map(|&src_task_id| {
src_task_id.into()
});
let task = &mut render_tasks[task_id];
@ -1018,9 +1018,9 @@ fn add_svg_filter_instances(
};
let instance = SvgFilterInstance {
task_address: render_tasks.get_task_address(task_id),
input_1_task_address: input_1_task.map(|id| render_tasks.get_task_address(id)).unwrap_or(RenderTaskAddress(0)),
input_2_task_address: input_2_task.map(|id| render_tasks.get_task_address(id)).unwrap_or(RenderTaskAddress(0)),
task_address: task_id.into(),
input_1_task_address: input_1_task.map(|id| id.into()).unwrap_or(RenderTaskAddress(0)),
input_2_task_address: input_2_task.map(|id| id.into()).unwrap_or(RenderTaskAddress(0)),
kind,
input_count,
generic_int,

Просмотреть файл

@ -45,6 +45,12 @@ fn render_task_sanity_check(size: &DeviceIntSize) {
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub struct RenderTaskAddress(pub u16);
impl Into<RenderTaskAddress> for RenderTaskId {
fn into(self) -> RenderTaskAddress {
RenderTaskAddress(self.index as u16)
}
}
/// Identifies the output buffer location for a given `RenderTask`.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "capture", derive(Serialize))]

Просмотреть файл

@ -9,7 +9,7 @@ use crate::internal_types::{CacheTextureId, FastHashMap, SavedTargetIndex};
use crate::render_backend::FrameId;
use crate::render_target::{RenderTarget, RenderTargetKind, RenderTargetList, ColorRenderTarget};
use crate::render_target::{PictureCacheTarget, TextureCacheRenderTarget, AlphaRenderTarget};
use crate::render_task::{BlitSource, RenderTask, RenderTaskKind, RenderTaskAddress, RenderTaskData};
use crate::render_task::{BlitSource, RenderTask, RenderTaskKind, RenderTaskData};
use crate::render_task::{RenderTaskLocation};
use crate::util::{VecHelper, Allocation};
use std::{cmp, usize, f32, i32, u32};
@ -35,8 +35,6 @@ pub struct RenderTaskGraph {
/// render tasks.
pub struct RenderTaskAllocation<'a> {
alloc: Allocation<'a, RenderTask>,
#[cfg(debug_assertions)]
frame_id: FrameId,
}
impl<'l> RenderTaskAllocation<'l> {
@ -44,8 +42,6 @@ impl<'l> RenderTaskAllocation<'l> {
pub fn init(self, value: RenderTask) -> RenderTaskId {
RenderTaskId {
index: self.alloc.init(value) as u32,
#[cfg(debug_assertions)]
frame_id: self.frame_id,
}
}
}
@ -75,8 +71,6 @@ impl RenderTaskGraph {
pub fn add(&mut self) -> RenderTaskAllocation {
RenderTaskAllocation {
alloc: self.tasks.alloc(),
#[cfg(debug_assertions)]
frame_id: self.frame_id,
}
}
@ -214,8 +208,6 @@ impl RenderTaskGraph {
let pass_index = offset + (max_depth - task_max_depths[task_index]) as usize;
let task_id = RenderTaskId {
index: task_index as u32,
#[cfg(debug_assertions)]
frame_id: self.frame_id,
};
let task = &self.tasks[task_index];
passes[pass_index as usize].add_render_task(
@ -316,8 +308,6 @@ impl RenderTaskGraph {
let child_task_id = RenderTaskId {
index: child_task_index as u32,
#[cfg(debug_assertions)]
frame_id: self.frame_id,
};
let mut blit = RenderTask::new_blit(
@ -333,8 +323,6 @@ impl RenderTaskGraph {
let blit_id = RenderTaskId {
index: self.tasks.len() as u32,
#[cfg(debug_assertions)]
frame_id: self.frame_id,
};
self.tasks.alloc().init(blit);
@ -347,12 +335,6 @@ impl RenderTaskGraph {
}
}
pub fn get_task_address(&self, id: RenderTaskId) -> RenderTaskAddress {
#[cfg(all(debug_assertions, not(feature = "replay")))]
debug_assert_eq!(self.frame_id, id.frame_id);
RenderTaskAddress(id.index as u16)
}
pub fn write_task_data(&mut self) {
profile_scope!("write_task_data");
for task in &self.tasks {
@ -375,16 +357,12 @@ impl RenderTaskGraph {
impl std::ops::Index<RenderTaskId> for RenderTaskGraph {
type Output = RenderTask;
fn index(&self, id: RenderTaskId) -> &RenderTask {
#[cfg(all(debug_assertions, not(feature = "replay")))]
debug_assert_eq!(self.frame_id, id.frame_id);
&self.tasks[id.index as usize]
}
}
impl std::ops::IndexMut<RenderTaskId> for RenderTaskGraph {
fn index_mut(&mut self, id: RenderTaskId) -> &mut RenderTask {
#[cfg(all(debug_assertions, not(feature = "replay")))]
debug_assert_eq!(self.frame_id, id.frame_id);
&mut self.tasks[id.index as usize]
}
}
@ -394,10 +372,6 @@ impl std::ops::IndexMut<RenderTaskId> for RenderTaskGraph {
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub struct RenderTaskId {
pub index: u32,
#[cfg(debug_assertions)]
#[cfg_attr(feature = "replay", serde(default = "FrameId::first"))]
frame_id: FrameId,
}
#[derive(Debug)]
@ -420,8 +394,6 @@ impl RenderTaskGraphCounters {
impl RenderTaskId {
pub const INVALID: RenderTaskId = RenderTaskId {
index: u32::MAX,
#[cfg(debug_assertions)]
frame_id: FrameId::INVALID,
};
}

Просмотреть файл

@ -36,10 +36,10 @@
use api::{BlobImageHandler, ColorF, ColorU, MixBlendMode};
use api::{DocumentId, Epoch, ExternalImageHandler, ExternalImageId};
use api::{ExternalImageSource, ExternalImageType, ExternalImageType::TextureHandle, FontRenderMode, ImageFormat};
use api::{ExternalImageSource, ExternalImageType, FontRenderMode, ImageFormat};
use api::{PipelineId, ImageRendering, Checkpoint, NotificationRequest};
use api::{VoidPtrToSizeFn, PremultipliedColorF};
use api::{RenderNotifier, TextureTarget, SharedFontInstanceMap};
use api::{RenderNotifier, ImageBufferKind, SharedFontInstanceMap};
#[cfg(feature = "replay")]
use api::ExternalImage;
use api::units::*;
@ -1096,28 +1096,6 @@ pub struct GraphicsApiInfo {
pub version: String,
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub enum ImageBufferKind {
Texture2D = 0,
TextureRect = 1,
TextureExternal = 2,
Texture2DArray = 3,
}
//TODO: those types are the same, so let's merge them
impl From<TextureTarget> for ImageBufferKind {
fn from(target: TextureTarget) -> Self {
match target {
TextureTarget::Default => ImageBufferKind::Texture2D,
TextureTarget::Rect => ImageBufferKind::TextureRect,
TextureTarget::Array => ImageBufferKind::Texture2DArray,
TextureTarget::External => ImageBufferKind::TextureExternal,
}
}
}
#[derive(Debug)]
pub struct GpuProfile {
pub frame_id: GpuFrameId,
@ -1227,7 +1205,7 @@ impl TextureResolver {
fn new(device: &mut Device) -> TextureResolver {
let dummy_cache_texture = device
.create_texture(
TextureTarget::Array,
ImageBufferKind::Texture2DArray,
ImageFormat::RGBA8,
1,
1,
@ -1648,7 +1626,7 @@ impl GpuCacheTexture {
_ => Some(RenderTargetInfo { has_depth: false }),
};
let mut texture = device.create_texture(
TextureTarget::Default,
ImageBufferKind::Texture2D,
ImageFormat::RGBAF32,
new_size.width,
new_size.height,
@ -1938,7 +1916,7 @@ impl<T> VertexDataTexture<T> {
}
let texture = device.create_texture(
TextureTarget::Default,
ImageBufferKind::Texture2D,
self.format,
MAX_VERTEX_TEXTURE_WIDTH as i32,
// Ensure height is at least two to work around
@ -2453,7 +2431,6 @@ impl Renderer {
return Err(RendererError::MaxTextureSize);
}
let max_texture_size = device.max_texture_size();
let max_texture_layers = device.max_texture_layers();
device.begin_frame();
@ -2531,7 +2508,7 @@ impl Renderer {
];
let texture = device.create_texture(
TextureTarget::Default,
ImageBufferKind::Texture2D,
ImageFormat::R8,
8,
8,
@ -2770,7 +2747,6 @@ impl Renderer {
let texture_cache = TextureCache::new(
max_texture_size,
max_texture_layers,
picture_tile_size,
color_cache_formats,
swizzle_settings,
@ -3981,20 +3957,18 @@ impl Renderer {
for allocation in update_list.allocations {
match allocation.kind {
TextureCacheAllocationKind::Alloc(_) => add_event_marker(c_str!("TextureCacheAlloc")),
TextureCacheAllocationKind::Realloc(_) => add_event_marker(c_str!("TextureCacheRealloc")),
TextureCacheAllocationKind::Reset(_) => add_event_marker(c_str!("TextureCacheReset")),
TextureCacheAllocationKind::Free => add_event_marker(c_str!("TextureCacheFree")),
};
let old = match allocation.kind {
TextureCacheAllocationKind::Alloc(ref info) |
TextureCacheAllocationKind::Realloc(ref info) |
TextureCacheAllocationKind::Reset(ref info) => {
// Create a new native texture, as requested by the texture cache.
//
// Ensure no PBO is bound when creating the texture storage,
// or GL will attempt to read data from there.
let mut texture = self.device.create_texture(
TextureTarget::Array,
info.target,
info.format,
info.width,
info.height,
@ -4037,12 +4011,6 @@ impl Renderer {
TextureCacheAllocationKind::Alloc(_) => {
assert!(old.is_none(), "Renderer and backend disagree!");
}
TextureCacheAllocationKind::Realloc(_) => {
self.device.blit_renderable_texture(
self.texture_resolver.texture_cache_map.get_mut(&allocation.id).unwrap(),
old.as_ref().unwrap(),
);
}
TextureCacheAllocationKind::Reset(_) |
TextureCacheAllocationKind::Free => {
assert!(old.is_some(), "Renderer and backend disagree!");
@ -4162,7 +4130,7 @@ impl Renderer {
allocator.extend(new_slice, BATCH_UPLOAD_TEXTURE_SIZE, rect.size);
let staging_texture = device.create_texture(
TextureTarget::Default,
ImageBufferKind::Texture2D,
texture.get_format(),
BATCH_UPLOAD_TEXTURE_SIZE.width,
BATCH_UPLOAD_TEXTURE_SIZE.height,
@ -4513,22 +4481,7 @@ impl Renderer {
let _timer = self.gpu_profiler.start_timer(GPU_TAG_SCALE);
for (source, instances) in scalings {
let target = match *source {
TextureSource::External(external_image) => {
match external_image.image_type {
TextureHandle(texture_target) => {
texture_target
},
_ => {
TextureTarget::Array
}
}
},
_ => {
TextureTarget::Array
}
};
let buffer_kind = ImageBufferKind::from(target);
let buffer_kind = source.image_buffer_kind();
self.shaders
.borrow_mut()
@ -5124,7 +5077,7 @@ impl Renderer {
tile.z_id,
),
BatchTextures::color(TextureSource::Dummy),
(CompositeSurfaceFormat::Rgba, ImageBufferKind::Texture2DArray),
(CompositeSurfaceFormat::Rgba, ImageBufferKind::Texture2D),
)
}
CompositeTileSurface::Texture { surface: ResolvedSurfaceTexture::TextureCache { texture, layer } } => {
@ -6158,7 +6111,7 @@ impl Renderer {
} else {
self.profile.inc(profiler::CREATED_TARGETS);
self.device.create_texture(
TextureTarget::Array,
ImageBufferKind::Texture2DArray,
list.format,
dimensions.width,
dimensions.height,
@ -6802,7 +6755,7 @@ impl Renderer {
if self.zoom_debug_texture.is_none() {
let texture = self.device.create_texture(
TextureTarget::Default,
ImageBufferKind::Texture2D,
ImageFormat::BGRA8,
source_rect.size.width,
source_rect.size.height,
@ -7639,7 +7592,7 @@ impl Renderer {
#[cfg(feature = "replay")]
fn load_texture(
target: TextureTarget,
target: ImageBufferKind,
plain: &PlainTexture,
rt_info: Option<RenderTargetInfo>,
root: &PathBuf,
@ -7902,7 +7855,7 @@ impl Renderer {
for (id, texture) in renderer.textures {
info!("\t{}", texture.data);
let t = Self::load_texture(
TextureTarget::Array,
ImageBufferKind::Texture2DArray,
&texture,
Some(RenderTargetInfo { has_depth: texture.has_depth }),
&root,
@ -7916,7 +7869,7 @@ impl Renderer {
self.device.delete_texture(t);
}
let (t, gpu_cache_data) = Self::load_texture(
TextureTarget::Default,
ImageBufferKind::Texture2D,
&renderer.gpu_cache,
Some(RenderTargetInfo { has_depth: false }),
&root,

Просмотреть файл

@ -1808,7 +1808,6 @@ impl ResourceCache {
self.current_frame_id = FrameId::INVALID;
self.texture_cache = TextureCache::new(
self.texture_cache.max_texture_size(),
self.texture_cache.max_texture_layers(),
self.texture_cache.default_picture_tile_size(),
self.texture_cache.color_formats(),
self.texture_cache.swizzle_settings(),

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше