scriptpad testing

Andreas Rieber rieberandreas at gmail.com
Wed Jan 23 05:33:45 PST 2013


Hi Sundar,

i have your last changes, did another update and fresh build 1 minute ago:

sh bin/jjs scriptpad.js
scriptpad.js:7 ReferenceError: "JFrame" is not defined

where the scriptpad.js is:

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

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

         createFrame();
     }
}

main();


- Andreas


On 23.01.13 14:22, A. Sundararajan wrote:
> Hi,
>
> Yes, 'sync' is rhino specific.  'with' statement seems to be a bug. 
> I'll file a bug.
>
> I've recently made some changes to jsr223 interface to nashorn. In 
> particular global scope handling and multiple globals per engine etc. 
> have been improved and fixed. Please pull the latest code. And please 
> send us your test cases showing failure.
>
> Thanks,
> -Sundar
>
>
> On Wednesday 23 January 2013 06:01 PM, Andreas Rieber wrote:
>> 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