Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/script/Test3.js
41144 views
1
var ScriptContext = javax.script.ScriptContext;
2
3
if (key == undefined || key != 'engine value') {
4
throw "unexpected engine scope value";
5
}
6
7
// pre-defined context variable refers to current ScriptContext
8
if (context.getAttribute('key', ScriptContext.GLOBAL_SCOPE) != 'global value') {
9
throw "unexpected global scope value";
10
}
11
12
// change the engine scope value
13
key = 'new engine value';
14
15
if (context.getAttribute('key', ScriptContext.GLOBAL_SCOPE) != 'global value') {
16
throw "global scope should not change here";
17
}
18
19
// delete engine scope value
20
delete key;
21
22
if (key == undefined && key != 'global value') {
23
throw 'global scope should be visible after engine scope removal';
24
}
25
26