Debian Codegraph @

rhino/testsrc/tests/e4x/Regress/regress-373082.js

raw symbols SCIP
1 /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 gTestfile = 'regress-373082.js';
8
9 var BUGNUMBER = 373082;
10 var summary = 'Simpler sharing of XML and XMLList functions';
11 var actual = '';
12 var expect = '';
13
14 printBugNumber(BUGNUMBER);
15 START(summary);
16
17 var l;
18
19 expect = '<a/>';
20 l = <><a/></>;
21 actual = l.toXMLString();
22 TEST(1, expect, actual);
23
24 expect = '<b/>';
25 l.setName('b');
26 actual = l.toXMLString();
27 TEST(2, expect, actual);
28
29 expect = '<c/>';
30 XMLList.prototype.function::setName.call(l, 'c');
31 actual = l.toXMLString();
32 TEST(3, expect, actual);
33
34 expect = 't';
35 l = <><a>text</a></>;
36 actual = l.charAt(0);
37 TEST(4, expect, actual);
38
39 expect = 'TypeError: String.prototype.toString called on incompatible XML';
40
41 try
42 {
43 delete XML.prototype.function::toString;
44 delete Object.prototype.toString;
45 actual = <a>TEXT</a>.toString();
46 }
47 catch(ex)
48 {
49 actual = ex + '';
50 }
51 TEST(7, expect, actual);
52
53 expect = 'TypeError: String.prototype.toString called on incompatible XML';
54 try
55 {
56 var x = <a><name/></a>;
57 x.(name == "Foo");
58 print(x.function::name());
59 }
60 catch(ex)
61 {
62 actual = ex + '';
63 }
64 TEST(8, expect, actual);
65
66 try
67 {
68 x = <a><name/></a>;
69 x.(name == "Foo");
70 print(x.name());
71 }
72 catch(ex)
73 {
74 actual = ex + '';
75 }
76 TEST(9, expect, actual);
77
78 END();