scriptpad testing

Andreas Rieber rieberandreas at gmail.com
Wed Jan 23 04:31:44 PST 2013


Hi,

i tried now the scriptpad sample from openjdk with Nashorn and have 
found 2 minor issues.

The file: 
jdk8/jdk/src/share/sample/scripting/scriptpad/src/resources/conc.js 
relies on a 'sync' function. Looks to be a Rhino only - so a migration 
issue.

The next one is about scopes in file: 
jdk8/jdk/src/share/sample/scripting/scriptpad/src/resources/scriptpad.js. I 
removed everything unimportant and the following code snippet show the 
problem:

------
var guiPkgs = { JFrame: function() { print("created"); } };

with (guiPkgs) {
     function main() {
         function createFrame() {
             var frame = new JFrame();
         }

         createFrame();
     }
}

main();

------

'created' should come out but JFrame is unknown. I tested this with some 
browsers (Firefox, Safari, Chrome) but only Rhino and Firefox can handle 
that construct.

I had also some more complex problems related to JSR223 but will come 
back with samples when i can separate them better.

- Andreas



More information about the nashorn-dev mailing list