Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: V8: backport dfcf1e86fac0 #37245

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.23',
'v8_embedder_string': '-node.24',

##### V8 defaults for Node.js #####

Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/common/message-template.h
Expand Up @@ -575,6 +575,8 @@ namespace internal {
T(DataCloneErrorOutOfMemory, "Data cannot be cloned, out of memory.") \
T(DataCloneErrorDetachedArrayBuffer, \
"An ArrayBuffer is detached and could not be cloned.") \
T(DataCloneErrorNonDetachableArrayBuffer, \
"ArrayBuffer is not detachable and could not be cloned.") \
T(DataCloneErrorSharedArrayBufferTransferred, \
"A SharedArrayBuffer could not be cloned. SharedArrayBuffer must not be " \
"transferred.") \
Expand Down
5 changes: 5 additions & 0 deletions deps/v8/src/objects/value-serializer.cc
Expand Up @@ -860,6 +860,11 @@ Maybe<bool> ValueSerializer::WriteJSArrayBuffer(
WriteVarint(index.FromJust());
return ThrowIfOutOfMemory();
}
if (!array_buffer->is_detachable()) {
ThrowDataCloneError(
MessageTemplate::kDataCloneErrorNonDetachableArrayBuffer);
return Nothing<bool>();
}

uint32_t* transfer_entry = array_buffer_transfer_map_.Find(array_buffer);
if (transfer_entry) {
Expand Down
7 changes: 7 additions & 0 deletions deps/v8/test/mjsunit/wasm/worker-memory.js
Expand Up @@ -11,6 +11,13 @@
assertThrows(() => worker.postMessage(memory), Error);
})();

(function TestPostMessageUnsharedMemoryBuffer() {
let worker = new Worker('', {type: 'string'});
let memory = new WebAssembly.Memory({initial: 1, maximum: 2});

assertThrows(() => worker.postMessage(memory.buffer), Error);
})();

// Can't use assert in a worker.
let workerHelpers =
`function assertTrue(value, msg) {
Expand Down