收口移动壳剪贴板诊断日志
移动壳剪贴板 HostBridge 失败日志只记录稳定标签 更新剪贴板失败测试避免断言原生错误对象外泄 扩展移动壳配置门禁禁止剪贴板日志打印原生 error 对象
This commit is contained in:
@@ -2473,6 +2473,12 @@ for (const snippet of [
|
||||
throw new Error(`mobile shell clipboard module is missing ${snippet}`);
|
||||
}
|
||||
}
|
||||
if (clipboardSource.includes('console.warn(`mobile clipboard failed for ${label}`, error)')) {
|
||||
throw new Error('mobile shell clipboard diagnostics must not log native error objects');
|
||||
}
|
||||
if (!clipboardSource.includes('console.warn(`mobile clipboard failed for ${label}`)')) {
|
||||
throw new Error('mobile shell clipboard diagnostics must use stable label-only logging');
|
||||
}
|
||||
if (!clipboardTestSource.includes("'猫'.repeat(100000)")) {
|
||||
throw new Error('mobile shell clipboard tests must cover Unicode truncation');
|
||||
}
|
||||
|
||||
@@ -779,7 +779,6 @@ describe('handleMobileHostBridgeMessage', () => {
|
||||
expect(failedResponse.error.code).toBe('host_error');
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile clipboard failed for read.get_string',
|
||||
nativeError,
|
||||
);
|
||||
} finally {
|
||||
warnSpy.mockRestore();
|
||||
|
||||
@@ -77,7 +77,6 @@ describe('mobile clipboard helpers', () => {
|
||||
});
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile clipboard failed for write.set_string',
|
||||
nativeError,
|
||||
);
|
||||
} finally {
|
||||
warnSpy.mockRestore();
|
||||
@@ -163,7 +162,6 @@ describe('mobile clipboard helpers', () => {
|
||||
});
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile clipboard failed for read.get_string',
|
||||
nativeError,
|
||||
);
|
||||
} finally {
|
||||
warnSpy.mockRestore();
|
||||
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
} from '../../../../packages/shared/src/contracts/hostBridge';
|
||||
import { invalidRequest, ok } from './protocol';
|
||||
|
||||
function logMobileClipboardFailure(label: string, error: unknown) {
|
||||
console.warn(`mobile clipboard failed for ${label}`, error);
|
||||
function logMobileClipboardFailure(label: string, _error: unknown) {
|
||||
console.warn(`mobile clipboard failed for ${label}`);
|
||||
}
|
||||
|
||||
export async function writeMobileClipboardText(rawText: unknown) {
|
||||
|
||||
Reference in New Issue
Block a user