Title: [205168] trunk
Revision
205168
Author
[email protected]
Date
2016-08-29 19:07:12 -0700 (Mon, 29 Aug 2016)

Log Message

REGRESSION(r202568): Web Inspector: Expanding Array Prototype in Console shows no properties
https://bugs.webkit.org/show_bug.cgi?id=161263
<rdar://problem/28035849>

Patch by Joseph Pecoraro <[email protected]> on 2016-08-29
Reviewed by Matt Baker.

Source/_javascript_Core:

* inspector/InjectedScriptSource.js:
(InjectedScript.prototype._propertyDescriptors):
Previously we only took the "numeric index fast path" if an object was
array like with length > 100. When we dropped the length check we
ended up breaking our display of Array prototype, because [].__proto__
is an array instance. Get it back by just doing a check of length > 0.
We may want to address this differently in the future by knowing if
we are getting properties for a prototype or not.

LayoutTests:

* inspector/model/remote-object-get-properties-expected.txt:
* inspector/model/remote-object-get-properties.html:
Include tests for an Array and an Array's proto (which is an Array).

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (205167 => 205168)


--- trunk/LayoutTests/ChangeLog	2016-08-30 01:56:37 UTC (rev 205167)
+++ trunk/LayoutTests/ChangeLog	2016-08-30 02:07:12 UTC (rev 205168)
@@ -1,3 +1,15 @@
+2016-08-29  Joseph Pecoraro  <[email protected]>
+
+        REGRESSION(r202568): Web Inspector: Expanding Array Prototype in Console shows no properties
+        https://bugs.webkit.org/show_bug.cgi?id=161263
+        <rdar://problem/28035849>
+
+        Reviewed by Matt Baker.
+
+        * inspector/model/remote-object-get-properties-expected.txt:
+        * inspector/model/remote-object-get-properties.html:
+        Include tests for an Array and an Array's proto (which is an Array).
+
 2016-08-29  Dean Jackson  <[email protected]>
 
         JSON.stringify returns empty when used with performance.timing.

Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt (205167 => 205168)


--- trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt	2016-08-30 01:56:37 UTC (rev 205167)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt	2016-08-30 02:07:12 UTC (rev 205168)
@@ -32,6 +32,195 @@
 -----------------------------------------------------
 
 -----------------------------------------------------
+_expression_: window.simpleArray
+type: object
+subtype: array
+description: Array
+
+OWN PROPERTIES:
+    0
+    1
+    2
+    __proto__
+
+DISPLAYABLE PROPERTIES:
+    0
+    1
+    2
+    __proto__
+
+ALL PROPERTIES:
+    0
+    1
+    2
+    length
+    toString
+    values
+    toLocaleString
+    concat
+    fill
+    join
+    pop
+    push
+    reverse
+    shift
+    slice
+    sort
+    splice
+    unshift
+    every
+    forEach
+    some
+    indexOf
+    lastIndexOf
+    filter
+    reduce
+    reduceRight
+    map
+    entries
+    keys
+    find
+    findIndex
+    includes
+    copyWithin
+    constructor
+    Symbol(Symbol.iterator)
+    Symbol(Symbol.unscopables)
+    valueOf
+    hasOwnProperty
+    propertyIsEnumerable
+    isPrototypeOf
+    __defineGetter__
+    __defineSetter__
+    __lookupGetter__
+    __lookupSetter__
+    __proto__
+-----------------------------------------------------
+
+-----------------------------------------------------
+_expression_: window.arrayProto
+type: object
+subtype: array
+description: Array
+
+OWN PROPERTIES:
+    length
+    toString
+    values
+    toLocaleString
+    concat
+    fill
+    join
+    pop
+    push
+    reverse
+    shift
+    slice
+    sort
+    splice
+    unshift
+    every
+    forEach
+    some
+    indexOf
+    lastIndexOf
+    filter
+    reduce
+    reduceRight
+    map
+    entries
+    keys
+    find
+    findIndex
+    includes
+    copyWithin
+    constructor
+    Symbol(Symbol.iterator)
+    Symbol(Symbol.unscopables)
+    __proto__
+
+DISPLAYABLE PROPERTIES:
+    length
+    toString
+    values
+    toLocaleString
+    concat
+    fill
+    join
+    pop
+    push
+    reverse
+    shift
+    slice
+    sort
+    splice
+    unshift
+    every
+    forEach
+    some
+    indexOf
+    lastIndexOf
+    filter
+    reduce
+    reduceRight
+    map
+    entries
+    keys
+    find
+    findIndex
+    includes
+    copyWithin
+    constructor
+    Symbol(Symbol.iterator)
+    Symbol(Symbol.unscopables)
+    __proto__
+
+ALL PROPERTIES:
+    length
+    toString
+    values
+    toLocaleString
+    concat
+    fill
+    join
+    pop
+    push
+    reverse
+    shift
+    slice
+    sort
+    splice
+    unshift
+    every
+    forEach
+    some
+    indexOf
+    lastIndexOf
+    filter
+    reduce
+    reduceRight
+    map
+    entries
+    keys
+    find
+    findIndex
+    includes
+    copyWithin
+    constructor
+    Symbol(Symbol.iterator)
+    Symbol(Symbol.unscopables)
+    valueOf
+    hasOwnProperty
+    propertyIsEnumerable
+    isPrototypeOf
+    __defineGetter__
+    __defineSetter__
+    __lookupGetter__
+    __lookupSetter__
+    __proto__
+-----------------------------------------------------
+
+-----------------------------------------------------
 _expression_: window.loadEvent
 type: object
 description: Event

Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties.html (205167 => 205168)


--- trunk/LayoutTests/inspector/model/remote-object-get-properties.html	2016-08-30 01:56:37 UTC (rev 205167)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties.html	2016-08-30 02:07:12 UTC (rev 205168)
@@ -39,6 +39,8 @@
 
 // window.loadEvent is set inside of <body _onload_="..."> below.
 var simpleObject = {a:1, b:"string"};
+var simpleArray = [1, "two", /three/];
+var arrayProto = [].__proto__;
 var complexObject = new SuperFoo;
 var badGetterObject = new ClassWithBadGetter;
 var unboundFunction = function() { console.log(arguments); }
@@ -54,6 +56,8 @@
     var currentStepIndex = 0;
     var steps = [
         {_expression_: "window.simpleObject"},
+        {_expression_: "window.simpleArray"},
+        {_expression_: "window.arrayProto"},
         {_expression_: "window.loadEvent"},
         {_expression_: "window.complexObject"},
         {_expression_: "window.badGetterObject"},

Modified: trunk/Source/_javascript_Core/ChangeLog (205167 => 205168)


--- trunk/Source/_javascript_Core/ChangeLog	2016-08-30 01:56:37 UTC (rev 205167)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-08-30 02:07:12 UTC (rev 205168)
@@ -1,3 +1,20 @@
+2016-08-29  Joseph Pecoraro  <[email protected]>
+
+        REGRESSION(r202568): Web Inspector: Expanding Array Prototype in Console shows no properties
+        https://bugs.webkit.org/show_bug.cgi?id=161263
+        <rdar://problem/28035849>
+
+        Reviewed by Matt Baker.
+
+        * inspector/InjectedScriptSource.js:
+        (InjectedScript.prototype._propertyDescriptors):
+        Previously we only took the "numeric index fast path" if an object was
+        array like with length > 100. When we dropped the length check we
+        ended up breaking our display of Array prototype, because [].__proto__
+        is an array instance. Get it back by just doing a check of length > 0.
+        We may want to address this differently in the future by knowing if
+        we are getting properties for a prototype or not.
+
 2016-08-29  Benjamin Poulain  <[email protected]>
 
         [JSC] Clean up FTL Capabilities for CompareEq

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (205167 => 205168)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js	2016-08-30 01:56:37 UTC (rev 205167)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js	2016-08-30 02:07:12 UTC (rev 205168)
@@ -675,7 +675,7 @@
         // For array types with a large length we attempt to skip getOwnPropertyNames and instead just sublist of indexes.
         var isArrayLike = false;
         try {
-            isArrayLike = injectedScript._subtype(object) === "array" && isFinite(object.length);
+            isArrayLike = injectedScript._subtype(object) === "array" && isFinite(object.length) && object.length > 0;
         } catch(e) {}
 
         for (var o = object; this._isDefined(o); o = o.__proto__) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to