cfsolve 0.1.4 → 0.1.5
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 +25 -0
- data/README.md +26 -6
- data/UPSTREAM.md +23 -8
- data/lib/cfsolve/profiles/safari-26-ios/answers.json +805 -797
- data/lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +909 -899
- data/lib/cfsolve/version.rb +2 -2
- data/lib/cfsolve.rb +22 -11
- data/vendor/cfsolve/README.md +5 -53
- data/vendor/cfsolve/examples/listing_dump.rs +24 -0
- data/vendor/cfsolve/examples/probe_similarity.rs +37 -0
- data/vendor/cfsolve/examples/rebase_reference.rs +96 -0
- data/vendor/cfsolve/examples/reread_capture.rs +31 -0
- data/vendor/cfsolve/examples/turnstile_smoke.rs +24 -3
- data/vendor/cfsolve/profiles/safari-26-ios/answers.json +805 -797
- data/vendor/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +909 -899
- data/vendor/cfsolve/src/capture/sessions.rs +88 -4
- data/vendor/cfsolve/src/capture.rs +1 -0
- data/vendor/cfsolve/src/deobfuscate/ast.rs +16 -0
- data/vendor/cfsolve/src/deobfuscate/control_flow.rs +1 -1
- data/vendor/cfsolve/src/deobfuscate/dead_branches.rs +33 -0
- data/vendor/cfsolve/src/deobfuscate/merged_functions.rs +24 -4
- data/vendor/cfsolve/src/embedding_page/extra_params.rs +10 -113
- data/vendor/cfsolve/src/embedding_page/page.rs +70 -99
- data/vendor/cfsolve/src/session/initial.rs +6 -7
- data/vendor/cfsolve/src/session/probes.rs +0 -1
- data/vendor/cfsolve/src/stage2/analysis/analyze.rs +4 -33
- data/vendor/cfsolve/src/stage2/analysis/discovery.rs +9 -17
- data/vendor/cfsolve/src/stage2/benchmark.rs +42 -62
- data/vendor/cfsolve/src/stage2/call_stack.rs +133 -227
- data/vendor/cfsolve/src/stage2/challenge_page.rs +10 -3
- data/vendor/cfsolve/src/stage2/probes/dates.rs +0 -44
- data/vendor/cfsolve/src/stage2/probes/parent_info.rs +345 -61
- data/vendor/cfsolve/src/stage2/probes/performance.rs +42 -5
- data/vendor/cfsolve/src/stage2/probes/stack.rs +45 -117
- data/vendor/cfsolve/src/stage2/probes/websocket_echo.rs +7 -76
- data/vendor/cfsolve/src/stage2/probes.rs +0 -1
- data/vendor/cfsolve/src/stage2/reference.json +1 -1
- data/vendor/cfsolve/src/stage2/reference.rs +70 -115
- data/vendor/cfsolve/src/stage2/registry.rs +6 -11
- data/vendor/cfsolve/src/stage2/replay.rs +3 -34
- data/vendor/cfsolve/src/stage2/stylesheets.rs +0 -35
- data/vendor/cfsolve/src/stage2/trace.rs +1 -1
- data/vendor/cfsolve/src/stage2/vocabulary.rs +6 -111
- data/vendor/cfsolve/src/stage2.rs +0 -1
- data/vendor/cfsolve/src/vm/dataflow.rs +15 -6
- data/vendor/cfsolve/src/vm/disassemble.rs +5 -68
- data/vendor/cfsolve/src/vm/encoded_strings.rs +1553 -0
- data/vendor/cfsolve/src/vm/extract.rs +193 -343
- data/vendor/cfsolve/src/vm/interpret/access.rs +2 -10
- data/vendor/cfsolve/src/vm/interpret/builtin.rs +0 -13
- data/vendor/cfsolve/src/vm/interpret/intrinsic.rs +28 -43
- data/vendor/cfsolve/src/vm/interpret/mix32.rs +216 -86
- data/vendor/cfsolve/src/vm/interpret/native_dispatch.rs +42 -21
- data/vendor/cfsolve/src/vm/interpret/pattern.rs +272 -100
- data/vendor/cfsolve/src/vm/interpret/register_helpers.rs +259 -36
- data/vendor/cfsolve/src/vm/interpret/run.rs +0 -4
- data/vendor/cfsolve/src/vm/machine.rs +14 -70
- data/vendor/cfsolve/src/vm/output.rs +3 -5
- data/vendor/cfsolve/src/vm/registers.rs +26 -46
- data/vendor/cfsolve/src/vm/session.rs +11 -9
- data/vendor/cfsolve/src/vm.rs +1 -1
- metadata +6 -12
- data/lib/cfsolve/profiles/chrome-157-macos/answers.json +0 -4777
- data/lib/cfsolve/profiles/chrome-157-macos.json +0 -613
- data/vendor/cfsolve/profiles/chrome-157-macos/answers.json +0 -4777
- data/vendor/cfsolve/profiles/chrome-157-macos.json +0 -613
- data/vendor/cfsolve/src/stage2/fixtures/encoded_benchmark_worker.js +0 -1
- data/vendor/cfsolve/src/stage2/probes/parent_info_array.rs +0 -326
- data/vendor/cfsolve/src/stage2/value_labels.rs +0 -185
- data/vendor/cfsolve/src/vm/encoded_names.rs +0 -635
- data/vendor/cfsolve/src/vm/fixtures/free_functions/README.md +0 -9
- data/vendor/cfsolve/src/vm/fixtures/free_functions/machine.js +0 -7438
- data/vendor/cfsolve/src/vm/fixtures/free_functions/program.base64 +0 -1
|
@@ -31,151 +31,114 @@ pub(crate) static REFERENCE: LazyLock<Reference> = LazyLock::new(|| {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
/// The challenge option (`_cf_chl_opt`) naming the platform segment of a probe's request path.
|
|
34
|
-
pub(crate) const PLATFORM_OPTION: &str = "
|
|
34
|
+
pub(crate) const PLATFORM_OPTION: &str = "_e30715545c342d2c7172508f";
|
|
35
35
|
/// The option holding the session's ray, which the worker fetch requests.
|
|
36
|
-
pub(crate) const RAY_OPTION: &str = "
|
|
36
|
+
pub(crate) const RAY_OPTION: &str = "_b57b772c6cbf614381ea1c9b";
|
|
37
37
|
/// The option holding the nonce the worker fetch requests.
|
|
38
|
-
pub(crate) const NONCE_OPTION: &str = "
|
|
38
|
+
pub(crate) const NONCE_OPTION: &str = "_5f03e51a908e7c7f4a90a1ca";
|
|
39
39
|
|
|
40
40
|
/// Shared result field used by clock and private-token probes.
|
|
41
|
-
pub(crate) const SHARED_RESULT: &str = "
|
|
41
|
+
pub(crate) const SHARED_RESULT: &str = "_62845f21bd76642fe7607006";
|
|
42
42
|
|
|
43
43
|
/// What the clock probe reports when its worker fails.
|
|
44
|
-
pub(crate) const CLOCK_FALLBACK: &str = "
|
|
44
|
+
pub(crate) const CLOCK_FALLBACK: &str = "_7de8bfec8afbfc6c0a7f7228";
|
|
45
45
|
|
|
46
|
-
pub(crate) const DATES_TODAY: &str = "
|
|
47
|
-
pub(crate) const DATES_OFFSET: &str = "
|
|
48
|
-
pub(crate) const DATES_ZONE: &str = "
|
|
46
|
+
pub(crate) const DATES_TODAY: &str = "_8462a594ae41b7c8900438ca";
|
|
47
|
+
pub(crate) const DATES_OFFSET: &str = "_daa71e2bf5d4de20599870b8";
|
|
48
|
+
pub(crate) const DATES_ZONE: &str = "_606c6ae129decf99cc72f7bd";
|
|
49
49
|
|
|
50
|
-
pub(crate) const DOM_MUTATION_RESULT: &str = "
|
|
50
|
+
pub(crate) const DOM_MUTATION_RESULT: &str = "_ab16b242260d08ce77aaf2d7";
|
|
51
51
|
|
|
52
52
|
// Environment and environment-audit names with session-specific replay patches.
|
|
53
53
|
|
|
54
54
|
/// The environment probe's `document.referrer`.
|
|
55
|
-
pub(crate) const ENVIRONMENT_REFERRER: &str = "
|
|
55
|
+
pub(crate) const ENVIRONMENT_REFERRER: &str = "_6adf411141c3ede7490c3a87";
|
|
56
56
|
/// The audit's groups of readers, by the value they read.
|
|
57
|
-
pub(crate) const ENVIRONMENT_AUDIT_GROUPS: &str = "
|
|
57
|
+
pub(crate) const ENVIRONMENT_AUDIT_GROUPS: &str = "_498acb3af906a5f1ad524b55";
|
|
58
58
|
/// The audit's measured values.
|
|
59
|
-
pub(crate) const ENVIRONMENT_AUDIT_VALUES: &str = "
|
|
59
|
+
pub(crate) const ENVIRONMENT_AUDIT_VALUES: &str = "_58775d9322eb1c51ea1c9de3";
|
|
60
60
|
/// Navigation decoded size minus a Server-Timing duration.
|
|
61
|
-
pub(crate) const ENVIRONMENT_AUDIT_REDUCTION: &str = "
|
|
61
|
+
pub(crate) const ENVIRONMENT_AUDIT_REDUCTION: &str = "_fc47349735427db7e5f565e1";
|
|
62
62
|
/// Navigation decoded size.
|
|
63
|
-
pub(crate) const ENVIRONMENT_AUDIT_DECODED: &str = "
|
|
63
|
+
pub(crate) const ENVIRONMENT_AUDIT_DECODED: &str = "_d1e50e6ff9e2ba34399058f3";
|
|
64
64
|
/// Navigation encoded size.
|
|
65
|
-
pub(crate) const ENVIRONMENT_AUDIT_ENCODED: &str = "
|
|
65
|
+
pub(crate) const ENVIRONMENT_AUDIT_ENCODED: &str = "_ea7ac764fd2860c697cbf813";
|
|
66
66
|
/// Whether the probe's frame supports touch events.
|
|
67
|
-
pub(crate) const ENVIRONMENT_AUDIT_TOUCH: &str = "
|
|
67
|
+
pub(crate) const ENVIRONMENT_AUDIT_TOUCH: &str = "_9cd866a3511f517879f4516b";
|
|
68
68
|
/// The probe frame's `isSecureContext` value.
|
|
69
|
-
pub(crate) const ENVIRONMENT_AUDIT_SECURE: &str = "
|
|
69
|
+
pub(crate) const ENVIRONMENT_AUDIT_SECURE: &str = "_05547ddcb67150366764f887";
|
|
70
70
|
/// The value of `Notification.permission`.
|
|
71
|
-
pub(crate) const ENVIRONMENT_AUDIT_PERMISSION: &str = "
|
|
71
|
+
pub(crate) const ENVIRONMENT_AUDIT_PERMISSION: &str = "_ae82ebb109ab253d3f05a980";
|
|
72
72
|
|
|
73
73
|
/// The isolation probe's results for blocked evaluation and cross-origin history writes.
|
|
74
74
|
pub(crate) const ISOLATION_FAILURE_FIELDS: [&str; 2] =
|
|
75
|
-
["
|
|
76
|
-
pub(crate) const STYLESHEETS_TEXT: &str = "
|
|
77
|
-
pub(crate) const STYLESHEETS_HASH: &str = "
|
|
78
|
-
|
|
79
|
-
pub(crate) const ERROR_MESSAGE_LENGTH_RESULT: &str = "
|
|
80
|
-
|
|
81
|
-
pub(crate) const IMAGE_WIDTH: &str = "
|
|
82
|
-
pub(crate) const IMAGE_HEIGHT: &str = "
|
|
83
|
-
pub(crate) const IMAGE_EFFECTIVE_TYPE: &str = "
|
|
84
|
-
pub(crate) const IMAGE_ONLINE: &str = "
|
|
85
|
-
pub(crate) const IMAGE_COMPLETE: &str = "
|
|
86
|
-
pub(crate) const IMAGE_NATURAL_WIDTH: &str = "
|
|
87
|
-
pub(crate) const IMAGE_TIMESTAMP: &str = "
|
|
75
|
+
["_0d933758da8afefe31570be9", "_f25bb13aa3dd8a386af7c1dc"];
|
|
76
|
+
pub(crate) const STYLESHEETS_TEXT: &str = "_fc71c1abadf551a615b367db";
|
|
77
|
+
pub(crate) const STYLESHEETS_HASH: &str = "_137a63be904787b00109cacd";
|
|
78
|
+
|
|
79
|
+
pub(crate) const ERROR_MESSAGE_LENGTH_RESULT: &str = "_81fab77ed2f23f790181a6f7";
|
|
80
|
+
|
|
81
|
+
pub(crate) const IMAGE_WIDTH: &str = "_78a72dd3637eb6fb0b4f86d4";
|
|
82
|
+
pub(crate) const IMAGE_HEIGHT: &str = "_5daa91bb069e46e542190bad";
|
|
83
|
+
pub(crate) const IMAGE_EFFECTIVE_TYPE: &str = "_2d11906e809fc8fd8574d281";
|
|
84
|
+
pub(crate) const IMAGE_ONLINE: &str = "_c744ece5552965265043fa60";
|
|
85
|
+
pub(crate) const IMAGE_COMPLETE: &str = "_8d310517c48e7b458e12ef89";
|
|
86
|
+
pub(crate) const IMAGE_NATURAL_WIDTH: &str = "_8cd60bdd4935672b05587476";
|
|
87
|
+
pub(crate) const IMAGE_TIMESTAMP: &str = "_12b0e3e0814b017bd235bc6e";
|
|
88
88
|
/// What the probe reports as both dimensions when the image fails to load.
|
|
89
|
-
pub(crate) const IMAGE_LOAD_ERROR: &str = "
|
|
89
|
+
pub(crate) const IMAGE_LOAD_ERROR: &str = "_df3d3a69189f46fae9de3d46";
|
|
90
90
|
/// Dimension values reported before the image load finishes.
|
|
91
|
-
pub(crate) const IMAGE_PENDING: &str = "
|
|
91
|
+
pub(crate) const IMAGE_PENDING: &str = "_951054c8356dc7089dd99299";
|
|
92
92
|
/// The key the probe's worker replies with when its deadline passes.
|
|
93
|
-
pub(crate) const IMAGE_WORKER_TIMEOUT: &str = "
|
|
93
|
+
pub(crate) const IMAGE_WORKER_TIMEOUT: &str = "_f91aefe3a5aa9c6bd7b610d8";
|
|
94
94
|
/// A name the probe shares with the other probes that await a promise.
|
|
95
|
-
pub(crate) const IMAGE_AWAITING: &str = "
|
|
96
|
-
|
|
97
|
-
pub(crate) const MEDIA_STATE: &str = "
|
|
98
|
-
pub(crate) const MEDIA_CODECS: &str = "
|
|
99
|
-
pub(crate) const MEDIA_CANDIDATES: &str = "
|
|
100
|
-
pub(crate) const MEDIA_SDP: &str = "
|
|
101
|
-
pub(crate) const MEDIA_SUPPORT: &str = "
|
|
102
|
-
pub(crate) const MEDIA_ICE_STATE: &str = "
|
|
103
|
-
pub(crate) const MEDIA_UNAVAILABLE: &str = "
|
|
104
|
-
pub(crate) const MEDIA_CANDIDATE: &str = "
|
|
105
|
-
pub(crate) const MEDIA_CANDIDATE_TIME: &str = "
|
|
106
|
-
pub(crate) const MEDIA_DATA_CHANNEL: &str = "
|
|
107
|
-
pub(crate) const MEDIA_REUSED: &str = "
|
|
108
|
-
pub(crate) const MEDIA_PRIOR_COUNT: &str = "
|
|
109
|
-
pub(crate) const MEDIA_FIRST_CANDIDATE: &str = "
|
|
110
|
-
pub(crate) const MEDIA_ELAPSED: &str = "
|
|
111
|
-
pub(crate) const MEDIA_CHANNEL_ERROR: &str = "
|
|
112
|
-
pub(crate) const MEDIA_SEED_OFFER_ERROR: &str = "
|
|
113
|
-
pub(crate) const MEDIA_SEED_GATHER_ERROR: &str = "
|
|
95
|
+
pub(crate) const IMAGE_AWAITING: &str = "_68b6422aa18fedc6d9fa7dc3";
|
|
96
|
+
|
|
97
|
+
pub(crate) const MEDIA_STATE: &str = "_f7da15e7ffdacb47a0cdfdf0";
|
|
98
|
+
pub(crate) const MEDIA_CODECS: &str = "_138e30bf2198594f2ded2588";
|
|
99
|
+
pub(crate) const MEDIA_CANDIDATES: &str = "_47d0c4f028335a349928a882";
|
|
100
|
+
pub(crate) const MEDIA_SDP: &str = "_c07cc41874125a9add025bfd";
|
|
101
|
+
pub(crate) const MEDIA_SUPPORT: &str = "_3354f14d23df4b2a88c3fa44";
|
|
102
|
+
pub(crate) const MEDIA_ICE_STATE: &str = "_f6d472be910ab1d7322bbadf";
|
|
103
|
+
pub(crate) const MEDIA_UNAVAILABLE: &str = "_53a4bc8e7faec89e93d6b000";
|
|
104
|
+
pub(crate) const MEDIA_CANDIDATE: &str = "_f6e0345d8c29ab2055f72609";
|
|
105
|
+
pub(crate) const MEDIA_CANDIDATE_TIME: &str = "_b77ac88bc96e1b8f478fee4a";
|
|
106
|
+
pub(crate) const MEDIA_DATA_CHANNEL: &str = "_538af0a1cfc635f286a37a76";
|
|
107
|
+
pub(crate) const MEDIA_REUSED: &str = "_c72defce69f0c94b1c40b17a";
|
|
108
|
+
pub(crate) const MEDIA_PRIOR_COUNT: &str = "_ba31acd3ba1c651c58268d2c";
|
|
109
|
+
pub(crate) const MEDIA_FIRST_CANDIDATE: &str = "_cd80a8ef68163ad6ce4c080e";
|
|
110
|
+
pub(crate) const MEDIA_ELAPSED: &str = "_fa5971a527a24b1a95854b8c";
|
|
111
|
+
pub(crate) const MEDIA_CHANNEL_ERROR: &str = "_5074ccd3d62b20984013a86b";
|
|
112
|
+
pub(crate) const MEDIA_SEED_OFFER_ERROR: &str = "_53089dcf29654deafd766592";
|
|
113
|
+
pub(crate) const MEDIA_SEED_GATHER_ERROR: &str = "_c781a8c6e10f1962d6344856";
|
|
114
114
|
|
|
115
115
|
/// Recognition recovers the network information probe's output names from the probe itself.
|
|
116
116
|
#[cfg(test)]
|
|
117
117
|
pub(crate) const NETWORK_INFORMATION_OUTPUTS: [&str; 6] = [
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
];
|
|
125
|
-
|
|
126
|
-
pub(crate) const PARENT_INFO_REFERRER: &str = "_31a6173d1692e77e5a1005d5";
|
|
127
|
-
/// Parent-page values copied by the document-structure probe.
|
|
128
|
-
pub(crate) const DOCUMENT_ROOT_ATTRIBUTES: &str = "_188bd52b36251eaae9a99374";
|
|
129
|
-
pub(crate) const DOCUMENT_CUSTOM_ELEMENTS: &str = "_301060c5326f9477769f5d8b";
|
|
130
|
-
pub(crate) const PARENT_INFO_MISSING: &str = "_10450802c4fb954516e0c07b";
|
|
131
|
-
pub(crate) const PARENT_INFO_REASONS: &str = "_cd7d13df270697c8781d261c";
|
|
132
|
-
pub(crate) const PARENT_INFO_VISIBILITY: &str = "_4172551fe148377bcda1f7b5";
|
|
133
|
-
/// The output the embedding page's `pad` property is copied to.
|
|
134
|
-
pub(crate) const PARENT_INFO_PAD: &str = "_e5caf599351485e860642415";
|
|
135
|
-
/// Pairs of output fields and parent-info properties copied directly.
|
|
136
|
-
pub(crate) const PARENT_INFO_DIRECT: [(&str, &str); 16] = [
|
|
137
|
-
("_6e1dc8b6953acf52c04a8602", "vDuh"),
|
|
138
|
-
("_4f08666db7270b9f907f663c", "vDie"),
|
|
139
|
-
("_c8cb367a7b94d575149530e3", "xp"),
|
|
140
|
-
("_5ef82acb130f4537ed9aac35", "wp"),
|
|
141
|
-
("_62193c48d482daf2700a995c", "pfp"),
|
|
142
|
-
("_1c113a764991c259adfcf85b", "sL"),
|
|
143
|
-
("_3da484dbed1006c654fac96e", "ssL"),
|
|
144
|
-
("_c74be140015d9b0e3d256c48", "mL"),
|
|
145
|
-
("_d6f250eb3d24cd44d78bab61", "t"),
|
|
146
|
-
("_1d5d7b99f35d507b3a08a437", "tL"),
|
|
147
|
-
("_af146df9ca80117c88f514dd", "lH"),
|
|
148
|
-
("_cf3a9d328d85b9c7f2ae9457", "sR"),
|
|
149
|
-
("_4c7024270fd2a920c7ce5503", "ii"),
|
|
150
|
-
("_e4689550ed6807ca8acfeff4", "ffp"),
|
|
151
|
-
("_fd302ee89388067a1cfa51d9", "pac"),
|
|
152
|
-
(PARENT_INFO_PAD, "pad"),
|
|
153
|
-
];
|
|
154
|
-
/// Pairs of output fields and parent-info properties copied with an empty-string fallback for
|
|
155
|
-
/// falsy values.
|
|
156
|
-
pub(crate) const PARENT_INFO_FALLBACK: [(&str, &str); 4] = [
|
|
157
|
-
("_3bce4851046c22ddb9da2a5b", "vDmt"),
|
|
158
|
-
("_70346a8995cdbf5b1cd02bc7", "vDhp"),
|
|
159
|
-
("_d9c1b344a652122a42aa8fdf", "vDmd"),
|
|
160
|
-
("_1b4e766af5a14e457b0a4459", "vDa"),
|
|
118
|
+
"_916465939c983b0e34932f10",
|
|
119
|
+
"_ee17ddb325bc2672e4632345",
|
|
120
|
+
"_089f27b0144047a027148655",
|
|
121
|
+
"_120472427ce39965f7989ab9",
|
|
122
|
+
"_7fa3fbe4ce55c442d8ce5ffb",
|
|
123
|
+
"_a19915adb31d352013e44e49",
|
|
161
124
|
];
|
|
162
125
|
|
|
163
|
-
pub(crate) const PRIVATE_TOKEN_ELAPSED: &str = "
|
|
164
|
-
pub(crate) const PRIVATE_TOKEN_ERROR: &str = "
|
|
165
|
-
pub(crate) const PRIVATE_TOKEN_TOKEN: &str = "
|
|
166
|
-
pub(crate) const PRIVATE_TOKEN_TIMESTAMP: &str = "
|
|
126
|
+
pub(crate) const PRIVATE_TOKEN_ELAPSED: &str = "_c2752bbd593e00cd0a557236";
|
|
127
|
+
pub(crate) const PRIVATE_TOKEN_ERROR: &str = "_788b80e93e6f07f8df3a191f";
|
|
128
|
+
pub(crate) const PRIVATE_TOKEN_TOKEN: &str = "_ce8d4c2947640b9eeab9edf5";
|
|
129
|
+
pub(crate) const PRIVATE_TOKEN_TIMESTAMP: &str = "_b9520771bad17798d15b6a4d";
|
|
167
130
|
/// The error the probe reports when its worker reaches its deadline.
|
|
168
|
-
pub(crate) const PRIVATE_TOKEN_TIMEOUT_ERROR: &str = "
|
|
131
|
+
pub(crate) const PRIVATE_TOKEN_TIMEOUT_ERROR: &str = "_5f147af36bc5c883dfb4a8f0";
|
|
169
132
|
/// The flag every reply of the probe's worker sets.
|
|
170
|
-
pub(crate) const PRIVATE_TOKEN_WORKER_REPLIED: &str = "
|
|
133
|
+
pub(crate) const PRIVATE_TOKEN_WORKER_REPLIED: &str = "_bd7744733cde9138e62e7c05";
|
|
171
134
|
/// The reply field holding the worker fetch error.
|
|
172
|
-
pub(crate) const PRIVATE_TOKEN_WORKER_ERROR: &str = "
|
|
135
|
+
pub(crate) const PRIVATE_TOKEN_WORKER_ERROR: &str = "_755032ac06c14e942209534c";
|
|
173
136
|
|
|
174
|
-
pub(crate) const WORKER_FETCH_STATUS: &str = "
|
|
175
|
-
pub(crate) const WORKER_FETCH_TOKEN: &str = "
|
|
137
|
+
pub(crate) const WORKER_FETCH_STATUS: &str = "_34ede69a56e30699295d3fe7";
|
|
138
|
+
pub(crate) const WORKER_FETCH_TOKEN: &str = "_04b7567131213446f02e16b1";
|
|
176
139
|
|
|
177
|
-
pub(crate) const WORKER_NAVIGATOR_INDICATOR: &str = "
|
|
178
|
-
pub(crate) const WORKER_NAVIGATOR_RESULT: &str = "
|
|
140
|
+
pub(crate) const WORKER_NAVIGATOR_INDICATOR: &str = "_4151217be1606ceeefdfdccb";
|
|
141
|
+
pub(crate) const WORKER_NAVIGATOR_RESULT: &str = "_bc44d64454a4d30a2e2a50ea";
|
|
179
142
|
|
|
180
143
|
#[cfg(test)]
|
|
181
144
|
mod tests {
|
|
@@ -203,8 +166,6 @@ mod tests {
|
|
|
203
166
|
(Kind::EnvironmentAudit, ENVIRONMENT_AUDIT_SECURE),
|
|
204
167
|
(Kind::EnvironmentAudit, ENVIRONMENT_AUDIT_PERMISSION),
|
|
205
168
|
(Kind::ErrorMessageLength, ERROR_MESSAGE_LENGTH_RESULT),
|
|
206
|
-
(Kind::DocumentStructure, DOCUMENT_ROOT_ATTRIBUTES),
|
|
207
|
-
(Kind::DocumentStructure, DOCUMENT_CUSTOM_ELEMENTS),
|
|
208
169
|
(Kind::Image, PLATFORM_OPTION),
|
|
209
170
|
(Kind::Image, IMAGE_WIDTH),
|
|
210
171
|
(Kind::Image, IMAGE_HEIGHT),
|
|
@@ -234,10 +195,6 @@ mod tests {
|
|
|
234
195
|
(Kind::Media, MEDIA_CHANNEL_ERROR),
|
|
235
196
|
(Kind::Media, MEDIA_SEED_OFFER_ERROR),
|
|
236
197
|
(Kind::Media, MEDIA_SEED_GATHER_ERROR),
|
|
237
|
-
(Kind::ParentInfo, PARENT_INFO_REFERRER),
|
|
238
|
-
(Kind::ParentInfo, PARENT_INFO_MISSING),
|
|
239
|
-
(Kind::ParentInfo, PARENT_INFO_REASONS),
|
|
240
|
-
(Kind::ParentInfo, PARENT_INFO_VISIBILITY),
|
|
241
198
|
(Kind::PrivateToken, PLATFORM_OPTION),
|
|
242
199
|
(Kind::PrivateToken, SHARED_RESULT),
|
|
243
200
|
(Kind::PrivateToken, PRIVATE_TOKEN_ELAPSED),
|
|
@@ -256,8 +213,6 @@ mod tests {
|
|
|
256
213
|
(Kind::WorkerNavigator, WORKER_NAVIGATOR_RESULT),
|
|
257
214
|
];
|
|
258
215
|
names.extend(NETWORK_INFORMATION_OUTPUTS.map(|name| (Kind::NetworkInformation, name)));
|
|
259
|
-
let copied = PARENT_INFO_DIRECT.into_iter().chain(PARENT_INFO_FALLBACK);
|
|
260
|
-
names.extend(copied.map(|(name, _)| (Kind::ParentInfo, name)));
|
|
261
216
|
for (kind, name) in names {
|
|
262
217
|
for &reference in kind.references() {
|
|
263
218
|
assert!(
|
|
@@ -14,8 +14,8 @@ use serde::{Deserialize, Serialize};
|
|
|
14
14
|
use super::analysis::recognize::{Phase, ProbeView};
|
|
15
15
|
use super::probes::{
|
|
16
16
|
clock, dates, dom_mutation, empty, error_message_length, host_reachability, image, media,
|
|
17
|
-
network_information, parent_info,
|
|
18
|
-
|
|
17
|
+
network_information, parent_info, performance, private_token, rects, stack, websocket_echo,
|
|
18
|
+
worker_fetch, worker_navigator,
|
|
19
19
|
};
|
|
20
20
|
use super::{benchmark, proof};
|
|
21
21
|
use crate::embedding_page::page::PageSignals;
|
|
@@ -164,10 +164,6 @@ families! {
|
|
|
164
164
|
worker_fetch, "worker_fetch", Reference, Computed, [4];
|
|
165
165
|
Image { fields: image::Fields } =>
|
|
166
166
|
image, "image", Reference, Computed, [33];
|
|
167
|
-
ParentInfo {} =>
|
|
168
|
-
parent_info, "parent_info", Reference, Computed, [7];
|
|
169
|
-
ParentInfoArray { fields: parent_info_array::Fields } =>
|
|
170
|
-
parent_info_array, "parent_info_array", Structural, Computed, [];
|
|
171
167
|
DateParsingOffsets(dates::Fields) =>
|
|
172
168
|
dates, "date_parsing_offsets", Reference, Computed, [21];
|
|
173
169
|
// The payload publishes the error-message length beside the record.
|
|
@@ -191,6 +187,9 @@ families! {
|
|
|
191
187
|
// Rebuilt from the session's own script. The reference build's stack probe is probe 28.
|
|
192
188
|
Stack { fields: stack::Fields } =>
|
|
193
189
|
stack, "stack", Structural, Computed, [28];
|
|
190
|
+
// Its outputs carry no reference names: it reads the embedding page's signals by index.
|
|
191
|
+
ParentInfo { fields: parent_info::Fields } =>
|
|
192
|
+
parent_info, "parent_info", Structural, Computed, [7];
|
|
194
193
|
HostReachability { fields: host_reachability::Fields } =>
|
|
195
194
|
host_reachability, "host_reachability", Structural, Computed, [];
|
|
196
195
|
WebSocketEcho { fields: websocket_echo::Fields } =>
|
|
@@ -368,11 +367,7 @@ impl Operation {
|
|
|
368
367
|
observed.benchmark.as_ref(),
|
|
369
368
|
"benchmark measurements",
|
|
370
369
|
)?)),
|
|
371
|
-
Self::ParentInfo {} => Ok(
|
|
372
|
-
observed.page_signals.as_ref(),
|
|
373
|
-
"the embedding page's signals",
|
|
374
|
-
)?)),
|
|
375
|
-
Self::ParentInfoArray { fields } => Ok(fields.collect(measured(
|
|
370
|
+
Self::ParentInfo { fields } => Ok(fields.collect(measured(
|
|
376
371
|
observed.page_signals.as_ref(),
|
|
377
372
|
"the embedding page's signals",
|
|
378
373
|
)?)),
|
|
@@ -20,10 +20,9 @@ pub use super::audit_globals::{Globals, Signature};
|
|
|
20
20
|
use super::probes::worker_navigator;
|
|
21
21
|
use super::records::{ArrangedFields, Probe, ProbePlan};
|
|
22
22
|
use super::reference::{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
WORKER_NAVIGATOR_RESULT,
|
|
23
|
+
ENVIRONMENT_AUDIT_DECODED, ENVIRONMENT_AUDIT_ENCODED, ENVIRONMENT_AUDIT_GROUPS,
|
|
24
|
+
ENVIRONMENT_AUDIT_REDUCTION, ENVIRONMENT_AUDIT_VALUES, ENVIRONMENT_REFERRER, REFERENCE,
|
|
25
|
+
STYLESHEETS_HASH, WORKER_NAVIGATOR_RESULT,
|
|
27
26
|
};
|
|
28
27
|
use super::registry::{AUDIT_PROBE, Kind, Operation, Treatment};
|
|
29
28
|
pub use super::stylesheets::Stylesheet;
|
|
@@ -298,8 +297,6 @@ pub struct Session<'session> {
|
|
|
298
297
|
pub controller: Option<&'session str>,
|
|
299
298
|
/// Definitions in the current iframe, used to translate audited globals.
|
|
300
299
|
pub globals: &'session Globals,
|
|
301
|
-
/// Current parent-page values, shared with the loader's page-signals message.
|
|
302
|
-
pub(crate) parent: Option<&'session crate::embedding_page::page::PageSignals>,
|
|
303
300
|
}
|
|
304
301
|
|
|
305
302
|
impl Session<'_> {
|
|
@@ -314,9 +311,6 @@ impl Session<'_> {
|
|
|
314
311
|
for value in fields.values_mut() {
|
|
315
312
|
refresh_transplant(value, self.iframe_url, &self.modified);
|
|
316
313
|
}
|
|
317
|
-
if let Some(parent) = self.parent {
|
|
318
|
-
refresh_parent_page(fields, &parent.root_attributes, &parent.custom_element_tags);
|
|
319
|
-
}
|
|
320
314
|
if let Some(referrer) = fields.get_mut(ENVIRONMENT_REFERRER) {
|
|
321
315
|
*referrer = json!(self.referrer);
|
|
322
316
|
}
|
|
@@ -361,18 +355,6 @@ impl Session<'_> {
|
|
|
361
355
|
}
|
|
362
356
|
}
|
|
363
357
|
|
|
364
|
-
/// The profile's capture page is unrelated to the page currently embedding the widget.
|
|
365
|
-
fn refresh_parent_page(fields: &mut JsObject, attributes: &[String], elements: &[String]) {
|
|
366
|
-
for (field, values) in [
|
|
367
|
-
(DOCUMENT_ROOT_ATTRIBUTES, attributes),
|
|
368
|
-
(DOCUMENT_CUSTOM_ELEMENTS, elements),
|
|
369
|
-
] {
|
|
370
|
-
if let Some(value) = fields.get_mut(field) {
|
|
371
|
-
*value = json!(values);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
358
|
/// Finds the option naming the audit's Server-Timing metric: the first option name after
|
|
377
359
|
/// `decodedBodySize` in the probe's strings, which some builds precede with `_cf_chl_opt`.
|
|
378
360
|
fn timing_option<'f>(features: &'f [String], options: &Options) -> Option<&'f str> {
|
|
@@ -555,19 +537,6 @@ mod tests {
|
|
|
555
537
|
use crate::challenge::installed::Installed;
|
|
556
538
|
use crate::js;
|
|
557
539
|
|
|
558
|
-
#[test]
|
|
559
|
-
fn document_structure_uses_the_current_parent_page() {
|
|
560
|
-
let mut fields = JsObject::from_iter([
|
|
561
|
-
(DOCUMENT_ROOT_ATTRIBUTES.into(), json!([])),
|
|
562
|
-
(DOCUMENT_CUSTOM_ELEMENTS.into(), json!(["old-element"])),
|
|
563
|
-
("other".into(), json!(true)),
|
|
564
|
-
]);
|
|
565
|
-
refresh_parent_page(&mut fields, &["lang".into()], &[]);
|
|
566
|
-
assert_eq!(fields[DOCUMENT_ROOT_ATTRIBUTES], json!(["lang"]));
|
|
567
|
-
assert_eq!(fields[DOCUMENT_CUSTOM_ELEMENTS], json!([]));
|
|
568
|
-
assert_eq!(fields["other"], json!(true));
|
|
569
|
-
}
|
|
570
|
-
|
|
571
540
|
#[test]
|
|
572
541
|
fn audit_globals_keep_their_groups_under_current_names() {
|
|
573
542
|
let mut groups: JsObject = js::from_value(json!({
|
|
@@ -16,41 +16,6 @@ use super::reference::{STYLESHEETS_HASH, STYLESHEETS_TEXT};
|
|
|
16
16
|
use super::registry::Kind;
|
|
17
17
|
use super::vocabulary;
|
|
18
18
|
use crate::js::{JsObject, json};
|
|
19
|
-
use crate::listing::Index;
|
|
20
|
-
use crate::vm::Term;
|
|
21
|
-
|
|
22
|
-
/// The excluded sheet's serialized rules, followed by its numeric index. API loads can move
|
|
23
|
-
/// around the stored field, so recognize `rules.join("|") + index` directly.
|
|
24
|
-
pub(crate) fn text_field(index: &Index<'_>, entry: u32) -> Option<String> {
|
|
25
|
-
let code = index.reachable(entry);
|
|
26
|
-
let fields = index
|
|
27
|
-
.stores()
|
|
28
|
-
.iter()
|
|
29
|
-
.filter(|store| code.contains(&store.pc))
|
|
30
|
-
.filter_map(|store| {
|
|
31
|
-
let (at, Term::Binary(oxc::syntax::operator::BinaryOperator::Addition, left, _)) =
|
|
32
|
-
index.dereference(store.pc, &store.value)?
|
|
33
|
-
else {
|
|
34
|
-
return None;
|
|
35
|
-
};
|
|
36
|
-
let (
|
|
37
|
-
at,
|
|
38
|
-
Term::Call {
|
|
39
|
-
callee, arguments, ..
|
|
40
|
-
},
|
|
41
|
-
) = index.dereference(at, &left)?
|
|
42
|
-
else {
|
|
43
|
-
return None;
|
|
44
|
-
};
|
|
45
|
-
let method = index.method(at, &callee);
|
|
46
|
-
(method.as_deref() == Some("join")
|
|
47
|
-
&& arguments.len() == 1
|
|
48
|
-
&& index.text(at, &arguments[0]).as_deref() == Some("|"))
|
|
49
|
-
.then(|| store.key.clone())
|
|
50
|
-
})
|
|
51
|
-
.collect::<std::collections::BTreeSet<_>>();
|
|
52
|
-
crate::candidates::exactly_one(fields, "excluded stylesheet text").ok()
|
|
53
|
-
}
|
|
54
19
|
|
|
55
20
|
static NAME: LazyLock<Regex> =
|
|
56
21
|
LazyLock::new(|| Regex::new(r"_[0-9a-f]{24}").expect("the session name pattern is valid"));
|
|
@@ -300,7 +300,7 @@ mod tests {
|
|
|
300
300
|
window.pushTrace(value);
|
|
301
301
|
}
|
|
302
302
|
};
|
|
303
|
-
window.vlJM8 = function(p) { return new M(p)
|
|
303
|
+
window.vlJM8 = function(p) { return run(new M(p), 0, 1, []); };
|
|
304
304
|
function start() { window.vlJM8("initial", window); }
|
|
305
305
|
function ready() { window.replaceTrace("fresh-root"); start(); }
|
|
306
306
|
function response(body) {
|
|
@@ -85,8 +85,6 @@ impl Vocabulary {
|
|
|
85
85
|
|
|
86
86
|
fn between<S: AsRef<[String]>>(session: &[S], reference: &[Vec<String>]) -> Self {
|
|
87
87
|
let (partners, candidates) = pair_probes(session, reference);
|
|
88
|
-
let cleaned_session = without_wrapper_names(session.iter().map(AsRef::as_ref));
|
|
89
|
-
let cleaned_reference = without_wrapper_names(reference.iter().map(Vec::as_slice));
|
|
90
88
|
let mut all = Votes::new();
|
|
91
89
|
let mut probes = Vec::with_capacity(session.len());
|
|
92
90
|
for (index, strings) in session.iter().enumerate() {
|
|
@@ -97,25 +95,7 @@ impl Vocabulary {
|
|
|
97
95
|
*all.entry(pair).or_default() += 1;
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
|
-
|
|
101
|
-
if let Some(partner) = partners[index] {
|
|
102
|
-
let mut supplemental = Votes::new();
|
|
103
|
-
for pair in aligned_names(&cleaned_session[index], &cleaned_reference[partner - 1])
|
|
104
|
-
{
|
|
105
|
-
*supplemental.entry(pair).or_default() += 1;
|
|
106
|
-
}
|
|
107
|
-
let consistent = Names::one_to_one(&supplemental);
|
|
108
|
-
for (&(session, reference), &count) in &supplemental {
|
|
109
|
-
if consistent.to_reference.get(session).map(String::as_str) == Some(reference)
|
|
110
|
-
&& !names.to_reference.contains_key(session)
|
|
111
|
-
&& !names.to_session.contains_key(reference)
|
|
112
|
-
{
|
|
113
|
-
names.pair(session.to_owned(), reference.to_owned());
|
|
114
|
-
*all.entry((session, reference)).or_default() += count;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
probes.push(names);
|
|
98
|
+
probes.push(Names::one_to_one(&votes));
|
|
119
99
|
}
|
|
120
100
|
Self {
|
|
121
101
|
global: Names::one_to_one(&all),
|
|
@@ -128,17 +108,17 @@ impl Vocabulary {
|
|
|
128
108
|
/// Replaces name pairs for probe `index` with mappings recovered from its code. Removes any
|
|
129
109
|
/// existing pair involving either name. Used when code analysis identifies a field more
|
|
130
110
|
/// reliably than string alignment.
|
|
131
|
-
pub(crate) fn pin<
|
|
111
|
+
pub(crate) fn pin<'a>(
|
|
132
112
|
&mut self,
|
|
133
113
|
index: usize,
|
|
134
|
-
pairs: impl IntoIterator<Item = (String,
|
|
114
|
+
pairs: impl IntoIterator<Item = (String, &'a str)>,
|
|
135
115
|
) {
|
|
136
116
|
let Some(names) = self.probes.get_mut(index) else {
|
|
137
117
|
return;
|
|
138
118
|
};
|
|
139
119
|
for (session, reference) in pairs {
|
|
140
120
|
// Identical names are kept too, so the program-wide map cannot rename them.
|
|
141
|
-
names.pair(session, reference.
|
|
121
|
+
names.pair(session, reference.to_owned());
|
|
142
122
|
}
|
|
143
123
|
}
|
|
144
124
|
|
|
@@ -197,31 +177,6 @@ impl Vocabulary {
|
|
|
197
177
|
}
|
|
198
178
|
}
|
|
199
179
|
|
|
200
|
-
/// Wrapper names and encrypted diagnostics move independently of probe fields. A second,
|
|
201
|
-
/// conservative alignment omits them and only fills pairs the original alignment left open.
|
|
202
|
-
fn without_wrapper_names<'a>(probes: impl Iterator<Item = &'a [String]>) -> Vec<Vec<String>> {
|
|
203
|
-
let probes: Vec<_> = probes.collect();
|
|
204
|
-
let mut counts = HashMap::new();
|
|
205
|
-
for probe in &probes {
|
|
206
|
-
for text in probe.iter().collect::<HashSet<_>>() {
|
|
207
|
-
*counts.entry(text.as_str()).or_insert(0) += 1;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
probes
|
|
211
|
-
.iter()
|
|
212
|
-
.map(|probe| {
|
|
213
|
-
probe
|
|
214
|
-
.iter()
|
|
215
|
-
.filter(|text| {
|
|
216
|
-
!is_log_message(text)
|
|
217
|
-
&& !(is_name(text) && 4 * counts[text.as_str()] > 3 * probes.len())
|
|
218
|
-
})
|
|
219
|
-
.cloned()
|
|
220
|
-
.collect()
|
|
221
|
-
})
|
|
222
|
-
.collect()
|
|
223
|
-
}
|
|
224
|
-
|
|
225
180
|
/// Renames strings and object keys using `rename`, including randomized names inside longer
|
|
226
181
|
/// strings, such as a list of names or a style rule's selector.
|
|
227
182
|
fn rewrite<'a>(value: &mut JsValue, rename: &impl Fn(&str) -> Option<&'a String>) {
|
|
@@ -229,16 +184,6 @@ fn rewrite<'a>(value: &mut JsValue, rename: &impl Fn(&str) -> Option<&'a String>
|
|
|
229
184
|
JsValue::String(text) => {
|
|
230
185
|
if let Some(name) = rename(text) {
|
|
231
186
|
*text = name.clone();
|
|
232
|
-
} else if matches!(text.trim_start().as_bytes().first(), Some(b'[' | b'{'))
|
|
233
|
-
&& let Ok(mut value) = serde_json::from_str::<JsValue>(text)
|
|
234
|
-
{
|
|
235
|
-
// Some probes serialize structured results before adding them to the record.
|
|
236
|
-
// Canonical labels inside those results need the same translation as arrays.
|
|
237
|
-
let original = value.clone();
|
|
238
|
-
rewrite(&mut value, rename);
|
|
239
|
-
if value != original {
|
|
240
|
-
*text = serde_json::to_string(&value).expect("JSON values serialize");
|
|
241
|
-
}
|
|
242
187
|
} else if let Some(renamed) = rename_embedded(text, rename) {
|
|
243
188
|
*text = renamed;
|
|
244
189
|
}
|
|
@@ -413,11 +358,11 @@ fn aligned_names<'a>(session: &'a [String], reference: &'a [String]) -> Vec<(&'a
|
|
|
413
358
|
let (mut left_names, left_texts): (Vec<_>, Vec<_>) = session[i..run.session]
|
|
414
359
|
.iter()
|
|
415
360
|
.copied()
|
|
416
|
-
.partition(|text| is_name(text)
|
|
361
|
+
.partition(|text| is_name(text));
|
|
417
362
|
let (mut right_names, right_texts): (Vec<_>, Vec<_>) = reference[j..run.reference]
|
|
418
363
|
.iter()
|
|
419
364
|
.copied()
|
|
420
|
-
.partition(|text| is_name(text)
|
|
365
|
+
.partition(|text| is_name(text));
|
|
421
366
|
// Repeats of a name in a row count once, even across non-name text.
|
|
422
367
|
left_names.dedup();
|
|
423
368
|
right_names.dedup();
|
|
@@ -651,11 +596,6 @@ mod tests {
|
|
|
651
596
|
"Math sqrt log1p acosh Qrst1 toString",
|
|
652
597
|
vec![("Abcd1", "Qrst1")],
|
|
653
598
|
),
|
|
654
|
-
(
|
|
655
|
-
"a:b Abcd1 toString c:d toString",
|
|
656
|
-
"a:b Qrst1 c:d toString",
|
|
657
|
-
vec![("Abcd1", "Qrst1")],
|
|
658
|
-
),
|
|
659
599
|
];
|
|
660
600
|
for (session, reference, expected) in cases {
|
|
661
601
|
assert_eq!(
|
|
@@ -665,23 +605,6 @@ mod tests {
|
|
|
665
605
|
}
|
|
666
606
|
}
|
|
667
607
|
|
|
668
|
-
#[test]
|
|
669
|
-
fn shared_wrapper_names_do_not_hide_unmapped_outputs() {
|
|
670
|
-
let session = [
|
|
671
|
-
strings("a:b Wrap1 Abcd1 c:d"),
|
|
672
|
-
strings("e:f Wrap1 c:d"),
|
|
673
|
-
strings("g:h Wrap1 c:d"),
|
|
674
|
-
];
|
|
675
|
-
let reference = [
|
|
676
|
-
strings("a:b Qrst1 c:d"),
|
|
677
|
-
strings("e:f c:d"),
|
|
678
|
-
strings("g:h c:d"),
|
|
679
|
-
];
|
|
680
|
-
let vocabulary = Vocabulary::between(&session, &reference);
|
|
681
|
-
assert_eq!(vocabulary.to_session(0, "Qrst1"), "Abcd1");
|
|
682
|
-
assert_eq!(vocabulary.to_reference(0, "Wrap1"), "Wrap1");
|
|
683
|
-
}
|
|
684
|
-
|
|
685
608
|
/// A probe that shares only three of seven stable strings with its reference still pairs,
|
|
686
609
|
/// as the devtools probe must when a program never names `document`.
|
|
687
610
|
#[test]
|
|
@@ -714,34 +637,6 @@ mod tests {
|
|
|
714
637
|
assert_eq!(vocabulary.global.to_session.len(), 1);
|
|
715
638
|
}
|
|
716
639
|
|
|
717
|
-
#[test]
|
|
718
|
-
fn translates_serialized_results_without_converting_their_schema() {
|
|
719
|
-
let mut vocabulary = Vocabulary::infer(&[strings("geolocation")]);
|
|
720
|
-
vocabulary.pin(0, [("_111111111111111111111111".into(), "geolocation")]);
|
|
721
|
-
let mut fields = JsObject::from_iter([
|
|
722
|
-
("pairs".into(), json!(r#"[["geolocation","denied"]]"#)),
|
|
723
|
-
(
|
|
724
|
-
"objects".into(),
|
|
725
|
-
json!(r#"[{"name":"geolocation","state":"denied"}]"#),
|
|
726
|
-
),
|
|
727
|
-
("unrelated".into(), json!(" [ 1, 2 ]")),
|
|
728
|
-
("invalid".into(), json!("[not JSON")),
|
|
729
|
-
]);
|
|
730
|
-
vocabulary.rewrite_to_session(0, &mut fields);
|
|
731
|
-
assert_eq!(
|
|
732
|
-
fields["pairs"],
|
|
733
|
-
json!(r#"[["_111111111111111111111111","denied"]]"#)
|
|
734
|
-
);
|
|
735
|
-
assert_eq!(
|
|
736
|
-
fields["objects"],
|
|
737
|
-
json!(r#"[{"name":"_111111111111111111111111","state":"denied"}]"#)
|
|
738
|
-
);
|
|
739
|
-
assert_eq!(fields["unrelated"], json!(" [ 1, 2 ]"));
|
|
740
|
-
assert_eq!(fields["invalid"], json!("[not JSON"));
|
|
741
|
-
vocabulary.rewrite_to_reference(0, &mut fields);
|
|
742
|
-
assert_eq!(fields["pairs"], json!(r#"[["geolocation","denied"]]"#));
|
|
743
|
-
}
|
|
744
|
-
|
|
745
640
|
#[test]
|
|
746
641
|
fn pinned_names_replace_aligned_pairs_in_their_probe() {
|
|
747
642
|
let session = [strings("a:b Abcd1 c:d"), strings("e:f Wxyz2 g:h")];
|