From 40760713ff67b4ea803b1f1062a3cd400870d4a1 Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Tue, 22 Sep 2020 16:48:44 +0800 Subject: [PATCH] fix: engineDisable override Signed-off-by: MiaoWoo --- src/main/java/pw/yumc/MiaoScript/ScriptEngine.java | 4 +--- src/main/resources/core/ployfill.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/pw/yumc/MiaoScript/ScriptEngine.java b/src/main/java/pw/yumc/MiaoScript/ScriptEngine.java index 8c95dca..0108422 100644 --- a/src/main/java/pw/yumc/MiaoScript/ScriptEngine.java +++ b/src/main/java/pw/yumc/MiaoScript/ScriptEngine.java @@ -17,18 +17,16 @@ public class ScriptEngine { private Object logger; private Base base; private MiaoScriptEngine engine; - private ScriptEngineManager manager; public ScriptEngine(String root, Object logger, Object instance) { this.root = root; this.logger = logger; this.base = new Base(instance); - this.manager = new ScriptEngineManager(); } public synchronized MiaoScriptEngine createEngine() { if (this.engine == null) { - this.engine = new MiaoScriptEngine(manager, "nashorn"); + this.engine = new MiaoScriptEngine(new ScriptEngineManager(), "nashorn"); this.engine.put("base", this.base); this.engine.put("ScriptEngineContextHolder", this); } diff --git a/src/main/resources/core/ployfill.js b/src/main/resources/core/ployfill.js index 72700cc..19a25b4 100644 --- a/src/main/resources/core/ployfill.js +++ b/src/main/resources/core/ployfill.js @@ -9,7 +9,7 @@ global.logger = logger; global.ScriptEngineStartTime = new Date().getTime() global.engineLoad = load; - global.noop = global.engineDisable = engineDisable = function () { }; + global.noop = function () { }; global.load = load = function __PreventGlobalLoadFunction__() { throw new Error('Internal engine system not allow use `load` function!'); } global.setGlobal = function (key, value, config) { if (config) {