aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorsundar <none@none>2013-06-25 17:31:19 +0530
committersundar <none@none>2013-06-25 17:31:19 +0530
commita9a2ed85a9d62a72c533757a98e1921c2a63801c (patch)
tree4856d49ed974a471a6a21a850718f4430cbd8352 /docs
parent5f4c00d79588a3d6b2fb9a827b7b688f151ed25c (diff)
downloadnashorn-a9a2ed85a9d62a72c533757a98e1921c2a63801c.tar.gz
8015969: Needs to enforce and document that global "context" and "engine" can't be modified when running via jsr223
Reviewed-by: hannesw, jlaskey
Diffstat (limited to 'docs')
-rw-r--r--docs/JavaScriptingProgrammersGuide.html10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/JavaScriptingProgrammersGuide.html b/docs/JavaScriptingProgrammersGuide.html
index a9803f7f..18ae823d 100644
--- a/docs/JavaScriptingProgrammersGuide.html
+++ b/docs/JavaScriptingProgrammersGuide.html
@@ -227,6 +227,16 @@ access the variable - for example, it can call public methods on
it. Note that the syntax to access Java objects, methods and fields
is dependent on the scripting language. JavaScript supports the
most "natural" Java-like syntax.</p>
+<p>
+Nashorn script engine pre-defines two global variables named "context"
+and "engine". The "context" variable is of type javax.script.ScriptContext
+and refers to the current ScriptContext instance passed to script engine's
+eval method. The "engine" variable is of type javax.script.ScriptEngine and
+refers to the current nashorn script engine instance evaluating the script.
+Both of these variables are non-writable, non-enumerable and non-configurable
+- which implies script code can not write overwrite the value, for..loop iteration
+on global object will not iterate these variables and these variables can not be
+deleted by script.
<pre><code>
// <a href="source/ScriptVars.java">ScriptVars.java</a>