| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package com.netscape.javascript.qa.liveconnect.exception; |
| 6 |
|
| 7 |
import com.netscape.javascript.qa.liveconnect.*; |
| 8 |
import netscape.javascript.JSObject; |
| 9 |
import netscape.javascript.JSException; |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
public class Exception_001 extends LiveConnectTest { |
| 21 |
public Exception_001() { |
| 22 |
super(); |
| 23 |
} |
| 24 |
|
| 25 |
public static void main( String[] args ) { |
| 26 |
Exception_001 test = new Exception_001(); |
| 27 |
test.start(); |
| 28 |
} |
| 29 |
public void executeTest() { |
| 30 |
String result = "No exception thrown."; |
| 31 |
|
| 32 |
try { |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
global.eval( "foo.bar = 999;" ); |
| 37 |
|
| 38 |
} catch (Exception e) { |
| 39 |
if ( e instanceof JSException ) { |
| 40 |
result = "JSException thrown!"; |
| 41 |
} else { |
| 42 |
result = "Some random exception thrown!"; |
| 43 |
} |
| 44 |
|
| 45 |
file.exception = e.toString(); |
| 46 |
e.printStackTrace(); |
| 47 |
} finally { |
| 48 |
addTestCase( |
| 49 |
"global.eval(\"foo.bar = 999\") should throw a JavaScript exception:", |
| 50 |
"JSException thrown!", |
| 51 |
result, |
| 52 |
file.exception ); |
| 53 |
} |
| 54 |
} |
| 55 |
} |