Skip to content

Commit

Permalink
Merge pull request #149 from rbuckton/lite-mode-no-dynamic-eval
Browse files Browse the repository at this point in the history
No dynamic evaluation in `/lite` mode
  • Loading branch information
rbuckton authored Dec 13, 2023
2 parents 893db5d + 85d168f commit 68fd019
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions ReflectLite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 68fd019

Please sign in to comment.