Debian Codegraph @

js/src/tests/non262/extensions/regress-412926.js

raw
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 = 412926;
8 var summary = 'JS_ValueToId(cx, JSVAL_NULL) should return atom for "null" string';
9 var actual = '';
10 var expect = '';
11
12
13 //-----------------------------------------------------------------------------
14 test();
15 //-----------------------------------------------------------------------------
16
17 function test()
18 {
19 printBugNumber(BUGNUMBER);
20 printStatus (summary);
21
22 actual = expect = 'No Errors';
23
24 var obj = { 'null': 1 };
25
26 var errors = [];
27
28 if (!obj.hasOwnProperty(null))
29 errors.push('null property is not owned');
30
31 if (!obj.propertyIsEnumerable(null))
32 errors.push('null property is not enumerable');
33
34 var getter_was_called = false;
35 obj.__defineGetter__(null, function() { getter_was_called = true; return 1; });
36 obj['null'];
37
38 if (!getter_was_called)
39 errors.push('getter was not assigned to the null property');
40
41 var setter_was_called = false;
42 obj.__defineSetter__(null, function() { setter_was_called = true; });
43 obj['null'] = 2;
44
45 if (!setter_was_called)
46 errors.push('setter was not assigned to the null property');
47
48 if (errors.length)
49 actual = errors.join('; ');
50
51 gc();
52
53 reportCompare(expect, actual, summary);
54 }