OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 assertFalse(global_mirror.property("Math").isEnum(), "Math is enumerable" + glob
al_mirror.property("Math").attributes()); | 193 assertFalse(global_mirror.property("Math").isEnum(), "Math is enumerable" + glob
al_mirror.property("Math").attributes()); |
194 | 194 |
195 math_mirror = global_mirror.property("Math").value(); | 195 math_mirror = global_mirror.property("Math").value(); |
196 assertEquals('property', math_mirror.property("E").type()); | 196 assertEquals('property', math_mirror.property("E").type()); |
197 assertFalse(math_mirror.property("E").isEnum(), "Math.E is enumerable"); | 197 assertFalse(math_mirror.property("E").isEnum(), "Math.E is enumerable"); |
198 assertTrue(math_mirror.property("E").isReadOnly()); | 198 assertTrue(math_mirror.property("E").isReadOnly()); |
199 assertFalse(math_mirror.property("E").canDelete()); | 199 assertFalse(math_mirror.property("E").canDelete()); |
200 | 200 |
201 // Test objects with JavaScript accessors. | 201 // Test objects with JavaScript accessors. |
202 o = {} | 202 o = {} |
203 o.__defineGetter__('a', function(){return 'a';}); | 203 o.__defineGetter__('a', function (){return 'a';}); |
204 o.__defineSetter__('b', function(){}); | 204 o.__defineSetter__('b', function (){}); |
205 o.__defineGetter__('c', function(){throw 'c';}); | 205 o.__defineGetter__('c', function (){throw 'c';}); |
206 o.__defineSetter__('c', function(){throw 'c';}); | 206 o.__defineSetter__('c', function (){throw 'c';}); |
207 testObjectMirror(o, 'Object', 'Object'); | 207 testObjectMirror(o, 'Object', 'Object'); |
208 mirror = debug.MakeMirror(o); | 208 mirror = debug.MakeMirror(o); |
209 // a has getter but no setter. | 209 // a has getter but no setter. |
210 assertTrue(mirror.property('a').hasGetter()); | 210 assertTrue(mirror.property('a').hasGetter()); |
211 assertFalse(mirror.property('a').hasSetter()); | 211 assertFalse(mirror.property('a').hasSetter()); |
212 assertEquals(debug.PropertyType.AccessorConstant, mirror.property('a').propertyT
ype()); | 212 assertEquals(debug.PropertyType.AccessorConstant, mirror.property('a').propertyT
ype()); |
213 assertEquals('function', mirror.property('a').getter().type()); | 213 assertEquals('function', mirror.property('a').getter().type()); |
214 assertEquals('undefined', mirror.property('a').setter().type()); | 214 assertEquals('undefined', mirror.property('a').setter().type()); |
215 assertEquals('function (){return \'a\';}', mirror.property('a').getter().source(
)); | 215 assertEquals('function (){return \'a\';}', mirror.property('a').getter().source(
)); |
216 // b has setter but no getter. | 216 // b has setter but no getter. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 var property_map = {}; | 282 var property_map = {}; |
283 for (var i = 0; i < ip.length; i++) { | 283 for (var i = 0; i < ip.length; i++) { |
284 property_map[ip[i].name()] = ip[i]; | 284 property_map[ip[i].name()] = ip[i]; |
285 } | 285 } |
286 assertTrue("[[Target]]" in property_map); | 286 assertTrue("[[Target]]" in property_map); |
287 assertEquals(target, property_map["[[Target]]"].value().value()); | 287 assertEquals(target, property_map["[[Target]]"].value().value()); |
288 assertTrue("[[Handler]]" in property_map); | 288 assertTrue("[[Handler]]" in property_map); |
289 assertEquals(handler, property_map["[[Handler]]"].value().value()); | 289 assertEquals(handler, property_map["[[Handler]]"].value().value()); |
290 assertTrue("[[IsRevoked]]" in property_map); | 290 assertTrue("[[IsRevoked]]" in property_map); |
291 assertEquals(false, property_map["[[IsRevoked]]"].value().value()); | 291 assertEquals(false, property_map["[[IsRevoked]]"].value().value()); |
OLD | NEW |