Debian Codegraph @

js/src/tests/non262/extensions/uneval/regress-367629.js

raw
1 // |reftest| skip-if(!this.uneval)
2
3 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8
9 //-----------------------------------------------------------------------------
10 var BUGNUMBER = 367629;
11 var summary = 'Decompilation of result with native function as getter';
12 var actual = '';
13 var expect = '';
14
15
16 //-----------------------------------------------------------------------------
17 test();
18 //-----------------------------------------------------------------------------
19
20 function test()
21 {
22 printBugNumber(BUGNUMBER);
23 printStatus (summary);
24
25 var a =
26 Object.defineProperty({}, "h",
27 {
28 get: encodeURI,
29 enumerable: true,
30 configurable: true
31 });
32
33 expect = '({get h() {[native code]}})';
34 actual = uneval(a);
35
36 // Native function syntax:
37 // `function IdentifierName_opt ( FormalParameters ) { [ native code ] }`
38
39 // The placement of whitespace characters in the native function's body is
40 // implementation-dependent, so we need to replace those for this test.
41 var re = new RegExp(["\\{", "\\[", "native", "code", "\\]", "\\}"].join("\\s*"));
42 actual = actual.replace(re, "{[native code]}");
43
44 compareSource(expect, actual, summary);
45 }