- Revision
- 246046
- Author
- [email protected]
- Date
- 2019-06-03 13:58:44 -0700 (Mon, 03 Jun 2019)
Log Message
Web Inspector: remove RemoteObject.prototype.getPropertyDescriptorsAsObject
https://bugs.webkit.org/show_bug.cgi?id=198395
Reviewed by Matt Baker.
Source/WebInspectorUI:
When calling `RemoteObject.prototype.getPropertyDescriptorsAsObject`, if one of the returned
property descriptors is named `__proto__`, it will replace the `__proto__` of the plain
object created for that function with the `WI.PropertyDescriptor` itself, altering the
prototype chain.
* UserInterface/Protocol/RemoteObject.js:
(WI.RemoteObject.prototype.getPropertyDescriptorsAsObject): Deleted.
* UserInterface/Models/AuditTestCase.js:
(WI.AuditTestCase.prototype.async run.async parseResponse.async resultArrayForEach):
* UserInterface/Views/ErrorObjectView.js:
(WI.ErrorObjectView.prototype.update):
LayoutTests:
* inspector/runtime/awaitPromise.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (246045 => 246046)
--- trunk/LayoutTests/ChangeLog 2019-06-03 20:49:53 UTC (rev 246045)
+++ trunk/LayoutTests/ChangeLog 2019-06-03 20:58:44 UTC (rev 246046)
@@ -1,3 +1,12 @@
+2019-06-03 Devin Rousso <[email protected]>
+
+ Web Inspector: remove RemoteObject.prototype.getPropertyDescriptorsAsObject
+ https://bugs.webkit.org/show_bug.cgi?id=198395
+
+ Reviewed by Matt Baker.
+
+ * inspector/runtime/awaitPromise.html:
+
2019-06-03 Rob Buis <[email protected]>
Implement imagesrcset and imagesizes attributes on link rel=preload
Modified: trunk/LayoutTests/inspector/runtime/awaitPromise.html (246045 => 246046)
--- trunk/LayoutTests/inspector/runtime/awaitPromise.html 2019-06-03 20:49:53 UTC (rev 246045)
+++ trunk/LayoutTests/inspector/runtime/awaitPromise.html 2019-06-03 20:58:44 UTC (rev 246046)
@@ -53,10 +53,10 @@
addTest(name, _expression_, options, async (remoteObject, wasThrown) => {
InspectorTest.assert(wasThrown, "There should be an error.");
if (value && typeof value === "object") {
- let propertyDescriptors = await new Promise((resolve) => remoteObject.getPropertyDescriptorsAsObject(resolve));
+ let propertyDescriptors = await new Promise((resolve) => remoteObject.getPropertyDescriptors(resolve));
let properties = Array.isArray(value) ? [] : {};
for (let key in value)
- properties[key] = propertyDescriptors[key].value.value;
+ properties[key] = propertyDescriptors.find((property) => property.name === key).value.value;
InspectorTest.expectShallowEqual(properties, value, "The rejected value should be " + JSON.stringify(value));
} else
InspectorTest.expectEqual(remoteObject.value, value, "The rejected value should be " + JSON.stringify(value));
Modified: trunk/Source/WebInspectorUI/ChangeLog (246045 => 246046)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-06-03 20:49:53 UTC (rev 246045)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-06-03 20:58:44 UTC (rev 246046)
@@ -1,3 +1,22 @@
+2019-06-03 Devin Rousso <[email protected]>
+
+ Web Inspector: remove RemoteObject.prototype.getPropertyDescriptorsAsObject
+ https://bugs.webkit.org/show_bug.cgi?id=198395
+
+ Reviewed by Matt Baker.
+
+ When calling `RemoteObject.prototype.getPropertyDescriptorsAsObject`, if one of the returned
+ property descriptors is named `__proto__`, it will replace the `__proto__` of the plain
+ object created for that function with the `WI.PropertyDescriptor` itself, altering the
+ prototype chain.
+
+ * UserInterface/Protocol/RemoteObject.js:
+ (WI.RemoteObject.prototype.getPropertyDescriptorsAsObject): Deleted.
+ * UserInterface/Models/AuditTestCase.js:
+ (WI.AuditTestCase.prototype.async run.async parseResponse.async resultArrayForEach):
+ * UserInterface/Views/ErrorObjectView.js:
+ (WI.ErrorObjectView.prototype.update):
+
2019-06-02 Matt Baker <[email protected]>
Web Inspector: Debugger: sidebar should always reveal active call frame when hitting a breakpoint
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js (246045 => 246046)
--- trunk/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js 2019-06-03 20:49:53 UTC (rev 246045)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js 2019-06-03 20:58:44 UTC (rev 246046)
@@ -181,12 +181,11 @@
if (!array)
return;
- // `getPropertyDescriptorsAsObject` returns an object, meaning that if we
- // want to iterate over `array` by index, we have to count.
- let asObject = await new Promise((resolve, reject) => array.getPropertyDescriptorsAsObject(resolve, options));
+ let arrayProperties = await new Promise((resolve, reject) => array.getPropertyDescriptors(resolve, options));
for (let i = 0; i < array.size; ++i) {
- if (i in asObject)
- await callback(asObject[i]);
+ let arrayPropertyForIndex = arrayProperties.find((arrayProperty) => arrayProperty.name === String(i));
+ if (arrayPropertyForIndex)
+ await callback(arrayPropertyForIndex);
}
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js (246045 => 246046)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js 2019-06-03 20:49:53 UTC (rev 246045)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js 2019-06-03 20:58:44 UTC (rev 246046)
@@ -651,19 +651,6 @@
return JSON.stringify(this._objectId) + "-" + this._subtype;
}
- getPropertyDescriptorsAsObject(callback, options = {})
- {
- this.getPropertyDescriptors(function(properties) {
- var propertiesResult = {};
- var internalPropertiesResult = {};
- for (var propertyDescriptor of properties) {
- var object = propertyDescriptor.isInternalProperty ? internalPropertiesResult : propertiesResult;
- object[propertyDescriptor.name] = propertyDescriptor;
- }
- callback(propertiesResult, internalPropertiesResult);
- }, options);
- }
-
_getPropertyDescriptorsResolver(callback, error, properties, internalProperties)
{
if (error) {
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js (246045 => 246046)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js 2019-06-03 20:49:53 UTC (rev 246045)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js 2019-06-03 20:58:44 UTC (rev 246046)
@@ -87,16 +87,23 @@
update()
{
+ if (this._hasStackTrace)
+ return;
+
const options = {
ownProperties: true,
generatePreview: true,
};
- this._object.getPropertyDescriptorsAsObject((properties) => {
- console.assert(properties && properties.stack && properties.stack.value);
+ this._object.getPropertyDescriptors((properties) => {
+ if (!properties || this._hasStackTrace)
+ return;
- if (!this._hasStackTrace)
- this._buildStackTrace(properties.stack.value.value);
+ let stackProperty = properties.find((property) => property.name === "stack");
+ console.assert(stackProperty);
+ if (!stackProperty)
+ return;
+ this._buildStackTrace(stackProperty.value.value);
this._hasStackTrace = true;
}, options);
}