| 1 | package EV::WebKit::Fingerprint; | ||
| 2 | use v5.10; use strict; use warnings; | ||
| 3 | our $VERSION = '0.05'; | ||
| 4 | use File::ShareDir (); | ||
| 5 | use Carp (); | ||
| 6 | use Glib (); | ||
| 7 | use Cwd (); | ||
| 8 | |||
| 9 | # The installed extension directory holds ONLY evwk_fp.so, so it can be handed | ||
| 10 | # straight to set_web_process_extensions_directory. Located via File::ShareDir | ||
| 11 | # in an installed dist, or the in-tree share/ during development/testing. | ||
| 12 | my $SO_DIR; | ||
| 13 | sub _so_dir { | ||
| 14 | return $SO_DIR if defined $SO_DIR; | ||
| 15 | my @cand; | ||
| 16 | # Prefer an in-tree build (blib during `make test`, or a plain checkout) over | ||
| 17 | # an installed copy, so testing a checkout never resolves a stale | ||
| 18 | # already-installed .so. Cwd::getcwd, not $ENV{PWD} (a shell var that is unset | ||
| 19 | # under service managers and stale after any chdir). | ||
| 20 | my $cwd = eval { Cwd::getcwd() }; | ||
| 21 | if (defined $cwd) { | ||
| 22 | # share/wext BEFORE blib: the Makefile rule compiles into share/wext and | ||
| 23 | # blib's is a COPY made afterwards, so preferring the copy left a | ||
| 24 | # checkout that already had a blib silently running the OLD extension | ||
| 25 | # whenever only the .so was rebuilt. Both in-tree paths still precede | ||
| 26 | # File::ShareDir, so a checkout still never resolves an installed .so. | ||
| 27 | push @cand, "$cwd/share/wext", "$cwd/blib/lib/auto/share/dist/EV-WebKit/wext"; | ||
| 28 | } | ||
| 29 | my $dist = eval { File::ShareDir::dist_dir('EV-WebKit') }; | ||
| 30 | push @cand, "$dist/wext" if defined $dist; | ||
| 31 | for my $d (@cand) { if (-e "$d/evwk_fp.so") { return $SO_DIR = $d } } | ||
| 32 | return $SO_DIR = ''; # cached "not found" | ||
| 33 | } | ||
| 34 | |||
| 35 | sub available { my $d = _so_dir(); return $d ne '' ? 1 : 0 } | ||
| 36 | |||
| 37 | # The closed set of DOM feature-presence stub groups the extension's FEATURES_JS | ||
| 38 | # knows how to install. Keep in sync with that switch. | ||
| 39 | our @FEATURE_GROUPS = qw(connection storage battery usb bluetooth hid serial scheduling rtc); | ||
| 40 | |||
| 41 | # Canonical per-GPU-family WebGL capability sets. pname keys are the JS WebGL | ||
| 42 | # numeric constants (decimal); values are a number, a string, or [n,n] for a | ||
| 43 | # 2-vector. VENDOR(7936)/RENDERER(7937) are the MASKED values real Chrome/Safari | ||
| 44 | # report; the UNMASKED pair comes from each preset's webgl_vendor/webgl_renderer | ||
| 45 | # via the existing string spoof. These are the canonical set for the family, not | ||
| 46 | # a per-driver capture -- a fingerprinter with a per-driver database could still | ||
| 47 | # find a mismatch (documented in the Ceiling POD). | ||
| 48 | my %WEBGL_ANGLE_NVIDIA = ( | ||
| 49 | params1 => { | ||
| 50 | 7936 => 'WebKit', 7937 => 'WebKit WebGL', | ||
| 51 | 7938 => 'WebGL 1.0 (OpenGL ES 2.0 Chromium)', | ||
| 52 | 35724 => 'WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)', | ||
| 53 | 3379 => 16384, 34076 => 16384, 34024 => 16384, 3386 => [32767,32767], | ||
| 54 | 34921 => 16, 36347 => 4096, 36348 => 30, 36349 => 1024, | ||
| 55 | 35660 => 16, 34930 => 16, 35661 => 32, | ||
| 56 | 33902 => [1,1], 33901 => [1,1024], 34047 => 16, | ||
| 57 | }, | ||
| 58 | params2 => { | ||
| 59 | # A WebGL2 context MUST report 2.0 strings: params1 (WebGL1) is merged | ||
| 60 | # under params2, so these override the 1.0 pair for a webgl2 context. | ||
| 61 | 7938 => 'WebGL 2.0 (OpenGL ES 3.0 Chromium)', | ||
| 62 | 35724 => 'WebGL GLSL ES 3.00 (OpenGL ES GLSL ES 3.0 Chromium)', | ||
| 63 | 32883 => 2048, 35071 => 2048, 36063 => 8, 34852 => 8, 36183 => 8, | ||
| 64 | 35376 => 65536, 34045 => 2, 36203 => 4294967294, | ||
| 65 | 35373 => 12, 35371 => 12, 35375 => 24, 35374 => 24, | ||
| 66 | # ES3 requires *_VECTORS == *_COMPONENTS/4; params1 has vertex=4096, | ||
| 67 | # fragment=1024, varying=30 vectors, so these must be 4x those. | ||
| 68 | 35658 => 16384, 35657 => 4096, 35659 => 120, 37157 => 120, 37154 => 120, | ||
| 69 | }, | ||
| 70 | extensions1 => [qw( | ||
| 71 | ANGLE_instanced_arrays EXT_blend_minmax EXT_clip_control | ||
| 72 | EXT_color_buffer_half_float EXT_depth_clamp EXT_disjoint_timer_query | ||
| 73 | EXT_float_blend EXT_frag_depth EXT_polygon_offset_clamp EXT_shader_texture_lod | ||
| 74 | EXT_texture_compression_bptc EXT_texture_compression_rgtc | ||
| 75 | EXT_texture_filter_anisotropic EXT_texture_mirror_clamp_to_edge EXT_sRGB | ||
| 76 | KHR_parallel_shader_compile OES_element_index_uint OES_fbo_render_mipmap | ||
| 77 | OES_standard_derivatives OES_texture_float OES_texture_float_linear | ||
| 78 | OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object | ||
| 79 | WEBGL_blend_func_extended WEBGL_color_buffer_float | ||
| 80 | WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb | ||
| 81 | WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_depth_texture | ||
| 82 | WEBGL_draw_buffers WEBGL_lose_context WEBGL_multi_draw WEBGL_polygon_mode | ||
| 83 | )], | ||
| 84 | extensions2 => [qw( | ||
| 85 | EXT_clip_control EXT_color_buffer_float EXT_color_buffer_half_float | ||
| 86 | EXT_conservative_depth EXT_depth_clamp EXT_disjoint_timer_query_webgl2 | ||
| 87 | EXT_float_blend EXT_polygon_offset_clamp EXT_render_snorm | ||
| 88 | EXT_texture_compression_bptc EXT_texture_compression_rgtc | ||
| 89 | EXT_texture_filter_anisotropic EXT_texture_mirror_clamp_to_edge | ||
| 90 | EXT_texture_norm16 KHR_parallel_shader_compile | ||
| 91 | NV_shader_noperspective_interpolation OES_draw_buffers_indexed | ||
| 92 | OES_sample_variables OES_shader_multisample_interpolation | ||
| 93 | OES_texture_float_linear OVR_multiview2 WEBGL_blend_func_extended | ||
| 94 | WEBGL_clip_cull_distance WEBGL_compressed_texture_s3tc | ||
| 95 | WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info | ||
| 96 | WEBGL_debug_shaders WEBGL_lose_context WEBGL_multi_draw WEBGL_polygon_mode | ||
| 97 | WEBGL_provoking_vertex WEBGL_stencil_texturing | ||
| 98 | )], | ||
| 99 | precision => { # "shaderType.precisionType" -> [rangeMin,rangeMax,precision] | ||
| 100 | 'VERTEX.HIGH_FLOAT' => [127,127,23], 'VERTEX.MEDIUM_FLOAT' => [127,127,23], | ||
| 101 | 'VERTEX.LOW_FLOAT' => [127,127,23], 'FRAGMENT.HIGH_FLOAT' => [127,127,23], | ||
| 102 | 'FRAGMENT.MEDIUM_FLOAT'=> [127,127,23], 'FRAGMENT.LOW_FLOAT' => [127,127,23], | ||
| 103 | # every shader/precision combination must be listed, or the unlisted ones | ||
| 104 | # fall through and report the REAL host precision alongside spoofed ones | ||
| 105 | 'VERTEX.HIGH_INT' => [31,30,0], 'FRAGMENT.HIGH_INT' => [31,30,0], | ||
| 106 | 'VERTEX.MEDIUM_INT' => [31,30,0], 'FRAGMENT.MEDIUM_INT' => [31,30,0], | ||
| 107 | 'VERTEX.LOW_INT' => [31,30,0], 'FRAGMENT.LOW_INT' => [31,30,0], | ||
| 108 | }, | ||
| 109 | ); | ||
| 110 | my %WEBGL_APPLE = ( | ||
| 111 | params1 => { | ||
| 112 | 7936 => 'WebKit', 7937 => 'WebKit WebGL', | ||
| 113 | # WebKit builds this as "WebGL GLSL ES 1.0 (" + native GLSL version + ")" | ||
| 114 | # unconditionally, so no WebKit port -- hence no Safari -- can emit the | ||
| 115 | # bare form. (WebGL2's bare "WebGL GLSL ES 3.00" IS hardcoded, so params2 | ||
| 116 | # is correct as written.) | ||
| 117 | 7938 => 'WebGL 1.0', 35724 => 'WebGL GLSL ES 1.0 (1.0)', | ||
| 118 | 3379 => 16384, 34076 => 16384, 34024 => 16384, 3386 => [16384,16384], | ||
| 119 | 34921 => 16, 36347 => 1024, 36348 => 31, 36349 => 1024, | ||
| 120 | 35660 => 16, 34930 => 16, 35661 => 32, | ||
| 121 | 33902 => [1,1], 33901 => [1,511], 34047 => 16, | ||
| 122 | }, | ||
| 123 | params2 => { | ||
| 124 | 7938 => 'WebGL 2.0', 35724 => 'WebGL GLSL ES 3.00', | ||
| 125 | 32883 => 2048, 35071 => 2048, 36063 => 8, 34852 => 8, 36183 => 4, | ||
| 126 | 35376 => 65536, 34045 => 2, 36203 => 4294967294, | ||
| 127 | 35373 => 12, 35371 => 12, 35375 => 24, 35374 => 24, | ||
| 128 | # params1 has vertex=1024, fragment=1024, varying=31 vectors -> x4. | ||
| 129 | 35658 => 4096, 35657 => 4096, 35659 => 124, 37157 => 124, 37154 => 124, | ||
| 130 | }, | ||
| 131 | extensions1 => [qw( | ||
| 132 | ANGLE_instanced_arrays EXT_blend_minmax EXT_clip_control EXT_color_buffer_half_float | ||
| 133 | EXT_float_blend EXT_frag_depth EXT_shader_texture_lod | ||
| 134 | EXT_texture_filter_anisotropic EXT_sRGB KHR_parallel_shader_compile | ||
| 135 | OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives | ||
| 136 | OES_texture_float OES_texture_float_linear OES_texture_half_float | ||
| 137 | OES_texture_half_float_linear OES_vertex_array_object | ||
| 138 | WEBGL_color_buffer_float WEBGL_compressed_texture_astc | ||
| 139 | WEBGL_compressed_texture_etc WEBGL_compressed_texture_pvrtc | ||
| 140 | WEBGL_debug_renderer_info WEBGL_depth_texture WEBGL_draw_buffers WEBGL_lose_context | ||
| 141 | WEBGL_multi_draw | ||
| 142 | )], | ||
| 143 | extensions2 => [qw( | ||
| 144 | EXT_clip_control EXT_color_buffer_float EXT_color_buffer_half_float | ||
| 145 | EXT_float_blend EXT_texture_filter_anisotropic EXT_texture_norm16 | ||
| 146 | KHR_parallel_shader_compile OES_draw_buffers_indexed OES_texture_float_linear | ||
| 147 | OVR_multiview2 WEBGL_clip_cull_distance WEBGL_compressed_texture_astc | ||
| 148 | WEBGL_compressed_texture_etc WEBGL_compressed_texture_pvrtc | ||
| 149 | WEBGL_debug_renderer_info WEBGL_lose_context | ||
| 150 | WEBGL_multi_draw WEBGL_provoking_vertex | ||
| 151 | )], | ||
| 152 | precision => { | ||
| 153 | 'VERTEX.HIGH_FLOAT' => [127,127,23], 'VERTEX.MEDIUM_FLOAT' => [15,15,10], | ||
| 154 | 'VERTEX.LOW_FLOAT' => [15,15,10], 'FRAGMENT.HIGH_FLOAT' => [127,127,23], | ||
| 155 | 'FRAGMENT.MEDIUM_FLOAT'=> [15,15,10], 'FRAGMENT.LOW_FLOAT' => [15,15,10], | ||
| 156 | # every shader/precision combination must be listed, or the unlisted ones | ||
| 157 | # fall through and report the REAL host precision alongside spoofed ones | ||
| 158 | 'VERTEX.HIGH_INT' => [31,30,0], 'FRAGMENT.HIGH_INT' => [31,30,0], | ||
| 159 | # fp16 mediump/lowp pairs with 16-bit ints, as ANGLE reports them | ||
| 160 | 'VERTEX.MEDIUM_INT' => [15,14,0], 'FRAGMENT.MEDIUM_INT' => [15,14,0], | ||
| 161 | 'VERTEX.LOW_INT' => [15,14,0], 'FRAGMENT.LOW_INT' => [15,14,0], | ||
| 162 | }, | ||
| 163 | ); | ||
| 164 | my %WEBGL_ADRENO = ( | ||
| 165 | params1 => { | ||
| 166 | 7936 => 'WebKit', 7937 => 'WebKit WebGL', | ||
| 167 | 7938 => 'WebGL 1.0 (OpenGL ES 2.0 Chromium)', | ||
| 168 | 35724 => 'WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)', | ||
| 169 | 3379 => 16384, 34076 => 16384, 34024 => 16384, 3386 => [16384,16384], | ||
| 170 | 34921 => 16, 36347 => 256, 36348 => 31, 36349 => 224, | ||
| 171 | 35660 => 16, 34930 => 16, 35661 => 32, | ||
| 172 | 33902 => [1,8], 33901 => [1,1023], 34047 => 16, | ||
| 173 | }, | ||
| 174 | params2 => { | ||
| 175 | 7938 => 'WebGL 2.0 (OpenGL ES 3.0 Chromium)', | ||
| 176 | 35724 => 'WebGL GLSL ES 3.00 (OpenGL ES GLSL ES 3.0 Chromium)', | ||
| 177 | 32883 => 2048, 35071 => 2048, 36063 => 8, 34852 => 8, 36183 => 4, | ||
| 178 | 35376 => 65536, 34045 => 2, 36203 => 4294967294, | ||
| 179 | # combined uniform blocks must be at least vertex+fragment (24+24) | ||
| 180 | 35373 => 24, 35371 => 24, 35375 => 72, 35374 => 48, | ||
| 181 | # params1 has vertex=256, fragment=224, varying=31 vectors -> x4. | ||
| 182 | 35658 => 1024, 35657 => 896, 35659 => 124, 37157 => 124, 37154 => 124, | ||
| 183 | }, | ||
| 184 | extensions1 => [qw( | ||
| 185 | ANGLE_instanced_arrays EXT_blend_minmax EXT_clip_control EXT_color_buffer_half_float | ||
| 186 | EXT_disjoint_timer_query EXT_float_blend EXT_frag_depth EXT_shader_texture_lod | ||
| 187 | EXT_texture_filter_anisotropic EXT_sRGB KHR_parallel_shader_compile | ||
| 188 | OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives | ||
| 189 | OES_texture_float OES_texture_float_linear OES_texture_half_float | ||
| 190 | OES_texture_half_float_linear OES_vertex_array_object WEBGL_color_buffer_float | ||
| 191 | WEBGL_compressed_texture_astc WEBGL_compressed_texture_etc | ||
| 192 | WEBGL_compressed_texture_etc1 WEBGL_debug_renderer_info WEBGL_debug_shaders | ||
| 193 | WEBGL_depth_texture WEBGL_draw_buffers WEBGL_lose_context WEBGL_multi_draw | ||
| 194 | )], | ||
| 195 | extensions2 => [qw( | ||
| 196 | EXT_clip_control EXT_color_buffer_float EXT_color_buffer_half_float | ||
| 197 | EXT_disjoint_timer_query_webgl2 EXT_float_blend EXT_texture_filter_anisotropic | ||
| 198 | EXT_texture_norm16 KHR_parallel_shader_compile OES_draw_buffers_indexed | ||
| 199 | OES_sample_variables OES_shader_multisample_interpolation OES_texture_float_linear | ||
| 200 | OVR_multiview2 WEBGL_clip_cull_distance WEBGL_compressed_texture_astc | ||
| 201 | WEBGL_compressed_texture_etc WEBGL_debug_renderer_info WEBGL_debug_shaders | ||
| 202 | WEBGL_lose_context WEBGL_multi_draw WEBGL_provoking_vertex | ||
| 203 | )], | ||
| 204 | precision => { | ||
| 205 | 'VERTEX.HIGH_FLOAT' => [127,127,23], 'VERTEX.MEDIUM_FLOAT' => [15,15,10], | ||
| 206 | 'VERTEX.LOW_FLOAT' => [15,15,10], 'FRAGMENT.HIGH_FLOAT' => [127,127,23], | ||
| 207 | 'FRAGMENT.MEDIUM_FLOAT'=> [15,15,10], 'FRAGMENT.LOW_FLOAT' => [15,15,10], | ||
| 208 | # every shader/precision combination must be listed, or the unlisted ones | ||
| 209 | # fall through and report the REAL host precision alongside spoofed ones | ||
| 210 | 'VERTEX.HIGH_INT' => [31,30,0], 'FRAGMENT.HIGH_INT' => [31,30,0], | ||
| 211 | # fp16 mediump/lowp pairs with 16-bit ints, as ANGLE reports them | ||
| 212 | 'VERTEX.MEDIUM_INT' => [15,14,0], 'FRAGMENT.MEDIUM_INT' => [15,14,0], | ||
| 213 | 'VERTEX.LOW_INT' => [15,14,0], 'FRAGMENT.LOW_INT' => [15,14,0], | ||
| 214 | }, | ||
| 215 | ); | ||
| 216 | |||
| 217 | # Each preset declares ONLY the fields that real device exposes (sparse rule). | ||
| 218 | # Numbers are plain scalars; screen is [w,h] or [w,h,availW,availH,colorDepth]. | ||
| 219 | my %PRESET = ( | ||
| 220 | 'windows-chrome' => { | ||
| 221 | user_agent => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36', | ||
| 222 | platform => 'Win32', vendor => 'Google Inc.', languages => ['en-US','en'], | ||
| 223 | hardwareConcurrency => 8, deviceMemory => 8, maxTouchPoints => 0, | ||
| 224 | screen => [1920,1080,1920,1040,24], devicePixelRatio => 1, | ||
| 225 | webgl_vendor => 'Google Inc. (NVIDIA)', | ||
| 226 | webgl_renderer => 'ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Direct3D11 vs_5_0 ps_5_0, D3D11)', | ||
| 227 | webgl => \%WEBGL_ANGLE_NVIDIA, | ||
| 228 | # Desktop Chrome's interface set; WebHID/Web Serial are desktop-only. | ||
| 229 | features => [qw(connection storage battery usb bluetooth hid serial scheduling rtc)], | ||
| 230 | # Chrome-only: drives window.chrome + navigator.userAgentData. | ||
| 231 | # Brand list, order and GREASE entry are curl-impersonate's chrome150 | ||
| 232 | # template verbatim, so the Sec-CH-UA on the wire and navigator | ||
| 233 | # .userAgentData cannot disagree. The GREASE brand and its version move | ||
| 234 | # every release -- 150 uses "Not;A=Brand";v="8", not 131's "Not_A Brand" | ||
| 235 | # v24 -- so it is not a constant to carry forward. | ||
| 236 | # 150.0.7871.189 is the last stable 150 build (Chrome version history | ||
| 237 | # API), not a plausible-looking invention: it is what a site asking for | ||
| 238 | # high-entropy hints compares against. | ||
| 239 | ua_data => { platform => 'Windows', platformVersion => '10.0.0', architecture => 'x86', bitness => '64', model => '', uaFullVersion => '150.0.7871.189', | ||
| 240 | brands => [ {brand=>'Not;A=Brand',version=>'8'}, {brand=>'Chromium',version=>'150'}, {brand=>'Google Chrome',version=>'150'} ], | ||
| 241 | fullVersionList => [ {brand=>'Not;A=Brand',version=>'8.0.0.0'}, {brand=>'Chromium',version=>'150.0.7871.189'}, {brand=>'Google Chrome',version=>'150.0.7871.189'} ] }, | ||
| 242 | }, | ||
| 243 | 'macos-safari' => { | ||
| 244 | user_agent => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15', | ||
| 245 | platform => 'MacIntel', vendor => 'Apple Computer, Inc.', languages => ['en-US','en'], | ||
| 246 | hardwareConcurrency => 10, maxTouchPoints => 0, # Safari omits deviceMemory | ||
| 247 | screen => [1512,982,1512,944,30], devicePixelRatio => 2, | ||
| 248 | webgl_vendor => 'Apple Inc.', webgl_renderer => 'Apple GPU', | ||
| 249 | webgl => \%WEBGL_APPLE, | ||
| 250 | # Safari exposes neither NetworkInformation, Battery, nor WebUSB/Bluetooth/HID/Serial. | ||
| 251 | features => [qw(storage rtc)], | ||
| 252 | }, | ||
| 253 | 'iphone-safari' => { | ||
| 254 | user_agent => 'Mozilla/5.0 (iPhone; CPU iPhone OS 26_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1', | ||
| 255 | platform => 'iPhone', vendor => 'Apple Computer, Inc.', languages => ['en-US','en'], | ||
| 256 | hardwareConcurrency => 6, maxTouchPoints => 5, | ||
| 257 | screen => [390,844,390,844,24], devicePixelRatio => 3, | ||
| 258 | webgl_vendor => 'Apple Inc.', webgl_renderer => 'Apple GPU', | ||
| 259 | webgl => \%WEBGL_APPLE, | ||
| 260 | features => [qw(storage rtc)], | ||
| 261 | mobile => 1, # drives window sizing + touch + pointer/hover/resolution media queries (Safari: no ua_data) | ||
| 262 | }, | ||
| 263 | 'windows-firefox' => { | ||
| 264 | # Gecko, claimed from a WebKit engine: a bigger lie than the others, and | ||
| 265 | # the residual Gecko-only surface is documented in the POD. What IS | ||
| 266 | # coherent is the whole header + TLS + HTTP/2 stack, which is Firefox's. | ||
| 267 | user_agent => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0', | ||
| 268 | # Firefox reports an EMPTY navigator.vendor, where Chrome says | ||
| 269 | # "Google Inc." and WebKit "Apple Computer, Inc." -- one of the cheapest | ||
| 270 | # engine checks there is, so it has to be the empty string, not absent. | ||
| 271 | platform => 'Win32', vendor => '', languages => ['en-US','en'], | ||
| 272 | # Gecko's own navigator surface. productSub is the cheap engine check -- | ||
| 273 | # every Gecko build reports 20100101 where WebKit and Chromium report | ||
| 274 | # 20030107 -- and oscpu/buildID exist in no other engine, so their | ||
| 275 | # ABSENCE is as much a tell as a wrong value. buildID has been frozen at | ||
| 276 | # this constant since Firefox 64 for exactly this reason. | ||
| 277 | productSub => '20100101', | ||
| 278 | oscpu => 'Windows NT 10.0; Win64; x64', | ||
| 279 | buildID => '20181001000000', | ||
| 280 | # Viewport origin in screen coordinates: 0 across, and down by the | ||
| 281 | # chrome above it for a maximised window. | ||
| 282 | mozInnerScreenX => 0, mozInnerScreenY => 74, | ||
| 283 | # No deviceMemory: Firefox has never shipped it. | ||
| 284 | hardwareConcurrency => 8, maxTouchPoints => 0, | ||
| 285 | screen => [1920,1080,1920,1040,24], devicePixelRatio => 1, | ||
| 286 | # Firefox on Windows renders through ANGLE too, so the unmasked strings | ||
| 287 | # are the same shape as Chrome's on the same GPU. | ||
| 288 | webgl_vendor => 'Google Inc. (NVIDIA)', | ||
| 289 | webgl_renderer => 'ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Direct3D11 vs_5_0 ps_5_0, D3D11)', | ||
| 290 | webgl => \%WEBGL_ANGLE_NVIDIA, | ||
| 291 | # Same interface set as Safari, by coincidence rather than kinship: | ||
| 292 | # Firefox dropped Battery, never shipped NetworkInformation for content, | ||
| 293 | # and implements none of WebUSB/Bluetooth/HID/Serial. | ||
| 294 | features => [qw(storage rtc)], | ||
| 295 | # No ua_data: client hints are Chromium-only, so identity_headers emits | ||
| 296 | # no Sec-CH-UA for this profile, which is what Firefox does. | ||
| 297 | }, | ||
| 298 | 'pixel-chrome' => { | ||
| 299 | # Chrome 131's reduced/frozen Android UA (model "K", version "Android 10"); | ||
| 300 | # the real device + OS version ride only in Sec-CH-UA-Model/-Platform-Version | ||
| 301 | # + navigator.userAgentData -- matching curl-impersonate's chrome131_android. | ||
| 302 | user_agent => 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36', | ||
| 303 | platform => 'Linux armv8l', vendor => 'Google Inc.', languages => ['en-US','en'], | ||
| 304 | hardwareConcurrency => 8, deviceMemory => 8, maxTouchPoints => 5, | ||
| 305 | screen => [412,915,412,915,24], devicePixelRatio => 2.625, | ||
| 306 | webgl_vendor => 'Google Inc. (Qualcomm)', | ||
| 307 | webgl_renderer => 'ANGLE (Qualcomm, Adreno (TM) 730, OpenGL ES 3.2)', | ||
| 308 | webgl => \%WEBGL_ADRENO, | ||
| 309 | # Android Chrome has WebUSB + Web Bluetooth but NOT WebHID / Web Serial. | ||
| 310 | features => [qw(connection storage battery usb bluetooth scheduling rtc)], | ||
| 311 | mobile => 1, | ||
| 312 | # Chrome for Android had NO inline PDF viewer at 131, so it reports | ||
| 313 | # pdfViewerEnabled false and an EMPTY plugins/mimeTypes list, where every | ||
| 314 | # other preset (and WebKitGTK itself) reports true and the five plugin | ||
| 315 | # names the HTML spec hardcodes. Dates, because the margin is narrow: | ||
| 316 | # Chrome 131 for Android shipped 2024-11-06, the Android viewer first | ||
| 317 | # appeared behind a flag in 2024-12, and only became default-on in | ||
| 318 | # Chrome 135 (2025-04). So 131 predates it outright. | ||
| 319 | pdf_viewer => 0, | ||
| 320 | ua_data => { platform => 'Android', platformVersion => '14.0.0', architecture => '', bitness => '', model => 'Pixel 8', uaFullVersion => '131.0.6778.86', | ||
| 321 | brands => [ {brand=>'Google Chrome',version=>'131'}, {brand=>'Chromium',version=>'131'}, {brand=>'Not_A Brand',version=>'24'} ], | ||
| 322 | fullVersionList => [ {brand=>'Google Chrome',version=>'131.0.6778.86'}, {brand=>'Chromium',version=>'131.0.6778.86'}, {brand=>'Not_A Brand',version=>'24.0.0.0'} ] }, | ||
| 323 | }, | ||
| 324 | ); | ||
| 325 | |||
| 326 | # field => validator: 'str'/'num'/'strv'/'screen'/'bool'/'uadata'. | ||
| 327 | my %FIELD = ( | ||
| 328 | user_agent => 'str', platform => 'str', vendor => 'str', | ||
| 329 | productSub => 'str', oscpu => 'str', buildID => 'str', | ||
| 330 | webgl_vendor => 'str', webgl_renderer => 'str', languages => 'strv', | ||
| 331 | hardwareConcurrency => 'num', deviceMemory => 'num', maxTouchPoints => 'num', | ||
| 332 | devicePixelRatio => 'num', screen => 'screen', | ||
| 333 | mozInnerScreenX => 'num', mozInnerScreenY => 'num', | ||
| 334 | mobile => 'bool', ua_data => 'uadata', webgl => 'webgl', features => 'features', | ||
| 335 | pdf_viewer => 'bool', | ||
| 336 | ); | ||
| 337 | |||
| 338 | sub profiles { return sort keys %PRESET } | ||
| 339 | |||
| 340 | # Map each preset to the curl-impersonate target with the matching TLS/HTTP2 | ||
| 341 | # fingerprint. curl ships only macOS desktop Chrome + Android Chrome, but | ||
| 342 | # Windows/macOS Chrome share an identical ClientHello (JA4 is OS-independent), so | ||
| 343 | # windows-chrome also uses chrome150 -- the OS lives in override_headers, not the | ||
| 344 | # TLS. Consumed by EV::WebKit's network_fingerprint wiring. | ||
| 345 | my %CURL_TARGET = ( | ||
| 346 | 'windows-chrome' => 'chrome150', | ||
| 347 | 'macos-safari' => 'safari26_0', | ||
| 348 | 'iphone-safari' => 'safari26_0_ios', | ||
| 349 | 'windows-firefox' => 'firefox147', | ||
| 350 | # chrome131_android is still the newest Android target upstream ships, so | ||
| 351 | # this one stays at 131 rather than claiming a Chrome the TLS cannot back. | ||
| 352 | 'pixel-chrome' => 'chrome131_android', | ||
| 353 | ); | ||
| 354 | sub curl_target { $CURL_TARGET{ $_[0] // '' } } | ||
| 355 | |||
| 356 | # The identity headers (User-Agent + Chrome client hints) a resolved profile | ||
| 357 | # should present to origins. The proxy forces these over curl's target defaults | ||
| 358 | # so the origin-seen OS/UA matches the JS layer -- e.g. Windows Chrome on the | ||
| 359 | # macOS-flavored chrome150 target. Safari profiles (no ua_data) carry just the UA. | ||
| 360 | # Chrome renders navigator.languages as Accept-Language "en-US,en;q=0.9,..." -- | ||
| 361 | # the first tag unweighted, each later tag q = 1 - 0.1*i (floored at 0.1), | ||
| 362 | # formatted without trailing zeros. The proxy no longer forwards WebKit's own | ||
| 363 | # (possibly libsoup-formatted) Accept-Language, so we supply the exact form here. | ||
| 364 | sub _accept_language { | ||
| 365 | my ($langs) = @_; | ||
| 366 | my @out; | ||
| 367 | for my $i (0 .. $#$langs) { | ||
| 368 | if ($i == 0) { push @out, $langs->[$i]; next } | ||
| 369 | my $q = 1 - 0.1 * $i; | ||
| 370 | $q = 0.1 if $q < 0.1; | ||
| 371 | push @out, sprintf('%s;q=%s', $langs->[$i], sprintf('%g', $q)); | ||
| 372 | } | ||
| 373 | return join ',', @out; | ||
| 374 | } | ||
| 375 | |||
| 376 | sub identity_headers { | ||
| 377 | my ($fp) = @_; | ||
| 378 | my %h = ('user-agent' => $fp->{user_agent}); | ||
| 379 | $h{'accept-language'} = _accept_language($fp->{languages}) | ||
| 380 | if $fp->{languages} && @{ $fp->{languages} }; | ||
| 381 | if (my $u = $fp->{ua_data}) { # Chrome | ||
| 382 | $h{'sec-ch-ua'} = join ', ', map { qq{"$_->{brand}";v="$_->{version}"} } @{ $u->{brands} || [] }; | ||
| 383 | $h{'sec-ch-ua-mobile'} = $fp->{mobile} ? '?1' : '?0'; | ||
| 384 | $h{'sec-ch-ua-platform'} = qq{"$u->{platform}"}; | ||
| 385 | } | ||
| 386 | return \%h; | ||
| 387 | } | ||
| 388 | |||
| 389 | # The HIGH-entropy client hints a resolved profile reports via | ||
| 390 | # getHighEntropyValues(). Real Chrome sends these only after an origin opts in | ||
| 391 | # with Accept-CH, so the proxy adds them per-host on demand (not on every | ||
| 392 | # request); this keeps the header layer consistent with the JS ua_data. Safari | ||
| 393 | # profiles (no ua_data) have none. | ||
| 394 | sub high_entropy_headers { | ||
| 395 | my ($fp) = @_; | ||
| 396 | my $u = $fp->{ua_data} or return {}; | ||
| 397 | my %h = ( | ||
| 398 | 'sec-ch-ua-platform-version' => qq{"$u->{platformVersion}"}, | ||
| 399 | 'sec-ch-ua-arch' => qq{"$u->{architecture}"}, | ||
| 400 | 'sec-ch-ua-bitness' => qq{"$u->{bitness}"}, | ||
| 401 | 'sec-ch-ua-model' => qq{"$u->{model}"}, | ||
| 402 | # match what the JS getHighEntropyValues() reports, or an Accept-CH'ing | ||
| 403 | # origin that cross-checks the two channels sees a contradiction: | ||
| 404 | 'sec-ch-ua-wow64' => '?0', # JS wow64:false (no 32-on-64 preset) | ||
| 405 | 'sec-ch-ua-full-version' => qq{"$u->{uaFullVersion}"}, # deprecated singular; JS still exposes uaFullVersion | ||
| 406 | ); | ||
| 407 | if ($u->{fullVersionList}) { | ||
| 408 | $h{'sec-ch-ua-full-version-list'} = | ||
| 409 | join ', ', map { qq{"$_->{brand}";v="$_->{version}"} } @{ $u->{fullVersionList} }; | ||
| 410 | } | ||
| 411 | return \%h; | ||
| 412 | } | ||
| 413 | |||
| 414 | sub resolve { | ||
| 415 | my ($arg) = @_; | ||
| 416 | my ($name, %ov); | ||
| 417 | if (ref $arg eq 'HASH') { %ov = %$arg; $name = delete $ov{profile}; } | ||
| 418 | elsif (!ref $arg) { $name = $arg; } | ||
| 419 | else { Carp::croak('fingerprint: expected a preset name or a hashref') } | ||
| 420 | Carp::croak('fingerprint: a profile hashref needs a "profile" => <preset> base') unless defined $name; | ||
| 421 | my $base = $PRESET{$name} | ||
| 422 | or Carp::croak("fingerprint: unknown fingerprint profile '$name' (have: " . join(', ', profiles()) . ')'); | ||
| 423 | my %p = (%$base, %ov); # overrides win | ||
| 424 | for my $k (sort keys %p) { | ||
| 425 | my $t = $FIELD{$k} or Carp::croak("fingerprint: unknown fingerprint field '$k'"); | ||
| 426 | my $v = $p{$k}; | ||
| 427 | # NUL rejection mirrors the module's own standard (add_user_script): an | ||
| 428 | # embedded NUL silently truncates the value WebKit receives, producing a | ||
| 429 | # silently-wrong -- de-anonymizing -- fingerprint rather than an error. | ||
| 430 | if ($t eq 'str') { Carp::croak("fingerprint: $k must be a string without a NUL byte") | ||
| 431 | if ref $v || !defined $v || index($v, "\0") >= 0 } | ||
| 432 | elsif ($t eq 'num') { Carp::croak("fingerprint: $k must be a number") unless defined $v && !ref $v && $v =~ /\A-?\d+(?:\.\d+)?\z/ } | ||
| 433 | elsif ($t eq 'strv') { Carp::croak("fingerprint: $k must be a non-empty arrayref of non-empty NUL-free strings") | ||
| 434 | unless ref $v eq 'ARRAY' && @$v && !grep { !defined($_) || ref($_) || !length($_) || index($_, "\0") >= 0 } @$v } | ||
| 435 | elsif ($t eq 'screen') { Carp::croak("fingerprint: screen must be [w,h] or [w,h,availW,availH,colorDepth]") | ||
| 436 | unless ref $v eq 'ARRAY' && (@$v == 2 || @$v == 5) && !grep { !defined || ref || !/\A\d+\z/ } @$v } | ||
| 437 | elsif ($t eq 'bool') { Carp::croak("fingerprint: $k must be 0 or 1") unless defined $v && !ref $v && ($v eq '0' || $v eq '1') } | ||
| 438 | elsif ($t eq 'webgl') { | ||
| 439 | Carp::croak("fingerprint: webgl must be a hashref") unless ref $v eq 'HASH'; | ||
| 440 | # Same silent-no-op class as features: a typo'd or empty webgl block | ||
| 441 | # leaves the JS wrapper with nothing to install, so the caller believes | ||
| 442 | # the GPU family is spoofed while getSupportedExtensions() still returns | ||
| 443 | # the host's list next to a spoofed webgl_renderer. | ||
| 444 | my @need = qw(params1 params2 extensions1 extensions2 precision); | ||
| 445 | my %ok = map { $_ => 1 } @need; | ||
| 446 | if (my @bad = grep { !$ok{$_} } sort keys %$v) { | ||
| 447 | Carp::croak("fingerprint: unknown webgl key(s): @bad (have: " . join(', ', @need) . ')'); | ||
| 448 | } | ||
| 449 | for my $k2 (@need) { | ||
| 450 | Carp::croak("fingerprint: webgl.$k2 is required") | ||
| 451 | unless defined $v->{$k2}; | ||
| 452 | my $want = ($k2 =~ /^extensions/) ? 'ARRAY' : 'HASH'; | ||
| 453 | Carp::croak("fingerprint: webgl.$k2 must be " . ($want eq 'ARRAY' ? 'an arrayref' : 'a hashref')) | ||
| 454 | unless ref $v->{$k2} eq $want; | ||
| 455 | } | ||
| 456 | } | ||
| 457 | elsif ($t eq 'features') { | ||
| 458 | Carp::croak("fingerprint: features must be an arrayref of strings") | ||
| 459 | unless ref $v eq 'ARRAY' && !grep { ref($_) || !defined($_) || index($_, "\0") >= 0 } @$v; | ||
| 460 | # The group names are a CLOSED set consumed by FEATURES_JS. Accepting | ||
| 461 | # an unknown one silently installs nothing -- the caller believes the | ||
| 462 | # interface is present when it is not, which is exactly the kind of | ||
| 463 | # quiet, de-anonymizing mismatch a fingerprint spoof must not have. | ||
| 464 | my %known = map { $_ => 1 } @FEATURE_GROUPS; | ||
| 465 | if (my @bad = grep { !$known{$_} } @$v) { | ||
| 466 | Carp::croak("fingerprint: unknown features group(s): @{[ sort @bad ]} (have: " | ||
| 467 | . join(', ', @FEATURE_GROUPS) . ')'); | ||
| 468 | } | ||
| 469 | } | ||
| 470 | elsif ($t eq 'uadata') { | ||
| 471 | Carp::croak("fingerprint: ua_data must be a hashref") unless ref $v eq 'HASH'; | ||
| 472 | for my $k2 (sort keys %$v) { | ||
| 473 | my $vv = $v->{$k2}; | ||
| 474 | if ($k2 eq 'brands' || $k2 eq 'fullVersionList') { | ||
| 475 | Carp::croak("fingerprint: ua_data.$k2 must be a non-empty arrayref of {brand,version} hashes") | ||
| 476 | unless ref $vv eq 'ARRAY' && @$vv; | ||
| 477 | for my $e (@$vv) { | ||
| 478 | Carp::croak("fingerprint: ua_data.$k2 entries must be {brand=>str,version=>str}") | ||
| 479 | unless ref $e eq 'HASH' | ||
| 480 | && !grep { !defined || ref || index($_, "\0") >= 0 } ($e->{brand}, $e->{version}); | ||
| 481 | } | ||
| 482 | } | ||
| 483 | else { Carp::croak("fingerprint: ua_data.$k2 must be a NUL-free string") | ||
| 484 | if ref $vv || !defined $vv || index($vv, "\0") >= 0 } | ||
| 485 | } | ||
| 486 | } | ||
| 487 | } | ||
| 488 | # Hand back a private deep copy. %PRESET's nested structures are SHARED (both | ||
| 489 | # Safari presets point at the same %WEBGL_APPLE table), so returning live refs | ||
| 490 | # would let a caller who edits one resolved profile silently re-fingerprint a | ||
| 491 | # different preset for the rest of the process. | ||
| 492 | return _clone(\%p); | ||
| 493 | } | ||
| 494 | |||
| 495 | sub _clone { | ||
| 496 | my ($v, $depth) = @_; | ||
| 497 | $depth //= 0; | ||
| 498 | # A caller can pass their own structure into an override, and a cyclic one | ||
| 499 | # would otherwise recurse until the stack dies rather than erroring cleanly. | ||
| 500 | Carp::croak('fingerprint: profile data nested too deeply (cyclic reference?)') if $depth > 64; | ||
| 501 | return [ map { _clone($_, $depth + 1) } @$v ] if ref $v eq 'ARRAY'; | ||
| 502 | return { map { ($_ => _clone($v->{$_}, $depth + 1)) } keys %$v } if ref $v eq 'HASH'; | ||
| 503 | return $v; | ||
| 504 | } | ||
| 505 | |||
| 506 | # Build the a{sv} GVariant of present, non-user_agent keys. screen is flattened | ||
| 507 | # to screen_width/height/availWidth/availHeight/colorDepth/pixelDepth; every | ||
| 508 | # number is a double ('d'); languages is 'as'. | ||
| 509 | sub gvariant { | ||
| 510 | my ($p, $seed, $extra) = @_; | ||
| 511 | my %d = %{ $extra || {} }; # entries the caller needs regardless of profile | ||
| 512 | $p ||= {}; | ||
| 513 | $d{$_} = Glib::Variant->new('s', $p->{$_}) for grep { defined $p->{$_} } qw/platform vendor webgl_vendor webgl_renderer productSub oscpu buildID/; | ||
| 514 | $d{languages} = Glib::Variant->new('as', $p->{languages}) if $p->{languages}; | ||
| 515 | $d{$_} = Glib::Variant->new('d', $p->{$_} + 0) for grep { defined $p->{$_} } qw/hardwareConcurrency deviceMemory maxTouchPoints devicePixelRatio mozInnerScreenX mozInnerScreenY/; | ||
| 516 | if (my $s = $p->{screen}) { | ||
| 517 | my ($w,$h,$aw,$ah,$cd) = @$s == 5 ? @$s : ($s->[0],$s->[1],$s->[0],$s->[1],24); | ||
| 518 | $d{screen_width} = Glib::Variant->new('d', $w); | ||
| 519 | $d{screen_height} = Glib::Variant->new('d', $h); | ||
| 520 | $d{screen_availWidth} = Glib::Variant->new('d', $aw); | ||
| 521 | $d{screen_availHeight} = Glib::Variant->new('d', $ah); | ||
| 522 | $d{screen_colorDepth} = Glib::Variant->new('d', $cd); | ||
| 523 | $d{screen_pixelDepth} = Glib::Variant->new('d', $cd); | ||
| 524 | } | ||
| 525 | # Readback-noise seed (opt-in). Passed as its own double so the extension can | ||
| 526 | # read it without parsing the coherence JSON; folded to guint32 in C. | ||
| 527 | $d{seed} = Glib::Variant->new('d', $seed + 0) if defined $seed; | ||
| 528 | # JS-layer coherence (window.chrome, navigator.userAgentData, matchMedia, | ||
| 529 | # touch) is not a native getter -- it is a JSON config the extension evals | ||
| 530 | # as JS. Carried as one 's' blob, separate from the native-getter fields. | ||
| 531 | if (my $coh = _coherence($p)) { | ||
| 532 | require Cpanel::JSON::XS; | ||
| 533 | $d{coherence} = Glib::Variant->new('s', Cpanel::JSON::XS::encode_json($coh)); | ||
| 534 | } | ||
| 535 | return Glib::Variant->new('a{sv}', \%d); | ||
| 536 | } | ||
| 537 | |||
| 538 | # Derive the JS-coherence config from the profile: window.chrome + userAgentData | ||
| 539 | # for a Chrome profile (has ua_data); touch + pointer/hover/resolution media | ||
| 540 | # overrides for a mobile profile. Returns undef when neither applies. | ||
| 541 | sub _coherence { | ||
| 542 | my ($p) = @_; | ||
| 543 | # No profile at all means a PLAIN browser, and new() promises the extension | ||
| 544 | # then "defines nothing, leaving a plain instance exactly as it was". Every | ||
| 545 | # other block below is gated on a field, but the orientation block is not -- | ||
| 546 | # it deliberately does not key off `mobile`, so with an empty profile it was | ||
| 547 | # the one thing that still emitted a blob. The extension gates COHERENCE_JS | ||
| 548 | # and the WebGL getParameter wrapper on the blob's mere presence, so a | ||
| 549 | # default browser was shipping window.ScreenOrientation (which stock | ||
| 550 | # WebKitGTK does not expose) and a getParameter whose toString no longer | ||
| 551 | # said [native code] -- both measured against the extension forced off. | ||
| 552 | return undef unless $p && %$p; | ||
| 553 | my %c; | ||
| 554 | if (my $u = $p->{ua_data}) { | ||
| 555 | $c{chrome} = 1; | ||
| 556 | $c{ua_data} = { %$u, mobile => ($p->{mobile} ? 1 : 0) }; | ||
| 557 | } | ||
| 558 | my %media; | ||
| 559 | if ($p->{mobile}) { | ||
| 560 | $c{touch} = 1; | ||
| 561 | $media{pointer} = 'coarse'; | ||
| 562 | $media{hover} = 'none'; | ||
| 563 | } | ||
| 564 | # Desktop Chrome 131 and Safari 18 both expose screen.orientation, so it must | ||
| 565 | # not be gated to mobile -- 'orientation' in screen was false on the desktop | ||
| 566 | # profiles, a one-expression presence probe. | ||
| 567 | # ... and the type follows the spoofed SCREEN's aspect, not the mobile flag. | ||
| 568 | # Keying it off mobile made a portrait desktop screen (or a landscape tablet | ||
| 569 | # profile) report an orientation its own screen.width/height contradict -- | ||
| 570 | # screen.width > screen.height with type 'portrait-primary' is a two-property | ||
| 571 | # probe. Square counts as landscape, as the engines do. | ||
| 572 | my ($ow, $oh) = @{ $p->{screen} || [] }[0,1]; | ||
| 573 | my $portrait = (defined $ow && defined $oh) ? ($oh > $ow) : $p->{mobile}; | ||
| 574 | $c{orientation} = $portrait | ||
| 575 | ? { type => 'portrait-primary', angle => 0 } | ||
| 576 | : { type => 'landscape-primary', angle => 0 }; | ||
| 577 | # Resolution media queries must agree with the spoofed devicePixelRatio for | ||
| 578 | # ANY profile whose dpr differs from 1 (e.g. a Retina desktop), not just | ||
| 579 | # mobile -- otherwise matchMedia('(min-resolution: 2dppx)') contradicts | ||
| 580 | # window.devicePixelRatio===2. | ||
| 581 | my $dpr = ($p->{devicePixelRatio} // 1) + 0; | ||
| 582 | $media{dppx} = $dpr if $dpr != 1; | ||
| 583 | # Emit the media block whenever a SCREEN is spoofed, not only for mobile or a | ||
| 584 | # non-1 dpr. Otherwise a desktop dpr-1 profile got no matchMedia wrapper at | ||
| 585 | # all, so device-width/height fell through to the engine and a binary search | ||
| 586 | # over '(device-width: Npx)' recovered the real host geometry -- defeating the | ||
| 587 | # native screen spoof in two lines. | ||
| 588 | $c{media} = \%media if %media || $p->{screen}; | ||
| 589 | # WebGL numeric capabilities / extension lists / shader precision are JS-layer | ||
| 590 | # config too -- the extension's WebGL wrapper reads them from this same blob. | ||
| 591 | $c{webgl} = $p->{webgl} if $p->{webgl}; | ||
| 592 | # Which DOM feature-presence stub groups to install (each in-guarded in JS, so | ||
| 593 | # a build that ships the real API keeps it). See FEATURES_JS in the extension. | ||
| 594 | $c{features} = $p->{features} if $p->{features}; | ||
| 595 | # Only emitted when the profile says there is NO inline PDF viewer, because | ||
| 596 | # that is the only case needing action: WebKitGTK already reports the | ||
| 597 | # viewer-present state (true + the five spec-hardcoded plugin names) that | ||
| 598 | # every other preset wants. | ||
| 599 | $c{no_pdf_viewer} = 1 if exists $p->{pdf_viewer} && !$p->{pdf_viewer}; | ||
| 600 | return %c ? \%c : undef; | ||
| 601 | } | ||
| 602 | |||
| 603 | 1; | ||
| 604 | |||
| 605 | __END__ |