Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: Source/devtools/front_end/RemoteObject.js

Issue 83383002: DevTools: Allow setting -0 value to object property (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/inspector/runtime/runtime-setPropertyValue-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « LayoutTests/inspector/runtime/runtime-setPropertyValue-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698