regress-338709.js (1630B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 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 //----------------------------------------------------------------------------- 7 var BUGNUMBER = 338709; 8 var summary = 'ReadOnly properties should not be overwritten by using ' + 9 'Object and try..throw..catch'; 10 var actual = ''; 11 var expect = ''; 12 13 printBugNumber(BUGNUMBER); 14 printStatus (summary); 15 16 Object = function () { return Math }; 17 expect = Math.LN2; 18 try 19 { 20 throw 1990; 21 } 22 catch (LN2) 23 { 24 } 25 actual = Math.LN2; 26 print("Math.LN2 = " + Math.LN2) 27 reportCompare(expect, actual, summary); 28 29 var s = new String("abc"); 30 Object = function () { return s }; 31 expect = s.length; 32 try 33 { 34 throw -8 35 } 36 catch (length) 37 { 38 } 39 actual = s.length; 40 print("length of '" + s + "' = " + s.length) 41 reportCompare(expect, actual, summary); 42 43 var re = /xy/m; 44 Object = function () { return re }; 45 expect = re.multiline; 46 try 47 { 48 throw false 49 } 50 catch (multiline) 51 { 52 } 53 actual = re.multiline; 54 print("re.multiline = " + re.multiline) 55 reportCompare(expect, actual, summary); 56 57 if ("document" in this) { 58 // Let the document be its own documentElement. 59 Object = function () { return document } 60 expect = document.documentElement + ''; 61 try 62 { 63 throw document; 64 } 65 catch (documentElement) 66 { 67 } 68 actual = document.documentElement + ''; 69 print("document.documentElement = " + document.documentElement) 70 } 71 else 72 Object = this.constructor 73 74 reportCompare(expect, actual, summary);