]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_3/Function/regress-49286.js
2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
7 * Software distributed under the License is distributed on an
8 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed
9 * or implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is mozilla.org code.
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation.
17 * All Rights Reserved.
19 * Contributors: jlaprise@delanotech.com,pschwartau@netscape.com
22 * SUMMARY: Invoking try...catch through Function.call
23 * See http://bugzilla.mozilla.org/show_bug.cgi?id=49286
25 * 1) Define a function with a try...catch block in it
26 * 2) Invoke the function via the call method of Function
27 * 3) Pass bad syntax to the try...catch block
28 * 4) We should catch the error!
30 //-------------------------------------------------------------------------------------------------
33 var summary
= 'Invoking try...catch through Function.call';
34 var cnErrorCaught
= 'Error caught';
35 var cnErrorNotCaught
= 'Error NOT caught';
36 var cnGoodSyntax
= '1==2';
37 var cnBadSyntax
= '1=2';
41 var actualvalues
= [];
43 var expectedvalues
= [];
46 var obj
= new testObject();
48 status
= 'Section A of test: direct call of f';
50 expect
= cnErrorCaught
;
53 status
= 'Section B of test: indirect call of f';
55 expect
= cnErrorCaught
;
60 //-----------------------------------------
62 //-----------------------------------------
69 printStatus (summary
);
71 for (var i
=0; i
<UBound
; i
++)
73 reportCompare(expectedvalues
[i
], actualvalues
[i
], statusitems
[i
]);
80 // An object storing bad syntax as a property -
83 this.badSyntax
= cnBadSyntax
;
84 this.goodSyntax
= cnGoodSyntax
;
88 // A function wrapping a try...catch block
99 return cnErrorNotCaught
;
103 // A function wrapping a call to f -
112 statusitems
[UBound
] = status
;
113 actualvalues
[UBound
] = actual
;
114 expectedvalues
[UBound
] = expect
;