Provide JSON.parse with source for primitives
Categories
(Core :: JavaScript Engine, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox124 | --- | fixed |
People
(Reporter: bthrall, Assigned: bthrall)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(10 files, 4 obsolete files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Support the JSON.parse with source proposal behind a shell option for parsing primitives (object and array support will come later).
This will require:
- A shell option "--enable-json-parse-with-source" to enable the proposal support
- Implement the
CreateParseRecord()
algorithm from the proposal with support for JSON primitive types - Update
InternalizeJSONProperty()
andJSON.parse()
implementations to use the Parse Record information according to the proposal
Assignee | ||
Updated•11 months ago
|
Assignee | ||
Updated•11 months ago
|
Assignee | ||
Comment 1•10 months ago
|
||
Assignee | ||
Comment 2•10 months ago
|
||
I haven't decided on the representation for ParseRecordObject.[[ParseNode]]
yet.
The slot enum is public for testing purposes, but will be made private as the
implementation matures.
Depends on D193469
Assignee | ||
Comment 3•10 months ago
|
||
Depends on D193470
Assignee | ||
Comment 4•10 months ago
|
||
Using JSString as a placeholder for the type because I think we will only need
to store the source content for use. We can probably end up using a
JSDependentString to minimize memory and copies.
The missing piece right now is how to provide the parseNode info to the
CreateJSONParseRecord since JSON parsing currently doesn't keep that info
around.
Depends on D193471
Assignee | ||
Comment 5•10 months ago
|
||
This is easier to do at parse time than in a separate pass using
CreateJSONParseRecord because we don't have a formal JSON syntax tree. The
downside is it's harder to make sure I am implementing things exactly as the
spec requires.
This implementation always constructs the ParseRecordObjects, even if they
aren't needed; we should avoid that cost when we can.
I also am creating whole new strings for the ParseNodeSlot, when I should
probably be using dependent strings.
Depends on D193472
Assignee | ||
Comment 6•10 months ago
|
||
This makes source handling consistent between number, string, boolean, and
null.
Some functions (numberValue, stringValue, atomValue, objectPropertyName) now
use the source's character type, so they had to move to JSONFullParseHandler.
Depends on D193474
Assignee | ||
Comment 7•10 months ago
|
||
Depends on D193475
Assignee | ||
Comment 8•10 months ago
|
||
Depends on D193476
Assignee | ||
Comment 9•10 months ago
|
||
These tests cover the progress of implementing JSON.parse with source so far,
so we don't have to modify
js/src/tests/test262/staging/JSON/json-parse-with-source.js while some parts
aren't done yet.
This file can also include tests that aren't part of test262, or can be removed
after the proposal is completely implemented.
Depends on D193477
Assignee | ||
Comment 10•10 months ago
|
||
Depends on D193479
Comment 11•10 months ago
|
||
The following patches are waiting for review from a reviewer who resigned from the review:
ID | Title | Author | Reviewer Status |
---|---|---|---|
D193469 | Bug 1860887 - Add --enable-json-parse-with-source shell option r=allstarschh! | bthrall | allstarschh: Resigned from review |
D193470 | Bug 1860887 - Begin implementing CreateJSONParseRecord r=allstarschh! | bthrall | allstarschh: Resigned from review |
D193471 | Bug 1860887 - Pass ParseRecordObject parameter to InternalizeJSONProperty and create context object r=allstarschh! | bthrall | allstarschh: Resigned from review |
D193472 | Bug 1860887 - Add parseNode parameter to CreateJSONParseRecord r=allstarschh! | bthrall | allstarschh: Resigned from review |
D193474 | Bug 1860887 - Construct ParseRecordObjects for primitives r=allstarschh! | bthrall | allstarschh: Resigned from review |
D193475 | Bug 1860887 - Move ParseRecordObject creation into numberValue() and stringValue() r=allstarschh! | bthrall | allstarschh: Resigned from review |
D193476 | Bug 1860887 - Avoid creating ParseRecordObject when not enabled r=allstarschh! | bthrall | allstarschh: Resigned from review |
D193477 | Bug 1860887 - Trace JSONFullParseHandler::parseRecord r=allstarschh! | bthrall | allstarschh: Resigned from review |
D193479 | Bug 1860887 - Add tests r=allstarschh! | bthrall | allstarschh: Resigned from review |
D193480 | Bug 1860887 - Add setter/getters instead of using slot ids directly r=allstarschh! | bthrall | allstarschh: Resigned from review |
:bthrall, could you please find another reviewer?
For more information, please visit BugBot documentation.
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Assignee | ||
Updated•10 months ago
|
Assignee | ||
Comment 12•8 months ago
|
||
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Assignee | ||
Comment 13•8 months ago
|
||
When we add ParseRecord support for objects and arrays, these functions will
depend on the character type, so they can't be in JSONFullParseHandlerAnyChar.
Depends on D193479
Assignee | ||
Comment 14•8 months ago
|
||
Follow the order in the header file, and group by class to make them easier to
find.
Depends on D198320
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Updated•8 months ago
|
Assignee | ||
Comment 15•8 months ago
|
||
Adding ParseRecordObject.cpp to js/src/moz.build changes the unified file that
includes jsdate.cpp so that it also includes WrappedFunctionObject.cpp, which
contains 'using namespace JS;'. This makes several static functions in
jsdate.cpp ambiguous.
jsdate.cpp was not expecting the JS namespace to be in scope, so it is clear
that the ambiguous function references should all be for the static functions.
Comment 16•8 months ago
|
||
Comment 17•8 months ago
|
||
Backed out for causing py3 failure on lint.py
- backout: https://hg.mozilla.org/integration/autoland/rev/90b599e79c1978332a10ff2488aefb0661e3c342
- push: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&revision=7a609350fd1141b84a9e3a8b006df4d6eb94abbf&selectedTaskRun=Va1D8r-vRkKhZGL8oH9p6A.0
- failure log: https://treeherder.mozilla.org/logviewer?job_id=445739497&repo=autoland&lineNumber=2342
[task 2024-02-02T20:18:02.278Z] ======================== 83 passed in 123.18s (0:02:03) ========================
[task 2024-02-02T20:18:02.278Z]
[task 2024-02-02T20:18:02.278Z]
[task 2024-02-02T20:18:02.278Z] Tests Completed: 100%|██████████| 81/81 [02:15<00:00, 27.71s/Test]
[task 2024-02-02T20:18:02.278Z]
[task 2024-02-02T20:18:02.278Z] /builds/worker/checkouts/gecko/python/mozbuild/mozbuild/test/configure/lint.py
[task 2024-02-02T20:18:02.278Z] ============================= test session starts ==============================
[task 2024-02-02T20:18:02.278Z] platform linux -- Python 3.8.10, pytest-7.0.1, pluggy-1.4.0 -- /builds/worker/.mozbuild/srcdirs/gecko-8a5b87fe5d69/_virtualenvs/python-test/bin/python
[task 2024-02-02T20:18:02.279Z] rootdir: /builds/worker/checkouts/gecko, configfile: config/mozunit/mozunit/pytest.ini
[task 2024-02-02T20:18:02.279Z] collecting ... collected 4 items
[task 2024-02-02T20:18:02.279Z]
[task 2024-02-02T20:18:02.279Z] python/mozbuild/mozbuild/test/configure/lint.py::Lint::test_browser TEST-UNEXPECTED-FAIL
[task 2024-02-02T20:18:02.279Z] python/mozbuild/mozbuild/test/configure/lint.py::Lint::test_js TEST-UNEXPECTED-FAIL
[task 2024-02-02T20:18:02.279Z] python/mozbuild/mozbuild/test/configure/lint.py::Lint::test_memory PASSED
[task 2024-02-02T20:18:02.279Z] python/mozbuild/mozbuild/test/configure/lint.py::Lint::test_mobile_android TEST-UNEXPECTED-FAIL
[task 2024-02-02T20:18:02.279Z]
Comment 18•8 months ago
|
||
Assignee | ||
Updated•8 months ago
|
Comment 19•8 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b49045beeaf3
https://hg.mozilla.org/mozilla-central/rev/aa9d9ac352af
https://hg.mozilla.org/mozilla-central/rev/ba7e3130ed8a
https://hg.mozilla.org/mozilla-central/rev/c7e519735961
https://hg.mozilla.org/mozilla-central/rev/c92998c43c3b
https://hg.mozilla.org/mozilla-central/rev/e97bc86aaf2b
https://hg.mozilla.org/mozilla-central/rev/523a63b359ed
https://hg.mozilla.org/mozilla-central/rev/1cffabd5b348
https://hg.mozilla.org/mozilla-central/rev/aa071cec54c8
Updated•7 months ago
|
Comment 20•6 months ago
|
||
Looking at the code, this is behind a build-time flag right? I.e. it is not released by default anywhere?
FYI Docs work for this being tracked in https://github.com/mdn/content/issues/32387
Updated•6 months ago
|
Assignee | ||
Comment 21•6 months ago
|
||
Yes, it is behind both a build-time flag and a runtime flag. It is not released by default anywhere yet.
Updated•6 months ago
|
Description
•