修复
- 修复真实浏览器非 secure context 下 polyfill 调用
crypto.getRandomValues时抛出TypeError: Illegal invocation的问题。 - 根因:原实现对原生 Web Crypto 方法做了解构调用,丢失了
this绑定。 - 修复:polyfill 内部将
getRandomValues绑定到Crypto实例后再调用。
测试
- 新增防回归测试:模拟要求
this的 native-likegetRandomValues,验证 polyfill 后的randomUUID()正常返回合法 UUID v4。 - 全量测试:4/4 通过。
- 构建:
tsc+tsdown全绿。
安装
dsh plugin add @visol-456/dsh-web-compat@0.1.1