Commit 1af5e29
js-port: protect runtime-constructed bridge names from ident minification
The screenshot runner (port.js) dispatches the suite's test lambdas by
building their identifier at runtime via string concatenation, e.g.
"cn1_..._Cn1ssDeviceRunner_lambda_" + methodName + "_" + i + "_" + sig
so the FULL generated identifier (".._lambda_runNextTest_2_<sig>") never
appears as a string literal -- only the 77-char stem does. The exact-match
string-literal exclusion therefore missed these, the minifier renamed the
lambda run methods to $M*, and the bridge's name lookup failed:
`lambda2RunBridge:missingDispatch=1`. With no runnable dispatch the
cooperative scheduler parked every thread (runnable=0) and the suite wedged
~28 tests in -> the javascript-screenshots hang/broken-pipe at 85a8e01.
Fix: treat every scanned cn1_ string token as a PREFIX and protect any
generated def that extends it at an identifier-segment boundary, so the
constructed name keeps its canonical identifier. A length floor (16) keeps
the generic construction roots "cn1_" (-> ___INIT__/___CLINIT__, already
skipped) and "cn1_s_" (dispatch-ids in the _qX table, never a def) out of
the prefix set -- "cn1_" as a prefix would match every def and disable all
minification. Over-protecting only forgoes a little size; under-protecting
breaks a name-resolved bridge.
Validated: HelloCodenameOne JS bundle keeps all 30 Cn1ssDeviceRunner lambda
identifiers verbatim while still minifying 12,836 generated functions
(translated_app.js 11.93MB -> 7.69MB, -36%); the local Playwright screenshot
run progresses past the prior wedge with sinceStepMs resetting (no parked
scheduler) instead of hanging.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 85a8e01 commit 1af5e29
1 file changed
Lines changed: 39 additions & 0 deletions
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
268 | 307 | | |
269 | 308 | | |
270 | 309 | | |
| |||
0 commit comments