Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! src: throw DataCloneError on transfering untransferable objects
  • Loading branch information
legendecas committed May 3, 2023
commit eb3c867b0d9cd7dc3e2d7aae0d2c574649480b3c
2 changes: 1 addition & 1 deletion doc/api/worker_threads.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ added: REPLACEME
* `object` {any} Any JavaScript value.
* Returns: {boolean}

Check is an object is marked as not transferable with
Check if an object is marked as not transferable with
[`markAsUntransferable()`][].

```js
Expand Down
10 changes: 3 additions & 7 deletions lib/internal/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const {
Float64Array,
MathFloor,
Number,
ObjectPrototypeHasOwnProperty,
Uint8Array,
} = primordials;

Expand Down Expand Up @@ -1055,15 +1054,12 @@ function markAsUntransferable(obj) {
}

// This simply checks if the object is marked as untransferable and doesn't
// check the ability to be transferred.
// check whether we are able to transfer it.
function isMarkedAsUntransferable(obj) {
if (obj == null)
return false;
// v8::Object::HasPrivate checks own properties only.
if (!ObjectPrototypeHasOwnProperty(obj, untransferable_object_private_symbol)) {
return false;
}
return obj[untransferable_object_private_symbol] === true;
// Private symbols are not inherited.
return obj[untransferable_object_private_symbol] !== undefined;
}

// A toggle used to access the zero fill setting of the array buffer allocator
Expand Down