jdk/test/javax/script/Test3.js
author prr
Thu, 18 Dec 2014 10:45:45 -0800
changeset 29908 83e2c403fefd
parent 16038 de84354579d3
permissions -rw-r--r--
8067050: Better font consistency checking Reviewed-by: bae, srl, mschoene

var ScriptContext = javax.script.ScriptContext;

if (key == undefined || key != 'engine value') {
    throw "unexpected engine scope value";
}

// pre-defined context variable refers to current ScriptContext
if (context.getAttribute('key', ScriptContext.GLOBAL_SCOPE) != 'global value') {
    throw "unexpected global scope value";
}

// change the engine scope value
key = 'new engine value';

if (context.getAttribute('key', ScriptContext.GLOBAL_SCOPE) != 'global value') {
    throw "global scope should not change here";
}

// delete engine scope value
delete key;

if (key == undefined && key != 'global value') {
    throw 'global scope should be visible after engine scope removal';
}