Closed
Bug 1390027
Opened 7 years ago
Closed 7 years ago
New console confused by __proto__ own property
Categories
(DevTools :: Console, defect, P3)
DevTools
Console
Tracking
(firefox57 wontfix, firefox59 wontfix, firefox60 wontfix, firefox61 fixed)
RESOLVED
FIXED
Firefox 61
People
(Reporter: Oriol, Unassigned)
References
Details
1. Open web console
2. Enter this code:
var obj = Object.create(null);
obj.__proto__ = [];
obj;
Result: Object { undefined: undefined, undefined: undefined, undefined: undefined }
Expected: Object { __proto__: [] }
3. Inspect the object
Result: no property
Expected: ▶ __proto__ : Array []
BTW, now that you are creating a new console and object inspector, I think it's a good time to remove the confusing magic about __proto__. I would reference the [[Prototype]] using the console's notation for internal slots, i.e. <proto> or <prototype> instead of __proto__. And I would show this on all non-proxy objects, including Object.create(null) and Object.prototype.
Updated•7 years ago
|
status-firefox57:
--- → wontfix
Priority: -- → P3
Comment 1•7 years ago
|
||
Here's the packet we get at the moment:
```json
{
"type": "object",
"actor": "server2.conn2.child1/obj27",
"class": "Object",
"extensible": true,
"frozen": false,
"sealed": false,
"ownPropertyLength": 1,
"preview": {
"kind": "Object",
"ownProperties": {},
"ownSymbols": [],
"ownPropertiesLength": 1,
"ownSymbolsLength": 0,
"safeGetterValues": {}
}
}
```
I don't know what's going on in the Grip rep to print those 3 undefined properties, I'll have a look.
In the meantime, we should fix the actor to actually send the __proto__ property in the preview.
Reporter | ||
Comment 2•7 years ago
|
||
Argh! The preview should inherit from null to avoid setters in Object.prototype!
https://searchfox.org/mozilla-central/rev/efce4ceddfbe5fe4e2d74f1aed93894bada9b273/devtools/server/actors/object.js#1627
Reporter | ||
Comment 3•7 years ago
|
||
Ah, no, sorry, preview.ownProperties inherits from null indeed. I guess the object is later copied into an object which inherits from Object.prototype or something like this.
Reporter | ||
Comment 4•7 years ago
|
||
Nicolas, are you sure that's the packet? If I add a breakpoint in https://searchfox.org/mozilla-central/rev/33cc9e0331da8d9ff3750f1e68d72d61201176cb/devtools/client/shared/components/reps/reps.js#584 and run
JSON.stringify(object, null, 2)
then I get
{
"type": "object",
"actor": "server1.conn1.child1/obj31",
"class": "Object",
"extensible": true,
"frozen": false,
"sealed": false,
"ownPropertyLength": 1,
"preview": {
"kind": "Object",
"ownProperties": {
"__proto__": {
"configurable": true,
"enumerable": true,
"writable": true,
"value": {
"type": "object",
"actor": "server1.conn1.child1/obj32",
"class": "Array",
"extensible": true,
"frozen": false,
"sealed": false,
"ownPropertyLength": 1,
"preview": {
"kind": "ArrayLike",
"length": 0
}
}
}
},
"ownSymbols": [],
"ownPropertiesLength": 1,
"ownSymbolsLength": 0,
"safeGetterValues": {}
}
}
Flags: needinfo?(nchevobbe)
Comment 5•7 years ago
|
||
Right, I think I was targetting an old server, thanks Oriol
Flags: needinfo?(nchevobbe)
Reporter | ||
Comment 7•7 years ago
|
||
Fixed by bug 1440388. Now it's
▶ Object { __proto__: [] }
And expanded:
▼ {...}
| ▶ __proto__: Array []
However, I would prefer a more explicit
▼ {...}
| ▶ __proto__: Array []
| <prototype>: null
I will file a reps issue for that.
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox60:
--- → affected
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 61
Updated•7 years ago
|
status-firefox59:
--- → wontfix
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•