Closed
Bug 1358919
Opened 7 years ago
Closed 11 months ago
Web Console displays array element with accessor descriptor as an empty slot.
Categories
(DevTools :: Console, defect, P3)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: brady.j.garvin, Unassigned)
References
()
Details
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 Build ID: 20170329150204 Steps to reproduce: 1. Navigate to about:blank 2. Open Web Console 3. Enter the following: x = [0]; Object.defineProperty(x, '0', { get: function() { return 0; } }); Actual results: Web Console displays Array [ <1 empty slot> ] Expected results: Web Console should describe the slot in some other way. The output Array [ 0 ] might be acceptable, or it may be preferable to show Array [ Getter ] in analogy to the output of x = { y: 0 }; Object.defineProperty(x, 'y', { get: function() { return 0; } });
Reporter | ||
Comment 1•7 years ago
|
||
On further thought, Array [ 0 ] is obviously incorrect because it would require running the getter, which may have side-effects.
Updated•7 years ago
|
Component: Untriaged → Developer Tools: Console
Comment 2•7 years ago
|
||
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0 Hi and thanks for your report! I was able to reproduce the issue you described on Release 53.0 and Beta 54.0b2 builds using Windows 10 x64, Ubuntu 16.04 LTS and MAC OS X. On the Nightly channel, the Web Console displays the following output: Array [ null ]
Status: UNCONFIRMED → NEW
Has STR: --- → yes
Ever confirmed: true
Comment 3•7 years ago
|
||
I agree - it'd be nice if we showed an icon to indicate that the slot had a getter but we wouldn't want to run it automatically due to side effects
Comment 4•7 years ago
|
||
The feature for showing getters is tracked in Reps: https://github.com/devtools-html/reps/issues/138
Comment 5•7 years ago
|
||
Hi, Thanks for reporting, this surfaced a bug in the console on Nightly as well. Now for the original bug, here's the grip we get when we evaluate the STR : { "type": "object", "actor": "server1.conn8.child1/obj31", "class": "Array", "extensible": true, "frozen": false, "sealed": false, "ownPropertyLength": 2, "preview": { "kind": "ArrayLike", "length": 1, "items": [ null ] } } We obtain the same grip when we evaluate `new Array(1)`, which explains why we have the same output in the old console. In order to handle this properly, we need to add some extra information on the backend side when an element of the array has a getter function.
Comment 6•7 years ago
|
||
(In reply to Brian Grinstead [:bgrins] from comment #4) > The feature for showing getters is tracked in Reps: > https://github.com/devtools-html/reps/issues/138 Addendum: Reps work is tracked here https://github.com/devtools-html/reps/issues/140
Updated•7 years ago
|
Updated•7 years ago
|
Priority: -- → P3
Comment 7•6 years ago
|
||
Code that should change: https://searchfox.org/mozilla-central/rev/8837610b6c999451435695e800f38d4acbc0a644/devtools/server/actors/object/previewers.js#144 https://searchfox.org/mozilla-central/rev/8837610b6c999451435695e800f38d4acbc0a644/devtools/server/actors/object/previewers.js#807
Updated•6 years ago
|
Product: Firefox → DevTools
Updated•2 years ago
|
Severity: normal → S3
Reporter | ||
Updated•11 months ago
|
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → INVALID
Reporter | ||
Updated•11 months ago
|
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Reporter | ||
Comment 8•11 months ago
|
||
I can verify that this bug has been fixed (also see the issues linked in the discussion), but it looks like as a reporter I cannot mark it as resolved with setting an incorrect resolution. If someone with suitable permissions could properly close it as fixed, that would be appreciated.
Updated•11 months ago
|
Status: REOPENED → RESOLVED
Closed: 11 months ago → 11 months ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•