1 if (key == undefined || key != 'engine value') { 2 throw "unexpected engine scope value"; 3 } 4 5 // pre-defined context variable refers to current ScriptContext 6 if (context.getAttribute('key', context.GLOBAL_SCOPE) != 'global value') { 7 throw "unexpected global scope value"; 8 } 9 10 // change the engine scope value 11 key = 'new engine value'; 12 13 if (context.getAttribute('key', context.GLOBAL_SCOPE) != 'global value') { 14 throw "global scope should not change here"; 15 } 16 17 // delete engine scope value 18 delete key; 19 20 if (key == undefined && key != 'xglobal value') { 21 throw 'global scope should be visible after engine scope removal'; 22 }