| 1 |
# JavaScript Language Feature Checklist |
| 2 |
So you're working on a new JavaScript feature in SpiderMonkey: Congratulations! Here's a set of checklists and guidelines to help you on your way. |
| 3 |
|
| 4 |
## High Level Feature Ship Checklist. |
| 5 |
(Note: Some of these pieces can happen in parallel, so it's not necessary to |
| 6 |
work directly top-down) |
| 7 |
|
| 8 |
- ☐ Send an Intent to Prototype email to `dev-platform`. This is part of the |
| 9 |
[Exposure Guidelines](https://wiki.mozilla.org/ExposureGuidelines) process. We |
| 10 |
historically haven't been amazing at sending intent-to-prototype emails, but |
| 11 |
we can always get better. |
| 12 |
- ☐ Stage 2 or earlier proposals should be developed under compile time guards, |
| 13 |
disabled by default. |
| 14 |
- ☐ Create a preference for the feature in `modules/libpref/init/StaticPrefList.yaml` |
| 15 |
and a command line option in `js/src/shell/js.cpp`. |
| 16 |
- ☐ Implement the Feature. |
| 17 |
- ☐ Land feature disabled by pref. |
| 18 |
- ☐ Import the test262 test cases for the feature, or enable them if they're |
| 19 |
already imported. (See `js/src/test/Readme.txt` for guidance) |
| 20 |
- ☐ Add the `fuzzing:needed` label to the proposal epic in the FFXP project in JIRA to request fuzzing for the feature. |
| 21 |
- ☐ If the feature introduces a new syntax, it may require a lot of work in the fuzzing engine to support it. Notify the fuzzing team early with the details. |
| 22 |
- ☐ Add shell option to `js/src/shell/fuzz-flags.txt`. This signals to other |
| 23 |
fuzzers as well that the feature is ready for fuzzing. |
| 24 |
- ☐ Send an Intent to Ship Email to `dev-platform`. This is also part of the |
| 25 |
[Exposure Guidelines](https://wiki.mozilla.org/ExposureGuidelines) process. |
| 26 |
- ☐ Ship the feature: |
| 27 |
- ☐ default the preference to true. |
| 28 |
- ☐ Double check for any code that is currently `NIGHTLY_BUILD` that should now be built unconditionally, e.g. in `js/src/vm/JSObject.cpp`. |
| 29 |
You may want to run a [central as beta simulation](https://wiki.mozilla.org/Sheriffing/How_To/Beta_simulations#TRUNK_AS_EARLY_BETA) |
| 30 |
to make sure you've caught any lingering `NIGHTLY_BUILD` parts. |
| 31 |
- ☐ Update `js/xpconnect/tests/chrome/test_xrayToJS.xhtml` for any changes to existing global objects. This is a mochitest, you need to run `mach test js/xpconnect/tests/chrome/test_xrayToJS.xhtml`. |
| 32 |
- ☐ For new globals, the following tests also need updates: |
| 33 |
`dom/serviceworkers/test/test_serviceworker_interfaces.js`, `tests/mochitest/general/test_interfaces.js`, and `dom/workers/test/test_worker_interfaces.js`. These are mochitests, you need to run, e.g. `mach test dom/serviceworkers/test/test_serviceworker_interfaces.html`. |
| 34 |
- ☐ Open a followup bug to later remove the preference. |
| 35 |
|
| 36 |
|
| 37 |
## Supplemental Checklists |
| 38 |
### Shipping Consideration Checklist |
| 39 |
|
| 40 |
- ☐ If it seems possible that the feature will cause webcompat issues, |
| 41 |
consider shipping `NIGHTLY_ONLY` for a cycle or two, to use nightly as an |
| 42 |
attempt to shake out potential webcompat issues. |
| 43 |
|
| 44 |
|
| 45 |
### Web Platform Integration Checklist |
| 46 |
|
| 47 |
_Sometimes Complexity of the web-platform leaks into JS Feature works_ |
| 48 |
|
| 49 |
- ☐ Ensure the appropriate web-platform tests exist, and are being run. |
| 50 |
- ☐ Is your feature correctly enabled inside of Workers? (They have different |
| 51 |
option set than main thread, and it's easy to forget them!) You may want to |
| 52 |
write a mochitest. |
| 53 |
|
| 54 |
### Syntax Features Checklist |
| 55 |
|
| 56 |
- ☐ Does `Reflect.parse` correctly parse and return results for your new syntax? |
| 57 |
- `Reflect.parse` tests are interesting as well, because they can be written |
| 58 |
for new syntax before bytecode emission is done. |
| 59 |
- ☐ Are the locations correct for the new syntax entries in the parse tree? |
| 60 |
- ☐ Are your errors emitted with sensible location info? |
| 61 |
|
| 62 |
### Testing Consideration Checklist |
| 63 |
|
| 64 |
_There's lots of complexity in SpiderMonkey that isn't always captured by the |
| 65 |
specification, so the below is some useful guidance to behaviour to pay |
| 66 |
attention to that may not be tested by a feature's test262 tests_ |
| 67 |
|
| 68 |
- ☐ How does your feature interact with multiple compartments? What happens if |
| 69 |
references happen across compartments, or if `this` is a |
| 70 |
`CrossCompartmentWrapper`? |
| 71 |
- ☐ Are your error messages being emitted in the correct realm, with the |
| 72 |
correct prototype? |
| 73 |
- ☐ If async functions or promises are involved, are user-code objects |
| 74 |
resolved? If so, does the feature correctly handle [the `.then` property |
| 75 |
behaviour of promise |
| 76 |
resolution?](https://www.stefanjudis.com/today-i-learned/promise-resolution-with-objects-including-a-then-property/) |
| 77 |
- ☐ Have you written some OOM tests for your feature to ensure your OOM |
| 78 |
handling is correct? |
| 79 |
|
| 80 |
#### Web Platform Testing Considerations |
| 81 |
- ☐ Does the feature have to handle exotic objects specially? Consider what |
| 82 |
happens when your feature interacts with the very exotic objects on the web |
| 83 |
platform, such as `WindowProxy`, `Location` (cross-origin objects). |
| 84 |
- ☐ What happens when your feature interacts with |
| 85 |
[X-rays](/dom/scriptSecurity/xray_vision.rst)? |