cfsolve 0.1.2 → 0.1.3
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/THIRD_PARTY_LICENSES/README.md +71 -254
- data/THIRD_PARTY_LICENSES/{derive_builder_macro-0.20.2/LICENSE-APACHE → bytecount-0.6.9/LICENSE.Apache2} +0 -1
- data/THIRD_PARTY_LICENSES/{darling-0.20.11/LICENSE → bytecount-0.6.9/LICENSE.MIT} +1 -3
- data/THIRD_PARTY_LICENSES/{ident_case-1.0.1/LICENSE → cobs-0.3.0/LICENSE-MIT} +1 -1
- data/THIRD_PARTY_LICENSES/cow-utils-0.1.3/LICENSE +21 -0
- data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → embedded-io-0.4.0}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.6.1}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{browserslist-data-0.1.4 → escape-simd-0.1.1}/LICENSE +1 -1
- data/THIRD_PARTY_LICENSES/escape-simd-0.1.1/NOTICE +62 -0
- data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/LICENSE +21 -0
- data/THIRD_PARTY_LICENSES/{miette-7.6.0/LICENSE → json-escape-simd-3.1.3/LICENSE-APACHE} +0 -1
- data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/NOTICE +62 -0
- data/THIRD_PARTY_LICENSES/memchr-2.8.3/UNLICENSE +24 -0
- data/THIRD_PARTY_LICENSES/{derive_builder_core-0.20.2 → nonmax-0.5.5}/LICENSE-APACHE +1 -2
- data/THIRD_PARTY_LICENSES/{dashmap-5.5.3/LICENSE → nonmax-0.5.5/LICENSE-MIT} +2 -4
- data/THIRD_PARTY_LICENSES/{rand-0.8.5 → num-bigint-0.5.1}/LICENSE-MIT +0 -1
- data/THIRD_PARTY_LICENSES/oxc-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/{browserslist-rs-0.19.0 → oxc-browserslist-5.0.1}/LICENSE +1 -0
- data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_index-5.0.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{bytes-str-0.2.7/LICENSE → self_cell-1.3.0/LICENSE-APACHE} +1 -2
- data/THIRD_PARTY_LICENSES/self_cell-1.3.0/LICENSE-GPLv2 +339 -0
- data/THIRD_PARTY_LICENSES/{darling_core-0.20.11 → smawk-0.3.3}/LICENSE +1 -1
- data/UPSTREAM.md +7 -5
- data/ext/cfsolve/Cargo.lock +534 -1727
- data/ext/cfsolve/Cargo.toml +4 -0
- data/ext/cfsolve/src/main.rs +1 -1
- data/lib/cfsolve/profiles/safari-26-ios/answers.json +266 -265
- data/lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +312 -312
- data/lib/cfsolve/profiles/safari-26-ios.json +106 -152
- data/lib/cfsolve/version.rb +2 -2
- data/vendor/cfsolve/Cargo.lock +561 -1729
- data/vendor/cfsolve/Cargo.toml +26 -8
- data/vendor/cfsolve/README.md +4 -0
- data/vendor/cfsolve/examples/check_answers.rs +2 -2
- data/vendor/cfsolve/examples/compare_session.rs +1 -2
- data/vendor/cfsolve/examples/solver_profile.rs +84 -0
- data/vendor/cfsolve/examples/solver_smoke.rs +9 -8
- data/vendor/cfsolve/examples/stage2_snapshot.rs +2 -2
- data/vendor/cfsolve/examples/tls_echo.rs +3 -3
- data/vendor/cfsolve/examples/vm_snapshot.rs +32 -33
- data/vendor/cfsolve/profiles/safari-26-ios/answers.json +266 -265
- data/vendor/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +312 -312
- data/vendor/cfsolve/profiles/safari-26-ios.json +106 -152
- data/vendor/cfsolve/src/bin/capture-proxy/main.rs +3 -2
- data/vendor/cfsolve/src/bin/challenge/cli.rs +8 -2
- data/vendor/cfsolve/src/bin/challenge/main.rs +7 -2
- data/vendor/cfsolve/src/capture/proxy/tests.rs +1 -1
- data/vendor/cfsolve/src/capture/proxy.rs +44 -13
- data/vendor/cfsolve/src/capture/sessions.rs +4 -3
- data/vendor/cfsolve/src/capture/upstream.rs +1 -1
- data/vendor/cfsolve/src/challenge/codec.rs +4 -2
- data/vendor/cfsolve/src/challenge/expression.rs +161 -117
- data/vendor/cfsolve/src/challenge/installed/audit.rs +11 -10
- data/vendor/cfsolve/src/challenge/installed.rs +13 -6
- data/vendor/cfsolve/src/challenge/merge.rs +120 -80
- data/vendor/cfsolve/src/challenge/orchestrator.rs +57 -44
- data/vendor/cfsolve/src/challenge/payload.rs +69 -31
- data/vendor/cfsolve/src/challenge/program.rs +197 -178
- data/vendor/cfsolve/src/challenge/reduced_timing.rs +55 -40
- data/vendor/cfsolve/src/challenge/source.rs +151 -96
- data/vendor/cfsolve/src/challenge/state.rs +180 -148
- data/vendor/cfsolve/src/challenge/tally.rs +64 -50
- data/vendor/cfsolve/src/challenge.rs +1 -0
- data/vendor/cfsolve/src/deobfuscate/analysis/bindings.rs +187 -185
- data/vendor/cfsolve/src/deobfuscate/analysis/effects.rs +42 -51
- data/vendor/cfsolve/src/deobfuscate/analysis/hoisting.rs +147 -228
- data/vendor/cfsolve/src/deobfuscate/analysis/properties.rs +250 -425
- data/vendor/cfsolve/src/deobfuscate/analysis/unconditional.rs +79 -0
- data/vendor/cfsolve/src/deobfuscate/analysis.rs +259 -41
- data/vendor/cfsolve/src/deobfuscate/argument_arrays.rs +70 -73
- data/vendor/cfsolve/src/deobfuscate/arrow_blocks.rs +91 -104
- data/vendor/cfsolve/src/deobfuscate/ast.rs +383 -0
- data/vendor/cfsolve/src/deobfuscate/bitwise.rs +44 -54
- data/vendor/cfsolve/src/deobfuscate/blocks.rs +36 -29
- data/vendor/cfsolve/src/deobfuscate/call_helpers.rs +80 -131
- data/vendor/cfsolve/src/deobfuscate/control_flow.rs +239 -297
- data/vendor/cfsolve/src/deobfuscate/copy_propagation.rs +114 -135
- data/vendor/cfsolve/src/deobfuscate/dead_branches.rs +62 -61
- data/vendor/cfsolve/src/deobfuscate/dead_properties.rs +197 -214
- data/vendor/cfsolve/src/deobfuscate/dispatch.rs +238 -298
- data/vendor/cfsolve/src/deobfuscate/encoded_strings.rs +198 -203
- data/vendor/cfsolve/src/deobfuscate/function_lengths.rs +32 -38
- data/vendor/cfsolve/src/deobfuscate/helper_objects.rs +338 -513
- data/vendor/cfsolve/src/deobfuscate/hygiene.rs +197 -0
- data/vendor/cfsolve/src/deobfuscate/int32_helpers.rs +121 -155
- data/vendor/cfsolve/src/deobfuscate/literals.rs +116 -67
- data/vendor/cfsolve/src/deobfuscate/loops.rs +43 -43
- data/vendor/cfsolve/src/deobfuscate/memoized_strings.rs +127 -131
- data/vendor/cfsolve/src/deobfuscate/merged_functions.rs +262 -220
- data/vendor/cfsolve/src/deobfuscate/pipeline.rs +199 -244
- data/vendor/cfsolve/src/deobfuscate/register_arrays.rs +353 -327
- data/vendor/cfsolve/src/deobfuscate/removal.rs +83 -52
- data/vendor/cfsolve/src/deobfuscate/simplify.rs +147 -0
- data/vendor/cfsolve/src/deobfuscate/state_machines.rs +88 -110
- data/vendor/cfsolve/src/deobfuscate/statements.rs +228 -228
- data/vendor/cfsolve/src/deobfuscate/static_members.rs +46 -31
- data/vendor/cfsolve/src/deobfuscate/testing.rs +49 -59
- data/vendor/cfsolve/src/deobfuscate/unused_bindings.rs +92 -102
- data/vendor/cfsolve/src/deobfuscate.rs +15 -11
- data/vendor/cfsolve/src/embedding_page/extra_params.rs +23 -18
- data/vendor/cfsolve/src/embedding_page/render_sample.rs +184 -147
- data/vendor/cfsolve/src/error.rs +40 -5
- data/vendor/cfsolve/src/fingerprint.rs +8 -2
- data/vendor/cfsolve/src/http/client.rs +7 -10
- data/vendor/cfsolve/src/http/requests.rs +2 -2
- data/vendor/cfsolve/src/js/ast.rs +479 -263
- data/vendor/cfsolve/src/lib.rs +1 -0
- data/vendor/cfsolve/src/listing/fold.rs +19 -9
- data/vendor/cfsolve/src/listing/query.rs +1 -47
- data/vendor/cfsolve/src/performance_clock.rs +20 -1
- data/vendor/cfsolve/src/profiling.rs +49 -0
- data/vendor/cfsolve/src/script.rs +35 -24
- data/vendor/cfsolve/src/session/challenge_page.rs +41 -21
- data/vendor/cfsolve/src/session/channel.rs +2 -2
- data/vendor/cfsolve/src/session/initial.rs +5 -5
- data/vendor/cfsolve/src/session/sink.rs +26 -1
- data/vendor/cfsolve/src/session/tests/challenge_page.rs +36 -1
- data/vendor/cfsolve/src/session.rs +1 -1
- data/vendor/cfsolve/src/solver.rs +3 -1
- data/vendor/cfsolve/src/stage2/analysis/audit.rs +4 -2
- data/vendor/cfsolve/src/stage2/analysis/envelope.rs +2 -1
- data/vendor/cfsolve/src/stage2/audit_globals.rs +142 -74
- data/vendor/cfsolve/src/stage2/benchmark.rs +62 -31
- data/vendor/cfsolve/src/stage2/call_stack.rs +1415 -1025
- data/vendor/cfsolve/src/stage2/challenge_page.rs +3 -2
- data/vendor/cfsolve/src/stage2/interaction/checkbox.rs +202 -150
- data/vendor/cfsolve/src/stage2/interaction/click.rs +2 -2
- data/vendor/cfsolve/src/stage2/interaction/plan.rs +5 -4
- data/vendor/cfsolve/src/stage2/payload/recover.rs +2 -2
- data/vendor/cfsolve/src/stage2/probes/clock.rs +1 -3
- data/vendor/cfsolve/src/stage2/probes/performance.rs +12 -8
- data/vendor/cfsolve/src/stage2/queries.rs +50 -0
- data/vendor/cfsolve/src/stage2/syntax.rs +88 -0
- data/vendor/cfsolve/src/stage2/trace.rs +134 -108
- data/vendor/cfsolve/src/stage2/vocabulary.rs +1 -11
- data/vendor/cfsolve/src/stage2.rs +2 -0
- data/vendor/cfsolve/src/vm/disassemble.rs +7 -3
- data/vendor/cfsolve/src/vm/dispatch.rs +93 -65
- data/vendor/cfsolve/src/vm/extract.rs +347 -250
- data/vendor/cfsolve/src/vm/interpret/access.rs +63 -48
- data/vendor/cfsolve/src/vm/interpret/builtin.rs +10 -10
- data/vendor/cfsolve/src/vm/interpret/call.rs +116 -52
- data/vendor/cfsolve/src/vm/interpret/compile.rs +79 -62
- data/vendor/cfsolve/src/vm/interpret/copies.rs +2 -2
- data/vendor/cfsolve/src/vm/interpret/evaluate/tests.rs +63 -42
- data/vendor/cfsolve/src/vm/interpret/evaluate.rs +65 -575
- data/vendor/cfsolve/src/vm/interpret/explore.rs +7 -10
- data/vendor/cfsolve/src/vm/interpret/formula.rs +131 -0
- data/vendor/cfsolve/src/vm/interpret/frozen.rs +3 -5
- data/vendor/cfsolve/src/vm/interpret/intrinsic.rs +123 -59
- data/vendor/cfsolve/src/vm/interpret/mix32.rs +189 -0
- data/vendor/cfsolve/src/vm/interpret/native_dispatch.rs +220 -0
- data/vendor/cfsolve/src/vm/interpret/pattern.rs +1736 -0
- data/vendor/cfsolve/src/vm/interpret/plan.rs +586 -338
- data/vendor/cfsolve/src/vm/interpret/register_helpers.rs +384 -0
- data/vendor/cfsolve/src/vm/interpret/run.rs +116 -45
- data/vendor/cfsolve/src/vm/interpret/semantics.rs +71 -46
- data/vendor/cfsolve/src/vm/interpret/setup.rs +80 -45
- data/vendor/cfsolve/src/vm/interpret/string_decoder.rs +482 -0
- data/vendor/cfsolve/src/vm/interpret.rs +9 -1
- data/vendor/cfsolve/src/vm/machine.rs +56 -49
- data/vendor/cfsolve/src/vm/output.rs +13 -5
- data/vendor/cfsolve/src/vm/packed_names.rs +11 -7
- data/vendor/cfsolve/src/vm/session.rs +185 -120
- data/vendor/cfsolve/src/vm/value.rs +22 -19
- data/vendor/cfsolve/src/vm.rs +2 -1
- data/vendor/cfsolve/vendor/btls-sys/Cargo.toml +3 -0
- data/vendor/cfsolve/vendor/btls-sys/build/main.rs +20 -0
- metadata +94 -178
- data/THIRD_PARTY_LICENSES/Inflector-0.11.4/LICENSE.md +0 -22
- data/THIRD_PARTY_LICENSES/arrayvec-0.7.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-MIT +0 -22
- data/THIRD_PARTY_LICENSES/ast_node-5.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/better_scoped_tls-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/bitvec-1.0.1/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/bstr-1.12.1/COPYING +0 -8
- data/THIRD_PARTY_LICENSES/bstr-1.12.1/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/cargo-platform-0.1.9/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/cargo_metadata-0.19.2/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/darling_macro-0.20.11/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/debugid-0.8.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/derive_builder-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/derive_builder_core-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/derive_builder_macro-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/foldhash-0.1.5/LICENSE +0 -19
- data/THIRD_PARTY_LICENSES/from_variant-3.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/funty-2.0.0/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/hashbrown-0.16.1/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/heck-0.5.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/hstr-3.0.3/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/is-macro-0.3.7/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/itoa-1.0.17/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/jsonc-parser-0.26.3/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/lru-0.16.2/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/memchr-2.7.6/COPYING +0 -3
- data/THIRD_PARTY_LICENSES/memchr-2.7.6/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/miette-derive-7.6.0/LICENSE +0 -229
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/COPYRIGHT +0 -7
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-THIRD-PARTY +0 -210
- data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-MIT +0 -20
- data/THIRD_PARTY_LICENSES/owo-colors-4.2.3/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/par-core-2.0.0/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/par-iter-2.0.0/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-APACHE +0 -13
- data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-MIT +0 -18
- data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-APACHE +0 -13
- data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-MIT +0 -18
- data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/petgraph-0.7.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/precomputed-map-0.2.0/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/preset_env_base-6.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/radium-0.7.0/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/radix_fmt-1.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/rand-0.8.5/COPYRIGHT +0 -12
- data/THIRD_PARTY_LICENSES/rand-0.8.5/LICENSE-APACHE +0 -176
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/COPYRIGHT +0 -12
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-APACHE +0 -187
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-MIT +0 -26
- data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-APACHE +0 -176
- data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-BOOST +0 -23
- data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/siphasher-0.3.11/COPYING +0 -7
- data/THIRD_PARTY_LICENSES/smallvec-1.15.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/smartstring-1.0.1/LICENCE.md +0 -355
- data/THIRD_PARTY_LICENSES/st-map-0.2.4/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/static-map-macro-0.3.4/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/string_enum-1.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/strsim-0.11.1/LICENSE +0 -23
- data/THIRD_PARTY_LICENSES/swc-52.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_allocator-4.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_atoms-9.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_common-18.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_compiler_base-45.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_config-3.1.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_config_macro-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_core-54.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_ast-19.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_codegen-21.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_codegen_macros-2.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_bugfixes-39.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_common-30.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2015-39.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2016-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2017-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2018-36.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2019-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2020-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2021-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2022-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es3-26.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_ext_transforms-25.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_hooks-0.3.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_loader-18.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_minifier-42.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_parser-32.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_preset_env-45.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transformer-6.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms-44.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_base-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_classes-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_compat-40.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_macros-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_module-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_optimization-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_proposal-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_react-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_typescript-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_usage_analyzer-27.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_utils-25.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_visit-19.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_eq_ignore_macros-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_error_reporters-20.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_macros_common-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_node_comments-18.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_timer-1.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_trace_macro-2.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_transform_common-12.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_visit-2.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/tap-1.0.1/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/tracing-0.1.44/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/tracing-attributes-0.1.31/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/tracing-core-0.1.36/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-MIT +0 -27
- data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-MIT +0 -26
- data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/wyz-0.5.1/LICENSE.txt +0 -21
- data/vendor/cfsolve/src/deobfuscate/analysis/globals.rs +0 -33
- data/vendor/cfsolve/src/deobfuscate/analysis/names.rs +0 -52
- /data/THIRD_PARTY_LICENSES/{derive_builder-0.20.2 → cobs-0.3.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{compact_str-0.7.1 → compact_str-0.10.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.4.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{arrayvec-0.7.6 → embedded-io-0.6.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{normpath-0.2.0 → escape-simd-0.1.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{bstr-1.12.1 → itertools-0.15.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{petgraph-0.7.1 → itertools-0.15.0}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{itoa-1.0.17 → itoa-1.0.19}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → itoa-1.0.19}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/COPYING +0 -0
- /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → num-bigint-0.5.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{swc_sourcemap-9.3.4 → oxc_sourcemap-9.0.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf-0.11.3 → phf-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_generator-0.11.3 → phf_generator-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_macros-0.11.3 → phf_macros-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_shared-0.11.3 → phf_shared-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → smallvec-1.16.5}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{smallvec-1.15.1 → smallvec-1.16.5}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{unicode-width-0.1.14 → unicode-segmentation-1.13.3}/COPYRIGHT +0 -0
- /data/THIRD_PARTY_LICENSES/{hashbrown-0.16.1 → unicode-segmentation-1.13.3}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{heck-0.5.0 → unicode-segmentation-1.13.3}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{cargo-platform-0.1.9 → zmij_ecma-1.0.23}/LICENSE-MIT +0 -0
|
@@ -15,18 +15,20 @@ use std::collections::{HashMap, HashSet};
|
|
|
15
15
|
use std::mem;
|
|
16
16
|
|
|
17
17
|
use anyhow::{Context, Result};
|
|
18
|
-
use
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
MemberProp, Pat, PropName, ReturnStmt, TryStmt, UnaryOp, VarDeclarator,
|
|
18
|
+
use oxc::ast::ast::{
|
|
19
|
+
Argument, BindingPattern, CallExpression, ConditionalExpression, Expression, Function,
|
|
20
|
+
MemberExpression, ObjectPropertyKind, PropertyKey, ReturnStatement, TryStatement,
|
|
21
|
+
VariableDeclarator,
|
|
23
22
|
};
|
|
24
|
-
use
|
|
23
|
+
use oxc::ast_visit::{Visit, walk};
|
|
24
|
+
use oxc::semantic::{ScopeFlags, SymbolId};
|
|
25
|
+
use oxc::span::GetSpan;
|
|
26
|
+
use oxc::syntax::operator::{BinaryOperator, UnaryOperator};
|
|
25
27
|
use url::Url;
|
|
26
28
|
|
|
27
29
|
use crate::candidates;
|
|
28
30
|
use crate::engine::{Engine, StackFrame, V8_STACK_LIMIT};
|
|
29
|
-
use crate::js::ast::{self, ParsedScript};
|
|
31
|
+
use crate::js::ast::{self, Binding, ParsedScript, Script};
|
|
30
32
|
|
|
31
33
|
/// The loader's entry point for widgets declared in markup.
|
|
32
34
|
const IMPLICIT_RENDER: &str = "runImplicitRender";
|
|
@@ -42,10 +44,10 @@ pub(crate) struct RenderSample {
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
impl RenderSample {
|
|
45
|
-
/// Rebuilds the stack for markup-triggered rendering from `
|
|
47
|
+
/// Rebuilds the stack for markup-triggered rendering from `script`, using `engine`'s format
|
|
46
48
|
/// and `url` as the script name.
|
|
47
|
-
pub(crate) fn
|
|
48
|
-
let loader = Loader::read(
|
|
49
|
+
pub(crate) fn from_script(script: Script<'_>, url: &Url, engine: Engine) -> Result<Self> {
|
|
50
|
+
let loader = Loader::read(script);
|
|
49
51
|
let (method, mut frames) = loader.sampled(IMPLICIT_RENDER, engine)?;
|
|
50
52
|
// The outer frames cover queue insertion and the DOM-ready handler draining that queue.
|
|
51
53
|
let queued = candidates::at_most_one_distinct(
|
|
@@ -58,13 +60,13 @@ impl RenderSample {
|
|
|
58
60
|
let drained = loader
|
|
59
61
|
.calls
|
|
60
62
|
.iter()
|
|
61
|
-
.find(|call| call.scope.
|
|
63
|
+
.find(|call| call.scope.map(Binding::Symbol) == Some(*ready))
|
|
62
64
|
.context("the ready handler calls nothing it queued")?;
|
|
63
|
-
frames.push((queued.function.
|
|
64
|
-
frames.push((ready.
|
|
65
|
+
frames.push((loader.name(queued.function).to_owned(), &queued.site));
|
|
66
|
+
frames.push((script.name(*ready).to_owned(), &drained.site));
|
|
65
67
|
Ok(Self {
|
|
66
68
|
method,
|
|
67
|
-
stack: engine.error_stack(placed(
|
|
69
|
+
stack: engine.error_stack(placed(script, url, &frames, engine)),
|
|
68
70
|
})
|
|
69
71
|
}
|
|
70
72
|
|
|
@@ -78,11 +80,12 @@ impl RenderSample {
|
|
|
78
80
|
caller: impl IntoIterator<Item = StackFrame<'caller>>,
|
|
79
81
|
engine: Engine,
|
|
80
82
|
) -> Result<Self> {
|
|
81
|
-
let parsed =
|
|
82
|
-
let
|
|
83
|
+
let parsed = ParsedScript::parse("the Turnstile loader", source)?;
|
|
84
|
+
let script = parsed.script();
|
|
85
|
+
let loader = Loader::read(script);
|
|
83
86
|
let (method, frames) = loader.sampled(EXPLICIT_RENDER, engine)?;
|
|
84
87
|
let caller = caller.into_iter().map(|frame| StackFrame { ..frame });
|
|
85
|
-
let frames = placed(
|
|
88
|
+
let frames = placed(script, url, &frames, engine)
|
|
86
89
|
.into_iter()
|
|
87
90
|
.chain(caller);
|
|
88
91
|
let stack = match engine {
|
|
@@ -94,7 +97,7 @@ impl RenderSample {
|
|
|
94
97
|
)?
|
|
95
98
|
.context("loader never calls an onload callback")?;
|
|
96
99
|
let timer = [(String::new(), onload)];
|
|
97
|
-
engine.error_stack(frames.chain(placed(
|
|
100
|
+
engine.error_stack(frames.chain(placed(script, url, &timer, engine)))
|
|
98
101
|
}
|
|
99
102
|
};
|
|
100
103
|
Ok(Self { method, stack })
|
|
@@ -104,7 +107,7 @@ impl RenderSample {
|
|
|
104
107
|
/// Places loader frames for `engine`, leaving out the frames JavaScriptCore's tail calls
|
|
105
108
|
/// replace.
|
|
106
109
|
fn placed<'a>(
|
|
107
|
-
|
|
110
|
+
script: Script<'_>,
|
|
108
111
|
url: &'a Url,
|
|
109
112
|
frames: &'a [(String, &Site)],
|
|
110
113
|
engine: Engine,
|
|
@@ -116,7 +119,7 @@ fn placed<'a>(
|
|
|
116
119
|
Engine::WebKit if site.tail => continue,
|
|
117
120
|
Engine::WebKit => site.jsc,
|
|
118
121
|
};
|
|
119
|
-
let (line, column) =
|
|
122
|
+
let (line, column) = script.position(at);
|
|
120
123
|
surviving.push(StackFrame {
|
|
121
124
|
function,
|
|
122
125
|
url: url.as_str(),
|
|
@@ -127,13 +130,13 @@ fn placed<'a>(
|
|
|
127
130
|
surviving
|
|
128
131
|
}
|
|
129
132
|
|
|
130
|
-
/// Engine-specific source
|
|
133
|
+
/// Engine-specific source offsets for a call frame.
|
|
131
134
|
#[derive(Debug, PartialEq)]
|
|
132
135
|
struct Site {
|
|
133
136
|
/// The start of the callee, V8's position.
|
|
134
|
-
v8:
|
|
137
|
+
v8: u32,
|
|
135
138
|
/// The opening argument parenthesis, used by JavaScriptCore.
|
|
136
|
-
jsc:
|
|
139
|
+
jsc: u32,
|
|
137
140
|
/// Whether this call is directly returned and therefore eligible for JavaScriptCore
|
|
138
141
|
/// tail-call replacement.
|
|
139
142
|
tail: bool,
|
|
@@ -141,39 +144,42 @@ struct Site {
|
|
|
141
144
|
|
|
142
145
|
/// A call through a plain identifier.
|
|
143
146
|
#[derive(Debug, PartialEq)]
|
|
144
|
-
struct Call {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
struct Call<'a> {
|
|
148
|
+
/// The named function containing the call.
|
|
149
|
+
scope: Option<SymbolId>,
|
|
150
|
+
callee: Binding<'a>,
|
|
147
151
|
site: Site,
|
|
148
|
-
first
|
|
152
|
+
/// The first argument, when it is a plain identifier.
|
|
153
|
+
first: Option<Binding<'a>>,
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
/// A frame position inside the named function `function`.
|
|
152
157
|
#[derive(Debug, PartialEq)]
|
|
153
158
|
struct FunctionSite {
|
|
154
|
-
function:
|
|
159
|
+
function: SymbolId,
|
|
155
160
|
site: Site,
|
|
156
161
|
}
|
|
157
162
|
|
|
158
163
|
/// Finds the functions and calls involved in stack sampling.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
struct Loader<'a> {
|
|
165
|
+
script: Script<'a>,
|
|
166
|
+
/// The named function being visited.
|
|
167
|
+
scope: Option<SymbolId>,
|
|
162
168
|
/// `new Error().stack` reads, at the error's construction site.
|
|
163
169
|
samples: Vec<FunctionSite>,
|
|
164
|
-
calls: Vec<Call
|
|
170
|
+
calls: Vec<Call<'a>>,
|
|
165
171
|
/// `runImplicitRender` property calls.
|
|
166
172
|
implicit_calls: Vec<FunctionSite>,
|
|
167
|
-
///
|
|
168
|
-
tail_calls: HashSet<
|
|
173
|
+
/// Starts of calls returned directly outside `try` blocks.
|
|
174
|
+
tail_calls: HashSet<u32>,
|
|
169
175
|
/// Whether the visit is inside a `try` block of the current function.
|
|
170
176
|
in_try: bool,
|
|
171
177
|
/// `key: function` in object literals.
|
|
172
|
-
properties: HashMap
|
|
178
|
+
properties: HashMap<&'a str, Binding<'a>>,
|
|
173
179
|
/// Variables initialised to a number.
|
|
174
|
-
numbers: HashMap<
|
|
180
|
+
numbers: HashMap<SymbolId, f64>,
|
|
175
181
|
/// The functions handed to `addEventListener("DOMContentLoaded", ...)`.
|
|
176
|
-
ready: Vec<
|
|
182
|
+
ready: Vec<Binding<'a>>,
|
|
177
183
|
/// Delay of the timer whose callback is currently being visited.
|
|
178
184
|
timer_delay: Option<f64>,
|
|
179
185
|
/// Calls to the page's defined `onload` callback from a timer with no delay. Another timer
|
|
@@ -181,13 +187,31 @@ struct Loader {
|
|
|
181
187
|
onload_calls: Vec<Site>,
|
|
182
188
|
}
|
|
183
189
|
|
|
184
|
-
impl Loader {
|
|
185
|
-
fn read(
|
|
186
|
-
let mut loader = Self
|
|
187
|
-
|
|
190
|
+
impl<'a> Loader<'a> {
|
|
191
|
+
fn read(script: Script<'a>) -> Self {
|
|
192
|
+
let mut loader = Self {
|
|
193
|
+
script,
|
|
194
|
+
scope: None,
|
|
195
|
+
samples: Vec::new(),
|
|
196
|
+
calls: Vec::new(),
|
|
197
|
+
implicit_calls: Vec::new(),
|
|
198
|
+
tail_calls: HashSet::new(),
|
|
199
|
+
in_try: false,
|
|
200
|
+
properties: HashMap::new(),
|
|
201
|
+
numbers: HashMap::new(),
|
|
202
|
+
ready: Vec::new(),
|
|
203
|
+
timer_delay: None,
|
|
204
|
+
onload_calls: Vec::new(),
|
|
205
|
+
};
|
|
206
|
+
loader.visit_program(script.program);
|
|
188
207
|
loader
|
|
189
208
|
}
|
|
190
209
|
|
|
210
|
+
/// The declared name of the function `symbol` binds.
|
|
211
|
+
fn name(&self, symbol: SymbolId) -> &'a str {
|
|
212
|
+
self.script.scoping.symbol_name(symbol)
|
|
213
|
+
}
|
|
214
|
+
|
|
191
215
|
/// Returns the sampling method code for loader export `property` and its frames, innermost
|
|
192
216
|
/// first: sampler, timing wrapper, and export. Fails if any step is ambiguous.
|
|
193
217
|
fn sampled(&self, property: &str, engine: Engine) -> Result<(f64, Vec<(String, &Site)>)> {
|
|
@@ -196,196 +220,209 @@ impl Loader {
|
|
|
196
220
|
let wrapper = candidates::at_most_one_distinct(
|
|
197
221
|
self.calls
|
|
198
222
|
.iter()
|
|
199
|
-
.filter(|call| call.callee == sample.function),
|
|
223
|
+
.filter(|call| call.callee == Binding::Symbol(sample.function)),
|
|
200
224
|
"calls of the stack sampler",
|
|
201
225
|
)?
|
|
202
226
|
.context("loader never calls its stack sampler")?;
|
|
203
227
|
let measured = wrapper
|
|
204
228
|
.scope
|
|
205
|
-
.as_ref()
|
|
206
229
|
.context("the stack sampler is called from an anonymous function")?;
|
|
207
|
-
let exported = self
|
|
230
|
+
let exported = *self
|
|
208
231
|
.properties
|
|
209
|
-
.get(
|
|
232
|
+
.get(property)
|
|
210
233
|
.with_context(|| format!("loader exports no {property}"))?;
|
|
211
234
|
let call = candidates::at_most_one_distinct(
|
|
212
|
-
self.calls
|
|
213
|
-
.
|
|
214
|
-
|
|
235
|
+
self.calls.iter().filter(|call| {
|
|
236
|
+
call.scope.map(Binding::Symbol) == Some(exported)
|
|
237
|
+
&& call.callee == Binding::Symbol(measured)
|
|
238
|
+
}),
|
|
215
239
|
"stack samples in the exported render",
|
|
216
240
|
)?
|
|
217
241
|
.with_context(|| format!("the loader's {property} takes no stack sample"))?;
|
|
218
|
-
let method = call
|
|
219
|
-
.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
242
|
+
let method = match call.first {
|
|
243
|
+
Some(Binding::Symbol(code)) => self.numbers.get(&code),
|
|
244
|
+
_ => None,
|
|
245
|
+
}
|
|
246
|
+
.with_context(|| format!("the loader's {property} has no constant method code"))?;
|
|
247
|
+
let exported = self.script.name(exported);
|
|
223
248
|
let exported = match engine {
|
|
224
249
|
Engine::Chromium => format!("Object.{exported} [as {property}]"),
|
|
225
|
-
Engine::WebKit => exported.
|
|
250
|
+
Engine::WebKit => exported.to_owned(),
|
|
226
251
|
};
|
|
227
252
|
Ok((
|
|
228
253
|
*method,
|
|
229
254
|
vec![
|
|
230
|
-
(sample.function.
|
|
231
|
-
(measured.
|
|
255
|
+
(self.name(sample.function).to_owned(), &sample.site),
|
|
256
|
+
(self.name(measured).to_owned(), &wrapper.site),
|
|
232
257
|
(exported, &call.site),
|
|
233
258
|
],
|
|
234
259
|
))
|
|
235
260
|
}
|
|
236
261
|
|
|
237
|
-
|
|
262
|
+
/// Visits `function` as the body of the function `name` binds, or of an anonymous one.
|
|
263
|
+
fn within(&mut self, name: Option<SymbolId>, function: &Function<'a>, flags: ScopeFlags) {
|
|
238
264
|
let previous = mem::replace(&mut self.scope, name);
|
|
239
265
|
let in_try = mem::take(&mut self.in_try);
|
|
240
|
-
|
|
266
|
+
walk::walk_function(self, function, flags);
|
|
241
267
|
self.scope = previous;
|
|
242
268
|
self.in_try = in_try;
|
|
243
269
|
}
|
|
244
270
|
|
|
245
|
-
fn site(&self, call: &
|
|
271
|
+
fn site(&self, call: &CallExpression<'_>, v8: u32, jsc: u32) -> Site {
|
|
246
272
|
Site {
|
|
247
273
|
v8,
|
|
248
274
|
jsc,
|
|
249
|
-
tail: self.tail_calls.contains(&call.span.
|
|
275
|
+
tail: self.tail_calls.contains(&call.span.start),
|
|
250
276
|
}
|
|
251
277
|
}
|
|
252
278
|
}
|
|
253
279
|
|
|
254
|
-
impl Visit for Loader {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
280
|
+
impl<'a> Visit<'a> for Loader<'a> {
|
|
281
|
+
/// Declared functions are named by their binding; expressions are anonymous unless a
|
|
282
|
+
/// variable names them.
|
|
283
|
+
fn visit_function(&mut self, function: &Function<'a>, flags: ScopeFlags) {
|
|
284
|
+
let name = function
|
|
285
|
+
.id
|
|
286
|
+
.as_ref()
|
|
287
|
+
.filter(|_| function.is_declaration())
|
|
288
|
+
.map(|id| id.symbol_id());
|
|
289
|
+
self.within(name, function, flags);
|
|
261
290
|
}
|
|
262
291
|
|
|
263
292
|
/// V8 names a function expression after the variable it initialises.
|
|
264
|
-
fn
|
|
265
|
-
if let
|
|
266
|
-
match declarator.init
|
|
267
|
-
Some(
|
|
268
|
-
self.within(Some(name.
|
|
293
|
+
fn visit_variable_declarator(&mut self, declarator: &VariableDeclarator<'a>) {
|
|
294
|
+
if let BindingPattern::BindingIdentifier(name) = &declarator.id {
|
|
295
|
+
match &declarator.init {
|
|
296
|
+
Some(Expression::FunctionExpression(function)) => {
|
|
297
|
+
self.within(Some(name.symbol_id()), function, ScopeFlags::Function);
|
|
269
298
|
return;
|
|
270
299
|
}
|
|
271
|
-
Some(
|
|
272
|
-
self.numbers.insert(name.
|
|
300
|
+
Some(Expression::NumericLiteral(number)) => {
|
|
301
|
+
self.numbers.insert(name.symbol_id(), number.value);
|
|
273
302
|
}
|
|
274
303
|
_ => {}
|
|
275
304
|
}
|
|
276
305
|
}
|
|
277
|
-
|
|
306
|
+
walk::walk_variable_declarator(self, declarator);
|
|
278
307
|
}
|
|
279
308
|
|
|
280
|
-
fn
|
|
281
|
-
if ast::member_str(
|
|
282
|
-
&& let
|
|
283
|
-
&&
|
|
284
|
-
&&
|
|
285
|
-
&& let Some(function) = self.scope.clone()
|
|
309
|
+
fn visit_member_expression(&mut self, member: &MemberExpression<'a>) {
|
|
310
|
+
if ast::member_str(member) == Some("stack")
|
|
311
|
+
&& let Expression::NewExpression(error) = member.object()
|
|
312
|
+
&& self.script.is_global(&error.callee, "Error")
|
|
313
|
+
&& let Some(function) = self.scope
|
|
286
314
|
{
|
|
287
315
|
self.samples.push(FunctionSite {
|
|
288
316
|
function,
|
|
289
317
|
site: Site {
|
|
290
|
-
v8: error.span.
|
|
291
|
-
jsc: callee.span.
|
|
318
|
+
v8: error.span.start,
|
|
319
|
+
jsc: error.callee.span().end,
|
|
292
320
|
tail: false,
|
|
293
321
|
},
|
|
294
322
|
});
|
|
295
323
|
}
|
|
296
|
-
|
|
324
|
+
walk::walk_member_expression(self, member);
|
|
297
325
|
}
|
|
298
326
|
|
|
299
327
|
/// `found === void 0 ? report() : found()`: the call of a callback once it is defined.
|
|
300
|
-
fn
|
|
328
|
+
fn visit_conditional_expression(&mut self, conditional: &ConditionalExpression<'a>) {
|
|
301
329
|
if self.timer_delay == Some(0.0)
|
|
302
|
-
&& let
|
|
303
|
-
&& test.
|
|
304
|
-
&& let
|
|
305
|
-
&& matches!(
|
|
306
|
-
|
|
307
|
-
&& call.
|
|
308
|
-
&&
|
|
309
|
-
&& let
|
|
310
|
-
&& callee
|
|
330
|
+
&& let Expression::BinaryExpression(test) = &conditional.test
|
|
331
|
+
&& test.operator == BinaryOperator::StrictEquality
|
|
332
|
+
&& let Expression::Identifier(tested) = &test.left
|
|
333
|
+
&& matches!(&test.right, Expression::UnaryExpression(unary)
|
|
334
|
+
if unary.operator == UnaryOperator::Void)
|
|
335
|
+
&& let Expression::CallExpression(call) = &conditional.alternate
|
|
336
|
+
&& call.arguments.is_empty()
|
|
337
|
+
&& let Expression::Identifier(callee) = &call.callee
|
|
338
|
+
&& self.script.binding(callee) == self.script.binding(tested)
|
|
311
339
|
{
|
|
312
|
-
let site = self.site(call, callee.span.
|
|
340
|
+
let site = self.site(call, callee.span.start, callee.span.end);
|
|
313
341
|
self.onload_calls.push(site);
|
|
314
342
|
}
|
|
315
|
-
|
|
343
|
+
walk::walk_conditional_expression(self, conditional);
|
|
316
344
|
}
|
|
317
345
|
|
|
318
|
-
fn
|
|
346
|
+
fn visit_call_expression(&mut self, call: &CallExpression<'a>) {
|
|
319
347
|
let outer_delay = self.timer_delay;
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
self.
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
348
|
+
match &call.callee {
|
|
349
|
+
Expression::Identifier(callee) => {
|
|
350
|
+
// `setTimeout(function () { ... }, delay)`: the callback runs from a timer.
|
|
351
|
+
if self.script.is_global(&call.callee, "setTimeout")
|
|
352
|
+
&& let [callback, delay] = &call.arguments[..]
|
|
353
|
+
&& matches!(
|
|
354
|
+
callback.as_expression(),
|
|
355
|
+
Some(Expression::FunctionExpression(_))
|
|
356
|
+
)
|
|
357
|
+
{
|
|
358
|
+
self.timer_delay = delay.as_expression().and_then(ast::number);
|
|
359
|
+
}
|
|
360
|
+
self.calls.push(Call {
|
|
361
|
+
scope: self.scope,
|
|
362
|
+
callee: self.script.binding(callee),
|
|
363
|
+
site: self.site(call, callee.span.start, callee.span.end),
|
|
364
|
+
first: match call.arguments.first().and_then(Argument::as_expression) {
|
|
365
|
+
Some(Expression::Identifier(first)) => Some(self.script.binding(first)),
|
|
366
|
+
_ => None,
|
|
367
|
+
},
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
callee => {
|
|
371
|
+
if let Expression::StaticMemberExpression(member) = callee
|
|
372
|
+
&& member.property.name == IMPLICIT_RENDER
|
|
373
|
+
&& let Some(function) = self.scope
|
|
374
|
+
{
|
|
375
|
+
let property = member.property.span;
|
|
376
|
+
let site = self.site(call, property.start, property.end);
|
|
377
|
+
self.implicit_calls.push(FunctionSite { function, site });
|
|
339
378
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
if ast::member_str(&member.prop) == Some("addEventListener")
|
|
349
|
-
&& let [event, listener, ..] = &call.args[..]
|
|
350
|
-
&& matches!(&*event.expr, Expr::Lit(Lit::Str(_)))
|
|
351
|
-
&& ast::static_str(&event.expr) == Some("DOMContentLoaded")
|
|
352
|
-
&& let Expr::Ident(listener) = &*listener.expr
|
|
353
|
-
{
|
|
354
|
-
self.ready.push(listener.sym.clone());
|
|
355
|
-
}
|
|
379
|
+
if let Some(member) = callee.as_member_expression()
|
|
380
|
+
&& ast::member_str(member) == Some("addEventListener")
|
|
381
|
+
&& let [event, listener, ..] = &call.arguments[..]
|
|
382
|
+
&& let Some(event @ Expression::StringLiteral(_)) = event.as_expression()
|
|
383
|
+
&& ast::static_str(event) == Some("DOMContentLoaded")
|
|
384
|
+
&& let Some(Expression::Identifier(listener)) = listener.as_expression()
|
|
385
|
+
{
|
|
386
|
+
self.ready.push(self.script.binding(listener));
|
|
356
387
|
}
|
|
357
|
-
_ => {}
|
|
358
388
|
}
|
|
359
389
|
}
|
|
360
|
-
|
|
390
|
+
walk::walk_call_expression(self, call);
|
|
361
391
|
self.timer_delay = outer_delay;
|
|
362
392
|
}
|
|
363
393
|
|
|
364
394
|
/// A directly returned call is in tail position unless an enclosing `try` requires work
|
|
365
395
|
/// after it returns.
|
|
366
|
-
fn
|
|
396
|
+
fn visit_return_statement(&mut self, statement: &ReturnStatement<'a>) {
|
|
367
397
|
if !self.in_try
|
|
368
|
-
&& let Some(
|
|
398
|
+
&& let Some(Expression::CallExpression(call)) = &statement.argument
|
|
369
399
|
{
|
|
370
|
-
self.tail_calls.insert(call.span.
|
|
400
|
+
self.tail_calls.insert(call.span.start);
|
|
371
401
|
}
|
|
372
|
-
|
|
402
|
+
walk::walk_return_statement(self, statement);
|
|
373
403
|
}
|
|
374
404
|
|
|
375
|
-
fn
|
|
405
|
+
fn visit_try_statement(&mut self, statement: &TryStatement<'a>) {
|
|
376
406
|
let outer = mem::replace(&mut self.in_try, true);
|
|
377
|
-
statement.block
|
|
407
|
+
self.visit_block_statement(&statement.block);
|
|
378
408
|
self.in_try = outer;
|
|
379
|
-
statement.handler
|
|
380
|
-
|
|
409
|
+
if let Some(handler) = &statement.handler {
|
|
410
|
+
self.visit_catch_clause(handler);
|
|
411
|
+
}
|
|
412
|
+
if let Some(finalizer) = &statement.finalizer {
|
|
413
|
+
self.visit_block_statement(finalizer);
|
|
414
|
+
}
|
|
381
415
|
}
|
|
382
416
|
|
|
383
|
-
fn
|
|
384
|
-
if let
|
|
385
|
-
&&
|
|
417
|
+
fn visit_object_property_kind(&mut self, property: &ObjectPropertyKind<'a>) {
|
|
418
|
+
if let Some(entry) = ast::key_value(property)
|
|
419
|
+
&& !entry.computed
|
|
420
|
+
&& let PropertyKey::StaticIdentifier(key) = &entry.key
|
|
421
|
+
&& let Expression::Identifier(value) = &entry.value
|
|
386
422
|
{
|
|
387
|
-
self.properties
|
|
423
|
+
self.properties
|
|
424
|
+
.insert(key.name.as_str(), self.script.binding(value));
|
|
388
425
|
}
|
|
389
|
-
|
|
426
|
+
walk::walk_object_property_kind(self, property);
|
|
390
427
|
}
|
|
391
428
|
}
|
data/vendor/cfsolve/src/error.rs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
//! retains the details.
|
|
3
3
|
|
|
4
4
|
use std::error::Error as StdError;
|
|
5
|
-
use std::fmt;
|
|
5
|
+
use std::{fmt, io};
|
|
6
6
|
|
|
7
7
|
use wreq::StatusCode;
|
|
8
8
|
|
|
9
|
-
use crate::session::Stage;
|
|
9
|
+
use crate::session::{SinkFailed, Stage};
|
|
10
10
|
|
|
11
11
|
/// A failed solve, or a profile that cannot solve.
|
|
12
12
|
#[derive(Debug)]
|
|
@@ -36,24 +36,35 @@ pub enum Error {
|
|
|
36
36
|
/// Rejection details, including request context.
|
|
37
37
|
error: anyhow::Error,
|
|
38
38
|
},
|
|
39
|
+
/// The [`Sink`](crate::Sink) failed to save an artifact, so the solve stopped rather than
|
|
40
|
+
/// lose its diagnostics.
|
|
41
|
+
Sink(anyhow::Error),
|
|
39
42
|
/// The solver cannot handle this page or challenge, for example because it uses a new
|
|
40
43
|
/// challenge build. Retrying will not help.
|
|
41
44
|
Unsupported(anyhow::Error),
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
impl Error {
|
|
45
|
-
/// Classifies a failure using a wrapped `Error`, if present, or the first
|
|
46
|
-
/// or
|
|
48
|
+
/// Classifies a failure using a wrapped `Error`, if present, a sink failure, or the first
|
|
49
|
+
/// recognized marker or transport error in the chain. Other failures are [`Unsupported`].
|
|
50
|
+
///
|
|
51
|
+
/// I/O errors count as network failures: once the sink's own failures are set apart, they
|
|
52
|
+
/// come from reading response bodies, such as a truncated compressed body.
|
|
53
|
+
///
|
|
54
|
+
/// [`Unsupported`]: Self::Unsupported
|
|
47
55
|
pub(crate) fn classify(error: anyhow::Error) -> Self {
|
|
48
56
|
let error = match error.downcast::<Self>() {
|
|
49
57
|
Ok(error) => return error,
|
|
50
58
|
Err(error) => error,
|
|
51
59
|
};
|
|
60
|
+
if error.downcast_ref::<SinkFailed>().is_some() {
|
|
61
|
+
return Self::Sink(error);
|
|
62
|
+
}
|
|
52
63
|
for cause in error.chain() {
|
|
53
64
|
if let Some(&Refused { stage, .. }) = cause.downcast_ref() {
|
|
54
65
|
return Self::Rejected { stage, error };
|
|
55
66
|
}
|
|
56
|
-
if cause.is::<wreq::Error>() {
|
|
67
|
+
if cause.is::<wreq::Error>() || cause.is::<io::Error>() {
|
|
57
68
|
return Self::Network(error);
|
|
58
69
|
}
|
|
59
70
|
}
|
|
@@ -67,6 +78,7 @@ impl fmt::Display for Error {
|
|
|
67
78
|
Self::Config(error)
|
|
68
79
|
| Self::Network(error)
|
|
69
80
|
| Self::Rejected { error, .. }
|
|
81
|
+
| Self::Sink(error)
|
|
70
82
|
| Self::Unsupported(error) => fmt::Display::fmt(error, formatter),
|
|
71
83
|
Self::Blocked { status } => write!(formatter, "the page answered HTTP {status}"),
|
|
72
84
|
Self::Challenged { status } => write!(
|
|
@@ -87,6 +99,7 @@ impl StdError for Error {
|
|
|
87
99
|
Self::Config(error)
|
|
88
100
|
| Self::Network(error)
|
|
89
101
|
| Self::Rejected { error, .. }
|
|
102
|
+
| Self::Sink(error)
|
|
90
103
|
| Self::Unsupported(error) => error.source(),
|
|
91
104
|
Self::Blocked { .. } | Self::Challenged { .. } | Self::NotChallenged => None,
|
|
92
105
|
}
|
|
@@ -139,4 +152,26 @@ mod tests {
|
|
|
139
152
|
let unknown = Error::classify(anyhow::anyhow!("no orchestrator path"));
|
|
140
153
|
assert!(matches!(unknown, Error::Unsupported(_)));
|
|
141
154
|
}
|
|
155
|
+
|
|
156
|
+
#[test]
|
|
157
|
+
fn sets_apart_sink_and_transport_failures() {
|
|
158
|
+
struct Full;
|
|
159
|
+
impl crate::Sink for Full {
|
|
160
|
+
fn artifact(&self, _: &str, _: &[u8]) -> anyhow::Result<()> {
|
|
161
|
+
Err(io::Error::from(io::ErrorKind::StorageFull).into())
|
|
162
|
+
}
|
|
163
|
+
fn progress(&self, _: &str) {}
|
|
164
|
+
}
|
|
165
|
+
let sink: &dyn crate::Sink = &Full;
|
|
166
|
+
let failed = sink
|
|
167
|
+
.save("page.html", b"")
|
|
168
|
+
.unwrap_err()
|
|
169
|
+
.context("loading the page");
|
|
170
|
+
let failed = Error::classify(failed);
|
|
171
|
+
assert!(matches!(failed, Error::Sink(_)));
|
|
172
|
+
assert!(failed.to_string().starts_with("loading the page"));
|
|
173
|
+
let truncated = anyhow::Error::new(io::Error::from(io::ErrorKind::UnexpectedEof))
|
|
174
|
+
.context("decoding the response body");
|
|
175
|
+
assert!(matches!(Error::classify(truncated), Error::Network(_)));
|
|
176
|
+
}
|
|
142
177
|
}
|
|
@@ -78,8 +78,13 @@ impl Transport {
|
|
|
78
78
|
})
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
/// Creates a client with this transport, optionally using `proxy
|
|
82
|
-
|
|
81
|
+
/// Creates a client with this transport, optionally using `proxy` and trusting only the PEM
|
|
82
|
+
/// certificate `trusted_root`.
|
|
83
|
+
pub fn client(
|
|
84
|
+
&self,
|
|
85
|
+
proxy: Option<&str>,
|
|
86
|
+
trusted_root: Option<&[u8]>,
|
|
87
|
+
) -> Result<BrowserClient> {
|
|
83
88
|
BrowserClient::try_new(
|
|
84
89
|
self.profile,
|
|
85
90
|
self.platform,
|
|
@@ -88,6 +93,7 @@ impl Transport {
|
|
|
88
93
|
self.requests.clone(),
|
|
89
94
|
self.engine,
|
|
90
95
|
proxy,
|
|
96
|
+
trusted_root,
|
|
91
97
|
)
|
|
92
98
|
}
|
|
93
99
|
}
|