From 8a77a443db7cb452ad000fec88bf5250ecd2dc8e Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Tue, 15 Jul 2014 16:54:01 +0530 Subject: [PATCH] 8050432: javax.script.filename variable should not be enumerable with nashorn engine's ENGINE_SCOPE bindings Reviewed-by: jlaskey --- .../jdk/nashorn/internal/objects/Global.java | 2 + nashorn/test/script/basic/JDK-8015969.js | 18 --------- nashorn/test/script/basic/JDK-8050432.js | 40 +++++++++++++++++++ .../api/scripting/ScriptEngineTest.java | 14 +++++++ 4 files changed, 56 insertions(+), 18 deletions(-) create mode 100644 nashorn/test/script/basic/JDK-8050432.js diff --git a/nashorn/src/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk/nashorn/internal/objects/Global.java index 5d28c1efd74..1c7e96b5a2c 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/Global.java +++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java @@ -1763,6 +1763,8 @@ public final class Global extends ScriptObject implements Scope { final int NOT_ENUMERABLE_NOT_CONFIG = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE; scontextProperty = addOwnProperty("context", NOT_ENUMERABLE_NOT_CONFIG, null); addOwnProperty("engine", NOT_ENUMERABLE_NOT_CONFIG, engine); + // default file name + addOwnProperty(ScriptEngine.FILENAME, Attribute.NOT_ENUMERABLE, null); // __noSuchProperty__ hook for ScriptContext search of missing variables final ScriptFunction noSuchProp = ScriptFunctionImpl.makeStrictFunction(NO_SUCH_PROPERTY_NAME, NO_SUCH_PROPERTY); addOwnProperty(NO_SUCH_PROPERTY_NAME, Attribute.NOT_ENUMERABLE, noSuchProp); diff --git a/nashorn/test/script/basic/JDK-8015969.js b/nashorn/test/script/basic/JDK-8015969.js index c8f8ca6817a..782d5929bf6 100644 --- a/nashorn/test/script/basic/JDK-8015969.js +++ b/nashorn/test/script/basic/JDK-8015969.js @@ -36,24 +36,6 @@ e.eval(<