⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 197061 in webkit


Ignore:
Timestamp:
Feb 24, 2016, 8:59:18 PM (11 years ago)
Author:
commit-queue@webkit.org
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 <Joseph Pecoraro> on 2016-02-24
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

  • 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.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r197052 r197061  
     12016-02-24  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Expose Proxy target and handler internal properties to Inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=154663
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * inspector/model/remote-object.html:
     9        * platform/mac/inspector/model/remote-object-expected.txt:
     10        Test that a Proxy object includes the internal properties.
     11
    1122016-02-24  Ryan Haddad  <ryanhaddad@apple.com>
    213
  • trunk/LayoutTests/inspector/model/remote-object-expected.txt

    r195305 r197061  
    46574657
    46584658-----------------------------------------------------
     4659EXPRESSION: new Proxy({x:1, y:1}, {handler: true})
     4660{
     4661  "_type": "object",
     4662  "_objectId": "<filtered>",
     4663  "_description": "ProxyObject",
     4664  "_preview": {
     4665    "_listeners": null,
     4666    "_type": "object",
     4667    "_description": "ProxyObject",
     4668    "_lossless": true,
     4669    "_overflow": false,
     4670    "_properties": [
     4671      {
     4672        "_listeners": null,
     4673        "_name": "target",
     4674        "_type": "object",
     4675        "_valuePreview": {
     4676          "_listeners": null,
     4677          "_type": "object",
     4678          "_description": "Object",
     4679          "_lossless": true,
     4680          "_overflow": false,
     4681          "_properties": [
     4682            {
     4683              "_listeners": null,
     4684              "_name": "x",
     4685              "_type": "number",
     4686              "_value": "1"
     4687            },
     4688            {
     4689              "_listeners": null,
     4690              "_name": "y",
     4691              "_type": "number",
     4692              "_value": "1"
     4693            }
     4694          ],
     4695          "_entries": null
     4696        },
     4697        "_internal": true
     4698      },
     4699      {
     4700        "_listeners": null,
     4701        "_name": "handler",
     4702        "_type": "object",
     4703        "_valuePreview": {
     4704          "_listeners": null,
     4705          "_type": "object",
     4706          "_description": "Object",
     4707          "_lossless": true,
     4708          "_overflow": false,
     4709          "_properties": [
     4710            {
     4711              "_listeners": null,
     4712              "_name": "handler",
     4713              "_type": "boolean",
     4714              "_value": "true"
     4715            }
     4716          ],
     4717          "_entries": null
     4718        },
     4719        "_internal": true
     4720      }
     4721    ],
     4722    "_entries": null
     4723  }
     4724}
     4725
     4726-----------------------------------------------------
    46594727EXPRESSION: Person = class Person { constructor(name){} get fullName(){} methodName(p1, p2){} }; Person
    46604728{
  • trunk/LayoutTests/inspector/model/remote-object.html

    r188403 r197061  
    169169        {expression: "Promise.resolve({result:1})"},
    170170
     171        // Proxy
     172        {expression: "new Proxy({x:1, y:1}, {handler: true})"},
     173
    171174    // Classes
    172175
  • trunk/LayoutTests/platform/mac/inspector/model/remote-object-expected.txt

    r196865 r197061  
    46584658
    46594659-----------------------------------------------------
     4660EXPRESSION: new Proxy({x:1, y:1}, {handler: true})
     4661{
     4662  "_type": "object",
     4663  "_objectId": "<filtered>",
     4664  "_description": "ProxyObject",
     4665  "_preview": {
     4666    "_listeners": null,
     4667    "_type": "object",
     4668    "_description": "ProxyObject",
     4669    "_lossless": true,
     4670    "_overflow": false,
     4671    "_properties": [
     4672      {
     4673        "_listeners": null,
     4674        "_name": "target",
     4675        "_type": "object",
     4676        "_valuePreview": {
     4677          "_listeners": null,
     4678          "_type": "object",
     4679          "_description": "Object",
     4680          "_lossless": true,
     4681          "_overflow": false,
     4682          "_properties": [
     4683            {
     4684              "_listeners": null,
     4685              "_name": "x",
     4686              "_type": "number",
     4687              "_value": "1"
     4688            },
     4689            {
     4690              "_listeners": null,
     4691              "_name": "y",
     4692              "_type": "number",
     4693              "_value": "1"
     4694            }
     4695          ],
     4696          "_entries": null
     4697        },
     4698        "_internal": true
     4699      },
     4700      {
     4701        "_listeners": null,
     4702        "_name": "handler",
     4703        "_type": "object",
     4704        "_valuePreview": {
     4705          "_listeners": null,
     4706          "_type": "object",
     4707          "_description": "Object",
     4708          "_lossless": true,
     4709          "_overflow": false,
     4710          "_properties": [
     4711            {
     4712              "_listeners": null,
     4713              "_name": "handler",
     4714              "_type": "boolean",
     4715              "_value": "true"
     4716            }
     4717          ],
     4718          "_entries": null
     4719        },
     4720        "_internal": true
     4721      }
     4722    ],
     4723    "_entries": null
     4724  }
     4725}
     4726
     4727-----------------------------------------------------
    46604728EXPRESSION: Person = class Person { constructor(name){} get fullName(){} methodName(p1, p2){} }; Person
    46614729{
  • trunk/Source/JavaScriptCore/ChangeLog

    r197058 r197061  
     12016-02-24  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Expose Proxy target and handler internal properties to Inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=154663
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * inspector/JSInjectedScriptHost.cpp:
     9        (Inspector::JSInjectedScriptHost::getInternalProperties):
     10        Expose the ProxyObject's target and handler.
     11
    1122016-02-24  Nikos Andronikos  <nikos.andronikos-webkit@cisra.canon.com.au>
    213
  • trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp

    r194496 r197061  
    4949#include "JSWeakSet.h"
    5050#include "ObjectConstructor.h"
     51#include "ProxyObject.h"
    5152#include "RegExpObject.h"
    5253#include "ScopedArguments.h"
    … …  
    258259        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundThis", boundFunction->boundThis()));
    259260        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundArgs", boundFunction->boundArgs()));
     261        return array;
     262    }
     263
     264    if (ProxyObject* proxy = jsDynamicCast<ProxyObject*>(value)) {
     265        unsigned index = 0;
     266        JSArray* array = constructEmptyArray(exec, nullptr, 2);
     267        array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("target"), proxy->target()));
     268        array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("handler"), proxy->handler()));
    260269        return array;
    261270    }
  • trunk/Source/WebInspectorUI/ChangeLog

    r197059 r197061  
     12016-02-24  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Expose Proxy target and handler internal properties to Inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=154663
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * UserInterface/Models/NativeFunctionParameters.js:
     9        * UserInterface/Views/ObjectTreePropertyTreeElement.js:
     10        (WebInspector.ObjectTreePropertyTreeElement.prototype._functionParameterString):
     11        Improve the native parameter list for the global Reflect object methods.
     12        Include "enumerate" even though it is deprecated, because we implement it.
     13
    1142016-02-24  Devin Rousso  <dcrousso+webkit@gmail.com>
    215
  • trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js

    r196788 r197061  
    127127        reject: "reason",
    128128        resolve: "value",
     129        __proto__: null,
     130    },
     131
     132    Reflect: {
     133        apply: "target, thisArgument, argumentsList",
     134        construct: "target, argumentsList, [newTarget=target]",
     135        defineProperty: "target, propertyKey, attributes",
     136        deleteProperty: "target, propertyKey",
     137        enumerate: "target",
     138        get: "target, propertyKey, [receiver]",
     139        getOwnPropertyDescriptor: "target, propertyKey",
     140        getPrototypeOf: "target",
     141        has: "target, propertyKey",
     142        isExtensible: "target",
     143        ownKeys: "target",
     144        preventExtensions: "target",
     145        set: "target, propertyKey, value, [receiver]",
     146        setPrototypeOf: "target, prototype",
    129147        __proto__: null,
    130148    },
  • trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js

    r186120 r197061  
    273273
    274274            // Native DOM constructor or on native objects that are not functions.
    275             if (parentDescription.endsWith("Constructor") || parentDescription === "Math" || parentDescription === "JSON") {
     275            if (parentDescription.endsWith("Constructor") || parentDescription === "Math" || parentDescription === "JSON" || parentDescription === "Reflect") {
    276276                var name = parentDescription;
    277277                if (WebInspector.NativeConstructorFunctionParameters[name]) {
Note: See TracChangeset for help on using the changeset viewer.