OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 * @param {function(string=)} callback | 278 * @param {function(string=)} callback |
279 */ | 279 */ |
280 doSetObjectPropertyValue: function(result, name, callback) | 280 doSetObjectPropertyValue: function(result, name, callback) |
281 { | 281 { |
282 // This assignment may be for a regular (data) property, and for an accc
essor property (with getter/setter). | 282 // This assignment may be for a regular (data) property, and for an accc
essor property (with getter/setter). |
283 // Note the sensitive matter about accessor property: the property may b
e physically defined in some proto object, | 283 // Note the sensitive matter about accessor property: the property may b
e physically defined in some proto object, |
284 // but logically it is bound to the object in question. JavaScript passe
s this object to getters/setters, not the object | 284 // but logically it is bound to the object in question. JavaScript passe
s this object to getters/setters, not the object |
285 // where property was defined; so do we. | 285 // where property was defined; so do we. |
286 var setPropertyValueFunction = "function(a, b) { this[a] = b; }"; | 286 var setPropertyValueFunction = "function(a, b) { this[a] = b; }"; |
287 | 287 |
288 // Special case for NaN, Infinity and -Infinity | 288 // Special case for NaN, Infinity, -Infinity, -0. |
289 if (result.type === "number" && typeof result.value !== "number") | 289 if (result.type === "number" && String(result.value) !== result.descript
ion) |
290 setPropertyValueFunction = "function(a) { this[a] = " + result.descr
iption + "; }"; | 290 setPropertyValueFunction = "function(a) { this[a] = " + result.descr
iption + "; }"; |
291 | 291 |
292 delete result.description; // Optimize on traffic. | 292 delete result.description; // Optimize on traffic. |
293 RuntimeAgent.callFunctionOn(this._objectId, setPropertyValueFunction, [{
value:name }, result], true, undefined, undefined, propertySetCallback.bind(thi
s)); | 293 RuntimeAgent.callFunctionOn(this._objectId, setPropertyValueFunction, [{
value:name }, result], true, undefined, undefined, propertySetCallback.bind(thi
s)); |
294 | 294 |
295 /** | 295 /** |
296 * @param {?Protocol.Error} error | 296 * @param {?Protocol.Error} error |
297 * @param {RuntimeAgent.RemoteObject} result | 297 * @param {RuntimeAgent.RemoteObject} result |
298 * @param {boolean=} wasThrown | 298 * @param {boolean=} wasThrown |
299 */ | 299 */ |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 }, | 808 }, |
809 | 809 |
810 /** | 810 /** |
811 * @return {number} | 811 * @return {number} |
812 */ | 812 */ |
813 arrayLength: function() | 813 arrayLength: function() |
814 { | 814 { |
815 return this._value instanceof Array ? this._value.length : 0; | 815 return this._value instanceof Array ? this._value.length : 0; |
816 } | 816 } |
817 } | 817 } |
OLD | NEW |