OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 // Throw exception in enumerate trap. | 109 // Throw exception in enumerate trap. |
110 | 110 |
111 function TestForInThrow(handler) { | 111 function TestForInThrow(handler) { |
112 TestWithProxies(TestForInThrow2, handler) | 112 TestWithProxies(TestForInThrow2, handler) |
113 } | 113 } |
114 | 114 |
115 function TestForInThrow2(create, handler) { | 115 function TestForInThrow2(create, handler) { |
116 var p = create(handler) | 116 var p = create(handler) |
117 var o = Object.create(p) | 117 var o = Object.create(p) |
118 assertThrows(function(){ for (var x in p) {} }, "myexn") | 118 assertThrowsEquals(function(){ for (var x in p) {} }, "myexn") |
119 assertThrows(function(){ for (var x in o) {} }, "myexn") | 119 assertThrowsEquals(function(){ for (var x in o) {} }, "myexn") |
120 } | 120 } |
121 | 121 |
122 TestForInThrow({ | 122 TestForInThrow({ |
123 enumerate: function() { throw "myexn" } | 123 enumerate: function() { throw "myexn" } |
124 }) | 124 }) |
125 | 125 |
126 TestForInThrow({ | 126 TestForInThrow({ |
127 enumerate: function() { return this.enumerate2() }, | 127 enumerate: function() { return this.enumerate2() }, |
128 enumerate2: function() { throw "myexn" } | 128 enumerate2: function() { throw "myexn" } |
129 }) | 129 }) |
(...skipping 10 matching lines...) Expand all Loading... |
140 o.__proto__ = p; | 140 o.__proto__ = p; |
141 var keys = []; | 141 var keys = []; |
142 for (var k in o) { keys.push(k); }; | 142 for (var k in o) { keys.push(k); }; |
143 assertEquals(["0"], keys); | 143 assertEquals(["0"], keys); |
144 })(); | 144 })(); |
145 | 145 |
146 (function () { | 146 (function () { |
147 var p = new Proxy({}, {ownKeys: function() { return ["1", Symbol(), "2"] }}); | 147 var p = new Proxy({}, {ownKeys: function() { return ["1", Symbol(), "2"] }}); |
148 assertEquals(["1","2"], Object.getOwnPropertyNames(p)); | 148 assertEquals(["1","2"], Object.getOwnPropertyNames(p)); |
149 })(); | 149 })(); |
OLD | NEW |