收口H5原生能力门控
H5 原生导航和支付能力统一通过 canUseNativeHostCapability 门控 原生壳门禁禁止 H5 facade 直接读取宿主能力数组 架构文档记录 H5 原生能力统一门控规则
This commit is contained in:
@@ -1149,6 +1149,33 @@ function assertH5HostBridgePayloadBoundaries() {
|
||||
'H5 HostBridge facade must normalize app.setTitle payloads with the shared title boundary',
|
||||
);
|
||||
}
|
||||
for (const nativeCapability of [
|
||||
'navigation.openNativePage',
|
||||
'auth.requestLogin',
|
||||
'payment.request',
|
||||
]) {
|
||||
if (
|
||||
h5HostBridgeSource.includes(
|
||||
`runtime.hostCapabilities.includes('${nativeCapability}')`,
|
||||
) ||
|
||||
h5HostBridgeSource.includes(
|
||||
`runtime.hostCapabilities.includes("${nativeCapability}")`,
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
`H5 HostBridge facade must gate ${nativeCapability} through canUseNativeHostCapability()`,
|
||||
);
|
||||
}
|
||||
if (
|
||||
!h5HostBridgeSource.includes(
|
||||
`canUseNativeHostCapability('${nativeCapability}')`,
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
`H5 HostBridge facade must check ${nativeCapability} with canUseNativeHostCapability()`,
|
||||
);
|
||||
}
|
||||
}
|
||||
for (const importBoundary of [
|
||||
{
|
||||
functionName: 'importHostTextFile',
|
||||
|
||||
Reference in New Issue
Block a user