Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-449657.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-449657.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 449657;
9 var summary = 'JS_SealObject on Arrays';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 if (typeof seal != 'function')
25 {
26 expect = actual = 'JS_SealObject not supported, test skipped.';
27 reportCompare(expect, actual, summary);
28 }
29 else
30 {
31 try
32 {
33 var a= [1, 2, 3];
34 seal(a);
35 }
36 catch(ex)
37 {
38 actual = ex + '';
39 }
40 reportCompare(expect, actual, summary + ': 1');
41
42 expect = 'Error: a.length is read-only';
43 actual = '';
44 try
45 {
46 a = [1,2,3];
47 a[4] = 2;
48 seal(a);
49 a.length = 5;
50 }
51 catch(ex)
52 {
53 actual = ex + '';
54 }
55 reportCompare(expect, actual, summary + ': 2');
56 }
57
58 exitFunc ('test');
59 }