收口宿主响应回放缓存边界
将 HostBridge 响应回放缓存上限提升到共享契约 让 Expo 移动壳复用共享缓存上限并拒绝本地重声明 让 Tauri 桌面壳配置检查反查共享缓存上限 补充两端回放缓存淘汰测试和壳方案文档
This commit is contained in:
@@ -14,6 +14,8 @@ const bridgePath = new URL('../src/host-bridge/bridge.ts', import.meta.url);
|
||||
const bridgeSource = fs.readFileSync(bridgePath, 'utf8');
|
||||
const dispatchPath = new URL('../src/host-bridge/dispatch.ts', import.meta.url);
|
||||
const dispatchSource = fs.readFileSync(dispatchPath, 'utf8');
|
||||
const protocolPath = new URL('../src/host-bridge/protocol.ts', import.meta.url);
|
||||
const protocolSource = fs.readFileSync(protocolPath, 'utf8');
|
||||
const sharePath = new URL('../src/host-bridge/share.ts', import.meta.url);
|
||||
const shareSource = fs.readFileSync(sharePath, 'utf8');
|
||||
const bridgeDirPath = new URL('../src/host-bridge/', import.meta.url);
|
||||
@@ -671,6 +673,13 @@ if (!hostBridgeSource.includes('function assertImportedFileSizeWithinLimit')) {
|
||||
throw new Error('mobile shell must centralize imported file size checks');
|
||||
}
|
||||
|
||||
if (!bridgeSource.includes('HOST_BRIDGE_RESPONSE_CACHE_MAX,')) {
|
||||
throw new Error('mobile shell bridge must import shared HostBridge response cache limit');
|
||||
}
|
||||
if (/const HOST_BRIDGE_RESPONSE_CACHE_MAX\s*=/.test(protocolSource)) {
|
||||
throw new Error('mobile shell protocol must not redeclare HostBridge response cache limit');
|
||||
}
|
||||
|
||||
for (const [functionName, readCall] of [
|
||||
['importTextFile', 'file.text()'],
|
||||
['importDocumentFile', 'file.base64()'],
|
||||
|
||||
Reference in New Issue
Block a user