diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2022-10-25 14:22:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-25 14:22:37 +0200 |
commit | 34fb380ed38ff324202b7779ae850edab133e577 (patch) | |
tree | 86548e0a099f6fc151e069b089a53b46ef396f3e /ext/web/06_streams.js | |
parent | a189c5393e1b106687736635fea0b8aeca283826 (diff) |
feat(ext/web): use ArrayBuffer.was_detached() (#16307)
This PR adds a way to reliably check if an ArrayBuffer was detached
Diffstat (limited to 'ext/web/06_streams.js')
-rw-r--r-- | ext/web/06_streams.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index 52488efb6..6dbf69951 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -193,7 +193,13 @@ * @returns {boolean} */ function isDetachedBuffer(O) { - return ReflectHas(O, isFakeDetached); + if (O.byteLength !== 0) { + return false; + } + // TODO(marcosc90) remove isFakeDetached once transferArrayBuffer + // actually detaches the buffer + return ReflectHas(O, isFakeDetached) || + core.ops.op_arraybuffer_was_detached(O); } /** |