Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / tests / e4x / extensions / extensibility.js
1 /*
2  * Any copyright is dedicated to the Public Domain.
3  * http://creativecommons.org/licenses/publicdomain/
4  * Contributor:
5  *   Jeff Walden <jwalden+code@mit.edu>
6  */
7
8 var gTestfile = 'extensibility.js';
9 //-----------------------------------------------------------------------------
10 var BUGNUMBER = 492849;
11 var summary = 'XML values cannot have their [[Extensible]] property changed';
12
13 print(BUGNUMBER + ": " + summary);
14
15 /**************
16  * BEGIN TEST *
17  **************/
18
19 var x = <foo/>;
20
21 assertEq(Object.isExtensible(x), true);
22
23 try
24 {
25   Object.preventExtensions(x);
26   throw new Error("didn't throw");
27 }
28 catch (e)
29 {
30   assertEq(e instanceof TypeError, true,
31            "xmlValue.[[Extensible]] cannot be changed");
32 }
33
34 assertEq(Object.isExtensible(x), true);
35
36
37 /******************************************************************************/
38
39 if (typeof reportCompare === "function")
40   reportCompare(true, true);
41
42 print("All tests passed!");