- Revision
- 202568
- Author
- [email protected]
- Date
- 2016-06-28 08:33:49 -0700 (Tue, 28 Jun 2016)
Log Message
Web Inspector: selectElement.options shows unexpected entries in console (named indexes beyond collection length)
https://bugs.webkit.org/show_bug.cgi?id=159192
Patch by Joseph Pecoraro <[email protected]> on 2016-06-28
Reviewed by Timothy Hatcher.
Source/_javascript_Core:
* inspector/InjectedScriptSource.js:
(InjectedScript.prototype.arrayIndexPropertyNames):
Start with an empty array because we just push valid indexes.
(InjectedScript.prototype._propertyDescriptors):
Avoid the >100 length requirement, and always treat the
array-like objects the same. The frontend currently
doesn't show named indexes for arrays anyways, so they
would have been unused.
LayoutTests:
* inspector/model/remote-object-get-properties-expected.txt:
* inspector/model/remote-object-get-properties.html:
* inspector/runtime/getProperties-expected.txt:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (202567 => 202568)
--- trunk/LayoutTests/ChangeLog 2016-06-28 15:32:39 UTC (rev 202567)
+++ trunk/LayoutTests/ChangeLog 2016-06-28 15:33:49 UTC (rev 202568)
@@ -1,3 +1,14 @@
+2016-06-28 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: selectElement.options shows unexpected entries in console (named indexes beyond collection length)
+ https://bugs.webkit.org/show_bug.cgi?id=159192
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/model/remote-object-get-properties-expected.txt:
+ * inspector/model/remote-object-get-properties.html:
+ * inspector/runtime/getProperties-expected.txt:
+
2016-06-28 Brian Burg <[email protected]>
Web Inspector: QuickConsole should update its selection when RuntimeManager.defaultExecutionContextIdentifier changes
Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt (202567 => 202568)
--- trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt 2016-06-28 15:32:39 UTC (rev 202567)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt 2016-06-28 15:33:49 UTC (rev 202568)
@@ -318,5 +318,43 @@
constructor
__proto__
-----------------------------------------------------
+
+-----------------------------------------------------
+_expression_: document.getElementById('my-select').options
+type: object
+subtype: array
+description: HTMLOptionsCollection
+
+OWN PROPERTIES:
+ 0
+ __proto__
+
+DISPLAYABLE PROPERTIES:
+ 0
+ selectedIndex
+ length
+ __proto__
+
+ALL PROPERTIES:
+ 0
+ constructor
+ selectedIndex
+ length
+ item
+ namedItem
+ add
+ remove
+ toString
+ toLocaleString
+ valueOf
+ hasOwnProperty
+ propertyIsEnumerable
+ isPrototypeOf
+ __defineGetter__
+ __defineSetter__
+ __lookupGetter__
+ __lookupSetter__
+ __proto__
+-----------------------------------------------------
DONE
Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties.html (202567 => 202568)
--- trunk/LayoutTests/inspector/model/remote-object-get-properties.html 2016-06-28 15:32:39 UTC (rev 202567)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties.html 2016-06-28 15:33:49 UTC (rev 202568)
@@ -45,7 +45,6 @@
var boundFunction = unboundFunction.bind(document.body, 1, 2, 3);
var objectWithSymbolProperties = {prop:1, [Symbol()]:2, [Symbol('sym')]:3, [Symbol('sym')]:4, [Symbol()]: Symbol(), prop2: 5};
-
// --------
// test
// --------
@@ -61,6 +60,7 @@
{_expression_: "window.unboundFunction"},
{_expression_: "window.boundFunction"},
{_expression_: "window.objectWithSymbolProperties"},
+ {_expression_: "document.getElementById('my-select').options"},
]
function runNextStep() {
@@ -115,5 +115,8 @@
</script>
</head>
<body _onload_="window.loadEvent = event; runTest()">
+ <select id="my-select" style="display: none">
+ <option name="1" id="attr_1" value="1"></option>
+ </select>
</body>
</html>
Modified: trunk/LayoutTests/inspector/runtime/getProperties-expected.txt (202567 => 202568)
--- trunk/LayoutTests/inspector/runtime/getProperties-expected.txt 2016-06-28 15:32:39 UTC (rev 202567)
+++ trunk/LayoutTests/inspector/runtime/getProperties-expected.txt 2016-06-28 15:33:49 UTC (rev 202568)
@@ -13,7 +13,6 @@
0 string red
1 string green
2 string blue
- length number 3
-- Running test case: CheckPropertiesOfBoundConstructor
Evaluating _expression_: Number.bind({}, 5)
Modified: trunk/Source/_javascript_Core/ChangeLog (202567 => 202568)
--- trunk/Source/_javascript_Core/ChangeLog 2016-06-28 15:32:39 UTC (rev 202567)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-06-28 15:33:49 UTC (rev 202568)
@@ -1,3 +1,20 @@
+2016-06-28 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: selectElement.options shows unexpected entries in console (named indexes beyond collection length)
+ https://bugs.webkit.org/show_bug.cgi?id=159192
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/InjectedScriptSource.js:
+ (InjectedScript.prototype.arrayIndexPropertyNames):
+ Start with an empty array because we just push valid indexes.
+
+ (InjectedScript.prototype._propertyDescriptors):
+ Avoid the >100 length requirement, and always treat the
+ array-like objects the same. The frontend currently
+ doesn't show named indexes for arrays anyways, so they
+ would have been unused.
+
2016-06-28 Per Arne Vollan <[email protected]>
[Win] Skip failing INTL test.
Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (202567 => 202568)
--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2016-06-28 15:32:39 UTC (rev 202567)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2016-06-28 15:33:49 UTC (rev 202568)
@@ -666,7 +666,7 @@
function arrayIndexPropertyNames(o, length)
{
- var array = new Array(length);
+ var array = [];
for (var i = 0; i < length; ++i) {
if (i in o)
array.push("" + i);
@@ -676,16 +676,16 @@
// FIXME: <https://webkit.org/b/143589> Web Inspector: Better handling for large collections in Object Trees
// For array types with a large length we attempt to skip getOwnPropertyNames and instead just sublist of indexes.
- var isArrayTypeWithLargeLength = false;
+ var isArrayLike = false;
try {
- isArrayTypeWithLargeLength = injectedScript._subtype(object) === "array" && isFinite(object.length) && object.length > 100;
+ isArrayLike = injectedScript._subtype(object) === "array" && isFinite(object.length);
} catch(e) {}
for (var o = object; this._isDefined(o); o = o.__proto__) {
var isOwnProperty = o === object;
- if (isArrayTypeWithLargeLength && isOwnProperty)
- processProperties(o, arrayIndexPropertyNames(o, 100), isOwnProperty);
+ if (isArrayLike && isOwnProperty)
+ processProperties(o, arrayIndexPropertyNames(o, Math.min(object.length, 100)), isOwnProperty);
else {
processProperties(o, Object.getOwnPropertyNames(o), isOwnProperty);
if (Object.getOwnPropertySymbols)