Skip to content

🎥 Make videos programmatically with React

`@remotion/studio-protocol`: Accept plain objects from other realms

Igor Samokhovetsef1d3e2015b6
diff --git a/packages/studio-protocol/src/element-drag-data.ts b/packages/studio-protocol/src/element-drag-data.ts
index 36aa07fee6..88cf38e20b 100644
--- a/packages/studio-protocol/src/element-drag-data.ts
+++ b/packages/studio-protocol/src/element-drag-data.ts
@@ -308,9 +308,11 @@ const isJsonCompatibleValue = (
}
seen.add(value);
+ // Plain objects from another realm have a different Object.prototype.
+ const prototype = Object.getPrototypeOf(value);
const valid = Array.isArray(value)
? value.every((item) => isJsonCompatibleValue(item, seen))
- : Object.getPrototypeOf(value) === Object.prototype &&
+ : (prototype === null || Object.getPrototypeOf(prototype) === null) &&
Object.values(value).every((item) => isJsonCompatibleValue(item, seen));
seen.delete(value);
return valid;