Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-412926.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-412926.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 412926;
9 var summary = 'JS_ValueToId(cx, JSVAL_NULL) should return atom for "null" string';
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 actual = expect = 'No Errors';
25
26 var obj = { 'null': 1 };
27
28 var errors = [];
29
30 if (!obj.hasOwnProperty(null))
31 errors.push('null property is not owned');
32
33 if (!obj.propertyIsEnumerable(null))
34 errors.push('null property is not enumerable');
35
36 var getter_was_called = false;
37 obj.__defineGetter__(null, function() { getter_was_called = true; return 1; });
38 obj['null'];
39
40 if (!getter_was_called)
41 errors.push('getter was not assigned to the null property');
42
43 var setter_was_called = false;
44 obj.__defineSetter__(null, function() { setter_was_called = true; });
45 obj['null'] = 2;
46
47 if (!setter_was_called)
48 errors.push('setter was not assigned to the null property');
49
50 if (errors.length)
51 actual = errors.join('; ');
52
53 gc();
54
55 reportCompare(expect, actual, summary);
56
57 exitFunc ('test');
58 }