Title: [197061] trunk
Revision
197061
Author
commit-qu...@webkit.org
Date
2016-02-24 20:59:18 -0800 (Wed, 24 Feb 2016)

Log Message

Web Inspector: Expose Proxy target and handler internal properties to Inspector
https://bugs.webkit.org/show_bug.cgi?id=154663

Patch by Joseph Pecoraro <pecor...@apple.com> on 2016-02-24
Reviewed by Timothy Hatcher.

Source/_javascript_Core:

* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::getInternalProperties):
Expose the ProxyObject's target and handler.

Source/WebInspectorUI:

* UserInterface/Models/NativeFunctionParameters.js:
* UserInterface/Views/ObjectTreePropertyTreeElement.js:
(WebInspector.ObjectTreePropertyTreeElement.prototype._functionParameterString):
Improve the native parameter list for the global Reflect object methods.
Include "enumerate" even though it is deprecated, because we implement it.

LayoutTests:

* inspector/model/remote-object.html:
* platform/mac/inspector/model/remote-object-expected.txt:
Test that a Proxy object includes the internal properties.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197060 => 197061)


--- trunk/LayoutTests/ChangeLog	2016-02-25 02:39:19 UTC (rev 197060)
+++ trunk/LayoutTests/ChangeLog	2016-02-25 04:59:18 UTC (rev 197061)
@@ -1,3 +1,14 @@
+2016-02-24  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Expose Proxy target and handler internal properties to Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=154663
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/model/remote-object.html:
+        * platform/mac/inspector/model/remote-object-expected.txt:
+        Test that a Proxy object includes the internal properties.
+
 2016-02-24  Ryan Haddad  <ryanhad...@apple.com>
 
         Marking storage/indexeddb/odd-strings.html as flaky on mac-wk1

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


--- trunk/LayoutTests/inspector/model/remote-object-expected.txt	2016-02-25 02:39:19 UTC (rev 197060)
+++ trunk/LayoutTests/inspector/model/remote-object-expected.txt	2016-02-25 04:59:18 UTC (rev 197061)
@@ -4656,6 +4656,74 @@
 }
 
 -----------------------------------------------------
+_expression_: new Proxy({x:1, y:1}, {handler: true})
+{
+  "_type": "object",
+  "_objectId": "<filtered>",
+  "_description": "ProxyObject",
+  "_preview": {
+    "_listeners": null,
+    "_type": "object",
+    "_description": "ProxyObject",
+    "_lossless": true,
+    "_overflow": false,
+    "_properties": [
+      {
+        "_listeners": null,
+        "_name": "target",
+        "_type": "object",
+        "_valuePreview": {
+          "_listeners": null,
+          "_type": "object",
+          "_description": "Object",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": [
+            {
+              "_listeners": null,
+              "_name": "x",
+              "_type": "number",
+              "_value": "1"
+            },
+            {
+              "_listeners": null,
+              "_name": "y",
+              "_type": "number",
+              "_value": "1"
+            }
+          ],
+          "_entries": null
+        },
+        "_internal": true
+      },
+      {
+        "_listeners": null,
+        "_name": "handler",
+        "_type": "object",
+        "_valuePreview": {
+          "_listeners": null,
+          "_type": "object",
+          "_description": "Object",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": [
+            {
+              "_listeners": null,
+              "_name": "handler",
+              "_type": "boolean",
+              "_value": "true"
+            }
+          ],
+          "_entries": null
+        },
+        "_internal": true
+      }
+    ],
+    "_entries": null
+  }
+}
+
+-----------------------------------------------------
 _expression_: Person = class Person { constructor(name){} get fullName(){} methodName(p1, p2){} }; Person
 {
   "_type": "function",

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


--- trunk/LayoutTests/inspector/model/remote-object.html	2016-02-25 02:39:19 UTC (rev 197060)
+++ trunk/LayoutTests/inspector/model/remote-object.html	2016-02-25 04:59:18 UTC (rev 197061)
@@ -168,6 +168,9 @@
         {_expression_: "Promise.resolve()"},
         {_expression_: "Promise.resolve({result:1})"},
 
+        // Proxy
+        {_expression_: "new Proxy({x:1, y:1}, {handler: true})"},
+
     // Classes
 
         {_expression_: "Person = class Person { constructor(name){} get fullName(){} methodName(p1, p2){} }; Person"}, // Constructor => class type

Modified: trunk/LayoutTests/platform/mac/inspector/model/remote-object-expected.txt (197060 => 197061)


--- trunk/LayoutTests/platform/mac/inspector/model/remote-object-expected.txt	2016-02-25 02:39:19 UTC (rev 197060)
+++ trunk/LayoutTests/platform/mac/inspector/model/remote-object-expected.txt	2016-02-25 04:59:18 UTC (rev 197061)
@@ -4657,6 +4657,74 @@
 }
 
 -----------------------------------------------------
+_expression_: new Proxy({x:1, y:1}, {handler: true})
+{
+  "_type": "object",
+  "_objectId": "<filtered>",
+  "_description": "ProxyObject",
+  "_preview": {
+    "_listeners": null,
+    "_type": "object",
+    "_description": "ProxyObject",
+    "_lossless": true,
+    "_overflow": false,
+    "_properties": [
+      {
+        "_listeners": null,
+        "_name": "target",
+        "_type": "object",
+        "_valuePreview": {
+          "_listeners": null,
+          "_type": "object",
+          "_description": "Object",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": [
+            {
+              "_listeners": null,
+              "_name": "x",
+              "_type": "number",
+              "_value": "1"
+            },
+            {
+              "_listeners": null,
+              "_name": "y",
+              "_type": "number",
+              "_value": "1"
+            }
+          ],
+          "_entries": null
+        },
+        "_internal": true
+      },
+      {
+        "_listeners": null,
+        "_name": "handler",
+        "_type": "object",
+        "_valuePreview": {
+          "_listeners": null,
+          "_type": "object",
+          "_description": "Object",
+          "_lossless": true,
+          "_overflow": false,
+          "_properties": [
+            {
+              "_listeners": null,
+              "_name": "handler",
+              "_type": "boolean",
+              "_value": "true"
+            }
+          ],
+          "_entries": null
+        },
+        "_internal": true
+      }
+    ],
+    "_entries": null
+  }
+}
+
+-----------------------------------------------------
 _expression_: Person = class Person { constructor(name){} get fullName(){} methodName(p1, p2){} }; Person
 {
   "_type": "function",

Modified: trunk/Source/_javascript_Core/ChangeLog (197060 => 197061)


--- trunk/Source/_javascript_Core/ChangeLog	2016-02-25 02:39:19 UTC (rev 197060)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-02-25 04:59:18 UTC (rev 197061)
@@ -1,3 +1,14 @@
+2016-02-24  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Expose Proxy target and handler internal properties to Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=154663
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/JSInjectedScriptHost.cpp:
+        (Inspector::JSInjectedScriptHost::getInternalProperties):
+        Expose the ProxyObject's target and handler.
+
 2016-02-24  Nikos Andronikos  <nikos.andronikos-web...@cisra.canon.com.au>
 
         [web-animations] Add AnimationTimeline, DocumentTimeline and add extensions to Document interface

Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp (197060 => 197061)


--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp	2016-02-25 02:39:19 UTC (rev 197060)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp	2016-02-25 04:59:18 UTC (rev 197061)
@@ -48,6 +48,7 @@
 #include "JSWeakMap.h"
 #include "JSWeakSet.h"
 #include "ObjectConstructor.h"
+#include "ProxyObject.h"
 #include "RegExpObject.h"
 #include "ScopedArguments.h"
 #include "SourceCode.h"
@@ -260,6 +261,14 @@
         return array;
     }
 
+    if (ProxyObject* proxy = jsDynamicCast<ProxyObject*>(value)) {
+        unsigned index = 0;
+        JSArray* array = constructEmptyArray(exec, nullptr, 2);
+        array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("target"), proxy->target()));
+        array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("handler"), proxy->handler()));
+        return array;
+    }
+
     if (JSArrayIterator* arrayIterator = jsDynamicCast<JSArrayIterator*>(value)) {
         String kind;
         switch (arrayIterator->kind(exec)) {

Modified: trunk/Source/WebInspectorUI/ChangeLog (197060 => 197061)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-02-25 02:39:19 UTC (rev 197060)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-02-25 04:59:18 UTC (rev 197061)
@@ -1,3 +1,16 @@
+2016-02-24  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Expose Proxy target and handler internal properties to Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=154663
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Models/NativeFunctionParameters.js:
+        * UserInterface/Views/ObjectTreePropertyTreeElement.js:
+        (WebInspector.ObjectTreePropertyTreeElement.prototype._functionParameterString):
+        Improve the native parameter list for the global Reflect object methods.
+        Include "enumerate" even though it is deprecated, because we implement it.
+
 2016-02-24  Devin Rousso  <dcrousso+web...@gmail.com>
 
         Web Inspector: Visual Styles sidebar should support multiple animations

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js (197060 => 197061)


--- trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js	2016-02-25 02:39:19 UTC (rev 197060)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js	2016-02-25 04:59:18 UTC (rev 197061)
@@ -129,6 +129,24 @@
         __proto__: null,
     },
 
+    Reflect: {
+        apply: "target, thisArgument, argumentsList",
+        construct: "target, argumentsList, [newTarget=target]",
+        defineProperty: "target, propertyKey, attributes",
+        deleteProperty: "target, propertyKey",
+        enumerate: "target",
+        get: "target, propertyKey, [receiver]",
+        getOwnPropertyDescriptor: "target, propertyKey",
+        getPrototypeOf: "target",
+        has: "target, propertyKey",
+        isExtensible: "target",
+        ownKeys: "target",
+        preventExtensions: "target",
+        set: "target, propertyKey, value, [receiver]",
+        setPrototypeOf: "target, prototype",
+        __proto__: null,
+    },
+
     String: {
         fromCharCode: "...codeUnits",
         fromCodePoint: "...codePoints",

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js (197060 => 197061)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js	2016-02-25 02:39:19 UTC (rev 197060)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js	2016-02-25 04:59:18 UTC (rev 197061)
@@ -272,7 +272,7 @@
             }
 
             // Native DOM constructor or on native objects that are not functions.
-            if (parentDescription.endsWith("Constructor") || parentDescription === "Math" || parentDescription === "JSON") {
+            if (parentDescription.endsWith("Constructor") || parentDescription === "Math" || parentDescription === "JSON" || parentDescription === "Reflect") {
                 var name = parentDescription;
                 if (WebInspector.NativeConstructorFunctionParameters[name]) {
                     var params = WebInspector.NativeConstructorFunctionParameters[name][this._property.name];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to