Don't allow the LoopbackPort
to "clone" a URL
Note that `URL`s aren't supported by the structured clone algorithm, see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm, and any attempt to send a `URL` using `postMessage` is rejected by the browser. Hence, for consistency when workers are disabled, the `LoopbackPort` should obviously also reject any `URL`s.
This commit is contained in:
parent
b2ffebe978
commit
0dba468e60
@ -1800,7 +1800,10 @@ class LoopbackPort {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
result = Array.isArray(value) ? [] : {};
|
||||
if (value instanceof URL) {
|
||||
throw new Error(`LoopbackPort.postMessage - cannot clone: ${value}`);
|
||||
}
|
||||
result = Array.isArray(value) ? [] : Object.create(null);
|
||||
cloned.set(value, result); // Adding to cache now for cyclic references.
|
||||
// Cloning all value and object properties, however ignoring properties
|
||||
// defined via getter.
|
||||
|
Loading…
x
Reference in New Issue
Block a user