From 85d168f9f05976e2102bfaea062a66b412610ef8 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 13 Dec 2023 13:51:57 -0500 Subject: [PATCH] Remove dynamic execution from lite-mode --- ReflectLite.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/ReflectLite.ts b/ReflectLite.ts index 81f71e8..d1f0d0f 100644 --- a/ReflectLite.ts +++ b/ReflectLite.ts @@ -571,16 +571,8 @@ namespace Reflect { }; } - function functionThis() { - try { return Function("return this;")(); } catch (_) { } - } - - function indirectEvalThis() { - try { return (void 0, eval)("(function() { return this; })()"); } catch (_) { } - } - - function sloppyModeThis() { - return functionThis() || indirectEvalThis(); + function sloppyModeThis(): never { + throw new ReferenceError("globalThis could not be found. Please polyfill globalThis before loading this module."); } }) (function (exporter, root) {