selenium_tor 1.5.4 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -5
  3. data/CHANGELOG.md +17 -0
  4. data/README.md +8 -10
  5. data/Rakefile +1 -2
  6. data/fonts/000_README.txt +1 -2
  7. data/fonts/Arimo-Bold.ttf +0 -0
  8. data/fonts/Arimo-BoldItalic.ttf +0 -0
  9. data/fonts/Arimo-Italic.ttf +0 -0
  10. data/fonts/Arimo-Regular.ttf +0 -0
  11. data/fonts/Cousine-Bold.ttf +0 -0
  12. data/fonts/Cousine-BoldItalic.ttf +0 -0
  13. data/fonts/Cousine-Italic.ttf +0 -0
  14. data/fonts/Cousine-Regular.ttf +0 -0
  15. data/fonts/NotoNaskhArabic-Regular.ttf +0 -0
  16. data/fonts/NotoSansAdlam-Regular.ttf +0 -0
  17. data/fonts/NotoSansArmenian-Regular.ttf +0 -0
  18. data/fonts/NotoSansBalinese-Regular.ttf +0 -0
  19. data/fonts/NotoSansBamum-Regular.ttf +0 -0
  20. data/fonts/NotoSansBassaVah-Regular.ttf +0 -0
  21. data/fonts/NotoSansBatak-Regular.ttf +0 -0
  22. data/fonts/NotoSansBengali-Regular.ttf +0 -0
  23. data/fonts/NotoSansBuginese-Regular.ttf +0 -0
  24. data/fonts/NotoSansBuhid-Regular.ttf +0 -0
  25. data/fonts/NotoSansCanadianAboriginal-Regular.ttf +0 -0
  26. data/fonts/NotoSansChakma-Regular.ttf +0 -0
  27. data/fonts/NotoSansCham-Regular.ttf +0 -0
  28. data/fonts/NotoSansCherokee-Regular.ttf +0 -0
  29. data/fonts/NotoSansCoptic-Regular.ttf +0 -0
  30. data/fonts/NotoSansDeseret-Regular.ttf +0 -0
  31. data/fonts/NotoSansDevanagari-Regular.ttf +0 -0
  32. data/fonts/NotoSansElbasan-Regular.ttf +0 -0
  33. data/fonts/NotoSansEthiopic-Regular.ttf +0 -0
  34. data/fonts/NotoSansGeorgian-Regular.ttf +0 -0
  35. data/fonts/NotoSansGrantha-Regular.ttf +0 -0
  36. data/fonts/NotoSansGujarati-Regular.ttf +0 -0
  37. data/fonts/NotoSansGunjalaGondi-Regular.ttf +0 -0
  38. data/fonts/NotoSansGurmukhi-Regular.ttf +0 -0
  39. data/fonts/NotoSansHanifiRohingya-Regular.ttf +0 -0
  40. data/fonts/NotoSansHanunoo-Regular.ttf +0 -0
  41. data/fonts/NotoSansHebrew-Regular.ttf +0 -0
  42. data/fonts/NotoSansJP-Regular.otf +0 -0
  43. data/fonts/NotoSansJavanese-Regular.ttf +0 -0
  44. data/fonts/NotoSansKR-Regular.otf +0 -0
  45. data/fonts/NotoSansKannada-Regular.ttf +0 -0
  46. data/fonts/NotoSansKayahLi-Regular.ttf +0 -0
  47. data/fonts/NotoSansKhmer-Regular.ttf +0 -0
  48. data/fonts/NotoSansKhojki-Regular.ttf +0 -0
  49. data/fonts/NotoSansKhudawadi-Regular.ttf +0 -0
  50. data/fonts/NotoSansLao-Regular.ttf +0 -0
  51. data/fonts/NotoSansLepcha-Regular.ttf +0 -0
  52. data/fonts/NotoSansLimbu-Regular.ttf +0 -0
  53. data/fonts/NotoSansLisu-Regular.ttf +0 -0
  54. data/fonts/NotoSansMahajani-Regular.ttf +0 -0
  55. data/fonts/NotoSansMalayalam-Regular.ttf +0 -0
  56. data/fonts/NotoSansMandaic-Regular.ttf +0 -0
  57. data/fonts/NotoSansMasaramGondi-Regular.ttf +0 -0
  58. data/fonts/NotoSansMedefaidrin-Regular.ttf +0 -0
  59. data/fonts/NotoSansMeeteiMayek-Regular.ttf +0 -0
  60. data/fonts/NotoSansMendeKikakui-Regular.ttf +0 -0
  61. data/fonts/NotoSansMiao-Regular.ttf +0 -0
  62. data/fonts/NotoSansModi-Regular.ttf +0 -0
  63. data/fonts/NotoSansMongolian-Regular.ttf +0 -0
  64. data/fonts/NotoSansMro-Regular.ttf +0 -0
  65. data/fonts/NotoSansMultani-Regular.ttf +0 -0
  66. data/fonts/NotoSansNKo-Regular.ttf +0 -0
  67. data/fonts/NotoSansNewTaiLue-Regular.ttf +0 -0
  68. data/fonts/NotoSansNewa-Regular.ttf +0 -0
  69. data/fonts/NotoSansOlChiki-Regular.ttf +0 -0
  70. data/fonts/NotoSansOriya-Regular.ttf +0 -0
  71. data/fonts/NotoSansOsage-Regular.ttf +0 -0
  72. data/fonts/NotoSansOsmanya-Regular.ttf +0 -0
  73. data/fonts/NotoSansPahawhHmong-Regular.ttf +0 -0
  74. data/fonts/NotoSansPauCinHau-Regular.ttf +0 -0
  75. data/fonts/NotoSansRejang-Regular.ttf +0 -0
  76. data/fonts/NotoSansRunic-Regular.ttf +0 -0
  77. data/fonts/NotoSansSC-Regular.otf +0 -0
  78. data/fonts/NotoSansSamaritan-Regular.ttf +0 -0
  79. data/fonts/NotoSansSaurashtra-Regular.ttf +0 -0
  80. data/fonts/NotoSansSharada-Regular.ttf +0 -0
  81. data/fonts/NotoSansShavian-Regular.ttf +0 -0
  82. data/fonts/NotoSansSinhala-Regular.ttf +0 -0
  83. data/fonts/NotoSansSoraSompeng-Regular.ttf +0 -0
  84. data/fonts/NotoSansSoyombo-Regular.ttf +0 -0
  85. data/fonts/NotoSansSundanese-Regular.ttf +0 -0
  86. data/fonts/NotoSansSylotiNagri-Regular.ttf +0 -0
  87. data/fonts/NotoSansSymbols-Regular.ttf +0 -0
  88. data/fonts/NotoSansSymbols2-Regular.ttf +0 -0
  89. data/fonts/NotoSansSyriac-Regular.ttf +0 -0
  90. data/fonts/NotoSansTC-Regular.otf +0 -0
  91. data/fonts/NotoSansTagalog-Regular.ttf +0 -0
  92. data/fonts/NotoSansTagbanwa-Regular.ttf +0 -0
  93. data/fonts/NotoSansTaiLe-Regular.ttf +0 -0
  94. data/fonts/NotoSansTaiTham-Regular.ttf +0 -0
  95. data/fonts/NotoSansTaiViet-Regular.ttf +0 -0
  96. data/fonts/NotoSansTakri-Regular.ttf +0 -0
  97. data/fonts/NotoSansTamil-Regular.ttf +0 -0
  98. data/fonts/NotoSansTelugu-Regular.ttf +0 -0
  99. data/fonts/NotoSansThaana-Regular.ttf +0 -0
  100. data/fonts/NotoSansThai-Regular.ttf +0 -0
  101. data/fonts/NotoSansTifinagh-Regular.ttf +0 -0
  102. data/fonts/NotoSansTifinaghAPT-Regular.ttf +0 -0
  103. data/fonts/NotoSansTifinaghAdrar-Regular.ttf +0 -0
  104. data/fonts/NotoSansTifinaghAgrawImazighen-Regular.ttf +0 -0
  105. data/fonts/NotoSansTifinaghAhaggar-Regular.ttf +0 -0
  106. data/fonts/NotoSansTifinaghAir-Regular.ttf +0 -0
  107. data/fonts/NotoSansTifinaghAzawagh-Regular.ttf +0 -0
  108. data/fonts/NotoSansTifinaghGhat-Regular.ttf +0 -0
  109. data/fonts/NotoSansTifinaghHawad-Regular.ttf +0 -0
  110. data/fonts/NotoSansTifinaghRhissaIxa-Regular.ttf +0 -0
  111. data/fonts/NotoSansTifinaghSIL-Regular.ttf +0 -0
  112. data/fonts/NotoSansTifinaghTawellemmet-Regular.ttf +0 -0
  113. data/fonts/NotoSansTirhuta-Regular.ttf +0 -0
  114. data/fonts/NotoSansVai-Regular.ttf +0 -0
  115. data/fonts/NotoSansWancho-Regular.ttf +0 -0
  116. data/fonts/NotoSansWarangCiti-Regular.ttf +0 -0
  117. data/fonts/NotoSansYi-Regular.ttf +0 -0
  118. data/fonts/NotoSansZanabazarSquare-Regular.ttf +0 -0
  119. data/fonts/NotoSerifArmenian-Regular.ttf +0 -0
  120. data/fonts/NotoSerifBalinese-Regular.ttf +0 -0
  121. data/fonts/NotoSerifBengali-Regular.ttf +0 -0
  122. data/fonts/NotoSerifDevanagari-Regular.ttf +0 -0
  123. data/fonts/NotoSerifDogra-Regular.ttf +0 -0
  124. data/fonts/NotoSerifEthiopic-Regular.ttf +0 -0
  125. data/fonts/NotoSerifGeorgian-Regular.ttf +0 -0
  126. data/fonts/NotoSerifGrantha-Regular.ttf +0 -0
  127. data/fonts/NotoSerifGujarati-Regular.ttf +0 -0
  128. data/fonts/NotoSerifGurmukhi-Regular.ttf +0 -0
  129. data/fonts/NotoSerifHebrew-Regular.ttf +0 -0
  130. data/fonts/NotoSerifKannada-Regular.ttf +0 -0
  131. data/fonts/NotoSerifKhmer-Regular.ttf +0 -0
  132. data/fonts/NotoSerifKhojki-Regular.ttf +0 -0
  133. data/fonts/NotoSerifLao-Regular.ttf +0 -0
  134. data/fonts/NotoSerifMalayalam-Regular.ttf +0 -0
  135. data/fonts/NotoSerifMyanmar-Regular.ttf +0 -0
  136. data/fonts/NotoSerifNPHmong-Regular.ttf +0 -0
  137. data/fonts/NotoSerifSinhala-Regular.ttf +0 -0
  138. data/fonts/NotoSerifTamil-Regular.ttf +0 -0
  139. data/fonts/NotoSerifTelugu-Regular.ttf +0 -0
  140. data/fonts/NotoSerifThai-Regular.ttf +0 -0
  141. data/fonts/NotoSerifTibetan-Regular.ttf +0 -0
  142. data/fonts/NotoSerifYezidi-Regular.ttf +0 -0
  143. data/fonts/Pyidaungsu-2.5.3_Regular.ttf +0 -0
  144. data/fonts/STIXTwoMath-Regular.otf +0 -0
  145. data/fonts/Tinos-Bold.ttf +0 -0
  146. data/fonts/Tinos-BoldItalic.ttf +0 -0
  147. data/fonts/Tinos-Italic.ttf +0 -0
  148. data/fonts/Tinos-Regular.ttf +0 -0
  149. data/fonts/TwemojiMozilla.ttf +0 -0
  150. data/fonts/fonts.conf +183 -0
  151. data/lib/tor/driver.rb +1 -8
  152. data/lib/tor/libxul_checksums.yml +79 -0
  153. data/lib/tor/libxul_patchable.rb +22 -5
  154. data/lib/tor/options.rb +0 -9
  155. data/lib/tor/tor_prefs.rb +1 -1
  156. data/lib/tor/tor_process.rb +39 -10
  157. data/lib/tor/version.rb +1 -1
  158. metadata +151 -7
data/fonts/fonts.conf ADDED
@@ -0,0 +1,183 @@
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
3
+ <!--
4
+ **DO NOT EDIT THIS FILE!**
5
+ This file sets Tor Browser's bundled fonts as the only available system fonts
6
+ and standardizes rendering settings.
7
+ Any changes might deanonymize you, or expose you to fingerprinting vectors.
8
+ -->
9
+ <!--
10
+ Derived from fonts.conf.in of Fontconfig.
11
+
12
+ Copyright © 2000,2001,2002,2003,2004,2006,2007 Keith Packard
13
+ Copyright © 2005 Patrick Lam
14
+ Copyright © 2009 Roozbeh Pournader
15
+ Copyright © 2008,2009 Red Hat, Inc.
16
+ Copyright © 2008 Danilo Šegan
17
+ Copyright © 2012 Google, Inc.
18
+
19
+
20
+ Permission to use, copy, modify, distribute, and sell this software and its
21
+ documentation for any purpose is hereby granted without fee, provided that
22
+ the above copyright notice appear in all copies and that both that
23
+ copyright notice and this permission notice appear in supporting
24
+ documentation, and that the name of the author(s) not be used in
25
+ advertising or publicity pertaining to distribution of the software without
26
+ specific, written prior permission. The authors make no
27
+ representations about the suitability of this software for any purpose. It
28
+ is provided "as is" without express or implied warranty.
29
+
30
+ THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
31
+ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
32
+ EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
33
+ CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
34
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
35
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
36
+ PERFORMANCE OF THIS SOFTWARE.
37
+ -->
38
+ <fontconfig>
39
+
40
+ <!-- Font directory list -->
41
+
42
+ <dir prefix="cwd">fonts</dir>
43
+
44
+ <!--
45
+ Accept deprecated 'mono' alias, replacing it with 'monospace'
46
+ -->
47
+ <match target="pattern">
48
+ <test qual="any" name="family">
49
+ <string>mono</string>
50
+ </test>
51
+ <edit name="family" mode="assign" binding="same">
52
+ <string>monospace</string>
53
+ </edit>
54
+ </match>
55
+
56
+ <!--
57
+ Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
58
+ -->
59
+ <match target="pattern">
60
+ <test qual="any" name="family">
61
+ <string>sans serif</string>
62
+ </test>
63
+ <edit name="family" mode="assign" binding="same">
64
+ <string>sans-serif</string>
65
+ </edit>
66
+ </match>
67
+
68
+ <!--
69
+ Accept deprecated 'sans' alias, replacing it with 'sans-serif'
70
+ -->
71
+ <match target="pattern">
72
+ <test qual="any" name="family">
73
+ <string>sans</string>
74
+ </test>
75
+ <edit name="family" mode="assign" binding="same">
76
+ <string>sans-serif</string>
77
+ </edit>
78
+ </match>
79
+
80
+ <!--
81
+ Set our default generic families.
82
+ -->
83
+ <match target="pattern">
84
+ <test qual="any" name="family">
85
+ <string>sans-serif</string>
86
+ </test>
87
+ <edit name="family" mode="assign" binding="same">
88
+ <string>Arimo</string>
89
+ </edit>
90
+ </match>
91
+ <match target="pattern">
92
+ <test qual="any" name="family">
93
+ <string>serif</string>
94
+ </test>
95
+ <edit name="family" mode="assign" binding="same">
96
+ <string>Tinos</string>
97
+ </edit>
98
+ </match>
99
+ <match target="pattern">
100
+ <test qual="any" name="family">
101
+ <string>monospace</string>
102
+ </test>
103
+ <edit name="family" mode="assign" binding="same">
104
+ <string>Cousine</string>
105
+ </edit>
106
+ </match>
107
+
108
+ <!--
109
+ tor-browser#41799, tor-browser-build#41237: Add some aliases for
110
+ compatibility.
111
+ -->
112
+ <match target="pattern">
113
+ <test qual="any" name="family">
114
+ <string>Arial</string>
115
+ </test>
116
+ <edit name="family" mode="assign" binding="same">
117
+ <string>Arimo</string>
118
+ </edit>
119
+ </match>
120
+ <match target="pattern">
121
+ <test qual="any" name="family">
122
+ <string>Times New Roman</string>
123
+ </test>
124
+ <edit name="family" mode="assign" binding="same">
125
+ <string>Tinos</string>
126
+ </edit>
127
+ </match>
128
+ <match target="pattern">
129
+ <test qual="any" name="family">
130
+ <string>Courier New</string>
131
+ </test>
132
+ <edit name="family" mode="assign" binding="same">
133
+ <string>Cousine</string>
134
+ </edit>
135
+ </match>
136
+ <match target="pattern">
137
+ <test qual="any" name="family">
138
+ <string>Helvetica</string>
139
+ </test>
140
+ <edit name="family" mode="assign" binding="same">
141
+ <string>Arimo</string>
142
+ </edit>
143
+ </match>
144
+ <match target="pattern">
145
+ <test qual="any" name="family">
146
+ <string>Times</string>
147
+ </test>
148
+ <edit name="family" mode="assign" binding="same">
149
+ <string>Tinos</string>
150
+ </edit>
151
+ </match>
152
+ <match target="pattern">
153
+ <test qual="any" name="family">
154
+ <string>Courier</string>
155
+ </test>
156
+ <edit name="family" mode="assign" binding="same">
157
+ <string>Cousine</string>
158
+ </edit>
159
+ </match>
160
+
161
+ <!-- Font cache directory list -->
162
+
163
+ <cachedir prefix="xdg">fontconfig</cachedir>
164
+
165
+ <config>
166
+ <!--
167
+ Rescan configuration every 30 seconds when FcFontSetList is called
168
+ -->
169
+ <rescan>
170
+ <int>30</int>
171
+ </rescan>
172
+ </config>
173
+
174
+ <!-- Standardize rendering settings. -->
175
+ <match target="pattern">
176
+ <edit name="antialias" mode="assign"><bool>true</bool></edit>
177
+ <edit name="autohint" mode="assign"><bool>false</bool></edit>
178
+ <edit name="hinting" mode="assign"><bool>true</bool></edit>
179
+ <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
180
+ <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
181
+ <edit name="rgba" mode="assign"><const>none</const></edit>
182
+ </match>
183
+ </fontconfig>
data/lib/tor/driver.rb CHANGED
@@ -29,8 +29,7 @@ module Selenium
29
29
  @data_dir = Dir.mktmpdir
30
30
  @options = options || Options.new # fix for issue #11, 'tis a puzzlement
31
31
  add_torrc_path_to_options
32
- # @instance = DriverDelegate.new(options: @options, **)
33
- @instance = DriverDelegate.new(options: @options, **, service: service)
32
+ @instance = DriverDelegate.new(options: @options, **)
34
33
  install_extensions @instance
35
34
  create_tor_process_and_start_tor @options.tor_opts
36
35
  super(@instance)
@@ -88,12 +87,6 @@ module Selenium
88
87
  def domain
89
88
  URI(current_url).host&.match(/[^\.]+\.\w+$/)
90
89
  end
91
-
92
- def service
93
- service = Service.tor
94
- service.args << '--enable-crash-reporter' # BUG: 18, https://github.com/mozilla/geckodriver/issues/2202
95
- service
96
- end
97
90
  end
98
91
  end
99
92
  end
@@ -1,4 +1,83 @@
1
1
  ---
2
+ 14.5.2:
3
+ unpatched_libxul: 0e4d960cb427df67a25ab50aa934272e7ac7ee3487c709e48d97e2611e2ae930
4
+ patched_libxul: 20579db140991d77db1a3ffa3e248752dd689bf4156056402cbe1fd6287430c1
5
+ patch_checksum: d6db59104c809ee3c9232e093e85b34abc02069ccf63beb2102f371492fcd42d
6
+ 14.5.1:
7
+ unpatched_libxul: d3fb74cad36cb0b944b6db87d9377e81b54b0ba1dc9ffecef3ffbf95ab5f6c56
8
+ patched_libxul: 0092fe0b27e0bc4be47b1f925509064494effea370023bc91e39f254dc52d341
9
+ patch_checksum: 3746698dfe5ed5d0f56d28fa9655aff2c908252bed51f584e4822d8581e6a24f
10
+ !!str 14.5:
11
+ unpatched_libxul: 8518f1b2b6b76b2d17fd32189b16e25898a4ae3bf6981613feecdec290363232
12
+ patched_libxul: f58a11c36cc91fefab1cf92de822d70b0f3d17e38b32c4fa37ba8287529b40c3
13
+ patch_checksum: 852b152872338a3d0c097607f7f2aa0b41729136bfe661bcc8427dc61789c630
14
+ 14.5a6:
15
+ unpatched_libxul: 7cdfdf7fa84ea5a31607595114d33d77d27eb1fea814835735c0bc0f6484a5b7
16
+ patched_libxul: 622f8635cf4cc82cc8c4c2db03bae44123d79c50ee910795b1f1dbe4351c9ca3
17
+ patch_checksum: 44682be0e6b8d885f769fc30daa4f2fdbe64367935f5f88ef6ded29a397101c5
18
+ 14.5a5:
19
+ unpatched_libxul: d96ab04398a1d2636be475ecc3cca747a496213c78d778304d2953b48342af3e
20
+ patched_libxul: 5c3e72fc6d477735013d7079828aa99cc47c662c58a7ab48fec600f159987c38
21
+ patch_checksum: 31aeb887eadaff88c19bcd989f6e2530f2ac931a4169e314853116ff568e0250
22
+ 14.5a4:
23
+ unpatched_libxul: 86b62b1794005a400fd204d130ae0dbd7e69db67e66d0db9cc374aee5a0eafdb
24
+ patched_libxul: 38a7ffff8cb094b7987b413ed5406699b2b137cee5d260f0da7d9b9289a36818
25
+ patch_checksum: e018a62d07829f4bdfc8ebf6ff2555b6705ea938c5cfdb3667b05fd118e25efe
26
+ 14.5a3:
27
+ unpatched_libxul: 2c865e239e20aeb785c830a922aa197cbd87337669b05ea0c0d43dc4b101efe7
28
+ patched_libxul: c9a0a33e747268269e269e2a01618e3f8db0c11d080a3867014e11b08b5d2be5
29
+ patch_checksum: 7977048cde11319a9e5a337ace40abc30e63e7be7808b438105cd90b2397beaf
30
+ 14.5a2:
31
+ unpatched_libxul: 764f91909cac9c90208aaa70001a52cba43ec02d8b0dab69809e542f39a3c0a2
32
+ patched_libxul: 3fc4c32bde0bd9f1e1ac2d22a936d9912db0cf5f5510227906dca8abb3d4648b
33
+ patch_checksum: 24cdd9a7755093222faff66fa79bc9c7580503c760d2fae6e0835e3c33b0dade
34
+ 14.5a1:
35
+ unpatched_libxul: 4586056dfd6584effa61f974e802b5b2103965326716423c2f76043e68571149
36
+ patched_libxul: b4463dffe43a112e509764c5e32b100bc2749112dc852244ed8817b72e631642
37
+ patch_checksum: a0397d3e9a86339c497bcedf3b8c4bed767284e9299e791e54266d42c2872b7d
38
+ 14.0.9:
39
+ unpatched_libxul: b52659cb3a202ef69acd8ba37360467daf17d7b90afdf1419f7dbefb872979cc
40
+ patched_libxul: af9c6c3822664f2084b404d9fd34d2e6a2d3f7d2d71f25cf9dde9e97018302fa
41
+ patch_checksum: 88188dfbd38bd84fa5bd5f82634fc009543ea3e16ba756ea02ffb11dd7875de6
42
+ 14.0.7:
43
+ unpatched_libxul: 649f05fd66e6e84fbde94907571d5bc34b59f06974cb2ebb60d1847c3c0eb1cc
44
+ patched_libxul: 15d8aaf658bc08b0990525ca4b45539a43e8249541f102bb19cb9050420b6047
45
+ patch_checksum: b30c3a09eb0a77c23f3c691c8c1a369ca8b1fefd209391e93a077779e60298a1
46
+ 14.0.6:
47
+ unpatched_libxul: a421a0cd73815c323ab6c2c5c676e5177425ae65830290a147ec6efbd5e25388
48
+ patched_libxul: e7a21cef56b25bc4b1364f953505cf8f74147fc5b48c73d204c17ab10696dae0
49
+ patch_checksum: 2a9d08a8d21f7ab07df7d2d4ba24c0cbde9b05cebb3f38bfa5953e22c06482c9
50
+ 14.0.5:
51
+ unpatched_libxul: 77d68b6ab27058addd192ba1cb23afb16eccc6bee3d96e1f2f72e1f80c6a09e6
52
+ patched_libxul: a5786dc865dc673f3290d55d3da324e0209f427678544f5c37e667755b2437ec
53
+ patch_checksum: be36849ddf1fe51922a3c192d2e97232d93ad62e1bfb2f00e98e2dcbc26a06e3
54
+ 14.0.4:
55
+ unpatched_libxul: 994b21b5417e704be58107cc6308de6e1c922f0cf60b9df2aac0e4f0090f373f
56
+ patched_libxul: ae03c3e7217b85c0f28b4d971b695f0d042723447c84a8676a372f32e7b76252
57
+ patch_checksum: d9f32d00ff1050774f1a90d3055f69ebac113261c082fab621244547c6ef41f5
58
+ 14.0.3:
59
+ unpatched_libxul: 2ddc3df2e8feb52c3bcd638249aac7d584d9c65888d67e18ad5fecceb4d5010a
60
+ patched_libxul: 9864cdfd750e504f06bd9eeca427f0a20d83d0bb5cd8e8232ae4a3ee4b2812b1
61
+ patch_checksum: 5deece766f5922c77ca4e60f194c0bdfa0374f6c80e190cdf60dd10f49d3b5e8
62
+ 14.0.2:
63
+ unpatched_libxul: 590a02a751951452b0f3eded2234b6c1ffc49ce794301192450a236db5ad11af
64
+ patched_libxul: 6a49949e01ea35f61ba0e08c05d66ec6b9591d7b148314b99a9d2e7b8334c3f4
65
+ patch_checksum: 8f3ab90326a7b995eebfd83018dc83b257f5699a72d3cd9754706df973a66852
66
+ 14.0.1:
67
+ unpatched_libxul: 02751a5f1c3390c8d8b1b062147713d9a5412797139d3a86217df3380b44a390
68
+ patched_libxul: 6df072f5e9f86bcd244b5dab416074754214b85f9735bc05f8d322bf136652ef
69
+ patch_checksum: 844e29b6131fa6d7282a0052aa81000c5decdd410da509f56e0cf9b8c24d6ca9
70
+ !!str 14.0:
71
+ unpatched_libxul: 0a9c57aa19a953af56b49e944bfb950b7ba47d12fa927bb76c5ff04b8cdcf063
72
+ patched_libxul: 3b163b5c035376883fd49eac7fa5d90bfa536d26038ee4e36508226111936cce
73
+ patch_checksum: 2821841ff51fb511731810622fecb9c132e0774f5883dc500f67869c59a81509
74
+ #######################
75
+ # NO LONGER SUPPORTED #
76
+ #######################
77
+ 14.0a9:
78
+ unpatched_libxul: af9228a9b026fb4dad1d611070421346d8f4f714f00d909bbc2bda04e4175ff4
79
+ patched_libxul: 7e1e5e733c8c258a92170b45d0bbcafc14beea628290cacbc013affda3082193
80
+ patch_checksum: cb3fef972d41f81a212b95b1b47b8b0fcb03e58271cde4bbaf6d4fe3f7ffc318
2
81
  14.0a8:
3
82
  unpatched_libxul: 3ce2cef75c68f52df50cc435c9307bae8596ecbbf53d067e0731506096fb36cd
4
83
  patched_libxul: 789bb47f02d7f5c87cae05409ea31a2cf1d222f6716c2dd81fc333f221bf8c16
@@ -14,9 +14,10 @@ module Selenium
14
14
  module LibxulPatchable
15
15
  class LibxulPatchableError < StandardError; end
16
16
 
17
- LIBXUL_CHECKSUMS = YAML.load_file(File.join(__dir__, 'libxul_checksums.yml'))[Tor::TBB_VERSION]
18
17
  PATCH_REPO = 'https://gitlab.com/matzfan/keymaster/-/raw/master/patches/tor-browser'
19
18
  ISSUES_URL = 'https://gitlab.com/matzfan/keymaster/-/issues'
19
+ NO_PATCH_MSG = "No patch for #{Tor::TBB_VERSION}, please raise an issue at #{ISSUES_URL}".freeze
20
+ UNDEF_REGEXP = /undefined method (`|')\[\]' for nil/
20
21
 
21
22
  def libxul_patched?
22
23
  libxul_checksum = checksum_for Tor::TBB_LIBXUL
@@ -35,7 +36,7 @@ module Selenium
35
36
  execute_patch patchfile
36
37
  FileUtils.cp libxul_patched, Tor::TBB_LIBXUL
37
38
  rescue OpenURI::HTTPError
38
- raise LibxulPatchableError, "No patch for #{Tor::TBB_VERSION}, please raise an issue at #{ISSUES_URL}"
39
+ raise LibxulPatchableError, NO_PATCH_MSG
39
40
  end
40
41
 
41
42
  def unpatch_libxul
@@ -63,16 +64,32 @@ module Selenium
63
64
  Bsdiff.patch libxul_original, libxul_patched, patchfile
64
65
  end
65
66
 
67
+ def libxul_checksums
68
+ @libxul_checksums ||= YAML.load_file(File.join(__dir__, 'libxul_checksums.yml'))[Tor::TBB_VERSION]
69
+ end
70
+
66
71
  def unpatched_libxul_checksum_for_version
67
- LIBXUL_CHECKSUMS['unpatched_libxul']
72
+ libxul_checksums['unpatched_libxul']
73
+ rescue NoMethodError => e
74
+ raise LibxulPatchableError, NO_PATCH_MSG if e.message.match UNDEF_REGEXP
75
+
76
+ raise e
68
77
  end
69
78
 
70
79
  def patched_libxul_checksum_for_version
71
- LIBXUL_CHECKSUMS['patched_libxul']
80
+ libxul_checksums['patched_libxul']
81
+ rescue NoMethodError => e
82
+ raise LibxulPatchableError, NO_PATCH_MSG if e.message.match UNDEF_REGEXP
83
+
84
+ raise e
72
85
  end
73
86
 
74
87
  def patch_checksum_for_version
75
- LIBXUL_CHECKSUMS['patch_checksum']
88
+ libxul_checksums['patch_checksum']
89
+ rescue NoMethodError => e
90
+ raise LibxulPatchableError, NO_PATCH_MSG if e.message.match UNDEF_REGEXP
91
+
92
+ raise e
76
93
  end
77
94
 
78
95
  def checksum_for(file)
data/lib/tor/options.rb CHANGED
@@ -29,7 +29,6 @@ module Selenium
29
29
  opts[:tor_opts] = opts.delete(:system_tor).opts if opts[:system_tor] # DEPRECATED 2.0
30
30
  @tor_opts = opts[:tor_opts] ? opts.delete(:tor_opts) : {} # must be deleted before call to super
31
31
  do_start_tor_browser_script_stuff # stuff the start-tor-browser script in TBB does
32
- copy_fonts # so we don't have to change dir before executing TB binary - issues #2 and #9
33
32
  super(log_level: log_level, **tor_options(opts.delete(:prefs)).merge(opts))
34
33
  end
35
34
 
@@ -42,17 +41,9 @@ module Selenium
42
41
  def do_start_tor_browser_script_stuff
43
42
  ENV['SESSION_MANAGER'] = nil
44
43
  ENV['XAUTHORITY'] = File.join(Dir.home, '.Xauthority') unless ENV.fetch('XAUTHORITY', nil)
45
- ENV['FONTCONFIG_PATH'] = File.join TBB_BROWSER_DIR, 'fontconfig'
46
- ENV['FONTCONFIG_FILE'] = 'fonts.conf'
47
44
  FileUtils.rm_rf File.join(Tor::TBB_BROWSER_DIR, *%w[TorBrowser Data fontconfig])
48
45
  ENV['GSETTINGS_BACKEND'] = 'memory'
49
46
  end
50
-
51
- def copy_fonts
52
- return unless Dir[File.join('fonts', '*')].size == 1 # README checked into git
53
-
54
- FileUtils.cp(Dir[File.join(Tor::TBB_BROWSER_DIR, 'fonts', '*')], File.expand_path('fonts'))
55
- end
56
47
  end
57
48
  end
58
49
  end
data/lib/tor/tor_prefs.rb CHANGED
@@ -17,7 +17,7 @@ module Selenium
17
17
 
18
18
  OTHER_PREFS = {
19
19
  'intl.language_notification.shown' => true, # affects font fingerprint (viewport size)
20
- 'remote.active-protocols' => 3, # CDP & BiDi future support
20
+ 'remote.active-protocols' => 1, # BiDi only >= 4.32 https://github.com/SeleniumHQ/selenium/pull/15224/files
21
21
  'extensions.torlauncher.start_tor' => false
22
22
  }.freeze
23
23
 
@@ -13,13 +13,19 @@ module Selenium
13
13
  BOOTSTRAP_SUCCESS_REGEX = /Bootstrapped 100% \(done\): Done$/
14
14
  BOOTSTRAP_FAIL_REGEX = /^[A-Z][a-z]{2} \d{2} \d{2}:\d{2}:\d{2}\.\d{3} \[err\] .*/
15
15
 
16
+ DIR_MSG = 'data_dir must exist and be a dir'
17
+ DATA_FILES = %w[cached-certs cached-microdesc-consensus cached-microdescs.new].freeze
18
+
19
+ class << self
20
+ attr_accessor :cached_certs, :cached_microdesc_consensus, :cached_microdescs # set when tor first started
21
+ end
22
+
16
23
  attr_reader :pid, :config
17
24
 
18
25
  def initialize(data_dir, opts = {})
19
- valid_data_dir?(data_dir)
26
+ setup_data_dir data_dir
20
27
  raise ArgumentError, 'TorProcess.new takes an options hash' unless opts.is_a? Hash
21
28
 
22
- @data_dir = data_dir # each tor process needs a separate data directory
23
29
  @opts = map_opts_to_torrc_keys opts
24
30
  @torrc = Torrc.new(@data_dir)
25
31
  @config ||= setup_config # Hash to store torrc config
@@ -29,11 +35,11 @@ module Selenium
29
35
  r, io = IO.pipe
30
36
  pid = Process.spawn tor_command, out: io, err: :out
31
37
  io.close
32
- errors = parse_tor_bootstrap_errors_with_timeout(r, timeout: timeout)
33
- errors.empty? ? @pid = pid : raise(TorProcessError, "Tor failed to start with errors:\n\n#{errors}")
38
+ parse_tor_bootstrap_errors_with_timeout(r, timeout: timeout)
39
+ read_from_data_files
40
+ @pid = pid
34
41
  rescue Timeout::Error
35
- Process.kill 'KILL', pid if pid
36
- raise Error::TimeoutError, "Tor not bootstrapped after #{timeout} seconds"
42
+ timeout_with pid, timeout
37
43
  ensure
38
44
  r.close
39
45
  end
@@ -46,9 +52,18 @@ module Selenium
46
52
 
47
53
  private
48
54
 
49
- def valid_data_dir?(dir)
50
- msg = 'data_dir must exist and be a dir'
51
- raise ArgumentError, msg unless Pathname.new(dir.to_s).directory? && Pathname.new(dir.to_s).empty?
55
+ def setup_data_dir(dir)
56
+ raise ArgumentError, DIR_MSG unless Pathname.new(dir.to_s).directory? && Pathname.new(dir.to_s).empty?
57
+
58
+ @data_dir = dir # each tor process needs a separate data directory
59
+ write_data_files_to dir
60
+ end
61
+
62
+ def write_data_files_to(dir)
63
+ DATA_FILES.each do |f|
64
+ var = self.class.instance_variable_get(var_from_file(f))
65
+ File.write(File.join(dir, f), var) if var
66
+ end
52
67
  end
53
68
 
54
69
  def map_opts_to_torrc_keys(opts)
@@ -66,13 +81,27 @@ module Selenium
66
81
 
67
82
  def parse_tor_bootstrap_errors_with_timeout(io, timeout:)
68
83
  lines = []
69
- Timeout.timeout timeout do
84
+ errors = Timeout.timeout timeout do
70
85
  io.each_line do |line|
71
86
  lines << line
72
87
  break lines.join if line.match BOOTSTRAP_FAIL_REGEX
73
88
  break '' if line.match BOOTSTRAP_SUCCESS_REGEX
74
89
  end
75
90
  end
91
+ raise(TorProcessError, "Tor failed to start with errors:\n\n#{errors}") unless errors.empty?
92
+ end
93
+
94
+ def read_from_data_files
95
+ DATA_FILES.each { |f| self.class.instance_variable_set var_from_file(f), File.read(File.join(@data_dir, f)) }
96
+ end
97
+
98
+ def var_from_file(name)
99
+ :"@#{name.tr('-', '_').sub('.new', '')}"
100
+ end
101
+
102
+ def timeout_with(pid, timeout)
103
+ Process.kill 'KILL', pid if pid
104
+ raise Error::TimeoutError, "Tor not bootstrapped after #{timeout} seconds"
76
105
  end
77
106
  end
78
107
  end
data/lib/tor/version.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Selenium
4
4
  module WebDriver
5
5
  module Tor
6
- VERSION = '1.5.4'
6
+ VERSION = '1.7.0'
7
7
  end
8
8
  end
9
9
  end