]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_3/Object/regress-72773.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 "AS IS"
8 * 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. All
19 * Contributor(s): pschwartau@netscape.com
22 * SUMMARY: Regression test: we shouldn't crash on this code
23 * See http://bugzilla.mozilla.org/show_bug.cgi?id=72773
25 * See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property.
27 * Same as class-001.js - but testing user-defined types here, not native types.
28 * Therefore we expect the [[Class]] property to equal 'Object' in each case -
30 * The getJSClass() function we use is in a utility file, e.g. "shell.js"
32 //-------------------------------------------------------------------------------------------------
34 var summary
= "Regression test: we shouldn't crash on this code";
41 * This code should produce an error, but not a crash.
42 * 'TypeError: Function.prototype.toString called on incompatible object'
44 sToEval
+= 'function Cow(name){this.name = name;}'
45 sToEval
+= 'function Calf(str){this.name = str;}'
46 sToEval
+= 'Calf.prototype = Cow;'
47 sToEval
+= 'new Calf().toString();'
49 status
= 'Trying to catch an expected error';
56 actual
= getJSClass(e
);
61 //----------------------------------------------------------------------------------------------
63 //----------------------------------------------------------------------------------------------
70 printStatus (summary
);
72 reportCompare(expect
, actual
, status
);