收口移动壳文件诊断日志
移动壳文件 HostBridge 失败日志只记录稳定标签 更新文件失败测试避免断言原生错误对象外泄 扩展移动壳配置门禁禁止文件日志打印原生 error 对象
This commit is contained in:
@@ -2368,6 +2368,14 @@ for (const snippet of [
|
||||
}
|
||||
}
|
||||
|
||||
if (filesSource.includes('console.warn(`mobile HostBridge file failed for ${label}`, error)')) {
|
||||
throw new Error('mobile shell file diagnostics must not log native error objects');
|
||||
}
|
||||
|
||||
if (!filesSource.includes('console.warn(`mobile HostBridge file failed for ${label}`)')) {
|
||||
throw new Error('mobile shell file diagnostics must use stable label-only logging');
|
||||
}
|
||||
|
||||
if (
|
||||
!dispatchSource.includes('exportMobileHostBridgeTextFile(request)') ||
|
||||
!dispatchSource.includes('importMobileHostBridgeTextFile(request)') ||
|
||||
|
||||
@@ -222,7 +222,6 @@ describe('mobile HostBridge file actions', () => {
|
||||
expect(shareAsyncMock).not.toHaveBeenCalled();
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile HostBridge file failed for sharing.available',
|
||||
error,
|
||||
);
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
@@ -252,7 +251,6 @@ describe('mobile HostBridge file actions', () => {
|
||||
]);
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile HostBridge file failed for sharing.open',
|
||||
error,
|
||||
);
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
@@ -329,7 +327,6 @@ describe('mobile HostBridge file actions', () => {
|
||||
});
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile HostBridge file failed for document_picker.open',
|
||||
error,
|
||||
);
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
@@ -357,7 +354,6 @@ describe('mobile HostBridge file actions', () => {
|
||||
});
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile HostBridge file failed for file.read_text',
|
||||
expect.any(Error),
|
||||
);
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
@@ -386,7 +382,6 @@ describe('mobile HostBridge file actions', () => {
|
||||
});
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile HostBridge file failed for file.read_base64',
|
||||
expect.any(Error),
|
||||
);
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
@@ -414,7 +409,6 @@ describe('mobile HostBridge file actions', () => {
|
||||
});
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile HostBridge file failed for file.read_base64',
|
||||
expect.any(Error),
|
||||
);
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
@@ -498,7 +492,6 @@ describe('mobile HostBridge file actions', () => {
|
||||
expect(imageLibraryMock).not.toHaveBeenCalled();
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile HostBridge file failed for image.library_permission',
|
||||
error,
|
||||
);
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
@@ -520,7 +513,6 @@ describe('mobile HostBridge file actions', () => {
|
||||
});
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile HostBridge file failed for image.library_open',
|
||||
error,
|
||||
);
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
@@ -537,7 +529,6 @@ describe('mobile HostBridge file actions', () => {
|
||||
expect(cameraMock).not.toHaveBeenCalled();
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile HostBridge file failed for image.camera_permission',
|
||||
error,
|
||||
);
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
@@ -559,7 +550,6 @@ describe('mobile HostBridge file actions', () => {
|
||||
});
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'mobile HostBridge file failed for image.camera_open',
|
||||
error,
|
||||
);
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
|
||||
@@ -51,8 +51,8 @@ import {
|
||||
} from './filePayloads';
|
||||
import { invalidRequest, ok } from './protocol';
|
||||
|
||||
function logMobileHostBridgeFileFailure(label: string, error: unknown) {
|
||||
console.warn(`mobile HostBridge file failed for ${label}`, error);
|
||||
function logMobileHostBridgeFileFailure(label: string, _error: unknown) {
|
||||
console.warn(`mobile HostBridge file failed for ${label}`);
|
||||
}
|
||||
|
||||
type MobileDocumentPickerOptions = Parameters<
|
||||
|
||||
Reference in New Issue
Block a user