Repository navigation
Fix ArrayBuffer transfer after failed structured clone - #5612
mansiverma897993 wants to merge 2 commits into
Conversation
Test262 conformance changes
Tested main commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5612 +/- ##
===========================================
+ Coverage 47.24% 63.11% +15.86%
===========================================
Files 476 536 +60
Lines 46892 60538 +13646
===========================================
+ Hits 22154 38207 +16053
+ Misses 24738 22331 -2407 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
AI-assisted cloud probes confirm the original fix: when serialization fails on a function, the 8-byte buffer (first byte One question about the all-buffer precheck: is keeping every other buffer attached an intentional guarantee when a getter detaches a transfer entry? const a = new ArrayBuffer(8), b = new ArrayBuffer(8);
let error = null;
try {
structuredClone({
a,
get value() {
structuredClone(b, { transfer: [b] });
return true;
}
}, { transfer: [a, b] });
} catch (e) { error = e.name; }
console.log(error, a.byteLength, b.byteLength);Separate builds of main and the PR gave:
Reversing the list to Which behavior should the getter-detachment regression test codify? These are focused observations, not a full-suite run. |
|
Thanks for the probe. The all-buffer precheck went beyond the HTML algorithm: step 5 checks and detaches each transfer entry in list order. I removed that precheck in |
|
@jedel1043, could you please review this PR when you have a chance? Thanks! |
|
Thanks for the correction in This addresses my transfer-order concern. This acknowledgment is based on source inspection; I have not rerun tests for this follow-up. |
|
I prepared a test-only patch extending your duplicate-transfer regression to five invalid-transfer inputs, including a valid buffer followed by an invalid entry. It checks rejection before getter access and preservation of buffer length and bytes. On head 89adadf 61cece9a, all six clone::tests:: tests passed natively on Linux, offline and locked, with 54 unrelated tests filtered out. This was a focused run, not the full suite. Would you like the patch to fold into this PR? |
Fixes #5609.
Stage
ArrayBuffertransfers until serialization succeeds, so a failed clone leaves buffers attached. Reject duplicate and detached transfer entries, and detach listed buffers even when they are unused.Tests:
cargo test -p boa_wintertc --lib(60 passed);cargo test -p boa_runtime --lib(108 passed);cargo fmt --all --check;cargo clippy -p boa_wintertc --all-targets -- -D warnings.