regress-381301.js (1349B)
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 = 381301; 11 var summary = 'uneval of object with native-function 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 o = 26 Object.defineProperty({}, "x", { get: decodeURI, enumerable: true, configurable: true }); 27 expect = '({get x() {[native code]}})'; 28 actual = uneval(o); 29 30 // Native function syntax: 31 // `function IdentifierName_opt ( FormalParameters ) { [ native code ] }` 32 33 // The placement of whitespace characters in the native function's body is 34 // implementation-dependent, so we need to replace those for this test. 35 var re = new RegExp(["\\{", "\\[", "native", "code", "\\]", "\\}"].join("\\s*")); 36 actual = actual.replace(re, "{[native code]}"); 37 38 compareSource(expect, actual, summary); 39 }