MCPcopy Create free account
hub / github.com/mozilla/rhino / Context

Class Context

rhino/src/main/java/org/mozilla/javascript/Context.java:60–3049  ·  view source on GitHub ↗

This class represents the runtime context of an executing script. Before executing a script, an instance of Context must be created and associated with the thread that will be executing the script. The Context will be used to store information about the executing of the script such as the call s

Source from the content-addressed store, hash-verified

58 * @author Brendan Eich
59 */
60public class Context implements Closeable {
61 /**
62 * Language versions.
63 *
64 * <p>All integral values are reserved for future version numbers.
65 */
66
67 /**
68 * The unknown version.
69 *
70 * <p>Be aware, this version will not support many of the newer language features and will not
71 * change in the future. In practice, for historical reasons, this is an odd version that
72 * doesn't necessarily match any particular version of JavaScript and should not be used.
73 *
74 * <p>Please use one of the other constants like {@link #VERSION_ECMASCRIPT} to get support for
75 * recent language features.
76 */
77 public static final int VERSION_UNKNOWN = -1;
78
79 /**
80 * The default version for older versions of Rhino.
81 *
82 * <p>Be aware, this version will not support many of the newer language features and will not
83 * change in the future. In practice, for historical reasons, this is an odd version that
84 * doesn't necessarily match any particular version of JavaScript and should not be used,
85 * although many older scripts and many tests may depend on it.
86 *
87 * <p>Please use one of the other constants like {@link #VERSION_ECMASCRIPT} to get support for
88 * recent language features.
89 */
90 public static final int VERSION_DEFAULT = 0;
91
92 /** JavaScript 1.5 */
93 public static final int VERSION_1_5 = 150;
94
95 /** JavaScript 1.6 */
96 public static final int VERSION_1_6 = 160;
97
98 /** JavaScript 1.7 */
99 public static final int VERSION_1_7 = 170;
100
101 /** JavaScript 1.8 */
102 public static final int VERSION_1_8 = 180;
103
104 /**
105 * ECMAScript 6 and after. This constant refers to the latest version of the language, and is
106 * mostly identical to {@link #VERSION_ECMASCRIPT}. The difference is that features that may
107 * cause existing code to break, such as enforcement of "const" and strict mode checks, are not
108 * enabled.
109 *
110 * <p>As of version 1.8, this is the default language version.
111 */
112 public static final int VERSION_ES6 = 200;
113
114 /**
115 * The current version of JavaScript as defined by ECMAScript. This version will always refer to
116 * the latest version of the language that Rhino supports. This will include everything in
117 * {@link #VERSION_ES6}, plus features that may cause backward incompatibility, such as

Callers

nothing calls this directly

Calls 2

classOrNullMethod · 0.95

Tested by

no test coverage detected