summaryrefslogtreecommitdiff
path: root/op_crates/fetch/11_streams.js
diff options
context:
space:
mode:
authorAnonymous <65428781+00ff0000red@users.noreply.github.com>2020-11-21 08:29:18 -0800
committerGitHub <noreply@github.com>2020-11-21 17:29:18 +0100
commit27dd78601669a92d0200ad197adcf0919fdc9e46 (patch)
treed58ad7dadc8ea39d3ececb64c64a57026320c92b /op_crates/fetch/11_streams.js
parent692322cc2818a7ee573aecff98f2e0f08972b389 (diff)
fix: "cloneValue" should return a Set when given a Set (#7972)
Diffstat (limited to 'op_crates/fetch/11_streams.js')
-rw-r--r--op_crates/fetch/11_streams.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/op_crates/fetch/11_streams.js b/op_crates/fetch/11_streams.js
index 549bc9922..c3fa6cb6f 100644
--- a/op_crates/fetch/11_streams.js
+++ b/op_crates/fetch/11_streams.js
@@ -81,13 +81,14 @@
if (value instanceof Map) {
const clonedMap = new Map();
objectCloneMemo.set(value, clonedMap);
- value.forEach((v, k) => clonedMap.set(k, cloneValue(v)));
+ value.forEach((v, k) => {
+ clonedMap.set(cloneValue(k), cloneValue(v));
+ });
return clonedMap;
}
if (value instanceof Set) {
- const clonedSet = new Map();
+ const clonedSet = new Set([...value].map(cloneValue));
objectCloneMemo.set(value, clonedSet);
- value.forEach((v, k) => clonedSet.set(k, cloneValue(v)));
return clonedSet;
}
@@ -97,6 +98,7 @@
for (const key of sourceKeys) {
clonedObj[key] = cloneValue(value[key]);
}
+ Reflect.setPrototypeOf(clonedObj, Reflect.getPrototypeOf(value));
return clonedObj;
}
case "symbol":