fix(runtime): onGenerateRoute pathElements 越界 RangeError
- buy-service/renew-minioffice 加长度检查 (pathElements.length >= 4/3) - 根因: Flutter web 深链接渐进式路径解析, onGenerateRoute 被调用多次, pathElements 递增 ([,buy-service] -> [,buy-service,1] -> 完整), 前几次路径短但 pathElements[1]已匹配 -> int.parse([2])/[3] 越界 - 直接访问/刷新 /buy-service/x/y, /renew-minioffice/x 时崩溃 - 恢复 buy_service 实验代码 (data 校验 + mounted 保留)
This commit is contained in:
15
tools/e2e/parse_map.js
Normal file
15
tools/e2e/parse_map.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const fs = require('fs');
|
||||
const { SourceMapConsumer } = require('source-map');
|
||||
(async () => {
|
||||
const mapJson = await (await fetch('http://127.0.0.1:8099/main.dart.js.map')).text().catch(()=>null);
|
||||
if (!mapJson) { console.log('无 sourcemap'); return; }
|
||||
const smc = await new SourceMapConsumer(mapJson);
|
||||
// 解析 299:254 (line:col)
|
||||
const pos = smc.originalPositionFor({ line: 299, column: 254 });
|
||||
console.log('299:254 →', pos.source, pos.line + ':' + pos.column, '|', pos.name);
|
||||
// 也试 299 的前后几行
|
||||
for (const c of [200, 100, 50]) {
|
||||
const p = smc.originalPositionFor({ line: 299, column: c });
|
||||
if (p.source) console.log(`299:${c} →`, p.source.split('/').slice(-2).join('/') + ':' + p.line);
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user