|
1 /// Copyright (c) 2012 Ecma International. All rights reserved. |
|
2 /// Ecma International makes this code available under the terms and conditions set |
|
3 /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the |
|
4 /// "Use Terms"). Any redistribution of this code must retain the above |
|
5 /// copyright and this notice and otherwise comply with the Use Terms. |
|
6 /** |
|
7 * This test is actually testing the [[Delete]] internal method (8.12.8). Since the |
|
8 * language provides no way to directly exercise [[Delete]], the tests are placed here. |
|
9 * |
|
10 * @path ch11/11.4/11.4.1/11.4.4-4.a-3-s.js |
|
11 * @description delete operator throws TypeError when deleting a non-configurable data property in strict mode |
|
12 * @onlyStrict |
|
13 */ |
|
14 |
|
15 |
|
16 function testcase() { |
|
17 'use strict'; |
|
18 |
|
19 var o = {}; |
|
20 var desc = { value : 1 }; // all other attributes default to false |
|
21 Object.defineProperty(o, "foo", desc); |
|
22 |
|
23 // Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false. |
|
24 try { |
|
25 delete o.foo; |
|
26 return false; |
|
27 } |
|
28 catch (e) { |
|
29 return (e instanceof TypeError); |
|
30 } |
|
31 } |
|
32 runTestCase(testcase); |