Closed Bug 1315563 Opened 9 years ago Closed 9 years ago

Allow usage of plain objects as prototype property with Xrays

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: evilpies, Unassigned)

References

(Blocks 1 open bug)

Details

In ES6 and beyond almost? all prototype properties are supposed to be just plain objects. And obviously defining a prototype constructor in ClassSpec that just calls createBlankPrototype<PlainObject>() is easy enough and works as expected in JS land. However this totally breaks JSXray reflection: Looking up Promise.prototype.then fails for example. Currently we create prototypes in two ways: we either just create an instance of the object as the prototype, or we have a delegating ClassSpec. It would be nice to come up with some solution that requires neither and allows us to use PlainObjects in JS.
For what it's worth, DOM prototypes are "just plain objects" too, but in practice have an interesting JSClass precisely to support Xrays...
Basically we discussed on IRC that solving this would be too much hassle. We need some way to identify a certain prototype object, but we certainly don't want to go through all prototype objects that are registered. We could obviously have some kind of HashMap, but that doesn't seem like it would be worth it. Closing for now.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
Before closing this, what are consequences are observable from JavaScript? Can you show a test case that differentiates?
It's not usually observable, just for Object.prototype.toString which isn't correctly implement yet and still returns stuff that isn't specified in the spec or via @@toStringTag. But we can simply hard code a return value of "Object" like bug 1318646.
So does this mean that we should expect no observable difference from JS, and thus no spec violation?
Yes.
You need to log in before you can comment on or make changes to this bug.