Skip to content
Closed
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
Next Next commit
fixup! worker: add typechecking for postMessage transfer list
  • Loading branch information
addaleax committed Jun 9, 2019
commit 8aac5b20816d42a4935fb2f2d145963d5bf48eb9
8 changes: 5 additions & 3 deletions src/node_messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -712,9 +712,11 @@ void MessagePort::PostMessage(const FunctionCallbackInfo<Value>& args) {
"MessagePort.postMessage");
}
if (!args[1]->IsNullOrUndefined() && !args[1]->IsObject()) {
// Browsers also do not throw on `null` or objects, although it really
// should be an array or undefined, thus the mismatch between the checks
// above and the actual error message.
// Browsers ignore null or undefined, and otherwise accept an array or an
// options object.
// TODO(addaleax): Add support for an options object and generic sequence
// support.
// Refs: https://github.com/nodejs/node/pull/28033#discussion_r289964991
return THROW_ERR_INVALID_ARG_TYPE(env,
"Optional transferList argument must be an array");
}
Expand Down