selenium_tor 1.5.3 → 1.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 615212a0bec3109cb6ebe51090a362d148c31d8bc88ab9d0fecf4d384a9084a9
4
- data.tar.gz: 131ef6f7ab2bdf7cf3a1df3014afcab84de4e6bfa6420599feb5d83bfed19afa
3
+ metadata.gz: e6f9d6ff1e71d45656e35148ac5d58b490e85c23fbe47cb977de1b0b3f0a7de2
4
+ data.tar.gz: 24a4431f5a6b7957f14ca5d222b0f630f29e9955956622e20e73cdff5c51de6c
5
5
  SHA512:
6
- metadata.gz: 30fbd1bfeb30c55c532164379e7bdfae6fe767cee32ecf6ac46dbc78e43221766ee5d6d9f11080474b8a6c81add95c03f15878ac0145f9f4fd8950c5395d2935
7
- data.tar.gz: 7aa97939922a4548d83a438b4c2a731c01007d8e4f2fc4c8dda63f6d03ec4b80d77d96b34ecd7e5550ea1297d000e540ac9cdd737a0fd3538733deeaa6e6deb0
6
+ metadata.gz: 3f4a53aa33461f0159c0ff8703786646df23b8f503534710d4cf83c688ee247334262e88661f9d87a9a7ce008377c62032e209b737c7abd61165a0b309d8a262
7
+ data.tar.gz: 758cbe58b60de4556ff5c95fc82761f919ea1670b131c8afad6f6e6be673092ceb2fa71e5fde1240d5e70c03786eb4d04c75197073af9425381c1d6d66777522
data/.rubocop.yml CHANGED
@@ -13,7 +13,7 @@ Style/HashSyntax:
13
13
 
14
14
  Naming/MethodName:
15
15
  Exclude:
16
- - !ruby/regexp /test_.*\.rb$/ # for test_FOO constant tests
16
+ - !ruby/regexp /test_.*\.rb$/ # for test_FOO constant tests
17
17
 
18
18
  Security/Eval:
19
19
  Exclude:
@@ -23,6 +23,10 @@ Lint/RescueException:
23
23
  Exclude:
24
24
  - 'test/test_readme.rb'
25
25
 
26
+ Minitest/TestFileName:
27
+ Exclude:
28
+ - 'test/features/fingerprinting/vglrun_test_fingerprintjs.rb'
29
+
26
30
  Style/RegexpLiteral:
27
31
  Exclude:
28
32
  - 'Guardfile'
@@ -32,7 +36,3 @@ Minitest/TestMethodName:
32
36
 
33
37
  Minitest/AssertTruthy:
34
38
  Enabled: false
35
-
36
- Minitest/TestFileName:
37
- Exclude:
38
- - test/features/fingerprinting/vglrun_test_fingerprintjs.rb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## master (unreleased)
2
2
 
3
+ ## [1.6.0] - 2024-12-04
4
+
5
+ * drop support for TB < 14.0 stable
6
+ * Remove vglrun test from CI
7
+
8
+ ## [1.5.4] - 2024-10-10
9
+
10
+ * Add Bsdiff gem dependency
11
+ * Add [TZP](https://arkenfox.github.io/TZP/tzp.html) test
12
+
13
+ ### Bug fixes
14
+
15
+ * [#18](https://gitlab.com/matzfan/selenium-tor/-/issues/18)
16
+
3
17
  ## [1.5.3] - 2024-09-08
4
18
 
5
19
  * Bump rexml 3.3.7 to fix [rexml missing strscan dep](https://github.com/ruby/rexml/issues/140)
data/README.md CHANGED
@@ -5,14 +5,22 @@
5
5
 
6
6
  A Selenium extension for Tor Browser.
7
7
  ```ruby
8
+ # before_all
9
+ require 'selenium_tor'
10
+
8
11
  options = Selenium::WebDriver::Tor::Options.new
9
12
  @driver = Selenium::WebDriver.for :tor, options: options
10
13
  ```
14
+ When you are done don't forget to quit the driver. Failure to do so may leave orphaned tor processes.
15
+ ```ruby
16
+ # after_all
17
+ @driver&.quit
18
+ ```
11
19
  Once you have a driver instance:
12
20
  ```ruby
13
21
  @driver.get 'https://check.torproject.org'
14
22
  @driver.title
15
- # => Congratulations. This browser is configured to use Tor.
23
+ # => "Congratulations. This browser is configured to use Tor."
16
24
  ```
17
25
 
18
26
  ## \_why?
@@ -33,9 +41,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
33
41
 
34
42
  ## Dependencies and configuration
35
43
 
36
- [Tor Browser](https://www.torproject.org/download).
37
-
38
- The shared libraries Tor Bowser requires will be available if you have Firefox or Firefox ESR installed on your system. If not, do `sudo apt install firefox-esr` or the equivalent for your package manager.
44
+ [Tor Browser](https://www.torproject.org/download). Versions >= 14.0 stable are supported.
39
45
 
40
46
  As with Firefox browser, `geckodriver` needs to be installed and in your PATH.
41
47
 
@@ -43,6 +49,7 @@ The gem needs to know the location of the Tor Browser Bundle (TBB). The Tor Brow
43
49
  ```ruby
44
50
  options = Selenium::WebDriver::Tor::Options.new
45
51
  options.binary = '/some/path/to/tor_firefox_binary' # UNNECESSARY
52
+ # => '/some/path/to/tor_firefox_binary'
46
53
  ```
47
54
 
48
55
  The location of the TBB is not expected to change during code execution.
@@ -53,18 +60,21 @@ Tor Selenium is tested on **Linux only** right now.
53
60
 
54
61
  A configuration option to patch the libxul.so packaged with Tor Browser is provided. This has the effect of preventing websites from fingerprinting Selenium-driven Tor Browser via a JS call to `navigator.webdriver`:
55
62
  ```ruby
56
- Tor::Driver.libxul_patched? # is Tor Browser's libxul.so patched?
63
+ @driver_class = Selenium::WebDriver::Tor::Driver
64
+ @driver_class.libxul_patched? # is Tor Browser's libxul.so patched?
57
65
  # => false
58
- Tor::Driver.patch_libxul # patch libxul.so
59
- Tor::Driver.libxul_patched?
66
+ @driver_class.patch_libxul # patch libxul.so
67
+ @driver_class.libxul_patched?
60
68
  # => true
61
- Tor::Driver.unpatch_libxul # revert the patch and restore the libxul.so packaged with Tor Browser
69
+ @driver_class.unpatch_libxul # revert the patch and restore the libxul.so packaged with Tor Browser
70
+ # => 0
62
71
  ```
63
- The patcher uses the `[bsdiff](https://www.daemonology.net/bsdiff)` package, which must be installed on your system.
72
+ The patcher uses the [Bsdiff](https://gitlab.com/matzfan/bsdiff) gem, which in turn requires the bzip2 library (`libbz2-dev`).
64
73
 
65
74
  ## Usage
66
75
  ```ruby
67
76
  require 'selenium_tor'
77
+ # => false
68
78
  ```
69
79
  Tor Browser is based on Firefox, so for usage please read the Selenium [docs](https://www.selenium.dev/documentation/webdriver/browsers/firefox) for Firefox browser.
70
80
 
@@ -94,18 +104,19 @@ end
94
104
 
95
105
  @drivers = [driver, driver]
96
106
 
97
- Parallel.all?(@drivers, in_threads: @drivers.size) do |driver|
107
+ ::Parallel.all?(@drivers, in_threads: @drivers.size) do |driver|
98
108
  driver.get 'https://check.torproject.org'
99
109
  end
100
110
 
101
111
  @drivers.each(&:quit)
112
+ # => truthy
102
113
  ```
103
114
  ### Tor Browser specific functionality
104
115
 
105
116
  You can get and set the security level (shield icon in TB) as follows. 4 is 'Standard', 2 is 'Safer', 1 is 'Safest'.
106
117
  ```ruby
107
118
  @driver.security_level
108
- # => 4 - the default value
119
+ # => 4
109
120
  @driver.security_level = 2
110
121
  @driver.security_level
111
122
  # => 2
@@ -113,16 +124,17 @@ You can get and set the security level (shield icon in TB) as follows. 4 is 'Sta
113
124
  You can get a new circuit for the current page ('New Tor circuit for this site' on TB's application menu):
114
125
  ```ruby
115
126
  @driver.new_circuit_for_site # new circuit for the current page domain
127
+ # => nil
116
128
  ```
117
129
  ### Miscellaneous
118
130
 
119
131
  You can get and set Driver preferences dynamically like this. Caveat emptor.
120
132
  ```ruby
121
133
  @driver.pref['browser.download.dir']
122
- # => ""
123
- @driver.pref['browser.download.dir'] = 'home/user/Downloads'
134
+ # => ''
135
+ @driver.pref['browser.download.dir'] = '/home/user/Downloads'
124
136
  @driver.pref['browser.download.dir']
125
- # => "home/user/Downloads"
137
+ # => '/home/user/Downloads'
126
138
  ```
127
139
 
128
140
  The `Selenium::WebDriver::Tor` namespace is used for `Driver`, `Options`, `Profile` and all tor-specific classes. Otherwise Selenium's `Selenium::WebDriver::Firefox` namespace is used.
@@ -131,13 +143,15 @@ Remote functionality is not tested, but may be if a suitable Tor Browser Docker
131
143
 
132
144
  A number of constants are set during driver initialization based upon values found in the Tor Browser Bundle (TBB) root directory - see below. These include:
133
145
  ```ruby
146
+ Tor = Selenium::WebDriver::Tor
134
147
  Tor::TBB_DIR # path to the TBB root directory
135
148
  Tor::TBB_BROWSER_DIR # path to the 'Browser' directory in the above
136
149
  Tor::TBB_BINARY_PATH # path to the firefox binary
137
150
  Tor::TBB_TOR_BINARY_PATH # path to the bundled tor binary
138
151
  Tor::TBB_PROFILE_DIR # path to the default profile directory
139
152
  Tor::TBB_EXTENSIONS_DIR # path to the 'extensions' directory in the above
140
- Tor::TBB_VERSION # the version installed, e.g. "13.0.1", note: driver.capabilities.browser_version returns the Firefox version Tor Browser is based on
153
+ Tor::TBB_VERSION # the version installed, e.g. "13.0.1", note: driver.capabilities.browser_version returns the Firefox version Tor Browser is based on
154
+ # => instance_of String
141
155
  ```
142
156
 
143
157
  ## Known issues
@@ -150,7 +164,9 @@ The gem uses Xvfb to allow Tor Browser to be manipulated headlessly. Xvfb in tur
150
164
 
151
165
  ## Testing
152
166
 
153
- After checking out the repo, run `bin/setup` to install dependencies.
167
+ ~~After checking out the repo, run `bin/setup` to install dependencies.~~
168
+
169
+ Tests dependencies are `[bsdiff](https://www.daemonology.net/bsdiff)`, `VirtualGL` (see Fingerprinting above) and `Xvfb` if you want to run headless tests.
154
170
 
155
171
  Tests are run in the display set by the `DISPLAY` env var, usually :0 by default. To run headless tests, set it to another value:
156
172
 
data/fonts/000_README.txt CHANGED
@@ -2,6 +2,5 @@ DO NOT MODIFY THE CONTENTS OF THIS DIRECTORY
2
2
 
3
3
  Any adjustment to bundled fonts will result in an altered fingerprint. Font
4
4
  fingerprinting is more than just detecting what fonts you have, it also includes
5
- font fallbacks and characters (unicode code points) and any change in those can
5
+ font fallbacks and characters (Unicode code points) and any change in those can
6
6
  be measured.
7
-
@@ -1,21 +1,80 @@
1
1
  ---
2
- 13.5.2:
3
- unpatched_libxul: b2f8b3fd25466bd3ffa12fb34b422767b28e09577d5714d6d0c97f695dac15dc
4
- patched_libxul: 7f761479c2d0307b97023455cfd7811b5749690302f54508b247720105dd0a3b
5
- patch_checksum: 695f7534586c757781bd33a6dbc627cfe62d010edce20e5754fa5efff7aa80d0
6
- 13.5.3:
7
- unpatched_libxul: a3d065c3f77a0c28dd798952965fc4a2d3c28fb8171728b212fff31e7c8bea20
8
- patched_libxul: ef43a1e5e1d89f4be717430153088357ecc0625c28444ab9b084587927cb7383
9
- patch_checksum: 9d1d6596e2efe7a74b43cc469f5f0c6e9a59752e9fccea6613b896393c2651ae
10
- 14.0a2:
11
- unpatched_libxul: e0eda8db975fe315e9be32b3bf95ee62767c60ee34deac97a7163f8ab0480dc9
12
- patched_libxul: ed05f9c383f4ecbce69d978aefc0625c44874193707ebe11166e714b3e2b4f64
13
- patch_checksum: 0cf817f97bdbe51fba5ad61d566934c9ebdda8fce5540bc803aeca23e0ac3e8b
14
- 14.0a3:
15
- unpatched_libxul: f448fc180b547d622b969fe170028408f75493cf95be5e4c1180594daec2226b
16
- patched_libxul: 337a4ef0e723069695294b37a4843126529c44e2bc4f90b1533b547100355db3
17
- patch_checksum: 08dd8cab30c4416adf7ab6411e1346dce4a8b6f42e4c410adcd5bc63a71506e5
2
+ 14.5a1:
3
+ unpatched_libxul: 4586056dfd6584effa61f974e802b5b2103965326716423c2f76043e68571149
4
+ patched_libxul: b4463dffe43a112e509764c5e32b100bc2749112dc852244ed8817b72e631642
5
+ patch_checksum: a0397d3e9a86339c497bcedf3b8c4bed767284e9299e791e54266d42c2872b7d
6
+ 14.0.3:
7
+ unpatched_libxul: 2ddc3df2e8feb52c3bcd638249aac7d584d9c65888d67e18ad5fecceb4d5010a
8
+ patched_libxul: 9864cdfd750e504f06bd9eeca427f0a20d83d0bb5cd8e8232ae4a3ee4b2812b1
9
+ patch_checksum: 5deece766f5922c77ca4e60f194c0bdfa0374f6c80e190cdf60dd10f49d3b5e8
10
+ 14.0.2:
11
+ unpatched_libxul: 590a02a751951452b0f3eded2234b6c1ffc49ce794301192450a236db5ad11af
12
+ patched_libxul: 6a49949e01ea35f61ba0e08c05d66ec6b9591d7b148314b99a9d2e7b8334c3f4
13
+ patch_checksum: 8f3ab90326a7b995eebfd83018dc83b257f5699a72d3cd9754706df973a66852
14
+ 14.0.1:
15
+ unpatched_libxul: 02751a5f1c3390c8d8b1b062147713d9a5412797139d3a86217df3380b44a390
16
+ patched_libxul: 6df072f5e9f86bcd244b5dab416074754214b85f9735bc05f8d322bf136652ef
17
+ patch_checksum: 844e29b6131fa6d7282a0052aa81000c5decdd410da509f56e0cf9b8c24d6ca9
18
+ !!str 14.0:
19
+ unpatched_libxul: 0a9c57aa19a953af56b49e944bfb950b7ba47d12fa927bb76c5ff04b8cdcf063
20
+ patched_libxul: 3b163b5c035376883fd49eac7fa5d90bfa536d26038ee4e36508226111936cce
21
+ patch_checksum: 2821841ff51fb511731810622fecb9c132e0774f5883dc500f67869c59a81509
22
+ #######################
23
+ # NO LONGER SUPPORTED #
24
+ #######################
25
+ 14.0a9:
26
+ unpatched_libxul: af9228a9b026fb4dad1d611070421346d8f4f714f00d909bbc2bda04e4175ff4
27
+ patched_libxul: 7e1e5e733c8c258a92170b45d0bbcafc14beea628290cacbc013affda3082193
28
+ patch_checksum: cb3fef972d41f81a212b95b1b47b8b0fcb03e58271cde4bbaf6d4fe3f7ffc318
29
+ 14.0a8:
30
+ unpatched_libxul: 3ce2cef75c68f52df50cc435c9307bae8596ecbbf53d067e0731506096fb36cd
31
+ patched_libxul: 789bb47f02d7f5c87cae05409ea31a2cf1d222f6716c2dd81fc333f221bf8c16
32
+ patch_checksum: d5d4e4bbd43e7070da5fe74b1ecf461ec1d45535ac65b3884de43941d7dbc795
33
+ 14.0a7:
34
+ unpatched_libxul: d5cb03c1a4eec29035fb416f8eccece7457d20e941cb3214b6f38290930a8b89
35
+ patched_libxul: 99eff0d6aa3afe9c824820dd502d65578275cfeaeed95892abd133176195284f
36
+ patch_checksum: d2954379bb924e61867f3c5f9c4d15cd2785bd3927ecf759ad1adb08c4c48911
37
+ 14.0a6:
38
+ unpatched_libxul: 03d715c15e52bce158d6c7b51635fe662013bce99ed8a7557d11e4d9a6f242be
39
+ patched_libxul: dea564104ca64c7c40a50d6a1b7bb68c6c99e91ad67d5a31e71c07d0534ac2c9
40
+ patch_checksum: 709de7e4e96569750dddce0b61b206e2e03a4a941bb754284c5a558dc82f5eff
41
+ 14.0a5:
42
+ unpatched_libxul: b21ee80498095637c801648464afb2ccfbe07fabc38107ea326f79f7703ea497
43
+ patched_libxul: bdbcf7e96eb8f58cb5b499576ff47b6b4aecea95e146045fe2a837c92af7ca53
44
+ patch_checksum: 36db05c8fd7ce8a9d37fa4aec204d587c676ebff7c7432c219a7be1861afdd35
18
45
  14.0a4:
19
46
  unpatched_libxul: 2edf6d6a22db0c64f2488cad9a335279018f5ef589c4bfdfe631d227c50fd0f2
20
47
  patched_libxul: 602fd5be68deb8fbd30b733c403f36ac125834cec2bc10ed2085e1b50b3ea776
21
48
  patch_checksum: 23dc44777b828cabfcbd2341c678b7743f5da6e9cce633b1637674334ca5773f
49
+ 14.0a3:
50
+ unpatched_libxul: f448fc180b547d622b969fe170028408f75493cf95be5e4c1180594daec2226b
51
+ patched_libxul: 337a4ef0e723069695294b37a4843126529c44e2bc4f90b1533b547100355db3
52
+ patch_checksum: 08dd8cab30c4416adf7ab6411e1346dce4a8b6f42e4c410adcd5bc63a71506e5
53
+ 14.0a2:
54
+ unpatched_libxul: e0eda8db975fe315e9be32b3bf95ee62767c60ee34deac97a7163f8ab0480dc9
55
+ patched_libxul: ed05f9c383f4ecbce69d978aefc0625c44874193707ebe11166e714b3e2b4f64
56
+ patch_checksum: 0cf817f97bdbe51fba5ad61d566934c9ebdda8fce5540bc803aeca23e0ac3e8b
57
+ 13.5.7:
58
+ unpatched_libxul: dff5619f50ca52a53f231e837252a89114240bac0b66fc401e037145fb48e35a
59
+ patched_libxul: d840ea5b9f502531ab96dc983602964fcc44ccec33e47066ce7e8f43a5db0348
60
+ patch_checksum: ea6fb30bd4591f4eb0a1eb99aaf2d2629f69ddd431bb6c59abd8d96656165650
61
+ 13.5.6:
62
+ unpatched_libxul: 048d9332ed8ad4b40ff445d4135341b1facdec134fe933936311475c097eb664
63
+ patched_libxul: 13f813580551b03bad26be5f30e16e24b933abddf64aa255f4764349bb7a5a8f
64
+ patch_checksum: e9ccf50e16a3bd182e777dffa95af1d789273af32bae0fbb6af58dc1cb0f4ff0
65
+ 13.5.5:
66
+ unpatched_libxul: 67a1bacf07a2c5ef3a6ac3f0f63af114ffc6567a962ceba411c8262abbef0284
67
+ patched_libxul: c9d8fcd83ee8d1254672effc04c94040c6d8433c147a380028eec51f7e61557f
68
+ patch_checksum: 2d87245eb18f3f5625b818b183e45ce888ef00d562efc0a78186f13a49034ecc
69
+ 13.5.4:
70
+ unpatched_libxul: d4b20c9c3aa969f009254fac1e134239b05ca316b84ddb360c2e6f6cfbb062ea
71
+ patched_libxul: c55212fb3644d79b70cab7f14e0dd829d317fa158bab71278a16bb0407d92195
72
+ patch_checksum: c9f89c1fc1906912385fb0eaaa0bfb1b7152a1cb9e38a6066dd8cc32e104e7dd
73
+ 13.5.3:
74
+ unpatched_libxul: a3d065c3f77a0c28dd798952965fc4a2d3c28fb8171728b212fff31e7c8bea20
75
+ patched_libxul: ef43a1e5e1d89f4be717430153088357ecc0625c28444ab9b084587927cb7383
76
+ patch_checksum: 9d1d6596e2efe7a74b43cc469f5f0c6e9a59752e9fccea6613b896393c2651ae
77
+ 13.5.2:
78
+ unpatched_libxul: b2f8b3fd25466bd3ffa12fb34b422767b28e09577d5714d6d0c97f695dac15dc
79
+ patched_libxul: 7f761479c2d0307b97023455cfd7811b5749690302f54508b247720105dd0a3b
80
+ patch_checksum: 695f7534586c757781bd33a6dbc627cfe62d010edce20e5754fa5efff7aa80d0
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bsdiff'
3
4
  require 'digest'
4
5
  require 'json'
5
6
  require 'open-uri'
@@ -13,10 +14,10 @@ module Selenium
13
14
  module LibxulPatchable
14
15
  class LibxulPatchableError < StandardError; end
15
16
 
16
- # PATCH_REPO = 'https://gitlab.com/matzfan/keymaster/-/releases' # TODO
17
- LIBXUL_CHECKSUMS = YAML.load_file(File.join(__dir__, 'libxul_checksums.yml'))[Tor::TBB_VERSION]
18
- PATCH_REPO = 'https://gitlab.com/matzfan/keymaster/-/raw/main/patches/tor-browser'
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
@@ -60,21 +61,35 @@ module Selenium
60
61
  end
61
62
 
62
63
  def execute_patch(patchfile)
63
- raise LibxulPatchableError, 'bspatch not found, please install bsdiff' if `which bspatch`.empty?
64
+ Bsdiff.patch libxul_original, libxul_patched, patchfile
65
+ end
64
66
 
65
- `bspatch #{libxul_original} #{libxul_patched} #{patchfile}`
67
+ def libxul_checksums
68
+ @libxul_checksums ||= YAML.load_file(File.join(__dir__, 'libxul_checksums.yml'))[Tor::TBB_VERSION]
66
69
  end
67
70
 
68
71
  def unpatched_libxul_checksum_for_version
69
- 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
70
77
  end
71
78
 
72
79
  def patched_libxul_checksum_for_version
73
- 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
74
85
  end
75
86
 
76
87
  def patch_checksum_for_version
77
- 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
78
93
  end
79
94
 
80
95
  def checksum_for(file)
data/lib/tor/options.rb CHANGED
@@ -42,17 +42,21 @@ module Selenium
42
42
  def do_start_tor_browser_script_stuff
43
43
  ENV['SESSION_MANAGER'] = nil
44
44
  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
45
  FileUtils.rm_rf File.join(Tor::TBB_BROWSER_DIR, *%w[TorBrowser Data fontconfig])
48
46
  ENV['GSETTINGS_BACKEND'] = 'memory'
47
+ setup_font_vars if Tor::TBB_VERSION.to_f < 14.5 # DEPRECATE when 14.5 stable drops
49
48
  end
50
49
 
51
50
  def copy_fonts
52
- return unless Dir[File.join('fonts', '*')].size == 1 # README checked into git
53
-
51
+ FileUtils.rm_rf File.join(File.expand_path('fonts'), '.')
54
52
  FileUtils.cp(Dir[File.join(Tor::TBB_BROWSER_DIR, 'fonts', '*')], File.expand_path('fonts'))
55
53
  end
54
+
55
+ # DEPRECATE when 14.5 stable drops
56
+ def setup_font_vars
57
+ ENV['FONTCONFIG_PATH'] = File.join TBB_BROWSER_DIR, 'fontconfig'
58
+ ENV['FONTCONFIG_FILE'] = 'fonts.conf'
59
+ end
56
60
  end
57
61
  end
58
62
  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.3'
6
+ VERSION = '1.6.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,38 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium_tor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MatzFan
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-09-08 00:00:00.000000000 Z
10
+ date: 2024-12-04 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bsdiff
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 0.1.0
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 0.1.0
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: selenium-webdriver
15
28
  requirement: !ruby/object:Gem::Requirement
16
29
  requirements:
17
30
  - - ">="
18
31
  - !ruby/object:Gem::Version
19
- version: '4.24'
32
+ version: '4.27'
20
33
  type: :runtime
21
34
  prerelease: false
22
35
  version_requirements: !ruby/object:Gem::Requirement
23
36
  requirements:
24
37
  - - ">="
25
38
  - !ruby/object:Gem::Version
26
- version: '4.24'
39
+ version: '4.27'
27
40
  description: An extension for Selenium::WebDriver that automates Tor Browser
28
- email:
29
41
  executables: []
30
42
  extensions: []
31
43
  extra_rdoc_files: []
32
44
  files:
33
45
  - ".jshintrc"
34
46
  - ".rubocop.yml"
35
- - ".ruby-version"
36
47
  - ".yamllint"
37
48
  - CHANGELOG.md
38
49
  - Guardfile
@@ -56,7 +67,6 @@ files:
56
67
  - lib/tor/tor_process.rb
57
68
  - lib/tor/torrc.rb
58
69
  - lib/tor/version.rb
59
- - selenium_tor.gemspec
60
70
  - sig/tor.rbs
61
71
  - tmp/.placeholder
62
72
  homepage: https://gitlab.com/matzfan/selenium-tor
@@ -67,7 +77,6 @@ metadata:
67
77
  source_code_uri: https://gitlab.com/matzfan/selenium-tor
68
78
  changelog_uri: https://gitlab.com/matzfan/selenium-tor/CHANGELOG.md
69
79
  rubygems_mfa_required: 'true'
70
- post_install_message:
71
80
  rdoc_options: []
72
81
  require_paths:
73
82
  - lib
@@ -82,8 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
91
  - !ruby/object:Gem::Version
83
92
  version: '0'
84
93
  requirements: []
85
- rubygems_version: 3.5.18
86
- signing_key:
94
+ rubygems_version: 3.6.0.dev
87
95
  specification_version: 4
88
96
  summary: Selenium extension for Tor Browser
89
97
  test_files: []
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.3.5
data/selenium_tor.gemspec DELETED
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/tor/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'selenium_tor'
7
- spec.version = Selenium::WebDriver::Tor::VERSION
8
- spec.authors = ['MatzFan']
9
-
10
- spec.summary = 'Selenium extension for Tor Browser'
11
- spec.description = 'An extension for Selenium::WebDriver that automates Tor Browser'
12
- spec.homepage = 'https://gitlab.com/matzfan/selenium-tor'
13
- spec.license = 'MIT'
14
- spec.required_ruby_version = '>= 3.2'
15
-
16
- spec.metadata['homepage_uri'] = spec.homepage
17
- spec.metadata['source_code_uri'] = 'https://gitlab.com/matzfan/selenium-tor'
18
- spec.metadata['changelog_uri'] = 'https://gitlab.com/matzfan/selenium-tor/CHANGELOG.md'
19
- spec.metadata['rubygems_mfa_required'] = 'true'
20
-
21
- # Specify which files should be added to the gem when it is released.
22
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(__dir__) do
24
- `git ls-files -z`.split("\x0").reject do |f|
25
- (File.expand_path(f) == __FILE__) ||
26
- f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
27
- end
28
- end
29
- spec.bindir = 'exe'
30
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
- spec.require_paths = ['lib']
32
-
33
- spec.add_dependency 'selenium-webdriver', '>= 4.24'
34
- end