Skip to content

Commit 12eec3d

Browse files
committed
chore: protect against running Hermes without block scoped vars
1 parent 1ac9396 commit 12eec3d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

bundler/modules/globals.cjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ if (!Array.prototype.at) {
7070
}
7171

7272
if (process.env.EXODUS_TEST_PLATFORM === 'hermes') {
73+
// Refuse to run if block scoped vars are fake
74+
const r = []
75+
for (let key of [1, 2]) r.push(() => key) // eslint-disable-line prefer-const
76+
if (r[0]() === r[1]()) {
77+
print('‼ FATAL Fake block-scoped vars support detected')
78+
throw new Error('Refusing to run')
79+
}
80+
7381
// Fixed after 0.12, not present in 0.12
7482
// Refs: https://github.com/facebook/hermes/commit/e8fa81328dd630e39975e6d16ac3e6f47f4cba06
7583
if (!Promise.allSettled) {

0 commit comments

Comments
 (0)