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 28 js> parseInt(123,"hi") 29 123 30 js> parseInt(123, "blah") 31 123 32 js> s 33 js: s is not defined 34 js> s = new Script 35 36 undefined; 37 38 39 js> s = new Script() 40 41 undefined; 42 43 44 js> s.getJSClass 45 js> s.getJSClass = Object.prototype.toString 46 function toString() { 47 [native code] 48 } 49 50 js> s.getJSClass() 51 [object Script] 52 js> s.compile( "return 3+4" ) 53 js: JavaScript exception: javax.javascript.EvaluatorException: "<Scr 54 js> s.compile( "3+4" ) 55 56 3 + 4; 57 58 59 js> typeof s 60 function 61 js> s() 62 Jit failure! 63 invalid opcode: 1 64 Jit Pass1 Failure! 65 javax/javascript/gen/c13 initScript (Ljavax/javascript/Scriptable;)V 66 An internal JIT error has occurred. Please report this with .class 67 jit-bugs (at) itools.symantec.com 68 69 7 70 js> s.compile("3+4") 71 72 3 + 4; 73 74 75 js> s() 76 Jit failure! 77 invalid opcode: 1 78 Jit Pass1 Failure! 79 javax/javascript/gen/c17 initScript (Ljavax/javascript/Scriptable;)V 80 An internal JIT error has occurred. Please report this with .class 81 jit-bugs (at) itools.symantec.com 82 83 7 84 js> quit() 85 86 C:\src\ns_priv\js\tests\ecma>shell 87 88 C:\src\ns_priv\js\tests\ecma>java -classpath c:\cafe\java\JavaScope; 89 :\src\ns_priv\js\tests javax.javascript.examples.Shell 90 Symantec Java! JustInTime Compiler Version 210.054 for JDK 1.1.2 91 Copyright (C) 1996-97 Symantec Corporation 92 93 js> s = new Script("3+4") 94 95 3 + 4; 96 97 98 js> s() 99 7 100 js> s2 = new Script(); 101 102 undefined; 103 104 105 js> s.compile( "3+4") 106 107 3 + 4; 108 109 110 js> s() 111 Jit failure! 112 invalid opcode: 1 113 Jit Pass1 Failure! 114 javax/javascript/gen/c7 initScript (Ljavax/javascript/Scriptable;)V 115 An internal JIT error has occurred. Please report this with .class 116 jit-bugs (at) itools.symantec.com 117 118 7 119 js> quit() 120 Author: christine (at) 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(); 147 function 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