Log Message
REGRESSION(r200422): Web Inspector: Make new Array Iterator objects play nice with Web Inspector https://bugs.webkit.org/show_bug.cgi?id=157361 <rdar://problem/26099793>
Patch by Joseph Pecoraro <[email protected]> on 2016-05-05 Reviewed by Timothy Hatcher. Source/_javascript_Core: * builtins/ArrayPrototype.js: (createArrayIterator): (values): (keys): (entries): * builtins/TypedArrayPrototype.js: (values): (keys): (entries): * runtime/CommonIdentifiers.h: Set the kind on the iterator object, that can be shown to the inspector if the object is shown in the console. * inspector/InjectedScriptSource.js: (InjectedScript.prototype._describe): Get a better name for the new Array Iterator which is just an Object. * inspector/JSInjectedScriptHost.cpp: (Inspector::JSInjectedScriptHost::subtype): (Inspector::JSInjectedScriptHost::getInternalProperties): Detect and handle ArrayIterator object instances. Porting the code from the JSArrayIterator code path. LayoutTests: * platform/mac/inspector/model/remote-object-expected.txt:
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/platform/mac/inspector/model/remote-object-expected.txt
- trunk/Source/_javascript_Core/ChangeLog
- trunk/Source/_javascript_Core/builtins/ArrayPrototype.js
- trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js
- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js
- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp
- trunk/Source/_javascript_Core/runtime/ArrayIteratorPrototype.cpp
- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h
Diff
Modified: trunk/LayoutTests/ChangeLog (200498 => 200499)
--- trunk/LayoutTests/ChangeLog 2016-05-06 00:05:04 UTC (rev 200498)
+++ trunk/LayoutTests/ChangeLog 2016-05-06 01:15:24 UTC (rev 200499)
@@ -1,3 +1,13 @@
+2016-05-05 Joseph Pecoraro <[email protected]>
+
+ REGRESSION(r200422): Web Inspector: Make new Array Iterator objects play nice with Web Inspector
+ https://bugs.webkit.org/show_bug.cgi?id=157361
+ <rdar://problem/26099793>
+
+ Reviewed by Timothy Hatcher.
+
+ * platform/mac/inspector/model/remote-object-expected.txt:
+
2016-05-05 Commit Queue <[email protected]>
Unreviewed, rolling out r200479.
Modified: trunk/LayoutTests/platform/mac/inspector/model/remote-object-expected.txt (200498 => 200499)
--- trunk/LayoutTests/platform/mac/inspector/model/remote-object-expected.txt 2016-05-06 00:05:04 UTC (rev 200498)
+++ trunk/LayoutTests/platform/mac/inspector/model/remote-object-expected.txt 2016-05-06 01:15:24 UTC (rev 200499)
@@ -3360,16 +3360,44 @@
_expression_: [][Symbol.iterator]()
{
"_type": "object",
+ "_subtype": "iterator",
"_objectId": "<filtered>",
- "_description": "Object",
+ "_description": "Array Iterator",
"_preview": {
"_listeners": null,
"_type": "object",
- "_description": "Object",
+ "_subtype": "iterator",
+ "_description": "Array Iterator",
"_lossless": true,
"_overflow": false,
- "_properties": [],
- "_entries": null
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "array",
+ "_type": "object",
+ "_subtype": "array",
+ "_valuePreview": {
+ "_listeners": null,
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 0,
+ "_properties": [],
+ "_entries": null
+ },
+ "_internal": true
+ },
+ {
+ "_listeners": null,
+ "_name": "kind",
+ "_type": "string",
+ "_value": "value",
+ "_internal": true
+ }
+ ],
+ "_entries": []
}
}
@@ -3377,16 +3405,64 @@
_expression_: [1][Symbol.iterator]()
{
"_type": "object",
+ "_subtype": "iterator",
"_objectId": "<filtered>",
- "_description": "Object",
+ "_description": "Array Iterator",
"_preview": {
"_listeners": null,
"_type": "object",
- "_description": "Object",
+ "_subtype": "iterator",
+ "_description": "Array Iterator",
"_lossless": true,
"_overflow": false,
- "_properties": [],
- "_entries": null
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "array",
+ "_type": "object",
+ "_subtype": "array",
+ "_valuePreview": {
+ "_listeners": null,
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 1,
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "0",
+ "_type": "number",
+ "_value": "1"
+ }
+ ],
+ "_entries": null
+ },
+ "_internal": true
+ },
+ {
+ "_listeners": null,
+ "_name": "kind",
+ "_type": "string",
+ "_value": "value",
+ "_internal": true
+ }
+ ],
+ "_entries": [
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "number",
+ "_description": "1",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ }
+ ]
}
}
@@ -3394,16 +3470,95 @@
_expression_: [1, 'two', 3, 'four', 5, 'size'][Symbol.iterator]()
{
"_type": "object",
+ "_subtype": "iterator",
"_objectId": "<filtered>",
- "_description": "Object",
+ "_description": "Array Iterator",
"_preview": {
"_listeners": null,
"_type": "object",
- "_description": "Object",
- "_lossless": true,
- "_overflow": false,
- "_properties": [],
- "_entries": null
+ "_subtype": "iterator",
+ "_description": "Array Iterator",
+ "_lossless": false,
+ "_overflow": true,
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "array",
+ "_type": "object",
+ "_subtype": "array",
+ "_value": "Array",
+ "_internal": true
+ },
+ {
+ "_listeners": null,
+ "_name": "kind",
+ "_type": "string",
+ "_value": "value",
+ "_internal": true
+ }
+ ],
+ "_entries": [
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "number",
+ "_description": "1",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "string",
+ "_description": "two",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "number",
+ "_description": "3",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "string",
+ "_description": "four",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "number",
+ "_description": "5",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ }
+ ]
}
}
@@ -3411,16 +3566,95 @@
_expression_: [1, 'two', 3, 'four', 5, 'size'].keys()
{
"_type": "object",
+ "_subtype": "iterator",
"_objectId": "<filtered>",
- "_description": "Object",
+ "_description": "Array Iterator",
"_preview": {
"_listeners": null,
"_type": "object",
- "_description": "Object",
- "_lossless": true,
- "_overflow": false,
- "_properties": [],
- "_entries": null
+ "_subtype": "iterator",
+ "_description": "Array Iterator",
+ "_lossless": false,
+ "_overflow": true,
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "array",
+ "_type": "object",
+ "_subtype": "array",
+ "_value": "Array",
+ "_internal": true
+ },
+ {
+ "_listeners": null,
+ "_name": "kind",
+ "_type": "string",
+ "_value": "key",
+ "_internal": true
+ }
+ ],
+ "_entries": [
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "number",
+ "_description": "0",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "number",
+ "_description": "1",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "number",
+ "_description": "2",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "number",
+ "_description": "3",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "number",
+ "_description": "4",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ }
+ ]
}
}
@@ -3428,16 +3662,170 @@
_expression_: [1, 'two', 3, 'four', 5, 'size'].entries()
{
"_type": "object",
+ "_subtype": "iterator",
"_objectId": "<filtered>",
- "_description": "Object",
+ "_description": "Array Iterator",
"_preview": {
"_listeners": null,
"_type": "object",
- "_description": "Object",
- "_lossless": true,
- "_overflow": false,
- "_properties": [],
- "_entries": null
+ "_subtype": "iterator",
+ "_description": "Array Iterator",
+ "_lossless": false,
+ "_overflow": true,
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "array",
+ "_type": "object",
+ "_subtype": "array",
+ "_value": "Array",
+ "_internal": true
+ },
+ {
+ "_listeners": null,
+ "_name": "kind",
+ "_type": "string",
+ "_value": "key+value",
+ "_internal": true
+ }
+ ],
+ "_entries": [
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 2,
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "0",
+ "_type": "number",
+ "_value": "0"
+ },
+ {
+ "_listeners": null,
+ "_name": "1",
+ "_type": "number",
+ "_value": "1"
+ }
+ ],
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 2,
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "0",
+ "_type": "number",
+ "_value": "1"
+ },
+ {
+ "_listeners": null,
+ "_name": "1",
+ "_type": "string",
+ "_value": "two"
+ }
+ ],
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 2,
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "0",
+ "_type": "number",
+ "_value": "2"
+ },
+ {
+ "_listeners": null,
+ "_name": "1",
+ "_type": "number",
+ "_value": "3"
+ }
+ ],
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 2,
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "0",
+ "_type": "number",
+ "_value": "3"
+ },
+ {
+ "_listeners": null,
+ "_name": "1",
+ "_type": "string",
+ "_value": "four"
+ }
+ ],
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 2,
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "0",
+ "_type": "number",
+ "_value": "4"
+ },
+ {
+ "_listeners": null,
+ "_name": "1",
+ "_type": "number",
+ "_value": "5"
+ }
+ ],
+ "_entries": null
+ }
+ }
+ ]
}
}
@@ -3841,16 +4229,82 @@
_expression_: x = undefined; (function() { x = arguments; })(1, 'two'); x[Symbol.iterator]()
{
"_type": "object",
+ "_subtype": "iterator",
"_objectId": "<filtered>",
- "_description": "Object",
+ "_description": "Array Iterator",
"_preview": {
"_listeners": null,
"_type": "object",
- "_description": "Object",
+ "_subtype": "iterator",
+ "_description": "Array Iterator",
"_lossless": true,
"_overflow": false,
- "_properties": [],
- "_entries": null
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "array",
+ "_type": "object",
+ "_subtype": "array",
+ "_valuePreview": {
+ "_listeners": null,
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Arguments",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 2,
+ "_properties": [
+ {
+ "_listeners": null,
+ "_name": "0",
+ "_type": "number",
+ "_value": "1"
+ },
+ {
+ "_listeners": null,
+ "_name": "1",
+ "_type": "string",
+ "_value": "two"
+ }
+ ],
+ "_entries": null
+ },
+ "_internal": true
+ },
+ {
+ "_listeners": null,
+ "_name": "kind",
+ "_type": "string",
+ "_value": "value",
+ "_internal": true
+ }
+ ],
+ "_entries": [
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "number",
+ "_description": "1",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ },
+ {
+ "_listeners": null,
+ "_value": {
+ "_listeners": null,
+ "_type": "string",
+ "_description": "two",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": null,
+ "_entries": null
+ }
+ }
+ ]
}
}
Modified: trunk/Source/_javascript_Core/ChangeLog (200498 => 200499)
--- trunk/Source/_javascript_Core/ChangeLog 2016-05-06 00:05:04 UTC (rev 200498)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-05-06 01:15:24 UTC (rev 200499)
@@ -1,3 +1,34 @@
+2016-05-05 Joseph Pecoraro <[email protected]>
+
+ REGRESSION(r200422): Web Inspector: Make new Array Iterator objects play nice with Web Inspector
+ https://bugs.webkit.org/show_bug.cgi?id=157361
+ <rdar://problem/26099793>
+
+ Reviewed by Timothy Hatcher.
+
+ * builtins/ArrayPrototype.js:
+ (createArrayIterator):
+ (values):
+ (keys):
+ (entries):
+ * builtins/TypedArrayPrototype.js:
+ (values):
+ (keys):
+ (entries):
+ * runtime/CommonIdentifiers.h:
+ Set the kind on the iterator object, that can be shown
+ to the inspector if the object is shown in the console.
+
+ * inspector/InjectedScriptSource.js:
+ (InjectedScript.prototype._describe):
+ Get a better name for the new Array Iterator which is just an Object.
+
+ * inspector/JSInjectedScriptHost.cpp:
+ (Inspector::JSInjectedScriptHost::subtype):
+ (Inspector::JSInjectedScriptHost::getInternalProperties):
+ Detect and handle ArrayIterator object instances. Porting the code
+ from the JSArrayIterator code path.
+
2016-05-05 Benjamin Poulain <[email protected]>
[JSC] In DFG, an OSR Exit on SetLocal can trash its child node
Modified: trunk/Source/_javascript_Core/builtins/ArrayPrototype.js (200498 => 200499)
--- trunk/Source/_javascript_Core/builtins/ArrayPrototype.js 2016-05-06 00:05:04 UTC (rev 200498)
+++ trunk/Source/_javascript_Core/builtins/ArrayPrototype.js 2016-05-06 01:15:24 UTC (rev 200499)
@@ -25,9 +25,10 @@
*/
@constructor
-function createArrayIterator(iteratedObject, iterationFunction)
+function createArrayIterator(iteratedObject, kind, iterationFunction)
{
this.@iteratedObject = iteratedObject;
+ this.@arrayIteratorKind = kind;
this.@arrayIteratorNextIndex = 0;
this.@arrayIteratorNext = iterationFunction;
this.@arrayIteratorIsDone = false;
@@ -41,7 +42,7 @@
throw new @TypeError("Array.prototype.values requires that |this| not be null");
throw new @TypeError("Array.prototype.values requires that |this| not be undefined");
}
- return new @createArrayIterator(@Object(this), @arrayIteratorValueNext);
+ return new @createArrayIterator(@Object(this), "value", @arrayIteratorValueNext);
}
function keys()
@@ -53,7 +54,7 @@
throw new @TypeError("Array.prototype.keys requires that |this| not be undefined");
}
- return new @createArrayIterator(@Object(this), @arrayIteratorKeyNext);
+ return new @createArrayIterator(@Object(this), "key", @arrayIteratorKeyNext);
}
function entries()
@@ -65,7 +66,7 @@
throw new @TypeError("Array.prototype.entries requires that |this| not be undefined");
}
- return new @createArrayIterator(@Object(this), @arrayIteratorKeyValueNext);
+ return new @createArrayIterator(@Object(this), "key+value", @arrayIteratorKeyValueNext);
}
function reduce(callback /*, initialValue */)
Modified: trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js (200498 => 200499)
--- trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js 2016-05-06 00:05:04 UTC (rev 200498)
+++ trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js 2016-05-06 01:15:24 UTC (rev 200499)
@@ -30,21 +30,21 @@
{
"use strict";
@typedArrayLength(this);
- return new @createArrayIterator(this, @arrayIteratorValueNext);
+ return new @createArrayIterator(this, "value", @arrayIteratorValueNext);
}
function keys()
{
"use strict";
@typedArrayLength(this);
- return new @createArrayIterator(this, @arrayIteratorKeyNext);
+ return new @createArrayIterator(this, "key", @arrayIteratorKeyNext);
}
function entries()
{
"use strict";
@typedArrayLength(this);
- return new @createArrayIterator(this, @arrayIteratorKeyValueNext);
+ return new @createArrayIterator(this, "key+value", @arrayIteratorKeyValueNext);
}
function every(callback /*, thisArg */)
Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (200498 => 200499)
--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2016-05-06 00:05:04 UTC (rev 200498)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2016-05-06 01:15:24 UTC (rev 200499)
@@ -863,6 +863,9 @@
if (subtype === "array")
return className;
+ if (subtype === "iterator" && Symbol.toStringTag in obj)
+ return obj[Symbol.toStringTag];
+
// NodeList in JSC is a function, check for array prior to this.
if (typeof obj === "function")
return toString(obj);
Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp (200498 => 200499)
--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp 2016-05-06 00:05:04 UTC (rev 200498)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp 2016-05-06 01:15:24 UTC (rev 200499)
@@ -161,6 +161,9 @@
|| value.inherits(JSPropertyNameIterator::info()))
return jsNontrivialString(exec, ASCIILiteral("iterator"));
+ if (object && object->getDirect(exec->vm(), exec->vm().propertyNames->builtinNames().arrayIteratorNextIndexPrivateName()))
+ return jsNontrivialString(exec, ASCIILiteral("iterator"));
+
if (value.inherits(JSInt8Array::info()) || value.inherits(JSInt16Array::info()) || value.inherits(JSInt32Array::info()))
return jsNontrivialString(exec, ASCIILiteral("array"));
if (value.inherits(JSUint8Array::info()) || value.inherits(JSUint16Array::info()) || value.inherits(JSUint32Array::info()))
@@ -270,6 +273,19 @@
return array;
}
+ if (JSObject* iteratorObject = jsDynamicCast<JSObject*>(value)) {
+ if (iteratorObject->getDirect(exec->vm(), exec->vm().propertyNames->builtinNames().arrayIteratorNextIndexPrivateName())) {
+ JSValue iteratedValue = iteratorObject->getDirect(exec->vm(), exec->vm().propertyNames->builtinNames().iteratedObjectPrivateName());
+ JSValue kind = iteratorObject->getDirect(exec->vm(), exec->vm().propertyNames->builtinNames().arrayIteratorKindPrivateName());
+
+ unsigned index = 0;
+ JSArray* array = constructEmptyArray(exec, nullptr, 2);
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "array", iteratedValue));
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", kind));
+ return array;
+ }
+ }
+
if (JSArrayIterator* arrayIterator = jsDynamicCast<JSArrayIterator*>(value)) {
String kind;
switch (arrayIterator->kind(exec)) {
Modified: trunk/Source/_javascript_Core/runtime/ArrayIteratorPrototype.cpp (200498 => 200499)
--- trunk/Source/_javascript_Core/runtime/ArrayIteratorPrototype.cpp 2016-05-06 00:05:04 UTC (rev 200498)
+++ trunk/Source/_javascript_Core/runtime/ArrayIteratorPrototype.cpp 2016-05-06 01:15:24 UTC (rev 200499)
@@ -26,12 +26,7 @@
#include "config.h"
#include "ArrayIteratorPrototype.h"
-namespace JSC {
-
-}
-
#include "ArrayIteratorPrototype.lut.h"
-
#include "IteratorOperations.h"
#include "JSArrayIterator.h"
#include "JSCInlines.h"
Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (200498 => 200499)
--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h 2016-05-06 00:05:04 UTC (rev 200498)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h 2016-05-06 01:15:24 UTC (rev 200499)
@@ -331,6 +331,7 @@
macro(arrayIterationKind) \
macro(arrayIteratorNext) \
macro(arrayIteratorIsDone) \
+ macro(arrayIteratorKind) \
macro(charCodeAt) \
macro(iteratedString) \
macro(stringIteratorNextIndex) \
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
