Merge pull request #11182 from Snuffleupagus/disableWorker-disable-Dict-postMessage

Forbid sending of `Dict`s and `Stream`s, with `postMessage`, when workers are disabled
This commit is contained in:
Tim van der Meij 2019-09-29 15:09:42 +02:00 committed by GitHub
commit 8c4f4b5eec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1463,8 +1463,14 @@ class LoopbackPort {
while (!(desc = Object.getOwnPropertyDescriptor(p, i))) {
p = Object.getPrototypeOf(p);
}
if (typeof desc.value === 'undefined' ||
typeof desc.value === 'function') {
if (typeof desc.value === 'undefined') {
continue;
}
if (typeof desc.value === 'function') {
if (value.hasOwnProperty && value.hasOwnProperty(i)) {
throw new Error(
`LoopbackPort.postMessage - cannot clone: ${value[i]}`);
}
continue;
}
result[i] = cloneValue(desc.value);