Change all JSClass' name back to the correct name instead of "Object"
Categories
(Core :: JavaScript: Standard Library, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox80 | --- | fixed |
People
(Reporter: evilpies, Assigned: anba)
References
Details
Attachments
(7 files)
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review |
Before bug 1277801 Object.prototype.toString would return the wrong result without a @@toStringTag. That is why we changed some JSClass name members to "Object". We should search for all those instances. Searching for "bug 1277801" already finds this one.
Updated•6 years ago
|
| Assignee | ||
Comment 1•5 years ago
|
||
I'm currently looking into this bug and it seems like we're not really consistent when it comes to naming proto-classes. For some proto-classes we're using "Object" (and also have tests for this behaviour [1]), but for others we're using the class name plus "Prototype", e.g. "Int32ArrayPrototype". And as three special cases. there's also "PromiseProto" for Promise.prototype JSClass, "object" for the streams proto-classes [2], and just the class name without "Prototype" for Iterator.prototype and AsyncIterator.prototype [3].
Tom, do you know if there's any preference here?
[1] https://searchfox.org/mozilla-central/source/js/src/jit-test/tests/basic/plain-object-prototypes-error.js
[2] https://searchfox.org/mozilla-central/rev/5a4aaccb28665807a6fd49cf48367d47fbb5a19a/js/src/builtin/streams/ClassSpecMacro.h#36 and https://searchfox.org/mozilla-central/rev/5a4aaccb28665807a6fd49cf48367d47fbb5a19a/js/src/builtin/streams/ReadableStream.cpp#553
[3] https://searchfox.org/mozilla-central/rev/5a4aaccb28665807a6fd49cf48367d47fbb5a19a/js/src/vm/Iteration.cpp#1663 and https://searchfox.org/mozilla-central/rev/5a4aaccb28665807a6fd49cf48367d47fbb5a19a/js/src/vm/AsyncIteration.cpp#628
| Reporter | ||
Comment 2•5 years ago
|
||
I like something along the lines of Object / ObjectPrototype, so e.g. "Map" / "MapPrototype". Maybe it would be even better to use "Map.prototype" for nicer results in [1]. Not really sure, everything is better than just always using Object. I think we shouldn't worry to much about the error messages right now, those should be improved anyway. InformalValueName using the JSClass name is not great.
| Assignee | ||
Comment 3•5 years ago
|
||
Great, let's go for that! :-)
| Assignee | ||
Comment 4•5 years ago
|
||
The Intl objects were already changed in bug 1642962 to get a more descriptive
@@toStringTag.
Updated•5 years ago
|
| Assignee | ||
Comment 5•5 years ago
|
||
Depends on D82042
| Assignee | ||
Comment 6•5 years ago
|
||
Depends on D82043
| Assignee | ||
Comment 7•5 years ago
|
||
Depends on D82045
| Assignee | ||
Comment 8•5 years ago
|
||
Depends on D82046
| Assignee | ||
Comment 9•5 years ago
|
||
Depends on D82048
| Assignee | ||
Comment 10•5 years ago
|
||
Depends on D82049
| Reporter | ||
Comment 11•5 years ago
|
||
Nice \o/ I think those names are much better. Have you pushed this to try? This might potentially cause test failures for some devtools tests.
| Assignee | ||
Comment 12•5 years ago
|
||
Ah, good call! I've forgot about devtools, only pushed to try with jsreftest, jit-tests, and xpc-shell tests.
Updated•5 years ago
|
| Assignee | ||
Comment 13•5 years ago
|
||
Changing Error objects to use a more specific class-name didn't work out for devtools, because they are testing object.class === "Error" to test for Error objects, so I had to revert that part.
| Reporter | ||
Comment 14•5 years ago
|
||
(In reply to André Bargull [:anba] from comment #13)
Changing Error objects to use a more specific class-name didn't work out for devtools, because they are testing
object.class === "Error"to test for Error objects, so I had to revert that part.
Okay. We should probably introduce Debugger.Object.isError and change devtools to use that.
Comment 15•5 years ago
|
||
| Assignee | ||
Comment 16•5 years ago
|
||
(In reply to Tom Schuster [:evilpie] from comment #14)
Okay. We should probably introduce
Debugger.Object.isErrorand change devtools to use that.
Filed as bug 1650776.
Comment 17•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/8fb77958bcda
https://hg.mozilla.org/mozilla-central/rev/f19da76c9c1e
https://hg.mozilla.org/mozilla-central/rev/a576109df99c
https://hg.mozilla.org/mozilla-central/rev/7958608bfaba
https://hg.mozilla.org/mozilla-central/rev/e9795038bab7
https://hg.mozilla.org/mozilla-central/rev/3fe60ca27593
https://hg.mozilla.org/mozilla-central/rev/fb6df25c3a13
Description
•