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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 this._type = type; | 275 this._type = type; |
276 this._subtype = subtype; | 276 this._subtype = subtype; |
277 if (objectId) { | 277 if (objectId) { |
278 // handle | 278 // handle |
279 this._objectId = objectId; | 279 this._objectId = objectId; |
280 this._description = description; | 280 this._description = description; |
281 this._hasChildren = (type !== "symbol"); | 281 this._hasChildren = (type !== "symbol"); |
282 this._preview = preview; | 282 this._preview = preview; |
283 } else { | 283 } else { |
284 // Primitive or null object. | 284 // Primitive or null object. |
285 console.assert(type !== "object" || value === null); | |
286 this._description = description || (value + ""); | 285 this._description = description || (value + ""); |
287 this._hasChildren = false; | 286 this._hasChildren = false; |
288 // Handle special numbers: NaN, Infinity, -Infinity, -0. | 287 // Handle special numbers: NaN, Infinity, -Infinity, -0. |
289 if (type === "number" && typeof value !== "number") | 288 if (type === "number" && typeof value !== "number") |
290 this.value = Number(value); | 289 this.value = Number(value); |
291 else | 290 else |
292 this.value = value; | 291 this.value = value; |
293 } | 292 } |
294 this._customPreview = customPreview || null; | 293 this._customPreview = customPreview || null; |
295 } | 294 } |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 { | 1192 { |
1194 if (!this._cachedDescription) { | 1193 if (!this._cachedDescription) { |
1195 var children = this._children(); | 1194 var children = this._children(); |
1196 this._cachedDescription = "{" + this._formatValue(children[0].value)
+ " => " + this._formatValue(children[1].value) + "}"; | 1195 this._cachedDescription = "{" + this._formatValue(children[0].value)
+ " => " + this._formatValue(children[1].value) + "}"; |
1197 } | 1196 } |
1198 return this._cachedDescription; | 1197 return this._cachedDescription; |
1199 }, | 1198 }, |
1200 | 1199 |
1201 __proto__: WebInspector.LocalJSONObject.prototype | 1200 __proto__: WebInspector.LocalJSONObject.prototype |
1202 } | 1201 } |
OLD | NEW |