From 5315df475e6322489a28d61370b5b1b06e014691 Mon Sep 17 00:00:00 2001 From: lushnikov Date: Wed, 10 Feb 2016 16:24:17 -0800 Subject: [PATCH] DevTools: [Console] speedup array autocompletion The patch avoids serializing array indexes in getCompletions function. BUG=585877 R=pfeldman, kozyatinskiy Review URL: https://codereview.chromium.org/1685683006 Cr-Commit-Position: refs/heads/master@{#374801} --- front_end/sdk/RuntimeModel.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/front_end/sdk/RuntimeModel.js b/front_end/sdk/RuntimeModel.js index d5a8cd049f..91933f1230 100644 --- a/front_end/sdk/RuntimeModel.js +++ b/front_end/sdk/RuntimeModel.js @@ -451,8 +451,13 @@ WebInspector.ExecutionContext.prototype = { if (type === "array" && o === object && ArrayBuffer.isView(o) && o.length > 9999) continue; var names = Object.getOwnPropertyNames(o); - for (var i = 0; i < names.length; ++i) + var isArray = Array.isArray(o); + for (var i = 0; i < names.length; ++i) { + // Skip array elements indexes. + if (isArray && /^[0-9]/.test(names[i])) + continue; resultSet[names[i]] = true; + } } catch (e) { } }