mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 13:44:08 +00:00
feat(ext/web): use ArrayBuffer.was_detached() (#16307)
This PR adds a way to reliably check if an ArrayBuffer was detached
This commit is contained in:
parent
a189c5393e
commit
34fb380ed3
4 changed files with 63 additions and 26 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue