1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_5/Object/regress-338709.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,74 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +//----------------------------------------------------------------------------- 1.10 +var BUGNUMBER = 338709; 1.11 +var summary = 'ReadOnly properties should not be overwritten by using ' + 1.12 + 'Object and try..throw..catch'; 1.13 +var actual = ''; 1.14 +var expect = ''; 1.15 + 1.16 +printBugNumber(BUGNUMBER); 1.17 +printStatus (summary); 1.18 + 1.19 +Object = function () { return Math }; 1.20 +expect = Math.LN2; 1.21 +try 1.22 +{ 1.23 + throw 1990; 1.24 +} 1.25 +catch (LN2) 1.26 +{ 1.27 +} 1.28 +actual = Math.LN2; 1.29 +print("Math.LN2 = " + Math.LN2) 1.30 + reportCompare(expect, actual, summary); 1.31 + 1.32 +var s = new String("abc"); 1.33 +Object = function () { return s }; 1.34 +expect = s.length; 1.35 +try 1.36 +{ 1.37 + throw -8 1.38 + } 1.39 +catch (length) 1.40 +{ 1.41 +} 1.42 +actual = s.length; 1.43 +print("length of '" + s + "' = " + s.length) 1.44 + reportCompare(expect, actual, summary); 1.45 + 1.46 +var re = /xy/m; 1.47 +Object = function () { return re }; 1.48 +expect = re.multiline; 1.49 +try 1.50 +{ 1.51 + throw false 1.52 + } 1.53 +catch (multiline) 1.54 +{ 1.55 +} 1.56 +actual = re.multiline; 1.57 +print("re.multiline = " + re.multiline) 1.58 + reportCompare(expect, actual, summary); 1.59 + 1.60 +if ("document" in this) { 1.61 + // Let the document be its own documentElement. 1.62 + Object = function () { return document } 1.63 + expect = document.documentElement + ''; 1.64 + try 1.65 + { 1.66 + throw document; 1.67 + } 1.68 + catch (documentElement) 1.69 + { 1.70 + } 1.71 + actual = document.documentElement + ''; 1.72 + print("document.documentElement = " + document.documentElement) 1.73 + } 1.74 +else 1.75 + Object = this.constructor 1.76 + 1.77 + reportCompare(expect, actual, summary);