Commit 62c11b0
committed
lib: refactor internal webidl converters
Rework lib/internal/webidl.js into a documented shared converter
module that follows the Web IDL conversion algorithms more closely.
Improvements:
- Add documented converters and helper factories for dictionaries,
enums, sequences, interfaces, required arguments, and integers.
- Move WebCrypto to the shared converters, keeping compatibility
wrappers for existing BufferSource and BigInteger behavior.
- Use shared converters from Blob, Performance, Web Locks, and
structured clone option handling.
- Add focused tests for core converters, WebCrypto converters,
integer conversion, and buffer source behavior.
Fixes:
- Make core BufferSource and Uint8Array reject resizable ArrayBuffer
and growable SharedArrayBuffer backing stores unless allowed.
This is non-breaking because the core behavior has no runtime
consumers other than WebCrypto. WebCrypto keeps its legacy behavior
until a semver-major follow-up opts in to the correct behavior.
- Use Web IDL ToNumber and ToString behavior for BigInt, Symbol, and
object primitive conversion.
- Use exact BigInt modulo for 64-bit ConvertToInt wrapping and
document the Number approximation behavior.
- Normalize mathematical modulo results to +0 where Web IDL requires it.
- Cover detached buffers, resizable-backed views, growable-backed
views, cross-realm buffer sources, and mutation-after-call behavior.
Signed-off-by: Filip Skokan <[email protected]>1 parent 21436f0 commit 62c11b0
14 files changed
Lines changed: 1726 additions & 671 deletions
File tree
- benchmark/misc
- lib/internal
- crypto
- perf
- worker
- test/parallel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
| |||
245 | 244 | | |
246 | 245 | | |
247 | 246 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
252 | 255 | | |
253 | 256 | | |
254 | 257 | | |
| |||
0 commit comments