Title: [187959] trunk
Revision
187959
Author
commit-qu...@webkit.org
Date
2015-08-05 07:04:47 -0700 (Wed, 05 Aug 2015)

Log Message

Web Inspector: Improve Support for PropertyName Iterator (Reflect.enumerate) in Inspector
https://bugs.webkit.org/show_bug.cgi?id=147679

Patch by Joseph Pecoraro <pecor...@apple.com> on 2015-08-05
Reviewed by Timothy Hatcher.

Source/_javascript_Core:

Improve native iterator support for the PropertyName Iterator by
allowing inspection of the internal object within the iterator
and peeking of the next upcoming values of the iterator.

* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::subtype):
(Inspector::JSInjectedScriptHost::getInternalProperties):
(Inspector::JSInjectedScriptHost::iteratorEntries):
* runtime/JSPropertyNameIterator.h:
(JSC::JSPropertyNameIterator::iteratedValue):

LayoutTests:

* inspector/model/remote-object-expected.txt:
* inspector/model/remote-object.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (187958 => 187959)


--- trunk/LayoutTests/ChangeLog	2015-08-05 10:27:18 UTC (rev 187958)
+++ trunk/LayoutTests/ChangeLog	2015-08-05 14:04:47 UTC (rev 187959)
@@ -1,3 +1,13 @@
+2015-08-05  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Improve Support for PropertyName Iterator (Reflect.enumerate) in Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=147679
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/model/remote-object-expected.txt:
+        * inspector/model/remote-object.html:
+
 2015-08-04  Simon Fraser  <simon.fra...@apple.com>
 
         Put Yosemite mac editing results in the correct location.

Modified: trunk/LayoutTests/inspector/model/remote-object-expected.txt (187958 => 187959)


--- trunk/LayoutTests/inspector/model/remote-object-expected.txt	2015-08-05 10:27:18 UTC (rev 187958)
+++ trunk/LayoutTests/inspector/model/remote-object-expected.txt	2015-08-05 14:04:47 UTC (rev 187959)
@@ -3748,6 +3748,162 @@
 }
 
 -----------------------------------------------------
+_expression_: Reflect.enumerate({a:1, b:2, c:3})
+{
+  "_type": "object",
+  "_subtype": "iterator",
+  "_objectId": "<filtered>",
+  "_description": "PropertyName Iterator",
+  "_preview": {
+    "_type": "object",
+    "_subtype": "iterator",
+    "_description": "PropertyName Iterator",
+    "_lossless": true,
+    "_overflow": false,
+    "_properties": [
+      {
+        "_name": "object",
+        "_type": "object",
+        "_valuePreview": {
+          "_type": "object",
+          "_description": "Object",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": [
+            {
+              "_name": "a",
+              "_type": "number",
+              "_value": "1"
+            },
+            {
+              "_name": "b",
+              "_type": "number",
+              "_value": "2"
+            },
+            {
+              "_name": "c",
+              "_type": "number",
+              "_value": "3"
+            }
+          ],
+          "_entries": null
+        },
+        "_internal": true
+      }
+    ],
+    "_entries": [
+      {
+        "_value": {
+          "_type": "string",
+          "_description": "a",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": null,
+          "_entries": null
+        }
+      },
+      {
+        "_value": {
+          "_type": "string",
+          "_description": "b",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": null,
+          "_entries": null
+        }
+      },
+      {
+        "_value": {
+          "_type": "string",
+          "_description": "c",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": null,
+          "_entries": null
+        }
+      }
+    ]
+  }
+}
+
+-----------------------------------------------------
+_expression_: Reflect.enumerate([1, 2, 3, 4, 5, 6, 7])
+{
+  "_type": "object",
+  "_subtype": "iterator",
+  "_objectId": "<filtered>",
+  "_description": "PropertyName Iterator",
+  "_preview": {
+    "_type": "object",
+    "_subtype": "iterator",
+    "_description": "PropertyName Iterator",
+    "_lossless": false,
+    "_overflow": true,
+    "_properties": [
+      {
+        "_name": "object",
+        "_type": "object",
+        "_subtype": "array",
+        "_value": "Array",
+        "_internal": true
+      }
+    ],
+    "_entries": [
+      {
+        "_value": {
+          "_type": "string",
+          "_description": "0",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": null,
+          "_entries": null
+        }
+      },
+      {
+        "_value": {
+          "_type": "string",
+          "_description": "1",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": null,
+          "_entries": null
+        }
+      },
+      {
+        "_value": {
+          "_type": "string",
+          "_description": "2",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": null,
+          "_entries": null
+        }
+      },
+      {
+        "_value": {
+          "_type": "string",
+          "_description": "3",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": null,
+          "_entries": null
+        }
+      },
+      {
+        "_value": {
+          "_type": "string",
+          "_description": "4",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": null,
+          "_entries": null
+        }
+      }
+    ]
+  }
+}
+
+-----------------------------------------------------
 _expression_: new Promise(function(){})
 {
   "_type": "object",

Modified: trunk/LayoutTests/inspector/model/remote-object.html (187958 => 187959)


--- trunk/LayoutTests/inspector/model/remote-object.html	2015-08-05 10:27:18 UTC (rev 187958)
+++ trunk/LayoutTests/inspector/model/remote-object.html	2015-08-05 14:04:47 UTC (rev 187959)
@@ -155,6 +155,8 @@
         {_expression_: "set = new Set; for (var i = 0; i <= 100; i++) set.add(i); set.values()"},
         {_expression_: "map.entries()"},
         {_expression_: "x = undefined; (function() { x = arguments; })(1, 'two'); x[Symbol.iterator]()"},
+        {_expression_: "Reflect.enumerate({a:1, b:2, c:3})"},
+        {_expression_: "Reflect.enumerate([1, 2, 3, 4, 5, 6, 7])"},
 
         // Promise
         {_expression_: "new Promise(function(){})"},

Modified: trunk/Source/_javascript_Core/ChangeLog (187958 => 187959)


--- trunk/Source/_javascript_Core/ChangeLog	2015-08-05 10:27:18 UTC (rev 187958)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-08-05 14:04:47 UTC (rev 187959)
@@ -1,3 +1,21 @@
+2015-08-05  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Improve Support for PropertyName Iterator (Reflect.enumerate) in Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=147679
+
+        Reviewed by Timothy Hatcher.
+
+        Improve native iterator support for the PropertyName Iterator by
+        allowing inspection of the internal object within the iterator
+        and peeking of the next upcoming values of the iterator.
+
+        * inspector/JSInjectedScriptHost.cpp:
+        (Inspector::JSInjectedScriptHost::subtype):
+        (Inspector::JSInjectedScriptHost::getInternalProperties):
+        (Inspector::JSInjectedScriptHost::iteratorEntries):
+        * runtime/JSPropertyNameIterator.h:
+        (JSC::JSPropertyNameIterator::iteratedValue):
+
 2015-08-04  Brent Fulgham  <bfulg...@apple.com>
 
         [Win] Update Apple Windows build for VS2015

Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp (187958 => 187959)


--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp	2015-08-05 10:27:18 UTC (rev 187958)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp	2015-08-05 14:04:47 UTC (rev 187959)
@@ -40,6 +40,7 @@
 #include "JSMap.h"
 #include "JSMapIterator.h"
 #include "JSPromise.h"
+#include "JSPropertyNameIterator.h"
 #include "JSSet.h"
 #include "JSSetIterator.h"
 #include "JSStringIterator.h"
@@ -165,7 +166,8 @@
     if (value.inherits(JSArrayIterator::info())
         || value.inherits(JSMapIterator::info())
         || value.inherits(JSSetIterator::info())
-        || value.inherits(JSStringIterator::info()))
+        || value.inherits(JSStringIterator::info())
+        || value.inherits(JSPropertyNameIterator::info()))
         return jsNontrivialString(exec, ASCIILiteral("iterator"));
 
     if (value.inherits(JSInt8Array::info()) || value.inherits(JSInt16Array::info()) || value.inherits(JSInt32Array::info()))
@@ -336,6 +338,13 @@
         return array;
     }
 
+    if (JSPropertyNameIterator* propertyNameIterator = jsDynamicCast<JSPropertyNameIterator*>(value)) {
+        unsigned index = 0;
+        JSArray* array = constructEmptyArray(exec, nullptr, 1);
+        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "object", propertyNameIterator->iteratedValue()));
+        return array;
+    }
+
     return jsUndefined();
 }
 
@@ -441,6 +450,8 @@
         iterator = setIterator->clone(exec);
     else if (JSStringIterator* stringIterator = jsDynamicCast<JSStringIterator*>(value))
         iterator = stringIterator->clone(exec);
+    else if (JSPropertyNameIterator* propertyNameIterator = jsDynamicCast<JSPropertyNameIterator*>(value))
+        iterator = propertyNameIterator->clone(exec);
     else
         return jsUndefined();
 

Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h (187958 => 187959)


--- trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h	2015-08-05 10:27:18 UTC (rev 187958)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h	2015-08-05 14:04:47 UTC (rev 187959)
@@ -54,6 +54,8 @@
     JSPropertyNameIterator* clone(ExecState*);
     bool next(ExecState*, JSValue&);
 
+    JSValue iteratedValue() const { return m_iteratedObject.get(); }
+
     static void visitChildren(JSCell*, SlotVisitor&);
 
 private:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to