Support the endings option in the Blob and File constructors #8461
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.36) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 192 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.315
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8461"
general
weight: 0.35
ryanking13
endingswasjsg::UnimplementedonBlobPropertyBagandFilePropertyBag, sonew Blob(parts, { endings })threw for any value, even the valid'transparent'and'native'. Code that setsendings: 'native'when it builds a text file couldn't run.In this patch:
endingsis parsed as the File API'sEndingTypeenum.'transparent'(the default) keeps the bytes as they are. Any other value, such asnull,''or'NATIVE', throws aTypeError, as in browsers.'native', each string part has its CRLF and lone CR converted to the native line ending before it is encoded. Buffer and Blob parts are left as they are, and each string is converted on its own, so['\r', '\n']gives two line endings.Blob-constructor-endingsandFile-constructor-endingstests now pass. Conversion tests are inblob-test.js, since WPT only checks which values are accepted.| | before | after |
|---|---|---|
|
new Blob(['a\r\nb'], { endings: 'native' })| throwsError|'a\nb'||
new Blob(['a\r\nb'], { endings: 'transparent' })| throwsError|'a\r\nb'||
new Blob([], { endings: 'NATIVE' })| throwsError| throwsTypeError|The option threw for every value before, so no working code changes behaviour, and it ships without a compatibility flag. Leaving
endingsout gives the same bytes as before.