Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What? Allow overwriting the `global.crypto` property when polyfilling it. ### Why? #48941 introduced `global.crypto` polyfill. The problem is that if some library (e.g. [xksuid](https://github.com/ValeriaVG/xksuid/blob/main/src/index.node.mjs)) tries to do the same thing, it breaks as `global.crypto` is defined as non-writable[^1]. Arguably libraries should check for `global.crypto` presence before overwriting it BUT I think polyfill should match the actual implementation[^2]. ### How? Make `global.crypto` `enumerable` and `configurable`, as well as define `set` implementation[^3]. [^1]: ![image](https://user-images.githubusercontent.com/7079786/236440322-7bcf1b18-8fcc-4bb9-b9b4-0f2eb032f5ba.png) [^2]: ![image](https://user-images.githubusercontent.com/7079786/236437260-d3abdb0c-134f-4c9d-aab8-de7bf4d7c831.png) [^3]: ![image](https://user-images.githubusercontent.com/7079786/236440393-1c469035-a9f1-4fbe-9ce7-c0308e980510.png) --------- Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
- Loading branch information