1/* The contents of this file are subject to the Netscape Public 2 * License Version 1.1 (the "License"); you may not use this file 3 * except in compliance with the License. You may obtain a copy of 4 * the License at http://www.mozilla.org/NPL/ 5 * 6 * Software distributed under the License is distributed on an "AS 7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 8 * implied. See the License for the specific language governing 9 * rights and limitations under the License. 10 * 11 * The Original Code is Mozilla Communicator client code, released March 12 * 31, 1998. 13 * 14 * The Initial Developer of the Original Code is Netscape Communications 15 * Corporation. Portions created by Netscape are 16 * Copyright (C) 1998 Netscape Communications Corporation. All 17 * Rights Reserved. 18 * 19 * Contributor(s): 20 * 21 */ 22/** 23 File Name: script-001.js 24 Section: 25 Description: new NativeScript object 26 27 28js> parseInt(123,"hi") 29123 30js> parseInt(123, "blah") 31123 32js> s 33js: s is not defined 34js> s = new Script 35 36undefined; 37 38 39js> s = new Script() 40 41undefined; 42 43 44js> s.getJSClass 45js> s.getJSClass = Object.prototype.toString 46function toString() { 47 [native code] 48} 49 50js> s.getJSClass() 51[object Script] 52js> s.compile( "return 3+4" ) 53js: JavaScript exception: javax.javascript.EvaluatorException: "<Scr 54js> s.compile( "3+4" ) 55 563 + 4; 57 58 59js> typeof s 60function 61js> s() 62Jit failure! 63invalid opcode: 1 64Jit Pass1 Failure! 65javax/javascript/gen/c13 initScript (Ljavax/javascript/Scriptable;)V 66An internal JIT error has occurred. Please report this with .class 67jit-bugs@itools.symantec.com 68 697 70js> s.compile("3+4") 71 723 + 4; 73 74 75js> s() 76Jit failure! 77invalid opcode: 1 78Jit Pass1 Failure! 79javax/javascript/gen/c17 initScript (Ljavax/javascript/Scriptable;)V 80An internal JIT error has occurred. Please report this with .class 81jit-bugs@itools.symantec.com 82 837 84js> quit() 85 86C:\src\ns_priv\js\tests\ecma>shell 87 88C:\src\ns_priv\js\tests\ecma>java -classpath c:\cafe\java\JavaScope; 89:\src\ns_priv\js\tests javax.javascript.examples.Shell 90Symantec Java! JustInTime Compiler Version 210.054 for JDK 1.1.2 91Copyright (C) 1996-97 Symantec Corporation 92 93js> s = new Script("3+4") 94 953 + 4; 96 97 98js> s() 997 100js> s2 = new Script(); 101 102undefined; 103 104 105js> s.compile( "3+4") 106 1073 + 4; 108 109 110js> s() 111Jit failure! 112invalid opcode: 1 113Jit Pass1 Failure! 114javax/javascript/gen/c7 initScript (Ljavax/javascript/Scriptable;)V 115An internal JIT error has occurred. Please report this with .class 116jit-bugs@itools.symantec.com 117 1187 119js> quit() 120 Author: christine@netscape.com 121 Date: 12 november 1997 122*/ 123 124 var SECTION = "script-001"; 125 var VERSION = "JS1_3"; 126 var TITLE = "NativeScript"; 127 128 startTest(); 129 writeHeaderToLog( SECTION + " "+ TITLE); 130 131 var testcases = new Array(); 132 133 var s = new Script(); 134 s.getJSClass = Object.prototype.toString; 135 136 testcases[tc++] = new TestCase( SECTION, 137 "var s = new Script(); typeof s", 138 "function", 139 typeof s ); 140 141 testcases[tc++] = new TestCase( SECTION, 142 "s.getJSClass()", 143 "[object Script]", 144 s.getJSClass() ); 145 146 test(); 147function test() { 148 for ( tc=0; tc < testcases.length; tc++ ) { 149 testcases[tc].passed = writeTestCaseResult( 150 testcases[tc].expect, 151 testcases[tc].actual, 152 testcases[tc].description +" = "+ 153 testcases[tc].actual ); 154 155 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; 156 } 157 stopTest(); 158 return ( testcases ); 159} 160