-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
http: improve writeEarlyHints by avoiding for-of loop #59958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Review requested:
|
0760cdf
to
17e98e7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #59958 +/- ##
=======================================
Coverage 88.42% 88.43%
=======================================
Files 703 703
Lines 207399 207401 +2
Branches 39986 39992 +6
=======================================
+ Hits 183397 183410 +13
- Misses 15989 15990 +1
+ Partials 8013 8001 -12
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
It looks like the CI run for this PR failed due to a flaky test. |
Landed in 5b3c4b3 |
PR-URL: #59958 Refs: https://github.com/nodejs/node/blob/main/doc/contributing/primordials.md#unsafe-array-iteration Reviewed-By: Daeyeon Jeong <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
This change is based on the "Unsafe array iteration" principle from the Node.js core development guidelines. for-of loops rely on the Symbol.iterator property, which can be modified by userland code, potentially leading to unpredictable or insecure behavior. Using a standard for loop directly accesses the array elements by index, ensuring a more stable and secure execution flow.
Refs: https://github.com/nodejs/node/blob/main/doc/contributing/primordials.md#unsafe-array-iteration