| OLD | NEW |
| 1 // Copyright 2006-2012 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 var UNDEFINED_TYPE = 'undefined'; | 147 var UNDEFINED_TYPE = 'undefined'; |
| 148 var NULL_TYPE = 'null'; | 148 var NULL_TYPE = 'null'; |
| 149 var BOOLEAN_TYPE = 'boolean'; | 149 var BOOLEAN_TYPE = 'boolean'; |
| 150 var NUMBER_TYPE = 'number'; | 150 var NUMBER_TYPE = 'number'; |
| 151 var STRING_TYPE = 'string'; | 151 var STRING_TYPE = 'string'; |
| 152 var OBJECT_TYPE = 'object'; | 152 var OBJECT_TYPE = 'object'; |
| 153 var FUNCTION_TYPE = 'function'; | 153 var FUNCTION_TYPE = 'function'; |
| 154 var REGEXP_TYPE = 'regexp'; | 154 var REGEXP_TYPE = 'regexp'; |
| 155 var ERROR_TYPE = 'error'; | 155 var ERROR_TYPE = 'error'; |
| 156 var PROPERTY_TYPE = 'property'; | 156 var PROPERTY_TYPE = 'property'; |
| 157 var INTERNAL_PROPERTY_TYPE = 'internalProperty'; | |
| 158 var FRAME_TYPE = 'frame'; | 157 var FRAME_TYPE = 'frame'; |
| 159 var SCRIPT_TYPE = 'script'; | 158 var SCRIPT_TYPE = 'script'; |
| 160 var CONTEXT_TYPE = 'context'; | 159 var CONTEXT_TYPE = 'context'; |
| 161 var SCOPE_TYPE = 'scope'; | 160 var SCOPE_TYPE = 'scope'; |
| 162 | 161 |
| 163 // Maximum length when sending strings through the JSON protocol. | 162 // Maximum length when sending strings through the JSON protocol. |
| 164 var kMaxProtocolStringLength = 80; | 163 var kMaxProtocolStringLength = 80; |
| 165 | 164 |
| 166 // Different kind of properties. | 165 // Different kind of properties. |
| 167 var PropertyKind = {}; | 166 var PropertyKind = {}; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // - NumberMirror | 205 // - NumberMirror |
| 207 // - StringMirror | 206 // - StringMirror |
| 208 // - ObjectMirror | 207 // - ObjectMirror |
| 209 // - FunctionMirror | 208 // - FunctionMirror |
| 210 // - UnresolvedFunctionMirror | 209 // - UnresolvedFunctionMirror |
| 211 // - ArrayMirror | 210 // - ArrayMirror |
| 212 // - DateMirror | 211 // - DateMirror |
| 213 // - RegExpMirror | 212 // - RegExpMirror |
| 214 // - ErrorMirror | 213 // - ErrorMirror |
| 215 // - PropertyMirror | 214 // - PropertyMirror |
| 216 // - InternalPropertyMirror | |
| 217 // - FrameMirror | 215 // - FrameMirror |
| 218 // - ScriptMirror | 216 // - ScriptMirror |
| 219 | 217 |
| 220 | 218 |
| 221 /** | 219 /** |
| 222 * Base class for all mirror objects. | 220 * Base class for all mirror objects. |
| 223 * @param {string} type The type of the mirror | 221 * @param {string} type The type of the mirror |
| 224 * @constructor | 222 * @constructor |
| 225 */ | 223 */ |
| 226 function Mirror(type) { | 224 function Mirror(type) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 /** | 351 /** |
| 354 * Check whether the mirror reflects a property. | 352 * Check whether the mirror reflects a property. |
| 355 * @returns {boolean} True if the mirror reflects a property | 353 * @returns {boolean} True if the mirror reflects a property |
| 356 */ | 354 */ |
| 357 Mirror.prototype.isProperty = function() { | 355 Mirror.prototype.isProperty = function() { |
| 358 return this instanceof PropertyMirror; | 356 return this instanceof PropertyMirror; |
| 359 }; | 357 }; |
| 360 | 358 |
| 361 | 359 |
| 362 /** | 360 /** |
| 363 * Check whether the mirror reflects an internal property. | |
| 364 * @returns {boolean} True if the mirror reflects an internal property | |
| 365 */ | |
| 366 Mirror.prototype.isInternalProperty = function() { | |
| 367 return this instanceof InternalPropertyMirror; | |
| 368 }; | |
| 369 | |
| 370 | |
| 371 /** | |
| 372 * Check whether the mirror reflects a stack frame. | 361 * Check whether the mirror reflects a stack frame. |
| 373 * @returns {boolean} True if the mirror reflects a stack frame | 362 * @returns {boolean} True if the mirror reflects a stack frame |
| 374 */ | 363 */ |
| 375 Mirror.prototype.isFrame = function() { | 364 Mirror.prototype.isFrame = function() { |
| 376 return this instanceof FrameMirror; | 365 return this instanceof FrameMirror; |
| 377 }; | 366 }; |
| 378 | 367 |
| 379 | 368 |
| 380 /** | 369 /** |
| 381 * Check whether the mirror reflects a script. | 370 * Check whether the mirror reflects a script. |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 ObjectMirror.prototype.prototypeObject = function() { | 587 ObjectMirror.prototype.prototypeObject = function() { |
| 599 return MakeMirror(%DebugGetProperty(this.value_, 'prototype')); | 588 return MakeMirror(%DebugGetProperty(this.value_, 'prototype')); |
| 600 }; | 589 }; |
| 601 | 590 |
| 602 | 591 |
| 603 ObjectMirror.prototype.protoObject = function() { | 592 ObjectMirror.prototype.protoObject = function() { |
| 604 return MakeMirror(%DebugGetPrototype(this.value_)); | 593 return MakeMirror(%DebugGetPrototype(this.value_)); |
| 605 }; | 594 }; |
| 606 | 595 |
| 607 | 596 |
| 597 /** |
| 598 * Return the primitive value if this is object of Boolean, Number or String |
| 599 * type (but not Date). Otherwise return undefined. |
| 600 */ |
| 601 ObjectMirror.prototype.primitiveValue = function() { |
| 602 if (!IS_STRING_WRAPPER(this.value_) && !IS_NUMBER_WRAPPER(this.value_) && |
| 603 !IS_BOOLEAN_WRAPPER(this.value_)) { |
| 604 return void 0; |
| 605 } |
| 606 var primitiveValue = %_ValueOf(this.value_); |
| 607 if (IS_UNDEFINED(primitiveValue)) { |
| 608 return void 0; |
| 609 } |
| 610 return MakeMirror(primitiveValue); |
| 611 }; |
| 612 |
| 613 |
| 608 ObjectMirror.prototype.hasNamedInterceptor = function() { | 614 ObjectMirror.prototype.hasNamedInterceptor = function() { |
| 609 // Get information on interceptors for this object. | 615 // Get information on interceptors for this object. |
| 610 var x = %GetInterceptorInfo(this.value_); | 616 var x = %GetInterceptorInfo(this.value_); |
| 611 return (x & 2) != 0; | 617 return (x & 2) != 0; |
| 612 }; | 618 }; |
| 613 | 619 |
| 614 | 620 |
| 615 ObjectMirror.prototype.hasIndexedInterceptor = function() { | 621 ObjectMirror.prototype.hasIndexedInterceptor = function() { |
| 616 // Get information on interceptors for this object. | 622 // Get information on interceptors for this object. |
| 617 var x = %GetInterceptorInfo(this.value_); | 623 var x = %GetInterceptorInfo(this.value_); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 } | 694 } |
| 689 | 695 |
| 690 return names; | 696 return names; |
| 691 }; | 697 }; |
| 692 | 698 |
| 693 | 699 |
| 694 /** | 700 /** |
| 695 * Return the properties for this object as an array of PropertyMirror objects. | 701 * Return the properties for this object as an array of PropertyMirror objects. |
| 696 * @param {number} kind Indicate whether named, indexed or both kinds of | 702 * @param {number} kind Indicate whether named, indexed or both kinds of |
| 697 * properties are requested | 703 * properties are requested |
| 698 * @param {number} limit Limit the number of properties returned to the | 704 * @param {number} limit Limit the number of properties returend to the |
| 699 specified value | 705 specified value |
| 700 * @return {Array} Property mirrors for this object | 706 * @return {Array} Property mirrors for this object |
| 701 */ | 707 */ |
| 702 ObjectMirror.prototype.properties = function(kind, limit) { | 708 ObjectMirror.prototype.properties = function(kind, limit) { |
| 703 var names = this.propertyNames(kind, limit); | 709 var names = this.propertyNames(kind, limit); |
| 704 var properties = new Array(names.length); | 710 var properties = new Array(names.length); |
| 705 for (var i = 0; i < names.length; i++) { | 711 for (var i = 0; i < names.length; i++) { |
| 706 properties[i] = this.property(names[i]); | 712 properties[i] = this.property(names[i]); |
| 707 } | 713 } |
| 708 | 714 |
| 709 return properties; | 715 return properties; |
| 710 }; | 716 }; |
| 711 | 717 |
| 712 | 718 |
| 713 /** | |
| 714 * Return the internal properties for this object as an array of | |
| 715 * InternalPropertyMirror objects. | |
| 716 * @return {Array} Property mirrors for this object | |
| 717 */ | |
| 718 ObjectMirror.prototype.internalProperties = function() { | |
| 719 return ObjectMirror.GetInternalProperties(this.value_); | |
| 720 } | |
| 721 | |
| 722 | |
| 723 ObjectMirror.prototype.property = function(name) { | 719 ObjectMirror.prototype.property = function(name) { |
| 724 var details = %DebugGetPropertyDetails(this.value_, %ToString(name)); | 720 var details = %DebugGetPropertyDetails(this.value_, %ToString(name)); |
| 725 if (details) { | 721 if (details) { |
| 726 return new PropertyMirror(this, name, details); | 722 return new PropertyMirror(this, name, details); |
| 727 } | 723 } |
| 728 | 724 |
| 729 // Nothing found. | 725 // Nothing found. |
| 730 return GetUndefinedMirror(); | 726 return GetUndefinedMirror(); |
| 731 }; | 727 }; |
| 732 | 728 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 name = ctor.name(); | 783 name = ctor.name(); |
| 788 if (!name) { | 784 if (!name) { |
| 789 name = this.className(); | 785 name = this.className(); |
| 790 } | 786 } |
| 791 } | 787 } |
| 792 return '#<' + name + '>'; | 788 return '#<' + name + '>'; |
| 793 }; | 789 }; |
| 794 | 790 |
| 795 | 791 |
| 796 /** | 792 /** |
| 797 * Return the internal properties of the value, such as [[PrimitiveValue]] of | |
| 798 * scalar wrapper objects and properties of the bound function. | |
| 799 * This method is done static to be accessible from Debug API with the bare | |
| 800 * values without mirrors. | |
| 801 * @return {Array} array (possibly empty) of InternalProperty instances | |
| 802 */ | |
| 803 ObjectMirror.GetInternalProperties = function(value) { | |
| 804 if (IS_STRING_WRAPPER(value) || IS_NUMBER_WRAPPER(value) || | |
| 805 IS_BOOLEAN_WRAPPER(value)) { | |
| 806 var primitiveValue = %_ValueOf(value); | |
| 807 return [new InternalPropertyMirror("[[PrimitiveValue]]", primitiveValue)]; | |
| 808 } else if (IS_FUNCTION(value)) { | |
| 809 var bindings = %BoundFunctionGetBindings(value); | |
| 810 var result = []; | |
| 811 if (bindings && IS_ARRAY(bindings)) { | |
| 812 result.push(new InternalPropertyMirror("[[TargetFunction]]", | |
| 813 bindings[0])); | |
| 814 result.push(new InternalPropertyMirror("[[BoundThis]]", bindings[1])); | |
| 815 var boundArgs = []; | |
| 816 for (var i = 2; i < bindings.length; i++) { | |
| 817 boundArgs.push(bindings[i]); | |
| 818 } | |
| 819 result.push(new InternalPropertyMirror("[[BoundArgs]]", boundArgs)); | |
| 820 } | |
| 821 return result; | |
| 822 } | |
| 823 return []; | |
| 824 } | |
| 825 | |
| 826 | |
| 827 /** | |
| 828 * Mirror object for functions. | 793 * Mirror object for functions. |
| 829 * @param {function} value The function object reflected by this mirror. | 794 * @param {function} value The function object reflected by this mirror. |
| 830 * @constructor | 795 * @constructor |
| 831 * @extends ObjectMirror | 796 * @extends ObjectMirror |
| 832 */ | 797 */ |
| 833 function FunctionMirror(value) { | 798 function FunctionMirror(value) { |
| 834 %_CallFunction(this, value, FUNCTION_TYPE, ObjectMirror); | 799 %_CallFunction(this, value, FUNCTION_TYPE, ObjectMirror); |
| 835 this.resolved_ = true; | 800 this.resolved_ = true; |
| 836 } | 801 } |
| 837 inherits(FunctionMirror, ObjectMirror); | 802 inherits(FunctionMirror, ObjectMirror); |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 * @return {boolean} True if the property is | 1261 * @return {boolean} True if the property is |
| 1297 * UndefinedMirror if there is no setter for this property | 1262 * UndefinedMirror if there is no setter for this property |
| 1298 */ | 1263 */ |
| 1299 PropertyMirror.prototype.isNative = function() { | 1264 PropertyMirror.prototype.isNative = function() { |
| 1300 return (this.propertyType() == PropertyType.Interceptor) || | 1265 return (this.propertyType() == PropertyType.Interceptor) || |
| 1301 ((this.propertyType() == PropertyType.Callbacks) && | 1266 ((this.propertyType() == PropertyType.Callbacks) && |
| 1302 !this.hasGetter() && !this.hasSetter()); | 1267 !this.hasGetter() && !this.hasSetter()); |
| 1303 }; | 1268 }; |
| 1304 | 1269 |
| 1305 | 1270 |
| 1306 /** | |
| 1307 * Mirror object for internal properties. Internal property reflects properties | |
| 1308 * not accessible from user code such as [[BoundThis]] in bound function. | |
| 1309 * Their names are merely symbolic. | |
| 1310 * @param {string} name The name of the property | |
| 1311 * @param {value} property value | |
| 1312 * @constructor | |
| 1313 * @extends Mirror | |
| 1314 */ | |
| 1315 function InternalPropertyMirror(name, value) { | |
| 1316 %_CallFunction(this, INTERNAL_PROPERTY_TYPE, Mirror); | |
| 1317 this.name_ = name; | |
| 1318 this.value_ = value; | |
| 1319 } | |
| 1320 inherits(InternalPropertyMirror, Mirror); | |
| 1321 | |
| 1322 | |
| 1323 InternalPropertyMirror.prototype.name = function() { | |
| 1324 return this.name_; | |
| 1325 }; | |
| 1326 | |
| 1327 | |
| 1328 InternalPropertyMirror.prototype.value = function() { | |
| 1329 return MakeMirror(this.value_, false); | |
| 1330 }; | |
| 1331 | |
| 1332 | |
| 1333 var kFrameDetailsFrameIdIndex = 0; | 1271 var kFrameDetailsFrameIdIndex = 0; |
| 1334 var kFrameDetailsReceiverIndex = 1; | 1272 var kFrameDetailsReceiverIndex = 1; |
| 1335 var kFrameDetailsFunctionIndex = 2; | 1273 var kFrameDetailsFunctionIndex = 2; |
| 1336 var kFrameDetailsArgumentCountIndex = 3; | 1274 var kFrameDetailsArgumentCountIndex = 3; |
| 1337 var kFrameDetailsLocalCountIndex = 4; | 1275 var kFrameDetailsLocalCountIndex = 4; |
| 1338 var kFrameDetailsSourcePositionIndex = 5; | 1276 var kFrameDetailsSourcePositionIndex = 5; |
| 1339 var kFrameDetailsConstructCallIndex = 6; | 1277 var kFrameDetailsConstructCallIndex = 6; |
| 1340 var kFrameDetailsAtReturnIndex = 7; | 1278 var kFrameDetailsAtReturnIndex = 7; |
| 1341 var kFrameDetailsFlagsIndex = 8; | 1279 var kFrameDetailsFlagsIndex = 8; |
| 1342 var kFrameDetailsFirstDynamicIndex = 9; | 1280 var kFrameDetailsFirstDynamicIndex = 9; |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2257 | 2195 |
| 2258 case OBJECT_TYPE: | 2196 case OBJECT_TYPE: |
| 2259 case FUNCTION_TYPE: | 2197 case FUNCTION_TYPE: |
| 2260 case ERROR_TYPE: | 2198 case ERROR_TYPE: |
| 2261 case REGEXP_TYPE: | 2199 case REGEXP_TYPE: |
| 2262 // Add object representation. | 2200 // Add object representation. |
| 2263 this.serializeObject_(mirror, content, details); | 2201 this.serializeObject_(mirror, content, details); |
| 2264 break; | 2202 break; |
| 2265 | 2203 |
| 2266 case PROPERTY_TYPE: | 2204 case PROPERTY_TYPE: |
| 2267 case INTERNAL_PROPERTY_TYPE: | 2205 throw new Error('PropertyMirror cannot be serialized independeltly'); |
| 2268 throw new Error('PropertyMirror cannot be serialized independently'); | |
| 2269 break; | 2206 break; |
| 2270 | 2207 |
| 2271 case FRAME_TYPE: | 2208 case FRAME_TYPE: |
| 2272 // Add object representation. | 2209 // Add object representation. |
| 2273 this.serializeFrame_(mirror, content); | 2210 this.serializeFrame_(mirror, content); |
| 2274 break; | 2211 break; |
| 2275 | 2212 |
| 2276 case SCOPE_TYPE: | 2213 case SCOPE_TYPE: |
| 2277 // Add object representation. | 2214 // Add object representation. |
| 2278 this.serializeScope_(mirror, content); | 2215 this.serializeScope_(mirror, content); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2334 | 2271 |
| 2335 /** | 2272 /** |
| 2336 * Serialize object information to the following JSON format. | 2273 * Serialize object information to the following JSON format. |
| 2337 * | 2274 * |
| 2338 * {"className":"<class name>", | 2275 * {"className":"<class name>", |
| 2339 * "constructorFunction":{"ref":<number>}, | 2276 * "constructorFunction":{"ref":<number>}, |
| 2340 * "protoObject":{"ref":<number>}, | 2277 * "protoObject":{"ref":<number>}, |
| 2341 * "prototypeObject":{"ref":<number>}, | 2278 * "prototypeObject":{"ref":<number>}, |
| 2342 * "namedInterceptor":<boolean>, | 2279 * "namedInterceptor":<boolean>, |
| 2343 * "indexedInterceptor":<boolean>, | 2280 * "indexedInterceptor":<boolean>, |
| 2344 * "properties":[<properties>], | 2281 * "properties":[<properties>]} |
| 2345 * "internalProperties":[<internal properties>]} | |
| 2346 */ | 2282 */ |
| 2347 JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content, | 2283 JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content, |
| 2348 details) { | 2284 details) { |
| 2349 // Add general object properties. | 2285 // Add general object properties. |
| 2350 content.className = mirror.className(); | 2286 content.className = mirror.className(); |
| 2351 content.constructorFunction = | 2287 content.constructorFunction = |
| 2352 this.serializeReference(mirror.constructorFunction()); | 2288 this.serializeReference(mirror.constructorFunction()); |
| 2353 content.protoObject = this.serializeReference(mirror.protoObject()); | 2289 content.protoObject = this.serializeReference(mirror.protoObject()); |
| 2354 content.prototypeObject = this.serializeReference(mirror.prototypeObject()); | 2290 content.prototypeObject = this.serializeReference(mirror.prototypeObject()); |
| 2355 | 2291 |
| 2292 var primitiveValue = mirror.primitiveValue(); |
| 2293 if (!IS_UNDEFINED(primitiveValue)) { |
| 2294 content.primitiveValue = this.serializeReference(primitiveValue); |
| 2295 } |
| 2296 |
| 2356 // Add flags to indicate whether there are interceptors. | 2297 // Add flags to indicate whether there are interceptors. |
| 2357 if (mirror.hasNamedInterceptor()) { | 2298 if (mirror.hasNamedInterceptor()) { |
| 2358 content.namedInterceptor = true; | 2299 content.namedInterceptor = true; |
| 2359 } | 2300 } |
| 2360 if (mirror.hasIndexedInterceptor()) { | 2301 if (mirror.hasIndexedInterceptor()) { |
| 2361 content.indexedInterceptor = true; | 2302 content.indexedInterceptor = true; |
| 2362 } | 2303 } |
| 2363 | 2304 |
| 2364 // Add function specific properties. | 2305 // Add function specific properties. |
| 2365 if (mirror.isFunction()) { | 2306 if (mirror.isFunction()) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 } | 2348 } |
| 2408 } | 2349 } |
| 2409 for (var i = 0; i < propertyIndexes.length; i++) { | 2350 for (var i = 0; i < propertyIndexes.length; i++) { |
| 2410 var propertyMirror = mirror.property(propertyIndexes[i]); | 2351 var propertyMirror = mirror.property(propertyIndexes[i]); |
| 2411 p[propertyNames.length + i] = this.serializeProperty_(propertyMirror); | 2352 p[propertyNames.length + i] = this.serializeProperty_(propertyMirror); |
| 2412 if (details) { | 2353 if (details) { |
| 2413 this.add_(propertyMirror.value()); | 2354 this.add_(propertyMirror.value()); |
| 2414 } | 2355 } |
| 2415 } | 2356 } |
| 2416 content.properties = p; | 2357 content.properties = p; |
| 2417 | |
| 2418 var internalProperties = mirror.internalProperties(); | |
| 2419 if (internalProperties.length > 0) { | |
| 2420 var ip = []; | |
| 2421 for (var i = 0; i < internalProperties.length; i++) { | |
| 2422 ip.push(this.serializeInternalProperty_(internalProperties[i])); | |
| 2423 } | |
| 2424 content.internalProperties = ip; | |
| 2425 } | |
| 2426 }; | 2358 }; |
| 2427 | 2359 |
| 2428 | 2360 |
| 2429 /** | 2361 /** |
| 2430 * Serialize location information to the following JSON format: | 2362 * Serialize location information to the following JSON format: |
| 2431 * | 2363 * |
| 2432 * "position":"<position>", | 2364 * "position":"<position>", |
| 2433 * "line":"<line>", | 2365 * "line":"<line>", |
| 2434 * "column":"<column>", | 2366 * "column":"<column>", |
| 2435 * | 2367 * |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2483 } | 2415 } |
| 2484 if (propertyMirror.propertyType() != PropertyType.Normal) { | 2416 if (propertyMirror.propertyType() != PropertyType.Normal) { |
| 2485 result.propertyType = propertyMirror.propertyType(); | 2417 result.propertyType = propertyMirror.propertyType(); |
| 2486 } | 2418 } |
| 2487 result.ref = propertyValue.handle(); | 2419 result.ref = propertyValue.handle(); |
| 2488 } | 2420 } |
| 2489 return result; | 2421 return result; |
| 2490 }; | 2422 }; |
| 2491 | 2423 |
| 2492 | 2424 |
| 2493 /** | |
| 2494 * Serialize internal property information to the following JSON format for | |
| 2495 * building the array of properties. | |
| 2496 * | |
| 2497 * {"name":"<property name>", | |
| 2498 * "ref":<number>} | |
| 2499 * | |
| 2500 * {"name":"[[BoundThis]]","ref":117} | |
| 2501 * | |
| 2502 * @param {InternalPropertyMirror} propertyMirror The property to serialize. | |
| 2503 * @returns {Object} Protocol object representing the property. | |
| 2504 */ | |
| 2505 JSONProtocolSerializer.prototype.serializeInternalProperty_ = | |
| 2506 function(propertyMirror) { | |
| 2507 var result = {}; | |
| 2508 | |
| 2509 result.name = propertyMirror.name(); | |
| 2510 var propertyValue = propertyMirror.value(); | |
| 2511 if (this.inlineRefs_() && propertyValue.isValue()) { | |
| 2512 result.value = this.serializeReferenceWithDisplayData_(propertyValue); | |
| 2513 } else { | |
| 2514 result.ref = propertyValue.handle(); | |
| 2515 } | |
| 2516 return result; | |
| 2517 }; | |
| 2518 | |
| 2519 | |
| 2520 JSONProtocolSerializer.prototype.serializeFrame_ = function(mirror, content) { | 2425 JSONProtocolSerializer.prototype.serializeFrame_ = function(mirror, content) { |
| 2521 content.index = mirror.index(); | 2426 content.index = mirror.index(); |
| 2522 content.receiver = this.serializeReference(mirror.receiver()); | 2427 content.receiver = this.serializeReference(mirror.receiver()); |
| 2523 var func = mirror.func(); | 2428 var func = mirror.func(); |
| 2524 content.func = this.serializeReference(func); | 2429 content.func = this.serializeReference(func); |
| 2525 if (func.script()) { | 2430 if (func.script()) { |
| 2526 content.script = this.serializeReference(func.script()); | 2431 content.script = this.serializeReference(func.script()); |
| 2527 } | 2432 } |
| 2528 content.constructCall = mirror.isConstructCall(); | 2433 content.constructCall = mirror.isConstructCall(); |
| 2529 content.atReturn = mirror.isAtReturn(); | 2434 content.atReturn = mirror.isAtReturn(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2592 } | 2497 } |
| 2593 if (!NUMBER_IS_FINITE(value)) { | 2498 if (!NUMBER_IS_FINITE(value)) { |
| 2594 if (value > 0) { | 2499 if (value > 0) { |
| 2595 return 'Infinity'; | 2500 return 'Infinity'; |
| 2596 } else { | 2501 } else { |
| 2597 return '-Infinity'; | 2502 return '-Infinity'; |
| 2598 } | 2503 } |
| 2599 } | 2504 } |
| 2600 return value; | 2505 return value; |
| 2601 } | 2506 } |
| OLD | NEW |