Title: [237571] trunk
Revision
237571
Author
[email protected]
Date
2018-10-29 16:29:13 -0700 (Mon, 29 Oct 2018)

Log Message

Web Inspector: refactor code for getting properties via WI.RemoteObject
https://bugs.webkit.org/show_bug.cgi?id=190989

Reviewed by Matt Baker.

Source/WebInspectorUI:

* UserInterface/Protocol/RemoteObject.js:
(WI.RemoteObject.prototype.getPropertyDescriptors): Added.
(WI.RemoteObject.prototype.getPropertyDescriptorsAsObject): Added.
(WI.RemoteObject.prototype.getOwnPropertyDescriptors): Deleted.
(WI.RemoteObject.prototype.getAllPropertyDescriptors): Deleted.
(WI.RemoteObject.prototype._getPropertyDescriptors): Deleted.
(WI.RemoteObject.prototype.getOwnPropertyDescriptorsAsObject): Deleted.

* UserInterface/Views/ErrorObjectView.js:
(WI.ErrorObjectView.prototype.update):
* UserInterface/Views/ObjectTreePropertyTreeElement.js:
(WI.ObjectTreePropertyTreeElement.prototype._updateChildren):
* UserInterface/Views/ObjectTreeView.js:
(WI.ObjectTreeView.prototype.update):

LayoutTests:

* http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html:
* inspector/debugger/breakpoint-scope.html:
* inspector/debugger/paused-scopes.html:
* inspector/debugger/tail-deleted-frames-from-vm-entry.html:
* inspector/debugger/tail-deleted-frames.html:
* inspector/debugger/tail-recursion.html:
* inspector/model/remote-object-fake-object.html:
* inspector/model/remote-object-get-properties.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237570 => 237571)


--- trunk/LayoutTests/ChangeLog	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/LayoutTests/ChangeLog	2018-10-29 23:29:13 UTC (rev 237571)
@@ -1,3 +1,19 @@
+2018-10-29  Devin Rousso  <[email protected]>
+
+        Web Inspector: refactor code for getting properties via WI.RemoteObject
+        https://bugs.webkit.org/show_bug.cgi?id=190989
+
+        Reviewed by Matt Baker.
+
+        * http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html:
+        * inspector/debugger/breakpoint-scope.html:
+        * inspector/debugger/paused-scopes.html:
+        * inspector/debugger/tail-deleted-frames-from-vm-entry.html:
+        * inspector/debugger/tail-deleted-frames.html:
+        * inspector/debugger/tail-recursion.html:
+        * inspector/model/remote-object-fake-object.html:
+        * inspector/model/remote-object-get-properties.html:
+
 2018-10-29  Justin Michaud  <[email protected]>
 
         Revert r237347 registered custom properties... https://bugs.webkit.org/show_bug.cgi?id=190039

Modified: trunk/LayoutTests/http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html (237570 => 237571)


--- trunk/LayoutTests/http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/LayoutTests/http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html	2018-10-29 23:29:13 UTC (rev 237571)
@@ -135,7 +135,7 @@
                     InspectorTest.evaluateInPage(_expression_, null, {remoteObjectOnly: true}),
                     InspectorTest.awaitEvent("Continue"),
                 ]);
-                let [propertyDescriptors] = await promisify((cb) => { remoteObject.getAllPropertyDescriptors(cb); });
+                let [propertyDescriptors] = await promisify((cb) => { remoteObject.getPropertyDescriptors(cb); });
                 for (let propertyDescriptor of propertyDescriptors.reverse()) {
                     if (propertyDescriptor.isInternalProperty) {
                         let displayString = await propertyDescriptorString(propertyDescriptor);

Modified: trunk/LayoutTests/inspector/debugger/breakpoint-scope.html (237570 => 237571)


--- trunk/LayoutTests/inspector/debugger/breakpoint-scope.html	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-scope.html	2018-10-29 23:29:13 UTC (rev 237571)
@@ -57,7 +57,7 @@
         for (var scope of scopeChain) {
             scopeTypes.push(scope.type);
             if (scope.type !== WI.ScopeChainNode.Type.Global) {
-                scope.objects[0].getAllPropertyDescriptors(function(properties) {
+                scope.objects[0].getPropertyDescriptors(function(properties) {
                     InspectorTest.log(scopeTypes[scopeTypeIndex++] + " properties:");
                     for (var propertyDescriptor of properties)
                         InspectorTest.log("    " + propertyDescriptor.name);

Modified: trunk/LayoutTests/inspector/debugger/paused-scopes.html (237570 => 237571)


--- trunk/LayoutTests/inspector/debugger/paused-scopes.html	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/LayoutTests/inspector/debugger/paused-scopes.html	2018-10-29 23:29:13 UTC (rev 237571)
@@ -36,7 +36,7 @@
 
             for (let scopeObject of scope.objects) {
                 promises.push(new Promise((resolve, reject) => {
-                    scopeObject.getAllPropertyDescriptors((propertyDescriptors) => {
+                    scopeObject.getPropertyDescriptors((propertyDescriptors) => {
                         data.properties = data.properties.concat(propertyDescriptors);
                         resolve();
                     });

Modified: trunk/LayoutTests/inspector/debugger/tail-deleted-frames-from-vm-entry.html (237570 => 237571)


--- trunk/LayoutTests/inspector/debugger/tail-deleted-frames-from-vm-entry.html	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/LayoutTests/inspector/debugger/tail-deleted-frames-from-vm-entry.html	2018-10-29 23:29:13 UTC (rev 237571)
@@ -60,7 +60,7 @@
             InspectorTest.expectThat(callFrame.isTailDeleted === expectedFrame.isTailDeleted, `Tail deleted expectation correct: ${callFrame.isTailDeleted}`);
             let scope = callFrame.scopeChain[1];
 
-            scope.objects[0].getAllPropertyDescriptors(function(properties) {
+            scope.objects[0].getPropertyDescriptors(function(properties) {
                 let found = false;
                 let variableName = expectedFrame.scope[0];
                 let variableValue = expectedFrame.scope[1];

Modified: trunk/LayoutTests/inspector/debugger/tail-deleted-frames.html (237570 => 237571)


--- trunk/LayoutTests/inspector/debugger/tail-deleted-frames.html	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/LayoutTests/inspector/debugger/tail-deleted-frames.html	2018-10-29 23:29:13 UTC (rev 237571)
@@ -61,7 +61,7 @@
             InspectorTest.assert(callFrame.isTailDeleted === expectedFrame.isTailDeleted);
             let topScope = callFrame.scopeChain[0];
 
-            topScope.objects[0].getAllPropertyDescriptors(function(properties) {
+            topScope.objects[0].getPropertyDescriptors(function(properties) {
                 let found = false;
                 let variableName = expectedFrame.scope[0];
                 let variableValue = expectedFrame.scope[1];

Modified: trunk/LayoutTests/inspector/debugger/tail-recursion.html (237570 => 237571)


--- trunk/LayoutTests/inspector/debugger/tail-recursion.html	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/LayoutTests/inspector/debugger/tail-recursion.html	2018-10-29 23:29:13 UTC (rev 237571)
@@ -61,7 +61,7 @@
             else
                 InspectorTest.assert(!callFrame.isTailDeleted);
 
-            topScope.objects[0].getAllPropertyDescriptors(function(properties) {
+            topScope.objects[0].getPropertyDescriptors(function(properties) {
                 let found = false;
                 for (let propertyDescriptor of properties) {
                     if (propertyDescriptor.name === 'i') {

Modified: trunk/LayoutTests/inspector/model/remote-object-fake-object.html (237570 => 237571)


--- trunk/LayoutTests/inspector/model/remote-object-fake-object.html	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/LayoutTests/inspector/model/remote-object-fake-object.html	2018-10-29 23:29:13 UTC (rev 237571)
@@ -12,9 +12,12 @@
     InspectorTest.expectThat(fakeObject.type === "object" && !fakeObject.subtype, "A fake remote object should have object type.");
     InspectorTest.expectThat(fakeObject !== WI.RemoteObject.createFakeRemoteObject(), "Each fake remote object instance should be unique.");
 
-    fakeObject.getOwnPropertyDescriptors(function(properties) {
+    const options = {
+        ownProperties: true,
+    };
+    fakeObject.getPropertyDescriptors((properties) => {
         InspectorTest.expectThat(Array.isArray(properties) && !properties.length, "A fake remote object should have an empty list of own properties.");
-    });
+    }, options);
 
     fakeObject.getDisplayablePropertyDescriptors(function(properties) {
         InspectorTest.expectThat(Array.isArray(properties) && !properties.length, "A fake remote object should have an empty list of displayable properties.");

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


--- trunk/LayoutTests/inspector/model/remote-object-get-properties.html	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties.html	2018-10-29 23:29:13 UTC (rev 237571)
@@ -85,13 +85,17 @@
             if (remoteObject.subtype)
                 InspectorTest.log("subtype: " + remoteObject.subtype);
             InspectorTest.log("description: " + remoteObject.description);
-            remoteObject.getOwnPropertyDescriptors(function(properties) {
+
+            const options = {
+                ownProperties: true,
+            };
+            remoteObject.getPropertyDescriptors(function(properties) {
                 InspectorTest.log("\nOWN PROPERTIES:");
                 for (var property of properties) {
                     InspectorTest.assert(property instanceof WI.PropertyDescriptor);
                     InspectorTest.log("    " + property.name);
                 }
-            });
+            }, options);
 
             remoteObject.getDisplayablePropertyDescriptors(function(properties) {
                 InspectorTest.log("\nDISPLAYABLE PROPERTIES:");
@@ -101,7 +105,7 @@
                 }
             });
 
-            remoteObject.getAllPropertyDescriptors(function(properties) {
+            remoteObject.getPropertyDescriptors(function(properties) {
                 InspectorTest.log("\nALL PROPERTIES:");
                 for (var property of properties) {
                     InspectorTest.assert(property instanceof WI.PropertyDescriptor);

Modified: trunk/Source/WebInspectorUI/ChangeLog (237570 => 237571)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-10-29 23:29:13 UTC (rev 237571)
@@ -1,3 +1,25 @@
+2018-10-29  Devin Rousso  <[email protected]>
+
+        Web Inspector: refactor code for getting properties via WI.RemoteObject
+        https://bugs.webkit.org/show_bug.cgi?id=190989
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Protocol/RemoteObject.js:
+        (WI.RemoteObject.prototype.getPropertyDescriptors): Added.
+        (WI.RemoteObject.prototype.getPropertyDescriptorsAsObject): Added.
+        (WI.RemoteObject.prototype.getOwnPropertyDescriptors): Deleted.
+        (WI.RemoteObject.prototype.getAllPropertyDescriptors): Deleted.
+        (WI.RemoteObject.prototype._getPropertyDescriptors): Deleted.
+        (WI.RemoteObject.prototype.getOwnPropertyDescriptorsAsObject): Deleted.
+
+        * UserInterface/Views/ErrorObjectView.js:
+        (WI.ErrorObjectView.prototype.update):
+        * UserInterface/Views/ObjectTreePropertyTreeElement.js:
+        (WI.ObjectTreePropertyTreeElement.prototype._updateChildren):
+        * UserInterface/Views/ObjectTreeView.js:
+        (WI.ObjectTreeView.prototype.update):
+
 2018-10-29  Tim Horton  <[email protected]>
 
         Modernize WebKit nibs and lprojs for localization's sake

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js (237570 => 237571)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js	2018-10-29 23:29:13 UTC (rev 237571)
@@ -263,14 +263,14 @@
         });
     }
 
-    getOwnPropertyDescriptors(callback)
+    getPropertyDescriptors(callback, options = {})
     {
-        this._getPropertyDescriptors(true, callback);
-    }
+        if (!this._objectId || this._isSymbol() || this._isFakeObject()) {
+            callback([]);
+            return;
+        }
 
-    getAllPropertyDescriptors(callback)
-    {
-        this._getPropertyDescriptors(false, callback);
+        this._target.RuntimeAgent.getProperties(this._objectId, options.ownProperties, options.generatePreview, this._getPropertyDescriptorsResolver.bind(this, callback));
     }
 
     getDisplayablePropertyDescriptors(callback)
@@ -651,19 +651,9 @@
         return JSON.stringify(this._objectId) + "-" + this._subtype;
     }
 
-    _getPropertyDescriptors(ownProperties, callback)
+    getPropertyDescriptorsAsObject(callback, options = {})
     {
-        if (!this._objectId || this._isSymbol() || this._isFakeObject()) {
-            callback([]);
-            return;
-        }
-
-        this._target.RuntimeAgent.getProperties(this._objectId, ownProperties, true, this._getPropertyDescriptorsResolver.bind(this, callback));
-    }
-
-    getOwnPropertyDescriptorsAsObject(callback)
-    {
-        this.getOwnPropertyDescriptors(function(properties) {
+        this.getPropertyDescriptors(function(properties) {
             var propertiesResult = {};
             var internalPropertiesResult = {};
             for (var propertyDescriptor of properties) {
@@ -671,7 +661,7 @@
                 object[propertyDescriptor.name] = propertyDescriptor;
             }
             callback(propertiesResult, internalPropertiesResult);
-        });
+        }, options);
     }
 
     _getPropertyDescriptorsResolver(callback, error, properties, internalProperties)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js (237570 => 237571)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js	2018-10-29 23:29:13 UTC (rev 237571)
@@ -92,7 +92,11 @@
 
     update()
     {
-        this._object.getOwnPropertyDescriptorsAsObject((properties) => {
+        const options = {
+            ownProperties: true,
+            generatePreview: true,
+        };
+        this._object.getPropertyDescriptorsAsObject((properties) => {
             console.assert(properties && properties.stack && properties.stack.value);
 
             if (!this._hasStackTrace)
@@ -99,7 +103,7 @@
                 this._buildStackTrace(properties.stack.value.value);
 
             this._hasStackTrace = true;
-        });
+        }, options);
     }
 
     expand()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js (237570 => 237571)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js	2018-10-29 23:29:13 UTC (rev 237571)
@@ -321,13 +321,18 @@
         if (this.children.length && !this.shouldRefreshChildren)
             return;
 
+        const options = {
+            ownProperties: true,
+            generatePreview: true,
+        };
+
         var resolvedValue = this.resolvedValue();
         if (resolvedValue.isCollectionType() && this._mode === WI.ObjectTreeView.Mode.Properties)
             resolvedValue.getCollectionEntries(0, 100, this._updateChildrenInternal.bind(this, this._updateEntries, this._mode));
         else if (this._mode === WI.ObjectTreeView.Mode.ClassAPI || this._mode === WI.ObjectTreeView.Mode.PureAPI)
-            resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WI.ObjectTreeView.Mode.ClassAPI));
+            resolvedValue.getPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WI.ObjectTreeView.Mode.ClassAPI), options);
         else if (this.property.name === "__proto__")
-            resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WI.ObjectTreeView.Mode.PrototypeAPI));
+            resolvedValue.getPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WI.ObjectTreeView.Mode.PrototypeAPI), options);
         else
             resolvedValue.getDisplayablePropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, this._mode));
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js (237570 => 237571)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js	2018-10-29 21:48:51 UTC (rev 237570)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js	2018-10-29 23:29:13 UTC (rev 237571)
@@ -246,12 +246,17 @@
 
     update()
     {
+        const options = {
+            ownProperties: true,
+            generatePreview: true,
+        };
+
         if (this._object.isCollectionType() && this._mode === WI.ObjectTreeView.Mode.Properties)
             this._object.getCollectionEntries(0, 100, this._updateChildren.bind(this, this._updateEntries));
         else if (this._object.isClass())
             this._object.classPrototype.getDisplayablePropertyDescriptors(this._updateChildren.bind(this, this._updateProperties));
         else if (this._mode === WI.ObjectTreeView.Mode.PureAPI)
-            this._object.getOwnPropertyDescriptors(this._updateChildren.bind(this, this._updateProperties));
+            this._object.getPropertyDescriptors(this._updateChildren.bind(this, this._updateProperties), options);
         else
             this._object.getDisplayablePropertyDescriptors(this._updateChildren.bind(this, this._updateProperties));
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to