Chromium Code Reviews| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 /** | 77 /** |
| 78 * @return {number} | 78 * @return {number} |
| 79 */ | 79 */ |
| 80 arrayLength: function() | 80 arrayLength: function() |
| 81 { | 81 { |
| 82 throw "Not implemented"; | 82 throw "Not implemented"; |
| 83 }, | 83 }, |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback | 86 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback |
| 87 * @param {boolean=} generatePreview | |
| 87 */ | 88 */ |
| 88 getOwnProperties: function(callback) | 89 getOwnProperties: function(callback, generatePreview) |
| 89 { | 90 { |
| 90 throw "Not implemented"; | 91 throw "Not implemented"; |
| 91 }, | 92 }, |
| 92 | 93 |
| 93 /** | 94 /** |
| 94 * @return {!Promise<!{properties: ?Array.<!WebInspector.RemoteObjectPropert y>, internalProperties: ?Array.<!WebInspector.RemoteObjectProperty>}>} | 95 * @return {!Promise<!{properties: ?Array.<!WebInspector.RemoteObjectPropert y>, internalProperties: ?Array.<!WebInspector.RemoteObjectProperty>}>} |
| 95 */ | 96 */ |
| 96 getOwnPropertiesPromise: function() | 97 getOwnPropertiesPromise: function() |
| 97 { | 98 { |
| 98 return new Promise(promiseConstructor.bind(this)); | 99 return new Promise(promiseConstructor.bind(this)); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 this.functionDetails(success); | 308 this.functionDetails(success); |
| 308 } | 309 } |
| 309 }, | 310 }, |
| 310 | 311 |
| 311 /** | 312 /** |
| 312 * @param {function(?WebInspector.DebuggerModel.GeneratorObjectDetails)} cal lback | 313 * @param {function(?WebInspector.DebuggerModel.GeneratorObjectDetails)} cal lback |
| 313 */ | 314 */ |
| 314 generatorObjectDetails: function(callback) | 315 generatorObjectDetails: function(callback) |
| 315 { | 316 { |
| 316 callback(null); | 317 callback(null); |
| 317 }, | |
| 318 | |
| 319 /** | |
| 320 * @param {function(?Array<!DebuggerAgent.CollectionEntry>)} callback | |
| 321 */ | |
| 322 collectionEntries: function(callback) | |
| 323 { | |
| 324 callback(null); | |
| 325 } | 318 } |
| 326 } | 319 } |
| 327 | 320 |
| 328 /** | 321 /** |
| 329 * @param {*} value | 322 * @param {*} value |
| 330 * @return {!WebInspector.RemoteObject} | 323 * @return {!WebInspector.RemoteObject} |
| 331 */ | 324 */ |
| 332 WebInspector.RemoteObject.fromLocalObject = function(value) | 325 WebInspector.RemoteObject.fromLocalObject = function(value) |
| 333 { | 326 { |
| 334 return new WebInspector.LocalJSONObject(value); | 327 return new WebInspector.LocalJSONObject(value); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 * @return {!RuntimeAgent.ObjectPreview|undefined} | 504 * @return {!RuntimeAgent.ObjectPreview|undefined} |
| 512 */ | 505 */ |
| 513 get preview() | 506 get preview() |
| 514 { | 507 { |
| 515 return this._preview; | 508 return this._preview; |
| 516 }, | 509 }, |
| 517 | 510 |
| 518 /** | 511 /** |
| 519 * @override | 512 * @override |
| 520 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback | 513 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback |
| 514 * @param {boolean=} generatePreview | |
|
dgozman
2016/06/28 01:20:47
Let's make it non-optional. Do we have a lot of ca
kozy
2016/06/28 18:41:49
Removed.
| |
| 521 */ | 515 */ |
| 522 getOwnProperties: function(callback) | 516 getOwnProperties: function(callback, generatePreview) |
| 523 { | 517 { |
| 524 this.doGetProperties(true, false, false, callback); | 518 this.doGetProperties(true, false, generatePreview || false, callback); |
| 525 }, | 519 }, |
| 526 | 520 |
| 527 /** | 521 /** |
| 528 * @override | 522 * @override |
| 529 * @param {boolean} accessorPropertiesOnly | 523 * @param {boolean} accessorPropertiesOnly |
| 530 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback | 524 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback |
| 531 */ | 525 */ |
| 532 getAllProperties: function(accessorPropertiesOnly, callback) | 526 getAllProperties: function(accessorPropertiesOnly, callback) |
| 533 { | 527 { |
| 534 this.doGetProperties(false, accessorPropertiesOnly, false, callback); | 528 this.doGetProperties(false, accessorPropertiesOnly, false, callback); |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 887 | 881 |
| 888 /** | 882 /** |
| 889 * @override | 883 * @override |
| 890 * @param {function(?WebInspector.DebuggerModel.GeneratorObjectDetails)} cal lback | 884 * @param {function(?WebInspector.DebuggerModel.GeneratorObjectDetails)} cal lback |
| 891 */ | 885 */ |
| 892 generatorObjectDetails: function(callback) | 886 generatorObjectDetails: function(callback) |
| 893 { | 887 { |
| 894 this._debuggerModel.generatorObjectDetails(this, callback); | 888 this._debuggerModel.generatorObjectDetails(this, callback); |
| 895 }, | 889 }, |
| 896 | 890 |
| 897 /** | |
| 898 * @override | |
| 899 * @param {function(?Array.<!DebuggerAgent.CollectionEntry>)} callback | |
| 900 */ | |
| 901 collectionEntries: function(callback) | |
| 902 { | |
| 903 if (!this._objectId) { | |
| 904 callback(null); | |
| 905 return; | |
| 906 } | |
| 907 this._debuggerModel.getCollectionEntries(this._objectId, callback); | |
| 908 }, | |
| 909 | |
| 910 __proto__: WebInspector.RemoteObject.prototype | 891 __proto__: WebInspector.RemoteObject.prototype |
| 911 }; | 892 }; |
| 912 | 893 |
| 913 | 894 |
| 914 /** | 895 /** |
| 915 * @param {!WebInspector.RemoteObject} object | 896 * @param {!WebInspector.RemoteObject} object |
| 916 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!WebIns pector.RemoteObjectProperty>)} callback | 897 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!WebIns pector.RemoteObjectProperty>)} callback |
| 917 */ | 898 */ |
| 918 WebInspector.RemoteObject.loadFromObjectPerProto = function(object, callback) | 899 WebInspector.RemoteObject.loadFromObjectPerProto = function(object, callback) |
| 919 { | 900 { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1081 * @constructor | 1062 * @constructor |
| 1082 * @param {number} number | 1063 * @param {number} number |
| 1083 * @param {string=} callFrameId | 1064 * @param {string=} callFrameId |
| 1084 */ | 1065 */ |
| 1085 WebInspector.ScopeRef = function(number, callFrameId) | 1066 WebInspector.ScopeRef = function(number, callFrameId) |
| 1086 { | 1067 { |
| 1087 this.number = number; | 1068 this.number = number; |
| 1088 this.callFrameId = callFrameId; | 1069 this.callFrameId = callFrameId; |
| 1089 } | 1070 } |
| 1090 | 1071 |
| 1072 | |
| 1073 /** | |
| 1074 * @constructor | |
| 1075 * @extends {WebInspector.RemoteObjectImpl} | |
| 1076 * @param {!WebInspector.Target} target | |
| 1077 * @param {string|undefined} objectId | |
| 1078 * @param {string} type | |
| 1079 * @param {string|undefined} subtype | |
| 1080 * @param {*} value | |
| 1081 * @param {string=} description | |
| 1082 * @param {!RuntimeAgent.ObjectPreview=} preview | |
| 1083 */ | |
| 1084 WebInspector.EntryRemoteObject = function(target, objectId, type, subtype, value , description, preview) | |
| 1085 { | |
| 1086 WebInspector.RemoteObjectImpl.call(this, target, objectId, type, subtype, va lue, description, preview); | |
| 1087 } | |
| 1088 | |
| 1089 WebInspector.EntryRemoteObject.prototype = { | |
| 1090 /** | |
| 1091 * @override | |
| 1092 * @return {string|undefined} | |
| 1093 */ | |
| 1094 get description() | |
| 1095 { | |
| 1096 if (!this._cachedDescription) { | |
| 1097 var properties = this.preview.properties.reduce((map, object) => map .set(object.name, this._formatValue(object)), new Map()); | |
|
dgozman
2016/06/28 01:20:47
Turn it into for-loop please.
kozy
2016/06/28 18:41:49
Removed.
| |
| 1098 if (properties.has("key")) | |
| 1099 this._cachedDescription = "{" + properties.get("key") + " => " + properties.get("value") + "}"; | |
| 1100 else | |
| 1101 this._cachedDescription = properties.get("value"); | |
| 1102 } | |
| 1103 return this._cachedDescription; | |
| 1104 }, | |
| 1105 | |
| 1106 /** | |
| 1107 * @param {!RuntimeAgent.PropertyPreview} propertyPreview | |
| 1108 */ | |
| 1109 _formatValue: function(propertyPreview) | |
| 1110 { | |
| 1111 var description = propertyPreview.value || ""; | |
| 1112 if (propertyPreview.type === "string") | |
| 1113 return "\"" + description.replace(/\n/g, "\u21B5") + "\""; | |
| 1114 return description; | |
| 1115 }, | |
| 1116 | |
| 1117 __proto__: WebInspector.RemoteObjectImpl.prototype | |
| 1118 }; | |
| 1119 | |
| 1120 | |
| 1091 /** | 1121 /** |
| 1092 * @constructor | 1122 * @constructor |
| 1093 * @param {string} name | 1123 * @param {string} name |
| 1094 * @param {?WebInspector.RemoteObject} value | 1124 * @param {?WebInspector.RemoteObject} value |
| 1095 * @param {boolean=} enumerable | 1125 * @param {boolean=} enumerable |
| 1096 * @param {boolean=} writable | 1126 * @param {boolean=} writable |
| 1097 * @param {boolean=} isOwn | 1127 * @param {boolean=} isOwn |
| 1098 * @param {boolean=} wasThrown | 1128 * @param {boolean=} wasThrown |
| 1099 * @param {boolean=} synthetic | 1129 * @param {boolean=} synthetic |
| 1100 * @param {?WebInspector.RemoteObject=} symbol | 1130 * @param {?WebInspector.RemoteObject=} symbol |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1268 get hasChildren() | 1298 get hasChildren() |
| 1269 { | 1299 { |
| 1270 if ((typeof this._value !== "object") || (this._value === null)) | 1300 if ((typeof this._value !== "object") || (this._value === null)) |
| 1271 return false; | 1301 return false; |
| 1272 return !!Object.keys(/** @type {!Object} */ (this._value)).length; | 1302 return !!Object.keys(/** @type {!Object} */ (this._value)).length; |
| 1273 }, | 1303 }, |
| 1274 | 1304 |
| 1275 /** | 1305 /** |
| 1276 * @override | 1306 * @override |
| 1277 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback | 1307 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback |
| 1308 * @param {boolean=} generatePreview | |
| 1278 */ | 1309 */ |
| 1279 getOwnProperties: function(callback) | 1310 getOwnProperties: function(callback, generatePreview) |
| 1280 { | 1311 { |
| 1281 callback(this._children(), null); | 1312 callback(this._children(), null); |
| 1282 }, | 1313 }, |
| 1283 | 1314 |
| 1284 /** | 1315 /** |
| 1285 * @override | 1316 * @override |
| 1286 * @param {boolean} accessorPropertiesOnly | 1317 * @param {boolean} accessorPropertiesOnly |
| 1287 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback | 1318 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback |
| 1288 */ | 1319 */ |
| 1289 getAllProperties: function(accessorPropertiesOnly, callback) | 1320 getAllProperties: function(accessorPropertiesOnly, callback) |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1581 }, | 1612 }, |
| 1582 | 1613 |
| 1583 /** | 1614 /** |
| 1584 * @return {!WebInspector.RemoteObject} | 1615 * @return {!WebInspector.RemoteObject} |
| 1585 */ | 1616 */ |
| 1586 object: function() | 1617 object: function() |
| 1587 { | 1618 { |
| 1588 return this._object; | 1619 return this._object; |
| 1589 } | 1620 } |
| 1590 } | 1621 } |
| 1591 | |
| 1592 /** | |
| 1593 * @constructor | |
| 1594 * @extends {WebInspector.LocalJSONObject} | |
| 1595 * @param {*} value | |
| 1596 */ | |
| 1597 WebInspector.MapEntryLocalJSONObject = function(value) | |
| 1598 { | |
| 1599 WebInspector.LocalJSONObject.call(this, value); | |
| 1600 } | |
| 1601 | |
| 1602 WebInspector.MapEntryLocalJSONObject.prototype = { | |
| 1603 /** | |
| 1604 * @override | |
| 1605 * @return {string} | |
| 1606 */ | |
| 1607 get description() | |
| 1608 { | |
| 1609 if (!this._cachedDescription) { | |
| 1610 var children = this._children(); | |
| 1611 this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}"; | |
| 1612 } | |
| 1613 return this._cachedDescription; | |
| 1614 }, | |
| 1615 | |
| 1616 __proto__: WebInspector.LocalJSONObject.prototype | |
| 1617 } | |
| OLD | NEW |