michael@0: // |reftest| skip -- obsolete test michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var UBound = 0; michael@0: var BUGNUMBER = 99663; michael@0: var summary = 'Regression test for Bugzilla bug 99663'; michael@0: /* michael@0: * This testcase expects error messages containing michael@0: * the phrase 'read-only' or something similar - michael@0: */ michael@0: var READONLY = /read\s*-?\s*only/; michael@0: var READONLY_TRUE = 'a "read-only" error'; michael@0: var READONLY_FALSE = 'Error: '; michael@0: var FAILURE = 'NO ERROR WAS GENERATED!'; michael@0: var status = ''; michael@0: var actual = ''; michael@0: var expect= ''; michael@0: var statusitems = []; michael@0: var expectedvalues = []; michael@0: var actualvalues = []; michael@0: michael@0: michael@0: /* michael@0: * These MUST be compiled in JS1.2 or less for the test to work - see above michael@0: */ michael@0: function f1() michael@0: { michael@0: with (it) michael@0: { michael@0: for (rdonly in this); michael@0: } michael@0: } michael@0: michael@0: michael@0: function f2() michael@0: { michael@0: for (it.rdonly in this); michael@0: } michael@0: michael@0: michael@0: function f3(s) michael@0: { michael@0: for (it[s] in this); michael@0: } michael@0: michael@0: michael@0: michael@0: /* michael@0: * Begin testing by capturing actual vs. expected values. michael@0: * Initialize to FAILURE; this will get reset if all goes well - michael@0: */ michael@0: actual = FAILURE; michael@0: try michael@0: { michael@0: f1(); michael@0: } michael@0: catch(e) michael@0: { michael@0: actual = readOnly(e.message); michael@0: } michael@0: expect= READONLY_TRUE; michael@0: status = 'Section 1 of test - got ' + actual; michael@0: addThis(); michael@0: michael@0: michael@0: actual = FAILURE; michael@0: try michael@0: { michael@0: f2(); michael@0: } michael@0: catch(e) michael@0: { michael@0: actual = readOnly(e.message); michael@0: } michael@0: expect= READONLY_TRUE; michael@0: status = 'Section 2 of test - got ' + actual; michael@0: addThis(); michael@0: michael@0: michael@0: actual = FAILURE; michael@0: try michael@0: { michael@0: f3('rdonly'); michael@0: } michael@0: catch(e) michael@0: { michael@0: actual = readOnly(e.message); michael@0: } michael@0: expect= READONLY_TRUE; michael@0: status = 'Section 3 of test - got ' + actual; michael@0: addThis(); michael@0: michael@0: michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: test(); michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: michael@0: michael@0: function readOnly(msg) michael@0: { michael@0: if (msg.match(READONLY)) michael@0: return READONLY_TRUE; michael@0: return READONLY_FALSE + msg; michael@0: } michael@0: michael@0: michael@0: function addThis() michael@0: { michael@0: statusitems[UBound] = status; michael@0: actualvalues[UBound] = actual; michael@0: expectedvalues[UBound] = expect; michael@0: UBound++; michael@0: } michael@0: michael@0: michael@0: function test() michael@0: { michael@0: print ('Bug Number ' + bug); michael@0: print ('STATUS: ' + summary); michael@0: michael@0: for (var i=0; i