锁定移动壳加载失败测试门禁

移动壳配置检查反查加载失败同源和非主页面测试

共享决策同步移动壳错误页验收边界
This commit is contained in:
2026-06-20 09:31:23 +08:00
parent b921c46afe
commit 888c4bc4d5
2 changed files with 23 additions and 0 deletions
@@ -143,6 +143,11 @@ const webViewHistoryPath = new URL('../src/shell/webViewHistory.ts', import.meta
const webViewHistorySource = fs.readFileSync(webViewHistoryPath, 'utf8');
const loadFailurePath = new URL('../src/shell/loadFailure.ts', import.meta.url);
const loadFailureSource = fs.readFileSync(loadFailurePath, 'utf8');
const loadFailureTestPath = new URL(
'../src/shell/loadFailure.test.ts',
import.meta.url,
);
const loadFailureTestSource = fs.readFileSync(loadFailureTestPath, 'utf8');
const runtimePath = new URL('../src/shell/runtime.ts', import.meta.url);
const runtimeSource = fs.readFileSync(runtimePath, 'utf8');
const safeAreaTestPath = new URL('../src/shell/safeArea.test.ts', import.meta.url);
@@ -1434,6 +1439,23 @@ for (const snippet of [
}
}
for (const snippet of [
"describe('loadFailure'",
"test('归一化同源 HTTP 加载失败'",
"test('忽略外域和非页面加载失败'",
"test('只展示当前主页面失败'",
"url: 'https://example.com/'",
"url: 'about:blank'",
"url: 'javascript:alert(1)'",
"url: '/favicon.ico'",
"url: 'https://app.genarrative.world/assets/main.js'",
"https://app.genarrative.world/creation/puzzle",
]) {
if (!loadFailureTestSource.includes(snippet)) {
throw new Error(`mobile shell load failure tests missing ${snippet}`);
}
}
for (const snippet of [
'MOBILE_WEBVIEW_BLOCKED_DOWNLOAD_PROTOCOLS',
'HOST_BRIDGE_MOBILE_WEBVIEW_BLOCKED_DOWNLOAD_PROTOCOLS',