Check existence of navigator before using it#1475
Conversation
Co-authored-by: larabr <larabr+github@protonmail.com>
cd26a42 to
3c421d4
Compare
| } | ||
|
|
||
| return navigator.hardwareConcurrency || 1; | ||
| return (typeof navigator !== 'undefined' && navigator.hardwareConcurrency) || 1; |
There was a problem hiding this comment.
I appreciate you trying to fix this problem, but just so you know: it doesn't fix the Cloudfare issue because it's still accessing a prohibited API. The mere attempt to read navigator is what's not allowed.
I tried to explain that in my pull request.
I will try to check with cloudflare if they could allow code like this to "pass"... but I thought you would be interested in knowing that.
There was a problem hiding this comment.
I understand - but even after your PR, you still had to shim util.isEdge, afaiu - after this PR and #1474, you can shim util.getHardwareConcurrency instead :)
Other than that, please do check with Cloudflare, as this is the standard way to check for the existence of global objects, it shouldn't cause issues.
Fix #1464. Depends on #1474.