ValueToSource should be useful without toSource methods
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: evilpie, Assigned: evilpie)
References
(Blocks 1 open bug)
Details
Attachments
(7 files)
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
We use ValueToSource
and JS_ValueToSource
in Gecko and SpiderMonkey code for various purposes, but mostly for error reporting and debugging. Right now ValueToSource
produces useful pretty printed output by calling the toSource
method of the passed in object. Without those there is only a default formatter for objects (and functions since bug 1605658). To avoid regressing error messages for cases like new [1, 2, 3]
or making the JS shell super ugly, we have to start producing better pretty printed output without toSource
.
I think we could follow a similar path to bug 1605658, where we directly call the C++ code of Function.prototype.toSource
. We probably do not need to do this for every kind of object, but array and error objects are definitely the most important from my POV.
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
To make testing easier without uneval
we should expose a JS shell function that calls ValueToSource
.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
We will keep improving this test when we are adding new implementations like ErrorToSource that don't require a toSource method.
(--disable-tosource can be removed in the future)
Assignee | ||
Comment 3•5 years ago
|
||
Assignee | ||
Comment 4•5 years ago
|
||
Comment 6•5 years ago
|
||
bugherder |
Assignee | ||
Comment 7•5 years ago
|
||
I am not sure if I should create a separate header just for ValueToSource?
In the future after we remove toSource from chrome-js we can move more ToSource methods to this file.
Assignee | ||
Comment 8•5 years ago
|
||
Depends on D59684
Comment 10•5 years ago
|
||
bugherder |
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
bugherder |
Assignee | ||
Comment 13•5 years ago
|
||
I think we can implement some generalized handling for Date, Boolean, String, Number etc. by leveraging js:Unbox
, but maybe that is too clever and we should just hardcode it.
Assignee | ||
Comment 14•5 years ago
|
||
Assignee | ||
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
Assignee | ||
Comment 17•5 years ago
|
||
I think this covers most of the important object types for now.
Assignee | ||
Updated•5 years ago
|
Comment 18•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/e02b75f47c9b
https://hg.mozilla.org/mozilla-central/rev/5e253b12e2b6
Description
•