diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-05-29 12:49:42 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-05-29 13:47:02 -0700 |
commit | b2e680a109d2a8fbc84e58a2c31b619671a78e8c (patch) | |
tree | b43d073b09705a3bdcba0c261d637df625438a19 /src/runtime.js | |
parent | 4ae305542c80f31b06c5e8325c63ade2bb4a3f33 (diff) |
NO_DYNAMIC_EXECUTION option to disable features using eval() or new Function()
Diffstat (limited to 'src/runtime.js')
-rw-r--r-- | src/runtime.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime.js b/src/runtime.js index 4466a308..96b12294 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -418,12 +418,16 @@ var Runtime = { abort('invalid EM_ASM input |' + source + '|. Please use EM_ASM(..code..) (no quotes) or EM_ASM({ ..code($0).. }, input) (to input values)'); } } +#if NO_DYNAMIC_EXECUTION == 0 try { var evalled = eval('(function(' + args.join(',') + '){ ' + source + ' })'); // new Function does not allow upvars in node } catch(e) { Module.printErr('error in executing inline EM_ASM code: ' + e + ' on: \n\n' + source + '\n\nwith args |' + args + '| (make sure to use the right one out of EM_ASM, EM_ASM_ARGS, etc.)'); throw e; } +#else + abort('NO_DYNAMIC_EXECUTION was set, cannot eval, so EM_ASM is not functional'); +#endif return Runtime.asmConstCache[code] = evalled; }, |