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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.Callbacks, mirror.property('a').propertyType()); | 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. |
217 assertFalse(mirror.property('b').hasGetter()); | 217 assertFalse(mirror.property('b').hasGetter()); |
218 assertTrue(mirror.property('b').hasSetter()); | 218 assertTrue(mirror.property('b').hasSetter()); |
219 assertEquals(debug.PropertyType.Callbacks, mirror.property('b').propertyType()); | 219 assertEquals(debug.PropertyType.AccessorConstant, mirror.property('b').propertyT
ype()); |
220 assertEquals('undefined', mirror.property('b').getter().type()); | 220 assertEquals('undefined', mirror.property('b').getter().type()); |
221 assertEquals('function', mirror.property('b').setter().type()); | 221 assertEquals('function', mirror.property('b').setter().type()); |
222 assertEquals('function (){}', mirror.property('b').setter().source()); | 222 assertEquals('function (){}', mirror.property('b').setter().source()); |
223 assertFalse(mirror.property('b').isException()); | 223 assertFalse(mirror.property('b').isException()); |
224 // c has both getter and setter. The getter throws an exception. | 224 // c has both getter and setter. The getter throws an exception. |
225 assertTrue(mirror.property('c').hasGetter()); | 225 assertTrue(mirror.property('c').hasGetter()); |
226 assertTrue(mirror.property('c').hasSetter()); | 226 assertTrue(mirror.property('c').hasSetter()); |
227 assertEquals(debug.PropertyType.Callbacks, mirror.property('c').propertyType()); | 227 assertEquals(debug.PropertyType.AccessorConstant, mirror.property('c').propertyT
ype()); |
228 assertEquals('function', mirror.property('c').getter().type()); | 228 assertEquals('function', mirror.property('c').getter().type()); |
229 assertEquals('function', mirror.property('c').setter().type()); | 229 assertEquals('function', mirror.property('c').setter().type()); |
230 assertEquals('function (){throw \'c\';}', mirror.property('c').getter().source()
); | 230 assertEquals('function (){throw \'c\';}', mirror.property('c').getter().source()
); |
231 assertEquals('function (){throw \'c\';}', mirror.property('c').setter().source()
); | 231 assertEquals('function (){throw \'c\';}', mirror.property('c').setter().source()
); |
232 | 232 |
233 // Test objects with native accessors. | 233 // Test objects with native accessors. |
234 mirror = debug.MakeMirror(new String('abc')); | 234 mirror = debug.MakeMirror(new String('abc')); |
235 assertTrue(mirror instanceof debug.ObjectMirror); | 235 assertTrue(mirror instanceof debug.ObjectMirror); |
236 assertFalse(mirror.property('length').hasGetter()); | 236 assertFalse(mirror.property('length').hasGetter()); |
237 assertFalse(mirror.property('length').hasSetter()); | 237 assertFalse(mirror.property('length').hasSetter()); |
(...skipping 20 matching lines...) Expand all Loading... |
258 } | 258 } |
259 assertTrue("[[BoundThis]]" in property_map); | 259 assertTrue("[[BoundThis]]" in property_map); |
260 assertEquals("function", property_map["[[BoundThis]]"].value().type()); | 260 assertEquals("function", property_map["[[BoundThis]]"].value().type()); |
261 assertEquals(Array, property_map["[[BoundThis]]"].value().value()); | 261 assertEquals(Array, property_map["[[BoundThis]]"].value().value()); |
262 assertTrue("[[TargetFunction]]" in property_map); | 262 assertTrue("[[TargetFunction]]" in property_map); |
263 assertEquals("function", property_map["[[TargetFunction]]"].value().type()); | 263 assertEquals("function", property_map["[[TargetFunction]]"].value().type()); |
264 assertEquals(Number, property_map["[[TargetFunction]]"].value().value()); | 264 assertEquals(Number, property_map["[[TargetFunction]]"].value().value()); |
265 assertTrue("[[BoundArgs]]" in property_map); | 265 assertTrue("[[BoundArgs]]" in property_map); |
266 assertEquals("object", property_map["[[BoundArgs]]"].value().type()); | 266 assertEquals("object", property_map["[[BoundArgs]]"].value().type()); |
267 assertEquals(1, property_map["[[BoundArgs]]"].value().value().length); | 267 assertEquals(1, property_map["[[BoundArgs]]"].value().value().length); |
OLD | NEW |