Files
flutter_wisetronic/tools/e2e/diag_stack.js
peima 901e42a41b 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 保留)
2026-08-02 00:13:33 +08:00

20 lines
1017 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({ headless: true });
const page = await (await browser.newContext({viewport:{width:1280,height:900}})).newPage();
const logs = [];
page.on('console', m => logs.push(m.text()));
await page.goto('http://127.0.0.1:8099/buy-service/1/ministore', { waitUntil: 'load' }).catch(()=>{});
await page.waitForTimeout(7000);
const stack = logs.filter(l => l.startsWith('CK_STACK'));
if (stack.length) {
// 找 .dart 源文件帧(非 main.dart.js
const dartFrames = stack[0].split('\n').filter(l => l.includes('.dart') && !l.includes('main.dart.js'));
console.log('源文件帧:', dartFrames.length ? dartFrames.slice(0,5).join('\n ') : '(无,全是 main.dart.js)');
// 也看前 3 个 main.dart.js 帧
const jsFrames = stack[0].split('\n').filter(l => l.includes('main.dart.js')).slice(0,4);
console.log('main.dart.js 帧:', jsFrames.join('\n '));
}
await browser.close();
})();