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

Unified Diff: Source/core/inspector/InjectedScriptSource.js

Issue 135973010: Revert of DevTools: Fix console.log for arrays in some corner cases. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaselined Created 6 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InjectedScriptSource.js
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js
index 6e24ae32db5768606d24da74f657ec42ea352c42..b09cd5d51cade9985b3382ba1957b78ee2cb60e8 100644
--- a/Source/core/inspector/InjectedScriptSource.js
+++ b/Source/core/inspector/InjectedScriptSource.js
@@ -111,17 +111,6 @@ function nullifyObjectProto(obj)
}
/**
- * @param {string} name
- * @return {boolean}
- */
-function isArrayIndexPropertyName(name)
-{
- // Array index check according to the ES5-15.4.
- var index = name >>> 0;
- return toString(index) === name && index !== 0xffffffff;
-}
-
-/**
* @constructor
*/
var InjectedScript = function()
@@ -1066,9 +1055,8 @@ InjectedScript.RemoteObject.prototype = {
descriptors.push(nameToDescriptors["#" + firstLevelKeys[i]]);
}
- var isArray = (this.subtype === "array");
for (var i = 0; i < descriptors.length; ++i) {
- if (propertiesThreshold.indexes < 0 && propertiesThreshold.properties < 0)
+ if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0)
break;
var descriptor = descriptors[i];
@@ -1078,15 +1066,13 @@ InjectedScript.RemoteObject.prototype = {
preview.lossless = false;
continue;
}
+ if (!descriptor.enumerable && !descriptor.isOwn)
+ continue;
var name = descriptor.name;
if (name === "__proto__")
continue;
- if (isArray && name === "length")
- continue;
-
- var isArrayIndex = isArray && isArrayIndexPropertyName(name);
- if (!descriptor.enumerable && !descriptor.isOwn && !isArrayIndex)
+ if (this.subtype === "array" && name === "length")
continue;
if (!("value" in descriptor)) {
@@ -1154,12 +1140,11 @@ InjectedScript.RemoteObject.prototype = {
*/
_appendPropertyPreview: function(preview, property, propertiesThreshold)
{
- var threshold;
- if (isArrayIndexPropertyName(property.name))
- threshold = --propertiesThreshold.indexes;
+ if (toString(property.name >>> 0) === property.name)
+ propertiesThreshold.indexes--;
else
- threshold = --propertiesThreshold.properties;
- if (threshold < 0) {
+ propertiesThreshold.properties--;
+ if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0) {
preview.overflow = true;
preview.lossless = false;
} else {
« no previous file with comments | « LayoutTests/inspector/console/console-object-preview-expected.txt ('k') | Source/devtools/front_end/ConsoleMessage.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698