Chromium Code Reviews| 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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 820 try { | 820 try { |
| 821 var descriptors = injectedScript._propertyDescriptors(object, undefi ned, undefined, firstLevelKeys); | 821 var descriptors = injectedScript._propertyDescriptors(object, undefi ned, undefined, firstLevelKeys); |
| 822 | 822 |
| 823 this._appendPropertyDescriptors(preview, descriptors, propertiesThre shold, secondLevelKeys, isTable); | 823 this._appendPropertyDescriptors(preview, descriptors, propertiesThre shold, secondLevelKeys, isTable); |
| 824 if (propertiesThreshold.indexes < 0 || propertiesThreshold.propertie s < 0) | 824 if (propertiesThreshold.indexes < 0 || propertiesThreshold.propertie s < 0) |
| 825 return preview; | 825 return preview; |
| 826 | 826 |
| 827 // Add internal properties to preview. | 827 // Add internal properties to preview. |
| 828 var rawInternalProperties = InjectedScriptHost.getInternalProperties (object) || []; | 828 var rawInternalProperties = InjectedScriptHost.getInternalProperties (object) || []; |
| 829 var internalProperties = []; | 829 var internalProperties = []; |
| 830 var entries = null; | |
| 830 for (var i = 0; i < rawInternalProperties.length; i += 2) { | 831 for (var i = 0; i < rawInternalProperties.length; i += 2) { |
| 831 push(internalProperties, { | 832 if (rawInternalProperties[i] !== "[[Entries]]") { |
|
dgozman
2016/06/28 01:20:47
if (.... === entries) {
...
continue;
}
kozy
2016/06/28 18:41:49
Done.
| |
| 832 name: rawInternalProperties[i], | 833 push(internalProperties, { |
| 833 value: rawInternalProperties[i + 1], | 834 name: rawInternalProperties[i], |
| 834 isOwn: true, | 835 value: rawInternalProperties[i + 1], |
| 835 enumerable: true, | 836 isOwn: true, |
| 836 __proto__: null | 837 enumerable: true, |
| 837 }); | 838 __proto__: null |
| 839 }); | |
| 840 } else { | |
| 841 entries = /** @type {!Array<*>} */(rawInternalProperties[i + 1]); | |
| 842 } | |
| 838 } | 843 } |
| 839 this._appendPropertyDescriptors(preview, internalProperties, propert iesThreshold, secondLevelKeys, isTable); | 844 this._appendPropertyDescriptors(preview, internalProperties, propert iesThreshold, secondLevelKeys, isTable); |
| 840 | 845 |
| 841 if (this.subtype === "map" || this.subtype === "set" || this.subtype === "iterator") | 846 if (this.subtype === "map" || this.subtype === "set" || this.subtype === "iterator") |
| 842 this._appendEntriesPreview(object, preview, skipEntriesPreview); | 847 this._appendEntriesPreview(entries, preview, skipEntriesPreview) ; |
| 843 | 848 |
| 844 } catch (e) {} | 849 } catch (e) {} |
| 845 | 850 |
| 846 return preview; | 851 return preview; |
| 847 }, | 852 }, |
| 848 | 853 |
| 849 /** | 854 /** |
| 850 * @param {!RuntimeAgent.ObjectPreview} preview | 855 * @param {!RuntimeAgent.ObjectPreview} preview |
| 851 * @param {!Array.<*>|!Iterable.<*>} descriptors | 856 * @param {!Array.<*>|!Iterable.<*>} descriptors |
| 852 * @param {!Object} propertiesThreshold | 857 * @param {!Object} propertiesThreshold |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 940 else | 945 else |
| 941 propertiesThreshold.properties--; | 946 propertiesThreshold.properties--; |
| 942 if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0) { | 947 if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0) { |
| 943 preview.overflow = true; | 948 preview.overflow = true; |
| 944 } else { | 949 } else { |
| 945 push(preview.properties, property); | 950 push(preview.properties, property); |
| 946 } | 951 } |
| 947 }, | 952 }, |
| 948 | 953 |
| 949 /** | 954 /** |
| 950 * @param {!Object} object | 955 * @param {?Array<*>} entries |
| 951 * @param {!RuntimeAgent.ObjectPreview} preview | 956 * @param {!RuntimeAgent.ObjectPreview} preview |
| 952 * @param {boolean=} skipEntriesPreview | 957 * @param {boolean=} skipEntriesPreview |
| 953 */ | 958 */ |
| 954 _appendEntriesPreview: function(object, preview, skipEntriesPreview) | 959 _appendEntriesPreview: function(entries, preview, skipEntriesPreview) |
| 955 { | 960 { |
| 956 var entries = InjectedScriptHost.collectionEntries(object); | |
| 957 if (!entries) | 961 if (!entries) |
| 958 return; | 962 return; |
| 959 if (skipEntriesPreview) { | 963 if (skipEntriesPreview) { |
| 960 if (entries.length) | 964 if (entries.length) |
| 961 preview.overflow = true; | 965 preview.overflow = true; |
| 962 return; | 966 return; |
| 963 } | 967 } |
| 964 preview.entries = []; | 968 preview.entries = []; |
| 965 var entriesThreshold = 5; | 969 var entriesThreshold = 5; |
| 966 for (var i = 0; i < entries.length; ++i) { | 970 for (var i = 0; i < entries.length; ++i) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1006 return string.substr(0, leftHalf) + "\u2026" + string.substr(string. length - rightHalf, rightHalf); | 1010 return string.substr(0, leftHalf) + "\u2026" + string.substr(string. length - rightHalf, rightHalf); |
| 1007 } | 1011 } |
| 1008 return string.substr(0, maxLength) + "\u2026"; | 1012 return string.substr(0, maxLength) + "\u2026"; |
| 1009 }, | 1013 }, |
| 1010 | 1014 |
| 1011 __proto__: null | 1015 __proto__: null |
| 1012 } | 1016 } |
| 1013 | 1017 |
| 1014 return injectedScript; | 1018 return injectedScript; |
| 1015 }) | 1019 }) |
| OLD | NEW |