jdk/test/javax/script/Test3.js
author xdono
Thu, 02 Oct 2008 19:58:32 -0700
changeset 1247 b4c26443dee5
parent 2 90ce3da70b43
child 16038 de84354579d3
permissions -rw-r--r--
6754988: Update copyright year Summary: Update for files that have been modified starting July 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
if (key == undefined || key != 'engine value') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
    throw "unexpected engine scope value";
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
// pre-defined context variable refers to current ScriptContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
if (context.getAttribute('key', context.GLOBAL_SCOPE) != 'global value') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
    throw "unexpected global scope value";
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
// change the engine scope value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
key = 'new engine value';
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
if (context.getAttribute('key', context.GLOBAL_SCOPE) != 'global value') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
    throw "global scope should not change here";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
// delete engine scope value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
delete key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
if (key == undefined && key != 'xglobal value') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
    throw 'global scope should be visible after engine scope removal';
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
}