Debian Codegraph @

rhino/testsrc/tests/js1_5/Object/regress-338709.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 var gTestfile = 'regress-338709.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 338709;
9 var summary = 'ReadOnly properties should not be overwritten by using ' +
10 'Object and try..throw..catch';
11 var actual = '';
12 var expect = '';
13
14 printBugNumber(BUGNUMBER);
15 printStatus (summary);
16
17 Object = function () { return Math };
18 expect = Math.LN2;
19 try
20 {
21 throw 1990;
22 }
23 catch (LN2)
24 {
25 }
26 actual = Math.LN2;
27 print("Math.LN2 = " + Math.LN2)
28 reportCompare(expect, actual, summary);
29
30 var s = new String("abc");
31 Object = function () { return s };
32 expect = s.length;
33 try
34 {
35 throw -8
36 }
37 catch (length)
38 {
39 }
40 actual = s.length;
41 print("length of '" + s + "' = " + s.length)
42 reportCompare(expect, actual, summary);
43
44 var re = /xy/m;
45 Object = function () { return re };
46 expect = re.multiline;
47 try
48 {
49 throw false
50 }
51 catch (multiline)
52 {
53 }
54 actual = re.multiline;
55 print("re.multiline = " + re.multiline)
56 reportCompare(expect, actual, summary);
57
58 if ("document" in this) {
59 // Let the document be its own documentElement.
60 Object = function () { return document }
61 expect = document.documentElement + '';
62 try
63 {
64 throw document;
65 }
66 catch (documentElement)
67 {
68 }
69 actual = document.documentElement + '';
70 print("document.documentElement = " + document.documentElement)
71 }
72 else
73 Object = this.constructor
74
75 reportCompare(expect, actual, summary);