cfsolve 0.1.1 → 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 +18 -0
- data/README.md +10 -9
- 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 +10 -8
- 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 +2570 -1894
- data/lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +1867 -1192
- data/lib/cfsolve/profiles/safari-26-ios.json +102 -156
- 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 -35
- data/vendor/cfsolve/examples/build_profile.rs +17 -15
- data/vendor/cfsolve/examples/capture_session.rs +37 -0
- data/vendor/cfsolve/examples/check_answers.rs +66 -0
- data/vendor/cfsolve/examples/compare_session.rs +189 -0
- 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 +6 -3
- 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 +2570 -1894
- data/vendor/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +1867 -1192
- data/vendor/cfsolve/profiles/safari-26-ios.json +102 -156
- data/vendor/cfsolve/scripts/capture_cssom.mjs +42 -0
- data/vendor/cfsolve/scripts/serve_cssom.py +111 -0
- 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/profile.rs +7 -18
- data/vendor/cfsolve/src/capture/proxy/tests.rs +1 -1
- data/vendor/cfsolve/src/capture/proxy.rs +44 -13
- data/vendor/cfsolve/src/capture/recorded.rs +42 -7
- 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 +132 -0
- data/vendor/cfsolve/src/challenge/installed.rs +127 -269
- 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 +175 -35
- 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 +236 -122
- 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 +201 -205
- data/vendor/cfsolve/src/deobfuscate/function_lengths.rs +32 -38
- data/vendor/cfsolve/src/deobfuscate/helper_objects.rs +346 -536
- 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 +361 -322
- 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 -32
- data/vendor/cfsolve/src/embedding_page/page.rs +28 -2
- 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 +9 -1
- data/vendor/cfsolve/src/http/requests.rs +2 -2
- data/vendor/cfsolve/src/js/ast.rs +479 -254
- data/vendor/cfsolve/src/js/objects.rs +9 -2
- data/vendor/cfsolve/src/lib.rs +1 -0
- data/vendor/cfsolve/src/listing/fold.rs +19 -92
- data/vendor/cfsolve/src/listing/query.rs +26 -291
- data/vendor/cfsolve/src/listing.rs +0 -1
- 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 +19 -10
- data/vendor/cfsolve/src/session/probes.rs +160 -125
- 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/timing.rs +58 -53
- data/vendor/cfsolve/src/session/widget.rs +5 -6
- data/vendor/cfsolve/src/session.rs +1 -1
- data/vendor/cfsolve/src/solver.rs +3 -1
- data/vendor/cfsolve/src/stage2/analysis/analyze.rs +50 -33
- data/vendor/cfsolve/src/stage2/analysis/audit.rs +4 -2
- data/vendor/cfsolve/src/stage2/analysis/discovery.rs +61 -66
- data/vendor/cfsolve/src/stage2/analysis/envelope.rs +33 -22
- data/vendor/cfsolve/src/stage2/analysis/recognize.rs +3 -5
- data/vendor/cfsolve/src/stage2/analysis.rs +0 -1
- data/vendor/cfsolve/src/stage2/audit_globals.rs +378 -0
- data/vendor/cfsolve/src/stage2/benchmark.rs +66 -38
- data/vendor/cfsolve/src/stage2/call_stack.rs +1463 -1017
- 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/native.rs +2 -1
- data/vendor/cfsolve/src/stage2/interaction/plan.rs +5 -7
- data/vendor/cfsolve/src/stage2/payload/recover.rs +56 -25
- data/vendor/cfsolve/src/stage2/probes/clock.rs +1 -3
- data/vendor/cfsolve/src/stage2/probes/ice.rs +11 -10
- data/vendor/cfsolve/src/stage2/probes/media.rs +47 -33
- data/vendor/cfsolve/src/stage2/probes/performance.rs +13 -8
- data/vendor/cfsolve/src/stage2/probes/rects.rs +12 -17
- data/vendor/cfsolve/src/stage2/probes/stack.rs +50 -103
- data/vendor/cfsolve/src/stage2/probes/websocket_echo.rs +17 -86
- data/vendor/cfsolve/src/stage2/probes.rs +0 -1
- data/vendor/cfsolve/src/stage2/queries.rs +50 -0
- data/vendor/cfsolve/src/stage2/records.rs +4 -13
- data/vendor/cfsolve/src/stage2/reference.json +1 -1
- data/vendor/cfsolve/src/stage2/reference.rs +98 -100
- data/vendor/cfsolve/src/stage2/registry.rs +41 -34
- data/vendor/cfsolve/src/stage2/replay.rs +182 -254
- data/vendor/cfsolve/src/stage2/stylesheets.rs +176 -0
- data/vendor/cfsolve/src/stage2/syntax.rs +88 -0
- data/vendor/cfsolve/src/stage2/trace.rs +152 -108
- data/vendor/cfsolve/src/stage2/vocabulary.rs +103 -403
- data/vendor/cfsolve/src/stage2.rs +4 -1
- data/vendor/cfsolve/src/vm/disassemble.rs +46 -13
- 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 +67 -68
- data/vendor/cfsolve/src/vm/interpret/builtin.rs +16 -63
- data/vendor/cfsolve/src/vm/interpret/call.rs +192 -51
- data/vendor/cfsolve/src/vm/interpret/compile.rs +643 -0
- data/vendor/cfsolve/src/vm/interpret/copies.rs +232 -120
- data/vendor/cfsolve/src/vm/interpret/evaluate/tests.rs +149 -40
- data/vendor/cfsolve/src/vm/interpret/evaluate.rs +189 -572
- data/vendor/cfsolve/src/vm/interpret/explore.rs +159 -46
- data/vendor/cfsolve/src/vm/interpret/formula.rs +131 -0
- data/vendor/cfsolve/src/vm/interpret/frozen.rs +169 -0
- data/vendor/cfsolve/src/vm/interpret/intrinsic.rs +414 -0
- 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 +605 -330
- data/vendor/cfsolve/src/vm/interpret/register_helpers.rs +384 -0
- data/vendor/cfsolve/src/vm/interpret/run.rs +314 -54
- 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 +16 -3
- data/vendor/cfsolve/src/vm/machine.rs +58 -47
- data/vendor/cfsolve/src/vm/output.rs +13 -5
- data/vendor/cfsolve/src/vm/packed_names.rs +311 -0
- data/vendor/cfsolve/src/vm/session.rs +197 -110
- data/vendor/cfsolve/src/vm/value.rs +35 -19
- data/vendor/cfsolve/src/vm.rs +3 -1
- data/vendor/cfsolve/vendor/btls-sys/Cargo.toml +3 -0
- data/vendor/cfsolve/vendor/btls-sys/build/main.rs +20 -0
- data/vendor/cfsolve/vendor/btls-sys/src/lib.rs +3 -0
- metadata +106 -183
- 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/vendor/cfsolve/src/listing/normalize.rs +0 -264
- data/vendor/cfsolve/src/stage2/analysis/outputs.rs +0 -327
- data/vendor/cfsolve/src/stage2/probes/stylesheets.rs +0 -249
- data/vendor/cfsolve/src/stage2/reference-expanded.json +0 -42
- data/vendor/cfsolve/src/stage2/session_names.rs +0 -470
- /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
|
@@ -20,6 +20,7 @@ use crate::stage2::call_stack::MethodCall;
|
|
|
20
20
|
use crate::stage2::payload::{
|
|
21
21
|
self, Document, Environment, Expression, Layout, RecordTemplate, Recovered, Scope, State,
|
|
22
22
|
};
|
|
23
|
+
use crate::stage2::queries;
|
|
23
24
|
use crate::vm::{Constant, Effect, Listing, Term};
|
|
24
25
|
|
|
25
26
|
/// Widget parameters passed to `turnstile.render`, excluding callbacks.
|
|
@@ -220,7 +221,7 @@ impl Reader<'_> {
|
|
|
220
221
|
scope,
|
|
221
222
|
path: vec![name],
|
|
222
223
|
};
|
|
223
|
-
if let Some(name) = self.index
|
|
224
|
+
if let Some(name) = queries::option_read(self.index, pc, term) {
|
|
224
225
|
return Some(read(Scope::Options, name));
|
|
225
226
|
}
|
|
226
227
|
let (at, value) = self.index.dereference(pc, term)?;
|
|
@@ -411,7 +412,7 @@ impl Reader<'_> {
|
|
|
411
412
|
.position(|store| self.index.reads(store.pc, &store.value, started))
|
|
412
413
|
.context("record's start is never copied")?;
|
|
413
414
|
let closing: Vec<&Store> = stores[copy..].iter().collect();
|
|
414
|
-
let marks = self.index
|
|
415
|
+
let marks = queries::clock_marks(self.index, &closing)?;
|
|
415
416
|
ensure!(
|
|
416
417
|
marks[0].pc == stores[copy].pc,
|
|
417
418
|
"record's duration does not start at its copied start"
|
|
@@ -3,75 +3,97 @@
|
|
|
3
3
|
use std::collections::BTreeMap;
|
|
4
4
|
|
|
5
5
|
use anyhow::{Context, Result};
|
|
6
|
-
use
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
use oxc::ast::AstKind;
|
|
7
|
+
use oxc::ast::ast::{
|
|
8
|
+
ArrowFunctionExpression, AssignmentExpression, AssignmentTarget, CallExpression, Expression,
|
|
9
|
+
Function, IfStatement, MethodDefinition, ObjectProperty,
|
|
9
10
|
};
|
|
10
|
-
use
|
|
11
|
+
use oxc::ast_visit::{Visit, walk};
|
|
12
|
+
use oxc::semantic::SymbolId;
|
|
13
|
+
use oxc::syntax::operator::{LogicalOperator, UnaryOperator};
|
|
14
|
+
use oxc::syntax::scope::ScopeFlags;
|
|
11
15
|
|
|
12
16
|
use crate::challenge::expression;
|
|
13
|
-
use crate::js::{
|
|
17
|
+
use crate::js::ast::{self, Binding, Script};
|
|
18
|
+
use crate::js::{JsObject, JsValue, Options};
|
|
14
19
|
use crate::script::Source;
|
|
20
|
+
use crate::stage2::syntax::{
|
|
21
|
+
assigned_member, is_optional_call, member, plain_parameter, walk_method, walk_property,
|
|
22
|
+
};
|
|
15
23
|
use crate::{candidates, js};
|
|
16
24
|
|
|
17
25
|
/// How many nested expressions and aliases [`Builder::value`] follows.
|
|
18
26
|
const VALUE_DEPTH: usize = 16;
|
|
19
27
|
|
|
20
28
|
/// Tracks member-read aliases and the functions that fill an element with a message.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
aliases: BTreeMap<
|
|
29
|
+
struct Declarations<'a> {
|
|
30
|
+
/// The member read first assigned to each binding.
|
|
31
|
+
aliases: BTreeMap<Binding<'a>, &'a Expression<'a>>,
|
|
24
32
|
/// Each message function, with the selectors its link binder queries.
|
|
25
|
-
messages: BTreeMap<
|
|
33
|
+
messages: BTreeMap<Binding<'a>, Vec<String>>,
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
/// Identifies a message function from its writes to its first parameter.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
parameter:
|
|
37
|
+
struct Adapters<'a> {
|
|
38
|
+
script: Script<'a>,
|
|
39
|
+
parameter: SymbolId,
|
|
32
40
|
html: bool,
|
|
33
41
|
/// Functions that receive an element and a computed message, such as a translation.
|
|
34
|
-
translated: Vec<
|
|
42
|
+
translated: Vec<Binding<'a>>,
|
|
35
43
|
/// Functions that receive the element, such as link binders.
|
|
36
|
-
forwarded: Vec<
|
|
44
|
+
forwarded: Vec<Binding<'a>>,
|
|
37
45
|
}
|
|
38
46
|
|
|
39
|
-
impl Visit for Adapters {
|
|
40
|
-
fn
|
|
41
|
-
if let
|
|
42
|
-
&& ast::member_str(
|
|
43
|
-
&&
|
|
47
|
+
impl<'a> Visit<'a> for Adapters<'a> {
|
|
48
|
+
fn visit_assignment_expression(&mut self, assignment: &AssignmentExpression<'a>) {
|
|
49
|
+
if let Some(member) = assigned_member(&assignment.left)
|
|
50
|
+
&& ast::member_str(member) == Some("innerHTML")
|
|
51
|
+
&& self.script.refers_to(member.object(), self.parameter)
|
|
44
52
|
{
|
|
45
53
|
self.html = true;
|
|
46
54
|
}
|
|
47
|
-
|
|
55
|
+
walk::walk_assignment_expression(self, assignment);
|
|
48
56
|
}
|
|
49
|
-
fn
|
|
50
|
-
if
|
|
51
|
-
&& let
|
|
52
|
-
&& call.
|
|
53
|
-
|
|
57
|
+
fn visit_call_expression(&mut self, call: &CallExpression<'a>) {
|
|
58
|
+
if !is_optional_call(call)
|
|
59
|
+
&& let Expression::Identifier(name) = &call.callee
|
|
60
|
+
&& call.arguments.first().is_some_and(|argument| {
|
|
61
|
+
self.script
|
|
62
|
+
.refers_to(ast::argument_expression(argument), self.parameter)
|
|
54
63
|
})
|
|
55
64
|
{
|
|
56
|
-
self.
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
let callee = self.script.binding(name);
|
|
66
|
+
self.forwarded.push(callee);
|
|
67
|
+
if call.arguments.get(1).is_some_and(|argument| {
|
|
68
|
+
matches!(
|
|
69
|
+
ast::argument_expression(argument),
|
|
70
|
+
Expression::CallExpression(_)
|
|
71
|
+
)
|
|
72
|
+
}) {
|
|
73
|
+
self.translated.push(callee);
|
|
59
74
|
}
|
|
60
75
|
}
|
|
61
|
-
|
|
76
|
+
walk::walk_call_expression(self, call);
|
|
62
77
|
}
|
|
63
78
|
}
|
|
64
79
|
|
|
65
|
-
impl
|
|
66
|
-
fn
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
impl<'a> Declarations<'a> {
|
|
81
|
+
fn new(script: Script<'a>) -> Self {
|
|
82
|
+
let mut aliases = BTreeMap::new();
|
|
83
|
+
for node in script.nodes.iter() {
|
|
84
|
+
if let AstKind::AssignmentExpression(assignment) = node.kind()
|
|
85
|
+
&& let AssignmentTarget::AssignmentTargetIdentifier(name) = &assignment.left
|
|
86
|
+
&& member(&assignment.right).is_some()
|
|
87
|
+
{
|
|
88
|
+
aliases
|
|
89
|
+
.entry(script.binding(name))
|
|
90
|
+
.or_insert(&assignment.right);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
Self {
|
|
94
|
+
aliases,
|
|
95
|
+
messages: BTreeMap::new(),
|
|
73
96
|
}
|
|
74
|
-
assignment.visit_children_with(self);
|
|
75
97
|
}
|
|
76
98
|
}
|
|
77
99
|
|
|
@@ -90,187 +112,212 @@ fn translation(object: &JsObject, key: &str) -> Option<String> {
|
|
|
90
112
|
}
|
|
91
113
|
|
|
92
114
|
/// The selectors a function body passes to `querySelectorAll`, in order.
|
|
93
|
-
|
|
94
|
-
|
|
115
|
+
struct Queries<'a> {
|
|
116
|
+
script: Script<'a>,
|
|
117
|
+
found: Vec<String>,
|
|
118
|
+
}
|
|
95
119
|
|
|
96
|
-
impl Visit for Queries {
|
|
97
|
-
fn
|
|
98
|
-
if
|
|
99
|
-
&&
|
|
100
|
-
&&
|
|
101
|
-
&& let Some(
|
|
102
|
-
|
|
120
|
+
impl<'a> Visit<'a> for Queries<'a> {
|
|
121
|
+
fn visit_call_expression(&mut self, call: &CallExpression<'a>) {
|
|
122
|
+
if !is_optional_call(call)
|
|
123
|
+
&& let Some(member) = member(&call.callee)
|
|
124
|
+
&& ast::member_str(member) == Some("querySelectorAll")
|
|
125
|
+
&& let Some(selector) = call.arguments.first()
|
|
126
|
+
&& let Some(JsValue::String(selector)) = expression::static_value(
|
|
127
|
+
self.script,
|
|
128
|
+
ast::argument_expression(selector),
|
|
129
|
+
&Options::new(),
|
|
130
|
+
)
|
|
103
131
|
{
|
|
104
|
-
self.
|
|
132
|
+
self.found.push(selector);
|
|
105
133
|
}
|
|
106
|
-
|
|
134
|
+
walk::walk_call_expression(self, call);
|
|
107
135
|
}
|
|
108
136
|
}
|
|
109
137
|
|
|
110
138
|
/// Statically evaluates one function body to find the elements it creates and the messages it
|
|
111
139
|
/// fills. Selects known branches and skips nested functions.
|
|
112
|
-
struct Builder<'input> {
|
|
113
|
-
|
|
140
|
+
struct Builder<'a, 'input> {
|
|
141
|
+
script: Script<'a>,
|
|
142
|
+
declarations: &'input Declarations<'a>,
|
|
114
143
|
options: &'input Options,
|
|
115
|
-
values: BTreeMap<
|
|
116
|
-
/// The
|
|
117
|
-
elements: BTreeMap<
|
|
144
|
+
values: BTreeMap<Binding<'a>, JsValue>,
|
|
145
|
+
/// The bindings holding created elements, with each one's `type` attribute.
|
|
146
|
+
elements: BTreeMap<Binding<'a>, Option<String>>,
|
|
118
147
|
/// Selectors queried by filled messages, in query order.
|
|
119
148
|
queried: Vec<String>,
|
|
120
149
|
}
|
|
121
150
|
|
|
122
|
-
impl Builder<'_> {
|
|
123
|
-
fn value(&self, expression: &
|
|
151
|
+
impl<'a> Builder<'a, '_> {
|
|
152
|
+
fn value(&self, expression: &Expression<'a>, depth: usize) -> Option<JsValue> {
|
|
124
153
|
if depth == 0 {
|
|
125
154
|
return None;
|
|
126
155
|
}
|
|
127
|
-
if let Some(value) = expression::static_value(expression, self.options) {
|
|
156
|
+
if let Some(value) = expression::static_value(self.script, expression, self.options) {
|
|
128
157
|
return Some(value);
|
|
129
158
|
}
|
|
130
159
|
match expression {
|
|
131
|
-
|
|
132
|
-
self.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
160
|
+
Expression::Identifier(name) => {
|
|
161
|
+
let name = self.script.binding(name);
|
|
162
|
+
self.values
|
|
163
|
+
.get(&name)
|
|
164
|
+
.cloned()
|
|
165
|
+
.or_else(|| self.value(self.declarations.aliases.get(&name)?, depth - 1))
|
|
166
|
+
}
|
|
167
|
+
expression if let Some(member) = member(expression) => self
|
|
168
|
+
.value(member.object(), depth - 1)?
|
|
169
|
+
.get(ast::member_str(member)?)
|
|
137
170
|
.cloned(),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
171
|
+
Expression::UnaryExpression(unary) if unary.operator == UnaryOperator::LogicalNot => {
|
|
172
|
+
Some(JsValue::Bool(!js::truthy(
|
|
173
|
+
&self.value(&unary.argument, depth - 1)?,
|
|
174
|
+
)))
|
|
175
|
+
}
|
|
176
|
+
Expression::LogicalExpression(logical)
|
|
177
|
+
if matches!(logical.operator, LogicalOperator::Or | LogicalOperator::And) =>
|
|
143
178
|
{
|
|
144
|
-
let left = self.value(&
|
|
145
|
-
if js::truthy(&left) == (
|
|
179
|
+
let left = self.value(&logical.left, depth - 1)?;
|
|
180
|
+
if js::truthy(&left) == (logical.operator == LogicalOperator::Or) {
|
|
146
181
|
Some(left)
|
|
147
182
|
} else {
|
|
148
|
-
self.value(&
|
|
183
|
+
self.value(&logical.right, depth - 1)
|
|
149
184
|
}
|
|
150
185
|
}
|
|
151
|
-
|
|
152
|
-
let key =
|
|
186
|
+
Expression::CallExpression(call) => {
|
|
187
|
+
let key =
|
|
188
|
+
self.value(ast::argument_expression(call.arguments.first()?), depth - 1)?;
|
|
153
189
|
translation(self.options, key.as_str()?).map(JsValue::String)
|
|
154
190
|
}
|
|
155
191
|
_ => None,
|
|
156
192
|
}
|
|
157
193
|
}
|
|
158
194
|
/// The expression's value as `setAttribute` converts it: `String(value)`.
|
|
159
|
-
fn text(&self, expression: &
|
|
195
|
+
fn text(&self, expression: &Expression<'a>) -> Option<String> {
|
|
160
196
|
let value = self.value(expression, VALUE_DEPTH)?;
|
|
161
197
|
Some(js::string(Some(&value)))
|
|
162
198
|
}
|
|
163
199
|
/// Whether `call` creates an element with `createElement(NS)` and a known tag.
|
|
164
|
-
fn creates(&self, call: &
|
|
165
|
-
let Some(
|
|
200
|
+
fn creates(&self, call: &CallExpression<'a>) -> bool {
|
|
201
|
+
let Some(member) = member(&call.callee) else {
|
|
166
202
|
return false;
|
|
167
203
|
};
|
|
168
|
-
let tag = match ast::member_str(
|
|
204
|
+
let tag = match ast::member_str(member) {
|
|
169
205
|
Some("createElement") => 0,
|
|
170
206
|
Some("createElementNS") => 1,
|
|
171
207
|
_ => return false,
|
|
172
208
|
};
|
|
173
|
-
call.
|
|
209
|
+
call.arguments
|
|
174
210
|
.get(tag)
|
|
175
|
-
.is_some_and(|tag| self.text(
|
|
211
|
+
.is_some_and(|tag| self.text(ast::argument_expression(tag)).is_some())
|
|
176
212
|
}
|
|
177
213
|
}
|
|
178
214
|
|
|
179
|
-
impl Visit for Builder<'_> {
|
|
180
|
-
fn visit_function(&mut self, _: &Function) {}
|
|
181
|
-
fn
|
|
182
|
-
fn
|
|
183
|
-
|
|
184
|
-
Some(value) if js::truthy(&value) => statement.cons.visit_with(self),
|
|
185
|
-
Some(_) => statement.alt.visit_with(self),
|
|
186
|
-
None => statement.visit_children_with(self),
|
|
187
|
-
}
|
|
215
|
+
impl<'a> Visit<'a> for Builder<'a, '_> {
|
|
216
|
+
fn visit_function(&mut self, _: &Function<'a>, _: ScopeFlags) {}
|
|
217
|
+
fn visit_arrow_function_expression(&mut self, _: &ArrowFunctionExpression<'a>) {}
|
|
218
|
+
fn visit_object_property(&mut self, property: &ObjectProperty<'a>) {
|
|
219
|
+
walk_property(self, property);
|
|
188
220
|
}
|
|
189
|
-
fn
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
{
|
|
197
|
-
self.
|
|
198
|
-
} else if let Some(value) = self.value(expression, VALUE_DEPTH) {
|
|
199
|
-
self.values.insert(name, value);
|
|
221
|
+
fn visit_method_definition(&mut self, method: &MethodDefinition<'a>) {
|
|
222
|
+
walk_method(self, method);
|
|
223
|
+
}
|
|
224
|
+
fn visit_if_statement(&mut self, statement: &IfStatement<'a>) {
|
|
225
|
+
match self.value(&statement.test, VALUE_DEPTH) {
|
|
226
|
+
Some(value) if js::truthy(&value) => self.visit_statement(&statement.consequent),
|
|
227
|
+
Some(_) => {
|
|
228
|
+
if let Some(alternate) = &statement.alternate {
|
|
229
|
+
self.visit_statement(alternate);
|
|
200
230
|
}
|
|
201
231
|
}
|
|
202
|
-
|
|
203
|
-
|
|
232
|
+
None => walk::walk_if_statement(self, statement),
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
fn visit_assignment_expression(&mut self, assignment: &AssignmentExpression<'a>) {
|
|
236
|
+
let expression = &assignment.right;
|
|
237
|
+
if let AssignmentTarget::AssignmentTargetIdentifier(name) = &assignment.left {
|
|
238
|
+
let name = self.script.binding(name);
|
|
239
|
+
if let Expression::CallExpression(call) = expression
|
|
240
|
+
&& self.creates(call)
|
|
204
241
|
{
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
{
|
|
209
|
-
*kind = Some(value);
|
|
210
|
-
}
|
|
242
|
+
self.elements.insert(name, None);
|
|
243
|
+
} else if let Some(value) = self.value(expression, VALUE_DEPTH) {
|
|
244
|
+
self.values.insert(name, value);
|
|
211
245
|
}
|
|
212
|
-
|
|
246
|
+
} else if let Some(member) = assigned_member(&assignment.left)
|
|
247
|
+
&& ast::member_str(member) == Some("type")
|
|
248
|
+
&& let Expression::Identifier(name) = member.object()
|
|
249
|
+
&& let Some(value) = self.text(expression)
|
|
250
|
+
&& let Some(kind) = self.elements.get_mut(&self.script.binding(name))
|
|
251
|
+
{
|
|
252
|
+
*kind = Some(value);
|
|
213
253
|
}
|
|
214
254
|
}
|
|
215
|
-
fn
|
|
216
|
-
|
|
255
|
+
fn visit_call_expression(&mut self, call: &CallExpression<'a>) {
|
|
256
|
+
// An optional call's operands may still make calls.
|
|
257
|
+
if is_optional_call(call) {
|
|
258
|
+
walk::walk_call_expression(self, call);
|
|
217
259
|
return;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
260
|
+
}
|
|
261
|
+
if let Some(member) = member(&call.callee) {
|
|
262
|
+
if ast::member_str(member) == Some("setAttribute")
|
|
263
|
+
&& let Expression::Identifier(name) = member.object()
|
|
264
|
+
&& let [key, value] = &call.arguments[..]
|
|
265
|
+
&& let (Some(key), Some(value)) = (
|
|
266
|
+
self.text(ast::argument_expression(key)),
|
|
267
|
+
self.text(ast::argument_expression(value)),
|
|
268
|
+
)
|
|
269
|
+
&& key == "type"
|
|
270
|
+
&& let Some(kind) = self.elements.get_mut(&self.script.binding(name))
|
|
271
|
+
{
|
|
272
|
+
*kind = Some(value);
|
|
230
273
|
}
|
|
274
|
+
} else if let Expression::Identifier(message) = &call.callee
|
|
231
275
|
// Filling a message binds its links, running their queries.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
_ => {}
|
|
276
|
+
&& let Some(queries) = self.declarations.messages.get(&self.script.binding(message))
|
|
277
|
+
{
|
|
278
|
+
self.queried.extend(queries.iter().cloned());
|
|
238
279
|
}
|
|
239
280
|
}
|
|
240
281
|
}
|
|
241
282
|
|
|
242
|
-
/// The name of `function`'s first parameter, if it is a plain identifier.
|
|
243
|
-
fn first_parameter(function: &Function) -> Option<String> {
|
|
244
|
-
Some(function.params.first()?.pat.as_ident()?.id.sym.to_string())
|
|
245
|
-
}
|
|
246
|
-
|
|
247
283
|
/// Returns selectors queried by the checkbox constructor, in order. Includes link-binding
|
|
248
284
|
/// queries from every message it fills; the iframe records all of them.
|
|
249
285
|
pub fn queries(source: &Source, options: &Options) -> Result<Vec<String>> {
|
|
250
|
-
let
|
|
251
|
-
let functions =
|
|
252
|
-
|
|
253
|
-
|
|
286
|
+
let script = source.script();
|
|
287
|
+
let functions: Vec<(SymbolId, &Function)> = script
|
|
288
|
+
.in_declared_functions(|function| Some((function.id.as_ref()?.symbol_id(), function)));
|
|
289
|
+
let mut syntax = Declarations::new(script);
|
|
254
290
|
let mut translators = Vec::new();
|
|
255
|
-
for (name, function) in &functions {
|
|
256
|
-
let (Some(parameter), Some(body)) = (
|
|
291
|
+
for &(name, function) in &functions {
|
|
292
|
+
let (Some(parameter), Some(body)) = (
|
|
293
|
+
function.params.items.first().and_then(plain_parameter),
|
|
294
|
+
&function.body,
|
|
295
|
+
) else {
|
|
257
296
|
continue;
|
|
258
297
|
};
|
|
259
298
|
let mut adapter = Adapters {
|
|
299
|
+
script,
|
|
260
300
|
parameter,
|
|
261
|
-
|
|
301
|
+
html: false,
|
|
302
|
+
translated: Vec::new(),
|
|
303
|
+
forwarded: Vec::new(),
|
|
262
304
|
};
|
|
263
|
-
|
|
305
|
+
adapter.visit_function_body(body);
|
|
264
306
|
if adapter.html {
|
|
265
307
|
// A message function hands the element it fills to a link binder.
|
|
266
|
-
let mut queries = Queries
|
|
308
|
+
let mut queries = Queries {
|
|
309
|
+
script,
|
|
310
|
+
found: Vec::new(),
|
|
311
|
+
};
|
|
267
312
|
for callee in &adapter.forwarded {
|
|
268
|
-
let binder = functions
|
|
313
|
+
let binder = functions
|
|
314
|
+
.iter()
|
|
315
|
+
.find(|(binder, _)| Binding::Symbol(*binder) == *callee);
|
|
269
316
|
if let Some(body) = binder.and_then(|(_, binder)| binder.body.as_ref()) {
|
|
270
|
-
|
|
317
|
+
queries.visit_function_body(body);
|
|
271
318
|
}
|
|
272
319
|
}
|
|
273
|
-
syntax.messages.insert(name
|
|
320
|
+
syntax.messages.insert(Binding::Symbol(name), queries.found);
|
|
274
321
|
}
|
|
275
322
|
translators.push((name, adapter.translated));
|
|
276
323
|
}
|
|
@@ -282,26 +329,31 @@ pub fn queries(source: &Source, options: &Options) -> Result<Vec<String>> {
|
|
|
282
329
|
.iter()
|
|
283
330
|
.find_map(|callee| syntax.messages.get(callee));
|
|
284
331
|
if let Some(queries) = filled {
|
|
285
|
-
translated.insert(name
|
|
332
|
+
translated.insert(Binding::Symbol(name), queries.clone());
|
|
286
333
|
}
|
|
287
334
|
}
|
|
288
335
|
syntax.messages.extend(translated);
|
|
289
336
|
let mut constructors = Vec::new();
|
|
290
|
-
for (_, function) in &functions {
|
|
337
|
+
for &(_, function) in &functions {
|
|
291
338
|
let Some(body) = &function.body else {
|
|
292
339
|
continue;
|
|
293
340
|
};
|
|
294
341
|
let mut builder = Builder {
|
|
342
|
+
script,
|
|
295
343
|
declarations: &syntax,
|
|
296
344
|
options,
|
|
297
|
-
values:
|
|
345
|
+
values: function
|
|
346
|
+
.params
|
|
347
|
+
.items
|
|
348
|
+
.first()
|
|
349
|
+
.and_then(plain_parameter)
|
|
298
350
|
.into_iter()
|
|
299
|
-
.map(|name| (name, JsValue::Bool(true)))
|
|
351
|
+
.map(|name| (Binding::Symbol(name), JsValue::Bool(true)))
|
|
300
352
|
.collect(),
|
|
301
353
|
elements: BTreeMap::new(),
|
|
302
354
|
queried: Vec::new(),
|
|
303
355
|
};
|
|
304
|
-
|
|
356
|
+
builder.visit_function_body(body);
|
|
305
357
|
if builder
|
|
306
358
|
.elements
|
|
307
359
|
.values()
|
|
@@ -4,8 +4,8 @@ use std::collections::BTreeMap;
|
|
|
4
4
|
|
|
5
5
|
use anyhow::{Context, Result, bail, ensure};
|
|
6
6
|
use indexmap::IndexMap;
|
|
7
|
+
use oxc::syntax::operator::BinaryOperator;
|
|
7
8
|
use serde::{Deserialize, Serialize};
|
|
8
|
-
use swc_core::ecma::ast::BinaryOp;
|
|
9
9
|
|
|
10
10
|
use crate::js::{self, JsObject, JsValue};
|
|
11
11
|
use crate::listing::Index;
|
|
@@ -125,7 +125,7 @@ fn read(index: &Index<'_>, pc: u32, argument: &Term, event: Event, element: u32)
|
|
|
125
125
|
"elementFromPoint" => "element_from_point",
|
|
126
126
|
"floor" => {
|
|
127
127
|
let (at, difference) = index.dereference(pc, arguments.first()?)?;
|
|
128
|
-
let Term::Binary(
|
|
128
|
+
let Term::Binary(BinaryOperator::Subtraction, point, _) = difference else {
|
|
129
129
|
return None;
|
|
130
130
|
};
|
|
131
131
|
let coordinate = index.member(at, &point)?;
|
|
@@ -140,7 +140,7 @@ pub(crate) fn measure(
|
|
|
140
140
|
"bubbles":true, "button":0, "buttons":0, "cancelable":true,
|
|
141
141
|
"clientX":client_x, "clientY":client_y, "composed":true, "ctrlKey":false,
|
|
142
142
|
"defaultPrevented":false, "detail":1, "eventPhase":2, "height":1,
|
|
143
|
-
"isPrimary":is_primary, "isTrusted":true, "layerX":(client_x-x).
|
|
143
|
+
"isPrimary":is_primary, "isTrusted":true, "layerX":(client_x-x).floor(), "layerY":(client_y-y).floor(),
|
|
144
144
|
}));
|
|
145
145
|
event.extend(object(json!({
|
|
146
146
|
"movementX":0, "movementY":0, "metaKey":false,
|
|
@@ -250,6 +250,7 @@ mod tests {
|
|
|
250
250
|
assert_eq!(event["screenX"], 101.0);
|
|
251
251
|
assert_eq!(event["screenY"], 145.0);
|
|
252
252
|
assert_eq!(event["offsetY"], 12.0);
|
|
253
|
+
assert_eq!(event["layerY"], 11.0);
|
|
253
254
|
assert_eq!(raw["sources"]["derived"]["relative_y"], 11.0);
|
|
254
255
|
assert_eq!(event["timeStamp"], 123.0);
|
|
255
256
|
assert_eq!(raw["sources"]["element"]["clientWidth"], 168.0);
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
use std::collections::BTreeSet;
|
|
4
4
|
|
|
5
5
|
use anyhow::{Context, Result, bail, ensure};
|
|
6
|
+
use oxc::syntax::operator::BinaryOperator;
|
|
6
7
|
use serde::{Deserialize, Serialize};
|
|
7
|
-
use swc_core::ecma::ast::BinaryOp;
|
|
8
8
|
|
|
9
9
|
use super::{click, diagnostics, initialization, ui};
|
|
10
10
|
use crate::candidates;
|
|
@@ -15,6 +15,7 @@ use crate::stage2::payload::{
|
|
|
15
15
|
self, Document, Environment, Layout, RecordTemplate, Recovered, State,
|
|
16
16
|
};
|
|
17
17
|
use crate::stage2::proof::{Proof, ProofFields};
|
|
18
|
+
use crate::stage2::queries;
|
|
18
19
|
use crate::stage2::records::{ArrangedFields, COMPLETED_STATUS, Completion};
|
|
19
20
|
use crate::vm::{Constant, Effect, Listing, Term};
|
|
20
21
|
|
|
@@ -98,9 +99,6 @@ impl Plan {
|
|
|
98
99
|
|
|
99
100
|
/// Analyzes a returned checkbox program's listing.
|
|
100
101
|
pub fn recover(listing: &Listing) -> Result<Plan> {
|
|
101
|
-
let mut normalized = listing.clone();
|
|
102
|
-
crate::listing::normalize::constants(&mut normalized);
|
|
103
|
-
let listing = &normalized;
|
|
104
102
|
ensure!(
|
|
105
103
|
listing.failures.is_empty(),
|
|
106
104
|
"checkbox program has undecoded instructions"
|
|
@@ -254,7 +252,7 @@ fn envelope(index: &Index<'_>, record: &RecordTemplate) -> Result<Completion> {
|
|
|
254
252
|
.iter()
|
|
255
253
|
.filter(|store| store.object == removed.object && epilogue.contains(&store.pc))
|
|
256
254
|
.collect();
|
|
257
|
-
let [started, finished, duration] =
|
|
255
|
+
let [started, finished, duration] = queries::clock_marks(index, &marked)?;
|
|
258
256
|
Ok(Completion {
|
|
259
257
|
status: status.key.clone(),
|
|
260
258
|
message: message.key.clone(),
|
|
@@ -305,7 +303,7 @@ fn proof_fields(index: &Index<'_>, config_pc: u32) -> Result<ProofFields> {
|
|
|
305
303
|
let destination = match value {
|
|
306
304
|
Term::Cell(_) => &mut hashes,
|
|
307
305
|
Term::Reg(_) => &mut workers,
|
|
308
|
-
Term::Binary(
|
|
306
|
+
Term::Binary(BinaryOperator::Subtraction, _, _) => &mut elapsed,
|
|
309
307
|
_ if index.is_date_now(store.pc, &store.value) => &mut finished,
|
|
310
308
|
_ => bail!("unrecognized proof callback write {}", store.key),
|
|
311
309
|
};
|
|
@@ -364,7 +362,7 @@ fn prefix_option(index: &Index<'_>, before: u32) -> Result<(u32, String)> {
|
|
|
364
362
|
};
|
|
365
363
|
for effect in instruction.effects() {
|
|
366
364
|
if let Effect::Set(_, value) = effect
|
|
367
|
-
&& let Some(key) =
|
|
365
|
+
&& let Some(key) = queries::option_read(index, previous, value)
|
|
368
366
|
{
|
|
369
367
|
options.push((previous, key));
|
|
370
368
|
}
|