OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 function getStrictF() { | 5 function getStrictF() { |
6 'use strict'; | 6 'use strict'; |
7 return function f() {}; | 7 return function f() {}; |
8 } | 8 } |
9 | 9 |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 test(testFunctionToString); | 84 test(testFunctionToString); |
85 | 85 |
86 | 86 |
87 (function testSetOnInstance() { | 87 (function testSetOnInstance() { |
88 // This needs to come before testDelete below | 88 // This needs to come before testDelete below |
89 assertTrue(Function.prototype.hasOwnProperty('name')); | 89 assertTrue(Function.prototype.hasOwnProperty('name')); |
90 | 90 |
91 function f() {} | 91 function f() {} |
92 delete f.name; | 92 delete f.name; |
93 assertEquals('Empty', f.name); | 93 assertEquals('', f.name); |
94 | 94 |
95 f.name = 42; | 95 f.name = 42; |
96 assertEquals('Empty', f.name); // non writable prototype property. | 96 assertEquals('', f.name); // non writable prototype property. |
97 assertFalse(f.hasOwnProperty('name')); | 97 assertFalse(f.hasOwnProperty('name')); |
98 | 98 |
99 Object.defineProperty(Function.prototype, 'name', {writable: true}); | 99 Object.defineProperty(Function.prototype, 'name', {writable: true}); |
100 | 100 |
101 f.name = 123; | 101 f.name = 123; |
102 assertTrue(f.hasOwnProperty('name')); | 102 assertTrue(f.hasOwnProperty('name')); |
103 assertEquals(123, f.name); | 103 assertEquals(123, f.name); |
104 })(); | 104 })(); |
105 | 105 |
106 | 106 |
107 (function testDelete() { | 107 (function testDelete() { |
108 function f() {} | 108 function f() {} |
109 assertTrue(delete f.name); | 109 assertTrue(delete f.name); |
110 assertFalse(f.hasOwnProperty('name')); | 110 assertFalse(f.hasOwnProperty('name')); |
111 assertEquals('Empty', f.name); | 111 assertEquals('', f.name); |
112 | 112 |
113 assertTrue(delete Function.prototype.name); | 113 assertTrue(delete Function.prototype.name); |
114 assertEquals(undefined, f.name); | 114 assertEquals(undefined, f.name); |
115 })(); | 115 })(); |
OLD | NEW |