Right now the [Private Fields](https://tc39.es/proposal-class-fields/) JS language features is under development under the [private-fields](https://bugzilla.mozilla.org/show_bug.cgi?id=1562054) bug tree. I did some testing, and as I had suspected, there will need to be some cooperation between DevTools and the JS engine to make private fields work well. I'll need some guidance help provide the right interfaces. Attached is a screenshot showing at least two different issues I found while running the build I created on try atop the not-yet-landed patches in Bug 1642476. 1. The first issue is that we don't show private fields in devtools. This is not unexpected: It is intended that from a language-specification perspective that private fields are not observable via any reflection system; this means that we'll have to provide a side-entry to devtools to bypass this. 2. The act of adding a private field to an object is not idempotent; it appears that while I was experimenting with the peculiar nature of private fields, the "show the result of the computation" feature stamped `window` for me, then when I hit enter I got an exception, as you can't add private fields twice.
Bug 1650188 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Right now the [Private Fields](https://tc39.es/proposal-class-fields/) JS language features is under development under the [private-fields](https://bugzilla.mozilla.org/show_bug.cgi?id=1562054) bug tree. I did some testing, and as I had suspected, there will need to be some cooperation between DevTools and the JS engine to make private fields work well. I'll need some guidance help provide the right interfaces. Attached is a screenshot showing at least two different issues I found while running [the build I created on try](https://treeherder.mozilla.org/#/jobs?repo=try&revision=0e3be6ecf886e9cf93b3a8c854daee64d1e59206) atop the not-yet-landed patches in Bug 1642476. 1. The first issue is that we don't show private fields in devtools. This is not unexpected: It is intended that from a language-specification perspective that private fields are not observable via any reflection system; this means that we'll have to provide a side-entry to devtools to bypass this. 2. The act of adding a private field to an object is not idempotent; it appears that while I was experimenting with the peculiar nature of private fields, the "show the result of the computation" feature stamped `window` for me, then when I hit enter I got an exception, as you can't add private fields twice.