Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / built-ins / Object / defineProperty / 15.2.3.6-4-540-8.js
blob26be4c5177f3a6755d3bbfa85970e355ba45ba7b
1 // Copyright (c) 2012 Ecma International.  All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 es5id: 15.2.3.6-4-540-8
6 description: >
7     Object.defineProperty fails to update [[Get]] and [[Set]]
8     attributes of an indexed accessor property 'P' whose
9     [[Configurable]] attribute is false, 'O' is an Arguments object
10     (8.12.9 step 11.a)
11 includes: [propertyHelper.js]
12 ---*/
14 var obj = (function() {
15   return arguments;
16 }());
18 obj.verifySetFunction = "data";
19 var getFunc = function() {
20   return obj.verifySetFunction;
22 var setFunc = function(value) {
23   obj.verifySetFunction = value;
25 Object.defineProperty(obj, "0", {
26   get: getFunc,
27   set: setFunc,
28   configurable: false
29 });
31 var result = false;
32 try {
33   Object.defineProperty(obj, "0", {
34     get: function() {
35       return 100;
36     }
37   });
38 } catch (e) {
39   result = e instanceof TypeError;
40   verifyEqualTo(obj, "0", getFunc());
42   verifyWritable(obj, "0", "verifySetFunction");
44   verifyNotEnumerable(obj, "0");
46   verifyNotConfigurable(obj, "0");
49 try {
50   Object.defineProperty(obj, "0", {
51     set: function(value) {
52       obj.verifySetFunction1 = value;
53     }
54   });
55 } catch (e) {
56   if (!result) {
57     throw new Test262Error('Expected result  to be true, actually ' + result);
58   }
60   verifyEqualTo(obj, "0", getFunc());
62   verifyWritable(obj, "0", "verifySetFunction");
64   verifyNotEnumerable(obj, "0");
66   verifyNotConfigurable(obj, "0");
68   if (!(e instanceof TypeError)) {
69     throw new Test262Error("Expected TypeError, got " + e);
70   }
74 reportCompare(0, 0);