Closed Bug 1890771 Opened 7 months ago Closed 5 months ago

Test JSON.parse with source edge cases

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: bthrall, Assigned: bthrall)

References

(Blocks 1 open bug)

Details

Attachments

(9 files, 1 obsolete file)

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

We want to make sure JSON.parse with source feature works at least in the following situations:

  • Inside of Workers
  • Interactions across multiple compartments (CCW, etc.)
  • OOM behavior
  • Exotic web platform objects (WindowProxy, cross-origin, etc.)
  • X-rays

So we should add automated tests to verify that it does function as expected.

When --setpref is used, but --enable-json-parse-with-source is not, the custom
shell flag handling was overriding the --setpref value.

Note the raw field is parsed as a number because JSON.stringify() serializes
RawJSONObject("4.32") as a number ('4.32') rather than a string ('"4.32"').

Using an IIFE lets me group the tests and name the group.

How the rawJSON field should be handled isn't clear to me yet.

Changing set_spidermonkey_pref to always is necessary for xpcshell to get the
pref value correctly. This is because xpcshell sets the prefs from
xpcshell.toml after the JS engine is initialized (via user.js);
experimental.json_parse_with_source is still false at that point.

Assignee: nobody → bthrall
Attachment #9407100 - Attachment description: WIP: Bug 1890771 - Fix JSON.parse with source OOM, add tests → Bug 1890771 - Fix JSON.parse with source OOM, add tests r=mgaudet
Attachment #9407101 - Attachment description: WIP: Bug 1890771 - Check that errors come from the correct realm and RawJSONObjects can be used as prototypes → Bug 1890771 - Check that errors come from the correct realm and RawJSONObjects can be used as prototypes r=mgaudet
Attachment #9407102 - Attachment description: WIP: Bug 1890771 - Test and fix JSON.isRawJSON() when handling CrossCompartmentWrappers → Bug 1890771 - Test and fix JSON.isRawJSON() when handling CrossCompartmentWrappers r=mgaudet
Attachment #9407103 - Attachment description: WIP: Bug 1890771 - Correctly set pref when custom shell flag is not there → Bug 1890771 - Correctly set pref when custom shell flag is not there r=mgaudet
Attachment #9407104 - Attachment description: WIP: Bug 1890771 - Check that JSON.parse with source features work in web workers → Bug 1890771 - Check that JSON.parse with source features work in web workers r=mgaudet
Attachment #9407105 - Attachment description: WIP: Bug 1890771 - Improve failure output for JSON.parse tests and group tests → Bug 1890771 - Improve failure output for JSON.parse tests and group tests r=mgaudet
Attachment #9407106 - Attachment description: WIP: Bug 1890771 - Unwrap RawJSONObject CCW inside JSON.stringify → Bug 1890771 - Unwrap RawJSONObject CCW inside JSON.stringify r=mgaudet
Attachment #9407107 - Attachment description: WIP: Bug 1890771 - Check that WindowProxy gets JSON.rawJSON(), JSON.isRawJSON() → Bug 1890771 - Check that WindowProxy gets JSON.rawJSON(), JSON.isRawJSON() and Location is handled correctly r=mgaudet
Attachment #9407108 - Attachment description: WIP: Bug 1890771 - Check JSON.parse with source handling of Xrays → Bug 1890771 - Check JSON.parse with source handling of Xrays r=mgaudet
Attachment #9407107 - Attachment is obsolete: true
Pushed by bthrall@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/231a98c0f826 Fix JSON.parse with source OOM, add tests r=mgaudet https://hg.mozilla.org/integration/autoland/rev/e87cbf65f386 Check that errors come from the correct realm and RawJSONObjects can be used as prototypes r=mgaudet https://hg.mozilla.org/integration/autoland/rev/1566570e97e7 Test and fix JSON.isRawJSON() when handling CrossCompartmentWrappers r=mgaudet https://hg.mozilla.org/integration/autoland/rev/90aceddc9988 Correctly set pref when custom shell flag is not there r=mgaudet https://hg.mozilla.org/integration/autoland/rev/fd197b7a873e Check that JSON.parse with source features work in web workers r=mgaudet https://hg.mozilla.org/integration/autoland/rev/95bf36cdb7c5 Improve failure output for JSON.parse tests and group tests r=mgaudet https://hg.mozilla.org/integration/autoland/rev/e4a0f6fcac10 Unwrap RawJSONObject CCW inside JSON.stringify r=mgaudet https://hg.mozilla.org/integration/autoland/rev/70a20173bda0 Check JSON.parse with source handling of Xrays r=mgaudet https://hg.mozilla.org/integration/autoland/rev/7a1ccaa09fc0 Make rawJSON member enumerable r=mgaudet
Pushed by bthrall@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/318f2311a5e0 Fix JSON.parse with source OOM, add tests r=mgaudet https://hg.mozilla.org/integration/autoland/rev/30bd191dca7d Check that errors come from the correct realm and RawJSONObjects can be used as prototypes r=mgaudet https://hg.mozilla.org/integration/autoland/rev/12b1739f207e Test and fix JSON.isRawJSON() when handling CrossCompartmentWrappers r=mgaudet https://hg.mozilla.org/integration/autoland/rev/29bae6b779a4 Correctly set pref when custom shell flag is not there r=mgaudet https://hg.mozilla.org/integration/autoland/rev/27bcb460dac2 Check that JSON.parse with source features work in web workers r=mgaudet https://hg.mozilla.org/integration/autoland/rev/57c453f97bcc Improve failure output for JSON.parse tests and group tests r=mgaudet https://hg.mozilla.org/integration/autoland/rev/2635be086cf2 Unwrap RawJSONObject CCW inside JSON.stringify r=mgaudet https://hg.mozilla.org/integration/autoland/rev/7d755d87bc7d Check JSON.parse with source handling of Xrays r=mgaudet https://hg.mozilla.org/integration/autoland/rev/8405145a8468 Make rawJSON member enumerable r=mgaudet
Flags: needinfo?(bthrall)
Regressions: 1905063
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: