OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 * @return {!RuntimeAgent.RemoteObject} | 294 * @return {!RuntimeAgent.RemoteObject} |
295 */ | 295 */ |
296 wrapObject: function(object, groupName, canAccessInspectedGlobalObject, forc eValueType, generatePreview) | 296 wrapObject: function(object, groupName, canAccessInspectedGlobalObject, forc eValueType, generatePreview) |
297 { | 297 { |
298 if (canAccessInspectedGlobalObject) | 298 if (canAccessInspectedGlobalObject) |
299 return this._wrapObject(object, groupName, forceValueType, generateP review); | 299 return this._wrapObject(object, groupName, forceValueType, generateP review); |
300 return this._fallbackWrapper(object); | 300 return this._fallbackWrapper(object); |
301 }, | 301 }, |
302 | 302 |
303 /** | 303 /** |
304 * @param {!Array<!Object>} array | |
305 * @param {string} property | |
306 * @param {string} groupName | |
307 * @param {boolean} canAccessInspectedGlobalObject | |
308 * @param {boolean} forceValueType | |
309 * @param {boolean} generatePreview | |
310 */ | |
311 wrapObjectsInArray: function(array, property, groupName, canAccessInspectedG lobalObject, forceValueType, generatePreview) | |
312 { | |
313 for (var i = 0; i < array.length; ++i) { | |
314 if (property in array[i]) | |
dgozman
2016/03/21 17:21:02
typeof array[i] === "object"
kozy
2016/03/21 19:45:01
Done.
| |
315 array[i][property] = this.wrapObject(array[i][property], groupNa me, canAccessInspectedGlobalObject, forceValueType, generatePreview); | |
316 } | |
317 }, | |
318 | |
319 /** | |
304 * @param {*} object | 320 * @param {*} object |
305 * @return {!RuntimeAgent.RemoteObject} | 321 * @return {!RuntimeAgent.RemoteObject} |
306 */ | 322 */ |
307 _fallbackWrapper: function(object) | 323 _fallbackWrapper: function(object) |
308 { | 324 { |
309 var result = { __proto__: null }; | 325 var result = { __proto__: null }; |
310 result.type = typeof object; | 326 result.type = typeof object; |
311 if (this.isPrimitiveValue(object)) | 327 if (this.isPrimitiveValue(object)) |
312 result.value = object; | 328 result.value = object; |
313 else | 329 else |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
443 if (!("enumerable" in descriptor)) | 459 if (!("enumerable" in descriptor)) |
444 descriptor.enumerable = false; | 460 descriptor.enumerable = false; |
445 if ("symbol" in descriptor) | 461 if ("symbol" in descriptor) |
446 descriptor.symbol = this._wrapObject(descriptor.symbol, objectGr oupName); | 462 descriptor.symbol = this._wrapObject(descriptor.symbol, objectGr oupName); |
447 push(descriptors, descriptor); | 463 push(descriptors, descriptor); |
448 } | 464 } |
449 return descriptors; | 465 return descriptors; |
450 }, | 466 }, |
451 | 467 |
452 /** | 468 /** |
453 * @param {string} objectId | |
454 * @return {!Array.<!Object>|string} | |
455 */ | |
456 getCollectionEntries: function(objectId) | |
457 { | |
458 var parsedObjectId = this._parseObjectId(objectId); | |
459 var object = this._objectForId(parsedObjectId); | |
460 if (!object || typeof object !== "object") | |
461 return "Could not find object with given id"; | |
462 var entries = InjectedScriptHost.collectionEntries(object); | |
463 if (!entries) | |
464 return "Object with given id is not a collection"; | |
465 var objectGroupName = InjectedScriptHost.idToObjectGroupName(parsedObjec tId.id); | |
466 for (var i = 0; i < entries.length; ++i) { | |
467 var entry = nullifyObjectProto(entries[i]); | |
468 if ("key" in entry) | |
469 entry.key = this._wrapObject(entry.key, objectGroupName); | |
470 entry.value = this._wrapObject(entry.value, objectGroupName); | |
471 entries[i] = entry; | |
472 } | |
473 return entries; | |
474 }, | |
475 | |
476 /** | |
477 * @param {!Object} object | 469 * @param {!Object} object |
478 * @param {boolean=} ownProperties | 470 * @param {boolean=} ownProperties |
479 * @param {boolean=} accessorPropertiesOnly | 471 * @param {boolean=} accessorPropertiesOnly |
480 * @param {?Array.<string>=} propertyNamesOnly | 472 * @param {?Array.<string>=} propertyNamesOnly |
481 */ | 473 */ |
482 _propertyDescriptors: function*(object, ownProperties, accessorPropertiesOnl y, propertyNamesOnly) | 474 _propertyDescriptors: function*(object, ownProperties, accessorPropertiesOnl y, propertyNamesOnly) |
483 { | 475 { |
484 var propertyProcessed = { __proto__: null }; | 476 var propertyProcessed = { __proto__: null }; |
485 | 477 |
486 /** | 478 /** |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1573 */ | 1565 */ |
1574 _logEvent: function(event) | 1566 _logEvent: function(event) |
1575 { | 1567 { |
1576 inspectedGlobalObject.console.log(event.type, event); | 1568 inspectedGlobalObject.console.log(event.type, event); |
1577 } | 1569 } |
1578 } | 1570 } |
1579 | 1571 |
1580 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1572 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
1581 return injectedScript; | 1573 return injectedScript; |
1582 }) | 1574 }) |
OLD | NEW |